Colibre: tdf#148029 Remove dark area in dark variant
[LibreOffice.git] / configure.ac
blob250de34971ab245eddc3f73eb18f00542a9b3308
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 100 -*-
2 dnl configure.ac serves as input for the GNU autoconf package
3 dnl in order to create a configure script.
5 # The version number in the second argument to AC_INIT should be four numbers separated by
6 # periods. Some parts of the code requires the first one to be less than 128 and the others to be less
7 # than 256. The four numbers can optionally be followed by a period and a free-form string containing
8 # no spaces or periods, like "frobozz-mumble-42" or "alpha0". If the free-form string ends with one or
9 # several non-alphanumeric characters, those are split off and used only for the
10 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
12 AC_INIT([LibreOffice],[7.4.0.0.alpha0+],[],[],[http://documentfoundation.org/])
14 dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed
15 dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard
16 dnl so check for the version of autoconf that is actually used to create the configure script
17 AC_PREREQ([2.59])
18 m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.68]), -1,
19     [AC_MSG_ERROR([at least autoconf version 2.68 is needed (you can use AUTOCONF environment variable to point to a suitable one)])])
21 if test -n "$BUILD_TYPE"; then
22     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
25 save_CC=$CC
26 save_CXX=$CXX
28 first_arg_basename()
30     for i in $1; do
31         basename "$i"
32         break
33     done
36 CC_BASE=`first_arg_basename "$CC"`
37 CXX_BASE=`first_arg_basename "$CXX"`
39 BUILD_TYPE="LibO"
40 SCPDEFS=""
41 GIT_NEEDED_SUBMODULES=""
42 LO_PATH= # used by path_munge to construct a PATH variable
44 FilterLibs()
46     # Return value: $filteredlibs
48     filteredlibs=
49     for f in $1; do
50         case "$f" in
51             # let's start with Fedora's paths for now
52             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
53                 # ignore it: on UNIXoids it is searched by default anyway
54                 # but if it's given explicitly then it may override other paths
55                 # (on macOS it would be an error to use it instead of SDK)
56                 ;;
57             *)
58                 filteredlibs="$filteredlibs $f"
59                 ;;
60         esac
61     done
64 PathFormat()
66     # Args: $1: A pathname. On Cygwin and WSL, in either the Unix or the Windows format. Note that this
67     # function is called also on Unix.
68     #
69     # Return value: $formatted_path and $formatted_path_unix.
70     #
71     # $formatted_path is the argument in Windows format, but using forward slashes instead of
72     # backslashes, using 8.3 pathname components if necessary (if it otherwise would contains spaces
73     # or shell metacharacters).
74     #
75     # $formatted_path_unix is the argument in a form usable in Cygwin or WSL, using 8.3 components if
76     # necessary. On Cygwin, it is the same as $formatted_path, but on WSL it is $formatted_path as a
77     # Unix pathname.
78     #
79     # Errors out if 8.3 names are needed but aren't present for some of the path components.
81     # Examples:
82     #
83     # /home/tml/lo/master-optimised => C:/cygwin64/home/tml/lo/master-optimised
84     #
85     # C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe => C:/PROGRA~2/MICROS~3/INSTAL~1/vswhere.exe
86     #
87     # C:\Program Files (x86)\Microsoft Visual Studio\2019\Community => C:/PROGRA~2/MICROS~3/2019/COMMUN~1
88     #
89     # C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/ucrt => C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/ucrt
90     #
91     # /cygdrive/c/PROGRA~2/WI3CF2~1/10 => C:/PROGRA~2/WI3CF2~1/10
92     #
93     # C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\ => C:/PROGRA~2/WI3CF2~1/NETFXSDK/4.8/
94     #
95     # /usr/bin/find.exe => C:/cygwin64/bin/find.exe
97     if test -n "$UNITTEST_WSL_PATHFORMAT"; then
98         printf "PathFormat $1 ==> "
99     fi
101     formatted_path="$1"
102     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
103         if test "$build_os" = "wsl"; then
104             formatted_path=$(echo "$formatted_path" | tr -d '\r')
105         fi
107         pf_conv_to_dos=
108         # spaces,parentheses,brackets,braces are problematic in pathname
109         # so are backslashes
110         case "$formatted_path" in
111             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
112                 pf_conv_to_dos="yes"
113             ;;
114         esac
115         if test "$pf_conv_to_dos" = "yes"; then
116             if test "$build_os" = "wsl"; then
117                 case "$formatted_path" in
118                     /*)
119                         formatted_path=$(wslpath -w "$formatted_path")
120                         ;;
121                 esac
122                 formatted_path=$($BUILDDIR/solenv/wsl/wsl-lo-helper.exe --8.3 "$formatted_path")
123             elif test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
124                 formatted_path=`cygpath -sm "$formatted_path"`
125             else
126                 formatted_path=`cygpath -d "$formatted_path"`
127             fi
128             if test $? -ne 0;  then
129                 AC_MSG_ERROR([path conversion failed for "$1".])
130             fi
131         fi
132         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
133         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
134         if test "$fp_count_slash$fp_count_colon" != "00"; then
135             if test "$fp_count_colon" = "0"; then
136                 new_formatted_path=`realpath "$formatted_path"`
137                 if test $? -ne 0;  then
138                     AC_MSG_WARN([realpath failed for "$formatted_path", not necessarily a problem.])
139                 else
140                     formatted_path="$new_formatted_path"
141                 fi
142             fi
143             if test "$build_os" = "wsl"; then
144                 if test "$fp_count_colon" != "0"; then
145                     formatted_path=$(wslpath "$formatted_path")
146                     local final_slash=
147                     case "$formatted_path" in
148                         */)
149                             final_slash=/
150                             ;;
151                     esac
152                     formatted_path=$(wslpath -m $formatted_path)
153                     case "$formatted_path" in
154                         */)
155                             ;;
156                         *)
157                             formatted_path="$formatted_path"$final_slash
158                             ;;
159                     esac
160                 else
161                     formatted_path=$(wslpath -m "$formatted_path")
162                 fi
163             else
164                 formatted_path=`cygpath -m "$formatted_path"`
165             fi
166             if test $? -ne 0;  then
167                 AC_MSG_ERROR([path conversion failed for "$1".])
168             fi
169         fi
170         fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
171         if test "$fp_count_space" != "0"; then
172             AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
173         fi
174     fi
175     if test "$build_os" = "wsl"; then
176         # WSL can't run Windows binaries from Windows pathnames so we need a separate return value in Unix format
177         formatted_path_unix=$(wslpath "$formatted_path")
178     else
179         # But Cygwin can
180         formatted_path_unix="$formatted_path"
181     fi
184 AbsolutePath()
186     # There appears to be no simple and portable method to get an absolute and
187     # canonical path, so we try creating the directory if does not exist and
188     # utilizing the shell and pwd.
190     # Args: $1: A possibly relative pathname
191     # Return value: $absolute_path
193     local rel="$1"
194     absolute_path=""
195     test ! -e "$rel" && mkdir -p "$rel"
196     if test -d "$rel" ; then
197         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
198         absolute_path="$(pwd)"
199         cd - > /dev/null
200     else
201         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
202     fi
205 WARNINGS_FILE=config.warn
206 WARNINGS_FILE_FOR_BUILD=config.Build.warn
207 rm -f "$WARNINGS_FILE" "$WARNINGS_FILE_FOR_BUILD"
208 have_WARNINGS="no"
209 add_warning()
211     if test "$have_WARNINGS" = "no"; then
212         echo "*************************************" > "$WARNINGS_FILE"
213         have_WARNINGS="yes"
214         if which tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
215             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
216             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
217         else
218             COLORWARN="* WARNING :"
219         fi
220     fi
221     echo "$COLORWARN $@" >> "$WARNINGS_FILE"
224 dnl Some Mac User have the bad habit of letting a lot of crap
225 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
226 dnl that confuse the build.
227 dnl For the ones that use LODE, let's be nice and protect them
228 dnl from themselves
230 mac_sanitize_path()
232     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
233 dnl a common but nevertheless necessary thing that may be in a fancy
234 dnl path location is git, so make sure we have it
235     mac_git_path=`which git 2>/dev/null`
236     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
237         mac_path="$mac_path:`dirname $mac_git_path`"
238     fi
239 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
240 dnl path location is gpg, so make sure we find it
241     mac_gpg_path=`which gpg 2>/dev/null`
242     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
243         mac_path="$mac_path:`dirname $mac_gpg_path`"
244     fi
245     PATH="$mac_path"
246     unset mac_path
247     unset mac_git_path
248     unset mac_gpg_path
251 dnl semantically test a three digits version
252 dnl $1 - $3 = minimal version
253 dnl $4 - $6 = current version
255 check_semantic_version_three()
257     test "$4" -gt "$1" \
258         -o \( "$4" -eq "$1" -a "$5" -gt "$2" \) \
259         -o \( "$4" -eq "$1" -a "$5" -eq "$2" -a "$6" -ge "$3" \)
260     return $?
263 dnl calls check_semantic_version_three with digits in named variables $1_MAJOR, $1_MINOR, $1_TINY
264 dnl $1 = current version prefix, e.g. EMSCRIPTEN => EMSCRIPTEN_
265 dnl $2 = postfix to $1, e.g. MIN => EMSCRIPTEN_MIN_
267 check_semantic_version_three_prefixed()
269     eval local MIN_MAJOR="\$${1}_${2}_MAJOR"
270     eval local MIN_MINOR="\$${1}_${2}_MINOR"
271     eval local MIN_TINY="\$${1}_${2}_TINY"
272     eval local CUR_MAJOR="\$${1}_MAJOR"
273     eval local CUR_MINOR="\$${1}_MINOR"
274     eval local CUR_TINY="\$${1}_TINY"
275     check_semantic_version_three $MIN_MAJOR $MIN_MINOR $MIN_TINY $CUR_MAJOR $CUR_MINOR $CUR_TINY
276     return $?
279 echo "********************************************************************"
280 echo "*"
281 echo "*   Running ${PACKAGE_NAME} build configuration."
282 echo "*"
283 echo "********************************************************************"
284 echo ""
286 dnl ===================================================================
287 dnl checks build and host OSes
288 dnl do this before argument processing to allow for platform dependent defaults
289 dnl ===================================================================
291 # Check for WSL (version 2, at least). But if --host is explicitly specified (to really do build for
292 # Linux on WSL) trust that.
293 if test -z "$host" -a -z "$build" -a "`wslsys -v 2>/dev/null`" != ""; then
294     ac_cv_host="x86_64-pc-wsl"
295     ac_cv_host_cpu="x86_64"
296     ac_cv_host_os="wsl"
297     ac_cv_build="$ac_cv_host"
298     ac_cv_build_cpu="$ac_cv_host_cpu"
299     ac_cv_build_os="$ac_cv_host_os"
301     # Emulation of Cygwin's cygpath command for WSL.
302     cygpath()
303     {
304         if test -n "$UNITTEST_WSL_CYGPATH"; then
305             echo -n cygpath "$@" "==> "
306         fi
308         # Cygwin's real cygpath has a plethora of options but we use only a few here.
309         local args="$@"
310         local opt
311         local opt_d opt_m opt_u opt_w opt_l opt_s opt_p
312         OPTIND=1
314         while getopts dmuwlsp opt; do
315             case "$opt" in
316                 \?)
317                     AC_MSG_ERROR([Unimplemented cygpath emulation option in invocation: cygpath $args])
318                     ;;
319                 ?)
320                     eval opt_$opt=yes
321                     ;;
322             esac
323         done
325         shift $((OPTIND-1))
327         if test $# -ne 1; then
328             AC_MSG_ERROR([Invalid cygpath emulation invocation: Pathname missing]);
329         fi
331         local input="$1"
333         local result
335         if test -n "$opt_d" -o -n "$opt_m" -o -n "$opt_w"; then
336             # Print Windows path, possibly in 8.3 form (-d) or with forward slashes (-m)
338             if test -n "$opt_u"; then
339                 AC_MSG_ERROR([Invalid cygpath invocation: Both Windows and Unix path output requested])
340             fi
342             case "$input" in
343                 /mnt/*)
344                     # A Windows file in WSL format
345                     input=$(wslpath -w "$input")
346                     ;;
347                 [[a-zA-Z]]:\\* | \\* | [[a-zA-Z]]:/* | /*)
348                     # Already in Windows format
349                     ;;
350                 /*)
351                     input=$(wslpath -w "$input")
352                     ;;
353                 *)
354                     AC_MSG_ERROR([Invalid cygpath invocation: Path '$input' is not absolute])
355                     ;;
356             esac
357             if test -n "$opt_d" -o -n "$opt_s"; then
358                 input=$($BUILDDIR/solenv/wsl/wsl-lo-helper.exe --8.3 "$input")
359             fi
360             if test -n "$opt_m"; then
361                 input="${input//\\//}"
362             fi
363             echo "$input"
364         else
365             # Print Unix path
367             case "$input" in
368                 [[a-zA-Z]]:\\* | \\* | [[a-zA-Z]]:/* | /*)
369                     wslpath -u "$input"
370                     ;;
371                 /)
372                     echo "$input"
373                     ;;
374                 *)
375                     AC_MSG_ERROR([Invalid cygpath invocation: Path '$input' is not absolute])
376                     ;;
377             esac
378         fi
379     }
381     if test -n "$UNITTEST_WSL_CYGPATH"; then
382         BUILDDIR=.
384         # Nothing special with these file names, just arbitrary ones picked to test with
385         cygpath -d /usr/lib64/ld-linux-x86-64.so.2
386         cygpath -w /usr/lib64/ld-linux-x86-64.so.2
387         cygpath -m /usr/lib64/ld-linux-x86-64.so.2
388         cygpath -m -s /usr/lib64/ld-linux-x86-64.so.2
389         # At least on my machine for instance this file does have an 8.3 name
390         cygpath -d /mnt/c/windows/WindowsUpdate.log
391         # But for instance this one doesn't
392         cygpath -w /mnt/c/windows/system32/AboutSettingsHandlers.dll
393         cygpath -ws /mnt/c/windows/WindowsUpdate.log
394         cygpath -m /mnt/c/windows/system32/AboutSettingsHandlers.dll
395         cygpath -ms /mnt/c/windows/WindowsUpdate.log
397         cygpath -u 'c:\windows\system32\AboutSettingsHandlers.dll'
398         cygpath -u 'c:/windows/system32/AboutSettingsHandlers.dll'
400         exit 0
401     fi
404 AC_CANONICAL_HOST
405 AC_CANONICAL_BUILD
407 if test -n "$UNITTEST_WSL_PATHFORMAT"; then
408     BUILDDIR=.
409     GREP=grep
411     # Use of PathFormat must be after AC_CANONICAL_BUILD above
412     PathFormat /
413     printf "$formatted_path , $formatted_path_unix\n"
415     PathFormat $PWD
416     printf "$formatted_path , $formatted_path_unix\n"
418     PathFormat "$PROGRAMFILESX86"
419     printf "$formatted_path , $formatted_path_unix\n"
421     exit 0
424 AC_MSG_CHECKING([for product name])
425 PRODUCTNAME="AC_PACKAGE_NAME"
426 if test -n "$with_product_name" -a "$with_product_name" != no; then
427     PRODUCTNAME="$with_product_name"
429 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
430     PRODUCTNAME="${PRODUCTNAME}Dev"
432 AC_MSG_RESULT([$PRODUCTNAME])
433 AC_SUBST(PRODUCTNAME)
434 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
435 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
437 dnl ===================================================================
438 dnl Our version is defined by the AC_INIT() at the top of this script.
439 dnl ===================================================================
441 AC_MSG_CHECKING([for package version])
442 if test -n "$with_package_version" -a "$with_package_version" != no; then
443     PACKAGE_VERSION="$with_package_version"
445 AC_MSG_RESULT([$PACKAGE_VERSION])
447 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
449 LIBO_VERSION_MAJOR=$1
450 LIBO_VERSION_MINOR=$2
451 LIBO_VERSION_MICRO=$3
452 LIBO_VERSION_PATCH=$4
454 LIBO_VERSION_SUFFIX=$5
456 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
457 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
458 # they get undoubled before actually passed to sed.
459 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
460 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
461 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
462 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
464 # The value for key CFBundleVersion in the Info.plist file must be a period-separated list of at most
465 # three non-negative integers. Please find more information about CFBundleVersion at
466 # https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleversion
468 # The value for key CFBundleShortVersionString in the Info.plist file must be a period-separated list
469 # of at most three non-negative integers. Please find more information about
470 # CFBundleShortVersionString at
471 # https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleshortversionstring
473 # But that is enforced only in the App Store, and we apparently want to break the rules otherwise.
475 if test "$enable_macosx_sandbox" = yes; then
476     MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
477     MACOSX_BUNDLE_VERSION=$MACOSX_BUNDLE_SHORTVERSION
478 else
479     MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.$LIBO_VERSION_MICRO.$LIBO_VERSION_PATCH
480     MACOSX_BUNDLE_VERSION=$MACOSX_BUNDLE_SHORTVERSION$LIBO_VERSION_SUFFIX
483 AC_SUBST(LIBO_VERSION_MAJOR)
484 AC_SUBST(LIBO_VERSION_MINOR)
485 AC_SUBST(LIBO_VERSION_MICRO)
486 AC_SUBST(LIBO_VERSION_PATCH)
487 AC_SUBST(LIBO_VERSION_SUFFIX)
488 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
489 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
490 AC_SUBST(MACOSX_BUNDLE_VERSION)
492 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
493 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
494 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
495 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
497 LIBO_THIS_YEAR=`date +%Y`
498 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
500 dnl ===================================================================
501 dnl Product version
502 dnl ===================================================================
503 AC_MSG_CHECKING([for product version])
504 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
505 AC_MSG_RESULT([$PRODUCTVERSION])
506 AC_SUBST(PRODUCTVERSION)
508 AC_PROG_EGREP
509 # AC_PROG_EGREP doesn't set GREP on all systems as well
510 AC_PATH_PROG(GREP, grep)
512 BUILDDIR=`pwd`
513 cd $srcdir
514 SRC_ROOT=`pwd`
515 cd $BUILDDIR
516 x_Cygwin=[\#]
518 dnl ======================================
519 dnl Required GObject introspection version
520 dnl ======================================
521 INTROSPECTION_REQUIRED_VERSION=1.32.0
523 dnl ===================================================================
524 dnl Search all the common names for GNU Make
525 dnl ===================================================================
526 AC_MSG_CHECKING([for GNU Make])
528 # try to use our own make if it is available and GNUMAKE was not already defined
529 if test -z "$GNUMAKE"; then
530     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
531         GNUMAKE="$LODE_HOME/opt/bin/make"
532     elif test -x "/opt/lo/bin/make"; then
533         GNUMAKE="/opt/lo/bin/make"
534     fi
537 GNUMAKE_WIN_NATIVE=
538 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
539     if test -n "$a"; then
540         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
541         if test $? -eq 0;  then
542             if test "$build_os" = "cygwin"; then
543                 if test -n "$($a -v | grep 'Built for Windows')" ; then
544                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
545                     GNUMAKE_WIN_NATIVE="TRUE"
546                 else
547                     GNUMAKE=`which $a`
548                 fi
549             else
550                 GNUMAKE=`which $a`
551             fi
552             break
553         fi
554     fi
555 done
556 AC_MSG_RESULT($GNUMAKE)
557 if test -z "$GNUMAKE"; then
558     AC_MSG_ERROR([not found. install GNU Make.])
559 else
560     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
561         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
562     fi
565 win_short_path_for_make()
567     local short_path="$1"
568     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
569         cygpath -sm "$short_path"
570     else
571         cygpath -u "$(cygpath -d "$short_path")"
572     fi
576 if test "$build_os" = "cygwin"; then
577     PathFormat "$SRC_ROOT"
578     SRC_ROOT="$formatted_path"
579     PathFormat "$BUILDDIR"
580     BUILDDIR="$formatted_path"
581     x_Cygwin=
582     AC_MSG_CHECKING(for explicit COMSPEC)
583     if test -z "$COMSPEC"; then
584         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
585     else
586         AC_MSG_RESULT([found: $COMSPEC])
587     fi
590 AC_SUBST(SRC_ROOT)
591 AC_SUBST(BUILDDIR)
592 AC_SUBST(x_Cygwin)
593 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
594 AC_DEFINE_UNQUOTED(SRC_ROOT,"$SRC_ROOT")
595 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
597 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
598     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
601 # need sed in os checks...
602 AC_PATH_PROGS(SED, sed)
603 if test -z "$SED"; then
604     AC_MSG_ERROR([install sed to run this script])
607 # Set the ENABLE_LTO variable
608 # ===================================================================
609 AC_MSG_CHECKING([whether to use link-time optimization])
610 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
611     ENABLE_LTO="TRUE"
612     AC_MSG_RESULT([yes])
613 else
614     ENABLE_LTO=""
615     AC_MSG_RESULT([no])
617 AC_SUBST(ENABLE_LTO)
619 AC_ARG_ENABLE(fuzz-options,
620     AS_HELP_STRING([--enable-fuzz-options],
621         [Randomly enable or disable each of those configurable options
622          that are supposed to be freely selectable without interdependencies,
623          or where bad interaction from interdependencies is automatically avoided.])
626 dnl ===================================================================
627 dnl When building for Android, --with-android-ndk,
628 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
629 dnl mandatory
630 dnl ===================================================================
632 AC_ARG_WITH(android-ndk,
633     AS_HELP_STRING([--with-android-ndk],
634         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
637 AC_ARG_WITH(android-ndk-toolchain-version,
638     AS_HELP_STRING([--with-android-ndk-toolchain-version],
639         [Specify which toolchain version to use, of those present in the
640         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
641         with_android_ndk_toolchain_version=clang5.0)
643 AC_ARG_WITH(android-sdk,
644     AS_HELP_STRING([--with-android-sdk],
645         [Specify location of the Android SDK. Mandatory when building for Android.]),
648 AC_ARG_WITH(android-api-level,
649     AS_HELP_STRING([--with-android-api-level],
650         [Specify the API level when building for Android. Defaults to 16 for ARM and x86 and to 21 for ARM64 and x86-64]),
653 ANDROID_NDK_HOME=
654 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
655     with_android_ndk="$SRC_ROOT/external/android-ndk"
657 if test -n "$with_android_ndk"; then
658     eval ANDROID_NDK_HOME=$with_android_ndk
660     # Set up a lot of pre-canned defaults
662     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
663         if test ! -f $ANDROID_NDK_HOME/source.properties; then
664             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
665         fi
666         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
667     else
668         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
669     fi
670     if test -z "$ANDROID_NDK_VERSION";  then
671         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
672     fi
673     case $ANDROID_NDK_VERSION in
674     r9*|r10*)
675         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
676         ;;
677     11.1.*|12.1.*|13.1.*|14.1.*)
678         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
679         ;;
680     16.*|17.*|18.*|19.*|20.*)
681         ;;
682     *)
683         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk.])
684         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk."
685         ;;
686     esac
688     ANDROID_API_LEVEL=16
689     if test -n "$with_android_api_level" ; then
690         ANDROID_API_LEVEL="$with_android_api_level"
691     fi
693     android_cpu=$host_cpu
694     if test $host_cpu = arm; then
695         android_platform_prefix=arm-linux-androideabi
696         android_gnu_prefix=$android_platform_prefix
697         LLVM_TRIPLE=armv7a-linux-androideabi
698         ANDROID_APP_ABI=armeabi-v7a
699         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
700     elif test $host_cpu = aarch64; then
701         android_platform_prefix=aarch64-linux-android
702         android_gnu_prefix=$android_platform_prefix
703         LLVM_TRIPLE=$android_platform_prefix
704         # minimum android version that supports aarch64
705         if test "$ANDROID_API_LEVEL" -lt "21" ; then
706             ANDROID_API_LEVEL=21
707         fi
708         ANDROID_APP_ABI=arm64-v8a
709     elif test $host_cpu = x86_64; then
710         android_platform_prefix=x86_64-linux-android
711         android_gnu_prefix=$android_platform_prefix
712         LLVM_TRIPLE=$android_platform_prefix
713         # minimum android version that supports x86_64
714         ANDROID_API_LEVEL=21
715         ANDROID_APP_ABI=x86_64
716     else
717         # host_cpu is something like "i386" or "i686" I guess, NDK uses
718         # "x86" in some contexts
719         android_cpu=x86
720         android_platform_prefix=$android_cpu
721         android_gnu_prefix=i686-linux-android
722         LLVM_TRIPLE=$android_gnu_prefix
723         ANDROID_APP_ABI=x86
724     fi
726     case "$with_android_ndk_toolchain_version" in
727     clang5.0)
728         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
729         ;;
730     *)
731         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
732     esac
734     AC_MSG_NOTICE([using the Android API level... $ANDROID_API_LEVEL])
736     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
737     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
738     # manage to link the (app-specific) single huge .so that is built for the app in
739     # android/source/ if there is debug information in a significant part of the object files.
740     # (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
741     # all objects have been built with debug information.)
742     case $build_os in
743     linux-gnu*)
744         android_HOST_TAG=linux-x86_64
745         ;;
746     darwin*)
747         android_HOST_TAG=darwin-x86_64
748         ;;
749     *)
750         AC_MSG_ERROR([We only support building for Android from Linux or macOS])
751         # ndk would also support windows and windows-x86_64
752         ;;
753     esac
754     android_TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$android_HOST_TAG
755     ANDROID_COMPILER_BIN=$android_TOOLCHAIN/bin
756     dnl TODO: NSS build uses it...
757     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION/prebuilt/$android_HOST_TAG
758     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
760     test -z "$AR" && AR=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ar
761     test -z "$NM" && NM=$ANDROID_COMPILER_BIN/$android_gnu_prefix-nm
762     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-objdump
763     test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ranlib
764     test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-strip
766     ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
767     ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
768     if test "$ENABLE_LTO" = TRUE; then
769         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
770         # $CC and $CXX when building external libraries
771         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
772     fi
774     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -stdlib=libc++"
776     if test -z "$CC"; then
777         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
778         CC_BASE="clang"
779     fi
780     if test -z "$CXX"; then
781         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
782         CXX_BASE="clang++"
783     fi
785 AC_SUBST(ANDROID_NDK_HOME)
786 AC_SUBST(ANDROID_APP_ABI)
787 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
789 dnl ===================================================================
790 dnl --with-android-sdk
791 dnl ===================================================================
792 ANDROID_SDK_HOME=
793 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
794     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
796 if test -n "$with_android_sdk"; then
797     eval ANDROID_SDK_HOME=$with_android_sdk
798     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
800 AC_SUBST(ANDROID_SDK_HOME)
802 AC_ARG_ENABLE([android-lok],
803     AS_HELP_STRING([--enable-android-lok],
804         [The Android app from the android/ subdir needs several tweaks all
805          over the place that break the LOK when used in the Online-based
806          Android app.  This switch indicates that the intent of this build is
807          actually the Online-based, non-modified LOK.])
809 ENABLE_ANDROID_LOK=
810 if test -n "$ANDROID_NDK_HOME" ; then
811     if test "$enable_android_lok" = yes; then
812         ENABLE_ANDROID_LOK=TRUE
813         AC_DEFINE(HAVE_FEATURE_ANDROID_LOK)
814         AC_MSG_NOTICE([building the Android version... for the Online-based Android app])
815     else
816         AC_MSG_NOTICE([building the Android version... for the app from the android/ subdir])
817     fi
819 AC_SUBST([ENABLE_ANDROID_LOK])
821 libo_FUZZ_ARG_ENABLE([android-editing],
822     AS_HELP_STRING([--enable-android-editing],
823         [Enable the experimental editing feature on Android.])
825 ENABLE_ANDROID_EDITING=
826 if test "$enable_android_editing" = yes; then
827     ENABLE_ANDROID_EDITING=TRUE
829 AC_SUBST([ENABLE_ANDROID_EDITING])
831 disable_database_connectivity_dependencies()
833     enable_evolution2=no
834     enable_firebird_sdbc=no
835     enable_mariadb_sdbc=no
836     enable_postgresql_sdbc=no
837     enable_report_builder=no
840 # ===================================================================
842 # Start initial platform setup
844 # The using_* variables reflect platform support and should not be
845 # changed after the "End initial platform setup" block.
846 # This is also true for most test_* variables.
847 # ===================================================================
848 build_crypto=yes
849 test_clucene=no
850 test_gdb_index=no
851 test_openldap=yes
852 test_split_debug=no
853 test_webdav=yes
854 usable_dlapi=yes
856 # There is currently just iOS not using salplug, so this explicitly enables it.
857 # must: using_freetype_fontconfig
858 #  may: using_headless_plugin defaults to $using_freetype_fontconfig
859 # must: using_x11
861 # Default values, as such probably valid just for Linux, set
862 # differently below just for Mac OSX, but at least better than
863 # hardcoding these as we used to do. Much of this is duplicated also
864 # in solenv for old build system and for gbuild, ideally we should
865 # perhaps define stuff like this only here in configure.ac?
867 LINKFLAGSSHL="-shared"
868 PICSWITCH="-fpic"
869 DLLPOST=".so"
871 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
873 INSTROOTBASESUFFIX=
874 INSTROOTCONTENTSUFFIX=
875 SDKDIRNAME=sdk
877 HOST_PLATFORM="$host"
879 host_cpu_for_clang="$host_cpu"
881 case "$host_os" in
883 solaris*)
884     using_freetype_fontconfig=yes
885     using_x11=yes
886     build_skia=yes
887     _os=SunOS
889     dnl ===========================================================
890     dnl Check whether we're using Solaris 10 - SPARC or Intel.
891     dnl ===========================================================
892     AC_MSG_CHECKING([the Solaris operating system release])
893     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
894     if test "$_os_release" -lt "10"; then
895         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
896     else
897         AC_MSG_RESULT([ok ($_os_release)])
898     fi
900     dnl Check whether we're using a SPARC or i386 processor
901     AC_MSG_CHECKING([the processor type])
902     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
903         AC_MSG_RESULT([ok ($host_cpu)])
904     else
905         AC_MSG_ERROR([only SPARC and i386 processors are supported])
906     fi
907     ;;
909 linux-gnu*|k*bsd*-gnu*|linux-musl*)
910     using_freetype_fontconfig=yes
911     using_x11=yes
912     build_skia=yes
913     test_gdb_index=yes
914     test_split_debug=yes
915     if test "$enable_fuzzers" = yes; then
916         test_system_freetype=no
917     fi
918     _os=Linux
919     ;;
921 gnu)
922     using_freetype_fontconfig=yes
923     using_x11=no
924     _os=GNU
925      ;;
927 cygwin*|wsl*)
928     # When building on Windows normally with MSVC under Cygwin,
929     # configure thinks that the host platform (the platform the
930     # built code will run on) is Cygwin, even if it obviously is
931     # Windows, which in Autoconf terminology is called
932     # "mingw32". (Which is misleading as MinGW is the name of the
933     # tool-chain, not an operating system.)
935     # Somewhat confusing, yes. But this configure script doesn't
936     # look at $host etc that much, it mostly uses its own $_os
937     # variable, set here in this case statement.
939     using_freetype_fontconfig=no
940     using_x11=no
941     test_unix_dlapi=no
942     test_openldap=no
943     test_eot=no
944     enable_pagein=no
945     build_skia=yes
946     _os=WINNT
948     DLLPOST=".dll"
949     LINKFLAGSNOUNDEFS=
951     if test "$host_cpu" = "aarch64"; then
952         build_skia=no
953         enable_gpgmepp=no
954         enable_coinmp=no
955         enable_firebird_sdbc=no
956     fi
957     ;;
959 darwin*) # macOS
960     using_freetype_fontconfig=no
961     using_x11=no
962     build_skia=yes
963     enable_pagein=no
964     test_eot=no
965     if test -n "$LODE_HOME" ; then
966         mac_sanitize_path
967         AC_MSG_NOTICE([sanitized the PATH to $PATH])
968     fi
969     _os=Darwin
970     INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
971     INSTROOTCONTENTSUFFIX=/Contents
972     SDKDIRNAME=${PRODUCTNAME_WITHOUT_SPACES}${PRODUCTVERSION}_SDK
973     # See "Default values, as such probably valid just for Linux" comment above the case "$host_os"
974     LINKFLAGSSHL="-dynamiclib -single_module"
976     # -fPIC is default
977     PICSWITCH=""
979     DLLPOST=".dylib"
981     # -undefined error is the default
982     LINKFLAGSNOUNDEFS=""
983     case "$host_cpu" in
984     aarch64|arm64)
985         # Apple's Clang uses "arm64"
986         host_cpu_for_clang=arm64
987     esac
990 ios*) # iOS
991     using_freetype_fontconfig=no
992     using_x11=no
993     build_crypto=no
994     test_libcmis=no
995     test_openldap=no
996     test_webdav=no
997     if test -n "$LODE_HOME" ; then
998         mac_sanitize_path
999         AC_MSG_NOTICE([sanitized the PATH to $PATH])
1000     fi
1001     enable_gpgmepp=no
1002     _os=iOS
1003     enable_mpl_subset=yes
1004     enable_lotuswordpro=no
1005     disable_database_connectivity_dependencies
1006     enable_coinmp=no
1007     enable_lpsolve=no
1008     enable_extension_integration=no
1009     enable_xmlhelp=no
1010     with_ppds=no
1011     if test "$enable_ios_simulator" = "yes"; then
1012         host=x86_64-apple-darwin
1013     fi
1014     # See "Default values, as such probably valid just for Linux" comment above the case "$host_os"
1015     LINKFLAGSSHL="-dynamiclib -single_module"
1017     # -fPIC is default
1018     PICSWITCH=""
1020     DLLPOST=".dylib"
1022     # -undefined error is the default
1023     LINKFLAGSNOUNDEFS=""
1025     # HOST_PLATFORM is used for external projects and their configury typically doesn't like the "ios"
1026     # part, so use aarch64-apple-darwin for now.
1027     HOST_PLATFORM=aarch64-apple-darwin
1029     # Apple's Clang uses "arm64"
1030     host_cpu_for_clang=arm64
1033 freebsd*)
1034     using_freetype_fontconfig=yes
1035     using_x11=yes
1036     build_skia=yes
1037     AC_MSG_CHECKING([the FreeBSD operating system release])
1038     if test -n "$with_os_version"; then
1039         OSVERSION="$with_os_version"
1040     else
1041         OSVERSION=`/sbin/sysctl -n kern.osreldate`
1042     fi
1043     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
1044     AC_MSG_CHECKING([which thread library to use])
1045     if test "$OSVERSION" -lt "500016"; then
1046         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1047         PTHREAD_LIBS="-pthread"
1048     elif test "$OSVERSION" -lt "502102"; then
1049         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1050         PTHREAD_LIBS="-lc_r"
1051     else
1052         PTHREAD_CFLAGS=""
1053         PTHREAD_LIBS="-pthread"
1054     fi
1055     AC_MSG_RESULT([$PTHREAD_LIBS])
1056     _os=FreeBSD
1057     ;;
1059 *netbsd*)
1060     using_freetype_fontconfig=yes
1061     using_x11=yes
1062     test_gtk3_kde5=no
1063     build_skia=yes
1064     PTHREAD_LIBS="-pthread -lpthread"
1065     _os=NetBSD
1066     ;;
1068 aix*)
1069     using_freetype_fontconfig=yes
1070     using_x11=yes
1071     test_randr=no
1072     test_gstreamer_1_0=no
1073     PTHREAD_LIBS=-pthread
1074     _os=AIX
1075     ;;
1077 openbsd*)
1078     using_freetype_fontconfig=yes
1079     using_x11=yes
1080     PTHREAD_CFLAGS="-D_THREAD_SAFE"
1081     PTHREAD_LIBS="-pthread"
1082     _os=OpenBSD
1083     ;;
1085 dragonfly*)
1086     using_freetype_fontconfig=yes
1087     using_x11=yes
1088     build_skia=yes
1089     PTHREAD_LIBS="-pthread"
1090     _os=DragonFly
1091     ;;
1093 linux-android*)
1094     # API exists, but seems not really usable since Android 7 AFAIK
1095     usable_dlapi=no
1096     using_freetype_fontconfig=yes
1097     using_headless_plugin=no
1098     using_x11=no
1099     build_crypto=no
1100     test_openldap=no
1101     test_system_freetype=no
1102     test_webdav=no
1103     disable_database_connectivity_dependencies
1104     enable_lotuswordpro=no
1105     enable_mpl_subset=yes
1106     enable_cairo_canvas=no
1107     enable_coinmp=yes
1108     enable_lpsolve=no
1109     enable_odk=no
1110     enable_python=no
1111     enable_xmlhelp=no
1112     _os=Android
1113     ;;
1115 haiku*)
1116     using_freetype_fontconfig=yes
1117     using_x11=no
1118     test_gtk3=no
1119     test_gtk3_kde5=no
1120     test_kf5=yes
1121     enable_odk=no
1122     enable_coinmp=no
1123     enable_pdfium=no
1124     enable_sdremote=no
1125     enable_postgresql_sdbc=no
1126     enable_firebird_sdbc=no
1127     _os=Haiku
1128     ;;
1130 emscripten)
1131     # API currently just exists in headers, not code
1132     usable_dlapi=no
1133     using_freetype_fontconfig=yes
1134     using_x11=no
1135     test_openldap=no
1136     test_qt5=yes
1137     test_split_debug=yes
1138     test_system_freetype=no
1139     enable_compiler_plugins=no
1140     enable_customtarget_components=yes
1141     enable_qt5=yes
1142     enable_scripting=no
1143     enable_split_debug=yes
1144     enable_wasm_strip=yes
1145     with_system_zlib=no
1146     with_theme="colibre"
1147     _os=Emscripten
1148     ;;
1151     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
1152     ;;
1153 esac
1155 AC_SUBST(HOST_PLATFORM)
1157 if test -z "$using_x11" -o -z "$using_freetype_fontconfig"; then
1158     AC_MSG_ERROR([You must set \$using_freetype_fontconfig and \$using_x11 for your platform])
1161 # Set defaults, if not set by platform
1162 test "${test_cups+set}" = set || test_cups="$using_x11"
1163 test "${test_dbus+set}" = set || test_dbus="$using_x11"
1164 test "${test_gen+set}" = set || test_gen="$using_x11"
1165 test "${test_gstreamer_1_0+set}" = set || test_gstreamer_1_0="$using_x11"
1166 test "${test_gtk3+set}" = set || test_gtk3="$using_x11"
1167 test "${test_gtk4+set}" = set || test_gtk4="$using_x11"
1168 test "${test_kf5+set}" = set || test_kf5="$using_x11"
1169 # don't handle test_qt5, so it can disable test_kf5 later
1170 test "${test_qt6+set}" = set || test_qt6="$using_x11"
1171 test "${test_randr+set}" = set || test_randr="$using_x11"
1172 test "${test_xrender+set}" = set || test_xrender="$using_x11"
1173 test "${using_headless_plugin+set}" = set || using_headless_plugin="$using_freetype_fontconfig"
1175 test "${test_gtk3_kde5+set}" != set -a "$test_kf5" = yes -a "$test_gtk3" = yes && test_gtk3_kde5="yes"
1176 # Make sure fontconfig and freetype test both either system or not
1177 test "${test_system_fontconfig+set}" != set -a "${test_system_freetype+set}" = set && test_system_fontconfig="$test_system_freetype"
1178 test "${test_system_freetype+set}" != set -a "${test_system_fontconfig+set}" = set && test_system_freetype="$test_system_fontconfig"
1180 # convenience / platform overriding "fixes"
1181 # Don't sort!
1182 test "$test_kf5" = yes -a "$test_qt5" = no && test_kf5=no
1183 test "$test_kf5" = yes && test_qt5=yes
1184 test "$test_gtk3" != yes && enable_gtk3=no
1185 test "$test_gtk3" != yes -o "$test_kf5" != yes && test_gtk3_kde5=no
1186 test "$using_freetype_fontconfig" = no && using_headless_plugin=no
1187 test "$using_freetype_fontconfig" = yes && test_cairo=yes
1189 # Keep in sync with the above $using_x11 depending test default list
1190 disable_x11_tests()
1192     test_cups=no
1193     test_dbus=no
1194     test_gen=no
1195     test_gstreamer_1_0=no
1196     test_gtk3_kde5=no
1197     test_gtk3=no
1198     test_gtk4=no
1199     test_kf5=no
1200     test_qt5=no
1201     test_qt6=no
1202     test_randr=no
1203     test_xrender=no
1206 test "$using_x11" = yes && USING_X11=TRUE
1208 if test "$using_freetype_fontconfig" = yes; then
1209     USE_HEADLESS_CODE=TRUE
1210     if test "$using_headless_plugin" = yes; then
1211         AC_DEFINE(ENABLE_HEADLESS)
1212         ENABLE_HEADLESS=TRUE
1213     fi
1214 else
1215     test_fontconfig=no
1216     test_freetype=no
1219 AC_SUBST(ENABLE_HEADLESS)
1220 AC_SUBST(USE_HEADLESS_CODE)
1222 AC_MSG_NOTICE([VCL platform has a usable dynamic loading API: $usable_dlapi])
1223 AC_MSG_NOTICE([VCL platform uses freetype+fontconfig: $using_freetype_fontconfig])
1224 AC_MSG_NOTICE([VCL platform uses headless plugin: $using_headless_plugin])
1225 AC_MSG_NOTICE([VCL platform uses X11: $using_x11])
1227 # ===================================================================
1229 # End initial platform setup
1231 # ===================================================================
1233 if test "$_os" = "Android" ; then
1234     # Verify that the NDK and SDK options are proper
1235     if test -z "$with_android_ndk"; then
1236         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
1237     elif test ! -f "$ANDROID_NDK_HOME/meta/abis.json"; then
1238         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
1239     fi
1241     if test -z "$ANDROID_SDK_HOME"; then
1242         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
1243     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
1244         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
1245     fi
1247     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
1248     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
1249         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
1250                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
1251                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
1252         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
1253         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
1254         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
1255     fi
1256     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
1257         AC_MSG_WARN([android support repository not found - install with
1258                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
1259                      to allow the build to download the specified version of the android support libraries])
1260         add_warning "android support repository not found - install with"
1261         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
1262         add_warning "to allow the build to download the specified version of the android support libraries"
1263     fi
1266 if test "$_os" = "AIX"; then
1267     AC_PATH_PROG(GAWK, gawk)
1268     if test -z "$GAWK"; then
1269         AC_MSG_ERROR([gawk not found in \$PATH])
1270     fi
1273 AC_SUBST(SDKDIRNAME)
1275 AC_SUBST(PTHREAD_CFLAGS)
1276 AC_SUBST(PTHREAD_LIBS)
1278 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
1279 # By default use the ones specified by our build system,
1280 # but explicit override is possible.
1281 AC_MSG_CHECKING(for explicit AFLAGS)
1282 if test -n "$AFLAGS"; then
1283     AC_MSG_RESULT([$AFLAGS])
1284     x_AFLAGS=
1285 else
1286     AC_MSG_RESULT(no)
1287     x_AFLAGS=[\#]
1289 AC_MSG_CHECKING(for explicit CFLAGS)
1290 if test -n "$CFLAGS"; then
1291     AC_MSG_RESULT([$CFLAGS])
1292     x_CFLAGS=
1293 else
1294     AC_MSG_RESULT(no)
1295     x_CFLAGS=[\#]
1297 AC_MSG_CHECKING(for explicit CXXFLAGS)
1298 if test -n "$CXXFLAGS"; then
1299     AC_MSG_RESULT([$CXXFLAGS])
1300     x_CXXFLAGS=
1301 else
1302     AC_MSG_RESULT(no)
1303     x_CXXFLAGS=[\#]
1305 AC_MSG_CHECKING(for explicit OBJCFLAGS)
1306 if test -n "$OBJCFLAGS"; then
1307     AC_MSG_RESULT([$OBJCFLAGS])
1308     x_OBJCFLAGS=
1309 else
1310     AC_MSG_RESULT(no)
1311     x_OBJCFLAGS=[\#]
1313 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
1314 if test -n "$OBJCXXFLAGS"; then
1315     AC_MSG_RESULT([$OBJCXXFLAGS])
1316     x_OBJCXXFLAGS=
1317 else
1318     AC_MSG_RESULT(no)
1319     x_OBJCXXFLAGS=[\#]
1321 AC_MSG_CHECKING(for explicit LDFLAGS)
1322 if test -n "$LDFLAGS"; then
1323     AC_MSG_RESULT([$LDFLAGS])
1324     x_LDFLAGS=
1325 else
1326     AC_MSG_RESULT(no)
1327     x_LDFLAGS=[\#]
1329 AC_SUBST(AFLAGS)
1330 AC_SUBST(CFLAGS)
1331 AC_SUBST(CXXFLAGS)
1332 AC_SUBST(OBJCFLAGS)
1333 AC_SUBST(OBJCXXFLAGS)
1334 AC_SUBST(LDFLAGS)
1335 AC_SUBST(x_AFLAGS)
1336 AC_SUBST(x_CFLAGS)
1337 AC_SUBST(x_CXXFLAGS)
1338 AC_SUBST(x_OBJCFLAGS)
1339 AC_SUBST(x_OBJCXXFLAGS)
1340 AC_SUBST(x_LDFLAGS)
1342 dnl These are potentially set for MSVC, in the code checking for UCRT below:
1343 my_original_CFLAGS=$CFLAGS
1344 my_original_CXXFLAGS=$CXXFLAGS
1345 my_original_CPPFLAGS=$CPPFLAGS
1347 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
1348 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
1349 dnl AC_PROG_CC internally.
1350 if test "$_os" != "WINNT"; then
1351     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
1352     save_CFLAGS=$CFLAGS
1353     AC_PROG_CC
1354     CFLAGS=$save_CFLAGS
1355     if test -z "$CC_BASE"; then
1356         CC_BASE=`first_arg_basename "$CC"`
1357     fi
1360 if test "$_os" != "WINNT"; then
1361     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
1362 else
1363     ENDIANNESS=little
1365 AC_SUBST(ENDIANNESS)
1367 if test "$usable_dlapi" != no; then
1368     AC_DEFINE([HAVE_DLAPI])
1369     if test "$test_unix_dlapi" != no; then
1370         save_LIBS="$LIBS"
1371         AC_SEARCH_LIBS([dlsym], [dl],
1372             [case "$ac_cv_search_dlsym" in -l*) UNIX_DLAPI_LIBS="$ac_cv_search_dlsym";; esac],
1373             [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
1374         LIBS="$save_LIBS"
1375         AC_DEFINE([HAVE_UNIX_DLAPI])
1376     fi
1378 AC_SUBST(UNIX_DLAPI_LIBS)
1380 # Check for a (GNU) backtrace implementation
1381 AC_ARG_VAR([BACKTRACE_CFLAGS], [Compiler flags needed to use backtrace(3)])
1382 AC_ARG_VAR([BACKTRACE_LIBS], [Linker flags needed to use backtrace(3)])
1383 AS_IF([test "x$BACKTRACE_LIBS$BACKTRACE_CFLAGS" = x], [
1384     save_LIBS="$LIBS"
1385     AC_SEARCH_LIBS([backtrace], [libexecinfo],
1386         [case "$ac_cv_search_backtrace" in -l*) BACKTRACE_LIBS="$ac_cv_search_backtrace";; esac],
1387         [PKG_CHECK_MODULES([BACKTRACE], [libexecinfo], [ac_cv_search_backtrace=], [:])])
1388     LIBS="$save_LIBS"
1390 AS_IF([test "x$ac_cv_search_backtrace" != xno ], [
1391     AC_DEFINE([HAVE_FEATURE_BACKTRACE])
1394 dnl ===================================================================
1395 dnl Sanity checks for Emscripten SDK setup
1396 dnl ===================================================================
1398 EMSCRIPTEN_MIN_MAJOR=2
1399 EMSCRIPTEN_MIN_MINOR=0
1400 EMSCRIPTEN_MIN_TINY=31
1401 EMSCRIPTEN_MIN_VERSION="${EMSCRIPTEN_MIN_MAJOR}.${EMSCRIPTEN_MIN_MINOR}.${EMSCRIPTEN_MIN_TINY}"
1403 if test "$_os" = "Emscripten"; then
1404     AC_MSG_CHECKING([if Emscripten is at least $EMSCRIPTEN_MIN_VERSION])
1405     EMSCRIPTEN_DEFINES=$(echo | emcc -dM -E - | $GREP __EMSCRIPTEN_)
1406     EMSCRIPTEN_MAJOR=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_major__ //p')
1407     EMSCRIPTEN_MINOR=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_minor__ //p')
1408     EMSCRIPTEN_TINY=$(echo "$EMSCRIPTEN_DEFINES" | $SED -ne 's/.*__EMSCRIPTEN_tiny__ //p')
1409     EMSCRIPTEN_VERSION="${EMSCRIPTEN_MAJOR}.${EMSCRIPTEN_MINOR}.${EMSCRIPTEN_TINY}"
1411     check_semantic_version_three_prefixed EMSCRIPTEN MIN
1412     if test $? -eq 0; then
1413         AC_MSG_RESULT([yes ($EMSCRIPTEN_VERSION)])
1414     else
1415         AC_MSG_ERROR([no, found $EMSCRIPTEN_VERSION])
1416     fi
1418     EMSCRIPTEN_ERROR=0
1419     if ! which emconfigure >/dev/null 2>&1; then
1420         AC_MSG_WARN([emconfigure must be in your \$PATH])
1421         EMSCRIPTEN_ERROR=1
1422     fi
1423     if test -z "$EMMAKEN_JUST_CONFIGURE"; then
1424         AC_MSG_WARN(["\$EMMAKEN_JUST_CONFIGURE wasn't set by emconfigure. Prefix configure or use autogen.sh])
1425         EMSCRIPTEN_ERROR=1
1426     fi
1427     EMSDK_FILE_PACKAGER="$(em-config EMSCRIPTEN_ROOT)"/tools/file_packager
1428     if ! test -x "$EMSDK_FILE_PACKAGER"; then
1429         AC_MSG_WARN([No file_packager found in $(em-config EMSCRIPTEN_ROOT)/tools/file_packager.])
1430         EMSCRIPTEN_ERROR=1
1431     fi
1432     if test $EMSCRIPTEN_ERROR -ne 0; then
1433         AC_MSG_ERROR(["Please fix your EMSDK setup to build with Emscripten!"])
1434     fi
1436 AC_SUBST(EMSDK_FILE_PACKAGER)
1438 ###############################################################################
1439 # Extensions switches --enable/--disable
1440 ###############################################################################
1441 # By default these should be enabled unless having extra dependencies.
1442 # If there is extra dependency over configure options then the enable should
1443 # be automagic based on whether the requiring feature is enabled or not.
1444 # All this options change anything only with --enable-extension-integration.
1446 # The name of this option and its help string makes it sound as if
1447 # extensions are built anyway, just not integrated in the installer,
1448 # if you use --disable-extension-integration. Is that really the
1449 # case?
1451 AC_ARG_ENABLE(ios-simulator,
1452     AS_HELP_STRING([--enable-ios-simulator],
1453         [build for iOS simulator])
1456 libo_FUZZ_ARG_ENABLE(extension-integration,
1457     AS_HELP_STRING([--disable-extension-integration],
1458         [Disable integration of the built extensions in the installer of the
1459          product. Use this switch to disable the integration.])
1462 AC_ARG_ENABLE(avmedia,
1463     AS_HELP_STRING([--disable-avmedia],
1464         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.]),
1465 ,test "${enable_avmedia+set}" = set || enable_avmedia=yes)
1467 AC_ARG_ENABLE(database-connectivity,
1468     AS_HELP_STRING([--disable-database-connectivity],
1469         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1472 # This doesn't mean not building (or "integrating") extensions
1473 # (although it probably should; i.e. it should imply
1474 # --disable-extension-integration I guess), it means not supporting
1475 # any extension mechanism at all
1476 libo_FUZZ_ARG_ENABLE(extensions,
1477     AS_HELP_STRING([--disable-extensions],
1478         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1481 AC_ARG_ENABLE(scripting,
1482     AS_HELP_STRING([--disable-scripting],
1483         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.]),
1484 ,test "${enable_scripting+set}" = set || enable_scripting=yes)
1486 # This is mainly for Android and iOS, but could potentially be used in some
1487 # special case otherwise, too, so factored out as a separate setting
1489 AC_ARG_ENABLE(dynamic-loading,
1490     AS_HELP_STRING([--disable-dynamic-loading],
1491         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1494 libo_FUZZ_ARG_ENABLE(report-builder,
1495     AS_HELP_STRING([--disable-report-builder],
1496         [Disable the Report Builder.])
1499 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1500     AS_HELP_STRING([--enable-ext-wiki-publisher],
1501         [Enable the Wiki Publisher extension.])
1504 libo_FUZZ_ARG_ENABLE(lpsolve,
1505     AS_HELP_STRING([--disable-lpsolve],
1506         [Disable compilation of the lp solve solver ])
1508 libo_FUZZ_ARG_ENABLE(coinmp,
1509     AS_HELP_STRING([--disable-coinmp],
1510         [Disable compilation of the CoinMP solver ])
1513 libo_FUZZ_ARG_ENABLE(pdfimport,
1514     AS_HELP_STRING([--disable-pdfimport],
1515         [Disable building the PDF import feature.])
1518 libo_FUZZ_ARG_ENABLE(pdfium,
1519     AS_HELP_STRING([--disable-pdfium],
1520         [Disable building PDFium. Results in unsecure PDF signature verification.])
1523 libo_FUZZ_ARG_ENABLE(skia,
1524     AS_HELP_STRING([--disable-skia],
1525         [Disable building Skia. Use --enable-skia=debug to build without optimizations.])
1528 ###############################################################################
1530 dnl ---------- *** ----------
1532 libo_FUZZ_ARG_ENABLE(mergelibs,
1533     AS_HELP_STRING([--enable-mergelibs],
1534         [Merge several of the smaller libraries into one big, "merged", one.])
1537 libo_FUZZ_ARG_ENABLE(breakpad,
1538     AS_HELP_STRING([--enable-breakpad],
1539         [Enables breakpad for crash reporting.])
1542 libo_FUZZ_ARG_ENABLE(crashdump,
1543     AS_HELP_STRING([--disable-crashdump],
1544         [Disable dump.ini and dump-file, when --enable-breakpad])
1547 AC_ARG_ENABLE(fetch-external,
1548     AS_HELP_STRING([--disable-fetch-external],
1549         [Disables fetching external tarballs from web sources.])
1552 AC_ARG_ENABLE(fuzzers,
1553     AS_HELP_STRING([--enable-fuzzers],
1554         [Enables building libfuzzer targets for fuzz testing.])
1557 libo_FUZZ_ARG_ENABLE(pch,
1558     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1559         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1560          Using 'system' will include only external headers, 'base' will add also headers
1561          from base modules, 'normal' will also add all headers except from the module built,
1562          'full' will use all suitable headers even from a module itself.])
1565 libo_FUZZ_ARG_ENABLE(epm,
1566     AS_HELP_STRING([--enable-epm],
1567         [LibreOffice includes self-packaging code, that requires epm, however epm is
1568          useless for large scale package building.])
1571 libo_FUZZ_ARG_ENABLE(odk,
1572     AS_HELP_STRING([--enable-odk],
1573         [Enable building the Office Development Kit, the part that extensions need to build against])
1576 AC_ARG_ENABLE(mpl-subset,
1577     AS_HELP_STRING([--enable-mpl-subset],
1578         [Don't compile any pieces which are not MPL or more liberally licensed])
1581 libo_FUZZ_ARG_ENABLE(evolution2,
1582     AS_HELP_STRING([--enable-evolution2],
1583         [Allows the built-in evolution 2 addressbook connectivity build to be
1584          enabled.])
1587 AC_ARG_ENABLE(avahi,
1588     AS_HELP_STRING([--enable-avahi],
1589         [Determines whether to use Avahi to advertise Impress to remote controls.])
1592 libo_FUZZ_ARG_ENABLE(werror,
1593     AS_HELP_STRING([--enable-werror],
1594         [Turn warnings to errors. (Has no effect in modules where the treating
1595          of warnings as errors is disabled explicitly.)]),
1598 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1599     AS_HELP_STRING([--enable-assert-always-abort],
1600         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1603 libo_FUZZ_ARG_ENABLE(dbgutil,
1604     AS_HELP_STRING([--enable-dbgutil],
1605         [Provide debugging support from --enable-debug and include additional debugging
1606          utilities such as object counting or more expensive checks.
1607          This is the recommended option for developers.
1608          Note that this makes the build ABI incompatible, it is not possible to mix object
1609          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1611 libo_FUZZ_ARG_ENABLE(debug,
1612     AS_HELP_STRING([--enable-debug],
1613         [Include debugging information, disable compiler optimization and inlining plus
1614          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1616 libo_FUZZ_ARG_ENABLE(split-debug,
1617     AS_HELP_STRING([--disable-split-debug],
1618         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1619          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1621 libo_FUZZ_ARG_ENABLE(gdb-index,
1622     AS_HELP_STRING([--disable-gdb-index],
1623         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1624          The feature requires the gold or lld linker.]))
1626 libo_FUZZ_ARG_ENABLE(sal-log,
1627     AS_HELP_STRING([--enable-sal-log],
1628         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1630 libo_FUZZ_ARG_ENABLE(symbols,
1631     AS_HELP_STRING([--enable-symbols],
1632         [Generate debug information.
1633          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1634          otherwise. It is possible to explicitly specify gbuild build targets
1635          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1636          everything in the directory; there is no ordering, more specific overrides
1637          more general, and disabling takes precedence).
1638          Example: --enable-symbols="all -sw/ -Library_sc".]))
1640 libo_FUZZ_ARG_ENABLE(optimized,
1641     AS_HELP_STRING([--enable-optimized=<yes/no/debug>],
1642         [Whether to compile with optimization flags.
1643          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1644          otherwise. Using 'debug' will try to use only optimizations that should
1645          not interfere with debugging. For Emscripten we default to optimized (-O1)
1646          debug build, as otherwise binaries become too large.]))
1648 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1649     AS_HELP_STRING([--disable-runtime-optimizations],
1650         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1651          JVM JIT) that are known to interact badly with certain dynamic analysis
1652          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1653          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1654          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1656 AC_ARG_WITH(valgrind,
1657     AS_HELP_STRING([--with-valgrind],
1658         [Make availability of Valgrind headers a hard requirement.]))
1660 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1661     AS_HELP_STRING([--enable-compiler-plugins],
1662         [Enable compiler plugins that will perform additional checks during
1663          building. Enabled automatically by --enable-dbgutil.
1664          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1665 COMPILER_PLUGINS_DEBUG=
1666 if test "$enable_compiler_plugins" = debug; then
1667     enable_compiler_plugins=yes
1668     COMPILER_PLUGINS_DEBUG=TRUE
1671 libo_FUZZ_ARG_ENABLE(compiler-plugins-analyzer-pch,
1672     AS_HELP_STRING([--disable-compiler-plugins-analyzer-pch],
1673         [Disable use of precompiled headers when running the Clang compiler plugin analyzer.  Not
1674          relevant in the --disable-compiler-plugins case.]))
1676 libo_FUZZ_ARG_ENABLE(ooenv,
1677     AS_HELP_STRING([--enable-ooenv],
1678         [Enable ooenv for the instdir installation.]))
1680 AC_ARG_ENABLE(lto,
1681     AS_HELP_STRING([--enable-lto],
1682         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1683          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1684          linker.)]))
1686 AC_ARG_ENABLE(python,
1687     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1688         [Enables or disables Python support at run-time.
1689          Also specifies what Python to use at build-time.
1690          'fully-internal' even forces the internal version for uses of Python
1691          during the build.
1692          On macOS the only choices are
1693          'internal' (default) or 'fully-internal'. Otherwise the default is 'auto'.
1694          ]))
1696 libo_FUZZ_ARG_ENABLE(gtk3,
1697     AS_HELP_STRING([--disable-gtk3],
1698         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1699 ,test "${test_gtk3}" = no -o "${enable_gtk3+set}" = set || enable_gtk3=yes)
1701 AC_ARG_ENABLE(gtk4,
1702     AS_HELP_STRING([--enable-gtk4],
1703         [Determines whether to use Gtk+ 4.0 vclplug on platforms where Gtk+ 4.0 is available.]))
1705 AC_ARG_ENABLE(introspection,
1706     AS_HELP_STRING([--enable-introspection],
1707         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1708          Linux distributions.)]))
1710 AC_ARG_ENABLE(split-app-modules,
1711     AS_HELP_STRING([--enable-split-app-modules],
1712         [Split file lists for app modules, e.g. base, calc.
1713          Has effect only with make distro-pack-install]),
1716 AC_ARG_ENABLE(split-opt-features,
1717     AS_HELP_STRING([--enable-split-opt-features],
1718         [Split file lists for some optional features, e.g. pyuno, testtool.
1719          Has effect only with make distro-pack-install]),
1722 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1723     AS_HELP_STRING([--disable-cairo-canvas],
1724         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1727 libo_FUZZ_ARG_ENABLE(dbus,
1728     AS_HELP_STRING([--disable-dbus],
1729         [Determines whether to enable features that depend on dbus.
1730          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1731 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1733 libo_FUZZ_ARG_ENABLE(sdremote,
1734     AS_HELP_STRING([--disable-sdremote],
1735         [Determines whether to enable Impress remote control (i.e. the server component).]),
1736 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1738 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1739     AS_HELP_STRING([--disable-sdremote-bluetooth],
1740         [Determines whether to build sdremote with bluetooth support.
1741          Requires dbus on Linux.]))
1743 libo_FUZZ_ARG_ENABLE(gio,
1744     AS_HELP_STRING([--disable-gio],
1745         [Determines whether to use the GIO support.]),
1746 ,test "${enable_gio+set}" = set || enable_gio=yes)
1748 AC_ARG_ENABLE(qt5,
1749     AS_HELP_STRING([--enable-qt5],
1750         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1751          available.]),
1754 AC_ARG_ENABLE(qt6,
1755     AS_HELP_STRING([--enable-qt6],
1756         [Determines whether to use Qt6 vclplug on platforms where Qt6 is
1757          available.]),
1760 AC_ARG_ENABLE(kf5,
1761     AS_HELP_STRING([--enable-kf5],
1762         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1763          KF5 are available.]),
1766 AC_ARG_ENABLE(gtk3_kde5,
1767     AS_HELP_STRING([--enable-gtk3-kde5],
1768         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1769          platforms where Gtk3, Qt5 and Plasma is available.]),
1772 AC_ARG_ENABLE(gen,
1773     AS_HELP_STRING([--enable-gen],
1774         [To select the gen backend in case of --disable-dynamic-loading.
1775          Per default auto-enabled when X11 is used.]),
1776 ,test "${test_gen}" = no -o "${enable_gen+set}" = set || enable_gen=yes)
1778 AC_ARG_ENABLE(gui,
1779     AS_HELP_STRING([--disable-gui],
1780         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1781 ,enable_gui=yes)
1783 libo_FUZZ_ARG_ENABLE(randr,
1784     AS_HELP_STRING([--disable-randr],
1785         [Disable RandR support in the vcl project.]),
1786 ,test "${enable_randr+set}" = set || enable_randr=yes)
1788 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1789     AS_HELP_STRING([--disable-gstreamer-1-0],
1790         [Disable building with the gstreamer 1.0 avmedia backend.]),
1791 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1793 libo_FUZZ_ARG_ENABLE(cve-tests,
1794     AS_HELP_STRING([--disable-cve-tests],
1795         [Prevent CVE tests to be executed]),
1798 libo_FUZZ_ARG_ENABLE(chart-tests,
1799     AS_HELP_STRING([--enable-chart-tests],
1800         [Executes chart XShape tests. In a perfect world these tests would be
1801          stable and everyone could run them, in reality it is best to run them
1802          only on a few machines that are known to work and maintained by people
1803          who can judge if a test failure is a regression or not.]),
1806 AC_ARG_ENABLE(build-opensymbol,
1807     AS_HELP_STRING([--enable-build-opensymbol],
1808         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1809          fontforge installed.]),
1812 AC_ARG_ENABLE(dependency-tracking,
1813     AS_HELP_STRING([--enable-dependency-tracking],
1814         [Do not reject slow dependency extractors.])[
1815   --disable-dependency-tracking
1816                           Disables generation of dependency information.
1817                           Speed up one-time builds.],
1820 AC_ARG_ENABLE(icecream,
1821     AS_HELP_STRING([--enable-icecream],
1822         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1823          It defaults to /opt/icecream for the location of the icecream gcc/g++
1824          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1827 AC_ARG_ENABLE(ld,
1828     AS_HELP_STRING([--enable-ld=<linker>],
1829         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1830          By default tries to use the best linker possible, use --disable-ld to use the default linker.
1831          If <linker> contains any ':', the part before the first ':' is used as the value of
1832          -fuse-ld, while the part after the first ':' is used as the value of --ld-path (which is
1833          needed for Clang 12).]),
1836 libo_FUZZ_ARG_ENABLE(cups,
1837     AS_HELP_STRING([--disable-cups],
1838         [Do not build cups support.])
1841 AC_ARG_ENABLE(ccache,
1842     AS_HELP_STRING([--disable-ccache],
1843         [Do not try to use ccache automatically.
1844          By default we will try to detect if ccache is available; in that case if
1845          CC/CXX are not yet set, and --enable-icecream is not given, we
1846          attempt to use ccache. --disable-ccache disables ccache completely.
1847          Additionally ccache's depend mode is enabled if possible,
1848          use --enable-ccache=nodepend to enable ccache without depend mode.
1852 AC_ARG_ENABLE(z7-debug,
1853     AS_HELP_STRING([--enable-z7-debug],
1854         [Makes the MSVC compiler use -Z7 for debugging instead of the default -Zi. Using this option takes
1855          more disk spaces but allows to use ccache. Final PDB files are created even with this option enabled.
1856          Enabled by default if ccache is detected.]))
1858 libo_FUZZ_ARG_ENABLE(online-update,
1859     AS_HELP_STRING([--enable-online-update],
1860         [Enable the online update service that will check for new versions of
1861          LibreOffice. Disabled by default. Requires --with-privacy-policy-url to be set.
1862          If the value is "mar", the experimental Mozilla-like update will be
1863          enabled instead of the traditional update mechanism.]),
1866 AC_ARG_WITH(update-config,
1867     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1868                    [Path to the update config ini file]))
1870 libo_FUZZ_ARG_ENABLE(extension-update,
1871     AS_HELP_STRING([--disable-extension-update],
1872         [Disable possibility to update installed extensions.]),
1875 libo_FUZZ_ARG_ENABLE(release-build,
1876     AS_HELP_STRING([--enable-release-build],
1877         [Enable release build. Note that the "release build" choice is orthogonal to
1878          whether symbols are present, debug info is generated, or optimization
1879          is done.
1880          See http://wiki.documentfoundation.org/Development/DevBuild]),
1883 AC_ARG_ENABLE(windows-build-signing,
1884     AS_HELP_STRING([--enable-windows-build-signing],
1885         [Enable signing of windows binaries (*.exe, *.dll)]),
1888 AC_ARG_ENABLE(silent-msi,
1889     AS_HELP_STRING([--enable-silent-msi],
1890         [Enable MSI with LIMITUI=1 (silent install).]),
1893 AC_ARG_ENABLE(macosx-code-signing,
1894     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1895         [Sign executables, dylibs, frameworks and the app bundle. If you
1896          don't provide an identity the first suitable certificate
1897          in your keychain is used.]),
1900 AC_ARG_ENABLE(macosx-package-signing,
1901     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1902         [Create a .pkg suitable for uploading to the Mac App Store and sign
1903          it. If you don't provide an identity the first suitable certificate
1904          in your keychain is used.]),
1907 AC_ARG_ENABLE(macosx-sandbox,
1908     AS_HELP_STRING([--enable-macosx-sandbox],
1909         [Make the app bundle run in a sandbox. Requires code signing.
1910          Is required by apps distributed in the Mac App Store, and implies
1911          adherence to App Store rules.]),
1914 AC_ARG_WITH(macosx-bundle-identifier,
1915     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1916         [Define the macOS bundle identifier. Default is the somewhat weird
1917          org.libreoffice.script ("script", huh?).]),
1918 ,with_macosx_bundle_identifier=org.libreoffice.script)
1920 AC_ARG_WITH(product-name,
1921     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1922         [Define the product name. Default is AC_PACKAGE_NAME.]),
1923 ,with_product_name=$PRODUCTNAME)
1925 libo_FUZZ_ARG_ENABLE(community-flavor,
1926     AS_HELP_STRING([--disable-community-flavor],
1927         [Disable the Community branding.]),
1930 AC_ARG_WITH(package-version,
1931     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1932         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1935 libo_FUZZ_ARG_ENABLE(readonly-installset,
1936     AS_HELP_STRING([--enable-readonly-installset],
1937         [Prevents any attempts by LibreOffice to write into its installation. That means
1938          at least that no "system-wide" extensions can be added. Partly experimental work in
1939          progress, probably not fully implemented. Always enabled for macOS.]),
1942 libo_FUZZ_ARG_ENABLE(mariadb-sdbc,
1943     AS_HELP_STRING([--disable-mariadb-sdbc],
1944         [Disable the build of the MariaDB/MySQL-SDBC driver.])
1947 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1948     AS_HELP_STRING([--disable-postgresql-sdbc],
1949         [Disable the build of the PostgreSQL-SDBC driver.])
1952 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1953     AS_HELP_STRING([--disable-lotuswordpro],
1954         [Disable the build of the Lotus Word Pro filter.]),
1955 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1957 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1958     AS_HELP_STRING([--disable-firebird-sdbc],
1959         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1960 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1962 AC_ARG_ENABLE(bogus-pkg-config,
1963     AS_HELP_STRING([--enable-bogus-pkg-config],
1964         [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.]),
1967 AC_ARG_ENABLE(openssl,
1968     AS_HELP_STRING([--disable-openssl],
1969         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1970          components will use NSS. Work in progress,
1971          use only if you are hacking on it.]),
1972 ,enable_openssl=yes)
1974 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1975     AS_HELP_STRING([--enable-cipher-openssl-backend],
1976         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1977          Requires --enable-openssl.]))
1979 AC_ARG_ENABLE(nss,
1980     AS_HELP_STRING([--disable-nss],
1981         [Disable using NSS. If disabled,
1982          components will use openssl. Work in progress,
1983          use only if you are hacking on it.]),
1984 ,enable_nss=yes)
1986 AC_ARG_ENABLE(library-bin-tar,
1987     AS_HELP_STRING([--enable-library-bin-tar],
1988         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1989         Some libraries can save their build result in a tarball
1990         stored in TARFILE_LOCATION. That binary tarball is
1991         uniquely identified by the source tarball,
1992         the content of the config_host.mk file and the content
1993         of the top-level directory in core for that library
1994         If this option is enabled, then if such a tarfile exist, it will be untarred
1995         instead of the source tarfile, and the build step will be skipped for that
1996         library.
1997         If a proper tarfile does not exist, then the normal source-based
1998         build is done for that library and a proper binary tarfile is created
1999         for the next time.]),
2002 AC_ARG_ENABLE(dconf,
2003     AS_HELP_STRING([--disable-dconf],
2004         [Disable the dconf configuration backend (enabled by default where
2005          available).]))
2007 libo_FUZZ_ARG_ENABLE(formula-logger,
2008     AS_HELP_STRING(
2009         [--enable-formula-logger],
2010         [Enable formula logger for logging formula calculation flow in Calc.]
2011     )
2014 AC_ARG_ENABLE(ldap,
2015     AS_HELP_STRING([--disable-ldap],
2016         [Disable LDAP support.]),
2017 ,enable_ldap=yes)
2019 AC_ARG_ENABLE(opencl,
2020     AS_HELP_STRING([--disable-opencl],
2021         [Disable OpenCL support.]),
2022 ,enable_opencl=yes)
2024 libo_FUZZ_ARG_ENABLE(librelogo,
2025     AS_HELP_STRING([--disable-librelogo],
2026         [Do not build LibreLogo.]),
2027 ,enable_librelogo=yes)
2029 AC_ARG_ENABLE(wasm-strip,
2030     AS_HELP_STRING([--enable-wasm-strip],
2031         [Strip the static build like for WASM/emscripten platform.]),
2034 AC_ARG_ENABLE(wasm-exceptions,
2035     AS_HELP_STRING([--enable-wasm-exceptions],
2036         [Build with native WASM exceptions (AKA -fwasm-exceptions),
2037         matter of fact, this is currently not finished by any implementation)
2038         (see https://webassembly.org/roadmap/ for the current state]),
2041 AC_ARG_ENABLE(xmlhelp,
2042     AS_HELP_STRING([--disable-xmlhelp],
2043         [Disable XML help support]),
2044 ,enable_xmlhelp=yes)
2046 AC_ARG_ENABLE(customtarget-components,
2047     AS_HELP_STRING([--enable-customtarget-components],
2048         [Generates the static UNO object constructor mapping from the build.]))
2050 dnl ===================================================================
2051 dnl Optional Packages (--with/without-)
2052 dnl ===================================================================
2054 AC_ARG_WITH(gcc-home,
2055     AS_HELP_STRING([--with-gcc-home],
2056         [Specify the location of gcc/g++ manually. This can be used in conjunction
2057          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
2058          non-default path.]),
2061 AC_ARG_WITH(gnu-patch,
2062     AS_HELP_STRING([--with-gnu-patch],
2063         [Specify location of GNU patch on Solaris or FreeBSD.]),
2066 AC_ARG_WITH(build-platform-configure-options,
2067     AS_HELP_STRING([--with-build-platform-configure-options],
2068         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
2071 AC_ARG_WITH(gnu-cp,
2072     AS_HELP_STRING([--with-gnu-cp],
2073         [Specify location of GNU cp on Solaris or FreeBSD.]),
2076 AC_ARG_WITH(external-tar,
2077     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
2078         [Specify an absolute path of where to find (and store) tarfiles.]),
2079     TARFILE_LOCATION=$withval ,
2082 AC_ARG_WITH(referenced-git,
2083     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
2084         [Specify another checkout directory to reference. This makes use of
2085                  git submodule update --reference, and saves a lot of diskspace
2086                  when having multiple trees side-by-side.]),
2087     GIT_REFERENCE_SRC=$withval ,
2090 AC_ARG_WITH(linked-git,
2091     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
2092         [Specify a directory where the repositories of submodules are located.
2093          This uses a method similar to git-new-workdir to get submodules.]),
2094     GIT_LINK_SRC=$withval ,
2097 AC_ARG_WITH(galleries,
2098     AS_HELP_STRING([--with-galleries],
2099         [Specify how galleries should be built. It is possible either to
2100          build these internally from source ("build"),
2101          or to disable them ("no")]),
2104 AC_ARG_WITH(theme,
2105     AS_HELP_STRING([--with-theme="theme1 theme2..."],
2106         [Choose which themes to include. By default those themes with an '*' are included.
2107          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg,
2108          *colibre, *colibre_svg, *colibre_dark, *colibre_dark_svg,
2109          *elementary, *elementary_svg,
2110          *karasa_jaga, *karasa_jaga_svg,
2111          *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg,
2112          *sukapura, *sukapura_svg.]),
2115 libo_FUZZ_ARG_WITH(helppack-integration,
2116     AS_HELP_STRING([--without-helppack-integration],
2117         [It will not integrate the helppacks to the installer
2118          of the product. Please use this switch to use the online help
2119          or separate help packages.]),
2122 libo_FUZZ_ARG_WITH(fonts,
2123     AS_HELP_STRING([--without-fonts],
2124         [LibreOffice includes some third-party fonts to provide a reliable basis for
2125          help content, templates, samples, etc. When these fonts are already
2126          known to be available on the system then you should use this option.]),
2129 AC_ARG_WITH(epm,
2130     AS_HELP_STRING([--with-epm],
2131         [Decides which epm to use. Default is to use the one from the system if
2132          one is built. When either this is not there or you say =internal epm
2133          will be built.]),
2136 AC_ARG_WITH(package-format,
2137     AS_HELP_STRING([--with-package-format],
2138         [Specify package format(s) for LibreOffice installation sets. The
2139          implicit --without-package-format leads to no installation sets being
2140          generated. Possible values: aix, archive, bsd, deb, dmg,
2141          installed, msi, pkg, and rpm.
2142          Example: --with-package-format='deb rpm']),
2145 AC_ARG_WITH(tls,
2146     AS_HELP_STRING([--with-tls],
2147         [Decides which TLS/SSL and cryptographic implementations to use for
2148          LibreOffice's code. Notice that this doesn't apply for depending
2149          libraries like "curl", for example. Default is to use NSS
2150          although OpenSSL is also possible. Notice that selecting NSS restricts
2151          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
2152          restrict by now the usage of NSS in LO's code. Possible values:
2153          openssl, nss. Example: --with-tls="nss"]),
2156 AC_ARG_WITH(system-libs,
2157     AS_HELP_STRING([--with-system-libs],
2158         [Use libraries already on system -- enables all --with-system-* flags.]),
2161 AC_ARG_WITH(system-bzip2,
2162     AS_HELP_STRING([--with-system-bzip2],
2163         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
2164     [with_system_bzip2="$with_system_libs"])
2166 AC_ARG_WITH(system-headers,
2167     AS_HELP_STRING([--with-system-headers],
2168         [Use headers already on system -- enables all --with-system-* flags for
2169          external packages whose headers are the only entities used i.e.
2170          boost/odbc/sane-header(s).]),,
2171     [with_system_headers="$with_system_libs"])
2173 AC_ARG_WITH(system-jars,
2174     AS_HELP_STRING([--without-system-jars],
2175         [When building with --with-system-libs, also the needed jars are expected
2176          on the system. Use this to disable that]),,
2177     [with_system_jars="$with_system_libs"])
2179 AC_ARG_WITH(system-cairo,
2180     AS_HELP_STRING([--with-system-cairo],
2181         [Use cairo libraries already on system.  Happens automatically for
2182          (implicit) --enable-gtk3.]))
2184 AC_ARG_WITH(system-epoxy,
2185     AS_HELP_STRING([--with-system-epoxy],
2186         [Use epoxy libraries already on system.  Happens automatically for
2187          (implicit) --enable-gtk3.]),,
2188        [with_system_epoxy="$with_system_libs"])
2190 AC_ARG_WITH(myspell-dicts,
2191     AS_HELP_STRING([--with-myspell-dicts],
2192         [Adds myspell dictionaries to the LibreOffice installation set]),
2195 AC_ARG_WITH(system-dicts,
2196     AS_HELP_STRING([--without-system-dicts],
2197         [Do not use dictionaries from system paths.]),
2200 AC_ARG_WITH(external-dict-dir,
2201     AS_HELP_STRING([--with-external-dict-dir],
2202         [Specify external dictionary dir.]),
2205 AC_ARG_WITH(external-hyph-dir,
2206     AS_HELP_STRING([--with-external-hyph-dir],
2207         [Specify external hyphenation pattern dir.]),
2210 AC_ARG_WITH(external-thes-dir,
2211     AS_HELP_STRING([--with-external-thes-dir],
2212         [Specify external thesaurus dir.]),
2215 AC_ARG_WITH(system-zlib,
2216     AS_HELP_STRING([--with-system-zlib],
2217         [Use zlib already on system.]),,
2218     [with_system_zlib=auto])
2220 AC_ARG_WITH(system-jpeg,
2221     AS_HELP_STRING([--with-system-jpeg],
2222         [Use jpeg already on system.]),,
2223     [with_system_jpeg="$with_system_libs"])
2225 AC_ARG_WITH(system-expat,
2226     AS_HELP_STRING([--with-system-expat],
2227         [Use expat already on system.]),,
2228     [with_system_expat="$with_system_libs"])
2230 AC_ARG_WITH(system-libxml,
2231     AS_HELP_STRING([--with-system-libxml],
2232         [Use libxml/libxslt already on system.]),,
2233     [with_system_libxml=auto])
2235 AC_ARG_WITH(system-ucpp,
2236     AS_HELP_STRING([--with-system-ucpp],
2237         [Use ucpp already on system.]),,
2238     [])
2240 AC_ARG_WITH(system-openldap,
2241     AS_HELP_STRING([--with-system-openldap],
2242         [Use the OpenLDAP LDAP SDK already on system.]),,
2243     [with_system_openldap="$with_system_libs"])
2245 libo_FUZZ_ARG_ENABLE(poppler,
2246     AS_HELP_STRING([--disable-poppler],
2247         [Disable building Poppler.])
2250 AC_ARG_WITH(system-poppler,
2251     AS_HELP_STRING([--with-system-poppler],
2252         [Use system poppler (only needed for PDF import).]),,
2253     [with_system_poppler="$with_system_libs"])
2255 AC_ARG_WITH(system-abseil,
2256     AS_HELP_STRING([--with-system-abseil],
2257         [Use the abseil libraries already on system.]),,
2258     [with_system_abseil="$with_system_libs"])
2260 AC_ARG_WITH(system-openjpeg,
2261     AS_HELP_STRING([--with-system-openjpeg],
2262         [Use the OpenJPEG library already on system.]),,
2263     [with_system_openjpeg="$with_system_libs"])
2265 libo_FUZZ_ARG_ENABLE(gpgmepp,
2266     AS_HELP_STRING([--disable-gpgmepp],
2267         [Disable building gpgmepp. Do not use in normal cases unless you want to fix potential problems it causes.])
2270 AC_ARG_WITH(system-gpgmepp,
2271     AS_HELP_STRING([--with-system-gpgmepp],
2272         [Use gpgmepp already on system]),,
2273     [with_system_gpgmepp="$with_system_libs"])
2275 AC_ARG_WITH(system-mariadb,
2276     AS_HELP_STRING([--with-system-mariadb],
2277         [Use MariaDB/MySQL libraries already on system.]),,
2278     [with_system_mariadb="$with_system_libs"])
2280 AC_ARG_ENABLE(bundle-mariadb,
2281     AS_HELP_STRING([--enable-bundle-mariadb],
2282         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
2285 AC_ARG_WITH(system-postgresql,
2286     AS_HELP_STRING([--with-system-postgresql],
2287         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
2288          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
2289     [with_system_postgresql="$with_system_libs"])
2291 AC_ARG_WITH(libpq-path,
2292     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
2293         [Use this PostgreSQL C interface (libpq) installation for building
2294          the PostgreSQL-SDBC extension.]),
2297 AC_ARG_WITH(system-firebird,
2298     AS_HELP_STRING([--with-system-firebird],
2299         [Use Firebird libraries already on system, for building the Firebird-SDBC
2300          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
2301     [with_system_firebird="$with_system_libs"])
2303 AC_ARG_WITH(system-libtommath,
2304             AS_HELP_STRING([--with-system-libtommath],
2305                            [Use libtommath already on system]),,
2306             [with_system_libtommath="$with_system_libs"])
2308 AC_ARG_WITH(system-hsqldb,
2309     AS_HELP_STRING([--with-system-hsqldb],
2310         [Use hsqldb already on system.]))
2312 AC_ARG_WITH(hsqldb-jar,
2313     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
2314         [Specify path to jarfile manually.]),
2315     HSQLDB_JAR=$withval)
2317 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
2318     AS_HELP_STRING([--disable-scripting-beanshell],
2319         [Disable support for scripts in BeanShell.]),
2323 AC_ARG_WITH(system-beanshell,
2324     AS_HELP_STRING([--with-system-beanshell],
2325         [Use beanshell already on system.]),,
2326     [with_system_beanshell="$with_system_jars"])
2328 AC_ARG_WITH(beanshell-jar,
2329     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
2330         [Specify path to jarfile manually.]),
2331     BSH_JAR=$withval)
2333 libo_FUZZ_ARG_ENABLE(scripting-javascript,
2334     AS_HELP_STRING([--disable-scripting-javascript],
2335         [Disable support for scripts in JavaScript.]),
2339 AC_ARG_WITH(system-rhino,
2340     AS_HELP_STRING([--with-system-rhino],
2341         [Use rhino already on system.]),,)
2342 #    [with_system_rhino="$with_system_jars"])
2343 # Above is not used as we have different debug interface
2344 # patched into internal rhino. This code needs to be fixed
2345 # before we can enable it by default.
2347 AC_ARG_WITH(rhino-jar,
2348     AS_HELP_STRING([--with-rhino-jar=JARFILE],
2349         [Specify path to jarfile manually.]),
2350     RHINO_JAR=$withval)
2352 AC_ARG_WITH(system-jfreereport,
2353     AS_HELP_STRING([--with-system-jfreereport],
2354         [Use JFreeReport already on system.]),,
2355     [with_system_jfreereport="$with_system_jars"])
2357 AC_ARG_WITH(sac-jar,
2358     AS_HELP_STRING([--with-sac-jar=JARFILE],
2359         [Specify path to jarfile manually.]),
2360     SAC_JAR=$withval)
2362 AC_ARG_WITH(libxml-jar,
2363     AS_HELP_STRING([--with-libxml-jar=JARFILE],
2364         [Specify path to jarfile manually.]),
2365     LIBXML_JAR=$withval)
2367 AC_ARG_WITH(flute-jar,
2368     AS_HELP_STRING([--with-flute-jar=JARFILE],
2369         [Specify path to jarfile manually.]),
2370     FLUTE_JAR=$withval)
2372 AC_ARG_WITH(jfreereport-jar,
2373     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
2374         [Specify path to jarfile manually.]),
2375     JFREEREPORT_JAR=$withval)
2377 AC_ARG_WITH(liblayout-jar,
2378     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
2379         [Specify path to jarfile manually.]),
2380     LIBLAYOUT_JAR=$withval)
2382 AC_ARG_WITH(libloader-jar,
2383     AS_HELP_STRING([--with-libloader-jar=JARFILE],
2384         [Specify path to jarfile manually.]),
2385     LIBLOADER_JAR=$withval)
2387 AC_ARG_WITH(libformula-jar,
2388     AS_HELP_STRING([--with-libformula-jar=JARFILE],
2389         [Specify path to jarfile manually.]),
2390     LIBFORMULA_JAR=$withval)
2392 AC_ARG_WITH(librepository-jar,
2393     AS_HELP_STRING([--with-librepository-jar=JARFILE],
2394         [Specify path to jarfile manually.]),
2395     LIBREPOSITORY_JAR=$withval)
2397 AC_ARG_WITH(libfonts-jar,
2398     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
2399         [Specify path to jarfile manually.]),
2400     LIBFONTS_JAR=$withval)
2402 AC_ARG_WITH(libserializer-jar,
2403     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
2404         [Specify path to jarfile manually.]),
2405     LIBSERIALIZER_JAR=$withval)
2407 AC_ARG_WITH(libbase-jar,
2408     AS_HELP_STRING([--with-libbase-jar=JARFILE],
2409         [Specify path to jarfile manually.]),
2410     LIBBASE_JAR=$withval)
2412 AC_ARG_WITH(system-odbc,
2413     AS_HELP_STRING([--with-system-odbc],
2414         [Use the odbc headers already on system.]),,
2415     [with_system_odbc="auto"])
2417 AC_ARG_WITH(system-sane,
2418     AS_HELP_STRING([--with-system-sane],
2419         [Use sane.h already on system.]),,
2420     [with_system_sane="$with_system_headers"])
2422 AC_ARG_WITH(system-bluez,
2423     AS_HELP_STRING([--with-system-bluez],
2424         [Use bluetooth.h already on system.]),,
2425     [with_system_bluez="$with_system_headers"])
2427 AC_ARG_WITH(system-boost,
2428     AS_HELP_STRING([--with-system-boost],
2429         [Use boost already on system.]),,
2430     [with_system_boost="$with_system_headers"])
2432 AC_ARG_WITH(system-cuckoo,
2433     AS_HELP_STRING([--with-system-cuckoo],
2434         [Use libcuckoo already on system.]),,
2435     [with_system_cuckoo="$with_system_headers"])
2437 AC_ARG_WITH(system-dragonbox,
2438     AS_HELP_STRING([--with-system-dragonbox],
2439         [Use dragonbox already on system.]),,
2440     [with_system_dragonbox="$with_system_headers"])
2442 AC_ARG_WITH(system-libfixmath,
2443     AS_HELP_STRING([--with-system-libfixmath],
2444         [Use libfixmath already on system.]),,
2445     [with_system_libfixmath="$with_system_libs"])
2447 AC_ARG_WITH(system-glm,
2448     AS_HELP_STRING([--with-system-glm],
2449         [Use glm already on system.]),,
2450     [with_system_glm="$with_system_headers"])
2452 AC_ARG_WITH(system-hunspell,
2453     AS_HELP_STRING([--with-system-hunspell],
2454         [Use libhunspell already on system.]),,
2455     [with_system_hunspell="$with_system_libs"])
2457 libo_FUZZ_ARG_ENABLE(zxing,
2458     AS_HELP_STRING([--disable-zxing],
2459        [Disable use of zxing external library.]))
2461 AC_ARG_WITH(system-zxing,
2462     AS_HELP_STRING([--with-system-zxing],
2463         [Use libzxing already on system.]),,
2464     [with_system_zxing="$with_system_libs"])
2466 AC_ARG_WITH(system-box2d,
2467     AS_HELP_STRING([--with-system-box2d],
2468         [Use box2d already on system.]),,
2469     [with_system_box2d="$with_system_libs"])
2471 AC_ARG_WITH(system-mythes,
2472     AS_HELP_STRING([--with-system-mythes],
2473         [Use mythes already on system.]),,
2474     [with_system_mythes="$with_system_libs"])
2476 AC_ARG_WITH(system-altlinuxhyph,
2477     AS_HELP_STRING([--with-system-altlinuxhyph],
2478         [Use ALTLinuxhyph already on system.]),,
2479     [with_system_altlinuxhyph="$with_system_libs"])
2481 AC_ARG_WITH(system-lpsolve,
2482     AS_HELP_STRING([--with-system-lpsolve],
2483         [Use lpsolve already on system.]),,
2484     [with_system_lpsolve="$with_system_libs"])
2486 AC_ARG_WITH(system-coinmp,
2487     AS_HELP_STRING([--with-system-coinmp],
2488         [Use CoinMP already on system.]),,
2489     [with_system_coinmp="$with_system_libs"])
2491 AC_ARG_WITH(system-liblangtag,
2492     AS_HELP_STRING([--with-system-liblangtag],
2493         [Use liblangtag library already on system.]),,
2494     [with_system_liblangtag="$with_system_libs"])
2496 AC_ARG_WITH(system-lockfile,
2497     AS_HELP_STRING([--with-system-lockfile[=file]],
2498         [Detect a system lockfile program or use the \$file argument.]))
2500 AC_ARG_WITH(webdav,
2501     AS_HELP_STRING([--without-webdav],
2502         [Disable WebDAV support in the UCB.]))
2504 AC_ARG_WITH(linker-hash-style,
2505     AS_HELP_STRING([--with-linker-hash-style],
2506         [Use linker with --hash-style=<style> when linking shared objects.
2507          Possible values: "sysv", "gnu", "both". The default value is "gnu"
2508          if supported on the build system, and "sysv" otherwise.]))
2510 AC_ARG_WITH(jdk-home,
2511     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
2512         [If you have installed JDK 9 or later on your system please supply the
2513          path here. Note that this is not the location of the java command but the
2514          location of the entire distribution. In case of cross-compiling, this
2515          is the JDK of the host os. Use --with-build-platform-configure-options
2516          to point to a different build platform JDK.]),
2519 AC_ARG_WITH(help,
2520     AS_HELP_STRING([--with-help],
2521         [Enable the build of help. There is a special parameter "common" that
2522          can be used to bundle only the common part, .e.g help-specific icons.
2523          This is useful when you build the helpcontent separately.])
2524     [
2525                           Usage:     --with-help    build the old local help
2526                                  --without-help     no local help (default)
2527                                  --with-help=html   build the new HTML local help
2528                                  --with-help=online build the new HTML online help
2529     ],
2532 AC_ARG_WITH(omindex,
2533    AS_HELP_STRING([--with-omindex],
2534         [Enable the support of xapian-omega index for online help.])
2535    [
2536                          Usage: --with-omindex=server prepare the pages for omindex
2537                                 but let xapian-omega be built in server.
2538                                 --with-omindex=noxap do not prepare online pages
2539                                 for xapian-omega
2540   ],
2543 libo_FUZZ_ARG_WITH(java,
2544     AS_HELP_STRING([--with-java=<java command>],
2545         [Specify the name of the Java interpreter command. Typically "java"
2546          which is the default.
2548          To build without support for Java components, applets, accessibility
2549          or the XML filters written in Java, use --without-java or --with-java=no.]),
2550     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2551     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2554 AC_ARG_WITH(jvm-path,
2555     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2556         [Use a specific JVM search path at runtime.
2557          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2560 AC_ARG_WITH(ant-home,
2561     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2562         [If you have installed Apache Ant on your system, please supply the path here.
2563          Note that this is not the location of the Ant binary but the location
2564          of the entire distribution.]),
2567 AC_ARG_WITH(symbol-config,
2568     AS_HELP_STRING([--with-symbol-config],
2569         [Configuration for the crashreport symbol upload]),
2570         [],
2571         [with_symbol_config=no])
2573 AC_ARG_WITH(export-validation,
2574     AS_HELP_STRING([--without-export-validation],
2575         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2576 ,with_export_validation=auto)
2578 AC_ARG_WITH(bffvalidator,
2579     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2580         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2581          Requires installed Microsoft Office Binary File Format Validator.
2582          Note: export-validation (--with-export-validation) is required to be turned on.
2583          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2584 ,with_bffvalidator=no)
2586 libo_FUZZ_ARG_WITH(junit,
2587     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2588         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2589          --without-junit disables those tests. Not relevant in the --without-java case.]),
2590 ,with_junit=yes)
2592 AC_ARG_WITH(hamcrest,
2593     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2594         [Specifies the hamcrest jar file to use for JUnit-based tests.
2595          --without-junit disables those tests. Not relevant in the --without-java case.]),
2596 ,with_hamcrest=yes)
2598 AC_ARG_WITH(perl-home,
2599     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2600         [If you have installed Perl 5 Distribution, on your system, please
2601          supply the path here. Note that this is not the location of the Perl
2602          binary but the location of the entire distribution.]),
2605 libo_FUZZ_ARG_WITH(doxygen,
2606     AS_HELP_STRING(
2607         [--with-doxygen=<absolute path to doxygen executable>],
2608         [Specifies the doxygen executable to use when generating ODK C/C++
2609          documentation. --without-doxygen disables generation of ODK C/C++
2610          documentation. Not relevant in the --disable-odk case.]),
2611 ,with_doxygen=yes)
2613 AC_ARG_WITH(visual-studio,
2614     AS_HELP_STRING([--with-visual-studio=<2019/2022>],
2615         [Specify which Visual Studio version to use in case several are
2616          installed. Currently 2019 (default) and 2022 are supported.]),
2619 AC_ARG_WITH(windows-sdk,
2620     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10.0>],
2621         [Specify which Windows SDK, or "Windows Kit", version to use
2622          in case the one that came with the selected Visual Studio
2623          is not what you want for some reason. Note that not all compiler/SDK
2624          combinations are supported. The intent is that this option should not
2625          be needed.]),
2628 AC_ARG_WITH(lang,
2629     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2630         [Use this option to build LibreOffice with additional UI language support.
2631          English (US) is always included by default.
2632          Separate multiple languages with space.
2633          For all languages, use --with-lang=ALL.]),
2636 AC_ARG_WITH(locales,
2637     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2638         [Use this option to limit the locale information built in.
2639          Separate multiple locales with space.
2640          Very experimental and might well break stuff.
2641          Just a desperate measure to shrink code and data size.
2642          By default all the locales available is included.
2643          Just works with --disable-dynloading. Defaults to "ALL".
2644          This option is completely unrelated to --with-lang.])
2645     [
2646                           Affects also our character encoding conversion
2647                           tables for encodings mainly targeted for a
2648                           particular locale, like EUC-CN and EUC-TW for
2649                           zh, ISO-2022-JP for ja.
2651                           Affects also our add-on break iterator data for
2652                           some languages.
2654                           For the default, all locales, don't use this switch at all.
2655                           Specifying just the language part of a locale means all matching
2656                           locales will be included.
2657     ],
2660 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2661 libo_FUZZ_ARG_WITH(krb5,
2662     AS_HELP_STRING([--with-krb5],
2663         [Enable MIT Kerberos 5 support in modules that support it.
2664          By default automatically enabled on platforms
2665          where a good system Kerberos 5 is available.]),
2668 libo_FUZZ_ARG_WITH(gssapi,
2669     AS_HELP_STRING([--with-gssapi],
2670         [Enable GSSAPI support in modules that support it.
2671          By default automatically enabled on platforms
2672          where a good system GSSAPI is available.]),
2675 AC_ARG_WITH(iwyu,
2676     AS_HELP_STRING([--with-iwyu],
2677         [Use given IWYU binary path to check unneeded includes instead of building.
2678          Use only if you are hacking on it.]),
2681 libo_FUZZ_ARG_WITH(lxml,
2682     AS_HELP_STRING([--without-lxml],
2683         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2684          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2685          report widget classes and ids.]),
2688 libo_FUZZ_ARG_WITH(latest-c++,
2689     AS_HELP_STRING([--with-latest-c++],
2690         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2691          published standard.]),,
2692         [with_latest_c__=no])
2694 dnl ===================================================================
2695 dnl Branding
2696 dnl ===================================================================
2698 AC_ARG_WITH(branding,
2699     AS_HELP_STRING([--with-branding=/path/to/images],
2700         [Use given path to retrieve branding images set.])
2701     [
2702                           Search for intro.png about.svg and logo.svg.
2703                           If any is missing, default ones will be used instead.
2705                           Search also progress.conf for progress
2706                           settings on intro screen :
2708                           PROGRESSBARCOLOR="255,255,255" Set color of
2709                           progress bar. Comma separated RGB decimal values.
2710                           PROGRESSSIZE="407,6" Set size of progress bar.
2711                           Comma separated decimal values (width, height).
2712                           PROGRESSPOSITION="61,317" Set position of progress
2713                           bar from left,top. Comma separated decimal values.
2714                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2715                           bar frame. Comma separated RGB decimal values.
2716                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2717                           bar text. Comma separated RGB decimal values.
2718                           PROGRESSTEXTBASELINE="287" Set vertical position of
2719                           progress bar text from top. Decimal value.
2721                           Default values will be used if not found.
2722     ],
2726 AC_ARG_WITH(extra-buildid,
2727     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2728         [Show addition build identification in about dialog.]),
2732 AC_ARG_WITH(vendor,
2733     AS_HELP_STRING([--with-vendor="John the Builder"],
2734         [Set vendor of the build.]),
2737 AC_ARG_WITH(privacy-policy-url,
2738     AS_HELP_STRING([--with-privacy-policy-url="https://yourdomain/privacy-policy"],
2739         [The URL to your privacy policy (needed when
2740          enabling online-update or crashreporting via breakpad)]),
2741         [if test "x$with_privacy_policy_url" = "xyes"; then
2742             AC_MSG_FAILURE([you need to specify an argument when using --with-privacy-policy-url])
2743          elif test "x$with_privacy_policy_url" = "xno"; then
2744             with_privacy_policy_url="undefined"
2745          fi]
2746 ,[with_privacy_policy_url="undefined"])
2748 AC_ARG_WITH(android-package-name,
2749     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2750         [Set Android package name of the build.]),
2753 AC_ARG_WITH(compat-oowrappers,
2754     AS_HELP_STRING([--with-compat-oowrappers],
2755         [Install oo* wrappers in parallel with
2756          lo* ones to keep backward compatibility.
2757          Has effect only with make distro-pack-install]),
2760 AC_ARG_WITH(os-version,
2761     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2762         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2765 AC_ARG_WITH(idlc-cpp,
2766     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2767         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2770 AC_ARG_WITH(parallelism,
2771     AS_HELP_STRING([--with-parallelism],
2772         [Number of jobs to run simultaneously during build. Parallel builds can
2773         save a lot of time on multi-cpu machines. Defaults to the number of
2774         CPUs on the machine, unless you configure --enable-icecream - then to
2775         40.]),
2778 AC_ARG_WITH(all-tarballs,
2779     AS_HELP_STRING([--with-all-tarballs],
2780         [Download all external tarballs unconditionally]))
2782 AC_ARG_WITH(gdrive-client-id,
2783     AS_HELP_STRING([--with-gdrive-client-id],
2784         [Provides the client id of the application for OAuth2 authentication
2785         on Google Drive. If either this or --with-gdrive-client-secret is
2786         empty, the feature will be disabled]),
2789 AC_ARG_WITH(gdrive-client-secret,
2790     AS_HELP_STRING([--with-gdrive-client-secret],
2791         [Provides the client secret of the application for OAuth2
2792         authentication on Google Drive. If either this or
2793         --with-gdrive-client-id is empty, the feature will be disabled]),
2796 AC_ARG_WITH(alfresco-cloud-client-id,
2797     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2798         [Provides the client id of the application for OAuth2 authentication
2799         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2800         empty, the feature will be disabled]),
2803 AC_ARG_WITH(alfresco-cloud-client-secret,
2804     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2805         [Provides the client secret of the application for OAuth2
2806         authentication on Alfresco Cloud. If either this or
2807         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2810 AC_ARG_WITH(onedrive-client-id,
2811     AS_HELP_STRING([--with-onedrive-client-id],
2812         [Provides the client id of the application for OAuth2 authentication
2813         on OneDrive. If either this or --with-onedrive-client-secret is
2814         empty, the feature will be disabled]),
2817 AC_ARG_WITH(onedrive-client-secret,
2818     AS_HELP_STRING([--with-onedrive-client-secret],
2819         [Provides the client secret of the application for OAuth2
2820         authentication on OneDrive. If either this or
2821         --with-onedrive-client-id is empty, the feature will be disabled]),
2823 dnl ===================================================================
2824 dnl Do we want to use pre-build binary tarball for recompile
2825 dnl ===================================================================
2827 if test "$enable_library_bin_tar" = "yes" ; then
2828     USE_LIBRARY_BIN_TAR=TRUE
2829 else
2830     USE_LIBRARY_BIN_TAR=
2832 AC_SUBST(USE_LIBRARY_BIN_TAR)
2834 dnl ===================================================================
2835 dnl Test whether build target is Release Build
2836 dnl ===================================================================
2837 AC_MSG_CHECKING([whether build target is Release Build])
2838 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2839     AC_MSG_RESULT([no])
2840     ENABLE_RELEASE_BUILD=
2841     GET_TASK_ALLOW_ENTITLEMENT='
2842         <!-- We want to be able to debug a hardened process when not building for release -->
2843         <key>com.apple.security.get-task-allow</key>
2844         <true/>'
2845 else
2846     AC_MSG_RESULT([yes])
2847     ENABLE_RELEASE_BUILD=TRUE
2848     GET_TASK_ALLOW_ENTITLEMENT=''
2850 AC_SUBST(ENABLE_RELEASE_BUILD)
2851 AC_SUBST(GET_TASK_ALLOW_ENTITLEMENT)
2853 AC_MSG_CHECKING([whether to build a Community flavor])
2854 if test -z "$enable_community_flavor" -o "$enable_community_flavor" = "yes"; then
2855     AC_DEFINE(HAVE_FEATURE_COMMUNITY_FLAVOR)
2856     AC_MSG_RESULT([yes])
2857 else
2858     AC_MSG_RESULT([no])
2861 dnl ===================================================================
2862 dnl Test whether to sign Windows Build
2863 dnl ===================================================================
2864 AC_MSG_CHECKING([whether to sign windows build])
2865 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2866     AC_MSG_RESULT([yes])
2867     WINDOWS_BUILD_SIGNING="TRUE"
2868 else
2869     AC_MSG_RESULT([no])
2870     WINDOWS_BUILD_SIGNING="FALSE"
2872 AC_SUBST(WINDOWS_BUILD_SIGNING)
2874 dnl ===================================================================
2875 dnl MacOSX build and runtime environment options
2876 dnl ===================================================================
2878 AC_ARG_WITH(macosx-version-min-required,
2879     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2880         [set the minimum OS version needed to run the built LibreOffice])
2881     [
2882                           e. g.: --with-macosx-version-min-required=10.13
2883     ],
2886 dnl ===================================================================
2887 dnl Check for incompatible options set by fuzzing, and reset those
2888 dnl automatically to working combinations
2889 dnl ===================================================================
2891 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2892         "$enable_dbus" != "$enable_avahi"; then
2893     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2894     enable_avahi=$enable_dbus
2897 add_lopath_after ()
2899     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2900         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2901     fi
2904 add_lopath_before ()
2906     local IFS=${P_SEP}
2907     local path_cleanup
2908     local dir
2909     for dir in $LO_PATH ; do
2910         if test "$dir" != "$1" ; then
2911             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2912         fi
2913     done
2914     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2917 dnl ===================================================================
2918 dnl check for required programs (grep, awk, sed, bash)
2919 dnl ===================================================================
2921 pathmunge ()
2923     local new_path
2924     if test -n "$1"; then
2925         if test "$build_os" = "cygwin"; then
2926             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2927                 PathFormat "$1"
2928                 new_path=`cygpath -sm "$formatted_path"`
2929             else
2930                 PathFormat "$1"
2931                 new_path=`cygpath -u "$formatted_path"`
2932             fi
2933         else
2934             new_path="$1"
2935         fi
2936         if test "$2" = "after"; then
2937             add_lopath_after "$new_path"
2938         else
2939             add_lopath_before "$new_path"
2940         fi
2941     fi
2944 AC_PROG_AWK
2945 AC_PATH_PROG( AWK, $AWK)
2946 if test -z "$AWK"; then
2947     AC_MSG_ERROR([install awk to run this script])
2950 AC_PATH_PROG(BASH, bash)
2951 if test -z "$BASH"; then
2952     AC_MSG_ERROR([bash not found in \$PATH])
2954 AC_SUBST(BASH)
2956 # prefer parallel compression tools, if available
2957 AC_PATH_PROG(COMPRESSIONTOOL, pigz)
2958 if test -z "$COMPRESSIONTOOL"; then
2959     AC_PATH_PROG(COMPRESSIONTOOL, gzip)
2960     if test -z "$COMPRESSIONTOOL"; then
2961         AC_MSG_ERROR([gzip not found in \$PATH])
2962     fi
2964 AC_SUBST(COMPRESSIONTOOL)
2966 AC_MSG_CHECKING([for GNU or BSD tar])
2967 for a in $GNUTAR gtar gnutar tar bsdtar /usr/sfw/bin/gtar; do
2968     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2969     if test $? -eq 0;  then
2970         GNUTAR=$a
2971         break
2972     fi
2973 done
2974 AC_MSG_RESULT($GNUTAR)
2975 if test -z "$GNUTAR"; then
2976     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2978 AC_SUBST(GNUTAR)
2980 AC_MSG_CHECKING([for tar's option to strip components])
2981 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2982 if test $? -eq 0; then
2983     STRIP_COMPONENTS="--strip-components"
2984 else
2985     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2986     if test $? -eq 0; then
2987         STRIP_COMPONENTS="--strip-path"
2988     else
2989         STRIP_COMPONENTS="unsupported"
2990     fi
2992 AC_MSG_RESULT($STRIP_COMPONENTS)
2993 if test x$STRIP_COMPONENTS = xunsupported; then
2994     AC_MSG_ERROR([you need a tar that is able to strip components.])
2996 AC_SUBST(STRIP_COMPONENTS)
2998 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2999 dnl desktop OSes from "mobile" ones.
3001 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
3002 dnl In other words, that when building for an OS that is not a
3003 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
3005 dnl Note the direction of the implication; there is no assumption that
3006 dnl cross-compiling would imply a non-desktop OS.
3008 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
3009     BUILD_TYPE="$BUILD_TYPE DESKTOP"
3010     AC_DEFINE(HAVE_FEATURE_DESKTOP)
3011     if test "$_os" != Emscripten; then
3012         AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
3013     fi
3016 # explicitly doesn't include enable_gtk3=no and enable_qt5=yes, so it should
3017 # also work with the default gtk3 plugin.
3018 if test "$enable_wasm_strip" = "yes"; then
3019     enable_avmedia=no
3020     enable_cmis=no
3021     enable_coinmp=no
3022     enable_cups=no
3023     test "$_os" = Emscripten && enable_curl=no
3024     enable_database_connectivity=no
3025     enable_dbus=no
3026     enable_dconf=no
3027     test "${enable_dynamic_loading+set}" = set -o "$_os" != Emscripten || enable_dynamic_loading=no
3028     enable_extension_integration=no
3029     enable_extensions=no
3030     enable_extension_update=no
3031     enable_gio=no
3032     enable_gpgmepp=no
3033     enable_ldap=no
3034     enable_lotuswordpro=no
3035     enable_lpsolve=no
3036     enable_nss=no
3037     enable_odk=no
3038     enable_online_update=no
3039     enable_opencl=no
3040     enable_pdfimport=no
3041     enable_randr=no
3042     enable_report_builder=no
3043     enable_scripting=no
3044     enable_sdremote_bluetooth=no
3045     enable_skia=no
3046     enable_xmlhelp=no
3047     enable_zxing=no
3048     test_libepubgen=no
3049     test_libcdr=no
3050     test_libcmis=no
3051     test_libetonyek=no
3052     test_libfreehand=no
3053     test_libmspub=no
3054     test_libpagemaker=no
3055     test_libqxp=no
3056     test_libvisio=no
3057     test_libzmf=no
3058     test_webdav=no
3059     with_galleries=no
3060     with_webdav=no
3061     with_x=no
3063     test "${with_fonts+set}" = set || with_fonts=yes
3064     test "${with_locales+set}" = set || with_locales=en
3066     AC_DEFINE(ENABLE_WASM_STRIP_ACCESSIBILITY)
3067     AC_DEFINE(ENABLE_WASM_STRIP_CANVAS)
3068 #    AC_DEFINE(ENABLE_WASM_STRIP_CHART)
3069     AC_DEFINE(ENABLE_WASM_STRIP_DBACCESS)
3070     AC_DEFINE(ENABLE_WASM_STRIP_EPUB)
3071     AC_DEFINE(ENABLE_WASM_STRIP_EXTRA)
3072     AC_DEFINE(ENABLE_WASM_STRIP_GUESSLANG)
3073 #    AC_DEFINE(ENABLE_WASM_STRIP_HUNSPELL)
3074     AC_DEFINE(ENABLE_WASM_STRIP_PINGUSER)
3075     AC_DEFINE(ENABLE_WASM_STRIP_PREMULTIPLY)
3076     AC_DEFINE(ENABLE_WASM_STRIP_RECENT)
3077     AC_DEFINE(ENABLE_WASM_STRIP_RECOVERYUI)
3078     AC_DEFINE(ENABLE_WASM_STRIP_SPLASH)
3079     AC_DEFINE(ENABLE_WASM_STRIP_SWEXPORTS)
3082 EMSCRIPTEN_NEH_MAJOR=3
3083 EMSCRIPTEN_NEH_MINOR=1
3084 EMSCRIPTEN_NEH_TINY=3
3085 EMSCRIPTEN_NEH_VERSION="${EMSCRIPTEN_NEH_MAJOR}.${EMSCRIPTEN_NEH_MINOR}.${EMSCRIPTEN_NEH_TINY}"
3087 if test "$enable_wasm_exceptions" = yes; then
3088     AC_MSG_CHECKING([if Emscripten version is at least $EMSCRIPTEN_NEH_VERSION for SjLj + native EH])
3089     check_semantic_version_three_prefixed EMSCRIPTEN NEH
3090     if test $? -ne 0; then
3091         AC_MSG_ERROR([no, found $EMSCRIPTEN_VERSION])
3092     else
3093         AC_MSG_RESULT([yes ($EMSCRIPTEN_VERSION)])
3094     fi
3095     ENABLE_WASM_EXCEPTIONS=TRUE
3097 AC_SUBST(ENABLE_WASM_EXCEPTIONS)
3099 # Whether to build "avmedia" functionality or not.
3101 if test "$enable_avmedia" = yes; then
3102     BUILD_TYPE="$BUILD_TYPE AVMEDIA"
3103     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
3104 else
3105     test_gstreamer_1_0=no
3108 # Decide whether to build database connectivity stuff (including Base) or not.
3109 if test "$enable_database_connectivity" != no; then
3110     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
3111     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
3112 else
3113     if test "$_os" = iOS; then
3114         AC_MSG_ERROR([Presumly can't disable DB connectivity on iOS.])
3115     fi
3116     disable_database_connectivity_dependencies
3119 if test -z "$enable_extensions"; then
3120     # For iOS and Android Viewer, disable extensions unless specifically overridden with --enable-extensions.
3121     if test $_os != iOS && test $_os != Android -o "$ENABLE_ANDROID_LOK" = TRUE ; then
3122         enable_extensions=yes
3123     fi
3126 DISABLE_SCRIPTING=''
3127 if test "$enable_scripting" = yes; then
3128     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
3129     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
3130 else
3131     DISABLE_SCRIPTING='TRUE'
3132     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
3135 if test $_os = iOS -o $_os = Android -o $_os = Emscripten; then
3136     # Disable dynamic_loading always for iOS and Android
3137     enable_dynamic_loading=no
3138 elif test -z "$enable_dynamic_loading"; then
3139     # Otherwise enable it unless specifically disabled
3140     enable_dynamic_loading=yes
3143 DISABLE_DYNLOADING=''
3144 if test "$enable_dynamic_loading" = yes; then
3145     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
3146 else
3147     DISABLE_DYNLOADING='TRUE'
3148     if test $_os != iOS -a $_os != Android; then
3149         enable_database_connectivity=no
3150         enable_nss=no
3151         enable_odk=no
3152         enable_python=no
3153         enable_skia=no
3154         with_java=no
3155     fi
3157 AC_SUBST(DISABLE_DYNLOADING)
3159 ENABLE_CUSTOMTARGET_COMPONENTS=
3160 if test "$enable_customtarget_components" = yes -a "$DISABLE_DYNLOADING" = TRUE; then
3161     ENABLE_CUSTOMTARGET_COMPONENTS=TRUE
3162     if test -n "$with_locales" -a "$with_locales" != en -a "$with_locales" != ALL; then
3163         AC_MSG_ERROR([Currently just --with-locales=all or en is supported with --enable-customtarget-components])
3164     fi
3166 AC_SUBST(ENABLE_CUSTOMTARGET_COMPONENTS)
3168 if test "$enable_extensions" = yes; then
3169     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
3170     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
3171 else
3172     enable_extension_integration=no
3173     enable_extension_update=no
3176 # remember SYSBASE value
3177 AC_SUBST(SYSBASE)
3179 dnl ===================================================================
3180 dnl  Sort out various gallery compilation options
3181 dnl ===================================================================
3182 WITH_GALLERY_BUILD=TRUE
3183 AC_MSG_CHECKING([how to build and package galleries])
3184 if test -n "${with_galleries}"; then
3185     if test "$with_galleries" = "build"; then
3186         if test "$enable_database_connectivity" = no; then
3187             AC_MSG_ERROR([DB connectivity is needed for gengal / svx])
3188         fi
3189         AC_MSG_RESULT([build from source images internally])
3190     elif test "$with_galleries" = "no"; then
3191         WITH_GALLERY_BUILD=
3192         AC_MSG_RESULT([disable non-internal gallery build])
3193     else
3194         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
3195     fi
3196 else
3197     if test $_os != iOS -a $_os != Android; then
3198         AC_MSG_RESULT([internal src images for desktop])
3199     else
3200         WITH_GALLERY_BUILD=
3201         AC_MSG_RESULT([disable src image build])
3202     fi
3204 AC_SUBST(WITH_GALLERY_BUILD)
3206 dnl ===================================================================
3207 dnl  Checks if ccache is available
3208 dnl ===================================================================
3209 CCACHE_DEPEND_MODE=
3210 if test "$enable_ccache" = "no"; then
3211     CCACHE=""
3212 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
3213     case "%$CC%$CXX%" in
3214     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
3215     # assume that's good then
3216     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
3217         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
3218         CCACHE_DEPEND_MODE=1
3219         ;;
3220     *)
3221         # try to use our own ccache if it is available and CCACHE was not already defined
3222         if test -z "$CCACHE"; then
3223             if test "$_os" = "WINNT"; then
3224                 ccache_ext=.exe # e.g. openssl build needs ccache.exe, not just ccache
3225             fi
3226             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/ccache$ccache_ext" ; then
3227                 CCACHE="$LODE_HOME/opt/bin/ccache$ccache_ext"
3228             elif test -x "/opt/lo/bin/ccache$ccache_ext"; then
3229                 CCACHE="/opt/lo/bin/ccache$ccache_ext"
3230             fi
3231         fi
3232         AC_PATH_PROG([CCACHE],[ccache],[not found])
3233         if test "$CCACHE" != "not found" -a "$_os" = "WINNT"; then
3234             CCACHE=`win_short_path_for_make "$CCACHE"`
3235             # check that it has MSVC support (it should recognize it in CCACHE_COMPILERTYPE)
3236             rm -f conftest.txt
3237             AC_MSG_CHECKING([whether $CCACHE has MSVC support])
3238             CCACHE_COMPILERTYPE=cl CCACHE_LOGFILE=conftest.txt $CCACHE echo >/dev/null 2>/dev/null
3239             if grep -q 'Config: (environment) compiler_type = cl' conftest.txt; then
3240                 AC_MSG_RESULT(yes)
3241             else
3242                 AC_MSG_RESULT(no)
3243                 CCACHE="not found"
3244             fi
3245             rm -f conftest.txt
3246         fi
3247         if test "$CCACHE" = "not found" -a "$_os" = "WINNT"; then
3248             # on windows/VC perhaps sccache is around?
3249             case "%$CC%$CXX%" in
3250             # If $CC and/or $CXX already contain "sccache" (possibly suffixed with some version number etc),
3251             # assume that's good then
3252             *%sccache[[-_' ']]*|*/sccache[[-_' ']]*)
3253                 AC_MSG_NOTICE([sccache seems to be included in a pre-defined CC and/or CXX])
3254                 CCACHE_DEPEND_MODE=1
3255                 SCCACHE=1
3256                 ;;
3257             *)
3258                 # for sharing code below, reuse CCACHE env var
3259                 AC_PATH_PROG([CCACHE],[sccache],[not found])
3260                 if test "$CCACHE" != "not found"; then
3261                     CCACHE=`win_short_path_for_make "$CCACHE"`
3262                     SCCACHE=1
3263                     CCACHE_DEPEND_MODE=1
3264                 fi
3265                 ;;
3266             esac
3267         fi
3268         if test "$CCACHE" = "not found"; then
3269             CCACHE=""
3270         fi
3271         if test -n "$CCACHE" -a -z "$SCCACHE"; then
3272             CCACHE_DEPEND_MODE=1
3273             # Need to check for ccache version: otherwise prevents
3274             # caching of the results (like "-x objective-c++" for Mac)
3275             if test $_os = Darwin -o $_os = iOS; then
3276                 # Check ccache version
3277                 AC_MSG_CHECKING([whether version of ccache is suitable])
3278                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
3279                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3280                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
3281                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
3282                 else
3283                     AC_MSG_RESULT([no, $CCACHE_VERSION])
3284                     CCACHE=""
3285                     CCACHE_DEPEND_MODE=
3286                 fi
3287             fi
3288         fi
3289         ;;
3290     esac
3291 else
3292     CCACHE=""
3294 if test "$enable_ccache" = "nodepend"; then
3295     CCACHE_DEPEND_MODE=""
3297 AC_SUBST(CCACHE_DEPEND_MODE)
3299 # sccache defaults are good enough
3300 if test "$CCACHE" != "" -a -z "$SCCACHE"; then
3301     # e.g. (/home/rene/.config/ccache/ccache.conf) max_size = 20.0G
3302     # -p works with both 4.2 and 4.4
3303     ccache_size_msg=$([$CCACHE -p | $AWK /max_size/'{ print $4 }' | sed -e 's/\.[0-9]*//'])
3304     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
3305     if test "$ccache_size" = ""; then
3306         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
3307         if test "$ccache_size" = ""; then
3308             ccache_size=0
3309         fi
3310         # we could not determine the size or it was less than 1GB -> disable auto-ccache
3311         if test $ccache_size -lt 1024; then
3312             CCACHE=""
3313             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
3314             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
3315         else
3316             # warn that ccache may be too small for debug build
3317             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3318             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3319         fi
3320     else
3321         if test $ccache_size -lt 5; then
3322             #warn that ccache may be too small for debug build
3323             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3324             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3325         fi
3326     fi
3329 ENABLE_Z7_DEBUG=
3330 if test "$enable_z7_debug" != no; then
3331     if test "$enable_z7_debug" = yes -o -n "$CCACHE"; then
3332         ENABLE_Z7_DEBUG=TRUE
3333     fi
3334 else
3335     AC_MSG_WARN([ccache will not work with --disable-z7-debug])
3336     add_warning "ccache will not work with --disable-z7-debug"
3338 AC_SUBST(ENABLE_Z7_DEBUG)
3340 dnl ===================================================================
3341 dnl  Checks for C compiler,
3342 dnl  The check for the C++ compiler is later on.
3343 dnl ===================================================================
3344 if test "$_os" != "WINNT"; then
3345     GCC_HOME_SET="true"
3346     AC_MSG_CHECKING([gcc home])
3347     if test -z "$with_gcc_home"; then
3348         if test "$enable_icecream" = "yes"; then
3349             if test -d "/usr/lib/icecc/bin"; then
3350                 GCC_HOME="/usr/lib/icecc/"
3351             elif test -d "/usr/libexec/icecc/bin"; then
3352                 GCC_HOME="/usr/libexec/icecc/"
3353             elif test -d "/opt/icecream/bin"; then
3354                 GCC_HOME="/opt/icecream/"
3355             else
3356                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
3358             fi
3359         else
3360             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
3361             GCC_HOME_SET="false"
3362         fi
3363     else
3364         GCC_HOME="$with_gcc_home"
3365     fi
3366     AC_MSG_RESULT($GCC_HOME)
3367     AC_SUBST(GCC_HOME)
3369     if test "$GCC_HOME_SET" = "true"; then
3370         if test -z "$CC"; then
3371             CC="$GCC_HOME/bin/gcc"
3372             CC_BASE="gcc"
3373         fi
3374         if test -z "$CXX"; then
3375             CXX="$GCC_HOME/bin/g++"
3376             CXX_BASE="g++"
3377         fi
3378     fi
3381 COMPATH=`dirname "$CC"`
3382 if test "$COMPATH" = "."; then
3383     AC_PATH_PROGS(COMPATH, $CC)
3384     dnl double square bracket to get single because of M4 quote...
3385     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
3387 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
3389 dnl ===================================================================
3390 dnl Java support
3391 dnl ===================================================================
3392 AC_MSG_CHECKING([whether to build with Java support])
3393 if test "$with_java" != "no"; then
3394     if test "$DISABLE_SCRIPTING" = TRUE; then
3395         AC_MSG_RESULT([no, overridden by --disable-scripting])
3396         ENABLE_JAVA=""
3397         with_java=no
3398     else
3399         AC_MSG_RESULT([yes])
3400         ENABLE_JAVA="TRUE"
3401         AC_DEFINE(HAVE_FEATURE_JAVA)
3402     fi
3403 else
3404     AC_MSG_RESULT([no])
3405     ENABLE_JAVA=""
3408 AC_SUBST(ENABLE_JAVA)
3410 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
3412 dnl ENABLE_JAVA="" indicate no Java support at all
3414 dnl ===================================================================
3415 dnl Check macOS SDK and compiler
3416 dnl ===================================================================
3418 if test $_os = Darwin; then
3420     # The SDK in the currently selected Xcode should be found.
3422     AC_MSG_CHECKING([what macOS SDK to use])
3423     for macosx_sdk in 12.3 12.1 12.0 11.3 11.1 11.0 10.15 10.14 10.13; do
3424         MACOSX_SDK_PATH=`xcrun --sdk macosx${macosx_sdk} --show-sdk-path 2> /dev/null`
3425         if test -d "$MACOSX_SDK_PATH"; then
3426             break
3427         else
3428             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${macosx_sdk}.sdk"
3429             if test -d "$MACOSX_SDK_PATH"; then
3430                 break
3431             fi
3432         fi
3433     done
3434     if test ! -d "$MACOSX_SDK_PATH"; then
3435         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
3436     fi
3438     AC_MSG_RESULT([macOS SDK $macosx_sdk at $MACOSX_SDK_PATH])
3440     case $macosx_sdk in
3441     10.13)
3442         MACOSX_SDK_VERSION=101300
3443         ;;
3444     10.14)
3445         MACOSX_SDK_VERSION=101400
3446         ;;
3447     10.15)
3448         MACOSX_SDK_VERSION=101500
3449         ;;
3450     11.0)
3451         MACOSX_SDK_VERSION=110000
3452         ;;
3453     11.1)
3454         MACOSX_SDK_VERSION=110100
3455         ;;
3456     11.3)
3457         MACOSX_SDK_VERSION=110300
3458         ;;
3459     12.0)
3460         MACOSX_SDK_VERSION=120000
3461         ;;
3462     12.1)
3463         MACOSX_SDK_VERSION=120100
3464         ;;
3465     12.3)
3466         MACOSX_SDK_VERSION=120300
3467         ;;
3468     *)
3469         AC_MSG_ERROR([macOS SDK $macosx_sdk is not supported])
3470         ;;
3471     esac
3473     if test "$host_cpu" = arm64 -a $MACOSX_SDK_VERSION -lt 110000; then
3474         AC_MSG_ERROR([macOS SDK $macosx_sdk is not supported for Apple Silicon])
3475     fi
3477     if test "$with_macosx_version_min_required" = "" ; then
3478         if test "$host_cpu" = x86_64; then
3479             with_macosx_version_min_required="10.13";
3480         else
3481             with_macosx_version_min_required="11.0";
3482         fi
3483     fi
3485     # export this so that "xcrun" invocations later return matching values
3486     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
3487     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
3488     export DEVELOPER_DIR
3489     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
3490     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
3492     AC_MSG_CHECKING([whether Xcode is new enough])
3493     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
3494     my_xcode_ver2=${my_xcode_ver1#Xcode }
3495     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
3496     if test "$my_xcode_ver3" -ge 1205; then
3497         AC_MSG_RESULT([yes ($my_xcode_ver2)])
3498     else
3499         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 12.5])
3500     fi
3502     case "$with_macosx_version_min_required" in
3503     10.13)
3504         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
3505         ;;
3506     10.14)
3507         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
3508         ;;
3509     10.15)
3510         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
3511         ;;
3512     10.16)
3513         MAC_OS_X_VERSION_MIN_REQUIRED="101600"
3514         ;;
3515     11.0)
3516         MAC_OS_X_VERSION_MIN_REQUIRED="110000"
3517         ;;
3518     11.1)
3519         MAC_OS_X_VERSION_MIN_REQUIRED="110100"
3520         ;;
3521     11.3)
3522         MAC_OS_X_VERSION_MIN_REQUIRED="110300"
3523         ;;
3524     12.0)
3525         MAC_OS_X_VERSION_MIN_REQUIRED="120000"
3526         ;;
3527     12.1)
3528         MAC_OS_X_VERSION_MIN_REQUIRED="120100"
3529         ;;
3530     12.3)
3531         MAC_OS_X_VERSION_MIN_REQUIRED="120300"
3532         ;;
3533     *)
3534         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.13--12.3])
3535         ;;
3536     esac
3538     LIBTOOL=/usr/bin/libtool
3539     INSTALL_NAME_TOOL=install_name_tool
3540     if test -z "$save_CC"; then
3541         stdlib=-stdlib=libc++
3543         AC_MSG_CHECKING([what C compiler to use])
3544         CC="`xcrun -find clang`"
3545         CC_BASE=`first_arg_basename "$CC"`
3546         if test "$host_cpu" = x86_64; then
3547             CC+=" -target x86_64-apple-macos"
3548         else
3549             CC+=" -target arm64-apple-macos"
3550         fi
3551         CC+=" -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3552         AC_MSG_RESULT([$CC])
3554         AC_MSG_CHECKING([what C++ compiler to use])
3555         CXX="`xcrun -find clang++`"
3556         CXX_BASE=`first_arg_basename "$CXX"`
3557         if test "$host_cpu" = x86_64; then
3558             CXX+=" -target x86_64-apple-macos"
3559         else
3560             CXX+=" -target arm64-apple-macos"
3561         fi
3562         CXX+=" $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3563         AC_MSG_RESULT([$CXX])
3565         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3566         AR=`xcrun -find ar`
3567         NM=`xcrun -find nm`
3568         STRIP=`xcrun -find strip`
3569         LIBTOOL=`xcrun -find libtool`
3570         RANLIB=`xcrun -find ranlib`
3571     fi
3573     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macos-with-sdk])
3574     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MACOSX_SDK_VERSION; then
3575         AC_MSG_ERROR([the version minimum required cannot be greater than the sdk level])
3576     else
3577         AC_MSG_RESULT([ok])
3578     fi
3579     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
3581     AC_MSG_CHECKING([whether to do code signing])
3583     if test "$enable_macosx_code_signing" = yes; then
3584         # By default use the first suitable certificate (?).
3586         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
3587         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
3588         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
3589         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
3590         # "Developer ID Application" one.
3592         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
3593         if test -n "$identity"; then
3594             MACOSX_CODESIGNING_IDENTITY=$identity
3595             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3596             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3597         else
3598             AC_MSG_ERROR([cannot determine identity to use])
3599         fi
3600     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
3601         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
3602         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3603         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3604     else
3605         AC_MSG_RESULT([no])
3606     fi
3608     AC_MSG_CHECKING([whether to create a Mac App Store package])
3610     if test -z "$enable_macosx_package_signing" || test "$enable_macosx_package_signing" == no; then
3611         AC_MSG_RESULT([no])
3612     elif test -z "$MACOSX_CODESIGNING_IDENTITY"; then
3613         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3614     elif test "$enable_macosx_package_signing" = yes; then
3615         # By default use the first suitable certificate.
3616         # It should be a "3rd Party Mac Developer Installer" one
3618         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
3619         if test -n "$identity"; then
3620             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3621             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3622             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3623         else
3624             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3625         fi
3626     else
3627         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
3628         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3629         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3630     fi
3632     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3633         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3634     fi
3636     AC_MSG_CHECKING([whether to sandbox the application])
3638     if test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3639         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3640     elif test "$enable_macosx_sandbox" = yes; then
3641         ENABLE_MACOSX_SANDBOX=TRUE
3642         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3643         AC_MSG_RESULT([yes])
3644     else
3645         AC_MSG_RESULT([no])
3646     fi
3648     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3649     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3650     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3652 AC_SUBST(MACOSX_SDK_PATH)
3653 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3654 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3655 AC_SUBST(INSTALL_NAME_TOOL)
3656 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3657 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3658 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3659 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3660 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3662 dnl ===================================================================
3663 dnl Check iOS SDK and compiler
3664 dnl ===================================================================
3666 if test $_os = iOS; then
3667     AC_MSG_CHECKING([what iOS SDK to use])
3668     current_sdk_ver=15.4
3669     older_sdk_vers="15.2 15.0 14.5"
3670     if test "$enable_ios_simulator" = "yes"; then
3671         platform=iPhoneSimulator
3672         versionmin=-mios-simulator-version-min=13.6
3673     else
3674         platform=iPhoneOS
3675         versionmin=-miphoneos-version-min=13.6
3676     fi
3677     xcode_developer=`xcode-select -print-path`
3679     for sdkver in $current_sdk_ver $older_sdk_vers; do
3680         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3681         if test -d $t; then
3682             sysroot=$t
3683             break
3684         fi
3685     done
3687     if test -z "$sysroot"; then
3688         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3689     fi
3691     AC_MSG_RESULT($sysroot)
3693     stdlib="-stdlib=libc++"
3695     AC_MSG_CHECKING([what C compiler to use])
3696     CC="`xcrun -find clang`"
3697     CC_BASE=`first_arg_basename "$CC"`
3698     CC+=" -arch $host_cpu_for_clang -isysroot $sysroot $versionmin"
3699     AC_MSG_RESULT([$CC])
3701     AC_MSG_CHECKING([what C++ compiler to use])
3702     CXX="`xcrun -find clang++`"
3703     CXX_BASE=`first_arg_basename "$CXX"`
3704     CXX+=" -arch $host_cpu_for_clang $stdlib -isysroot $sysroot $versionmin"
3705     AC_MSG_RESULT([$CXX])
3707     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3708     AR=`xcrun -find ar`
3709     NM=`xcrun -find nm`
3710     STRIP=`xcrun -find strip`
3711     LIBTOOL=`xcrun -find libtool`
3712     RANLIB=`xcrun -find ranlib`
3715 AC_MSG_CHECKING([whether to treat the installation as read-only])
3717 if test $_os = Darwin; then
3718     enable_readonly_installset=yes
3719 elif test "$enable_extensions" != yes; then
3720     enable_readonly_installset=yes
3722 if test "$enable_readonly_installset" = yes; then
3723     AC_MSG_RESULT([yes])
3724     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3725 else
3726     AC_MSG_RESULT([no])
3729 dnl ===================================================================
3730 dnl Structure of install set
3731 dnl ===================================================================
3733 if test $_os = Darwin; then
3734     LIBO_BIN_FOLDER=MacOS
3735     LIBO_ETC_FOLDER=Resources
3736     LIBO_LIBEXEC_FOLDER=MacOS
3737     LIBO_LIB_FOLDER=Frameworks
3738     LIBO_LIB_PYUNO_FOLDER=Resources
3739     LIBO_SHARE_FOLDER=Resources
3740     LIBO_SHARE_HELP_FOLDER=Resources/help
3741     LIBO_SHARE_JAVA_FOLDER=Resources/java
3742     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3743     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3744     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3745     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3746     LIBO_URE_BIN_FOLDER=MacOS
3747     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3748     LIBO_URE_LIB_FOLDER=Frameworks
3749     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3750     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3751 elif test $_os = WINNT; then
3752     LIBO_BIN_FOLDER=program
3753     LIBO_ETC_FOLDER=program
3754     LIBO_LIBEXEC_FOLDER=program
3755     LIBO_LIB_FOLDER=program
3756     LIBO_LIB_PYUNO_FOLDER=program
3757     LIBO_SHARE_FOLDER=share
3758     LIBO_SHARE_HELP_FOLDER=help
3759     LIBO_SHARE_JAVA_FOLDER=program/classes
3760     LIBO_SHARE_PRESETS_FOLDER=presets
3761     LIBO_SHARE_READMES_FOLDER=readmes
3762     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3763     LIBO_SHARE_SHELL_FOLDER=program/shell
3764     LIBO_URE_BIN_FOLDER=program
3765     LIBO_URE_ETC_FOLDER=program
3766     LIBO_URE_LIB_FOLDER=program
3767     LIBO_URE_MISC_FOLDER=program
3768     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3769 else
3770     LIBO_BIN_FOLDER=program
3771     LIBO_ETC_FOLDER=program
3772     LIBO_LIBEXEC_FOLDER=program
3773     LIBO_LIB_FOLDER=program
3774     LIBO_LIB_PYUNO_FOLDER=program
3775     LIBO_SHARE_FOLDER=share
3776     LIBO_SHARE_HELP_FOLDER=help
3777     LIBO_SHARE_JAVA_FOLDER=program/classes
3778     LIBO_SHARE_PRESETS_FOLDER=presets
3779     LIBO_SHARE_READMES_FOLDER=readmes
3780     if test "$enable_fuzzers" != yes; then
3781         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3782     else
3783         LIBO_SHARE_RESOURCE_FOLDER=resource
3784     fi
3785     LIBO_SHARE_SHELL_FOLDER=program/shell
3786     LIBO_URE_BIN_FOLDER=program
3787     LIBO_URE_ETC_FOLDER=program
3788     LIBO_URE_LIB_FOLDER=program
3789     LIBO_URE_MISC_FOLDER=program
3790     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3792 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3793 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3794 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3795 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3796 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3797 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3798 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3799 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3800 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3801 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3802 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3803 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3804 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3805 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3806 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3807 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3809 # Not all of them needed in config_host.mk, add more if need arises
3810 AC_SUBST(LIBO_BIN_FOLDER)
3811 AC_SUBST(LIBO_ETC_FOLDER)
3812 AC_SUBST(LIBO_LIB_FOLDER)
3813 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3814 AC_SUBST(LIBO_SHARE_FOLDER)
3815 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3816 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3817 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3818 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3819 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3820 AC_SUBST(LIBO_URE_BIN_FOLDER)
3821 AC_SUBST(LIBO_URE_ETC_FOLDER)
3822 AC_SUBST(LIBO_URE_LIB_FOLDER)
3823 AC_SUBST(LIBO_URE_MISC_FOLDER)
3824 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3826 dnl ===================================================================
3827 dnl Windows specific tests and stuff
3828 dnl ===================================================================
3830 reg_get_value()
3832     # Return value: $regvalue
3833     unset regvalue
3835     if test "$build_os" = "wsl"; then
3836         regvalue=$($BUILDDIR/solenv/wsl/wsl-lo-helper.exe --read-registry $1 "$2" 2>/dev/null)
3837         return
3838     fi
3840     local _regentry="/proc/registry${1}/${2}"
3841     if test -f "$_regentry"; then
3842         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3843         # Registry keys read via /proc/registry* are always \0 terminated!
3844         local _regvalue=$(tr -d '\0' < "$_regentry")
3845         if test $? -eq 0; then
3846             regvalue=$_regvalue
3847         fi
3848     fi
3851 # Get a value from the 32-bit side of the Registry
3852 reg_get_value_32()
3854     reg_get_value "32" "$1"
3857 # Get a value from the 64-bit side of the Registry
3858 reg_get_value_64()
3860     reg_get_value "64" "$1"
3863 case "$host_os" in
3864 cygwin*|wsl*)
3865     COM=MSC
3866     OS=WNT
3867     RTL_OS=Windows
3868     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3869         P_SEP=";"
3870     else
3871         P_SEP=:
3872     fi
3873     case "$host_cpu" in
3874     x86_64)
3875         CPUNAME=X86_64
3876         RTL_ARCH=X86_64
3877         PLATFORMID=windows_x86_64
3878         WINDOWS_X64=1
3879         SCPDEFS="$SCPDEFS -DWINDOWS_X64"
3880         WIN_HOST_ARCH="x64"
3881         WIN_MULTI_ARCH="x86"
3882         WIN_HOST_BITS=64
3883         ;;
3884     i*86)
3885         CPUNAME=INTEL
3886         RTL_ARCH=x86
3887         PLATFORMID=windows_x86
3888         WIN_HOST_ARCH="x86"
3889         WIN_HOST_BITS=32
3890         WIN_OTHER_ARCH="x64"
3891         ;;
3892     aarch64)
3893         CPUNAME=AARCH64
3894         RTL_ARCH=AARCH64
3895         PLATFORMID=windows_aarch64
3896         WINDOWS_X64=1
3897         SCPDEFS="$SCPDEFS -DWINDOWS_AARCH64"
3898         WIN_HOST_ARCH="arm64"
3899         WIN_HOST_BITS=64
3900         with_ucrt_dir=no
3901         ;;
3902     *)
3903         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3904         ;;
3905     esac
3907     case "$build_cpu" in
3908     x86_64) WIN_BUILD_ARCH="x64" ;;
3909     i*86) WIN_BUILD_ARCH="x86" ;;
3910     aarch64) WIN_BUILD_ARCH="arm64" ;;
3911     *)
3912         AC_MSG_ERROR([Unsupported build_cpu $build_cpu for host_os $host_os])
3913         ;;
3914     esac
3916     SCPDEFS="$SCPDEFS -D_MSC_VER"
3917     ;;
3918 esac
3920 # multi-arch is an arch, which can execute on the host (x86 on x64), while
3921 # other-arch won't, but wouldn't break the build (x64 on x86).
3922 if test -n "$WIN_MULTI_ARCH" -a -n "$WIN_OTHER_ARCH"; then
3923     AC_MSG_ERROR([Broken configure.ac file: can't have set \$WIN_MULTI_ARCH and $WIN_OTHER_ARCH])
3927 if test "$build_cpu" != "$host_cpu" -o "$DISABLE_DYNLOADING" = TRUE; then
3928     # To allow building Windows multi-arch releases without cross-tooling
3929     if test "$DISABLE_DYNLOADING" = TRUE -o \( -z "$WIN_MULTI_ARCH" -a -z "$WIN_OTHER_ARCH" \); then
3930         cross_compiling="yes"
3931     fi
3934 if test "$cross_compiling" = "yes"; then
3935     export CROSS_COMPILING=TRUE
3936     if test "$enable_dynamic_loading" != yes -a "$enable_wasm_strip" = yes; then
3937         ENABLE_WASM_STRIP=TRUE
3938     fi
3939 else
3940     CROSS_COMPILING=
3941     BUILD_TYPE="$BUILD_TYPE NATIVE"
3943 AC_SUBST(CROSS_COMPILING)
3944 AC_SUBST(ENABLE_WASM_STRIP)
3946 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3947 # NOTE: must _not_ be used for bundled external libraries!
3948 ISYSTEM=
3949 if test "$GCC" = "yes"; then
3950     AC_MSG_CHECKING( for -isystem )
3951     save_CFLAGS=$CFLAGS
3952     CFLAGS="$CFLAGS -isystem /usr/include -Werror"
3953     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3954     CFLAGS=$save_CFLAGS
3955     if test -n "$ISYSTEM"; then
3956         AC_MSG_RESULT(yes)
3957     else
3958         AC_MSG_RESULT(no)
3959     fi
3961 if test -z "$ISYSTEM"; then
3962     # fall back to using -I
3963     ISYSTEM=-I
3965 AC_SUBST(ISYSTEM)
3967 dnl ===================================================================
3968 dnl  Check which Visual Studio compiler is used
3969 dnl ===================================================================
3971 map_vs_year_to_version()
3973     # Return value: $vsversion
3975     unset vsversion
3977     case $1 in
3978     2019)
3979         vsversion=16;;
3980     2022)
3981         vsversion=17;;
3982     *)
3983         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3984     esac
3987 vs_versions_to_check()
3989     # Args: $1 (optional) : versions to check, in the order of preference
3990     # Return value: $vsversions
3992     unset vsversions
3994     if test -n "$1"; then
3995         map_vs_year_to_version "$1"
3996         vsversions=$vsversion
3997     else
3998         # Default version is 2019
3999         vsversions="16"
4000     fi
4003 win_get_env_from_vsvars32bat()
4005     local WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
4006     # Also seems to be located in another directory under the same name: vsvars32.bat
4007     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
4008     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
4009     # use 'echo.%ENV%' syntax (instead of 'echo %ENV%') to avoid outputting "ECHO is off." in case when ENV is empty or a space
4010     printf '@setlocal\r\n@echo.%%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
4011     local result
4012     if test "$build_os" = "wsl"; then
4013         result=$(cd /mnt/c && cmd.exe /c $(wslpath -w $WRAPPERBATCHFILEPATH) | tr -d '\r')
4014     else
4015         chmod +x $WRAPPERBATCHFILEPATH
4016         result=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
4017     fi
4018     rm -f $WRAPPERBATCHFILEPATH
4019     printf '%s' "$result"
4022 find_ucrt()
4024     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
4025     if test -n "$regvalue"; then
4026         PathFormat "$regvalue"
4027         UCRTSDKDIR=$formatted_path_unix
4028         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
4029         UCRTVERSION=$regvalue
4030         # Rest if not exist
4031         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
4032           UCRTSDKDIR=
4033         fi
4034     fi
4035     if test -z "$UCRTSDKDIR"; then
4036         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
4037         ide_env_file="${ide_env_dir}VsDevCmd.bat"
4038         if test -f "$ide_env_file"; then
4039             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
4040             UCRTSDKDIR=$formatted_path
4041             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
4042             dnl Hack needed at least by tml:
4043             if test "$UCRTVERSION" = 10.0.15063.0 \
4044                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
4045                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
4046             then
4047                 UCRTVERSION=10.0.14393.0
4048             fi
4049         else
4050           AC_MSG_ERROR([No UCRT found])
4051         fi
4052     fi
4055 find_msvc()
4057     # Find Visual C++
4058     # Args: $1 (optional) : The VS version year
4059     # Return values: $vctest, $vcyear, $vctoolset, $vcnumwithdot, $vcbuildnumber
4061     unset vctest vctoolset vcnumwithdot vcbuildnumber
4063     vs_versions_to_check "$1"
4064     if test "$build_os" = wsl; then
4065         vswhere="$PROGRAMFILESX86"
4066     else
4067         vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
4068     fi
4069     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
4070     PathFormat "$vswhere"
4071     vswhere=$formatted_path_unix
4072     for ver in $vsversions; do
4073         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4074         if test -z "$vswhereoutput"; then
4075             vswhereoutput=`$vswhere -prerelease -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4076         fi
4077         # Fall back to all MS products (this includes VC++ Build Tools)
4078         if ! test -n "$vswhereoutput"; then
4079             AC_MSG_CHECKING([VC++ Build Tools and similar])
4080             vswhereoutput=`$vswhere -products \* -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4081         fi
4082         if test -n "$vswhereoutput"; then
4083             PathFormat "$vswhereoutput"
4084             vctest=$formatted_path_unix
4085             break
4086         fi
4087     done
4089     if test -n "$vctest"; then
4090         vcnumwithdot="$ver.0"
4091         case "$vcnumwithdot" in
4092         16.0)
4093             vcyear=2019
4094             vctoolset=v142
4095             ;;
4096         17.0)
4097             vcyear=2022
4098             vctoolset=v143
4099             ;;
4100         esac
4101         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
4103     fi
4106 test_cl_exe()
4108     AC_MSG_CHECKING([$1 compiler])
4110     CL_EXE_PATH="$2/cl.exe"
4112     if test ! -f "$CL_EXE_PATH"; then
4113         if test "$1" = "multi-arch"; then
4114             AC_MSG_WARN([no compiler (cl.exe) in $2])
4115             return 1
4116         else
4117             AC_MSG_ERROR([no compiler (cl.exe) in $2])
4118         fi
4119     fi
4121     dnl ===========================================================
4122     dnl  Check for the corresponding mspdb*.dll
4123     dnl ===========================================================
4125     # MSVC 15.0 has libraries from 14.0?
4126     mspdbnum="140"
4128     if test ! -e "$2/mspdb${mspdbnum}.dll"; then
4129         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $2, Visual Studio installation broken?])
4130     fi
4132     # The compiles has to find its shared libraries
4133     OLD_PATH="$PATH"
4134     TEMP_PATH=`cygpath -d "$2"`
4135     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
4137     if ! "$CL_EXE_PATH" -? </dev/null >/dev/null 2>&1; then
4138         AC_MSG_ERROR([no compiler (cl.exe) in $2])
4139     fi
4141     PATH="$OLD_PATH"
4143     AC_MSG_RESULT([$CL_EXE_PATH])
4146 SOLARINC=
4147 MSBUILD_PATH=
4148 DEVENV=
4149 if test "$_os" = "WINNT"; then
4150     AC_MSG_CHECKING([Visual C++])
4151     find_msvc "$with_visual_studio"
4152     if test -z "$vctest"; then
4153         if test -n "$with_visual_studio"; then
4154             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
4155         else
4156             AC_MSG_ERROR([no Visual Studio installation found])
4157         fi
4158     fi
4159     AC_MSG_RESULT([])
4161     VC_PRODUCT_DIR="$vctest/VC"
4162     COMPATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber"
4164     # $WIN_OTHER_ARCH is a hack to test the x64 compiler on x86, even if it's not multi-arch
4165     if test -n "$WIN_MULTI_ARCH" -o -n "$WIN_OTHER_ARCH"; then
4166         MSVC_MULTI_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/${WIN_MULTI_ARCH}${WIN_OTHER_ARCH}"
4167         test_cl_exe "multi-arch" "$MSVC_MULTI_PATH"
4168         if test $? -ne 0; then
4169             WIN_MULTI_ARCH=""
4170             WIN_OTHER_ARCH=""
4171         fi
4172     fi
4174     if test "$WIN_BUILD_ARCH" = "$WIN_HOST_ARCH"; then
4175         MSVC_BUILD_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_BUILD_ARCH"
4176         test_cl_exe "build" "$MSVC_BUILD_PATH"
4177     fi
4179     if test "$WIN_BUILD_ARCH" != "$WIN_HOST_ARCH"; then
4180         MSVC_HOST_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_HOST_ARCH"
4181         test_cl_exe "host" "$MSVC_HOST_PATH"
4182     else
4183         MSVC_HOST_PATH="$MSVC_BUILD_PATH"
4184     fi
4186     AC_MSG_CHECKING([for short pathname of VC product directory])
4187     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
4188     AC_MSG_RESULT([$VC_PRODUCT_DIR])
4190     UCRTSDKDIR=
4191     UCRTVERSION=
4193     AC_MSG_CHECKING([for UCRT location])
4194     find_ucrt
4195     # find_ucrt errors out if it doesn't find it
4196     AC_MSG_RESULT([$UCRTSDKDIR ($UCRTVERSION)])
4197     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
4198     ucrtincpath_formatted=$formatted_path
4199     # SOLARINC is used for external modules and must be set too.
4200     # And no, it's not sufficient to set SOLARINC only, as configure
4201     # itself doesn't honour it.
4202     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
4203     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
4204     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
4205     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
4207     AC_SUBST(UCRTSDKDIR)
4208     AC_SUBST(UCRTVERSION)
4210     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
4211     # Find the proper version of MSBuild.exe to use based on the VS version
4212     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
4213     if test -z "$regvalue" ; then
4214         if test "$WIN_BUILD_ARCH" != "x64"; then
4215             regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
4216         else
4217             regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
4218         fi
4219     fi
4220     if test -d "$regvalue" ; then
4221         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
4222         AC_MSG_RESULT([$regvalue])
4223     else
4224         AC_MSG_ERROR([MSBuild.exe location not found])
4225     fi
4227     # Find the version of devenv.exe
4228     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
4229     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
4230     DEVENV_unix=$(cygpath -u "$DEVENV")
4231     if test ! -e "$DEVENV_unix"; then
4232         AC_MSG_WARN([No devenv.exe found - this is expected for VC++ Build Tools])
4233     fi
4235     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
4236     dnl needed when building CLR code:
4237     if test -z "$MSVC_CXX"; then
4238         # This gives us a posix path with 8.3 filename restrictions
4239         MSVC_CXX=`win_short_path_for_make "$MSVC_HOST_PATH/cl.exe"`
4240     fi
4242     if test -z "$CC"; then
4243         CC=$MSVC_CXX
4244         CC_BASE=`first_arg_basename "$CC"`
4245     fi
4246     if test -z "$CXX"; then
4247         CXX=$MSVC_CXX
4248         CXX_BASE=`first_arg_basename "$CXX"`
4249     fi
4251     if test -n "$CC"; then
4252         # Remove /cl.exe from CC case insensitive
4253         AC_MSG_NOTICE([found Visual C++ $vcyear])
4255         main_include_dir=`cygpath -d -m "$COMPATH/Include"`
4256         CPPFLAGS="$CPPFLAGS -I$main_include_dir"
4258         PathFormat "$COMPATH"
4259         COMPATH=`win_short_path_for_make "$formatted_path"`
4261         VCVER=$vcnumwithdot
4262         VCTOOLSET=$vctoolset
4264         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
4265         # are always "better", we list them in reverse chronological order.
4267         case "$vcnumwithdot" in
4268         16.0 | 17.0)
4269             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
4270             ;;
4271         esac
4273         # The expectation is that --with-windows-sdk should not need to be used
4274         if test -n "$with_windows_sdk"; then
4275             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
4276             *" "$with_windows_sdk" "*)
4277                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
4278                 ;;
4279             *)
4280                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $vcyear])
4281                 ;;
4282             esac
4283         fi
4285         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
4286         ac_objext=obj
4287         ac_exeext=exe
4289     else
4290         AC_MSG_ERROR([Visual C++ not found after all, huh])
4291     fi
4293     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.5])
4294     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4295         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
4296         // between Visual Studio versions and _MSC_VER:
4297         #if _MSC_VER < 1925
4298         #error
4299         #endif
4300     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
4302     # Check for 64-bit (cross-)compiler to use to build the 64-bit
4303     # version of the Explorer extension (and maybe other small
4304     # bits, too) needed when installing a 32-bit LibreOffice on a
4305     # 64-bit OS. The 64-bit Explorer extension is a feature that
4306     # has been present since long in OOo. Don't confuse it with
4307     # building LibreOffice itself as 64-bit code.
4309     BUILD_X64=
4310     CXX_X64_BINARY=
4312     if test "$WIN_HOST_ARCH" = "x86" -a -n "$WIN_OTHER_ARCH"; then
4313         AC_MSG_CHECKING([for the libraries to build the 64-bit Explorer extensions])
4314         if test -f "$COMPATH/atlmfc/lib/x64/atls.lib" -o \
4315              -f "$COMPATH/atlmfc/lib/spectre/x64/atls.lib"
4316         then
4317             BUILD_X64=TRUE
4318             CXX_X64_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4319             AC_MSG_RESULT([found])
4320         else
4321             AC_MSG_RESULT([not found])
4322             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
4323         fi
4324     elif test "$WIN_HOST_ARCH" = "x64"; then
4325         CXX_X64_BINARY=$CXX
4326     fi
4327     AC_SUBST(BUILD_X64)
4329     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
4330     AC_SUBST(CXX_X64_BINARY)
4332     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
4333     # needed to support TWAIN scan on both 32- and 64-bit systems
4335     case "$WIN_HOST_ARCH" in
4336     x64)
4337         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
4338         if test -n "$CXX_X86_BINARY"; then
4339             BUILD_X86=TRUE
4340             AC_MSG_RESULT([preset])
4341         elif test -n "$WIN_MULTI_ARCH"; then
4342             BUILD_X86=TRUE
4343             CXX_X86_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4344             AC_MSG_RESULT([found])
4345         else
4346             AC_MSG_RESULT([not found])
4347             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
4348         fi
4349         ;;
4350     x86)
4351         BUILD_X86=TRUE
4352         CXX_X86_BINARY=$MSVC_CXX
4353         ;;
4354     esac
4355     AC_SUBST(BUILD_X86)
4356     AC_SUBST(CXX_X86_BINARY)
4358 AC_SUBST(VCVER)
4359 AC_SUBST(VCTOOLSET)
4360 AC_SUBST(DEVENV)
4361 AC_SUBST(MSVC_CXX)
4363 COM_IS_CLANG=
4364 AC_MSG_CHECKING([whether the compiler is actually Clang])
4365 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4366     #ifndef __clang__
4367     you lose
4368     #endif
4369     int foo=42;
4370     ]])],
4371     [AC_MSG_RESULT([yes])
4372      COM_IS_CLANG=TRUE],
4373     [AC_MSG_RESULT([no])])
4374 AC_SUBST(COM_IS_CLANG)
4376 CLANGVER=
4377 if test "$COM_IS_CLANG" = TRUE; then
4378     AC_MSG_CHECKING([whether Clang is new enough])
4379     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4380         #if !defined __apple_build_version__
4381         #error
4382         #endif
4383         ]])],
4384         [my_apple_clang=yes],[my_apple_clang=])
4385     if test "$my_apple_clang" = yes; then
4386         AC_MSG_RESULT([assumed yes (Apple Clang)])
4387     elif test "$_os" = Emscripten; then
4388         AC_MSG_RESULT([assumed yes (Emscripten Clang)])
4389     else
4390         if test "$_os" = WINNT; then
4391             dnl In which case, assume clang-cl:
4392             my_args="/EP /TC"
4393         else
4394             my_args="-E -P"
4395         fi
4396         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC $my_args - | sed 's/ //g'`
4397         CLANG_FULL_VERSION=`echo __clang_version__ | $CC $my_args -`
4398         CLANGVER=`echo $clang_version \
4399             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
4400         if test "$CLANGVER" -ge 80001; then
4401             AC_MSG_RESULT([yes ($clang_version)])
4402         else
4403             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 8.0.1])
4404         fi
4405         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
4406         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
4407     fi
4410 SHOWINCLUDES_PREFIX=
4411 if test "$_os" = WINNT; then
4412     dnl We need to guess the prefix of the -showIncludes output, it can be
4413     dnl localized
4414     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
4415     echo "#include <stdlib.h>" > conftest.c
4416     SHOWINCLUDES_PREFIX=`$CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
4417         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
4418     rm -f conftest.c conftest.obj
4419     if test -z "$SHOWINCLUDES_PREFIX"; then
4420         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
4421     else
4422         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
4423     fi
4425 AC_SUBST(SHOWINCLUDES_PREFIX)
4428 # prefix C with ccache if needed
4430 if test "$CCACHE" != ""; then
4431     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
4433     AC_LANG_PUSH([C])
4434     save_CFLAGS=$CFLAGS
4435     CFLAGS="$CFLAGS --ccache-skip -O2"
4436     # msvc does not fail on unknown options, check stdout
4437     if test "$COM" = MSC; then
4438         CFLAGS="$CFLAGS -nologo"
4439     fi
4440     save_ac_c_werror_flag=$ac_c_werror_flag
4441     ac_c_werror_flag=yes
4442     dnl an empty program will do, we're checking the compiler flags
4443     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
4444                       [use_ccache=yes], [use_ccache=no])
4445     CFLAGS=$save_CFLAGS
4446     ac_c_werror_flag=$save_ac_c_werror_flag
4447     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
4448         AC_MSG_RESULT([yes])
4449     else
4450         CC="$CCACHE $CC"
4451         CC_BASE="ccache $CC_BASE"
4452         AC_MSG_RESULT([no])
4453     fi
4454     AC_LANG_POP([C])
4457 # ===================================================================
4458 # check various GCC options that Clang does not support now but maybe
4459 # will somewhen in the future, check them even for GCC, so that the
4460 # flags are set
4461 # ===================================================================
4463 HAVE_GCC_GGDB2=
4464 if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4465     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
4466     save_CFLAGS=$CFLAGS
4467     CFLAGS="$CFLAGS -Werror -ggdb2"
4468     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
4469     CFLAGS=$save_CFLAGS
4470     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
4471         AC_MSG_RESULT([yes])
4472     else
4473         AC_MSG_RESULT([no])
4474     fi
4476     if test "$host_cpu" = "m68k"; then
4477         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
4478         save_CFLAGS=$CFLAGS
4479         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
4480         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
4481         CFLAGS=$save_CFLAGS
4482         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
4483             AC_MSG_RESULT([yes])
4484         else
4485             AC_MSG_ERROR([no])
4486         fi
4487     fi
4489 AC_SUBST(HAVE_GCC_GGDB2)
4491 dnl ===================================================================
4492 dnl  Test the gcc version
4493 dnl ===================================================================
4494 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
4495     AC_MSG_CHECKING([the GCC version])
4496     _gcc_version=`$CC -dumpfullversion`
4497     gcc_full_version=$(printf '%s' "$_gcc_version" | \
4498         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
4499     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
4501     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
4503     if test "$gcc_full_version" -lt 70000; then
4504         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
4505     fi
4506 else
4507     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
4508     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
4509     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
4510     # (which reports itself as GCC 4.2.1).
4511     GCC_VERSION=
4513 AC_SUBST(GCC_VERSION)
4515 dnl Set the ENABLE_DBGUTIL variable
4516 dnl ===================================================================
4517 AC_MSG_CHECKING([whether to build with additional debug utilities])
4518 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
4519     ENABLE_DBGUTIL="TRUE"
4520     # this is an extra var so it can have different default on different MSVC
4521     # versions (in case there are version specific problems with it)
4522     MSVC_USE_DEBUG_RUNTIME="TRUE"
4524     AC_MSG_RESULT([yes])
4525     # cppunit and graphite expose STL in public headers
4526     if test "$with_system_cppunit" = "yes"; then
4527         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
4528     else
4529         with_system_cppunit=no
4530     fi
4531     if test "$with_system_graphite" = "yes"; then
4532         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
4533     else
4534         with_system_graphite=no
4535     fi
4536     if test "$with_system_orcus" = "yes"; then
4537         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
4538     else
4539         with_system_orcus=no
4540     fi
4541     if test "$with_system_libcmis" = "yes"; then
4542         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
4543     else
4544         with_system_libcmis=no
4545     fi
4546     if test "$with_system_hunspell" = "yes"; then
4547         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
4548     else
4549         with_system_hunspell=no
4550     fi
4551     if test "$with_system_gpgmepp" = "yes"; then
4552         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
4553     else
4554         with_system_gpgmepp=no
4555     fi
4556     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
4557     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
4558     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
4559     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
4560     # of those two is using the system variant:
4561     if test "$with_system_libnumbertext" = "yes"; then
4562         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
4563     else
4564         with_system_libnumbertext=no
4565     fi
4566     if test "$with_system_libwps" = "yes"; then
4567         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
4568     else
4569         with_system_libwps=no
4570     fi
4571 else
4572     ENABLE_DBGUTIL=""
4573     MSVC_USE_DEBUG_RUNTIME=""
4574     AC_MSG_RESULT([no])
4576 AC_SUBST(ENABLE_DBGUTIL)
4577 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
4579 dnl Set the ENABLE_DEBUG variable.
4580 dnl ===================================================================
4581 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
4582     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
4584 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
4585     if test -z "$libo_fuzzed_enable_debug"; then
4586         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
4587     else
4588         AC_MSG_NOTICE([Resetting --enable-debug=yes])
4589         enable_debug=yes
4590     fi
4593 AC_MSG_CHECKING([whether to do a debug build])
4594 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
4595     ENABLE_DEBUG="TRUE"
4596     if test -n "$ENABLE_DBGUTIL" ; then
4597         AC_MSG_RESULT([yes (dbgutil)])
4598     else
4599         AC_MSG_RESULT([yes])
4600     fi
4601 else
4602     ENABLE_DEBUG=""
4603     AC_MSG_RESULT([no])
4605 AC_SUBST(ENABLE_DEBUG)
4607 dnl ===================================================================
4608 dnl Select the linker to use (gold/lld/ld.bfd).
4609 dnl This is done only after compiler checks (need to know if Clang is
4610 dnl used, for different defaults) and after checking if a debug build
4611 dnl is wanted (non-debug builds get the default linker if not explicitly
4612 dnl specified otherwise).
4613 dnl All checks for linker features/options should come after this.
4614 dnl ===================================================================
4615 check_use_ld()
4617     use_ld=-fuse-ld=${1%%:*}
4618     use_ld_path=${1#*:}
4619     if test "$use_ld_path" != "$1"; then
4620         if test "$COM_IS_CLANG" = TRUE; then
4621             if test "$CLANGVER" -ge 120000; then
4622                 use_ld="${use_ld} --ld-path=${use_ld_path}"
4623             else
4624                 use_ld="-fuse-ld=${use_ld_path}"
4625             fi
4626         else
4627             # I tried to use gcc's '-B<path>' and a directory + symlink setup in
4628             # $BUILDDIR, but libtool always filtered-out that option, so gcc wouldn't
4629             # pickup the alternative linker, when called by libtool for linking.
4630             # For mold, one can use LD_PRELOAD=/usr/lib/mold/mold-wrapper.so instead.
4631             AC_MSG_ERROR([A linker path is just supported with clang, because of libtool's -B filtering!])
4632         fi
4633     fi
4634     use_ld_fail_if_error=$2
4635     use_ld_ok=
4636     AC_MSG_CHECKING([for $use_ld linker support])
4637     use_ld_ldflags_save="$LDFLAGS"
4638     LDFLAGS="$LDFLAGS $use_ld"
4639     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4640 #include <stdio.h>
4641         ],[
4642 printf ("hello world\n");
4643         ])], USE_LD=$use_ld, [])
4644     if test -n "$USE_LD"; then
4645         AC_MSG_RESULT( yes )
4646         use_ld_ok=yes
4647     else
4648         if test -n "$use_ld_fail_if_error"; then
4649             AC_MSG_ERROR( no )
4650         else
4651             AC_MSG_RESULT( no )
4652         fi
4653     fi
4654     if test -n "$use_ld_ok"; then
4655         dnl keep the value of LDFLAGS
4656         return 0
4657     fi
4658     LDFLAGS="$use_ld_ldflags_save"
4659     return 1
4661 USE_LD=
4662 if test "$enable_ld" != "no"; then
4663     if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4664         if test -n "$enable_ld"; then
4665             check_use_ld "$enable_ld" fail_if_error
4666         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4667             dnl non-debug builds default to the default linker
4668             true
4669         elif test -n "$COM_IS_CLANG"; then
4670             check_use_ld lld
4671             if test $? -ne 0; then
4672                 check_use_ld gold
4673             fi
4674         else
4675             # For gcc first try gold, new versions also support lld.
4676             check_use_ld gold
4677             if test $? -ne 0; then
4678                 check_use_ld lld
4679             fi
4680         fi
4681         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4682         rm conftest.out
4683         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4684         if test -z "$ld_used"; then
4685             ld_used="unknown"
4686         fi
4687         AC_MSG_CHECKING([for linker that is used])
4688         AC_MSG_RESULT([$ld_used])
4689         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4690             if echo "$ld_used" | grep -q "^GNU ld"; then
4691                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4692                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4693             fi
4694         fi
4695     else
4696         if test "$enable_ld" = "yes"; then
4697             AC_MSG_ERROR([--enable-ld not supported])
4698         fi
4699     fi
4701 AC_SUBST(USE_LD)
4703 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4704 if test "$GCC" = "yes" -a "$_os" != Emscripten ; then
4705     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4706     bsymbolic_functions_ldflags_save=$LDFLAGS
4707     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4708     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4709 #include <stdio.h>
4710         ],[
4711 printf ("hello world\n");
4712         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4713     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4714         AC_MSG_RESULT( found )
4715     else
4716         AC_MSG_RESULT( not found )
4717     fi
4718     LDFLAGS=$bsymbolic_functions_ldflags_save
4720 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4722 LD_GC_SECTIONS=
4723 if test "$GCC" = "yes"; then
4724     for flag in "--gc-sections" "-dead_strip"; do
4725         AC_MSG_CHECKING([for $flag linker support])
4726         ldflags_save=$LDFLAGS
4727         LDFLAGS="$LDFLAGS -Wl,$flag"
4728         AC_LINK_IFELSE([AC_LANG_PROGRAM([
4729 #include <stdio.h>
4730             ],[
4731 printf ("hello world\n");
4732             ])],[
4733             LD_GC_SECTIONS="-Wl,$flag"
4734             AC_MSG_RESULT( found )
4735             ], [
4736             AC_MSG_RESULT( not found )
4737             ])
4738         LDFLAGS=$ldflags_save
4739         if test -n "$LD_GC_SECTIONS"; then
4740             break
4741         fi
4742     done
4744 AC_SUBST(LD_GC_SECTIONS)
4746 HAVE_EXTERNAL_DWARF=
4747 if test "$enable_split_debug" != no; then
4748     use_split_debug=
4749     if test -n "$ENABLE_LTO"; then
4750         : # Inherently incompatible, since no debug info is created while compiling, GCC complains.
4751     elif test "$enable_split_debug" = yes; then
4752         use_split_debug=1
4753     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4754     elif test "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4755         use_split_debug=1
4756     fi
4757     if test -n "$use_split_debug"; then
4758         if test "$_os" = "Emscripten"; then
4759             TEST_CC_FLAG=-gseparate-dwarf
4760         else
4761             TEST_CC_FLAG=-gsplit-dwarf
4762         fi
4763         AC_MSG_CHECKING([whether $CC_BASE supports $TEST_CC_FLAG])
4764         save_CFLAGS=$CFLAGS
4765         CFLAGS="$CFLAGS -Werror $TEST_CC_FLAG"
4766         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_EXTERNAL_DWARF=TRUE ],[])
4767         CFLAGS=$save_CFLAGS
4768         if test "$HAVE_EXTERNAL_DWARF" = "TRUE"; then
4769             AC_MSG_RESULT([yes])
4770         else
4771             if test "$enable_split_debug" = yes; then
4772                 AC_MSG_ERROR([no])
4773             else
4774                 AC_MSG_RESULT([no])
4775             fi
4776         fi
4777     fi
4778     if test -z "$HAVE_EXTERNAL_DWARF" -a "$test_split_debug" = "yes" -a -n "$use_split_debug"; then
4779         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4780         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4781     fi
4783 AC_SUBST(HAVE_EXTERNAL_DWARF)
4785 HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=
4786 AC_MSG_CHECKING([whether $CC_BASE supports -Xclang -debug-info-kind=constructor])
4787 save_CFLAGS=$CFLAGS
4788 CFLAGS="$CFLAGS -Werror -Xclang -debug-info-kind=constructor"
4789 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=TRUE ],[])
4790 CFLAGS=$save_CFLAGS
4791 if test "$HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR" = "TRUE"; then
4792     AC_MSG_RESULT([yes])
4793 else
4794     AC_MSG_RESULT([no])
4796 AC_SUBST(HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR)
4798 ENABLE_GDB_INDEX=
4799 if test "$enable_gdb_index" != "no"; then
4800     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4801     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4802         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4803         save_CFLAGS=$CFLAGS
4804         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4805         have_ggnu_pubnames=
4806         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4807         if test "$have_ggnu_pubnames" != "TRUE"; then
4808             if test "$enable_gdb_index" = "yes"; then
4809                 AC_MSG_ERROR([no, --enable-gdb-index not supported])
4810             else
4811                 AC_MSG_RESULT( no )
4812             fi
4813         else
4814             AC_MSG_RESULT( yes )
4815             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4816             ldflags_save=$LDFLAGS
4817             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4818             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4819 #include <stdio.h>
4820                 ],[
4821 printf ("hello world\n");
4822                 ])], ENABLE_GDB_INDEX=TRUE, [])
4823             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4824                 AC_MSG_RESULT( yes )
4825             else
4826                 if test "$enable_gdb_index" = "yes"; then
4827                     AC_MSG_ERROR( no )
4828                 else
4829                     AC_MSG_RESULT( no )
4830                 fi
4831             fi
4832             LDFLAGS=$ldflags_save
4833         fi
4834         CFLAGS=$save_CFLAGS
4835         fi
4836     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4837         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4838         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4839     fi
4841 AC_SUBST(ENABLE_GDB_INDEX)
4843 if test -z "$enable_sal_log" && test "$ENABLE_DEBUG" = TRUE; then
4844     enable_sal_log=yes
4846 if test "$enable_sal_log" = yes; then
4847     ENABLE_SAL_LOG=TRUE
4849 AC_SUBST(ENABLE_SAL_LOG)
4851 dnl Check for enable symbols option
4852 dnl ===================================================================
4853 AC_MSG_CHECKING([whether to generate debug information])
4854 if test -z "$enable_symbols"; then
4855     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4856         enable_symbols=yes
4857     else
4858         enable_symbols=no
4859     fi
4861 if test "$enable_symbols" = yes; then
4862     ENABLE_SYMBOLS_FOR=all
4863     AC_MSG_RESULT([yes])
4864 elif test "$enable_symbols" = no; then
4865     ENABLE_SYMBOLS_FOR=
4866     AC_MSG_RESULT([no])
4867 else
4868     # Selective debuginfo.
4869     ENABLE_SYMBOLS_FOR="$enable_symbols"
4870     AC_MSG_RESULT([for "$enable_symbols"])
4872 AC_SUBST(ENABLE_SYMBOLS_FOR)
4874 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4875     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4876     AC_MSG_CHECKING([whether enough memory is available for linking])
4877     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4878     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4879     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4880         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4881     else
4882         AC_MSG_RESULT([yes])
4883     fi
4886 ENABLE_OPTIMIZED=
4887 ENABLE_OPTIMIZED_DEBUG=
4888 AC_MSG_CHECKING([whether to compile with optimization flags])
4889 if test -z "$enable_optimized"; then
4890     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4891         enable_optimized=no
4892     else
4893         enable_optimized=yes
4894     fi
4896 if test "$enable_optimized" = yes; then
4897     ENABLE_OPTIMIZED=TRUE
4898     AC_MSG_RESULT([yes])
4899 elif test "$enable_optimized" = debug; then
4900     ENABLE_OPTIMIZED_DEBUG=TRUE
4901     AC_MSG_RESULT([yes (debug)])
4902     HAVE_GCC_OG=
4903     if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4904         AC_MSG_CHECKING([whether $CC_BASE supports -Og])
4905         save_CFLAGS=$CFLAGS
4906         CFLAGS="$CFLAGS -Werror -Og"
4907         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[])
4908         CFLAGS=$save_CFLAGS
4909         if test "$HAVE_GCC_OG" = "TRUE"; then
4910             AC_MSG_RESULT([yes])
4911         else
4912             AC_MSG_RESULT([no])
4913         fi
4914     fi
4915     if test -z "$HAVE_GCC_OG" -a "$_os" != "Emscripten"; then
4916         AC_MSG_ERROR([The compiler does not support optimizations suitable for debugging.])
4917     fi
4918 else
4919     AC_MSG_RESULT([no])
4921 AC_SUBST(ENABLE_OPTIMIZED)
4922 AC_SUBST(ENABLE_OPTIMIZED_DEBUG)
4925 # determine CPUNAME, OS, ...
4927 case "$host_os" in
4929 aix*)
4930     COM=GCC
4931     CPUNAME=POWERPC
4932     OS=AIX
4933     RTL_OS=AIX
4934     RTL_ARCH=PowerPC
4935     PLATFORMID=aix_powerpc
4936     P_SEP=:
4937     ;;
4939 cygwin*|wsl*)
4940     # Already handled
4941     ;;
4943 darwin*)
4944     COM=GCC
4945     OS=MACOSX
4946     RTL_OS=MacOSX
4947     P_SEP=:
4949     case "$host_cpu" in
4950     aarch64|arm64)
4951         if test "$enable_ios_simulator" = "yes"; then
4952             OS=iOS
4953         else
4954             CPUNAME=AARCH64
4955             RTL_ARCH=AARCH64
4956             PLATFORMID=macosx_aarch64
4957         fi
4958         ;;
4959     x86_64)
4960         if test "$enable_ios_simulator" = "yes"; then
4961             OS=iOS
4962         fi
4963         CPUNAME=X86_64
4964         RTL_ARCH=X86_64
4965         PLATFORMID=macosx_x86_64
4966         ;;
4967     *)
4968         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4969         ;;
4970     esac
4971     ;;
4973 ios*)
4974     COM=GCC
4975     OS=iOS
4976     RTL_OS=iOS
4977     P_SEP=:
4979     case "$host_cpu" in
4980     aarch64|arm64)
4981         if test "$enable_ios_simulator" = "yes"; then
4982             AC_MSG_ERROR([iOS simulator is only available in macOS not iOS])
4983         fi
4984         ;;
4985     *)
4986         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4987         ;;
4988     esac
4989     CPUNAME=AARCH64
4990     RTL_ARCH=AARCH64
4991     PLATFORMID=ios_arm64
4992     ;;
4994 dragonfly*)
4995     COM=GCC
4996     OS=DRAGONFLY
4997     RTL_OS=DragonFly
4998     P_SEP=:
5000     case "$host_cpu" in
5001     i*86)
5002         CPUNAME=INTEL
5003         RTL_ARCH=x86
5004         PLATFORMID=dragonfly_x86
5005         ;;
5006     x86_64)
5007         CPUNAME=X86_64
5008         RTL_ARCH=X86_64
5009         PLATFORMID=dragonfly_x86_64
5010         ;;
5011     *)
5012         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5013         ;;
5014     esac
5015     ;;
5017 freebsd*)
5018     COM=GCC
5019     RTL_OS=FreeBSD
5020     OS=FREEBSD
5021     P_SEP=:
5023     case "$host_cpu" in
5024     aarch64)
5025         CPUNAME=AARCH64
5026         PLATFORMID=freebsd_aarch64
5027         RTL_ARCH=AARCH64
5028         ;;
5029     i*86)
5030         CPUNAME=INTEL
5031         RTL_ARCH=x86
5032         PLATFORMID=freebsd_x86
5033         ;;
5034     x86_64|amd64)
5035         CPUNAME=X86_64
5036         RTL_ARCH=X86_64
5037         PLATFORMID=freebsd_x86_64
5038         ;;
5039     powerpc64)
5040         CPUNAME=POWERPC64
5041         RTL_ARCH=PowerPC_64
5042         PLATFORMID=freebsd_powerpc64
5043         ;;
5044     powerpc|powerpcspe)
5045         CPUNAME=POWERPC
5046         RTL_ARCH=PowerPC
5047         PLATFORMID=freebsd_powerpc
5048         ;;
5049     *)
5050         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5051         ;;
5052     esac
5053     ;;
5055 haiku*)
5056     COM=GCC
5057     GUIBASE=haiku
5058     RTL_OS=Haiku
5059     OS=HAIKU
5060     P_SEP=:
5062     case "$host_cpu" in
5063     i*86)
5064         CPUNAME=INTEL
5065         RTL_ARCH=x86
5066         PLATFORMID=haiku_x86
5067         ;;
5068     x86_64|amd64)
5069         CPUNAME=X86_64
5070         RTL_ARCH=X86_64
5071         PLATFORMID=haiku_x86_64
5072         ;;
5073     *)
5074         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5075         ;;
5076     esac
5077     ;;
5079 kfreebsd*)
5080     COM=GCC
5081     OS=LINUX
5082     RTL_OS=kFreeBSD
5083     P_SEP=:
5085     case "$host_cpu" in
5087     i*86)
5088         CPUNAME=INTEL
5089         RTL_ARCH=x86
5090         PLATFORMID=kfreebsd_x86
5091         ;;
5092     x86_64)
5093         CPUNAME=X86_64
5094         RTL_ARCH=X86_64
5095         PLATFORMID=kfreebsd_x86_64
5096         ;;
5097     *)
5098         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5099         ;;
5100     esac
5101     ;;
5103 linux-gnu*|linux-musl*)
5104     COM=GCC
5105     OS=LINUX
5106     RTL_OS=Linux
5107     P_SEP=:
5109     case "$host_cpu" in
5111     aarch64)
5112         CPUNAME=AARCH64
5113         PLATFORMID=linux_aarch64
5114         RTL_ARCH=AARCH64
5115         EPM_FLAGS="-a arm64"
5116         ;;
5117     alpha)
5118         CPUNAME=AXP
5119         RTL_ARCH=ALPHA
5120         PLATFORMID=linux_alpha
5121         ;;
5122     arm*)
5123         CPUNAME=ARM
5124         EPM_FLAGS="-a arm"
5125         RTL_ARCH=ARM_EABI
5126         PLATFORMID=linux_arm_eabi
5127         case "$host_cpu" in
5128         arm*-linux)
5129             RTL_ARCH=ARM_OABI
5130             PLATFORMID=linux_arm_oabi
5131             ;;
5132         esac
5133         ;;
5134     hppa)
5135         CPUNAME=HPPA
5136         RTL_ARCH=HPPA
5137         EPM_FLAGS="-a hppa"
5138         PLATFORMID=linux_hppa
5139         ;;
5140     i*86)
5141         CPUNAME=INTEL
5142         RTL_ARCH=x86
5143         PLATFORMID=linux_x86
5144         ;;
5145     ia64)
5146         CPUNAME=IA64
5147         RTL_ARCH=IA64
5148         PLATFORMID=linux_ia64
5149         ;;
5150     mips)
5151         CPUNAME=GODSON
5152         RTL_ARCH=MIPS_EB
5153         EPM_FLAGS="-a mips"
5154         PLATFORMID=linux_mips_eb
5155         ;;
5156     mips64)
5157         CPUNAME=GODSON64
5158         RTL_ARCH=MIPS64_EB
5159         EPM_FLAGS="-a mips64"
5160         PLATFORMID=linux_mips64_eb
5161         ;;
5162     mips64el)
5163         CPUNAME=GODSON64
5164         RTL_ARCH=MIPS64_EL
5165         EPM_FLAGS="-a mips64el"
5166         PLATFORMID=linux_mips64_el
5167         ;;
5168     mipsel)
5169         CPUNAME=GODSON
5170         RTL_ARCH=MIPS_EL
5171         EPM_FLAGS="-a mipsel"
5172         PLATFORMID=linux_mips_el
5173         ;;
5174     m68k)
5175         CPUNAME=M68K
5176         RTL_ARCH=M68K
5177         PLATFORMID=linux_m68k
5178         ;;
5179     powerpc)
5180         CPUNAME=POWERPC
5181         RTL_ARCH=PowerPC
5182         PLATFORMID=linux_powerpc
5183         ;;
5184     powerpc64)
5185         CPUNAME=POWERPC64
5186         RTL_ARCH=PowerPC_64
5187         PLATFORMID=linux_powerpc64
5188         ;;
5189     powerpc64le)
5190         CPUNAME=POWERPC64
5191         RTL_ARCH=PowerPC_64_LE
5192         PLATFORMID=linux_powerpc64_le
5193         ;;
5194     sparc)
5195         CPUNAME=SPARC
5196         RTL_ARCH=SPARC
5197         PLATFORMID=linux_sparc
5198         ;;
5199     sparc64)
5200         CPUNAME=SPARC64
5201         RTL_ARCH=SPARC64
5202         PLATFORMID=linux_sparc64
5203         ;;
5204     s390)
5205         CPUNAME=S390
5206         RTL_ARCH=S390
5207         PLATFORMID=linux_s390
5208         ;;
5209     s390x)
5210         CPUNAME=S390X
5211         RTL_ARCH=S390x
5212         PLATFORMID=linux_s390x
5213         ;;
5214     x86_64)
5215         CPUNAME=X86_64
5216         RTL_ARCH=X86_64
5217         PLATFORMID=linux_x86_64
5218         ;;
5219     *)
5220         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5221         ;;
5222     esac
5223     ;;
5225 linux-android*)
5226     COM=GCC
5227     OS=ANDROID
5228     RTL_OS=Android
5229     P_SEP=:
5231     case "$host_cpu" in
5233     arm|armel)
5234         CPUNAME=ARM
5235         RTL_ARCH=ARM_EABI
5236         PLATFORMID=android_arm_eabi
5237         ;;
5238     aarch64)
5239         CPUNAME=AARCH64
5240         RTL_ARCH=AARCH64
5241         PLATFORMID=android_aarch64
5242         ;;
5243     i*86)
5244         CPUNAME=INTEL
5245         RTL_ARCH=x86
5246         PLATFORMID=android_x86
5247         ;;
5248     x86_64)
5249         CPUNAME=X86_64
5250         RTL_ARCH=X86_64
5251         PLATFORMID=android_x86_64
5252         ;;
5253     *)
5254         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5255         ;;
5256     esac
5257     ;;
5259 *netbsd*)
5260     COM=GCC
5261     OS=NETBSD
5262     RTL_OS=NetBSD
5263     P_SEP=:
5265     case "$host_cpu" in
5266     i*86)
5267         CPUNAME=INTEL
5268         RTL_ARCH=x86
5269         PLATFORMID=netbsd_x86
5270         ;;
5271     powerpc)
5272         CPUNAME=POWERPC
5273         RTL_ARCH=PowerPC
5274         PLATFORMID=netbsd_powerpc
5275         ;;
5276     sparc)
5277         CPUNAME=SPARC
5278         RTL_ARCH=SPARC
5279         PLATFORMID=netbsd_sparc
5280         ;;
5281     x86_64)
5282         CPUNAME=X86_64
5283         RTL_ARCH=X86_64
5284         PLATFORMID=netbsd_x86_64
5285         ;;
5286     *)
5287         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5288         ;;
5289     esac
5290     ;;
5292 openbsd*)
5293     COM=GCC
5294     OS=OPENBSD
5295     RTL_OS=OpenBSD
5296     P_SEP=:
5298     case "$host_cpu" in
5299     i*86)
5300         CPUNAME=INTEL
5301         RTL_ARCH=x86
5302         PLATFORMID=openbsd_x86
5303         ;;
5304     x86_64)
5305         CPUNAME=X86_64
5306         RTL_ARCH=X86_64
5307         PLATFORMID=openbsd_x86_64
5308         ;;
5309     *)
5310         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5311         ;;
5312     esac
5313     SOLARINC="$SOLARINC -I/usr/local/include"
5314     ;;
5316 solaris*)
5317     COM=GCC
5318     OS=SOLARIS
5319     RTL_OS=Solaris
5320     P_SEP=:
5322     case "$host_cpu" in
5323     i*86)
5324         CPUNAME=INTEL
5325         RTL_ARCH=x86
5326         PLATFORMID=solaris_x86
5327         ;;
5328     sparc)
5329         CPUNAME=SPARC
5330         RTL_ARCH=SPARC
5331         PLATFORMID=solaris_sparc
5332         ;;
5333     sparc64)
5334         CPUNAME=SPARC64
5335         RTL_ARCH=SPARC64
5336         PLATFORMID=solaris_sparc64
5337         ;;
5338     *)
5339         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5340         ;;
5341     esac
5342     SOLARINC="$SOLARINC -I/usr/local/include"
5343     ;;
5345 emscripten*)
5346     COM=GCC
5347     OS=EMSCRIPTEN
5348     RTL_OS=Emscripten
5349     P_SEP=:
5351     case "$host_cpu" in
5352     wasm32|wasm64)
5353         ;;
5354     *)
5355         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5356         ;;
5357     esac
5358     CPUNAME=INTEL
5359     RTL_ARCH=x86
5360     PLATFORMID=linux_x86
5361     ;;
5364     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
5365     ;;
5366 esac
5368 DISABLE_GUI=""
5369 if test "$enable_gui" = "no"; then
5370     if test "$using_x11" != yes; then
5371         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
5372     fi
5373     USING_X11=
5374     DISABLE_GUI=TRUE
5375     test_epoxy=no
5376 else
5377     AC_DEFINE(HAVE_FEATURE_UI)
5379 AC_SUBST(DISABLE_GUI)
5381 if test "$with_x" = "no"; then
5382     USING_X11=
5385 if test -z "$USING_X11" -a "$DISABLE_DYNLOADING" = TRUE -a "$enable_gen" = "yes"; then
5386     AC_MSG_ERROR([Can't select gen VCL plugin, if --without-x is used!])
5389 if test "$using_x11" = yes; then
5390     if test "$USING_X11" = TRUE; then
5391         AC_DEFINE(USING_X11)
5392     else
5393         disable_x11_tests
5394         if test "$DISABLE_DYNLOADING" = TRUE; then
5395             test_qt5=yes
5396         fi
5397     fi
5398 else
5399     if test "$USING_X11" = TRUE; then
5400         AC_MSG_ERROR([Platform doesn't support X11 (\$using_x11), but \$USING_X11 is set!])
5401     fi
5404 WORKDIR="${BUILDDIR}/workdir"
5405 INSTDIR="${BUILDDIR}/instdir"
5406 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
5407 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
5408 AC_SUBST(COM)
5409 AC_SUBST(CPUNAME)
5410 AC_SUBST(RTL_OS)
5411 AC_SUBST(RTL_ARCH)
5412 AC_SUBST(EPM_FLAGS)
5413 AC_SUBST(USING_X11)
5414 AC_SUBST([INSTDIR])
5415 AC_SUBST([INSTROOT])
5416 AC_SUBST([INSTROOTBASE])
5417 AC_SUBST(OS)
5418 AC_SUBST(P_SEP)
5419 AC_SUBST(WORKDIR)
5420 AC_SUBST(PLATFORMID)
5421 AC_SUBST(WINDOWS_X64)
5422 AC_DEFINE_UNQUOTED(SDKDIR, "$INSTDIR/$SDKDIRNAME")
5423 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
5425 if test "$OS" = WNT -a "$COM" = MSC; then
5426     case "$CPUNAME" in
5427     INTEL) CPPU_ENV=msci ;;
5428     X86_64) CPPU_ENV=mscx ;;
5429     AARCH64) CPPU_ENV=msca ;;
5430     *)
5431         AC_MSG_ERROR([Unknown \$CPUNAME '$CPUNAME' for $OS / $COM"])
5432         ;;
5433     esac
5434 else
5435     CPPU_ENV=gcc3
5437 AC_SUBST(CPPU_ENV)
5439 dnl ===================================================================
5440 dnl Test which package format to use
5441 dnl ===================================================================
5442 AC_MSG_CHECKING([which package format to use])
5443 if test -n "$with_package_format" -a "$with_package_format" != no; then
5444     for i in $with_package_format; do
5445         case "$i" in
5446         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
5447             ;;
5448         *)
5449             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
5450 aix - AIX software distribution
5451 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
5452 deb - Debian software distribution
5453 pkg - Solaris software distribution
5454 rpm - RedHat software distribution
5456 LibreOffice additionally supports:
5457 archive - .tar.gz or .zip
5458 dmg - macOS .dmg
5459 installed - installation tree
5460 msi - Windows .msi
5461         ])
5462             ;;
5463         esac
5464     done
5465     # fakeroot is needed to ensure correct file ownerships/permissions
5466     # inside deb packages and tar archives created on Linux and Solaris.
5467     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
5468         AC_PATH_PROG(FAKEROOT, fakeroot, no)
5469         if test "$FAKEROOT" = "no"; then
5470             AC_MSG_ERROR(
5471                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
5472         fi
5473     fi
5474     PKGFORMAT="$with_package_format"
5475     AC_MSG_RESULT([$PKGFORMAT])
5476 else
5477     PKGFORMAT=
5478     AC_MSG_RESULT([none])
5480 AC_SUBST(PKGFORMAT)
5482 dnl ===================================================================
5483 dnl handle help related options
5485 dnl If you change help related options, please update README.help
5486 dnl ===================================================================
5488 ENABLE_HTMLHELP=
5489 HELP_OMINDEX_PAGE=
5490 HELP_ONLINE=
5491 WITH_HELPPACKS=
5493 AC_MSG_CHECKING([which help to build])
5494 if test -n "$with_help" -a "$with_help" != "no"; then
5495     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5496     BUILD_TYPE="$BUILD_TYPE HELP"
5497     case "$with_help" in
5498     "html")
5499         ENABLE_HTMLHELP=TRUE
5500         WITH_HELPPACKS=TRUE
5501         SCPDEFS="$SCPDEFS -DWITH_HELPPACKS"
5502         AC_MSG_RESULT([HTML (local)])
5503         ;;
5504     "online")
5505         ENABLE_HTMLHELP=TRUE
5506         HELP_ONLINE=TRUE
5507         AC_MSG_RESULT([HTML (online)])
5508         ;;
5509     yes)
5510         WITH_HELPPACKS=TRUE
5511         SCPDEFS="$SCPDEFS -DWITH_HELPPACKS"
5512         AC_MSG_RESULT([XML (local)])
5513         ;;
5514     *)
5515         AC_MSG_ERROR([Unknown --with-help=$with_help])
5516         ;;
5517     esac
5518 else
5519     AC_MSG_RESULT([no])
5522 AC_MSG_CHECKING([if we need to build the help index tooling])
5523 if test \( "$with_help" = yes -o "$enable_extension_integration" != no \) -a -z "$DISABLE_DYNLOADING"; then
5524     BUILD_TYPE="$BUILD_TYPE HELPTOOLS"
5525     test_clucene=yes
5526     AC_MSG_RESULT([yes])
5527 else
5528     AC_MSG_RESULT([no])
5531 AC_MSG_CHECKING([whether to enable xapian-omega support for online help])
5532 if test -n "$with_omindex" -a "$with_omindex" != "no"; then
5533     if test "$HELP_ONLINE" != TRUE; then
5534         AC_MSG_ERROR([Can't build xapian-omega index without --help=online])
5535     fi
5536     case "$with_omindex" in
5537     "server")
5538         HELP_OMINDEX_PAGE=TRUE
5539         AC_MSG_RESULT([SERVER])
5540         ;;
5541     "noxap")
5542         AC_MSG_RESULT([NOXAP])
5543         ;;
5544     *)
5545         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5546         ;;
5547     esac
5548 else
5549     AC_MSG_RESULT([no])
5552 AC_MSG_CHECKING([whether to include the XML-help support])
5553 if test "$enable_xmlhelp" = yes; then
5554     BUILD_TYPE="$BUILD_TYPE XMLHELP"
5555     test_clucene=yes
5556     AC_DEFINE(HAVE_FEATURE_XMLHELP)
5557     AC_MSG_RESULT([yes])
5558 else
5559     if test "$with_help" = yes; then
5560         add_warning "Building the XML help, but LO with disabled xmlhelp support. Generated help can't be accessed from this LO build!"
5561     fi
5562     AC_MSG_RESULT([no])
5565 dnl Test whether to integrate helppacks into the product's installer
5566 AC_MSG_CHECKING([for helppack integration])
5567 if test -z "$WITH_HELPPACKS" -o "$with_helppack_integration" = no; then
5568     AC_MSG_RESULT([no integration])
5569 else
5570     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
5571     AC_MSG_RESULT([integration])
5574 AC_SUBST([ENABLE_HTMLHELP])
5575 AC_SUBST([HELP_OMINDEX_PAGE])
5576 AC_SUBST([HELP_ONLINE])
5577 # WITH_HELPPACKS is used only in configure
5579 dnl ===================================================================
5580 dnl Set up a different compiler to produce tools to run on the build
5581 dnl machine when doing cross-compilation
5582 dnl ===================================================================
5584 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
5585 m4_pattern_allow([PKG_CONFIG_LIBDIR])
5586 if test "$cross_compiling" = "yes"; then
5587     AC_MSG_CHECKING([for BUILD platform configuration])
5588     echo
5589     rm -rf CONF-FOR-BUILD config_build.mk
5590     mkdir CONF-FOR-BUILD
5591     # Here must be listed all files needed when running the configure script. In particular, also
5592     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
5593     # keep them in the same order as there.
5594     (cd $SRC_ROOT && tar cf - \
5595         config.guess \
5596         bin/get_config_variables \
5597         solenv/bin/getcompver.awk \
5598         solenv/inc/langlist.mk \
5599         download.lst \
5600         config_host.mk.in \
5601         config_host_lang.mk.in \
5602         Makefile.in \
5603         bin/bffvalidator.sh.in \
5604         bin/odfvalidator.sh.in \
5605         bin/officeotron.sh.in \
5606         hardened_runtime.xcent.in \
5607         instsetoo_native/util/openoffice.lst.in \
5608         config_host/*.in \
5609         sysui/desktop/macosx/Info.plist.in \
5610         .vscode/vs-code-template.code-workspace.in \
5611         solenv/lockfile/autoconf.h.in \
5612         ) \
5613     | (cd CONF-FOR-BUILD && tar xf -)
5614     cp configure CONF-FOR-BUILD
5615     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
5616     (
5617     unset COM USING_X11 OS CPUNAME
5618     unset CC CXX SYSBASE CFLAGS
5619     unset AR LD NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
5620     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
5621     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
5622     unset PKG_CONFIG_LIBDIR PKG_CONFIG_PATH
5623     if test -n "$CC_FOR_BUILD"; then
5624         export CC="$CC_FOR_BUILD"
5625         CC_BASE=`first_arg_basename "$CC"`
5626     fi
5627     if test -n "$CXX_FOR_BUILD"; then
5628         export CXX="$CXX_FOR_BUILD"
5629         CXX_BASE=`first_arg_basename "$CXX"`
5630     fi
5631     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
5632     cd CONF-FOR-BUILD
5634     # Handle host configuration, which affects the cross-toolset too
5635     sub_conf_opts=""
5636     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
5637     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
5638     test "$with_junit" = "no" && sub_conf_opts="$sub_conf_opts --without-junit"
5639     # While we don't need scripting support, we don't have a PYTHON_FOR_BUILD Java equivalent, so must enable scripting for Java
5640     if test -n "$ENABLE_JAVA"; then
5641         case "$_os" in
5642         Android)
5643             # Hack for Android - the build doesn't need a host JDK, so just forward to build for convenience
5644             test -n "$with_jdk_home" && sub_conf_opts="$sub_conf_opts --with-jdk-home=$with_jdk_home"
5645             ;;
5646         *)
5647             if test -z "$with_jdk_home"; then
5648                 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.])
5649             fi
5650             ;;
5651         esac
5652     else
5653         sub_conf_opts="$sub_conf_opts --disable-scripting"
5654     fi
5655     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
5656     test "$with_galleries" = "no" -o -z "$WITH_GALLERY_BUILD" && sub_conf_opts="$sub_conf_opts --with-galleries=no --disable-database-connectivity"
5657     test -n "$with_help" -a "$with_help" != "no" && sub_conf_opts="$sub_conf_opts --with-help=$with_help"
5658     test "$enable_extensions" = yes || sub_conf_opts="$sub_conf_opts --disable-extensions"
5659     test "${enable_ld+set}" = set -a "$build_cpu" = "$host_cpu" && sub_conf_opts="$sub_conf_opts --enable-ld=${enable_ld}"
5660     test "${enable_pch+set}" = set && sub_conf_opts="$sub_conf_opts --enable-pch=${enable_pch}"
5661     test "$enable_wasm_strip" = "yes" && sub_conf_opts="$sub_conf_opts --enable-wasm-strip"
5662     test "${with_system_lockfile+set}" = set && sub_conf_opts="$sub_conf_opts --with-system-lockfile=${with_system_lockfile}"
5663     test "${enable_fuzzers}" = yes && sub_conf_opts="$sub_conf_opts --without-system-libxml"
5664     if test "$_os" = "Emscripten"; then
5665         sub_conf_opts="$sub_conf_opts --without-system-libxml --without-system-fontconfig --without-system-freetype --without-system-zlib"
5666     fi
5668     # Don't bother having configure look for stuff not needed for the build platform anyway
5669     # WARNING: any option with an argument containing spaces must be handled separately (see --with-theme)
5670     sub_conf_defaults=" \
5671         --build="$build_alias" \
5672         --disable-cairo-canvas \
5673         --disable-cups \
5674         --disable-customtarget-components \
5675         --disable-firebird-sdbc \
5676         --disable-gpgmepp \
5677         --disable-gstreamer-1-0 \
5678         --disable-gtk3 \
5679         --disable-gtk4 \
5680         --disable-libcmis \
5681         --disable-mariadb-sdbc \
5682         --disable-nss \
5683         --disable-online-update \
5684         --disable-opencl \
5685         --disable-pdfimport \
5686         --disable-postgresql-sdbc \
5687         --disable-skia \
5688         --disable-xmlhelp \
5689         --enable-dynamic-loading \
5690         --enable-icecream="$enable_icecream" \
5691         --without-doxygen \
5692         --without-webdav \
5693         --without-x \
5694         --with-tls=openssl \
5696     # single quotes added for better readability in case of spaces
5697     echo "    Running CONF-FOR-BUILD/configure" \
5698         $sub_conf_defaults \
5699         --with-parallelism="'$with_parallelism'" \
5700         --with-theme="'$with_theme'" \
5701         $sub_conf_opts \
5702         $with_build_platform_configure_options \
5703         --srcdir=$srcdir
5705     ./configure \
5706         $sub_conf_defaults \
5707         --with-parallelism="$with_parallelism" \
5708         --with-theme="$with_theme" \
5709         $sub_conf_opts \
5710         $with_build_platform_configure_options \
5711         --srcdir=$srcdir \
5712         2>&1 | sed -e 's/^/    /'
5713     if test [${PIPESTATUS[0]}] -ne 0; then
5714         AC_MSG_ERROR([Running the configure script for BUILD side failed, see CONF-FOR-BUILD/config.log])
5715     fi
5717     # filter permitted build targets
5718     PERMITTED_BUILD_TARGETS="
5719         AVMEDIA
5720         BOOST
5721         CAIRO
5722         CLUCENE
5723         CUCKOO
5724         CURL
5725         DBCONNECTIVITY
5726         DESKTOP
5727         DRAGONBOX
5728         DYNLOADING
5729         EPOXY
5730         EXPAT
5731         GLM
5732         GRAPHITE
5733         HARFBUZZ
5734         HELPTOOLS
5735         ICU
5736         LCMS2
5737         LIBJPEG_TURBO
5738         LIBLANGTAG
5739         LibO
5740         LIBFFI
5741         LIBPN
5742         LIBWEBP
5743         LIBXML2
5744         LIBXSLT
5745         MDDS
5746         NATIVE
5747         OPENSSL
5748         ORCUS
5749         PYTHON
5750         SCRIPTING
5751         ZLIB
5753     # converts BUILD_TYPE and PERMITTED_BUILD_TARGETS into non-whitespace,
5754     # newlined lists, to use grep as a filter
5755     PERMITTED_BUILD_TARGETS=$(echo "$PERMITTED_BUILD_TARGETS" | sed -e '/^ *$/d' -e 's/ *//')
5756     BUILD_TARGETS="$(sed -n -e '/^export BUILD_TYPE=/ s/.*=//p' config_host.mk | tr ' ' '\n')"
5757     BUILD_TARGETS="$(echo "$BUILD_TARGETS" | grep -F "$PERMITTED_BUILD_TARGETS" | tr '\n' ' ')"
5758     sed -i -e "s/ BUILD_TYPE=.*$/ BUILD_TYPE=$BUILD_TARGETS/" config_host.mk
5760     cp config_host.mk ../config_build.mk
5761     cp config_host_lang.mk ../config_build_lang.mk
5762     mv config.log ../config.Build.log
5763     mkdir -p ../config_build
5764     mv config_host/*.h ../config_build
5765     test -f "$WARNINGS_FILE" && mv "$WARNINGS_FILE" "../$WARNINGS_FILE_FOR_BUILD"
5767     # all these will get a _FOR_BUILD postfix
5768     DIRECT_FOR_BUILD_SETTINGS="
5769         CC
5770         CPPU_ENV
5771         CXX
5772         ILIB
5773         JAVA_HOME
5774         JAVAIFLAGS
5775         JDK
5776         LIBO_BIN_FOLDER
5777         LIBO_LIB_FOLDER
5778         LIBO_URE_LIB_FOLDER
5779         LIBO_URE_MISC_FOLDER
5780         OS
5781         SDKDIRNAME
5782         SYSTEM_LIBXML
5783         SYSTEM_LIBXSLT
5785     # these overwrite host config with build config
5786     OVERWRITING_SETTINGS="
5787         ANT
5788         ANT_HOME
5789         ANT_LIB
5790         HSQLDB_USE_JDBC_4_1
5791         JAVA_CLASSPATH_NOT_SET
5792         JAVA_SOURCE_VER
5793         JAVA_TARGET_VER
5794         JAVACFLAGS
5795         JAVACOMPILER
5796         JAVADOC
5797         JAVADOCISGJDOC
5798         LOCKFILE
5799         SYSTEM_GENBRK
5800         SYSTEM_GENCCODE
5801         SYSTEM_GENCMN
5803     # these need some special handling
5804     EXTRA_HANDLED_SETTINGS="
5805         INSTDIR
5806         INSTROOT
5807         PATH
5808         WORKDIR
5810     OLD_PATH=$PATH
5811     . ./bin/get_config_variables $DIRECT_FOR_BUILD_SETTINGS $OVERWRITING_SETTINGS $EXTRA_HANDLED_SETTINGS
5812     BUILD_PATH=$PATH
5813     PATH=$OLD_PATH
5815     line=`echo "LO_PATH_FOR_BUILD='${BUILD_PATH}'" | sed -e 's,/CONF-FOR-BUILD,,g'`
5816     echo "$line" >>build-config
5818     for V in $DIRECT_FOR_BUILD_SETTINGS; do
5819         VV='$'$V
5820         VV=`eval "echo $VV"`
5821         if test -n "$VV"; then
5822             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
5823             echo "$line" >>build-config
5824         fi
5825     done
5827     for V in $OVERWRITING_SETTINGS; do
5828         VV='$'$V
5829         VV=`eval "echo $VV"`
5830         if test -n "$VV"; then
5831             line=${V}='${'${V}:-$VV'}'
5832             echo "$line" >>build-config
5833         fi
5834     done
5836     for V in INSTDIR INSTROOT WORKDIR; do
5837         VV='$'$V
5838         VV=`eval "echo $VV"`
5839         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
5840         if test -n "$VV"; then
5841             line="${V}_FOR_BUILD='$VV'"
5842             echo "$line" >>build-config
5843         fi
5844     done
5846     )
5847     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([setup/configure for BUILD side failed, see CONF-FOR-BUILD/config.log])
5848     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])
5849     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
5850              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
5852     eval `cat CONF-FOR-BUILD/build-config`
5854     AC_MSG_RESULT([checking for BUILD platform configuration... done])
5856     rm -rf CONF-FOR-BUILD
5857 else
5858     OS_FOR_BUILD="$OS"
5859     CC_FOR_BUILD="$CC"
5860     CPPU_ENV_FOR_BUILD="$CPPU_ENV"
5861     CXX_FOR_BUILD="$CXX"
5862     INSTDIR_FOR_BUILD="$INSTDIR"
5863     INSTROOT_FOR_BUILD="$INSTROOT"
5864     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
5865     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
5866     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
5867     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
5868     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
5869     WORKDIR_FOR_BUILD="$WORKDIR"
5871 AC_SUBST(OS_FOR_BUILD)
5872 AC_SUBST(INSTDIR_FOR_BUILD)
5873 AC_SUBST(INSTROOT_FOR_BUILD)
5874 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
5875 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
5876 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
5877 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
5878 AC_SUBST(SDKDIRNAME_FOR_BUILD)
5879 AC_SUBST(WORKDIR_FOR_BUILD)
5880 AC_SUBST(CC_FOR_BUILD)
5881 AC_SUBST(CXX_FOR_BUILD)
5882 AC_SUBST(CPPU_ENV_FOR_BUILD)
5884 dnl ===================================================================
5885 dnl Check for lockfile deps
5886 dnl ===================================================================
5887 if test -z "$CROSS_COMPILING"; then
5888     test -n "$LOCKFILE" -a "${with_system_lockfile+set}" != set && with_system_lockfile="$LOCKFILE"
5889     test "${with_system_lockfile+set}" = set || with_system_lockfile=no
5890     AC_MSG_CHECKING([which lockfile binary to use])
5891     case "$with_system_lockfile" in
5892     yes)
5893         AC_MSG_RESULT([external])
5894         AC_PATH_PROGS([LOCKFILE],[dotlockfile lockfile])
5895         ;;
5896     no)
5897         AC_MSG_RESULT([internal])
5898         ;;
5899     *)
5900         if test -x "$with_system_lockfile"; then
5901             LOCKFILE="$with_system_lockfile"
5902         else
5903             AC_MSG_ERROR(['$with_system_lockfile' is not executable.])
5904         fi
5905         AC_MSG_RESULT([$with_system_lockfile])
5906         ;;
5907     esac
5910 if test -n "$LOCKFILE" -a "$DISABLE_DYNLOADING" = TRUE; then
5911     add_warning "The default system lockfile has increasing poll intervals up to 60s, so linking executables may be delayed."
5914 AC_CHECK_HEADERS([getopt.h paths.h sys/param.h])
5915 AC_CHECK_FUNCS([utime utimes])
5916 AC_SUBST(LOCKFILE)
5918 dnl ===================================================================
5919 dnl Check for syslog header
5920 dnl ===================================================================
5921 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
5923 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
5924 dnl ===================================================================
5925 AC_MSG_CHECKING([whether to turn warnings to errors])
5926 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
5927     ENABLE_WERROR="TRUE"
5928     PYTHONWARNINGS="error"
5929     AC_MSG_RESULT([yes])
5930 else
5931     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
5932         ENABLE_WERROR="TRUE"
5933         PYTHONWARNINGS="error"
5934         AC_MSG_RESULT([yes])
5935     else
5936         AC_MSG_RESULT([no])
5937     fi
5939 AC_SUBST(ENABLE_WERROR)
5940 AC_SUBST(PYTHONWARNINGS)
5942 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
5943 dnl ===================================================================
5944 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
5945 if test -z "$enable_assert_always_abort"; then
5946    if test "$ENABLE_DEBUG" = TRUE; then
5947        enable_assert_always_abort=yes
5948    else
5949        enable_assert_always_abort=no
5950    fi
5952 if test "$enable_assert_always_abort" = "yes"; then
5953     ASSERT_ALWAYS_ABORT="TRUE"
5954     AC_MSG_RESULT([yes])
5955 else
5956     ASSERT_ALWAYS_ABORT="FALSE"
5957     AC_MSG_RESULT([no])
5959 AC_SUBST(ASSERT_ALWAYS_ABORT)
5961 # Determine whether to use ooenv for the instdir installation
5962 # ===================================================================
5963 if test $_os != "WINNT" -a $_os != "Darwin"; then
5964     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
5965     if test -z "$enable_ooenv"; then
5966         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5967             enable_ooenv=yes
5968         else
5969             enable_ooenv=no
5970         fi
5971     fi
5972     if test "$enable_ooenv" = "no"; then
5973         AC_MSG_RESULT([no])
5974     else
5975         ENABLE_OOENV="TRUE"
5976         AC_MSG_RESULT([yes])
5977     fi
5979 AC_SUBST(ENABLE_OOENV)
5981 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
5982     if test "$enable_qt5" = "no"; then
5983         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
5984     else
5985         enable_qt5=yes
5986     fi
5989 AC_MSG_CHECKING([whether to build the pagein binaries for oosplash])
5990 if test "${enable_pagein}" != no -a -z "$DISABLE_DYNLOADING"; then
5991     AC_MSG_RESULT([yes])
5992     ENABLE_PAGEIN=TRUE
5993     AC_DEFINE(HAVE_FEATURE_PAGEIN)
5994 else
5995     AC_MSG_RESULT([no])
5997 AC_SUBST(ENABLE_PAGEIN)
5999 dnl ===================================================================
6000 dnl check for cups support
6001 dnl ===================================================================
6003 AC_MSG_CHECKING([whether to enable CUPS support])
6004 if test "$test_cups" = yes -a "$enable_cups" != no; then
6005     ENABLE_CUPS=TRUE
6006     AC_MSG_RESULT([yes])
6008     AC_MSG_CHECKING([whether cups support is present])
6009     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
6010     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
6011     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
6012         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
6013     fi
6014 else
6015     AC_MSG_RESULT([no])
6018 AC_SUBST(ENABLE_CUPS)
6020 libo_CHECK_SYSTEM_MODULE([fontconfig],[FONTCONFIG],[fontconfig >= 2.4.1],,system,TRUE)
6022 dnl whether to find & fetch external tarballs?
6023 dnl ===================================================================
6024 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
6025    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6026        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
6027    else
6028        TARFILE_LOCATION="$LODE_HOME/ext_tar"
6029    fi
6031 if test -z "$TARFILE_LOCATION"; then
6032     if test -d "$SRC_ROOT/src" ; then
6033         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
6034         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
6035     fi
6036     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
6037 else
6038     AbsolutePath "$TARFILE_LOCATION"
6039     PathFormat "${absolute_path}"
6040     TARFILE_LOCATION="${formatted_path}"
6042 AC_SUBST(TARFILE_LOCATION)
6044 AC_MSG_CHECKING([whether we want to fetch tarballs])
6045 if test "$enable_fetch_external" != "no"; then
6046     if test "$with_all_tarballs" = "yes"; then
6047         AC_MSG_RESULT([yes, all of them])
6048         DO_FETCH_TARBALLS="ALL"
6049     else
6050         AC_MSG_RESULT([yes, if we use them])
6051         DO_FETCH_TARBALLS="TRUE"
6052     fi
6053 else
6054     AC_MSG_RESULT([no])
6055     DO_FETCH_TARBALLS=
6057 AC_SUBST(DO_FETCH_TARBALLS)
6059 dnl Test whether to include MySpell dictionaries
6060 dnl ===================================================================
6061 AC_MSG_CHECKING([whether to include MySpell dictionaries])
6062 if test "$with_myspell_dicts" = "yes"; then
6063     AC_MSG_RESULT([yes])
6064     WITH_MYSPELL_DICTS=TRUE
6065     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
6066     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
6067 else
6068     AC_MSG_RESULT([no])
6069     WITH_MYSPELL_DICTS=
6071 AC_SUBST(WITH_MYSPELL_DICTS)
6073 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
6074 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
6075     if test "$with_system_dicts" = yes; then
6076         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
6077     fi
6078     with_system_dicts=no
6081 AC_MSG_CHECKING([whether to use dicts from external paths])
6082 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
6083     AC_MSG_RESULT([yes])
6084     SYSTEM_DICTS=TRUE
6085     AC_MSG_CHECKING([for spelling dictionary directory])
6086     if test -n "$with_external_dict_dir"; then
6087         DICT_SYSTEM_DIR=file://$with_external_dict_dir
6088     else
6089         DICT_SYSTEM_DIR=file:///usr/share/hunspell
6090         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
6091             DICT_SYSTEM_DIR=file:///usr/share/myspell
6092         fi
6093     fi
6094     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
6095     AC_MSG_CHECKING([for hyphenation patterns directory])
6096     if test -n "$with_external_hyph_dir"; then
6097         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
6098     else
6099         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
6100     fi
6101     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
6102     AC_MSG_CHECKING([for thesaurus directory])
6103     if test -n "$with_external_thes_dir"; then
6104         THES_SYSTEM_DIR=file://$with_external_thes_dir
6105     else
6106         THES_SYSTEM_DIR=file:///usr/share/mythes
6107     fi
6108     AC_MSG_RESULT([$THES_SYSTEM_DIR])
6109 else
6110     AC_MSG_RESULT([no])
6111     SYSTEM_DICTS=
6113 AC_SUBST(SYSTEM_DICTS)
6114 AC_SUBST(DICT_SYSTEM_DIR)
6115 AC_SUBST(HYPH_SYSTEM_DIR)
6116 AC_SUBST(THES_SYSTEM_DIR)
6118 dnl ===================================================================
6119 dnl Precompiled headers.
6120 ENABLE_PCH=""
6121 AC_MSG_CHECKING([whether to enable pch feature])
6122 if test -z "$enable_pch"; then
6123     if test "$_os" = "WINNT"; then
6124         # Enabled by default on Windows.
6125         enable_pch=yes
6126         # never use sccache on auto-enabled PCH builds, except if requested explicitly
6127         if test -z "$enable_ccache" -a "$SCCACHE"; then
6128             CCACHE=""
6129         fi
6130     else
6131         enable_pch=no
6132     fi
6134 if test "$enable_pch" != no -a "$_os" = Emscripten -a "$ENABLE_WASM_EXCEPTIONS" = TRUE; then
6135     AC_MSG_ERROR([PCH currently isn't supported for Emscripten with native EH (nEH) because of missing Sj/Lj support with nEH in clang.])
6137 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
6138     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
6140 if test "$enable_pch" = "system"; then
6141     ENABLE_PCH="1"
6142     AC_MSG_RESULT([yes (system headers)])
6143 elif test "$enable_pch" = "base"; then
6144     ENABLE_PCH="2"
6145     AC_MSG_RESULT([yes (system and base headers)])
6146 elif test "$enable_pch" = "normal"; then
6147     ENABLE_PCH="3"
6148     AC_MSG_RESULT([yes (normal)])
6149 elif test "$enable_pch" = "full"; then
6150     ENABLE_PCH="4"
6151     AC_MSG_RESULT([yes (full)])
6152 elif test "$enable_pch" = "yes"; then
6153     # Pick a suitable default.
6154     if test "$GCC" = "yes"; then
6155         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
6156         # while making the PCHs larger and rebuilds more likely.
6157         ENABLE_PCH="2"
6158         AC_MSG_RESULT([yes (system and base headers)])
6159     else
6160         # With MSVC the highest level makes a significant difference,
6161         # and it was the default when there used to be no PCH levels.
6162         ENABLE_PCH="4"
6163         AC_MSG_RESULT([yes (full)])
6164     fi
6165 elif test "$enable_pch" = "no"; then
6166     AC_MSG_RESULT([no])
6167 else
6168     AC_MSG_ERROR([Unknown value for --enable-pch])
6170 AC_SUBST(ENABLE_PCH)
6171 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
6172 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
6173     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
6174     if test "$CCACHE_BIN" != "not found"; then
6175         AC_MSG_CHECKING([ccache version])
6176         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
6177         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6178         AC_MSG_RESULT([$CCACHE_VERSION])
6179         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
6180         if test "$CCACHE_NUMVER" -gt "030701"; then
6181             AC_MSG_RESULT([yes])
6182         else
6183             AC_MSG_RESULT([no (not newer than 3.7.1)])
6184             CCACHE_DEPEND_MODE=
6185         fi
6186     fi
6189 PCH_INSTANTIATE_TEMPLATES=
6190 if test -n "$ENABLE_PCH"; then
6191     AC_MSG_CHECKING([whether $CC supports -fpch-instantiate-templates])
6192     save_CFLAGS=$CFLAGS
6193     CFLAGS="$CFLAGS -Werror -fpch-instantiate-templates"
6194     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_INSTANTIATE_TEMPLATES="-fpch-instantiate-templates" ],[])
6195     CFLAGS=$save_CFLAGS
6196     if test -n "$PCH_INSTANTIATE_TEMPLATES"; then
6197         AC_MSG_RESULT(yes)
6198     else
6199         AC_MSG_RESULT(no)
6200     fi
6202 AC_SUBST(PCH_INSTANTIATE_TEMPLATES)
6204 BUILDING_PCH_WITH_OBJ=
6205 if test -n "$ENABLE_PCH"; then
6206     AC_MSG_CHECKING([whether $CC supports -Xclang -building-pch-with-obj])
6207     save_CFLAGS=$CFLAGS
6208     CFLAGS="$CFLAGS -Werror -Xclang -building-pch-with-obj"
6209     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ BUILDING_PCH_WITH_OBJ="-Xclang -building-pch-with-obj" ],[])
6210     CFLAGS=$save_CFLAGS
6211     if test -n "$BUILDING_PCH_WITH_OBJ"; then
6212         AC_MSG_RESULT(yes)
6213     else
6214         AC_MSG_RESULT(no)
6215     fi
6217 AC_SUBST(BUILDING_PCH_WITH_OBJ)
6219 PCH_CODEGEN=
6220 PCH_NO_CODEGEN=
6221 fpch_prefix=
6222 if test "$COM" = MSC; then
6223     fpch_prefix="-Xclang "
6225 if test -n "$BUILDING_PCH_WITH_OBJ"; then
6226     AC_MSG_CHECKING([whether $CC supports ${fpch_prefix}-fpch-codegen])
6227     save_CFLAGS=$CFLAGS
6228     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fpch-codegen"
6229     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
6230         [ PCH_CODEGEN="${fpch_prefix}-fpch-codegen" ],[])
6231     CFLAGS=$save_CFLAGS
6232     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fno-pch-codegen"
6233     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
6234         [ PCH_NO_CODEGEN="${fpch_prefix}-fno-pch-codegen" ],[])
6235     CFLAGS=$save_CFLAGS
6236     if test -n "$PCH_CODEGEN"; then
6237         AC_MSG_RESULT(yes)
6238     else
6239         AC_MSG_RESULT(no)
6240     fi
6242 AC_SUBST(PCH_CODEGEN)
6243 AC_SUBST(PCH_NO_CODEGEN)
6244 PCH_DEBUGINFO=
6245 if test -n "$BUILDING_PCH_WITH_OBJ"; then
6246     AC_MSG_CHECKING([whether $CC supports ${fpch_prefix}-fpch-debuginfo])
6247     save_CFLAGS=$CFLAGS
6248     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fpch-debuginfo"
6249     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_DEBUGINFO="${fpch_prefix}-fpch-debuginfo" ],[])
6250     CFLAGS=$save_CFLAGS
6251     if test -n "$PCH_DEBUGINFO"; then
6252         AC_MSG_RESULT(yes)
6253     else
6254         AC_MSG_RESULT(no)
6255     fi
6257 AC_SUBST(PCH_DEBUGINFO)
6259 TAB=`printf '\t'`
6261 AC_MSG_CHECKING([the GNU Make version])
6262 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
6263 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6264 if test "$_make_longver" -ge "038200"; then
6265     AC_MSG_RESULT([$GNUMAKE $_make_version])
6267 elif test "$_make_longver" -ge "038100"; then
6268     if test "$build_os" = "cygwin"; then
6269         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
6270     fi
6271     AC_MSG_RESULT([$GNUMAKE $_make_version])
6273     dnl ===================================================================
6274     dnl Search all the common names for sha1sum
6275     dnl ===================================================================
6276     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
6277     if test -z "$SHA1SUM"; then
6278         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
6279     elif test "$SHA1SUM" = "openssl"; then
6280         SHA1SUM="openssl sha1"
6281     fi
6282     AC_MSG_CHECKING([for GNU Make bug 20033])
6283     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
6284     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
6285 A := \$(wildcard *.a)
6287 .PHONY: all
6288 all: \$(A:.a=.b)
6289 <TAB>@echo survived bug20033.
6291 .PHONY: setup
6292 setup:
6293 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
6295 define d1
6296 @echo lala \$(1)
6297 @sleep 1
6298 endef
6300 define d2
6301 @echo tyty \$(1)
6302 @sleep 1
6303 endef
6305 %.b : %.a
6306 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
6307 <TAB>\$(call d1,\$(CHECKSUM)),\
6308 <TAB>\$(call d2,\$(CHECKSUM)))
6310     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
6311         no_parallelism_make="YES"
6312         AC_MSG_RESULT([yes, disable parallelism])
6313     else
6314         AC_MSG_RESULT([no, keep parallelism enabled])
6315     fi
6316     rm -rf $TESTGMAKEBUG20033
6317 else
6318     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
6321 # find if gnumake support file function
6322 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
6323 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
6324 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6325     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
6327 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
6328 \$(file >test.txt,Success )
6330 .PHONY: all
6331 all:
6332 <TAB>@cat test.txt
6335 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
6336 if test -f $TESTGMAKEFILEFUNC/test.txt; then
6337     HAVE_GNUMAKE_FILE_FUNC=TRUE
6338     AC_MSG_RESULT([yes])
6339 else
6340     AC_MSG_RESULT([no])
6342 rm -rf $TESTGMAKEFILEFUNC
6343 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
6345 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
6346 STALE_MAKE=
6347 if test "$_make_ver_check" = ""; then
6348    STALE_MAKE=TRUE
6351 HAVE_LD_HASH_STYLE=FALSE
6352 WITH_LINKER_HASH_STYLE=
6353 AC_MSG_CHECKING([for --hash-style gcc linker support])
6354 if test "$GCC" = "yes"; then
6355     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
6356         hash_styles="gnu sysv"
6357     elif test "$with_linker_hash_style" = "no"; then
6358         hash_styles=
6359     else
6360         hash_styles="$with_linker_hash_style"
6361     fi
6363     for hash_style in $hash_styles; do
6364         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
6365         hash_style_ldflags_save=$LDFLAGS
6366         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
6368         AC_RUN_IFELSE([AC_LANG_PROGRAM(
6369             [
6370 #include <stdio.h>
6371             ],[
6372 printf ("");
6373             ])],
6374             [
6375                   HAVE_LD_HASH_STYLE=TRUE
6376                   WITH_LINKER_HASH_STYLE=$hash_style
6377             ],
6378             [HAVE_LD_HASH_STYLE=FALSE],
6379             [HAVE_LD_HASH_STYLE=FALSE])
6380         LDFLAGS=$hash_style_ldflags_save
6381     done
6383     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
6384         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
6385     else
6386         AC_MSG_RESULT( no )
6387     fi
6388     LDFLAGS=$hash_style_ldflags_save
6389 else
6390     AC_MSG_RESULT( no )
6392 AC_SUBST(HAVE_LD_HASH_STYLE)
6393 AC_SUBST(WITH_LINKER_HASH_STYLE)
6395 dnl ===================================================================
6396 dnl Check whether there's a Perl version available.
6397 dnl ===================================================================
6398 if test -z "$with_perl_home"; then
6399     AC_PATH_PROG(PERL, perl)
6400 else
6401     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
6402     _perl_path="$with_perl_home/bin/perl"
6403     if test -x "$_perl_path"; then
6404         PERL=$_perl_path
6405     else
6406         AC_MSG_ERROR([$_perl_path not found])
6407     fi
6410 dnl ===================================================================
6411 dnl Testing for Perl version 5 or greater.
6412 dnl $] is the Perl version variable, it is returned as an integer
6413 dnl ===================================================================
6414 if test "$PERL"; then
6415     AC_MSG_CHECKING([the Perl version])
6416     ${PERL} -e "exit($]);"
6417     _perl_version=$?
6418     if test "$_perl_version" -lt 5; then
6419         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
6420     fi
6421     AC_MSG_RESULT([Perl $_perl_version])
6422 else
6423     AC_MSG_ERROR([Perl not found, install Perl 5])
6426 dnl ===================================================================
6427 dnl Testing for required Perl modules
6428 dnl ===================================================================
6430 AC_MSG_CHECKING([for required Perl modules])
6431 perl_use_string="use Cwd ; use Digest::MD5"
6432 if test "$_os" = "WINNT"; then
6433     if test -n "$PKGFORMAT"; then
6434         for i in $PKGFORMAT; do
6435             case "$i" in
6436             msi)
6437                 # for getting fonts versions to use in MSI
6438                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
6439                 ;;
6440             esac
6441         done
6442     fi
6444 if test "$with_system_hsqldb" = "yes"; then
6445     perl_use_string="$perl_use_string ; use Archive::Zip"
6447 if test "$enable_openssl" = "yes" -a "$with_system_openssl" != "yes"; then
6448     # OpenSSL needs that to build
6449     perl_use_string="$perl_use_string ; use FindBin"
6451 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
6452     AC_MSG_RESULT([all modules found])
6453 else
6454     AC_MSG_RESULT([failed to find some modules])
6455     # Find out which modules are missing.
6456     for i in $perl_use_string; do
6457         if test "$i" != "use" -a "$i" != ";"; then
6458             if ! $PERL -e "use $i;">/dev/null 2>&1; then
6459                 missing_perl_modules="$missing_perl_modules $i"
6460             fi
6461         fi
6462     done
6463     AC_MSG_ERROR([
6464     The missing Perl modules are: $missing_perl_modules
6465     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
6468 dnl ===================================================================
6469 dnl Check for pkg-config
6470 dnl ===================================================================
6471 if test "$_os" != "WINNT"; then
6472     PKG_PROG_PKG_CONFIG
6475 if test "$_os" != "WINNT"; then
6477     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
6478     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
6479     # explicitly. Or put /path/to/compiler in PATH yourself.
6481     # Use wrappers for LTO
6482     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
6483         AC_CHECK_TOOL(AR,gcc-ar)
6484         AC_CHECK_TOOL(NM,gcc-nm)
6485         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
6486     else
6487         AC_CHECK_TOOL(AR,ar)
6488         AC_CHECK_TOOL(NM,nm)
6489         AC_CHECK_TOOL(RANLIB,ranlib)
6490     fi
6491     AC_CHECK_TOOL(OBJDUMP,objdump)
6492     AC_CHECK_TOOL(READELF,readelf)
6493     AC_CHECK_TOOL(STRIP,strip)
6495 AC_SUBST(AR)
6496 AC_SUBST(LD)
6497 AC_SUBST(NM)
6498 AC_SUBST(OBJDUMP)
6499 AC_SUBST(PKG_CONFIG)
6500 AC_SUBST(PKG_CONFIG_PATH)
6501 AC_SUBST(PKG_CONFIG_LIBDIR)
6502 AC_SUBST(RANLIB)
6503 AC_SUBST(READELF)
6504 AC_SUBST(STRIP)
6506 dnl ===================================================================
6507 dnl pkg-config checks on macOS
6508 dnl ===================================================================
6510 if test $_os = Darwin; then
6511     AC_MSG_CHECKING([for bogus pkg-config])
6512     if test -n "$PKG_CONFIG"; then
6513         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
6514             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
6515         else
6516             if test "$enable_bogus_pkg_config" = "yes"; then
6517                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
6518             else
6519                 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.])
6520             fi
6521         fi
6522     else
6523         AC_MSG_RESULT([no, good])
6524     fi
6527 find_csc()
6529     # Return value: $csctest
6531     unset csctest
6533     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
6534     if test -n "$regvalue"; then
6535         csctest=$regvalue
6536         return
6537     fi
6540 find_al()
6542     # Return value: $altest
6544     unset altest
6546     # We need this check to detect 4.6.1 or above.
6547     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
6548         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
6549         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
6550             altest=$regvalue
6551             return
6552         fi
6553     done
6555     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
6556         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
6557         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
6558             altest=$regvalue
6559             return
6560         fi
6561     done
6564 find_dotnetsdk46()
6566     unset frametest
6568     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
6569         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
6570         if test -n "$regvalue"; then
6571             frametest=$regvalue
6572             return
6573         fi
6574     done
6577 find_winsdk_version()
6579     # Args: $1 : SDK version as in "8.0", "8.1A" etc
6580     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
6582     unset winsdktest winsdkbinsubdir winsdklibsubdir
6584     case "$1" in
6585     8.0|8.0A)
6586         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
6587         if test -n "$regvalue"; then
6588             winsdktest=$regvalue
6589             winsdklibsubdir=win8
6590             return
6591         fi
6592         ;;
6593     8.1|8.1A)
6594         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
6595         if test -n "$regvalue"; then
6596             winsdktest=$regvalue
6597             winsdklibsubdir=winv6.3
6598             return
6599         fi
6600         ;;
6601     10.0)
6602         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
6603         if test -n "$regvalue"; then
6604             winsdktest=$regvalue
6605             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
6606             if test -n "$regvalue"; then
6607                 winsdkbinsubdir="$regvalue".0
6608                 winsdklibsubdir=$winsdkbinsubdir
6609                 local tmppath="$winsdktest\\Include\\$winsdklibsubdir"
6610                 local tmppath_unix=$(cygpath -u "$tmppath")
6611                 # test exist the SDK path
6612                 if test -d "$tmppath_unix"; then
6613                    # when path is convertible to a short path then path is okay
6614                    cygpath -d "$tmppath" >/dev/null 2>&1
6615                    if test $? -ne 0; then
6616                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
6617                    fi
6618                 else
6619                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
6620                 fi
6621             fi
6622             return
6623         fi
6624         ;;
6625     esac
6628 find_winsdk()
6630     # Return value: From find_winsdk_version
6632     unset winsdktest
6634     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
6635         find_winsdk_version $ver
6636         if test -n "$winsdktest"; then
6637             return
6638         fi
6639     done
6642 find_msms()
6644     # Return value: $msmdir
6646     AC_MSG_CHECKING([for MSVC merge modules directory])
6647     local my_msm_files
6648     local my_msm_dir
6650     dnl Order my_msm_files in increasing order. Then check the directories returned
6651     dnl by ls in an inner loop; assuming they are also ordered in increasing order,
6652     dnl the result will be the highest MSM version found in the highest directory.
6654     case "$VCVER" in
6655         16.0 | 17.0)
6656         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
6657         ;;
6658     esac
6659     for f in $my_msm_files; do
6660         echo "$as_me:$LINENO: searching for $f" >&5
6661     done
6663     msmdir=
6664     case "$VCVER" in
6665     16.0 | 17.0)
6666         for f in ${my_msm_files}; do
6667             for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6668                 my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
6669                 echo "$as_me:$LINENO: looking for $my_msm_dir${f}])" >&5
6670                 if test -e "$my_msm_dir${f}"; then
6671                     msmdir=$my_msm_dir
6672                 fi
6673             done
6674         done
6675         ;;
6676     esac
6678     if test -n "$msmdir"; then
6679         msmdir=`cygpath -m "$msmdir"`
6680         AC_MSG_RESULT([$msmdir])
6681     else
6682         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
6683             AC_MSG_FAILURE([not found])
6684         else
6685             AC_MSG_WARN([not found (check config.log)])
6686             add_warning "MSM none of ${my_msm_files} found"
6687         fi
6688     fi
6691 find_msvc_x64_dlls()
6693     # Return value: $msvcdllpath, $msvcdlls
6695     AC_MSG_CHECKING([for MSVC x64 DLL path])
6697     dnl Order crtver in increasing order. Then check the directories returned by
6698     dnl ls in an inner loop; assuming they are also ordered in increasing order,
6699     dnl the result will be the highest CRT version found in the highest directory.
6701     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
6702     case "$VCVER" in
6703     16.0 | 17.0)
6704         for crtver in 141 142 143; do
6705             for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6706                 echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT" >&5
6707                 if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT"; then
6708                     msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT"
6709                 fi
6710             done
6711         done
6712         ;;
6713     esac
6714     AC_MSG_RESULT([$msvcdllpath])
6715     AC_MSG_CHECKING([for MSVC x64 DLLs])
6716     msvcdlls="msvcp140.dll vcruntime140.dll"
6717     for dll in $msvcdlls; do
6718         if ! test -f "$msvcdllpath/$dll"; then
6719             AC_MSG_FAILURE([missing $dll])
6720         fi
6721     done
6722     AC_MSG_RESULT([found all ($msvcdlls)])
6725 dnl =========================================
6726 dnl Check for the Windows  SDK.
6727 dnl =========================================
6728 if test "$_os" = "WINNT"; then
6729     AC_MSG_CHECKING([for Windows SDK])
6730     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6731         find_winsdk
6732         WINDOWS_SDK_HOME=$winsdktest
6734         # normalize if found
6735         if test -n "$WINDOWS_SDK_HOME"; then
6736             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
6737             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
6738         fi
6740         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
6741     fi
6743     if test -n "$WINDOWS_SDK_HOME"; then
6744         # Remove a possible trailing backslash
6745         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
6747         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
6748              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
6749              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
6750             have_windows_sdk_headers=yes
6751         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
6752              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
6753              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
6754             have_windows_sdk_headers=yes
6755         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
6756              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
6757              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
6758             have_windows_sdk_headers=yes
6759         else
6760             have_windows_sdk_headers=no
6761         fi
6763         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
6764             have_windows_sdk_libs=yes
6765         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/user32.lib"; then
6766             have_windows_sdk_libs=yes
6767         else
6768             have_windows_sdk_libs=no
6769         fi
6771         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
6772             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
6773 the  Windows SDK are installed.])
6774         fi
6775     fi
6777     if test -z "$WINDOWS_SDK_HOME"; then
6778         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
6779     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
6780         WINDOWS_SDK_VERSION=80
6781         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
6782     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
6783         WINDOWS_SDK_VERSION=81
6784         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
6785     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
6786         WINDOWS_SDK_VERSION=10
6787         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
6788     else
6789         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
6790     fi
6791     PathFormat "$WINDOWS_SDK_HOME"
6792     WINDOWS_SDK_HOME="$formatted_path"
6793     WINDOWS_SDK_HOME_unix="$formatted_path_unix"
6794     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6795         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
6796         if test -d "$WINDOWS_SDK_HOME/include/um"; then
6797             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
6798         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
6799             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
6800         fi
6801     fi
6803     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
6804     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
6805     dnl but not in v8.0), so allow this to be overridden with a
6806     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
6807     dnl and configuration error if no WiLangId.vbs is found would arguably be
6808     dnl better, but I do not know under which conditions exactly it is needed by
6809     dnl msiglobal.pm:
6810     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
6811         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
6812         WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6813         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6814             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WIN_BUILD_ARCH}/WiLangId.vbs"
6815             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6816         fi
6817         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6818             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WIN_BUILD_ARCH/WiLangId.vbs
6819             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6820         fi
6821         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6822             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WIN_BUILD_ARCH/WiLangId.vbs")
6823             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6824         fi
6825     fi
6826     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
6827         if test -n "$with_package_format" -a "$with_package_format" != no; then
6828             for i in "$with_package_format"; do
6829                 if test "$i" = "msi"; then
6830                     if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6831                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
6832                     fi
6833                 fi
6834             done
6835         fi
6836     fi
6838 AC_SUBST(WINDOWS_SDK_HOME)
6839 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
6840 AC_SUBST(WINDOWS_SDK_VERSION)
6841 AC_SUBST(WINDOWS_SDK_WILANGID)
6843 if test "$build_os" = "cygwin"; then
6844     dnl Check midl.exe; this being the first check for a tool in the SDK bin
6845     dnl dir, it also determines that dir's path w/o an arch segment if any,
6846     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
6847     AC_MSG_CHECKING([for midl.exe])
6849     find_winsdk
6850     if test -n "$winsdkbinsubdir" \
6851         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/midl.exe"
6852     then
6853         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH
6854         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
6855     elif test -f "$winsdktest/Bin/$WIN_BUILD_ARCH/midl.exe"; then
6856         MIDL_PATH=$winsdktest/Bin/$WIN_BUILD_ARCH
6857         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
6858     elif test -f "$winsdktest/Bin/midl.exe"; then
6859         MIDL_PATH=$winsdktest/Bin
6860         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
6861     fi
6862     if test ! -f "$MIDL_PATH/midl.exe"; then
6863         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WIN_BUILD_ARCH, Windows SDK installation broken?])
6864     else
6865         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
6866     fi
6868     # Convert to posix path with 8.3 filename restrictions ( No spaces )
6869     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
6871     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
6872          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
6873          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
6874          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
6875     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
6876          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
6877          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6878          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
6879     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
6880          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
6881          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6882          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
6883     else
6884         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
6885     fi
6887     dnl Check csc.exe
6888     AC_MSG_CHECKING([for csc.exe])
6889     find_csc
6890     if test -f "$csctest/csc.exe"; then
6891         CSC_PATH="$csctest"
6892     fi
6893     if test ! -f "$CSC_PATH/csc.exe"; then
6894         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
6895     else
6896         AC_MSG_RESULT([$CSC_PATH/csc.exe])
6897     fi
6899     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
6901     dnl Check al.exe
6902     AC_MSG_CHECKING([for al.exe])
6903     find_winsdk
6904     if test -n "$winsdkbinsubdir" \
6905         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/al.exe"
6906     then
6907         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH"
6908     elif test -f "$winsdktest/Bin/$WIN_BUILD_ARCH/al.exe"; then
6909         AL_PATH="$winsdktest/Bin/$WIN_BUILD_ARCH"
6910     elif test -f "$winsdktest/Bin/al.exe"; then
6911         AL_PATH="$winsdktest/Bin"
6912     fi
6914     if test -z "$AL_PATH"; then
6915         find_al
6916         if test -f "$altest/bin/al.exe"; then
6917             AL_PATH="$altest/bin"
6918         elif test -f "$altest/al.exe"; then
6919             AL_PATH="$altest"
6920         fi
6921     fi
6922     if test ! -f "$AL_PATH/al.exe"; then
6923         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
6924     else
6925         AC_MSG_RESULT([$AL_PATH/al.exe])
6926     fi
6928     AL_PATH=`win_short_path_for_make "$AL_PATH"`
6930     dnl Check mscoree.lib / .NET Framework dir
6931     AC_MSG_CHECKING(.NET Framework)
6932     find_dotnetsdk46
6933     PathFormat "$frametest"
6934     frametest="$formatted_path"
6935     if test -f "$frametest/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6936         DOTNET_FRAMEWORK_HOME="$frametest"
6937     else
6938         find_winsdk
6939         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6940             DOTNET_FRAMEWORK_HOME="$winsdktest"
6941         fi
6942     fi
6943     if test ! -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib" -a ! -f "$DOTNET_FRAMEWORK_HOME/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib" -a ! -f "$DOTNET_FRAMEWORK_HOME/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6944         AC_MSG_ERROR([mscoree.lib not found])
6945     fi
6946     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
6948     PathFormat "$MIDL_PATH"
6949     MIDL_PATH="$formatted_path"
6951     PathFormat "$AL_PATH"
6952     AL_PATH="$formatted_path"
6954     PathFormat "$DOTNET_FRAMEWORK_HOME"
6955     DOTNET_FRAMEWORK_HOME="$formatted_path"
6957     PathFormat "$CSC_PATH"
6958     CSC_PATH="$formatted_path"
6961 dnl ===================================================================
6962 dnl Testing for C++ compiler and version...
6963 dnl ===================================================================
6965 if test "$_os" != "WINNT"; then
6966     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
6967     save_CXXFLAGS=$CXXFLAGS
6968     AC_PROG_CXX
6969     CXXFLAGS=$save_CXXFLAGS
6970     if test -z "$CXX_BASE"; then
6971         CXX_BASE=`first_arg_basename "$CXX"`
6972     fi
6975 dnl check for GNU C++ compiler version
6976 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
6977     AC_MSG_CHECKING([the GNU C++ compiler version])
6979     _gpp_version=`$CXX -dumpversion`
6980     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
6982     if test "$_gpp_majmin" -lt "700"; then
6983         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
6984     else
6985         AC_MSG_RESULT([ok (g++ $_gpp_version)])
6986     fi
6988     dnl see https://code.google.com/p/android/issues/detail?id=41770
6989         glibcxx_threads=no
6990         AC_LANG_PUSH([C++])
6991         AC_REQUIRE_CPP
6992         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
6993         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
6994             #include <bits/c++config.h>]],[[
6995             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
6996             && !defined(_GLIBCXX__PTHREADS) \
6997             && !defined(_GLIBCXX_HAS_GTHREADS)
6998             choke me
6999             #endif
7000         ]])],[AC_MSG_RESULT([yes])
7001         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
7002         AC_LANG_POP([C++])
7003         if test $glibcxx_threads = yes; then
7004             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
7005         fi
7007 AC_SUBST(BOOST_CXXFLAGS)
7010 # prefx CXX with ccache if needed
7012 if test "$CCACHE" != ""; then
7013     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
7014     AC_LANG_PUSH([C++])
7015     save_CXXFLAGS=$CXXFLAGS
7016     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
7017     # msvc does not fail on unknown options, check stdout
7018     if test "$COM" = MSC; then
7019         CXXFLAGS="$CXXFLAGS -nologo"
7020     fi
7021     save_ac_cxx_werror_flag=$ac_cxx_werror_flag
7022     ac_cxx_werror_flag=yes
7023     dnl an empty program will do, we're checking the compiler flags
7024     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
7025                       [use_ccache=yes], [use_ccache=no])
7026     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
7027         AC_MSG_RESULT([yes])
7028     else
7029         CXX="$CCACHE $CXX"
7030         CXX_BASE="ccache $CXX_BASE"
7031         AC_MSG_RESULT([no])
7032     fi
7033     CXXFLAGS=$save_CXXFLAGS
7034     ac_cxx_werror_flag=$save_ac_cxx_werror_flag
7035     AC_LANG_POP([C++])
7038 dnl ===================================================================
7039 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
7040 dnl ===================================================================
7042 if test "$_os" != "WINNT"; then
7043     AC_PROG_CXXCPP
7045     dnl Check whether there's a C pre-processor.
7046     AC_PROG_CPP
7050 dnl ===================================================================
7051 dnl Find integral type sizes and alignments
7052 dnl ===================================================================
7054 if test "$_os" != "WINNT"; then
7056     AC_CHECK_SIZEOF(long)
7057     AC_CHECK_SIZEOF(short)
7058     AC_CHECK_SIZEOF(int)
7059     AC_CHECK_SIZEOF(long long)
7060     AC_CHECK_SIZEOF(double)
7061     AC_CHECK_SIZEOF(void*)
7062     AC_CHECK_SIZEOF(size_t)
7064     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
7065     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
7066     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
7067     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
7068     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
7069     SIZEOF_SIZE_T=$ac_cv_sizeof_size_t
7071     dnl Allow build without AC_CHECK_ALIGNOF, grrr
7072     m4_pattern_allow([AC_CHECK_ALIGNOF])
7073     m4_ifdef([AC_CHECK_ALIGNOF],
7074         [
7075             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
7076             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
7077             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
7078             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
7079         ],
7080         [
7081             case "$_os-$host_cpu" in
7082             Linux-i686)
7083                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
7084                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
7085                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
7086                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
7087                 ;;
7088             Linux-x86_64)
7089                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
7090                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
7091                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
7092                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
7093                 ;;
7094             *)
7095                 if test -z "$ac_cv_alignof_short" -o \
7096                         -z "$ac_cv_alignof_int" -o \
7097                         -z "$ac_cv_alignof_long" -o \
7098                         -z "$ac_cv_alignof_double"; then
7099                    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.])
7100                 fi
7101                 ;;
7102             esac
7103         ])
7105     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
7106     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
7107     if test $ac_cv_sizeof_long -eq 8; then
7108         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
7109     elif test $ac_cv_sizeof_double -eq 8; then
7110         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
7111     else
7112         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
7113     fi
7115     dnl Check for large file support
7116     AC_SYS_LARGEFILE
7117     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
7118         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
7119     fi
7120     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
7121         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
7122     fi
7123 else
7124     # Hardcode for MSVC
7125     SAL_TYPES_SIZEOFSHORT=2
7126     SAL_TYPES_SIZEOFINT=4
7127     SAL_TYPES_SIZEOFLONG=4
7128     SAL_TYPES_SIZEOFLONGLONG=8
7129     if test $WIN_HOST_BITS -eq 32; then
7130         SAL_TYPES_SIZEOFPOINTER=4
7131         SIZEOF_SIZE_T=4
7132     else
7133         SAL_TYPES_SIZEOFPOINTER=8
7134         SIZEOF_SIZE_T=8
7135     fi
7136     SAL_TYPES_ALIGNMENT2=2
7137     SAL_TYPES_ALIGNMENT4=4
7138     SAL_TYPES_ALIGNMENT8=8
7139     LFS_CFLAGS=''
7141 AC_SUBST(LFS_CFLAGS)
7142 AC_SUBST(SIZEOF_SIZE_T)
7144 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
7145 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
7146 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
7147 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
7148 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
7149 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
7150 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
7151 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
7153 dnl Calc jumbo sheets (1m+ rows) depend on 64 bit tools::Long .
7154 AC_MSG_CHECKING([whether jumbo sheets are supported])
7155 if test "$_os" != "WINNT"; then
7156     if test $SAL_TYPES_SIZEOFLONG -gt 4; then
7157         AC_MSG_RESULT([yes])
7158         ENABLE_JUMBO_SHEETS=TRUE
7159         AC_DEFINE(HAVE_FEATURE_JUMBO_SHEETS)
7160     else
7161         AC_MSG_RESULT([no])
7162     fi
7163 else
7164     if test $WIN_HOST_BITS -gt 32; then
7165         # 64bit windows is special-cased for tools::Long because long is 32bit
7166         AC_MSG_RESULT([yes])
7167         ENABLE_JUMBO_SHEETS=TRUE
7168         AC_DEFINE(HAVE_FEATURE_JUMBO_SHEETS)
7169     else
7170         AC_MSG_RESULT([no])
7171     fi
7173 AC_SUBST(ENABLE_JUMBO_SHEETS)
7175 dnl ===================================================================
7176 dnl Check whether to enable runtime optimizations
7177 dnl ===================================================================
7178 ENABLE_RUNTIME_OPTIMIZATIONS=
7179 AC_MSG_CHECKING([whether to enable runtime optimizations])
7180 if test -z "$enable_runtime_optimizations"; then
7181     for i in $CC; do
7182         case $i in
7183         -fsanitize=*)
7184             enable_runtime_optimizations=no
7185             break
7186             ;;
7187         esac
7188     done
7190 if test "$enable_runtime_optimizations" != no; then
7191     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
7192     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
7193     AC_MSG_RESULT([yes])
7194 else
7195     AC_MSG_RESULT([no])
7197 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
7199 dnl ===================================================================
7200 dnl Check if valgrind headers are available
7201 dnl ===================================================================
7202 ENABLE_VALGRIND=
7203 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
7204     prev_cppflags=$CPPFLAGS
7205     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
7206     # or where does it come from?
7207     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
7208     AC_CHECK_HEADER([valgrind/valgrind.h],
7209         [ENABLE_VALGRIND=TRUE])
7210     CPPFLAGS=$prev_cppflags
7212 AC_SUBST([ENABLE_VALGRIND])
7213 if test -z "$ENABLE_VALGRIND"; then
7214     if test "$with_valgrind" = yes; then
7215         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
7216     fi
7217     VALGRIND_CFLAGS=
7219 AC_SUBST([VALGRIND_CFLAGS])
7222 dnl ===================================================================
7223 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
7224 dnl ===================================================================
7226 # We need at least the sys/sdt.h include header.
7227 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
7228 if test "$SDT_H_FOUND" = "TRUE"; then
7229     # Found sys/sdt.h header, now make sure the c++ compiler works.
7230     # Old g++ versions had problems with probes in constructors/destructors.
7231     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
7232     AC_LANG_PUSH([C++])
7233     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
7234     #include <sys/sdt.h>
7235     class ProbeClass
7236     {
7237     private:
7238       int& ref;
7239       const char *name;
7241     public:
7242       ProbeClass(int& v, const char *n) : ref(v), name(n)
7243       {
7244         DTRACE_PROBE2(_test_, cons, name, ref);
7245       }
7247       void method(int min)
7248       {
7249         DTRACE_PROBE3(_test_, meth, name, ref, min);
7250         ref -= min;
7251       }
7253       ~ProbeClass()
7254       {
7255         DTRACE_PROBE2(_test_, dest, name, ref);
7256       }
7257     };
7258     ]],[[
7259     int i = 64;
7260     DTRACE_PROBE1(_test_, call, i);
7261     ProbeClass inst = ProbeClass(i, "call");
7262     inst.method(24);
7263     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
7264           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
7265     AC_LANG_POP([C++])
7267 AC_CONFIG_HEADERS([config_host/config_probes.h])
7269 dnl ===================================================================
7270 dnl GCC features
7271 dnl ===================================================================
7272 HAVE_GCC_STACK_CLASH_PROTECTION=
7273 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7274     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
7275     save_CFLAGS=$CFLAGS
7276     CFLAGS="$CFLAGS -Werror -fstack-clash-protection"
7277     AC_LINK_IFELSE(
7278         [AC_LANG_PROGRAM(, [[return 0;]])],
7279         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
7280         [AC_MSG_RESULT([no])])
7281     CFLAGS=$save_CFLAGS
7283     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
7284     save_CFLAGS=$CFLAGS
7285     CFLAGS="$CFLAGS -Werror -mno-avx"
7286     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
7287     CFLAGS=$save_CFLAGS
7288     if test "$HAVE_GCC_AVX" = "TRUE"; then
7289         AC_MSG_RESULT([yes])
7290     else
7291         AC_MSG_RESULT([no])
7292     fi
7294     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
7295     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
7296     int v = 0;
7297     if (__sync_add_and_fetch(&v, 1) != 1 ||
7298         __sync_sub_and_fetch(&v, 1) != 0)
7299         return 1;
7300     __sync_synchronize();
7301     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
7302         v != 1)
7303         return 1;
7304     return 0;
7305 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
7306     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
7307         AC_MSG_RESULT([yes])
7308         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
7309     else
7310         AC_MSG_RESULT([no])
7311     fi
7313     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
7314     AC_LANG_PUSH([C++])
7315     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7316             #include <cstddef>
7317             #include <cxxabi.h>
7318             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
7319         ])], [
7320             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
7321             AC_MSG_RESULT([yes])
7322         ], [AC_MSG_RESULT([no])])
7323     AC_LANG_POP([C++])
7325     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
7326     AC_LANG_PUSH([C++])
7327     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7328             #include <cstddef>
7329             #include <cxxabi.h>
7330             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
7331         ])], [
7332             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
7333             AC_MSG_RESULT([yes])
7334         ], [AC_MSG_RESULT([no])])
7335     AC_LANG_POP([C++])
7337     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
7338     AC_LANG_PUSH([C++])
7339     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7340             #include <cxxabi.h>
7341             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
7342         ])], [
7343             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
7344             AC_MSG_RESULT([yes])
7345         ], [AC_MSG_RESULT([no])])
7346     AC_LANG_POP([C++])
7348     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
7349     AC_LANG_PUSH([C++])
7350     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7351             #include <cstddef>
7352             #include <cxxabi.h>
7353             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
7354         ])], [
7355             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
7356             AC_MSG_RESULT([yes])
7357         ], [AC_MSG_RESULT([no])])
7358     AC_LANG_POP([C++])
7360     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exception in cxxabi.h])
7361     AC_LANG_PUSH([C++])
7362     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7363             #include <cstddef>
7364             #include <cxxabi.h>
7365             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exception); }
7366         ])], [
7367             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTION],[1])
7368             AC_MSG_RESULT([yes])
7369         ], [AC_MSG_RESULT([no])])
7370     AC_LANG_POP([C++])
7372     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
7373     AC_LANG_PUSH([C++])
7374     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7375             #include <cxxabi.h>
7376             void * f() { return __cxxabiv1::__cxa_get_globals(); }
7377         ])], [
7378             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
7379             AC_MSG_RESULT([yes])
7380         ], [AC_MSG_RESULT([no])])
7381     AC_LANG_POP([C++])
7383     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
7384     AC_LANG_PUSH([C++])
7385     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7386             #include <cxxabi.h>
7387             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
7388         ])], [
7389             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
7390             AC_MSG_RESULT([yes])
7391         ], [AC_MSG_RESULT([no])])
7392     AC_LANG_POP([C++])
7394     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
7395     AC_LANG_PUSH([C++])
7396     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7397             #include <cxxabi.h>
7398             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
7399         ])], [
7400             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
7401             AC_MSG_RESULT([yes])
7402         ], [AC_MSG_RESULT([no])])
7403     AC_LANG_POP([C++])
7405     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
7406     AC_LANG_PUSH([C++])
7407     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7408             #include <cstddef>
7409             #include <cxxabi.h>
7410             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
7411         ])], [
7412             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
7413             AC_MSG_RESULT([yes])
7414         ], [AC_MSG_RESULT([no])])
7415     AC_LANG_POP([C++])
7417     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
7418     AC_LANG_PUSH([C++])
7419     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7420             #include <cstddef>
7421             #include <cxxabi.h>
7422             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
7423         ])], [
7424             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
7425             AC_MSG_RESULT([yes])
7426         ], [AC_MSG_RESULT([no])])
7427     AC_LANG_POP([C++])
7430 AC_SUBST(HAVE_GCC_AVX)
7431 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
7432 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
7434 dnl ===================================================================
7435 dnl Identify the C++ library
7436 dnl ===================================================================
7438 AC_MSG_CHECKING([what the C++ library is])
7439 HAVE_LIBSTDCPP=
7440 AC_LANG_PUSH([C++])
7441 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7442 #include <utility>
7443 #ifndef __GLIBCXX__
7444 foo bar
7445 #endif
7446 ]])],
7447     [CPP_LIBRARY=GLIBCXX
7448      cpp_library_name="GNU libstdc++"
7449      HAVE_LIBSTDCPP=TRUE
7450     ],
7451     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7452 #include <utility>
7453 #ifndef _LIBCPP_VERSION
7454 foo bar
7455 #endif
7456 ]])],
7457     [CPP_LIBRARY=LIBCPP
7458      cpp_library_name="LLVM libc++"
7459      AC_DEFINE([HAVE_LIBCXX])
7460     ],
7461     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7462 #include <utility>
7463 #ifndef _MSC_VER
7464 foo bar
7465 #endif
7466 ]])],
7467     [CPP_LIBRARY=MSVCRT
7468      cpp_library_name="Microsoft"
7469     ],
7470     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
7471 AC_MSG_RESULT([$cpp_library_name])
7472 AC_LANG_POP([C++])
7473 AC_SUBST([HAVE_LIBSTDCPP])
7475 dnl ===================================================================
7476 dnl Check for gperf
7477 dnl ===================================================================
7478 AC_PATH_PROG(GPERF, gperf)
7479 if test -z "$GPERF"; then
7480     AC_MSG_ERROR([gperf not found but needed. Install it.])
7482 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7483     GPERF=`cygpath -m $GPERF`
7485 AC_MSG_CHECKING([whether gperf is new enough])
7486 my_gperf_ver1=$($GPERF --version | head -n 1)
7487 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
7488 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
7489 if test "$my_gperf_ver3" -ge 301; then
7490     AC_MSG_RESULT([yes ($my_gperf_ver2)])
7491 else
7492     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
7494 AC_SUBST(GPERF)
7496 dnl ===================================================================
7497 dnl Check for system libcmis
7498 dnl ===================================================================
7499 libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2],enabled)
7501 dnl ===================================================================
7502 dnl C++11
7503 dnl ===================================================================
7505 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
7506 CXXFLAGS_CXX11=
7507 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
7508     if test "$with_latest_c__" = yes; then
7509         CXXFLAGS_CXX11=-std:c++latest
7510     else
7511         CXXFLAGS_CXX11=-std:c++17
7512     fi
7513     CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -permissive- -Zc:__cplusplus"
7514 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7515     my_flags='-std=c++17 -std=c++1z'
7516     if test "$with_latest_c__" = yes; then
7517         my_flags="-std=c++23 -std=c++2b -std=c++20 -std=c++2a $my_flags"
7518     fi
7519     for flag in $my_flags; do
7520         if test "$COM" = MSC; then
7521             flag="-Xclang $flag"
7522         fi
7523         save_CXXFLAGS=$CXXFLAGS
7524         CXXFLAGS="$CXXFLAGS $flag -Werror"
7525         if test "$SYSTEM_LIBCMIS" = TRUE; then
7526             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
7527         fi
7528         AC_LANG_PUSH([C++])
7529         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7530             #include <algorithm>
7531             #include <functional>
7532             #include <vector>
7534             #if defined SYSTEM_LIBCMIS
7535             // See ucb/source/ucp/cmis/auth_provider.hxx:
7536             #if !defined __clang__
7537             #pragma GCC diagnostic push
7538             #pragma GCC diagnostic ignored "-Wdeprecated"
7539             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
7540             #endif
7541             #include <libcmis/libcmis.hxx>
7542             #if !defined __clang__
7543             #pragma GCC diagnostic pop
7544             #endif
7545             #endif
7547             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
7548                 std::sort(v.begin(), v.end(), fn);
7549             }
7550             ]])],[CXXFLAGS_CXX11=$flag])
7551         AC_LANG_POP([C++])
7552         CXXFLAGS=$save_CXXFLAGS
7553         if test -n "$CXXFLAGS_CXX11"; then
7554             break
7555         fi
7556     done
7558 if test -n "$CXXFLAGS_CXX11"; then
7559     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
7560 else
7561     AC_MSG_ERROR(no)
7563 AC_SUBST(CXXFLAGS_CXX11)
7565 if test "$GCC" = "yes"; then
7566     save_CXXFLAGS=$CXXFLAGS
7567     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7568     CHECK_L_ATOMIC
7569     CXXFLAGS=$save_CXXFLAGS
7570     AC_SUBST(ATOMIC_LIB)
7573 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
7574 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
7575 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
7576 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
7577 dnl again towards 4.7.2:
7578 if test $CPP_LIBRARY = GLIBCXX; then
7579     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
7580     AC_LANG_PUSH([C++])
7581     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7582 #include <list>
7583 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
7584     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
7585     //   GCC 4.7.0: 20120322
7586     //   GCC 4.7.1: 20120614
7587     // and using a range check is not possible as the mapping between
7588     // __GLIBCXX__ values and GCC versions is not monotonic
7589 /* ok */
7590 #else
7591 abi broken
7592 #endif
7593         ]])], [AC_MSG_RESULT(no, ok)],
7594         [AC_MSG_ERROR(yes)])
7595     AC_LANG_POP([C++])
7598 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
7599 save_CXXFLAGS=$CXXFLAGS
7600 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7601 AC_LANG_PUSH([C++])
7603 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7604 #include <stddef.h>
7606 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
7608 namespace
7610         struct b
7611         {
7612                 int i;
7613                 int j;
7614         };
7616 ]], [[
7617 struct a
7619         int i;
7620         int j;
7622 a thinga[]={{0,0}, {1,1}};
7623 b thingb[]={{0,0}, {1,1}};
7624 size_t i = sizeof(sal_n_array_size(thinga));
7625 size_t j = sizeof(sal_n_array_size(thingb));
7626 return !(i != 0 && j != 0);
7628     ], [ AC_MSG_RESULT(yes) ],
7629     [ AC_MSG_ERROR(no)])
7630 AC_LANG_POP([C++])
7631 CXXFLAGS=$save_CXXFLAGS
7633 HAVE_GCC_FNO_SIZED_DEALLOCATION=
7634 if test "$GCC" = yes; then
7635     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
7636     AC_LANG_PUSH([C++])
7637     save_CXXFLAGS=$CXXFLAGS
7638     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
7639     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
7640     CXXFLAGS=$save_CXXFLAGS
7641     AC_LANG_POP([C++])
7642     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
7643         AC_MSG_RESULT([yes])
7644     else
7645         AC_MSG_RESULT([no])
7646     fi
7648 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
7650 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
7651 AC_LANG_PUSH([C++])
7652 save_CXXFLAGS=$CXXFLAGS
7653 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7654 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7655         #include <algorithm>
7656         #include <initializer_list>
7657         #include <vector>
7658         template<typename T> class S {
7659         private:
7660             std::vector<T> v_;
7661         public:
7662             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
7663         };
7664         constinit S<int> s{3, 2, 1};
7665     ])], [
7666         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
7667         AC_MSG_RESULT([yes])
7668     ], [AC_MSG_RESULT([no])])
7669 CXXFLAGS=$save_CXXFLAGS
7670 AC_LANG_POP([C++])
7672 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
7673 AC_LANG_PUSH([C++])
7674 save_CXXFLAGS=$CXXFLAGS
7675 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7676 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7677         #include <span>
7678         #include <type_traits>
7679         // Don't check size_type directly, as it was called index_type before P1872R0:
7680         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
7681     ])], [
7682         AC_DEFINE([HAVE_CPP_SPAN],[1])
7683         AC_MSG_RESULT([yes])
7684     ], [AC_MSG_RESULT([no])])
7685 CXXFLAGS=$save_CXXFLAGS
7686 AC_LANG_POP([C++])
7688 AC_MSG_CHECKING([whether $CXX_BASE implements C++ DR P1155R3])
7689 AC_LANG_PUSH([C++])
7690 save_CXXFLAGS=$CXXFLAGS
7691 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7692 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7693         struct S1 { S1(S1 &&); };
7694         struct S2: S1 {};
7695         S1 f(S2 s) { return s; }
7696     ])], [
7697         AC_DEFINE([HAVE_P1155R3],[1])
7698         AC_MSG_RESULT([yes])
7699     ], [AC_MSG_RESULT([no])])
7700 CXXFLAGS=$save_CXXFLAGS
7701 AC_LANG_POP([C++])
7703 AC_MSG_CHECKING([whether $CXX_BASE supports C++20 std::atomic_ref])
7704 HAVE_CXX20_ATOMIC_REF=
7705 AC_LANG_PUSH([C++])
7706 save_CXXFLAGS=$CXXFLAGS
7707 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7708 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7709         #include <atomic>
7710         int x;
7711         std::atomic_ref<int> y(x);
7712     ])], [
7713         HAVE_CXX20_ATOMIC_REF=TRUE
7714         AC_MSG_RESULT([yes])
7715     ], [AC_MSG_RESULT([no])])
7716 CXXFLAGS=$save_CXXFLAGS
7717 AC_LANG_POP([C++])
7718 AC_SUBST([HAVE_CXX20_ATOMIC_REF])
7720 dnl Supported since GCC 9 and Clang 10 (which each also started to support -Wdeprecated-copy, but
7721 dnl which is included in -Wextra anyway):
7722 HAVE_WDEPRECATED_COPY_DTOR=
7723 if test "$GCC" = yes; then
7724     AC_MSG_CHECKING([whether $CXX_BASE supports -Wdeprecated-copy-dtor])
7725     AC_LANG_PUSH([C++])
7726     save_CXXFLAGS=$CXXFLAGS
7727     CXXFLAGS="$CXXFLAGS -Werror -Wdeprecated-copy-dtor"
7728     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
7729             HAVE_WDEPRECATED_COPY_DTOR=TRUE
7730             AC_MSG_RESULT([yes])
7731         ], [AC_MSG_RESULT([no])])
7732     CXXFLAGS=$save_CXXFLAGS
7733     AC_LANG_POP([C++])
7735 AC_SUBST([HAVE_WDEPRECATED_COPY_DTOR])
7737 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
7738 dnl uninitialized warning for code like
7740 dnl   OString f();
7741 dnl   boost::optional<OString> * g(bool b) {
7742 dnl       boost::optional<OString> o;
7743 dnl       if (b) o = f();
7744 dnl       return new boost::optional<OString>(o);
7745 dnl   }
7747 dnl (as is e.g. present, in a slightly more elaborate form, in
7748 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
7749 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
7750 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
7751 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7752     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
7753     AC_LANG_PUSH([C++])
7754     save_CXXFLAGS=$CXXFLAGS
7755     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
7756     if test "$ENABLE_OPTIMIZED" = TRUE; then
7757         CXXFLAGS="$CXXFLAGS -O2"
7758     else
7759         CXXFLAGS="$CXXFLAGS -O0"
7760     fi
7761     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7762             #include <new>
7763             void f1(int);
7764             struct S1 {
7765                 ~S1() { f1(n); }
7766                 int n = 0;
7767             };
7768             struct S2 {
7769                 S2() {}
7770                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
7771                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
7772                 void set(S1 s) {
7773                     new (stg) S1(s);
7774                     init = true;
7775                 }
7776                 bool init = false;
7777                 char stg[sizeof (S1)];
7778             } ;
7779             S1 f2();
7780             S2 * f3(bool b) {
7781                 S2 o;
7782                 if (b) o.set(f2());
7783                 return new S2(o);
7784             }
7785         ]])], [AC_MSG_RESULT([no])], [
7786             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
7787             AC_MSG_RESULT([yes])
7788         ])
7789     CXXFLAGS=$save_CXXFLAGS
7790     AC_LANG_POP([C++])
7792 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
7794 dnl Check for <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c5> "[8/9/10/11 Regression]
7795 dnl -Wstringop-overflow false positive due to using MEM_REF type of &MEM" (fixed in GCC 11), which
7796 dnl hits us e.g. with GCC 10 and --enable-optimized at
7798 dnl   In file included from include/rtl/string.hxx:49,
7799 dnl                    from include/rtl/ustring.hxx:43,
7800 dnl                    from include/osl/file.hxx:35,
7801 dnl                    from include/codemaker/global.hxx:28,
7802 dnl                    from include/codemaker/options.hxx:23,
7803 dnl                    from codemaker/source/commoncpp/commoncpp.cxx:24:
7804 dnl   In function â€˜char* rtl::addDataHelper(char*, const char*, std::size_t)’,
7805 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,
7806 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,
7807 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,
7808 dnl       inlined from â€˜rtl::OString codemaker::cpp::scopedCppName(const rtl::OString&, bool)’ at codemaker/source/commoncpp/commoncpp.cxx:53:55:
7809 dnl   include/rtl/stringconcat.hxx:78:15: error: writing 2 bytes into a region of size 1 [-Werror=stringop-overflow=]
7810 dnl      78 |         memcpy( buffer, data, length );
7811 dnl         |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
7812 HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=
7813 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7814     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=stringop-overflow=])
7815     AC_LANG_PUSH([C++])
7816     save_CXXFLAGS=$CXXFLAGS
7817     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wstringop-overflow"
7818     if test "$ENABLE_OPTIMIZED" = TRUE; then
7819         CXXFLAGS="$CXXFLAGS -O2"
7820     else
7821         CXXFLAGS="$CXXFLAGS -O0"
7822     fi
7823     dnl Test code taken from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c0>:
7824     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7825             void fill(char const * begin, char const * end, char c);
7826             struct q {
7827                 char ids[4];
7828                 char username[6];
7829             };
7830             void test(q & c) {
7831                 fill(c.ids, c.ids + sizeof(c.ids), '\0');
7832                 __builtin_strncpy(c.username, "root", sizeof(c.username));
7833             }
7834         ]])], [AC_MSG_RESULT([no])], [
7835             HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=TRUE
7836             AC_MSG_RESULT([yes])
7837         ])
7838     CXXFLAGS=$save_CXXFLAGS
7839     AC_LANG_POP([C++])
7841 AC_SUBST([HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW])
7843 HAVE_DLLEXPORTINLINES=
7844 if test "$_os" = "WINNT"; then
7845     AC_MSG_CHECKING([whether $CXX_BASE supports -Zc:dllexportInlines-])
7846     AC_LANG_PUSH([C++])
7847     save_CXXFLAGS=$CXXFLAGS
7848     CXXFLAGS="$CXXFLAGS -Werror -Zc:dllexportInlines-"
7849     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
7850             HAVE_DLLEXPORTINLINES=TRUE
7851             AC_MSG_RESULT([yes])
7852         ], [AC_MSG_RESULT([no])])
7853     CXXFLAGS=$save_CXXFLAGS
7854     AC_LANG_POP([C++])
7856 AC_SUBST([HAVE_DLLEXPORTINLINES])
7858 dnl ===================================================================
7859 dnl CPU Intrinsics support - SSE, AVX
7860 dnl ===================================================================
7862 CXXFLAGS_INTRINSICS_SSE2=
7863 CXXFLAGS_INTRINSICS_SSSE3=
7864 CXXFLAGS_INTRINSICS_SSE41=
7865 CXXFLAGS_INTRINSICS_SSE42=
7866 CXXFLAGS_INTRINSICS_AVX=
7867 CXXFLAGS_INTRINSICS_AVX2=
7868 CXXFLAGS_INTRINSICS_AVX512=
7869 CXXFLAGS_INTRINSICS_AVX512F=
7870 CXXFLAGS_INTRINSICS_F16C=
7871 CXXFLAGS_INTRINSICS_FMA=
7873 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7874     # GCC, Clang or Clang-cl (clang-cl + MSVC's -arch options don't work well together)
7875     flag_sse2=-msse2
7876     flag_ssse3=-mssse3
7877     flag_sse41=-msse4.1
7878     flag_sse42=-msse4.2
7879     flag_avx=-mavx
7880     flag_avx2=-mavx2
7881     flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
7882     flag_avx512f=-mavx512f
7883     flag_f16c=-mf16c
7884     flag_fma=-mfma
7885 else
7886     # With MSVC using -arch is in fact not necessary for being able
7887     # to use CPU intrinsics, code using AVX512F intrinsics will compile
7888     # even if compiled with -arch:AVX, the -arch option really only affects
7889     # instructions generated for C/C++ code.
7890     # So use the matching same (or lower) -arch options, but only in order
7891     # to generate the best matching instructions for the C++ code surrounding
7892     # the intrinsics.
7893     # SSE2 is the default for x86/x64, so no need to specify the option.
7894     flag_sse2=
7895     # No specific options for these, use the next lower.
7896     flag_ssse3="$flag_sse2"
7897     flag_sse41="$flag_sse2"
7898     flag_sse42="$flag_sse2"
7899     flag_avx=-arch:AVX
7900     flag_avx2=-arch:AVX2
7901     flag_avx512=-arch:AVX512
7902     # Using -arch:AVX512 would enable more than just AVX512F, so use only AVX2.
7903     flag_avx512f=-arch:AVX2
7904     # No MSVC options for these.
7905     flag_f16c="$flag_sse2"
7906     flag_fma="$flag_sse2"
7909 AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
7910 AC_LANG_PUSH([C++])
7911 save_CXXFLAGS=$CXXFLAGS
7912 CXXFLAGS="$CXXFLAGS $flag_sse2"
7913 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7914     #include <emmintrin.h>
7915     int main () {
7916         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7917         c = _mm_xor_si128 (a, b);
7918         return 0;
7919     }
7920     ])],
7921     [can_compile_sse2=yes],
7922     [can_compile_sse2=no])
7923 AC_LANG_POP([C++])
7924 CXXFLAGS=$save_CXXFLAGS
7925 AC_MSG_RESULT([${can_compile_sse2}])
7926 if test "${can_compile_sse2}" = "yes" ; then
7927     CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
7930 AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
7931 AC_LANG_PUSH([C++])
7932 save_CXXFLAGS=$CXXFLAGS
7933 CXXFLAGS="$CXXFLAGS $flag_ssse3"
7934 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7935     #include <tmmintrin.h>
7936     int main () {
7937         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7938         c = _mm_maddubs_epi16 (a, b);
7939         return 0;
7940     }
7941     ])],
7942     [can_compile_ssse3=yes],
7943     [can_compile_ssse3=no])
7944 AC_LANG_POP([C++])
7945 CXXFLAGS=$save_CXXFLAGS
7946 AC_MSG_RESULT([${can_compile_ssse3}])
7947 if test "${can_compile_ssse3}" = "yes" ; then
7948     CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
7951 AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
7952 AC_LANG_PUSH([C++])
7953 save_CXXFLAGS=$CXXFLAGS
7954 CXXFLAGS="$CXXFLAGS $flag_sse41"
7955 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7956     #include <smmintrin.h>
7957     int main () {
7958         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7959         c = _mm_cmpeq_epi64 (a, b);
7960         return 0;
7961     }
7962     ])],
7963     [can_compile_sse41=yes],
7964     [can_compile_sse41=no])
7965 AC_LANG_POP([C++])
7966 CXXFLAGS=$save_CXXFLAGS
7967 AC_MSG_RESULT([${can_compile_sse41}])
7968 if test "${can_compile_sse41}" = "yes" ; then
7969     CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
7972 AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
7973 AC_LANG_PUSH([C++])
7974 save_CXXFLAGS=$CXXFLAGS
7975 CXXFLAGS="$CXXFLAGS $flag_sse42"
7976 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7977     #include <nmmintrin.h>
7978     int main () {
7979         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7980         c = _mm_cmpgt_epi64 (a, b);
7981         return 0;
7982     }
7983     ])],
7984     [can_compile_sse42=yes],
7985     [can_compile_sse42=no])
7986 AC_LANG_POP([C++])
7987 CXXFLAGS=$save_CXXFLAGS
7988 AC_MSG_RESULT([${can_compile_sse42}])
7989 if test "${can_compile_sse42}" = "yes" ; then
7990     CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
7993 AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
7994 AC_LANG_PUSH([C++])
7995 save_CXXFLAGS=$CXXFLAGS
7996 CXXFLAGS="$CXXFLAGS $flag_avx"
7997 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7998     #include <immintrin.h>
7999     int main () {
8000         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
8001         c = _mm256_xor_ps(a, b);
8002         return 0;
8003     }
8004     ])],
8005     [can_compile_avx=yes],
8006     [can_compile_avx=no])
8007 AC_LANG_POP([C++])
8008 CXXFLAGS=$save_CXXFLAGS
8009 AC_MSG_RESULT([${can_compile_avx}])
8010 if test "${can_compile_avx}" = "yes" ; then
8011     CXXFLAGS_INTRINSICS_AVX="$flag_avx"
8014 AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
8015 AC_LANG_PUSH([C++])
8016 save_CXXFLAGS=$CXXFLAGS
8017 CXXFLAGS="$CXXFLAGS $flag_avx2"
8018 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8019     #include <immintrin.h>
8020     int main () {
8021         __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
8022         c = _mm256_maddubs_epi16(a, b);
8023         return 0;
8024     }
8025     ])],
8026     [can_compile_avx2=yes],
8027     [can_compile_avx2=no])
8028 AC_LANG_POP([C++])
8029 CXXFLAGS=$save_CXXFLAGS
8030 AC_MSG_RESULT([${can_compile_avx2}])
8031 if test "${can_compile_avx2}" = "yes" ; then
8032     CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
8035 AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
8036 AC_LANG_PUSH([C++])
8037 save_CXXFLAGS=$CXXFLAGS
8038 CXXFLAGS="$CXXFLAGS $flag_avx512"
8039 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8040     #include <immintrin.h>
8041     int main () {
8042         __m512i a = _mm512_loadu_si512(0);
8043         __m512d v1 = _mm512_load_pd(0);
8044         // https://gcc.gnu.org/git/?p=gcc.git;a=commit;f=gcc/config/i386/avx512fintrin.h;h=23bce99cbe7016a04e14c2163ed3fe6a5a64f4e2
8045         __m512d v2 = _mm512_abs_pd(v1);
8046         return 0;
8047     }
8048     ])],
8049     [can_compile_avx512=yes],
8050     [can_compile_avx512=no])
8051 AC_LANG_POP([C++])
8052 CXXFLAGS=$save_CXXFLAGS
8053 AC_MSG_RESULT([${can_compile_avx512}])
8054 if test "${can_compile_avx512}" = "yes" ; then
8055     CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
8056     CXXFLAGS_INTRINSICS_AVX512F="$flag_avx512f"
8059 AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
8060 AC_LANG_PUSH([C++])
8061 save_CXXFLAGS=$CXXFLAGS
8062 CXXFLAGS="$CXXFLAGS $flag_f16c"
8063 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8064     #include <immintrin.h>
8065     int main () {
8066         __m128i a = _mm_set1_epi32 (0);
8067         __m128 c;
8068         c = _mm_cvtph_ps(a);
8069         return 0;
8070     }
8071     ])],
8072     [can_compile_f16c=yes],
8073     [can_compile_f16c=no])
8074 AC_LANG_POP([C++])
8075 CXXFLAGS=$save_CXXFLAGS
8076 AC_MSG_RESULT([${can_compile_f16c}])
8077 if test "${can_compile_f16c}" = "yes" ; then
8078     CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
8081 AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
8082 AC_LANG_PUSH([C++])
8083 save_CXXFLAGS=$CXXFLAGS
8084 CXXFLAGS="$CXXFLAGS $flag_fma"
8085 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8086     #include <immintrin.h>
8087     int main () {
8088         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
8089         d = _mm256_fmadd_ps(a, b, c);
8090         return 0;
8091     }
8092     ])],
8093     [can_compile_fma=yes],
8094     [can_compile_fma=no])
8095 AC_LANG_POP([C++])
8096 CXXFLAGS=$save_CXXFLAGS
8097 AC_MSG_RESULT([${can_compile_fma}])
8098 if test "${can_compile_fma}" = "yes" ; then
8099     CXXFLAGS_INTRINSICS_FMA="$flag_fma"
8102 AC_SUBST([CXXFLAGS_INTRINSICS_SSE2])
8103 AC_SUBST([CXXFLAGS_INTRINSICS_SSSE3])
8104 AC_SUBST([CXXFLAGS_INTRINSICS_SSE41])
8105 AC_SUBST([CXXFLAGS_INTRINSICS_SSE42])
8106 AC_SUBST([CXXFLAGS_INTRINSICS_AVX])
8107 AC_SUBST([CXXFLAGS_INTRINSICS_AVX2])
8108 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512])
8109 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512F])
8110 AC_SUBST([CXXFLAGS_INTRINSICS_F16C])
8111 AC_SUBST([CXXFLAGS_INTRINSICS_FMA])
8113 dnl ===================================================================
8114 dnl system stl sanity tests
8115 dnl ===================================================================
8116 if test "$_os" != "WINNT"; then
8118     AC_LANG_PUSH([C++])
8120     save_CPPFLAGS="$CPPFLAGS"
8121     if test -n "$MACOSX_SDK_PATH"; then
8122         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
8123     fi
8125     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
8126     # only.
8127     if test "$CPP_LIBRARY" = GLIBCXX; then
8128         dnl gcc#19664, gcc#22482, rhbz#162935
8129         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
8130         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
8131         AC_MSG_RESULT([$stlvisok])
8132         if test "$stlvisok" = "no"; then
8133             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
8134         fi
8135     fi
8137     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
8138     # when we don't make any dynamic libraries?
8139     if test "$DISABLE_DYNLOADING" = ""; then
8140         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
8141         cat > conftestlib1.cc <<_ACEOF
8142 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
8143 struct S2: S1<int> { virtual ~S2(); };
8144 S2::~S2() {}
8145 _ACEOF
8146         cat > conftestlib2.cc <<_ACEOF
8147 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
8148 struct S2: S1<int> { virtual ~S2(); };
8149 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
8150 _ACEOF
8151         gccvisinlineshiddenok=yes
8152         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
8153             gccvisinlineshiddenok=no
8154         else
8155             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
8156             dnl known to not work with -z defs (unsetting which makes the test
8157             dnl moot, though):
8158             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
8159             if test "$COM_IS_CLANG" = TRUE; then
8160                 for i in $CXX $CXXFLAGS; do
8161                     case $i in
8162                     -fsanitize=*)
8163                         my_linkflagsnoundefs=
8164                         break
8165                         ;;
8166                     esac
8167                 done
8168             fi
8169             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
8170                 gccvisinlineshiddenok=no
8171             fi
8172         fi
8174         rm -fr libconftest*
8175         AC_MSG_RESULT([$gccvisinlineshiddenok])
8176         if test "$gccvisinlineshiddenok" = "no"; then
8177             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
8178         fi
8179     fi
8181    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
8182     cat >visibility.cxx <<_ACEOF
8183 #pragma GCC visibility push(hidden)
8184 struct __attribute__ ((visibility ("default"))) TestStruct {
8185   static void Init();
8187 __attribute__ ((visibility ("default"))) void TestFunc() {
8188   TestStruct::Init();
8190 _ACEOF
8191     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
8192         gccvisbroken=yes
8193     else
8194         case "$host_cpu" in
8195         i?86|x86_64)
8196             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
8197                 gccvisbroken=no
8198             else
8199                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
8200                     gccvisbroken=no
8201                 else
8202                     gccvisbroken=yes
8203                 fi
8204             fi
8205             ;;
8206         *)
8207             gccvisbroken=no
8208             ;;
8209         esac
8210     fi
8211     rm -f visibility.s visibility.cxx
8213     AC_MSG_RESULT([$gccvisbroken])
8214     if test "$gccvisbroken" = "yes"; then
8215         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
8216     fi
8218     CPPFLAGS="$save_CPPFLAGS"
8220     AC_MSG_CHECKING([if CET endbranch is recognized])
8221 cat > endbr.s <<_ACEOF
8222 endbr32
8223 _ACEOF
8224     HAVE_ASM_END_BRANCH_INS_SUPPORT=
8225     if $CXX -c endbr.s -o endbr.o >/dev/null 2>&5; then
8226         AC_MSG_RESULT([yes])
8227         HAVE_ASM_END_BRANCH_INS_SUPPORT=TRUE
8228     else
8229         AC_MSG_RESULT([no])
8230     fi
8231     rm -f endbr.s endbr.o
8232     AC_SUBST(HAVE_ASM_END_BRANCH_INS_SUPPORT)
8234     AC_LANG_POP([C++])
8237 dnl ===================================================================
8238 dnl  Clang++ tests
8239 dnl ===================================================================
8241 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
8242 if test "$GCC" = "yes"; then
8243     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
8244     AC_LANG_PUSH([C++])
8245     save_CXXFLAGS=$CXXFLAGS
8246     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
8247     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
8248     CXXFLAGS=$save_CXXFLAGS
8249     AC_LANG_POP([C++])
8250     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
8251         AC_MSG_RESULT([yes])
8252     else
8253         AC_MSG_RESULT([no])
8254     fi
8256 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
8258 dnl ===================================================================
8259 dnl Compiler plugins
8260 dnl ===================================================================
8262 COMPILER_PLUGINS=
8263 # currently only Clang
8265 if test "$COM_IS_CLANG" != "TRUE"; then
8266     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
8267         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
8268         enable_compiler_plugins=no
8269     fi
8272 COMPILER_PLUGINS_COM_IS_CLANG=
8273 if test "$COM_IS_CLANG" = "TRUE"; then
8274     if test -n "$enable_compiler_plugins"; then
8275         compiler_plugins="$enable_compiler_plugins"
8276     elif test -n "$ENABLE_DBGUTIL"; then
8277         compiler_plugins=test
8278     else
8279         compiler_plugins=no
8280     fi
8281     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
8282         if test "$CLANGVER" -lt 120001; then
8283             if test "$compiler_plugins" = yes; then
8284                 AC_MSG_ERROR(
8285                     [Clang $CLANGVER is too old to build compiler plugins; need >= 12.0.1.])
8286             else
8287                 compiler_plugins=no
8288             fi
8289         fi
8290     fi
8291     if test "$compiler_plugins" != "no"; then
8292         dnl The prefix where Clang resides, override to where Clang resides if
8293         dnl using a source build:
8294         if test -z "$CLANGDIR"; then
8295             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $(printf '%s\n' $CXX | grep clang | head -n 1)))))
8296         fi
8297         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
8298         if test -z "$COMPILER_PLUGINS_CXX"; then
8299             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
8300         fi
8301         clangbindir=$CLANGDIR/bin
8302         if test "$build_os" = "cygwin"; then
8303             clangbindir=$(cygpath -u "$clangbindir")
8304         fi
8305         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
8306         if test -n "$LLVM_CONFIG"; then
8307             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
8308             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
8309             if test -z "$CLANGLIBDIR"; then
8310                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
8311             fi
8312             # Try if clang is built from source (in which case its includes are not together with llvm includes).
8313             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
8314             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
8315             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
8316                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
8317             fi
8318             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
8319             clangobjdir=$($LLVM_CONFIG --obj-root)
8320             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
8321                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
8322             fi
8323         fi
8324         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
8325         AC_LANG_PUSH([C++])
8326         save_CXX=$CXX
8327         save_CXXCPP=$CXXCPP
8328         save_CPPFLAGS=$CPPFLAGS
8329         save_CXXFLAGS=$CXXFLAGS
8330         save_LDFLAGS=$LDFLAGS
8331         save_LIBS=$LIBS
8332         CXX=$COMPILER_PLUGINS_CXX
8333         CXXCPP="$COMPILER_PLUGINS_CXX -E"
8334         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
8335         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
8336         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
8337             [COMPILER_PLUGINS=TRUE],
8338             [
8339             if test "$compiler_plugins" = "yes"; then
8340                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
8341             else
8342                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
8343                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
8344             fi
8345             ])
8346         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
8347         dnl comment in compilerplugins/Makefile-clang.mk:
8348         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
8349             LDFLAGS=""
8350             AC_MSG_CHECKING([for clang libraries to use])
8351             if test -z "$CLANGTOOLLIBS"; then
8352                 LIBS="-lclangTooling -lclangFrontend -lclangDriver -lclangParse -lclangSema -lclangEdit \
8353  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
8354                 AC_LINK_IFELSE([
8355                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8356                         [[ clang::FullSourceLoc().dump(); ]])
8357                 ],[CLANGTOOLLIBS="$LIBS"],[])
8358             fi
8359             if test -z "$CLANGTOOLLIBS"; then
8360                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
8361                 AC_LINK_IFELSE([
8362                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8363                         [[ clang::FullSourceLoc().dump(); ]])
8364                 ],[CLANGTOOLLIBS="$LIBS"],[])
8365             fi
8366             AC_MSG_RESULT([$CLANGTOOLLIBS])
8367             if test -z "$CLANGTOOLLIBS"; then
8368                 if test "$compiler_plugins" = "yes"; then
8369                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
8370                 else
8371                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
8372                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
8373                 fi
8374                 COMPILER_PLUGINS=
8375             fi
8376             if test -n "$COMPILER_PLUGINS"; then
8377                 if test -z "$CLANGSYSINCLUDE"; then
8378                     if test -n "$LLVM_CONFIG"; then
8379                         # Path to the clang system headers (no idea if there's a better way to get it).
8380                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/git\|svn//')/include
8381                     fi
8382                 fi
8383             fi
8384         fi
8385         CXX=$save_CXX
8386         CXXCPP=$save_CXXCPP
8387         CPPFLAGS=$save_CPPFLAGS
8388         CXXFLAGS=$save_CXXFLAGS
8389         LDFLAGS=$save_LDFLAGS
8390         LIBS="$save_LIBS"
8391         AC_LANG_POP([C++])
8393         AC_MSG_CHECKING([whether the compiler for building compilerplugins is actually Clang])
8394         AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
8395             #ifndef __clang__
8396             you lose
8397             #endif
8398             int foo=42;
8399             ]])],
8400             [AC_MSG_RESULT([yes])
8401              COMPILER_PLUGINS_COM_IS_CLANG=TRUE],
8402             [AC_MSG_RESULT([no])])
8403         AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8404     fi
8405 else
8406     if test "$enable_compiler_plugins" = "yes"; then
8407         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
8408     fi
8410 COMPILER_PLUGINS_ANALYZER_PCH=
8411 if test "$enable_compiler_plugins_analyzer_pch" != no; then
8412     COMPILER_PLUGINS_ANALYZER_PCH=TRUE
8414 AC_SUBST(COMPILER_PLUGINS)
8415 AC_SUBST(COMPILER_PLUGINS_ANALYZER_PCH)
8416 AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8417 AC_SUBST(COMPILER_PLUGINS_CXX)
8418 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
8419 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
8420 AC_SUBST(COMPILER_PLUGINS_DEBUG)
8421 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
8422 AC_SUBST(CLANGDIR)
8423 AC_SUBST(CLANGLIBDIR)
8424 AC_SUBST(CLANGTOOLLIBS)
8425 AC_SUBST(CLANGSYSINCLUDE)
8427 # Plugin to help linker.
8428 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
8429 # This makes --enable-lto build with clang work.
8430 AC_SUBST(LD_PLUGIN)
8432 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
8433 AC_SUBST(HAVE_POSIX_FALLOCATE)
8435 JITC_PROCESSOR_TYPE=""
8436 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
8437     # IBMs JDK needs this...
8438     JITC_PROCESSOR_TYPE=6
8439     export JITC_PROCESSOR_TYPE
8441 AC_SUBST([JITC_PROCESSOR_TYPE])
8443 # Misc Windows Stuff
8444 AC_ARG_WITH(ucrt-dir,
8445     AS_HELP_STRING([--with-ucrt-dir],
8446         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
8447         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
8448         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
8449             Windows6.1-KB2999226-x64.msu
8450             Windows6.1-KB2999226-x86.msu
8451             Windows8.1-KB2999226-x64.msu
8452             Windows8.1-KB2999226-x86.msu
8453             Windows8-RT-KB2999226-x64.msu
8454             Windows8-RT-KB2999226-x86.msu
8455         A zip archive including those files is available from Microsoft site:
8456         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
8459 UCRT_REDISTDIR="$with_ucrt_dir"
8460 if test $_os = "WINNT"; then
8461     find_msvc_x64_dlls
8462     for i in $PKGFORMAT; do
8463         if test "$i" = msi; then
8464             find_msms
8465             break
8466         fi
8467     done
8468     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
8469     MSVC_DLLS="$msvcdlls"
8470     test -n "$msmdir" && MSM_PATH=`win_short_path_for_make "$msmdir"`
8471     # MSVC 15.3 changed it to VC141
8472     if echo "$msvcdllpath" | grep -q "VC143.CRT$"; then
8473         SCPDEFS="$SCPDEFS -DWITH_VC143_REDIST"
8474     elif echo "$msvcdllpath" | grep -q "VC142.CRT$"; then
8475         SCPDEFS="$SCPDEFS -DWITH_VC142_REDIST"
8476     elif echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
8477         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
8478     else
8479         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
8480     fi
8482     if test "$UCRT_REDISTDIR" = "no"; then
8483         dnl explicitly disabled
8484         UCRT_REDISTDIR=""
8485     else
8486         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
8487                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
8488                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
8489                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
8490                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
8491                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
8492             UCRT_REDISTDIR=""
8493             if test -n "$PKGFORMAT"; then
8494                for i in $PKGFORMAT; do
8495                    case "$i" in
8496                    msi)
8497                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
8498                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
8499                        ;;
8500                    esac
8501                done
8502             fi
8503         fi
8504     fi
8507 AC_SUBST(UCRT_REDISTDIR)
8508 AC_SUBST(MSVC_DLL_PATH)
8509 AC_SUBST(MSVC_DLLS)
8510 AC_SUBST(MSM_PATH)
8513 dnl ===================================================================
8514 dnl Checks for Java
8515 dnl ===================================================================
8516 if test "$ENABLE_JAVA" != ""; then
8518     # Windows-specific tests
8519     if test "$build_os" = "cygwin"; then
8520         if test -z "$with_jdk_home"; then
8521             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
8522             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
8523             reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
8524             if test -n "$regvalue"; then
8525                 ver=$regvalue
8526                 reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
8527                 with_jdk_home=$regvalue
8528             fi
8529             howfound="found automatically"
8530         else
8531             with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
8532             howfound="you passed"
8533         fi
8535         if ! test -f "$with_jdk_home/lib/jvm.lib" -a -f "$with_jdk_home/bin/java.exe"; then
8536             AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option (or fix the path) pointing to a $WIN_HOST_BITS-bit JDK >= 9])
8537         fi
8538     fi
8540     # 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.
8541     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
8542     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
8543         with_jdk_home=`/usr/libexec/java_home`
8544     fi
8546     JAVA_HOME=; export JAVA_HOME
8547     if test -z "$with_jdk_home"; then
8548         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
8549     else
8550         _java_path="$with_jdk_home/bin/$with_java"
8551         dnl Check if there is a Java interpreter at all.
8552         if test -x "$_java_path"; then
8553             JAVAINTERPRETER=$_java_path
8554         else
8555             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
8556         fi
8557     fi
8559     dnl Check that the JDK found is correct architecture (at least 2 reasons to
8560     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
8561     dnl loaded by java to run JunitTests:
8562     if test "$build_os" = "cygwin" -a "$cross_compiling" != "yes"; then
8563         shortjdkhome=`cygpath -d "$with_jdk_home"`
8564         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
8565             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
8566             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8567         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
8568             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8569             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8570         fi
8572         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
8573             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
8574         fi
8575         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
8576     elif test "$cross_compiling" != "yes"; then
8577         case $CPUNAME in
8578             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
8579                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
8580                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
8581                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8582                 fi
8583                 ;;
8584             *) # assumption: everything else 32-bit
8585                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
8586                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8587                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8588                 fi
8589                 ;;
8590         esac
8591     fi
8594 dnl ===================================================================
8595 dnl Checks for JDK.
8596 dnl ===================================================================
8598 # Whether all the complexity here actually is needed any more or not, no idea.
8600 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8601     _gij_longver=0
8602     AC_MSG_CHECKING([the installed JDK])
8603     if test -n "$JAVAINTERPRETER"; then
8604         dnl java -version sends output to stderr!
8605         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
8606             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8607         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
8608             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8609         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
8610             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8611         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
8612             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8613         else
8614             JDK=sun
8616             dnl Sun JDK specific tests
8617             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
8618             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
8620             if test "$_jdk_ver" -lt 10900; then
8621                 AC_MSG_ERROR([JDK is too old, you need at least 9 ($_jdk_ver < 10900)])
8622             fi
8623             if test "$_jdk_ver" -gt 10900; then
8624                 JAVA_CLASSPATH_NOT_SET=TRUE
8625             fi
8627             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
8628             if test "$_os" = "WINNT"; then
8629                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
8630             fi
8631             AC_MSG_RESULT([found $JAVA_HOME (JDK $_jdk)])
8633             # set to limit VM usage for JunitTests
8634             JAVAIFLAGS=-Xmx64M
8635             # set to limit VM usage for javac
8636             JAVACFLAGS=-J-Xmx128M
8637         fi
8638     else
8639         AC_MSG_ERROR([Java not found. You need at least JDK 9])
8640     fi
8641 else
8642     if test -z "$ENABLE_JAVA"; then
8643         dnl Java disabled
8644         JAVA_HOME=
8645         export JAVA_HOME
8646     elif test "$cross_compiling" = "yes"; then
8647         # Just assume compatibility of build and host JDK
8648         JDK=$JDK_FOR_BUILD
8649         JAVAIFLAGS=$JAVAIFLAGS_FOR_BUILD
8650     fi
8653 dnl ===================================================================
8654 dnl Checks for javac
8655 dnl ===================================================================
8656 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8657     javacompiler="javac"
8658     : ${JAVA_SOURCE_VER=8}
8659     : ${JAVA_TARGET_VER=8}
8660     if test -z "$with_jdk_home"; then
8661         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
8662     else
8663         _javac_path="$with_jdk_home/bin/$javacompiler"
8664         dnl Check if there is a Java compiler at all.
8665         if test -x "$_javac_path"; then
8666             JAVACOMPILER=$_javac_path
8667         fi
8668     fi
8669     if test -z "$JAVACOMPILER"; then
8670         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
8671     fi
8672     if test "$build_os" = "cygwin"; then
8673         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
8674             JAVACOMPILER="${JAVACOMPILER}.exe"
8675         fi
8676         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
8677     fi
8680 dnl ===================================================================
8681 dnl Checks for javadoc
8682 dnl ===================================================================
8683 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8684     if test -z "$with_jdk_home"; then
8685         AC_PATH_PROG(JAVADOC, javadoc)
8686     else
8687         _javadoc_path="$with_jdk_home/bin/javadoc"
8688         dnl Check if there is a javadoc at all.
8689         if test -x "$_javadoc_path"; then
8690             JAVADOC=$_javadoc_path
8691         else
8692             AC_PATH_PROG(JAVADOC, javadoc)
8693         fi
8694     fi
8695     if test -z "$JAVADOC"; then
8696         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
8697     fi
8698     if test "$build_os" = "cygwin"; then
8699         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
8700             JAVADOC="${JAVADOC}.exe"
8701         fi
8702         JAVADOC=`win_short_path_for_make "$JAVADOC"`
8703     fi
8705     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
8706     JAVADOCISGJDOC="yes"
8707     fi
8709 AC_SUBST(JAVADOC)
8710 AC_SUBST(JAVADOCISGJDOC)
8712 if test "$ENABLE_JAVA" != "" -a \( "$cross_compiling" != "yes" -o -n "$with_jdk_home" \); then
8713     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
8714     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
8715         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
8716            # try to recover first by looking whether we have an alternative
8717            # system as in Debian or newer SuSEs where following /usr/bin/javac
8718            # over /etc/alternatives/javac leads to the right bindir where we
8719            # just need to strip a bit away to get a valid JAVA_HOME
8720            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
8721         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
8722             # maybe only one level of symlink (e.g. on Mac)
8723             JAVA_HOME=$(readlink $JAVACOMPILER)
8724             if test "$(dirname $JAVA_HOME)" = "."; then
8725                 # we've got no path to trim back
8726                 JAVA_HOME=""
8727             fi
8728         else
8729             # else warn
8730             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
8731             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
8732             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
8733             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
8734         fi
8735         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
8736         if test "$JAVA_HOME" != "/usr"; then
8737             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8738                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
8739                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
8740                 dnl Tiger already returns a JDK path...
8741                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
8742             else
8743                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
8744                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
8745                 dnl that checks which version to run
8746                 if test -f "$JAVA_HOME"; then
8747                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
8748                 fi
8749             fi
8750         fi
8751     fi
8752     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
8754     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
8755     if test -z "$JAVA_HOME"; then
8756         if test "x$with_jdk_home" = "x"; then
8757             cat > findhome.java <<_ACEOF
8758 [import java.io.File;
8760 class findhome
8762     public static void main(String args[])
8763     {
8764         String jrelocation = System.getProperty("java.home");
8765         File jre = new File(jrelocation);
8766         System.out.println(jre.getParent());
8767     }
8769 _ACEOF
8770             AC_MSG_CHECKING([if javac works])
8771             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
8772             AC_TRY_EVAL(javac_cmd)
8773             if test $? = 0 -a -f ./findhome.class; then
8774                 AC_MSG_RESULT([javac works])
8775             else
8776                 echo "configure: javac test failed" >&5
8777                 cat findhome.java >&5
8778                 AC_MSG_ERROR([javac does not work - java projects will not build!])
8779             fi
8780             AC_MSG_CHECKING([if gij knows its java.home])
8781             JAVA_HOME=`$JAVAINTERPRETER findhome`
8782             if test $? = 0 -a "$JAVA_HOME" != ""; then
8783                 AC_MSG_RESULT([$JAVA_HOME])
8784             else
8785                 echo "configure: java test failed" >&5
8786                 cat findhome.java >&5
8787                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
8788             fi
8789             # clean-up after ourselves
8790             rm -f ./findhome.java ./findhome.class
8791         else
8792             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
8793         fi
8794     fi
8796     # now check if $JAVA_HOME is really valid
8797     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8798         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
8799             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
8800             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
8801             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
8802             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
8803             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
8804             add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
8805         fi
8806     fi
8807     PathFormat "$JAVA_HOME"
8808     JAVA_HOME="$formatted_path"
8811 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
8812     "$_os" != Darwin
8813 then
8814     AC_MSG_CHECKING([for JAWT lib])
8815     if test "$_os" = WINNT; then
8816         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
8817         JAWTLIB=jawt.lib
8818     else
8819         case "$host_cpu" in
8820         arm*)
8821             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
8822             JAVA_ARCH=$my_java_arch
8823             ;;
8824         i*86)
8825             my_java_arch=i386
8826             ;;
8827         m68k)
8828             my_java_arch=m68k
8829             ;;
8830         powerpc)
8831             my_java_arch=ppc
8832             ;;
8833         powerpc64)
8834             my_java_arch=ppc64
8835             ;;
8836         powerpc64le)
8837             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
8838             JAVA_ARCH=$my_java_arch
8839             ;;
8840         sparc64)
8841             my_java_arch=sparcv9
8842             ;;
8843         x86_64)
8844             my_java_arch=amd64
8845             ;;
8846         *)
8847             my_java_arch=$host_cpu
8848             ;;
8849         esac
8850         # This is where JDK9 puts the library
8851         if test -e "$JAVA_HOME/lib/libjawt.so"; then
8852             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
8853         else
8854             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
8855         fi
8856         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
8857     fi
8858     AC_MSG_RESULT([$JAWTLIB])
8860 AC_SUBST(JAWTLIB)
8862 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
8863     case "$host_os" in
8865     aix*)
8866         JAVAINC="-I$JAVA_HOME/include"
8867         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
8868         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8869         ;;
8871     cygwin*|wsl*)
8872         JAVAINC="-I$JAVA_HOME/include/win32"
8873         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
8874         ;;
8876     darwin*)
8877         if test -d "$JAVA_HOME/include/darwin"; then
8878             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
8879         else
8880             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
8881         fi
8882         ;;
8884     dragonfly*)
8885         JAVAINC="-I$JAVA_HOME/include"
8886         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8887         ;;
8889     freebsd*)
8890         JAVAINC="-I$JAVA_HOME/include"
8891         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
8892         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
8893         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8894         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8895         ;;
8897     k*bsd*-gnu*)
8898         JAVAINC="-I$JAVA_HOME/include"
8899         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8900         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8901         ;;
8903     linux-gnu*)
8904         JAVAINC="-I$JAVA_HOME/include"
8905         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8906         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8907         ;;
8909     *netbsd*)
8910         JAVAINC="-I$JAVA_HOME/include"
8911         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
8912         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8913        ;;
8915     openbsd*)
8916         JAVAINC="-I$JAVA_HOME/include"
8917         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
8918         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8919         ;;
8921     solaris*)
8922         JAVAINC="-I$JAVA_HOME/include"
8923         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
8924         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8925         ;;
8926     esac
8928 SOLARINC="$SOLARINC $JAVAINC"
8930 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8931     JAVA_HOME_FOR_BUILD=$JAVA_HOME
8932     JAVAIFLAGS_FOR_BUILD=$JAVAIFLAGS
8933     JDK_FOR_BUILD=$JDK
8936 AC_SUBST(JAVACFLAGS)
8937 AC_SUBST(JAVACOMPILER)
8938 AC_SUBST(JAVAINTERPRETER)
8939 AC_SUBST(JAVAIFLAGS)
8940 AC_SUBST(JAVAIFLAGS_FOR_BUILD)
8941 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
8942 AC_SUBST(JAVA_HOME)
8943 AC_SUBST(JAVA_HOME_FOR_BUILD)
8944 AC_SUBST(JDK)
8945 AC_SUBST(JDK_FOR_BUILD)
8946 AC_SUBST(JAVA_SOURCE_VER)
8947 AC_SUBST(JAVA_TARGET_VER)
8950 dnl ===================================================================
8951 dnl Export file validation
8952 dnl ===================================================================
8953 AC_MSG_CHECKING([whether to enable export file validation])
8954 if test "$with_export_validation" != "no"; then
8955     if test -z "$ENABLE_JAVA"; then
8956         if test "$with_export_validation" = "yes"; then
8957             AC_MSG_ERROR([requested, but Java is disabled])
8958         else
8959             AC_MSG_RESULT([no, as Java is disabled])
8960         fi
8961     elif ! test -d "${SRC_ROOT}/schema"; then
8962         if test "$with_export_validation" = "yes"; then
8963             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
8964         else
8965             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
8966         fi
8967     else
8968         AC_MSG_RESULT([yes])
8969         AC_DEFINE(HAVE_EXPORT_VALIDATION)
8971         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
8972         if test -z "$ODFVALIDATOR"; then
8973             # remember to download the ODF toolkit with validator later
8974             AC_MSG_NOTICE([no odfvalidator found, will download it])
8975             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
8976             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
8978             # and fetch name of odfvalidator jar name from download.lst
8979             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
8980             AC_SUBST(ODFVALIDATOR_JAR)
8982             if test -z "$ODFVALIDATOR_JAR"; then
8983                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
8984             fi
8985         fi
8986         if test "$build_os" = "cygwin"; then
8987             # In case of Cygwin it will be executed from Windows,
8988             # so we need to run bash and absolute path to validator
8989             # so instead of "odfvalidator" it will be
8990             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
8991             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
8992         else
8993             ODFVALIDATOR="sh $ODFVALIDATOR"
8994         fi
8995         AC_SUBST(ODFVALIDATOR)
8998         AC_PATH_PROGS(OFFICEOTRON, officeotron)
8999         if test -z "$OFFICEOTRON"; then
9000             # remember to download the officeotron with validator later
9001             AC_MSG_NOTICE([no officeotron found, will download it])
9002             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
9003             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
9005             # and fetch name of officeotron jar name from download.lst
9006             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
9007             AC_SUBST(OFFICEOTRON_JAR)
9009             if test -z "$OFFICEOTRON_JAR"; then
9010                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
9011             fi
9012         else
9013             # check version of existing officeotron
9014             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
9015             if test 0"$OFFICEOTRON_VER" -lt 704; then
9016                 AC_MSG_ERROR([officeotron too old])
9017             fi
9018         fi
9019         if test "$build_os" = "cygwin"; then
9020             # In case of Cygwin it will be executed from Windows,
9021             # so we need to run bash and absolute path to validator
9022             # so instead of "odfvalidator" it will be
9023             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
9024             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
9025         else
9026             OFFICEOTRON="sh $OFFICEOTRON"
9027         fi
9028     fi
9029     AC_SUBST(OFFICEOTRON)
9030 else
9031     AC_MSG_RESULT([no])
9034 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
9035 if test "$with_bffvalidator" != "no"; then
9036     AC_DEFINE(HAVE_BFFVALIDATOR)
9038     if test "$with_export_validation" = "no"; then
9039         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
9040     fi
9042     if test "$with_bffvalidator" = "yes"; then
9043         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
9044     else
9045         BFFVALIDATOR="$with_bffvalidator"
9046     fi
9048     if test "$build_os" = "cygwin"; then
9049         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
9050             AC_MSG_RESULT($BFFVALIDATOR)
9051         else
9052             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
9053         fi
9054     elif test -n "$BFFVALIDATOR"; then
9055         # We are not in Cygwin but need to run Windows binary with wine
9056         AC_PATH_PROGS(WINE, wine)
9058         # so swap in a shell wrapper that converts paths transparently
9059         BFFVALIDATOR_EXE="$BFFVALIDATOR"
9060         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
9061         AC_SUBST(BFFVALIDATOR_EXE)
9062         AC_MSG_RESULT($BFFVALIDATOR)
9063     else
9064         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
9065     fi
9066     AC_SUBST(BFFVALIDATOR)
9067 else
9068     AC_MSG_RESULT([no])
9071 dnl ===================================================================
9072 dnl Check for C preprocessor to use
9073 dnl ===================================================================
9074 AC_MSG_CHECKING([which C preprocessor to use in idlc])
9075 SYSTEM_UCPP_IS_GCC=
9076 if test -n "$with_idlc_cpp"; then
9077     AC_MSG_RESULT([$with_idlc_cpp])
9078     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
9079     AC_MSG_CHECKING([if $with_idlc_cpp is GCC CPP])
9080     # ucpp will accept -v (to output version), warn about the others as unknown
9081     # and return 1 (due to -v)
9082     # gcc will accept -v (as verbose), --version (to output version) and -nostdinc
9083     # and return 0 (due to --version ) if all options are supported
9084     $SYSTEM_UCPP -v --version -nostdinc >/dev/null 2>/dev/null
9085     if test $? -eq 0;  then
9086         SYSTEM_UCPP_IS_GCC=TRUE
9087         AC_MSG_RESULT([yes])
9088     else
9089         AC_MSG_RESULT([no])
9090     fi
9091 else
9092     AC_MSG_RESULT([ucpp])
9093     AC_MSG_CHECKING([which ucpp to use])
9094     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
9095         AC_MSG_RESULT([external])
9096         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
9097     else
9098         AC_MSG_RESULT([internal])
9099         BUILD_TYPE="$BUILD_TYPE UCPP"
9100     fi
9102 AC_SUBST(SYSTEM_UCPP)
9103 AC_SUBST(SYSTEM_UCPP_IS_GCC)
9105 dnl ===================================================================
9106 dnl Check for epm (not needed for Windows)
9107 dnl ===================================================================
9108 AC_MSG_CHECKING([whether to enable EPM for packing])
9109 if test "$enable_epm" = "yes"; then
9110     AC_MSG_RESULT([yes])
9111     if test "$_os" != "WINNT"; then
9112         if test $_os = Darwin; then
9113             EPM=internal
9114         elif test -n "$with_epm"; then
9115             EPM=$with_epm
9116         else
9117             AC_PATH_PROG(EPM, epm, no)
9118         fi
9119         if test "$EPM" = "no" -o "$EPM" = "internal"; then
9120             AC_MSG_NOTICE([EPM will be built.])
9121             BUILD_TYPE="$BUILD_TYPE EPM"
9122             EPM=${WORKDIR}/UnpackedTarball/epm/epm
9123         else
9124             # Gentoo has some epm which is something different...
9125             AC_MSG_CHECKING([whether the found epm is the right epm])
9126             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
9127                 AC_MSG_RESULT([yes])
9128             else
9129                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
9130             fi
9131             AC_MSG_CHECKING([epm version])
9132             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
9133             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
9134                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
9135                 AC_MSG_RESULT([OK, >= 3.7])
9136             else
9137                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
9138                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
9139             fi
9140         fi
9141     fi
9143     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
9144         AC_MSG_CHECKING([for rpm])
9145         for a in "$RPM" rpmbuild rpm; do
9146             $a --usage >/dev/null 2> /dev/null
9147             if test $? -eq 0; then
9148                 RPM=$a
9149                 break
9150             else
9151                 $a --version >/dev/null 2> /dev/null
9152                 if test $? -eq 0; then
9153                     RPM=$a
9154                     break
9155                 fi
9156             fi
9157         done
9158         if test -z "$RPM"; then
9159             AC_MSG_ERROR([not found])
9160         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
9161             RPM_PATH=`which $RPM`
9162             AC_MSG_RESULT([$RPM_PATH])
9163             SCPDEFS="$SCPDEFS -DWITH_RPM"
9164         else
9165             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
9166         fi
9167     fi
9168     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
9169         AC_PATH_PROG(DPKG, dpkg, no)
9170         if test "$DPKG" = "no"; then
9171             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
9172         fi
9173     fi
9174     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
9175        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
9176         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
9177             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
9178                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
9179                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
9180                     AC_MSG_RESULT([yes])
9181                 else
9182                     AC_MSG_RESULT([no])
9183                     if echo "$PKGFORMAT" | $GREP -q rpm; then
9184                         _pt="rpm"
9185                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
9186                         add_warning "the rpms will need to be installed with --nodeps"
9187                     else
9188                         _pt="pkg"
9189                     fi
9190                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
9191                     add_warning "the ${_pt}s will not be relocatable"
9192                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
9193                                  relocation will work, you need to patch your epm with the
9194                                  patch in epm/epm-3.7.patch or build with
9195                                  --with-epm=internal which will build a suitable epm])
9196                 fi
9197             fi
9198         fi
9199     fi
9200     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
9201         AC_PATH_PROG(PKGMK, pkgmk, no)
9202         if test "$PKGMK" = "no"; then
9203             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
9204         fi
9205     fi
9206     AC_SUBST(RPM)
9207     AC_SUBST(DPKG)
9208     AC_SUBST(PKGMK)
9209 else
9210     for i in $PKGFORMAT; do
9211         case "$i" in
9212         aix | bsd | deb | pkg | rpm | native | portable)
9213             AC_MSG_ERROR(
9214                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
9215             ;;
9216         esac
9217     done
9218     AC_MSG_RESULT([no])
9219     EPM=NO
9221 AC_SUBST(EPM)
9223 ENABLE_LWP=
9224 if test "$enable_lotuswordpro" = "yes"; then
9225     ENABLE_LWP="TRUE"
9227 AC_SUBST(ENABLE_LWP)
9229 dnl ===================================================================
9230 dnl Check for building ODK
9231 dnl ===================================================================
9232 AC_MSG_CHECKING([whether to build the ODK])
9233 if test "$enable_odk" = yes; then
9234     if test "$DISABLE_DYNLOADING" = TRUE; then
9235         AC_MSG_ERROR([can't build ODK for --disable-dynamic-loading builds])
9236     fi
9237     AC_MSG_RESULT([yes])
9238     BUILD_TYPE="$BUILD_TYPE ODK"
9239 else
9240     AC_MSG_RESULT([no])
9243 if test "$enable_odk" != yes; then
9244     unset DOXYGEN
9245 else
9246     if test "$with_doxygen" = no; then
9247         AC_MSG_CHECKING([for doxygen])
9248         unset DOXYGEN
9249         AC_MSG_RESULT([no])
9250     else
9251         if test "$with_doxygen" = yes; then
9252             AC_PATH_PROG([DOXYGEN], [doxygen])
9253             if test -z "$DOXYGEN"; then
9254                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
9255             fi
9256             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
9257                 if ! dot -V 2>/dev/null; then
9258                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
9259                 fi
9260             fi
9261         else
9262             AC_MSG_CHECKING([for doxygen])
9263             DOXYGEN=$with_doxygen
9264             AC_MSG_RESULT([$DOXYGEN])
9265         fi
9266         if test -n "$DOXYGEN"; then
9267             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
9268             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
9269             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
9270                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
9271             fi
9272         fi
9273     fi
9275 AC_SUBST([DOXYGEN])
9277 dnl ==================================================================
9278 dnl libfuzzer
9279 dnl ==================================================================
9280 AC_MSG_CHECKING([whether to enable fuzzers])
9281 if test "$enable_fuzzers" != yes; then
9282     AC_MSG_RESULT([no])
9283 else
9284     if test -z $LIB_FUZZING_ENGINE; then
9285       AC_MSG_ERROR(['LIB_FUZZING_ENGINE' must be set when using --enable-fuzzers. Examples include '-fsanitize=fuzzer'.])
9286     fi
9287     AC_MSG_RESULT([yes])
9288     ENABLE_FUZZERS="TRUE"
9289     AC_DEFINE([ENABLE_FUZZERS],1)
9290     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9292 AC_SUBST(LIB_FUZZING_ENGINE)
9294 dnl ===================================================================
9295 dnl Check for system zlib
9296 dnl ===================================================================
9297 if test "$with_system_zlib" = "auto"; then
9298     case "$_os" in
9299     WINNT)
9300         with_system_zlib="$with_system_libs"
9301         ;;
9302     *)
9303         if test "$enable_fuzzers" != "yes"; then
9304             with_system_zlib=yes
9305         else
9306             with_system_zlib=no
9307         fi
9308         ;;
9309     esac
9312 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
9313 dnl and has no pkg-config for it at least on some tinderboxes,
9314 dnl so leaving that out for now
9315 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
9316 AC_MSG_CHECKING([which zlib to use])
9317 if test "$with_system_zlib" = "yes"; then
9318     AC_MSG_RESULT([external])
9319     SYSTEM_ZLIB=TRUE
9320     AC_CHECK_HEADER(zlib.h, [],
9321         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
9322     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
9323         [AC_MSG_ERROR(zlib not found or functional)], [])
9324 else
9325     AC_MSG_RESULT([internal])
9326     SYSTEM_ZLIB=
9327     BUILD_TYPE="$BUILD_TYPE ZLIB"
9328     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
9329     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
9331 AC_SUBST(ZLIB_CFLAGS)
9332 AC_SUBST(ZLIB_LIBS)
9333 AC_SUBST(SYSTEM_ZLIB)
9335 dnl ===================================================================
9336 dnl Check for system jpeg
9337 dnl ===================================================================
9338 AC_MSG_CHECKING([which libjpeg to use])
9339 if test "$with_system_jpeg" = "yes"; then
9340     AC_MSG_RESULT([external])
9341     SYSTEM_LIBJPEG=TRUE
9342     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
9343         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
9344     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
9345         [AC_MSG_ERROR(jpeg library not found or functional)], [])
9346 else
9347     SYSTEM_LIBJPEG=
9348     AC_MSG_RESULT([internal, libjpeg-turbo])
9349     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
9351     case "$host_cpu" in
9352     x86_64 | amd64 | i*86 | x86 | ia32)
9353         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
9354         if test -z "$NASM" -a "$build_os" = "cygwin"; then
9355             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
9356                 NASM="$LODE_HOME/opt/bin/nasm"
9357             elif test -x "/opt/lo/bin/nasm"; then
9358                 NASM="/opt/lo/bin/nasm"
9359             fi
9360         fi
9362         if test -n "$NASM"; then
9363             AC_MSG_CHECKING([for object file format of host system])
9364             case "$host_os" in
9365               cygwin* | mingw* | pw32* | wsl*)
9366                 case "$host_cpu" in
9367                   x86_64)
9368                     objfmt='Win64-COFF'
9369                     ;;
9370                   *)
9371                     objfmt='Win32-COFF'
9372                     ;;
9373                 esac
9374               ;;
9375               msdosdjgpp* | go32*)
9376                 objfmt='COFF'
9377               ;;
9378               os2-emx*) # not tested
9379                 objfmt='MSOMF' # obj
9380               ;;
9381               linux*coff* | linux*oldld*)
9382                 objfmt='COFF' # ???
9383               ;;
9384               linux*aout*)
9385                 objfmt='a.out'
9386               ;;
9387               linux*)
9388                 case "$host_cpu" in
9389                   x86_64)
9390                     objfmt='ELF64'
9391                     ;;
9392                   *)
9393                     objfmt='ELF'
9394                     ;;
9395                 esac
9396               ;;
9397               kfreebsd* | freebsd* | netbsd* | openbsd*)
9398                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
9399                   objfmt='BSD-a.out'
9400                 else
9401                   case "$host_cpu" in
9402                     x86_64 | amd64)
9403                       objfmt='ELF64'
9404                       ;;
9405                     *)
9406                       objfmt='ELF'
9407                       ;;
9408                   esac
9409                 fi
9410               ;;
9411               solaris* | sunos* | sysv* | sco*)
9412                 case "$host_cpu" in
9413                   x86_64)
9414                     objfmt='ELF64'
9415                     ;;
9416                   *)
9417                     objfmt='ELF'
9418                     ;;
9419                 esac
9420               ;;
9421               darwin* | rhapsody* | nextstep* | openstep* | macos*)
9422                 case "$host_cpu" in
9423                   x86_64)
9424                     objfmt='Mach-O64'
9425                     ;;
9426                   *)
9427                     objfmt='Mach-O'
9428                     ;;
9429                 esac
9430               ;;
9431               *)
9432                 objfmt='ELF ?'
9433               ;;
9434             esac
9436             AC_MSG_RESULT([$objfmt])
9437             if test "$objfmt" = 'ELF ?'; then
9438               objfmt='ELF'
9439               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
9440             fi
9442             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
9443             case "$objfmt" in
9444               MSOMF)      NAFLAGS='-fobj -DOBJ32 -DPIC';;
9445               Win32-COFF) NAFLAGS='-fwin32 -DWIN32 -DPIC';;
9446               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__ -DPIC';;
9447               COFF)       NAFLAGS='-fcoff -DCOFF -DPIC';;
9448               a.out)      NAFLAGS='-faout -DAOUT -DPIC';;
9449               BSD-a.out)  NAFLAGS='-faoutb -DAOUT -DPIC';;
9450               ELF)        NAFLAGS='-felf -DELF -DPIC';;
9451               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__ -DPIC';;
9452               RDF)        NAFLAGS='-frdf -DRDF -DPIC';;
9453               Mach-O)     NAFLAGS='-fmacho -DMACHO -DPIC';;
9454               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__ -DPIC';;
9455             esac
9456             AC_MSG_RESULT([$NAFLAGS])
9458             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
9459             cat > conftest.asm << EOF
9460             [%line __oline__ "configure"
9461                     section .text
9462                     global  _main,main
9463             _main:
9464             main:   xor     eax,eax
9465                     ret
9466             ]
9468             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
9469             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
9470               AC_MSG_RESULT(yes)
9471             else
9472               echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
9473               cat conftest.asm >&AS_MESSAGE_LOG_FD
9474               rm -rf conftest*
9475               AC_MSG_RESULT(no)
9476               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
9477               NASM=""
9478             fi
9480         fi
9482         if test -z "$NASM"; then
9483 cat << _EOS
9484 ****************************************************************************
9485 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
9486 To get one please:
9488 _EOS
9489             if test "$build_os" = "cygwin"; then
9490 cat << _EOS
9491 install a pre-compiled binary for Win32
9493 mkdir -p /opt/lo/bin
9494 cd /opt/lo/bin
9495 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
9496 chmod +x nasm
9498 or get and install one from http://www.nasm.us/
9500 Then re-run autogen.sh
9502 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
9503 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
9505 _EOS
9506             else
9507 cat << _EOS
9508 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
9510 _EOS
9511             fi
9512             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
9513             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
9514         fi
9515       ;;
9516     esac
9519 AC_SUBST(NASM)
9520 AC_SUBST(NAFLAGS)
9521 AC_SUBST(LIBJPEG_CFLAGS)
9522 AC_SUBST(LIBJPEG_LIBS)
9523 AC_SUBST(SYSTEM_LIBJPEG)
9525 dnl ===================================================================
9526 dnl Check for system clucene
9527 dnl ===================================================================
9528 libo_CHECK_SYSTEM_MODULE([clucene],[CLUCENE],[libclucene-core])
9529 if test "$SYSTEM_CLUCENE" = TRUE; then
9530     AC_LANG_PUSH([C++])
9531     save_CXXFLAGS=$CXXFLAGS
9532     save_CPPFLAGS=$CPPFLAGS
9533     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
9534     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
9535     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
9536     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
9537     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
9538                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
9539     CXXFLAGS=$save_CXXFLAGS
9540     CPPFLAGS=$save_CPPFLAGS
9541     AC_LANG_POP([C++])
9542     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
9545 dnl ===================================================================
9546 dnl Check for system expat
9547 dnl ===================================================================
9548 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
9550 dnl ===================================================================
9551 dnl Check for system xmlsec
9552 dnl ===================================================================
9553 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
9555 libo_CHECK_SYSTEM_MODULE([eot],[LIBEOT],[libeot >= 0.01],disabled)
9557 dnl ===================================================================
9558 dnl Check for DLP libs
9559 dnl ===================================================================
9560 REVENGE_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/librevenge/inc"
9561 AS_IF([test "$COM" = "MSC"],
9562       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
9563       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
9565 REVENGE_LIBS_internal="-L${librevenge_libdir} -lrevenge-0.0"
9566 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1])
9568 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
9570 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
9572 WPD_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/libwpd/inc"
9573 AS_IF([test "$COM" = "MSC"],
9574       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
9575       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
9577 WPD_LIBS_internal="-L${libwpd_libdir} -lwpd-0.10"
9578 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10])
9580 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
9582 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
9583 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.12])
9585 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
9587 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
9589 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
9591 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
9592 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.21])
9594 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
9595 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.10])
9597 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
9599 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
9600 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
9602 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
9604 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
9606 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
9608 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
9610 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
9611 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.7])
9613 dnl ===================================================================
9614 dnl Check for system lcms2
9615 dnl ===================================================================
9616 if test "$with_system_lcms2" != "yes"; then
9617     SYSTEM_LCMS2=
9619 LCMS2_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/lcms2/include"
9620 LCMS2_LIBS_internal="-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"
9621 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2])
9622 if test "$GCC" = "yes"; then
9623     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
9625 if test "$COM" = "MSC"; then # override the above
9626     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
9629 dnl ===================================================================
9630 dnl Check for system cppunit
9631 dnl ===================================================================
9632 if test "$_os" != "Android" ; then
9633     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
9636 dnl ===================================================================
9637 dnl Check whether freetype is available
9639 dnl FreeType has 3 different kinds of versions
9640 dnl * release, like 2.4.10
9641 dnl * libtool, like 13.0.7 (this what pkg-config returns)
9642 dnl * soname
9643 dnl FreeType's docs/VERSION.DLL provides a table mapping between the three
9645 dnl 9.9.3 is 2.2.0
9646 dnl When the minimal version is at least 2.8.1, remove Skia's check down below.
9647 dnl ===================================================================
9648 FREETYPE_CFLAGS_internal="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
9649 if test "x$ac_config_site_64bit_host" = xYES; then
9650     FREETYPE_LIBS_internal="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
9651 else
9652     FREETYPE_LIBS_internal="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
9654 libo_CHECK_SYSTEM_MODULE([freetype],[FREETYPE],[freetype2 >= 9.9.3],,system,TRUE)
9656 # ===================================================================
9657 # Check for system libxslt
9658 # to prevent incompatibilities between internal libxml2 and external libxslt,
9659 # or vice versa, use with_system_libxml here
9660 # ===================================================================
9661 if test "$with_system_libxml" = "auto"; then
9662     case "$_os" in
9663     WINNT|iOS|Android)
9664         with_system_libxml="$with_system_libs"
9665         ;;
9666     Emscripten)
9667         with_system_libxml=no
9668         ;;
9669     *)
9670         if test "$enable_fuzzers" != "yes"; then
9671             with_system_libxml=yes
9672         else
9673             with_system_libxml=no
9674         fi
9675         ;;
9676     esac
9679 AC_MSG_CHECKING([which libxslt to use])
9680 if test "$with_system_libxml" = "yes"; then
9681     AC_MSG_RESULT([external])
9682     SYSTEM_LIBXSLT=TRUE
9683     if test "$_os" = "Darwin"; then
9684         dnl make sure to use SDK path
9685         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9686         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
9687         dnl omit -L/usr/lib
9688         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
9689         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
9690     else
9691         PKG_CHECK_MODULES(LIBXSLT, libxslt)
9692         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9693         FilterLibs "${LIBXSLT_LIBS}"
9694         LIBXSLT_LIBS="${filteredlibs}"
9695         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
9696         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9697         FilterLibs "${LIBEXSLT_LIBS}"
9698         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
9699     fi
9701     dnl Check for xsltproc
9702     AC_PATH_PROG(XSLTPROC, xsltproc, no)
9703     if test "$XSLTPROC" = "no"; then
9704         AC_MSG_ERROR([xsltproc is required])
9705     fi
9706 else
9707     AC_MSG_RESULT([internal])
9708     SYSTEM_LIBXSLT=
9709     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
9711 AC_SUBST(SYSTEM_LIBXSLT)
9712 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
9713     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
9715 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
9717 AC_SUBST(LIBEXSLT_CFLAGS)
9718 AC_SUBST(LIBEXSLT_LIBS)
9719 AC_SUBST(LIBXSLT_CFLAGS)
9720 AC_SUBST(LIBXSLT_LIBS)
9721 AC_SUBST(XSLTPROC)
9723 # ===================================================================
9724 # Check for system libxml
9725 # ===================================================================
9726 AC_MSG_CHECKING([which libxml to use])
9727 if test "$with_system_libxml" = "yes"; then
9728     AC_MSG_RESULT([external])
9729     SYSTEM_LIBXML=TRUE
9730     if test "$_os" = "Darwin"; then
9731         dnl make sure to use SDK path
9732         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9733         dnl omit -L/usr/lib
9734         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
9735     elif test $_os = iOS; then
9736         dnl make sure to use SDK path
9737         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
9738         LIBXML_CFLAGS="-I$usr/include/libxml2"
9739         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
9740     else
9741         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
9742         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9743         FilterLibs "${LIBXML_LIBS}"
9744         LIBXML_LIBS="${filteredlibs}"
9745     fi
9747     dnl Check for xmllint
9748     AC_PATH_PROG(XMLLINT, xmllint, no)
9749     if test "$XMLLINT" = "no"; then
9750         AC_MSG_ERROR([xmllint is required])
9751     fi
9752 else
9753     AC_MSG_RESULT([internal])
9754     SYSTEM_LIBXML=
9755     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
9756     if test "$COM" = "MSC"; then
9757         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9758     fi
9759     if test "$COM" = "MSC"; then
9760         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
9761     else
9762         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
9763         if test "$DISABLE_DYNLOADING" = TRUE; then
9764             LIBXML_LIBS="$LIBXML_LIBS -lm"
9765         fi
9766     fi
9767     BUILD_TYPE="$BUILD_TYPE LIBXML2"
9769 AC_SUBST(SYSTEM_LIBXML)
9770 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
9771     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
9773 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
9774 AC_SUBST(LIBXML_CFLAGS)
9775 AC_SUBST(LIBXML_LIBS)
9776 AC_SUBST(XMLLINT)
9778 # =====================================================================
9779 # Checking for a Python interpreter with version >= 3.3.
9780 # Optionally user can pass an option to configure, i. e.
9781 # ./configure PYTHON=/usr/bin/python
9782 # =====================================================================
9783 if test $_os = Darwin -a "$enable_python" != no -a "$enable_python" != fully-internal -a "$enable_python" != internal -a "$enable_python" != system; then
9784     # Only allowed choices for macOS are 'no', 'internal' (default), and 'fully-internal'
9785     # unless PYTHON is defined as above which allows 'system'
9786     enable_python=internal
9788 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
9789     if test -n "$PYTHON"; then
9790         PYTHON_FOR_BUILD=$PYTHON
9791     else
9792         # This allows a lack of system python with no error, we use internal one in that case.
9793         AM_PATH_PYTHON([3.3],, [:])
9794         # Clean PYTHON_VERSION checked below if cross-compiling
9795         PYTHON_VERSION=""
9796         if test "$PYTHON" != ":"; then
9797             PYTHON_FOR_BUILD=$PYTHON
9798         fi
9799     fi
9802 # Checks for Python to use for Pyuno
9803 AC_MSG_CHECKING([which Python to use for Pyuno])
9804 case "$enable_python" in
9805 no|disable)
9806     if test -z "$PYTHON_FOR_BUILD" -a "$cross_compiling" != yes; then
9807         # Python is required to build LibreOffice. In theory we could separate the build-time Python
9808         # requirement from the choice whether to include Python stuff in the installer, but why
9809         # bother?
9810         AC_MSG_ERROR([Python is required at build time.])
9811     fi
9812     enable_python=no
9813     AC_MSG_RESULT([none])
9814     ;;
9815 ""|yes|auto)
9816     if test "$DISABLE_SCRIPTING" = TRUE; then
9817         if test -z "$PYTHON_FOR_BUILD" -a "$cross_compiling" != yes; then
9818             AC_MSG_ERROR([Python support can't be disabled without cross-compiling or a system python.])
9819         fi
9820         AC_MSG_RESULT([none, overridden by --disable-scripting])
9821         enable_python=no
9822     elif test $build_os = cygwin; then
9823         dnl When building on Windows we don't attempt to use any installed
9824         dnl "system"  Python.
9825         AC_MSG_RESULT([fully internal])
9826         enable_python=internal
9827     elif test "$cross_compiling" = yes; then
9828         AC_MSG_RESULT([system])
9829         enable_python=system
9830     else
9831         # Unset variables set by the above AM_PATH_PYTHON so that
9832         # we actually do check anew.
9833         AC_MSG_RESULT([])
9834         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
9835         AM_PATH_PYTHON([3.3],, [:])
9836         AC_MSG_CHECKING([which Python to use for Pyuno])
9837         if test "$PYTHON" = ":"; then
9838             if test -z "$PYTHON_FOR_BUILD"; then
9839                 AC_MSG_RESULT([fully internal])
9840             else
9841                 AC_MSG_RESULT([internal])
9842             fi
9843             enable_python=internal
9844         else
9845             AC_MSG_RESULT([system])
9846             enable_python=system
9847         fi
9848     fi
9849     ;;
9850 internal)
9851     AC_MSG_RESULT([internal])
9852     ;;
9853 fully-internal)
9854     AC_MSG_RESULT([fully internal])
9855     enable_python=internal
9856     ;;
9857 system)
9858     AC_MSG_RESULT([system])
9859     if test "$_os" = Darwin -a -z "$PYTHON"; then
9860         AC_MSG_ERROR([--enable-python=system doesn't work on macOS because the version provided is obsolete])
9861     fi
9862     ;;
9864     AC_MSG_ERROR([Incorrect --enable-python option])
9865     ;;
9866 esac
9868 if test $enable_python != no; then
9869     BUILD_TYPE="$BUILD_TYPE PYUNO"
9872 if test $enable_python = system; then
9873     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
9874         # Fallback: Accept these in the environment, or as set above
9875         # for MacOSX.
9876         :
9877     elif test "$cross_compiling" != yes; then
9878         # Unset variables set by the above AM_PATH_PYTHON so that
9879         # we actually do check anew.
9880         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
9881         # This causes an error if no python command is found
9882         AM_PATH_PYTHON([3.3])
9883         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
9884         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
9885         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
9886         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
9887         if test -z "$PKG_CONFIG"; then
9888             PYTHON_CFLAGS="-I$python_include"
9889             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
9890         elif $PKG_CONFIG --exists python-$python_version-embed; then
9891             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
9892             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
9893         elif $PKG_CONFIG --exists python-$python_version; then
9894             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
9895             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
9896         else
9897             PYTHON_CFLAGS="-I$python_include"
9898             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
9899         fi
9900         FilterLibs "${PYTHON_LIBS}"
9901         PYTHON_LIBS="${filteredlibs}"
9902     else
9903         dnl How to find out the cross-compilation Python installation path?
9904         AC_MSG_CHECKING([for python version])
9905         AS_IF([test -n "$PYTHON_VERSION"],
9906               [AC_MSG_RESULT([$PYTHON_VERSION])],
9907               [AC_MSG_RESULT([not found])
9908                AC_MSG_ERROR([no usable python found])])
9909         test -n "$PYTHON_CFLAGS" && break
9910     fi
9912     dnl Check if the headers really work
9913     save_CPPFLAGS="$CPPFLAGS"
9914     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
9915     AC_CHECK_HEADER(Python.h)
9916     CPPFLAGS="$save_CPPFLAGS"
9918     # let the PYTHON_FOR_BUILD match the same python installation that
9919     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
9920     # better for PythonTests.
9921     PYTHON_FOR_BUILD=$PYTHON
9924 if test "$with_lxml" != no; then
9925     if test -z "$PYTHON_FOR_BUILD"; then
9926         case $build_os in
9927             cygwin)
9928                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
9929                 ;;
9930             *)
9931                 if test "$cross_compiling" != yes ; then
9932                     BUILD_TYPE="$BUILD_TYPE LXML"
9933                 fi
9934                 ;;
9935         esac
9936     else
9937         AC_MSG_CHECKING([for python lxml])
9938         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
9939             AC_MSG_RESULT([yes])
9940         else
9941             case $build_os in
9942                 cygwin)
9943                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
9944                     ;;
9945                 *)
9946                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
9947                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
9948                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
9949                         else
9950                             BUILD_TYPE="$BUILD_TYPE LXML"
9951                             AC_MSG_RESULT([no, using internal lxml])
9952                         fi
9953                     else
9954                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
9955                     fi
9956                     ;;
9957             esac
9958         fi
9959     fi
9962 if test \( "$cross_compiling" = yes -a -z "$PYTHON_FOR_BUILD" \) -o "$enable_python" = internal; then
9963     SYSTEM_PYTHON=
9964     PYTHON_VERSION_MAJOR=3
9965     PYTHON_VERSION_MINOR=8
9966     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.12
9967     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
9968         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
9969     fi
9970     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
9972     # Embedded Python dies without Home set
9973     if test "$HOME" = ""; then
9974         export HOME=""
9975     fi
9978 dnl By now enable_python should be "system", "internal" or "no"
9979 case $enable_python in
9980 system)
9981     SYSTEM_PYTHON=TRUE
9983     if test "x$ac_cv_header_Python_h" != "xyes"; then
9984        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
9985     fi
9987     AC_LANG_PUSH(C)
9988     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
9989     AC_MSG_CHECKING([for correct python library version])
9990        AC_RUN_IFELSE([AC_LANG_SOURCE([[
9991 #include <Python.h>
9993 int main(int argc, char **argv) {
9994    if ((PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
9995    else return 1;
9997        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3])],[AC_MSG_RESULT([skipped; cross-compiling])])
9998     AC_LANG_POP(C)
10000     dnl FIXME Check if the Python library can be linked with, too?
10001     ;;
10003 internal)
10004     BUILD_TYPE="$BUILD_TYPE PYTHON"
10005     if test "$OS" = LINUX -o "$OS" = WNT ; then
10006         BUILD_TYPE="$BUILD_TYPE LIBFFI"
10007     fi
10008     ;;
10010     DISABLE_PYTHON=TRUE
10011     SYSTEM_PYTHON=
10012     ;;
10014     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
10015     ;;
10016 esac
10018 AC_SUBST(DISABLE_PYTHON)
10019 AC_SUBST(SYSTEM_PYTHON)
10020 AC_SUBST(PYTHON_CFLAGS)
10021 AC_SUBST(PYTHON_FOR_BUILD)
10022 AC_SUBST(PYTHON_LIBS)
10023 AC_SUBST(PYTHON_VERSION)
10024 AC_SUBST(PYTHON_VERSION_MAJOR)
10025 AC_SUBST(PYTHON_VERSION_MINOR)
10027 AC_MSG_CHECKING([whether to build LibreLogo])
10028 case "$enable_python" in
10029 no|disable)
10030     AC_MSG_RESULT([no; Python disabled])
10031     ;;
10033     if test "${enable_librelogo}" = "no"; then
10034         AC_MSG_RESULT([no])
10035     else
10036         AC_MSG_RESULT([yes])
10037         BUILD_TYPE="${BUILD_TYPE} LIBRELOGO"
10038         AC_DEFINE([ENABLE_LIBRELOGO],1)
10039     fi
10040     ;;
10041 esac
10042 AC_SUBST(ENABLE_LIBRELOGO)
10044 ENABLE_MARIADBC=
10045 MARIADBC_MAJOR=1
10046 MARIADBC_MINOR=0
10047 MARIADBC_MICRO=2
10048 AC_MSG_CHECKING([whether to build the MariaDB/MySQL SDBC driver])
10049 if test "x$enable_mariadb_sdbc" != "xno" -a "$enable_mpl_subset" != "yes"; then
10050     ENABLE_MARIADBC=TRUE
10051     AC_MSG_RESULT([yes])
10052     BUILD_TYPE="$BUILD_TYPE MARIADBC"
10053 else
10054     AC_MSG_RESULT([no])
10056 AC_SUBST(ENABLE_MARIADBC)
10057 AC_SUBST(MARIADBC_MAJOR)
10058 AC_SUBST(MARIADBC_MINOR)
10059 AC_SUBST(MARIADBC_MICRO)
10061 if test "$ENABLE_MARIADBC" = "TRUE"; then
10062     dnl ===================================================================
10063     dnl Check for system MariaDB
10064     dnl ===================================================================
10065     AC_MSG_CHECKING([which MariaDB to use])
10066     if test "$with_system_mariadb" = "yes"; then
10067         AC_MSG_RESULT([external])
10068         SYSTEM_MARIADB_CONNECTOR_C=TRUE
10069         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
10070         if test -z "$MARIADBCONFIG"; then
10071             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
10072             if test -z "$MARIADBCONFIG"; then
10073                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
10074                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
10075             fi
10076         fi
10077         AC_MSG_CHECKING([MariaDB version])
10078         MARIADB_VERSION=`$MARIADBCONFIG --version`
10079         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
10080         if test "$MARIADB_MAJOR" -ge "5"; then
10081             AC_MSG_RESULT([OK])
10082         else
10083             AC_MSG_ERROR([too old, use 5.0.x or later])
10084         fi
10085         AC_MSG_CHECKING([for MariaDB Client library])
10086         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
10087         if test "$COM_IS_CLANG" = TRUE; then
10088             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
10089         fi
10090         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
10091         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
10092         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
10093         dnl linux32:
10094         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
10095             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
10096             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
10097                 | sed -e 's|/lib64/|/lib/|')
10098         fi
10099         FilterLibs "${MARIADB_LIBS}"
10100         MARIADB_LIBS="${filteredlibs}"
10101         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
10102         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
10103         if test "$enable_bundle_mariadb" = "yes"; then
10104             AC_MSG_RESULT([yes])
10105             BUNDLE_MARIADB_CONNECTOR_C=TRUE
10106             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
10108 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
10110 /g' | grep -E '(mysqlclient|mariadb)')
10111             if test "$_os" = "Darwin"; then
10112                 LIBMARIADB=${LIBMARIADB}.dylib
10113             elif test "$_os" = "WINNT"; then
10114                 LIBMARIADB=${LIBMARIADB}.dll
10115             else
10116                 LIBMARIADB=${LIBMARIADB}.so
10117             fi
10118             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
10119             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
10120             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
10121                 AC_MSG_RESULT([found.])
10122                 PathFormat "$LIBMARIADB_PATH"
10123                 LIBMARIADB_PATH="$formatted_path"
10124             else
10125                 AC_MSG_ERROR([not found.])
10126             fi
10127         else
10128             AC_MSG_RESULT([no])
10129             BUNDLE_MARIADB_CONNECTOR_C=
10130         fi
10131     else
10132         AC_MSG_RESULT([internal])
10133         SYSTEM_MARIADB_CONNECTOR_C=
10134         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
10135         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
10136         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
10137     fi
10139     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
10140     AC_SUBST(MARIADB_CFLAGS)
10141     AC_SUBST(MARIADB_LIBS)
10142     AC_SUBST(LIBMARIADB)
10143     AC_SUBST(LIBMARIADB_PATH)
10144     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
10147 dnl ===================================================================
10148 dnl Check for system hsqldb
10149 dnl ===================================================================
10150 if test "$with_java" != "no" -a "$cross_compiling" != "yes"; then
10151     HSQLDB_USE_JDBC_4_1=
10152     AC_MSG_CHECKING([which hsqldb to use])
10153     if test "$with_system_hsqldb" = "yes"; then
10154         AC_MSG_RESULT([external])
10155         SYSTEM_HSQLDB=TRUE
10156         if test -z $HSQLDB_JAR; then
10157             HSQLDB_JAR=/usr/share/java/hsqldb.jar
10158         fi
10159         if ! test -f $HSQLDB_JAR; then
10160                AC_MSG_ERROR(hsqldb.jar not found.)
10161         fi
10162         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
10163         export HSQLDB_JAR
10164         if $PERL -e \
10165            'use Archive::Zip;
10166             my $file = "$ENV{'HSQLDB_JAR'}";
10167             my $zip = Archive::Zip->new( $file );
10168             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
10169             if ( $mf =~ m/Specification-Version: 1.8.*/ )
10170             {
10171                 push @l, split(/\n/, $mf);
10172                 foreach my $line (@l)
10173                 {
10174                     if ($line =~ m/Specification-Version:/)
10175                     {
10176                         ($t, $version) = split (/:/,$line);
10177                         $version =~ s/^\s//;
10178                         ($a, $b, $c, $d) = split (/\./,$version);
10179                         if ($c == "0" && $d > "8")
10180                         {
10181                             exit 0;
10182                         }
10183                         else
10184                         {
10185                             exit 1;
10186                         }
10187                     }
10188                 }
10189             }
10190             else
10191             {
10192                 exit 1;
10193             }'; then
10194             AC_MSG_RESULT([yes])
10195         else
10196             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
10197         fi
10198     else
10199         AC_MSG_RESULT([internal])
10200         SYSTEM_HSQLDB=
10201         BUILD_TYPE="$BUILD_TYPE HSQLDB"
10202         NEED_ANT=TRUE
10203         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
10204         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
10205         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
10206             AC_MSG_RESULT([yes])
10207             HSQLDB_USE_JDBC_4_1=TRUE
10208         else
10209             AC_MSG_RESULT([no])
10210         fi
10211     fi
10212 else
10213     if test "$with_java" != "no" -a -z "$HSQLDB_JAR"; then
10214         BUILD_TYPE="$BUILD_TYPE HSQLDB"
10215     fi
10217 AC_SUBST(SYSTEM_HSQLDB)
10218 AC_SUBST(HSQLDB_JAR)
10219 AC_SUBST([HSQLDB_USE_JDBC_4_1])
10221 dnl ===================================================================
10222 dnl Check for PostgreSQL stuff
10223 dnl ===================================================================
10224 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
10225 if test "x$enable_postgresql_sdbc" != "xno"; then
10226     AC_MSG_RESULT([yes])
10227     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
10229     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
10230         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
10231     fi
10232     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
10233         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
10234     fi
10236     postgres_interface=""
10237     if test "$with_system_postgresql" = "yes"; then
10238         postgres_interface="external PostgreSQL"
10239         SYSTEM_POSTGRESQL=TRUE
10240         if test "$_os" = Darwin; then
10241             supp_path=''
10242             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
10243                 pg_supp_path="$P_SEP$d$pg_supp_path"
10244             done
10245         fi
10246         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
10247         if test -n "$PGCONFIG"; then
10248             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
10249             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
10250         else
10251             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
10252               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
10253               POSTGRESQL_LIB=$POSTGRESQL_LIBS
10254             ],[
10255               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
10256             ])
10257         fi
10258         FilterLibs "${POSTGRESQL_LIB}"
10259         POSTGRESQL_LIB="${filteredlibs}"
10260     else
10261         # if/when anything else than PostgreSQL uses Kerberos,
10262         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
10263         WITH_KRB5=
10264         WITH_GSSAPI=
10265         case "$_os" in
10266         Darwin)
10267             # macOS has system MIT Kerberos 5 since 10.4
10268             if test "$with_krb5" != "no"; then
10269                 WITH_KRB5=TRUE
10270                 save_LIBS=$LIBS
10271                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
10272                 # that the libraries where these functions are located on macOS will change, is it?
10273                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10274                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10275                 KRB5_LIBS=$LIBS
10276                 LIBS=$save_LIBS
10277                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10278                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10279                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10280                 LIBS=$save_LIBS
10281             fi
10282             if test "$with_gssapi" != "no"; then
10283                 WITH_GSSAPI=TRUE
10284                 save_LIBS=$LIBS
10285                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10286                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10287                 GSSAPI_LIBS=$LIBS
10288                 LIBS=$save_LIBS
10289             fi
10290             ;;
10291         WINNT)
10292             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
10293                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
10294             fi
10295             ;;
10296         Linux|GNU|*BSD|DragonFly)
10297             if test "$with_krb5" != "no"; then
10298                 WITH_KRB5=TRUE
10299                 save_LIBS=$LIBS
10300                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10301                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10302                 KRB5_LIBS=$LIBS
10303                 LIBS=$save_LIBS
10304                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10305                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10306                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10307                 LIBS=$save_LIBS
10308             fi
10309             if test "$with_gssapi" != "no"; then
10310                 WITH_GSSAPI=TRUE
10311                 save_LIBS=$LIBS
10312                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10313                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10314                 GSSAPI_LIBS=$LIBS
10315                 LIBS=$save_LIBS
10316             fi
10317             ;;
10318         *)
10319             if test "$with_krb5" = "yes"; then
10320                 WITH_KRB5=TRUE
10321                 save_LIBS=$LIBS
10322                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10323                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10324                 KRB5_LIBS=$LIBS
10325                 LIBS=$save_LIBS
10326                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10327                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10328                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10329                 LIBS=$save_LIBS
10330             fi
10331             if test "$with_gssapi" = "yes"; then
10332                 WITH_GSSAPI=TRUE
10333                 save_LIBS=$LIBS
10334                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10335                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10336                 LIBS=$save_LIBS
10337                 GSSAPI_LIBS=$LIBS
10338             fi
10339         esac
10341         if test -n "$with_libpq_path"; then
10342             SYSTEM_POSTGRESQL=TRUE
10343             postgres_interface="external libpq"
10344             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
10345             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
10346         else
10347             SYSTEM_POSTGRESQL=
10348             postgres_interface="internal"
10349             POSTGRESQL_LIB=""
10350             POSTGRESQL_INC="%OVERRIDE_ME%"
10351             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
10352         fi
10353     fi
10355     AC_MSG_CHECKING([PostgreSQL C interface])
10356     AC_MSG_RESULT([$postgres_interface])
10358     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
10359         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
10360         save_CFLAGS=$CFLAGS
10361         save_CPPFLAGS=$CPPFLAGS
10362         save_LIBS=$LIBS
10363         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
10364         LIBS="${LIBS} ${POSTGRESQL_LIB}"
10365         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
10366         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
10367             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
10368         CFLAGS=$save_CFLAGS
10369         CPPFLAGS=$save_CPPFLAGS
10370         LIBS=$save_LIBS
10371     fi
10372     BUILD_POSTGRESQL_SDBC=TRUE
10373 else
10374     AC_MSG_RESULT([no])
10376 AC_SUBST(WITH_KRB5)
10377 AC_SUBST(WITH_GSSAPI)
10378 AC_SUBST(GSSAPI_LIBS)
10379 AC_SUBST(KRB5_LIBS)
10380 AC_SUBST(BUILD_POSTGRESQL_SDBC)
10381 AC_SUBST(SYSTEM_POSTGRESQL)
10382 AC_SUBST(POSTGRESQL_INC)
10383 AC_SUBST(POSTGRESQL_LIB)
10385 dnl ===================================================================
10386 dnl Check for Firebird stuff
10387 dnl ===================================================================
10388 ENABLE_FIREBIRD_SDBC=
10389 if test "$enable_firebird_sdbc" = "yes" ; then
10390     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
10392     dnl ===================================================================
10393     dnl Check for system Firebird
10394     dnl ===================================================================
10395     AC_MSG_CHECKING([which Firebird to use])
10396     if test "$with_system_firebird" = "yes"; then
10397         AC_MSG_RESULT([external])
10398         SYSTEM_FIREBIRD=TRUE
10399         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
10400         if test -z "$FIREBIRDCONFIG"; then
10401             AC_MSG_NOTICE([No fb_config -- using pkg-config])
10402             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
10403                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
10404             ])
10405             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
10406         else
10407             AC_MSG_NOTICE([fb_config found])
10408             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
10409             AC_MSG_CHECKING([for Firebird Client library])
10410             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
10411             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
10412             FilterLibs "${FIREBIRD_LIBS}"
10413             FIREBIRD_LIBS="${filteredlibs}"
10414         fi
10415         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
10416         AC_MSG_CHECKING([Firebird version])
10417         if test -n "${FIREBIRD_VERSION}"; then
10418             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
10419             if test "$FIREBIRD_MAJOR" -ge "3"; then
10420                 AC_MSG_RESULT([OK])
10421             else
10422                 AC_MSG_ERROR([Ensure firebird >= 3 is installed])
10423             fi
10424         else
10425             save_CFLAGS="${CFLAGS}"
10426             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
10427             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
10428 #if defined(FB_API_VER) && FB_API_VER == 30
10429 int fb_api_is_30(void) { return 0; }
10430 #else
10431 #error "Wrong Firebird API version"
10432 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
10433             CFLAGS="$save_CFLAGS"
10434         fi
10435         ENABLE_FIREBIRD_SDBC=TRUE
10436         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10437     elif test "$enable_database_connectivity" = no; then
10438         AC_MSG_RESULT([none])
10439     elif test "$cross_compiling" = "yes"; then
10440         AC_MSG_RESULT([none])
10441     else
10442         dnl Embedded Firebird has version 3.0
10443         dnl We need libatomic_ops for any non X86/X64 system
10444         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
10445             dnl ===================================================================
10446             dnl Check for system libatomic_ops
10447             dnl ===================================================================
10448             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[LIBATOMIC_OPS],[atomic_ops >= 0.7.2])
10449             if test "$with_system_libatomic_ops" = "yes"; then
10450                 SYSTEM_LIBATOMIC_OPS=TRUE
10451                 AC_CHECK_HEADERS(atomic_ops.h, [],
10452                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
10453             else
10454                 SYSTEM_LIBATOMIC_OPS=
10455                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
10456                 LIBATOMIC_OPS_LIBS="-latomic_ops"
10457                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
10458             fi
10459         fi
10461         AC_MSG_RESULT([internal])
10462         SYSTEM_FIREBIRD=
10463         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
10464         FIREBIRD_LIBS="-lfbclient"
10466         if test "$with_system_libtommath" = "yes"; then
10467             SYSTEM_LIBTOMMATH=TRUE
10468             dnl check for tommath presence
10469             save_LIBS=$LIBS
10470             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
10471             AC_CHECK_LIB(tommath, mp_init, LIBTOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
10472             LIBS=$save_LIBS
10473         else
10474             SYSTEM_LIBTOMMATH=
10475             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
10476             LIBTOMMATH_LIBS="-ltommath"
10477             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
10478         fi
10480         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
10481         ENABLE_FIREBIRD_SDBC=TRUE
10482         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10483     fi
10485 AC_SUBST(ENABLE_FIREBIRD_SDBC)
10486 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
10487 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
10488 AC_SUBST(LIBATOMIC_OPS_LIBS)
10489 AC_SUBST(SYSTEM_FIREBIRD)
10490 AC_SUBST(FIREBIRD_CFLAGS)
10491 AC_SUBST(FIREBIRD_LIBS)
10492 AC_SUBST(SYSTEM_LIBTOMMATH)
10493 AC_SUBST(LIBTOMMATH_CFLAGS)
10494 AC_SUBST(LIBTOMMATH_LIBS)
10496 dnl ===================================================================
10497 dnl Check for system curl
10498 dnl ===================================================================
10499 libo_CHECK_SYSTEM_MODULE([curl],[CURL],[libcurl >= 7.68.0],enabled)
10501 dnl ===================================================================
10502 dnl Check for system boost
10503 dnl ===================================================================
10504 AC_MSG_CHECKING([which boost to use])
10505 if test "$with_system_boost" = "yes"; then
10506     AC_MSG_RESULT([external])
10507     SYSTEM_BOOST=TRUE
10508     AX_BOOST_BASE([1.66],,[AC_MSG_ERROR([no suitable Boost found])])
10509     AX_BOOST_DATE_TIME
10510     AX_BOOST_FILESYSTEM
10511     AX_BOOST_IOSTREAMS
10512     AX_BOOST_LOCALE
10513     AC_LANG_PUSH([C++])
10514     save_CXXFLAGS=$CXXFLAGS
10515     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
10516     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
10517        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
10518     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
10519        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
10520     CXXFLAGS=$save_CXXFLAGS
10521     AC_LANG_POP([C++])
10522     # this is in m4/ax_boost_base.m4
10523     FilterLibs "${BOOST_LDFLAGS}"
10524     BOOST_LDFLAGS="${filteredlibs}"
10525 else
10526     AC_MSG_RESULT([internal])
10527     BUILD_TYPE="$BUILD_TYPE BOOST"
10528     SYSTEM_BOOST=
10529     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
10530         # use warning-suppressing wrapper headers
10531         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
10532     else
10533         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
10534     fi
10536 AC_SUBST(SYSTEM_BOOST)
10538 dnl ===================================================================
10539 dnl Check for system mdds
10540 dnl ===================================================================
10541 MDDS_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/mdds/include"
10542 libo_CHECK_SYSTEM_MODULE([mdds],[MDDS],[mdds-2.0 >= 2.0.0])
10544 dnl ===================================================================
10545 dnl Check for system cuckoo
10546 dnl ===================================================================
10547 AC_MSG_CHECKING([which cuckoo to use])
10548 if test "$with_system_cuckoo" = "yes"; then
10549     AC_MSG_RESULT([external])
10550     SYSTEM_CUCKOO=TRUE
10551     AC_LANG_PUSH([C++])
10552     AC_CHECK_HEADER([libcuckoo/cuckoohash_map.hh], [],
10553        [AC_MSG_ERROR([libcuckoo/cuckoohash_map.hh not found. install cuckoo])], [])
10554     AC_LANG_POP([C++])
10555 else
10556     AC_MSG_RESULT([internal])
10557     BUILD_TYPE="$BUILD_TYPE CUCKOO"
10558     SYSTEM_CUCKOO=
10560 AC_SUBST([SYSTEM_CUCKOO])
10562 dnl ===================================================================
10563 dnl Check for system dragonbox
10564 dnl ===================================================================
10565 AC_MSG_CHECKING([which dragonbox to use])
10566 if test "$with_system_dragonbox" = "yes"; then
10567     AC_MSG_RESULT([external])
10568     SYSTEM_DRAGONBOX=TRUE
10569     AC_LANG_PUSH([C++])
10570     save_CPPFLAGS=$CPPFLAGS
10571     # This is where upstream installs to, unfortunately no .pc or so...
10572     DRAGONBOX_CFLAGS=-I/usr/include/dragonbox-1.0.0
10573     CPPFLAGS="$CPPFLAGS $DRAGONBOX_CFLAGS"
10574     AC_CHECK_HEADER([dragonbox/dragonbox.h], [],
10575        [AC_MSG_ERROR([dragonbox/dragonbox.h not found. install dragonbox])], [])
10576     AC_LANG_POP([C++])
10577     CPPFLAGS=$save_CPPFLAGS
10578 else
10579     AC_MSG_RESULT([internal])
10580     BUILD_TYPE="$BUILD_TYPE DRAGONBOX"
10581     SYSTEM_DRAGONBOX=
10583 AC_SUBST([SYSTEM_DRAGONBOX])
10584 AC_SUBST([DRAGONBOX_CFLAGS])
10586 dnl ===================================================================
10587 dnl Check for system libfixmath
10588 dnl ===================================================================
10589 AC_MSG_CHECKING([which libfixmath to use])
10590 if test "$with_system_libfixmath" = "yes"; then
10591     AC_MSG_RESULT([external])
10592     SYSTEM_LIBFIXMATH=TRUE
10593     AC_LANG_PUSH([C++])
10594     AC_CHECK_HEADER([libfixmath/fix16.hpp], [],
10595        [AC_MSG_ERROR([libfixmath/fix16.hpp not found. install libfixmath])], [])
10596     AC_CHECK_LIB([libfixmath], [fix16_mul], [:], [AC_MSG_ERROR(libfixmath lib not found or functional)], [])
10597     AC_LANG_POP([C++])
10598 else
10599     AC_MSG_RESULT([internal])
10600     SYSTEM_LIBFIXMATH=
10602 AC_SUBST([SYSTEM_LIBFIXMATH])
10604 dnl ===================================================================
10605 dnl Check for system glm
10606 dnl ===================================================================
10607 AC_MSG_CHECKING([which glm to use])
10608 if test "$with_system_glm" = "yes"; then
10609     AC_MSG_RESULT([external])
10610     SYSTEM_GLM=TRUE
10611     AC_LANG_PUSH([C++])
10612     AC_CHECK_HEADER([glm/glm.hpp], [],
10613        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
10614     AC_LANG_POP([C++])
10615 else
10616     AC_MSG_RESULT([internal])
10617     BUILD_TYPE="$BUILD_TYPE GLM"
10618     SYSTEM_GLM=
10619     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
10621 AC_SUBST([GLM_CFLAGS])
10622 AC_SUBST([SYSTEM_GLM])
10624 dnl ===================================================================
10625 dnl Check for system odbc
10626 dnl ===================================================================
10627 AC_MSG_CHECKING([which odbc headers to use])
10628 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
10629     AC_MSG_RESULT([external])
10630     SYSTEM_ODBC_HEADERS=TRUE
10632     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
10633         save_CPPFLAGS=$CPPFLAGS
10634         find_winsdk
10635         PathFormat "$winsdktest"
10636         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"
10637         AC_CHECK_HEADER(sqlext.h, [],
10638             [AC_MSG_ERROR(odbc not found. install odbc)],
10639             [#include <windows.h>])
10640         CPPFLAGS=$save_CPPFLAGS
10641     else
10642         AC_CHECK_HEADER(sqlext.h, [],
10643             [AC_MSG_ERROR(odbc not found. install odbc)],[])
10644     fi
10645 elif test "$enable_database_connectivity" = no; then
10646     AC_MSG_RESULT([none])
10647 else
10648     AC_MSG_RESULT([internal])
10649     SYSTEM_ODBC_HEADERS=
10651 AC_SUBST(SYSTEM_ODBC_HEADERS)
10653 dnl ===================================================================
10654 dnl Check for system NSS
10655 dnl ===================================================================
10656 if test "$enable_fuzzers" != "yes" -a "$enable_nss" = "yes"; then
10657     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
10658     AC_DEFINE(HAVE_FEATURE_NSS)
10659     ENABLE_NSS=TRUE
10660 elif test $_os != iOS ; then
10661     with_tls=openssl
10663 AC_SUBST(ENABLE_NSS)
10665 dnl ===================================================================
10666 dnl Enable LDAP support
10667 dnl ===================================================================
10669 if test "$test_openldap" = yes; then
10670     AC_MSG_CHECKING([whether to enable LDAP support])
10671     if test "$enable_ldap" = yes -a \( "$ENABLE_NSS" = TRUE -o "$with_system_openldap" = yes \); then
10672         AC_MSG_RESULT([yes])
10673         ENABLE_LDAP=TRUE
10674     else
10675         if test "$enable_ldap" != "yes"; then
10676             AC_MSG_RESULT([no])
10677         else
10678             AC_MSG_RESULT([no (needs NSS or system openldap)])
10679         fi
10680     fi
10682 dnl ===================================================================
10683 dnl Check for system openldap
10684 dnl ===================================================================
10686     if test "$ENABLE_LDAP" = TRUE; then
10687         AC_MSG_CHECKING([which openldap library to use])
10688         if test "$with_system_openldap" = yes; then
10689             AC_MSG_RESULT([external])
10690             SYSTEM_OPENLDAP=TRUE
10691             AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
10692             AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10693             AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10694         else
10695             AC_MSG_RESULT([internal])
10696             BUILD_TYPE="$BUILD_TYPE OPENLDAP"
10697         fi
10698     fi
10701 AC_SUBST(ENABLE_LDAP)
10702 AC_SUBST(SYSTEM_OPENLDAP)
10704 dnl ===================================================================
10705 dnl Check for TLS/SSL and cryptographic implementation to use
10706 dnl ===================================================================
10707 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
10708 if test -n "$with_tls"; then
10709     case $with_tls in
10710     openssl)
10711         AC_DEFINE(USE_TLS_OPENSSL)
10712         TLS=OPENSSL
10713         AC_MSG_RESULT([$TLS])
10715         if test "$enable_openssl" != "yes"; then
10716             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
10717         fi
10719         # warn that OpenSSL has been selected but not all TLS code has this option
10720         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS])
10721         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS"
10722         ;;
10723     nss)
10724         AC_DEFINE(USE_TLS_NSS)
10725         TLS=NSS
10726         AC_MSG_RESULT([$TLS])
10727         ;;
10728     no)
10729         AC_MSG_RESULT([none])
10730         AC_MSG_WARN([Skipping TLS/SSL])
10731         ;;
10732     *)
10733         AC_MSG_RESULT([])
10734         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
10735 openssl - OpenSSL
10736 nss - Mozilla's Network Security Services (NSS)
10737     ])
10738         ;;
10739     esac
10740 else
10741     # default to using NSS, it results in smaller oox lib
10742     AC_DEFINE(USE_TLS_NSS)
10743     TLS=NSS
10744     AC_MSG_RESULT([$TLS])
10746 AC_SUBST(TLS)
10748 dnl ===================================================================
10749 dnl Check for system sane
10750 dnl ===================================================================
10751 AC_MSG_CHECKING([which sane header to use])
10752 if test "$with_system_sane" = "yes"; then
10753     AC_MSG_RESULT([external])
10754     AC_CHECK_HEADER(sane/sane.h, [],
10755       [AC_MSG_ERROR(sane not found. install sane)], [])
10756 else
10757     AC_MSG_RESULT([internal])
10758     BUILD_TYPE="$BUILD_TYPE SANE"
10761 dnl ===================================================================
10762 dnl Check for system icu
10763 dnl ===================================================================
10764 ICU_MAJOR=70
10765 ICU_MINOR=1
10766 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
10767 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
10768 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
10769 ICU_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
10770 ICU_LIBS_internal="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
10771 libo_CHECK_SYSTEM_MODULE([icu],[ICU],[icu-i18n >= 4.6])
10772 if test "$SYSTEM_ICU" = TRUE; then
10773     AC_LANG_PUSH([C++])
10774     AC_MSG_CHECKING([for unicode/rbbi.h])
10775     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
10776     AC_LANG_POP([C++])
10778     ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
10779     ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
10780     ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
10782     if test "$ICU_MAJOR" -ge 50; then
10783         AC_MSG_NOTICE([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
10784         ICU_MINOR=
10785     fi
10787     if test "$CROSS_COMPILING" != TRUE; then
10788         # using the system icu tools can lead to version confusion, use the
10789         # ones from the build environment when cross-compiling
10790         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
10791         if test -z "$SYSTEM_GENBRK"; then
10792             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
10793         fi
10794         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
10795         if test -z "$SYSTEM_GENCCODE"; then
10796             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
10797         fi
10798         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
10799         if test -z "$SYSTEM_GENCMN"; then
10800             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
10801         fi
10802         if test "$ICU_MAJOR" -lt 49; then
10803             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
10804             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
10805             ICU_RECLASSIFIED_HEBREW_LETTER=
10806         fi
10807     fi
10809 if test "$ICU_MAJOR" -ge "59"; then
10810     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
10811     # with -std=c++11 but not all external libraries can be built with that,
10812     # for those use a bit-compatible typedef uint16_t UChar; see
10813     # icu/source/common/unicode/umachine.h
10814     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
10815 else
10816     ICU_UCHAR_TYPE=""
10818 AC_SUBST(SYSTEM_GENBRK)
10819 AC_SUBST(SYSTEM_GENCCODE)
10820 AC_SUBST(SYSTEM_GENCMN)
10821 AC_SUBST(ICU_MAJOR)
10822 AC_SUBST(ICU_MINOR)
10823 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
10824 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
10825 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
10826 AC_SUBST(ICU_UCHAR_TYPE)
10828 dnl ==================================================================
10829 dnl Breakpad
10830 dnl ==================================================================
10831 DEFAULT_CRASHDUMP_VALUE="true"
10832 AC_MSG_CHECKING([whether to enable breakpad])
10833 if test "$enable_breakpad" != yes; then
10834     AC_MSG_RESULT([no])
10835 else
10836     AC_MSG_RESULT([yes])
10837     ENABLE_BREAKPAD="TRUE"
10838     AC_DEFINE(ENABLE_BREAKPAD)
10839     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
10840     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
10842     AC_MSG_CHECKING([for disable crash dump])
10843     if test "$enable_crashdump" = no; then
10844         DEFAULT_CRASHDUMP_VALUE="false"
10845         AC_MSG_RESULT([yes])
10846     else
10847        AC_MSG_RESULT([no])
10848     fi
10850     AC_MSG_CHECKING([for crashreport config])
10851     if test "$with_symbol_config" = "no"; then
10852         BREAKPAD_SYMBOL_CONFIG="invalid"
10853         AC_MSG_RESULT([no])
10854     else
10855         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
10856         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
10857         AC_MSG_RESULT([yes])
10858     fi
10859     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
10861 AC_SUBST(ENABLE_BREAKPAD)
10862 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
10864 dnl ===================================================================
10865 dnl Orcus
10866 dnl ===================================================================
10867 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.17 >= 0.17.2])
10868 if test "$with_system_orcus" != "yes"; then
10869     if test "$SYSTEM_BOOST" = "TRUE"; then
10870         dnl Link with Boost.System
10871         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
10872         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
10873         dnl in documentation has no effect.
10874         AX_BOOST_SYSTEM
10875     fi
10877 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
10878 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
10879 AC_SUBST([BOOST_SYSTEM_LIB])
10880 AC_SUBST(SYSTEM_LIBORCUS)
10882 dnl ===================================================================
10883 dnl HarfBuzz
10884 dnl ===================================================================
10886 GRAPHITE_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"
10887 GRAPHITE_LIBS_internal="-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"
10888 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3])
10890 HARFBUZZ_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/harfbuzz/src"
10891 HARFBUZZ_LIBS_internal="-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"
10892 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42])
10894 if test "$COM" = "MSC"; then # override the above
10895     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
10896     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
10899 if test "$with_system_harfbuzz" = "yes"; then
10900     if test "$with_system_graphite" = "no"; then
10901         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
10902     fi
10903     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
10904     save_LIBS="$LIBS"
10905     save_CFLAGS="$CFLAGS"
10906     LIBS="$LIBS $HARFBUZZ_LIBS"
10907     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
10908     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
10909     LIBS="$save_LIBS"
10910     CFLAGS="$save_CFLAGS"
10911 else
10912     if test "$with_system_graphite" = "yes"; then
10913         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
10914     fi
10917 if test "$USING_X11" = TRUE; then
10918     AC_PATH_X
10919     AC_PATH_XTRA
10920     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
10922     if test -z "$x_includes"; then
10923         x_includes="default_x_includes"
10924     fi
10925     if test -z "$x_libraries"; then
10926         x_libraries="default_x_libraries"
10927     fi
10928     CFLAGS="$CFLAGS $X_CFLAGS"
10929     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
10930     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
10931 else
10932     x_includes="no_x_includes"
10933     x_libraries="no_x_libraries"
10936 if test "$USING_X11" = TRUE; then
10937     dnl ===================================================================
10938     dnl Check for extension headers
10939     dnl ===================================================================
10940     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
10941      [#include <X11/extensions/shape.h>])
10943     # vcl needs ICE and SM
10944     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
10945     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
10946         [AC_MSG_ERROR(ICE library not found)])
10947     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
10948     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
10949         [AC_MSG_ERROR(SM library not found)])
10952 if test "$USING_X11" = TRUE -a "$ENABLE_JAVA" != ""; then
10953     # bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c needs Xt
10954     AC_CHECK_HEADERS(X11/Intrinsic.h,[],[AC_MSG_ERROR([libXt headers not found])])
10957 dnl ===================================================================
10958 dnl Check for system Xrender
10959 dnl ===================================================================
10960 AC_MSG_CHECKING([whether to use Xrender])
10961 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
10962     AC_MSG_RESULT([yes])
10963     PKG_CHECK_MODULES(XRENDER, xrender)
10964     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10965     FilterLibs "${XRENDER_LIBS}"
10966     XRENDER_LIBS="${filteredlibs}"
10967     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
10968       [AC_MSG_ERROR(libXrender not found or functional)], [])
10969     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
10970       [AC_MSG_ERROR(Xrender not found. install X)], [])
10971 else
10972     AC_MSG_RESULT([no])
10974 AC_SUBST(XRENDER_CFLAGS)
10975 AC_SUBST(XRENDER_LIBS)
10977 dnl ===================================================================
10978 dnl Check for XRandr
10979 dnl ===================================================================
10980 AC_MSG_CHECKING([whether to enable RandR support])
10981 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
10982     AC_MSG_RESULT([yes])
10983     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
10984     if test "$ENABLE_RANDR" != "TRUE"; then
10985         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
10986                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
10987         XRANDR_CFLAGS=" "
10988         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
10989           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
10990         XRANDR_LIBS="-lXrandr "
10991         ENABLE_RANDR="TRUE"
10992     fi
10993     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10994     FilterLibs "${XRANDR_LIBS}"
10995     XRANDR_LIBS="${filteredlibs}"
10996 else
10997     ENABLE_RANDR=""
10998     AC_MSG_RESULT([no])
11000 AC_SUBST(XRANDR_CFLAGS)
11001 AC_SUBST(XRANDR_LIBS)
11002 AC_SUBST(ENABLE_RANDR)
11004 if test -z "$with_webdav"; then
11005     with_webdav=$test_webdav
11008 AC_MSG_CHECKING([for WebDAV support])
11009 case "$with_webdav" in
11011     AC_MSG_RESULT([no])
11012     WITH_WEBDAV=""
11013     ;;
11015     AC_MSG_RESULT([yes])
11016     # curl is already mandatory (almost) and checked elsewhere
11017     if test "$enable_curl" = "no"; then
11018         AC_MSG_ERROR(["--with-webdav conflicts with --disable-curl"])
11019     fi
11020     WITH_WEBDAV=TRUE
11021     ;;
11022 esac
11023 AC_SUBST(WITH_WEBDAV)
11025 dnl ===================================================================
11026 dnl Check for disabling cve_tests
11027 dnl ===================================================================
11028 AC_MSG_CHECKING([whether to execute CVE tests])
11029 # If not explicitly enabled or disabled, default
11030 if test -z "$enable_cve_tests"; then
11031     case "$OS" in
11032     WNT)
11033         # Default cves off for Windows with its wild and wonderful
11034         # variety of AV software kicking in and panicking
11035         enable_cve_tests=no
11036         ;;
11037     *)
11038         # otherwise yes
11039         enable_cve_tests=yes
11040         ;;
11041     esac
11043 if test "$enable_cve_tests" = "no"; then
11044     AC_MSG_RESULT([no])
11045     DISABLE_CVE_TESTS=TRUE
11046     AC_SUBST(DISABLE_CVE_TESTS)
11047 else
11048     AC_MSG_RESULT([yes])
11051 dnl ===================================================================
11052 dnl Check for enabling chart XShape tests
11053 dnl ===================================================================
11054 AC_MSG_CHECKING([whether to execute chart XShape tests])
11055 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
11056     AC_MSG_RESULT([yes])
11057     ENABLE_CHART_TESTS=TRUE
11058     AC_SUBST(ENABLE_CHART_TESTS)
11059 else
11060     AC_MSG_RESULT([no])
11063 dnl ===================================================================
11064 dnl Check for system openssl
11065 dnl ===================================================================
11066 ENABLE_OPENSSL=
11067 AC_MSG_CHECKING([whether to disable OpenSSL usage])
11068 if test "$enable_openssl" = "yes"; then
11069     AC_MSG_RESULT([no])
11070     ENABLE_OPENSSL=TRUE
11071     if test "$_os" = Darwin ; then
11072         # OpenSSL is deprecated when building for 10.7 or later.
11073         #
11074         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
11075         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
11077         with_system_openssl=no
11078         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
11079     elif test "$_os" = "FreeBSD" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
11080             && test "$with_system_openssl" != "no"; then
11081         with_system_openssl=yes
11082         SYSTEM_OPENSSL=TRUE
11083         OPENSSL_CFLAGS=
11084         OPENSSL_LIBS="-lssl -lcrypto"
11085     else
11086         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
11087     fi
11088     if test "$with_system_openssl" = "yes"; then
11089         AC_MSG_CHECKING([whether openssl supports SHA512])
11090         AC_LANG_PUSH([C])
11091         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
11092             SHA512_CTX context;
11093 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
11094         AC_LANG_POP(C)
11095     fi
11096 else
11097     AC_MSG_RESULT([yes])
11099     # warn that although OpenSSL is disabled, system libraries may depend on it
11100     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
11101     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
11104 AC_SUBST([ENABLE_OPENSSL])
11106 if test "$enable_cipher_openssl_backend" = yes && test "$ENABLE_OPENSSL" != TRUE; then
11107     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
11108         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
11109         enable_cipher_openssl_backend=no
11110     else
11111         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
11112     fi
11114 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
11115 ENABLE_CIPHER_OPENSSL_BACKEND=
11116 if test "$enable_cipher_openssl_backend" = yes; then
11117     AC_MSG_RESULT([yes])
11118     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
11119 else
11120     AC_MSG_RESULT([no])
11122 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
11124 dnl ===================================================================
11125 dnl Select the crypto backends used by LO
11126 dnl ===================================================================
11128 if test "$build_crypto" = yes; then
11129     if test "$OS" = WNT; then
11130         BUILD_TYPE="$BUILD_TYPE CRYPTO_MSCAPI"
11131         AC_DEFINE([USE_CRYPTO_MSCAPI])
11132     elif test "$ENABLE_NSS" = TRUE; then
11133         BUILD_TYPE="$BUILD_TYPE CRYPTO_NSS"
11134         AC_DEFINE([USE_CRYPTO_NSS])
11135     fi
11138 dnl ===================================================================
11139 dnl Check for system redland
11140 dnl ===================================================================
11141 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
11142 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
11143 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
11144 if test "$with_system_redland" = "yes"; then
11145     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
11146             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
11147 else
11148     RAPTOR_MAJOR="0"
11149     RASQAL_MAJOR="3"
11150     REDLAND_MAJOR="0"
11152 AC_SUBST(RAPTOR_MAJOR)
11153 AC_SUBST(RASQAL_MAJOR)
11154 AC_SUBST(REDLAND_MAJOR)
11156 dnl ===================================================================
11157 dnl Check for system hunspell
11158 dnl ===================================================================
11159 AC_MSG_CHECKING([which libhunspell to use])
11160 if test "$with_system_hunspell" = "yes"; then
11161     AC_MSG_RESULT([external])
11162     SYSTEM_HUNSPELL=TRUE
11163     AC_LANG_PUSH([C++])
11164     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
11165     if test "$HUNSPELL_PC" != "TRUE"; then
11166         AC_CHECK_HEADER(hunspell.hxx, [],
11167             [
11168             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
11169             [AC_MSG_ERROR(hunspell headers not found.)], [])
11170             ], [])
11171         AC_CHECK_LIB([hunspell], [main], [:],
11172            [ AC_MSG_ERROR(hunspell library not found.) ], [])
11173         HUNSPELL_LIBS=-lhunspell
11174     fi
11175     AC_LANG_POP([C++])
11176     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11177     FilterLibs "${HUNSPELL_LIBS}"
11178     HUNSPELL_LIBS="${filteredlibs}"
11179 else
11180     AC_MSG_RESULT([internal])
11181     SYSTEM_HUNSPELL=
11182     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
11183     if test "$COM" = "MSC"; then
11184         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
11185     else
11186         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
11187     fi
11188     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
11190 AC_SUBST(SYSTEM_HUNSPELL)
11191 AC_SUBST(HUNSPELL_CFLAGS)
11192 AC_SUBST(HUNSPELL_LIBS)
11194 dnl ===================================================================
11195 dnl Check for system zxing
11196 dnl ===================================================================
11197 AC_MSG_CHECKING([whether to use zxing])
11198 if test "$enable_zxing" = "no"; then
11199     AC_MSG_RESULT([no])
11200     ENABLE_ZXING=
11201     SYSTEM_ZXING=
11202 else
11203     AC_MSG_RESULT([yes])
11204     ENABLE_ZXING=TRUE
11205     AC_MSG_CHECKING([which libzxing to use])
11206     if test "$with_system_zxing" = "yes"; then
11207         AC_MSG_RESULT([external])
11208         SYSTEM_ZXING=TRUE
11209         AC_LANG_PUSH([C++])
11210         AC_CHECK_HEADER(ZXing/MultiFormatWriter.h, [],
11211             [AC_MSG_ERROR(zxing headers not found.)], [#include <stdexcept>])
11212         ZXING_CFLAGS=-I/usr/include/ZXing
11213         AC_CHECK_LIB([ZXing], [main], [ZXING_LIBS=-lZXing],
11214             [ AC_CHECK_LIB([ZXingCore], [main], [ZXING_LIBS=-lZXingCore],
11215             [ AC_MSG_ERROR(zxing C++ library not found.) ])], [])
11216         AC_LANG_POP([C++])
11217         ZXING_CFLAGS=$(printf '%s' "$ZXING_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11218         FilterLibs "${ZXING_LIBS}"
11219         ZXING_LIBS="${filteredlibs}"
11220     else
11221         AC_MSG_RESULT([internal])
11222         SYSTEM_ZXING=
11223         BUILD_TYPE="$BUILD_TYPE ZXING"
11224     fi
11225     if test "$ENABLE_ZXING" = TRUE; then
11226         AC_DEFINE(ENABLE_ZXING)
11227     fi
11229 AC_SUBST(SYSTEM_ZXING)
11230 AC_SUBST(ENABLE_ZXING)
11231 AC_SUBST(ZXING_CFLAGS)
11232 AC_SUBST(ZXING_LIBS)
11234 dnl ===================================================================
11235 dnl Check for system box2d
11236 dnl ===================================================================
11237 AC_MSG_CHECKING([which box2d to use])
11238 if test "$with_system_box2d" = "yes"; then
11239     AC_MSG_RESULT([external])
11240     SYSTEM_BOX2D=TRUE
11241     AC_LANG_PUSH([C++])
11242     AC_CHECK_HEADER(box2d/box2d.h, [BOX2D_H_FOUND='TRUE'],
11243         [BOX2D_H_FOUND='FALSE'])
11244     if test "$BOX2D_H_FOUND" = "TRUE"; then # 2.4.0+
11245         _BOX2D_LIB=box2d
11246         AC_DEFINE(BOX2D_HEADER,<box2d/box2d.h>)
11247     else
11248         # fail this. there's no other alternative to check when we are here.
11249         AC_CHECK_HEADER([Box2D/Box2D.h], [],
11250             [AC_MSG_ERROR(box2d headers not found.)])
11251         _BOX2D_LIB=Box2D
11252         AC_DEFINE(BOX2D_HEADER,<Box2D/Box2D.h>)
11253     fi
11254     AC_CHECK_LIB([$_BOX2D_LIB], [main], [:],
11255         [ AC_MSG_ERROR(box2d library not found.) ], [])
11256     BOX2D_LIBS=-l$_BOX2D_LIB
11257     AC_LANG_POP([C++])
11258     BOX2D_CFLAGS=$(printf '%s' "$BOX2D_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11259     FilterLibs "${BOX2D_LIBS}"
11260     BOX2D_LIBS="${filteredlibs}"
11261 else
11262     AC_MSG_RESULT([internal])
11263     SYSTEM_BOX2D=
11264     BUILD_TYPE="$BUILD_TYPE BOX2D"
11266 AC_SUBST(SYSTEM_BOX2D)
11267 AC_SUBST(BOX2D_CFLAGS)
11268 AC_SUBST(BOX2D_LIBS)
11270 dnl ===================================================================
11271 dnl Checking for altlinuxhyph
11272 dnl ===================================================================
11273 AC_MSG_CHECKING([which altlinuxhyph to use])
11274 if test "$with_system_altlinuxhyph" = "yes"; then
11275     AC_MSG_RESULT([external])
11276     SYSTEM_HYPH=TRUE
11277     AC_CHECK_HEADER(hyphen.h, [],
11278        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
11279     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
11280        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
11281        [#include <hyphen.h>])
11282     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
11283         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11284     if test -z "$HYPHEN_LIB"; then
11285         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
11286            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11287     fi
11288     if test -z "$HYPHEN_LIB"; then
11289         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
11290            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11291     fi
11292 else
11293     AC_MSG_RESULT([internal])
11294     SYSTEM_HYPH=
11295     BUILD_TYPE="$BUILD_TYPE HYPHEN"
11296     if test "$COM" = "MSC"; then
11297         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
11298     else
11299         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
11300     fi
11302 AC_SUBST(SYSTEM_HYPH)
11303 AC_SUBST(HYPHEN_LIB)
11305 dnl ===================================================================
11306 dnl Checking for mythes
11307 dnl ===================================================================
11308 AC_MSG_CHECKING([which mythes to use])
11309 if test "$with_system_mythes" = "yes"; then
11310     AC_MSG_RESULT([external])
11311     SYSTEM_MYTHES=TRUE
11312     AC_LANG_PUSH([C++])
11313     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
11314     if test "$MYTHES_PKGCONFIG" = "no"; then
11315         AC_CHECK_HEADER(mythes.hxx, [],
11316             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
11317         AC_CHECK_LIB([mythes-1.2], [main], [:],
11318             [ MYTHES_FOUND=no], [])
11319     if test "$MYTHES_FOUND" = "no"; then
11320         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
11321                 [ MYTHES_FOUND=no], [])
11322     fi
11323     if test "$MYTHES_FOUND" = "no"; then
11324         AC_MSG_ERROR([mythes library not found!.])
11325     fi
11326     fi
11327     AC_LANG_POP([C++])
11328     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11329     FilterLibs "${MYTHES_LIBS}"
11330     MYTHES_LIBS="${filteredlibs}"
11331 else
11332     AC_MSG_RESULT([internal])
11333     SYSTEM_MYTHES=
11334     BUILD_TYPE="$BUILD_TYPE MYTHES"
11335     if test "$COM" = "MSC"; then
11336         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
11337     else
11338         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
11339     fi
11341 AC_SUBST(SYSTEM_MYTHES)
11342 AC_SUBST(MYTHES_CFLAGS)
11343 AC_SUBST(MYTHES_LIBS)
11345 dnl ===================================================================
11346 dnl How should we build the linear programming solver ?
11347 dnl ===================================================================
11349 ENABLE_COINMP=
11350 AC_MSG_CHECKING([whether to build with CoinMP])
11351 if test "$enable_coinmp" != "no"; then
11352     ENABLE_COINMP=TRUE
11353     AC_MSG_RESULT([yes])
11354     if test "$with_system_coinmp" = "yes"; then
11355         SYSTEM_COINMP=TRUE
11356         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
11357         FilterLibs "${COINMP_LIBS}"
11358         COINMP_LIBS="${filteredlibs}"
11359     else
11360         BUILD_TYPE="$BUILD_TYPE COINMP"
11361     fi
11362 else
11363     AC_MSG_RESULT([no])
11365 AC_SUBST(ENABLE_COINMP)
11366 AC_SUBST(SYSTEM_COINMP)
11367 AC_SUBST(COINMP_CFLAGS)
11368 AC_SUBST(COINMP_LIBS)
11370 ENABLE_LPSOLVE=
11371 AC_MSG_CHECKING([whether to build with lpsolve])
11372 if test "$enable_lpsolve" != "no"; then
11373     ENABLE_LPSOLVE=TRUE
11374     AC_MSG_RESULT([yes])
11375 else
11376     AC_MSG_RESULT([no])
11378 AC_SUBST(ENABLE_LPSOLVE)
11380 if test "$ENABLE_LPSOLVE" = TRUE; then
11381     AC_MSG_CHECKING([which lpsolve to use])
11382     if test "$with_system_lpsolve" = "yes"; then
11383         AC_MSG_RESULT([external])
11384         SYSTEM_LPSOLVE=TRUE
11385         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
11386            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
11387         save_LIBS=$LIBS
11388         # some systems need this. Like Ubuntu...
11389         AC_CHECK_LIB(m, floor)
11390         AC_CHECK_LIB(dl, dlopen)
11391         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
11392             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
11393         LIBS=$save_LIBS
11394     else
11395         AC_MSG_RESULT([internal])
11396         SYSTEM_LPSOLVE=
11397         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
11398     fi
11400 AC_SUBST(SYSTEM_LPSOLVE)
11402 dnl ===================================================================
11403 dnl Checking for libexttextcat
11404 dnl ===================================================================
11405 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
11406 if test "$with_system_libexttextcat" = "yes"; then
11407     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
11409 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
11411 dnl ===================================================================
11412 dnl Checking for libnumbertext
11413 dnl ===================================================================
11414 libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.6])
11415 if test "$with_system_libnumbertext" = "yes"; then
11416     SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
11417     SYSTEM_LIBNUMBERTEXT=YES
11418 else
11419     SYSTEM_LIBNUMBERTEXT=
11420     AC_LANG_PUSH([C++])
11421     save_CPPFLAGS=$CPPFLAGS
11422     CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
11423     AC_CHECK_HEADERS([codecvt regex])
11424     AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
11425             [ LIBNUMBERTEXT_CFLAGS=''
11426               AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
11427                            Enable libnumbertext fallback (missing number to number name conversion).])
11428             ])
11429     CPPFLAGS=$save_CPPFLAGS
11430     AC_LANG_POP([C++])
11432 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
11433 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
11434 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
11436 dnl ***************************************
11437 dnl testing libc version for Linux...
11438 dnl ***************************************
11439 if test "$_os" = "Linux"; then
11440     AC_MSG_CHECKING([whether the libc is recent enough])
11441     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
11442     #include <features.h>
11443     #if defined(__GNU_LIBRARY__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1))
11444     #error glibc >= 2.1 is required
11445     #endif
11446     ]])],, [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no, upgrade libc])])
11449 dnl =========================================
11450 dnl Check for uuidgen
11451 dnl =========================================
11452 if test "$_os" = "WINNT"; then
11453     # we must use the uuidgen from the Windows SDK, which will be in the LO_PATH, but isn't in
11454     # the PATH for AC_PATH_PROG. It is already tested above in the WINDOWS_SDK_HOME check.
11455     UUIDGEN=uuidgen.exe
11456     AC_SUBST(UUIDGEN)
11457 else
11458     AC_PATH_PROG([UUIDGEN], [uuidgen])
11459     if test -z "$UUIDGEN"; then
11460         AC_MSG_WARN([uuid is needed for building installation sets])
11461     fi
11464 dnl ***************************************
11465 dnl Checking for bison and flex
11466 dnl ***************************************
11467 AC_PATH_PROG(BISON, bison)
11468 if test -z "$BISON"; then
11469     AC_MSG_ERROR([no bison found in \$PATH, install it])
11470 else
11471     AC_MSG_CHECKING([the bison version])
11472     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
11473     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
11474     dnl Accept newer than 2.0; for --enable-compiler-plugins at least 2.3 is known to be bad and
11475     dnl cause
11476     dnl
11477     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]
11478     dnl   typedef union YYSTYPE
11479     dnl           ~~~~~~^~~~~~~
11480     dnl
11481     dnl while at least 3.4.1 is know to be good:
11482     if test "$COMPILER_PLUGINS" = TRUE; then
11483         if test "$_bison_longver" -lt 2004; then
11484             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.4+ for --enable-compiler-plugins)])
11485         fi
11486     else
11487         if test "$_bison_longver" -lt 2000; then
11488             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
11489         fi
11490     fi
11492 AC_SUBST([BISON])
11494 AC_PATH_PROG(FLEX, flex)
11495 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11496     FLEX=`cygpath -m $FLEX`
11498 if test -z "$FLEX"; then
11499     AC_MSG_ERROR([no flex found in \$PATH, install it])
11500 else
11501     AC_MSG_CHECKING([the flex version])
11502     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
11503     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
11504         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
11505     fi
11507 AC_SUBST([FLEX])
11509 AC_PATH_PROG(DIFF, diff)
11510 if test -z "$DIFF"; then
11511     AC_MSG_ERROR(["diff" not found in \$PATH, install it])
11513 AC_SUBST([DIFF])
11515 AC_PATH_PROG(UNIQ, uniq)
11516 if test -z "$UNIQ"; then
11517     AC_MSG_ERROR(["uniq" not found in \$PATH, install it])
11519 AC_SUBST([UNIQ])
11521 dnl ***************************************
11522 dnl Checking for patch
11523 dnl ***************************************
11524 AC_PATH_PROG(PATCH, patch)
11525 if test -z "$PATCH"; then
11526     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
11529 dnl On Solaris or macOS, check if --with-gnu-patch was used
11530 if test "$_os" = "SunOS" -o "$_os" = "Darwin"; then
11531     if test -z "$with_gnu_patch"; then
11532         GNUPATCH=$PATCH
11533     else
11534         if test -x "$with_gnu_patch"; then
11535             GNUPATCH=$with_gnu_patch
11536         else
11537             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
11538         fi
11539     fi
11541     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
11542     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
11543         AC_MSG_RESULT([yes])
11544     else
11545         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
11546     fi
11547 else
11548     GNUPATCH=$PATCH
11551 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11552     GNUPATCH=`cygpath -m $GNUPATCH`
11555 dnl We also need to check for --with-gnu-cp
11557 if test -z "$with_gnu_cp"; then
11558     # check the place where the good stuff is hidden on Solaris...
11559     if test -x /usr/gnu/bin/cp; then
11560         GNUCP=/usr/gnu/bin/cp
11561     else
11562         AC_PATH_PROGS(GNUCP, gnucp cp)
11563     fi
11564     if test -z $GNUCP; then
11565         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
11566     fi
11567 else
11568     if test -x "$with_gnu_cp"; then
11569         GNUCP=$with_gnu_cp
11570     else
11571         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
11572     fi
11575 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11576     GNUCP=`cygpath -m $GNUCP`
11579 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
11580 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
11581     AC_MSG_RESULT([yes])
11582 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
11583     AC_MSG_RESULT([yes])
11584 else
11585     case "$build_os" in
11586     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
11587         x_GNUCP=[\#]
11588         GNUCP=''
11589         AC_MSG_RESULT([no gnucp found - using the system's cp command])
11590         ;;
11591     *)
11592         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
11593         ;;
11594     esac
11597 AC_SUBST(GNUPATCH)
11598 AC_SUBST(GNUCP)
11599 AC_SUBST(x_GNUCP)
11601 dnl ***************************************
11602 dnl testing assembler path
11603 dnl ***************************************
11604 ML_EXE=""
11605 if test "$_os" = "WINNT"; then
11606     case "$WIN_HOST_ARCH" in
11607     x86) assembler=ml.exe ;;
11608     x64) assembler=ml64.exe ;;
11609     arm64) assembler=armasm64.exe ;;
11610     esac
11612     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
11613     if test -f "$MSVC_HOST_PATH/$assembler"; then
11614         ML_EXE=`win_short_path_for_make "$MSVC_HOST_PATH/$assembler"`
11615         AC_MSG_RESULT([$ML_EXE])
11616     else
11617         AC_MSG_ERROR([not found in $MSVC_HOST_PATH])
11618     fi
11621 AC_SUBST(ML_EXE)
11623 dnl ===================================================================
11624 dnl We need zip and unzip
11625 dnl ===================================================================
11626 AC_PATH_PROG(ZIP, zip)
11627 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
11628 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
11629     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],,)
11632 AC_PATH_PROG(UNZIP, unzip)
11633 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
11635 dnl ===================================================================
11636 dnl Zip must be a specific type for different build types.
11637 dnl ===================================================================
11638 if test $build_os = cygwin; then
11639     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
11640         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
11641     fi
11644 dnl ===================================================================
11645 dnl We need touch with -h option support.
11646 dnl ===================================================================
11647 AC_PATH_PROG(TOUCH, touch)
11648 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
11649 touch "$WARNINGS_FILE"
11650 if ! "$TOUCH" -h "$WARNINGS_FILE" 2>/dev/null > /dev/null; then
11651     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],,)
11654 dnl ===================================================================
11655 dnl Check for system epoxy
11656 dnl ===================================================================
11657 EPOXY_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/epoxy/include"
11658 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2])
11660 dnl ===================================================================
11661 dnl Set vcl option: coordinate device in double or sal_Int32
11662 dnl ===================================================================
11664 dnl disabled for now, we don't want subtle differences between OSs
11665 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
11666 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
11667 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
11668 dnl     AC_MSG_RESULT([double])
11669 dnl else
11670 dnl     AC_MSG_RESULT([sal_Int32])
11671 dnl fi
11673 dnl ===================================================================
11674 dnl Show which vclplugs will be built.
11675 dnl ===================================================================
11676 R=""
11678 libo_ENABLE_VCLPLUG([gen])
11679 libo_ENABLE_VCLPLUG([gtk3])
11680 libo_ENABLE_VCLPLUG([gtk3_kde5])
11681 libo_ENABLE_VCLPLUG([gtk4])
11682 libo_ENABLE_VCLPLUG([kf5])
11683 libo_ENABLE_VCLPLUG([qt5])
11684 libo_ENABLE_VCLPLUG([qt6])
11686 if test "$_os" = "WINNT"; then
11687     R="$R win"
11688 elif test "$_os" = "Darwin"; then
11689     R="$R osx"
11690 elif test "$_os" = "iOS"; then
11691     R="ios"
11692 elif test "$_os" = Android; then
11693     R="android"
11696 build_vcl_plugins="$R"
11697 if test -z "$build_vcl_plugins"; then
11698     build_vcl_plugins=" none"
11700 AC_MSG_NOTICE([VCLplugs to be built:${build_vcl_plugins}])
11701 VCL_PLUGIN_INFO=$R
11702 AC_SUBST([VCL_PLUGIN_INFO])
11704 if test "$DISABLE_DYNLOADING" = TRUE -a -z "$DISABLE_GUI" -a \( -z "$R" -o $(echo "$R" | wc -w) -ne 1 \); then
11705     AC_MSG_ERROR([Can't build --disable-dynamic-loading without --disable-gui and a single VCL plugin"])
11708 dnl ===================================================================
11709 dnl Check for GTK libraries
11710 dnl ===================================================================
11712 GTK3_CFLAGS=""
11713 GTK3_LIBS=""
11714 if test "$test_gtk3" = yes -a "x$enable_gtk3" = "xyes" -o "x$enable_gtk3_kde5" = "xyes"; then
11715     if test "$with_system_cairo" = no; then
11716         add_warning 'Non-system cairo combined with gtk3 is assumed to cause trouble; proceed at your own risk.'
11717     fi
11718     : ${with_system_cairo:=yes}
11719     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)
11720     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11721     GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
11722     FilterLibs "${GTK3_LIBS}"
11723     GTK3_LIBS="${filteredlibs}"
11725     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
11726     if test "$with_system_epoxy" != "yes"; then
11727         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
11728         AC_CHECK_HEADER(EGL/eglplatform.h, [],
11729                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
11730     fi
11732 AC_SUBST(GTK3_LIBS)
11733 AC_SUBST(GTK3_CFLAGS)
11735 GTK4_CFLAGS=""
11736 GTK4_LIBS=""
11737 if test "$test_gtk4" = yes -a "x$enable_gtk4" = "xyes"; then
11738     if test "$with_system_cairo" = no; then
11739         add_warning 'Non-system cairo combined with gtk4 is assumed to cause trouble; proceed at your own risk.'
11740     fi
11741     : ${with_system_cairo:=yes}
11742     PKG_CHECK_MODULES(GTK4, gtk4 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo atk)
11743     GTK4_CFLAGS=$(printf '%s' "$GTK4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11744     GTK4_CFLAGS="$GTK4_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
11745     FilterLibs "${GTK4_LIBS}"
11746     GTK4_LIBS="${filteredlibs}"
11748     dnl We require egl only for the gtk4 plugin. Otherwise we use glx.
11749     if test "$with_system_epoxy" != "yes"; then
11750         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
11751         AC_CHECK_HEADER(EGL/eglplatform.h, [],
11752                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
11753     fi
11755 AC_SUBST(GTK4_LIBS)
11756 AC_SUBST(GTK4_CFLAGS)
11758 if test "$enable_introspection" = yes; then
11759     if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
11760         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
11761     else
11762         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
11763     fi
11766 dnl ===================================================================
11767 dnl check for dbus support
11768 dnl ===================================================================
11769 ENABLE_DBUS=""
11770 DBUS_CFLAGS=""
11771 DBUS_LIBS=""
11772 DBUS_GLIB_CFLAGS=""
11773 DBUS_GLIB_LIBS=""
11774 DBUS_HAVE_GLIB=""
11776 if test "$enable_dbus" = "no"; then
11777     test_dbus=no
11780 AC_MSG_CHECKING([whether to enable DBUS support])
11781 if test "$test_dbus" = "yes"; then
11782     ENABLE_DBUS="TRUE"
11783     AC_MSG_RESULT([yes])
11784     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
11785     AC_DEFINE(ENABLE_DBUS)
11786     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11787     FilterLibs "${DBUS_LIBS}"
11788     DBUS_LIBS="${filteredlibs}"
11790     # Glib is needed for BluetoothServer
11791     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
11792     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
11793         [
11794             DBUS_HAVE_GLIB="TRUE"
11795             AC_DEFINE(DBUS_HAVE_GLIB,1)
11796         ],
11797         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
11798     )
11799 else
11800     AC_MSG_RESULT([no])
11803 AC_SUBST(ENABLE_DBUS)
11804 AC_SUBST(DBUS_CFLAGS)
11805 AC_SUBST(DBUS_LIBS)
11806 AC_SUBST(DBUS_GLIB_CFLAGS)
11807 AC_SUBST(DBUS_GLIB_LIBS)
11808 AC_SUBST(DBUS_HAVE_GLIB)
11810 AC_MSG_CHECKING([whether to enable Impress remote control])
11811 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
11812     AC_MSG_RESULT([yes])
11813     ENABLE_SDREMOTE=TRUE
11814     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
11816     if test $OS = MACOSX && test "$MACOSX_SDK_VERSION" -ge 101500; then
11817         # The Bluetooth code doesn't compile with macOS SDK 10.15
11818         if test "$enable_sdremote_bluetooth" = yes; then
11819             AC_MSG_ERROR([macOS SDK $macosx_sdk does not currently support --enable-sdremote-bluetooth])
11820         fi
11821         enable_sdremote_bluetooth=no
11822     fi
11823     # If not explicitly enabled or disabled, default
11824     if test -z "$enable_sdremote_bluetooth"; then
11825         case "$OS" in
11826         LINUX|MACOSX|WNT)
11827             # Default to yes for these
11828             enable_sdremote_bluetooth=yes
11829             ;;
11830         *)
11831             # otherwise no
11832             enable_sdremote_bluetooth=no
11833             ;;
11834         esac
11835     fi
11836     # $enable_sdremote_bluetooth is guaranteed non-empty now
11838     if test "$enable_sdremote_bluetooth" != "no"; then
11839         if test "$OS" = "LINUX"; then
11840             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
11841                 AC_MSG_RESULT([yes])
11842                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
11843                 dnl ===================================================================
11844                 dnl Check for system bluez
11845                 dnl ===================================================================
11846                 AC_MSG_CHECKING([which Bluetooth header to use])
11847                 if test "$with_system_bluez" = "yes"; then
11848                     AC_MSG_RESULT([external])
11849                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
11850                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
11851                     SYSTEM_BLUEZ=TRUE
11852                 else
11853                     AC_MSG_RESULT([internal])
11854                     SYSTEM_BLUEZ=
11855                 fi
11856             else
11857                 AC_MSG_RESULT([no, dbus disabled])
11858                 ENABLE_SDREMOTE_BLUETOOTH=
11859                 SYSTEM_BLUEZ=
11860             fi
11861         else
11862             AC_MSG_RESULT([yes])
11863             ENABLE_SDREMOTE_BLUETOOTH=TRUE
11864             SYSTEM_BLUEZ=
11865         fi
11866     else
11867         AC_MSG_RESULT([no])
11868         ENABLE_SDREMOTE_BLUETOOTH=
11869         SYSTEM_BLUEZ=
11870     fi
11871 else
11872     ENABLE_SDREMOTE=
11873     SYSTEM_BLUEZ=
11874     AC_MSG_RESULT([no])
11876 AC_SUBST(ENABLE_SDREMOTE)
11877 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
11878 AC_SUBST(SYSTEM_BLUEZ)
11880 dnl ===================================================================
11881 dnl Check whether to enable GIO support
11882 dnl ===================================================================
11883 if test "$ENABLE_GTK4" = "TRUE" -o "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
11884     AC_MSG_CHECKING([whether to enable GIO support])
11885     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
11886         dnl Need at least 2.26 for the dbus support.
11887         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
11888                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
11889         if test "$ENABLE_GIO" = "TRUE"; then
11890             AC_DEFINE(ENABLE_GIO)
11891             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11892             FilterLibs "${GIO_LIBS}"
11893             GIO_LIBS="${filteredlibs}"
11894         fi
11895     else
11896         AC_MSG_RESULT([no])
11897     fi
11899 AC_SUBST(ENABLE_GIO)
11900 AC_SUBST(GIO_CFLAGS)
11901 AC_SUBST(GIO_LIBS)
11904 dnl ===================================================================
11906 SPLIT_APP_MODULES=""
11907 if test "$enable_split_app_modules" = "yes"; then
11908     SPLIT_APP_MODULES="TRUE"
11910 AC_SUBST(SPLIT_APP_MODULES)
11912 SPLIT_OPT_FEATURES=""
11913 if test "$enable_split_opt_features" = "yes"; then
11914     SPLIT_OPT_FEATURES="TRUE"
11916 AC_SUBST(SPLIT_OPT_FEATURES)
11918 dnl ===================================================================
11919 dnl Check whether the GStreamer libraries are available.
11920 dnl ===================================================================
11922 ENABLE_GSTREAMER_1_0=""
11924 if test "$test_gstreamer_1_0" = yes; then
11926     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
11927     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
11928         ENABLE_GSTREAMER_1_0="TRUE"
11929         AC_MSG_RESULT([yes])
11930         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
11931         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11932         FilterLibs "${GSTREAMER_1_0_LIBS}"
11933         GSTREAMER_1_0_LIBS="${filteredlibs}"
11934         AC_DEFINE(ENABLE_GSTREAMER_1_0)
11935     else
11936         AC_MSG_RESULT([no])
11937     fi
11939 AC_SUBST(GSTREAMER_1_0_CFLAGS)
11940 AC_SUBST(GSTREAMER_1_0_LIBS)
11941 AC_SUBST(ENABLE_GSTREAMER_1_0)
11943 ENABLE_OPENGL_TRANSITIONS=
11944 ENABLE_OPENGL_CANVAS=
11945 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
11946    : # disable
11947 elif test "$_os" = "Darwin"; then
11948     # We use frameworks on macOS, no need for detail checks
11949     ENABLE_OPENGL_TRANSITIONS=TRUE
11950     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11951     ENABLE_OPENGL_CANVAS=TRUE
11952 elif test $_os = WINNT; then
11953     ENABLE_OPENGL_TRANSITIONS=TRUE
11954     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11955     ENABLE_OPENGL_CANVAS=TRUE
11956 else
11957     if test "$USING_X11" = TRUE; then
11958         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
11959         ENABLE_OPENGL_TRANSITIONS=TRUE
11960         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11961         ENABLE_OPENGL_CANVAS=TRUE
11962     fi
11965 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
11966 AC_SUBST(ENABLE_OPENGL_CANVAS)
11968 dnl =================================================
11969 dnl Check whether to build with OpenCL support.
11970 dnl =================================================
11972 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE" -a "$enable_opencl" = "yes"; then
11973     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
11974     # platform (optional at run-time, used through clew).
11975     BUILD_TYPE="$BUILD_TYPE OPENCL"
11976     AC_DEFINE(HAVE_FEATURE_OPENCL)
11979 dnl =================================================
11980 dnl Check whether to build with dconf support.
11981 dnl =================================================
11983 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
11984     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
11985         if test "$enable_dconf" = yes; then
11986             AC_MSG_ERROR([dconf not found])
11987         else
11988             enable_dconf=no
11989         fi])
11991 AC_MSG_CHECKING([whether to enable dconf])
11992 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
11993     DCONF_CFLAGS=
11994     DCONF_LIBS=
11995     ENABLE_DCONF=
11996     AC_MSG_RESULT([no])
11997 else
11998     ENABLE_DCONF=TRUE
11999     AC_DEFINE(ENABLE_DCONF)
12000     AC_MSG_RESULT([yes])
12002 AC_SUBST([DCONF_CFLAGS])
12003 AC_SUBST([DCONF_LIBS])
12004 AC_SUBST([ENABLE_DCONF])
12006 # pdf import?
12007 AC_MSG_CHECKING([whether to build the PDF import feature])
12008 ENABLE_PDFIMPORT=
12009 if test -z "$enable_pdfimport" -o "$enable_pdfimport" = yes; then
12010     AC_MSG_RESULT([yes])
12011     ENABLE_PDFIMPORT=TRUE
12012     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
12013 else
12014     AC_MSG_RESULT([no])
12017 # Pdfium?
12018 AC_MSG_CHECKING([whether to build PDFium])
12019 ENABLE_PDFIUM=
12020 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
12021     AC_MSG_RESULT([yes])
12022     ENABLE_PDFIUM=TRUE
12023     BUILD_TYPE="$BUILD_TYPE PDFIUM"
12024 else
12025     AC_MSG_RESULT([no])
12027 AC_SUBST(ENABLE_PDFIUM)
12029 if test "$ENABLE_PDFIUM" = "TRUE"; then
12030     AC_MSG_CHECKING([which OpenJPEG library to use])
12031     if test "$with_system_openjpeg" = "yes"; then
12032         SYSTEM_OPENJPEG2=TRUE
12033         AC_MSG_RESULT([external])
12034         PKG_CHECK_MODULES( OPENJPEG2, libopenjp2 )
12035         OPENJPEG2_CFLAGS=$(printf '%s' "$OPENJPEG2_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12036         FilterLibs "${OPENJPEG2_LIBS}"
12037         OPENJPEG2_LIBS="${filteredlibs}"
12038     else
12039         SYSTEM_OPENJPEG2=FALSE
12040         AC_MSG_RESULT([internal])
12041     fi
12043     AC_MSG_CHECKING([which Abseil library to use])
12044     if test "$with_system_abseil" = "yes"; then
12045         AC_MSG_RESULT([external])
12046         SYSTEM_ABSEIL=TRUE
12047         AC_LANG_PUSH([C++])
12048         AC_CHECK_HEADER(absl/types/bad_optional_access.h, [],
12049                         [AC_MSG_ERROR(abseil headers not found.)], [])
12050         AC_CHECK_LIB([absl_bad_optional_access], [main], [ABSEIL_LIBS=-labsl_bad_optional_access],
12051                      [AC_MSG_ERROR([libabsl_bad_optional_access library not found.])])
12052         AC_LANG_POP([C++])
12053         ABSEIL_CFLAGS=$(printf '%s' "$ABSEIL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12054         FilterLibs "${ABSEIL_LIBS}"
12055         ABSEIL_LIBS="${filteredlibs}"
12056     else
12057         AC_MSG_RESULT([internal])
12058     fi
12060 AC_SUBST(SYSTEM_OPENJPEG2)
12061 AC_SUBST(SYSTEM_ABSEIL)
12062 AC_SUBST(ABSEIL_CFLAGS)
12063 AC_SUBST(ABSEIL_LIBS)
12065 dnl ===================================================================
12066 dnl Check for poppler
12067 dnl ===================================================================
12068 ENABLE_POPPLER=
12069 AC_MSG_CHECKING([whether to build Poppler])
12070 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" -a $_os != Android \) -o "$enable_poppler" = yes; then
12071     AC_MSG_RESULT([yes])
12072     ENABLE_POPPLER=TRUE
12073     AC_DEFINE(HAVE_FEATURE_POPPLER)
12074 else
12075     AC_MSG_RESULT([no])
12077 AC_SUBST(ENABLE_POPPLER)
12079 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
12080     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
12083 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
12084     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
12087 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
12088     dnl ===================================================================
12089     dnl Check for system poppler
12090     dnl ===================================================================
12091     AC_MSG_CHECKING([which PDF import poppler to use])
12092     if test "$with_system_poppler" = "yes"; then
12093         AC_MSG_RESULT([external])
12094         SYSTEM_POPPLER=TRUE
12095         PKG_CHECK_MODULES(POPPLER,[poppler >= 0.14 poppler-cpp])
12096         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12097         FilterLibs "${POPPLER_LIBS}"
12098         POPPLER_LIBS="${filteredlibs}"
12099     else
12100         AC_MSG_RESULT([internal])
12101         SYSTEM_POPPLER=
12102         BUILD_TYPE="$BUILD_TYPE POPPLER"
12103     fi
12104     AC_DEFINE([ENABLE_PDFIMPORT],1)
12106 AC_SUBST(ENABLE_PDFIMPORT)
12107 AC_SUBST(SYSTEM_POPPLER)
12108 AC_SUBST(POPPLER_CFLAGS)
12109 AC_SUBST(POPPLER_LIBS)
12111 # Skia?
12112 ENABLE_SKIA=
12113 if test "$enable_skia" != "no" -a "$build_skia" = "yes" -a -z "$DISABLE_GUI"; then
12114     # Skia now requires at least freetype2 >= 2.8.1, which is less that what LO requires as system freetype.
12115     if test "$SYSTEM_FREETYPE" = TRUE; then
12116         PKG_CHECK_EXISTS(freetype2 >= 21.0.15, # 21.0.15 = 2.8.1
12117             [skia_freetype_ok=yes],
12118             [skia_freetype_ok=no])
12119     else # internal is ok
12120         skia_freetype_ok=yes
12121     fi
12122     AC_MSG_CHECKING([whether to build Skia])
12123     if test "$skia_freetype_ok" = "yes"; then
12124         if test "$enable_skia" = "debug"; then
12125             AC_MSG_RESULT([yes (debug)])
12126             ENABLE_SKIA_DEBUG=TRUE
12127         else
12128             AC_MSG_RESULT([yes])
12129             ENABLE_SKIA_DEBUG=
12130         fi
12131         ENABLE_SKIA=TRUE
12132         AC_DEFINE(HAVE_FEATURE_SKIA)
12133         BUILD_TYPE="$BUILD_TYPE SKIA"
12135         if test "$OS" = "MACOSX"; then
12136             AC_DEFINE(SK_SUPPORT_GPU,1)
12137             AC_DEFINE(SK_METAL,1)
12138             SKIA_GPU=METAL
12139             AC_SUBST(SKIA_GPU)
12140         else
12141             AC_DEFINE(SK_SUPPORT_GPU,1)
12142             AC_DEFINE(SK_VULKAN,1)
12143             SKIA_GPU=VULKAN
12144             AC_SUBST(SKIA_GPU)
12145         fi
12147         if test -n "$MAC_OS_X_VERSION_MIN_REQUIRED" && test "$MAC_OS_X_VERSION_MIN_REQUIRED" -lt "101200"; then
12148             SKIA_DISABLE_VMA_USE_STL_SHARED_MUTEX=1
12149             AC_SUBST(SKIA_DISABLE_VMA_USE_STL_SHARED_MUTEX)
12150         fi
12151     else
12152         AC_MSG_RESULT([no (freetype too old)])
12153         add_warning "freetype version is too old for Skia library, at least 2.8.1 required, Skia support disabled"
12154     fi
12156 else
12157     AC_MSG_CHECKING([whether to build Skia])
12158     AC_MSG_RESULT([no])
12160 AC_SUBST(ENABLE_SKIA)
12161 AC_SUBST(ENABLE_SKIA_DEBUG)
12163 LO_CLANG_CXXFLAGS_INTRINSICS_SSE2=
12164 LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3=
12165 LO_CLANG_CXXFLAGS_INTRINSICS_SSE41=
12166 LO_CLANG_CXXFLAGS_INTRINSICS_SSE42=
12167 LO_CLANG_CXXFLAGS_INTRINSICS_AVX=
12168 LO_CLANG_CXXFLAGS_INTRINSICS_AVX2=
12169 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512=
12170 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F=
12171 LO_CLANG_CXXFLAGS_INTRINSICS_F16C=
12172 LO_CLANG_CXXFLAGS_INTRINSICS_FMA=
12173 HAVE_LO_CLANG_DLLEXPORTINLINES=
12175 if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE; then
12176     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12177         AC_MSG_CHECKING([for Clang])
12178         AC_MSG_RESULT([$LO_CLANG_CC / $LO_CLANG_CXX])
12179     else
12180         if test "$_os" = "WINNT"; then
12181             AC_MSG_CHECKING([for clang-cl])
12182             if test -x "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"; then
12183                 LO_CLANG_CC=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"`
12184             elif test -n "$PROGRAMFILES" -a -x "$PROGRAMFILES/LLVM/bin/clang-cl.exe"; then
12185                 LO_CLANG_CC=`win_short_path_for_make "$PROGRAMFILES/LLVM/bin/clang-cl.exe"`
12186             elif test -x "c:/Program Files/LLVM/bin/clang-cl.exe"; then
12187                 LO_CLANG_CC=`win_short_path_for_make "c:/Program Files/LLVM/bin/clang-cl.exe"`
12188             fi
12189             if test -n "$LO_CLANG_CC"; then
12190                 dnl explicitly set -m32/-m64
12191                 LO_CLANG_CC="$LO_CLANG_CC -m$WIN_HOST_BITS"
12192                 LO_CLANG_CXX="$LO_CLANG_CC"
12193                 AC_MSG_RESULT([$LO_CLANG_CC])
12194             else
12195                 AC_MSG_RESULT([no])
12196             fi
12198             AC_MSG_CHECKING([the dependency generation prefix (clang.exe -showIncludes)])
12199             echo "#include <stdlib.h>" > conftest.c
12200             LO_CLANG_SHOWINCLUDES_PREFIX=`$LO_CLANG_CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
12201                 grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
12202             rm -f conftest.c conftest.obj
12203             if test -z "$LO_CLANG_SHOWINCLUDES_PREFIX"; then
12204                 AC_MSG_ERROR([cannot determine the -showIncludes prefix])
12205             else
12206                 AC_MSG_RESULT(["$LO_CLANG_SHOWINCLUDES_PREFIX"])
12207             fi
12208         else
12209             AC_CHECK_PROG(LO_CLANG_CC,clang,clang,[])
12210             AC_CHECK_PROG(LO_CLANG_CXX,clang++,clang++,[])
12211         fi
12212     fi
12213     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12214         clang2_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $LO_CLANG_CC -E - | tail -1 | sed 's/ //g'`
12215         clang2_ver=`echo "$clang2_version" | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
12216         if test "$clang2_ver" -lt 50002; then
12217             AC_MSG_WARN(["$clang2_version" is too old or unrecognized, must be at least Clang 5.0.2])
12218             LO_CLANG_CC=
12219             LO_CLANG_CXX=
12220         fi
12221     fi
12222     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX" -a "$_os" = "WINNT"; then
12223         save_CXX="$CXX"
12224         CXX="$LO_CLANG_CXX"
12225         AC_MSG_CHECKING([whether $CXX supports -Zc:dllexportInlines-])
12226         AC_LANG_PUSH([C++])
12227         save_CXXFLAGS=$CXXFLAGS
12228         CXXFLAGS="$CXXFLAGS -Werror -Zc:dllexportInlines-"
12229         AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
12230                 HAVE_LO_CLANG_DLLEXPORTINLINES=TRUE
12231                 AC_MSG_RESULT([yes])
12232             ], [AC_MSG_RESULT([no])])
12233         CXXFLAGS=$save_CXXFLAGS
12234         AC_LANG_POP([C++])
12235         CXX="$save_CXX"
12236         if test -z "$HAVE_LO_CLANG_DLLEXPORTINLINES"; then
12237             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.])
12238         fi
12239     fi
12240     if test -z "$LO_CLANG_CC" -o -z "$LO_CLANG_CXX"; then
12241         # Skia is the default on Windows and Mac, so hard-require Clang.
12242         # Elsewhere it's used just by the 'gen' VCL backend which is rarely used.
12243         if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
12244             AC_MSG_ERROR([Clang compiler not found. The Skia library needs to be built using Clang, or use --disable-skia.])
12245         else
12246             AC_MSG_WARN([Clang compiler not found.])
12247         fi
12248     else
12250         save_CXX="$CXX"
12251         CXX="$LO_CLANG_CXX"
12252         # copy&paste (and adjust) of intrinsics checks, since MSVC's -arch doesn't work well for Clang-cl
12253         flag_sse2=-msse2
12254         flag_ssse3=-mssse3
12255         flag_sse41=-msse4.1
12256         flag_sse42=-msse4.2
12257         flag_avx=-mavx
12258         flag_avx2=-mavx2
12259         flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
12260         flag_avx512f=-mavx512f
12261         flag_f16c=-mf16c
12262         flag_fma=-mfma
12264         AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
12265         AC_LANG_PUSH([C++])
12266         save_CXXFLAGS=$CXXFLAGS
12267         CXXFLAGS="$CXXFLAGS $flag_sse2"
12268         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12269             #include <emmintrin.h>
12270             int main () {
12271                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12272                 c = _mm_xor_si128 (a, b);
12273                 return 0;
12274             }
12275             ])],
12276             [can_compile_sse2=yes],
12277             [can_compile_sse2=no])
12278         AC_LANG_POP([C++])
12279         CXXFLAGS=$save_CXXFLAGS
12280         AC_MSG_RESULT([${can_compile_sse2}])
12281         if test "${can_compile_sse2}" = "yes" ; then
12282             LO_CLANG_CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
12283         fi
12285         AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
12286         AC_LANG_PUSH([C++])
12287         save_CXXFLAGS=$CXXFLAGS
12288         CXXFLAGS="$CXXFLAGS $flag_ssse3"
12289         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12290             #include <tmmintrin.h>
12291             int main () {
12292                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12293                 c = _mm_maddubs_epi16 (a, b);
12294                 return 0;
12295             }
12296             ])],
12297             [can_compile_ssse3=yes],
12298             [can_compile_ssse3=no])
12299         AC_LANG_POP([C++])
12300         CXXFLAGS=$save_CXXFLAGS
12301         AC_MSG_RESULT([${can_compile_ssse3}])
12302         if test "${can_compile_ssse3}" = "yes" ; then
12303             LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
12304         fi
12306         AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
12307         AC_LANG_PUSH([C++])
12308         save_CXXFLAGS=$CXXFLAGS
12309         CXXFLAGS="$CXXFLAGS $flag_sse41"
12310         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12311             #include <smmintrin.h>
12312             int main () {
12313                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12314                 c = _mm_cmpeq_epi64 (a, b);
12315                 return 0;
12316             }
12317             ])],
12318             [can_compile_sse41=yes],
12319             [can_compile_sse41=no])
12320         AC_LANG_POP([C++])
12321         CXXFLAGS=$save_CXXFLAGS
12322         AC_MSG_RESULT([${can_compile_sse41}])
12323         if test "${can_compile_sse41}" = "yes" ; then
12324             LO_CLANG_CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
12325         fi
12327         AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
12328         AC_LANG_PUSH([C++])
12329         save_CXXFLAGS=$CXXFLAGS
12330         CXXFLAGS="$CXXFLAGS $flag_sse42"
12331         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12332             #include <nmmintrin.h>
12333             int main () {
12334                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12335                 c = _mm_cmpgt_epi64 (a, b);
12336                 return 0;
12337             }
12338             ])],
12339             [can_compile_sse42=yes],
12340             [can_compile_sse42=no])
12341         AC_LANG_POP([C++])
12342         CXXFLAGS=$save_CXXFLAGS
12343         AC_MSG_RESULT([${can_compile_sse42}])
12344         if test "${can_compile_sse42}" = "yes" ; then
12345             LO_CLANG_CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
12346         fi
12348         AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
12349         AC_LANG_PUSH([C++])
12350         save_CXXFLAGS=$CXXFLAGS
12351         CXXFLAGS="$CXXFLAGS $flag_avx"
12352         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12353             #include <immintrin.h>
12354             int main () {
12355                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
12356                 c = _mm256_xor_ps(a, b);
12357                 return 0;
12358             }
12359             ])],
12360             [can_compile_avx=yes],
12361             [can_compile_avx=no])
12362         AC_LANG_POP([C++])
12363         CXXFLAGS=$save_CXXFLAGS
12364         AC_MSG_RESULT([${can_compile_avx}])
12365         if test "${can_compile_avx}" = "yes" ; then
12366             LO_CLANG_CXXFLAGS_INTRINSICS_AVX="$flag_avx"
12367         fi
12369         AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
12370         AC_LANG_PUSH([C++])
12371         save_CXXFLAGS=$CXXFLAGS
12372         CXXFLAGS="$CXXFLAGS $flag_avx2"
12373         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12374             #include <immintrin.h>
12375             int main () {
12376                 __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
12377                 c = _mm256_maddubs_epi16(a, b);
12378                 return 0;
12379             }
12380             ])],
12381             [can_compile_avx2=yes],
12382             [can_compile_avx2=no])
12383         AC_LANG_POP([C++])
12384         CXXFLAGS=$save_CXXFLAGS
12385         AC_MSG_RESULT([${can_compile_avx2}])
12386         if test "${can_compile_avx2}" = "yes" ; then
12387             LO_CLANG_CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
12388         fi
12390         AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
12391         AC_LANG_PUSH([C++])
12392         save_CXXFLAGS=$CXXFLAGS
12393         CXXFLAGS="$CXXFLAGS $flag_avx512"
12394         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12395             #include <immintrin.h>
12396             int main () {
12397                 __m512i a = _mm512_loadu_si512(0);
12398                 __m512d v1 = _mm512_load_pd(0);
12399                 // https://gcc.gnu.org/git/?p=gcc.git;a=commit;f=gcc/config/i386/avx512fintrin.h;h=23bce99cbe7016a04e14c2163ed3fe6a5a64f4e2
12400                 __m512d v2 = _mm512_abs_pd(v1);
12401                 return 0;
12402             }
12403             ])],
12404             [can_compile_avx512=yes],
12405             [can_compile_avx512=no])
12406         AC_LANG_POP([C++])
12407         CXXFLAGS=$save_CXXFLAGS
12408         AC_MSG_RESULT([${can_compile_avx512}])
12409         if test "${can_compile_avx512}" = "yes" ; then
12410             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
12411             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F="$flag_avx512f"
12412         fi
12414         AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
12415         AC_LANG_PUSH([C++])
12416         save_CXXFLAGS=$CXXFLAGS
12417         CXXFLAGS="$CXXFLAGS $flag_f16c"
12418         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12419             #include <immintrin.h>
12420             int main () {
12421                 __m128i a = _mm_set1_epi32 (0);
12422                 __m128 c;
12423                 c = _mm_cvtph_ps(a);
12424                 return 0;
12425             }
12426             ])],
12427             [can_compile_f16c=yes],
12428             [can_compile_f16c=no])
12429         AC_LANG_POP([C++])
12430         CXXFLAGS=$save_CXXFLAGS
12431         AC_MSG_RESULT([${can_compile_f16c}])
12432         if test "${can_compile_f16c}" = "yes" ; then
12433             LO_CLANG_CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
12434         fi
12436         AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
12437         AC_LANG_PUSH([C++])
12438         save_CXXFLAGS=$CXXFLAGS
12439         CXXFLAGS="$CXXFLAGS $flag_fma"
12440         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12441             #include <immintrin.h>
12442             int main () {
12443                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
12444                 d = _mm256_fmadd_ps(a, b, c);
12445                 return 0;
12446             }
12447             ])],
12448             [can_compile_fma=yes],
12449             [can_compile_fma=no])
12450         AC_LANG_POP([C++])
12451         CXXFLAGS=$save_CXXFLAGS
12452         AC_MSG_RESULT([${can_compile_fma}])
12453         if test "${can_compile_fma}" = "yes" ; then
12454             LO_CLANG_CXXFLAGS_INTRINSICS_FMA="$flag_fma"
12455         fi
12457         CXX="$save_CXX"
12458     fi
12461 # prefix LO_CLANG_CC/LO_CLANG_CXX with ccache if needed
12463 if test "$CCACHE" != "" -a -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12464     AC_MSG_CHECKING([whether $LO_CLANG_CC is already ccached])
12465     AC_LANG_PUSH([C])
12466     save_CC="$CC"
12467     CC="$LO_CLANG_CC"
12468     save_CFLAGS=$CFLAGS
12469     CFLAGS="$CFLAGS --ccache-skip -O2 -Werror"
12470     dnl an empty program will do, we're checking the compiler flags
12471     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12472                       [use_ccache=yes], [use_ccache=no])
12473     CFLAGS=$save_CFLAGS
12474     CC=$save_CC
12475     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12476         AC_MSG_RESULT([yes])
12477     else
12478         LO_CLANG_CC="$CCACHE $LO_CLANG_CC"
12479         AC_MSG_RESULT([no])
12480     fi
12481     AC_LANG_POP([C])
12483     AC_MSG_CHECKING([whether $LO_CLANG_CXX is already ccached])
12484     AC_LANG_PUSH([C++])
12485     save_CXX="$CXX"
12486     CXX="$LO_CLANG_CXX"
12487     save_CXXFLAGS=$CXXFLAGS
12488     CXXFLAGS="$CXXFLAGS --ccache-skip -O2 -Werror"
12489     dnl an empty program will do, we're checking the compiler flags
12490     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12491                       [use_ccache=yes], [use_ccache=no])
12492     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12493         AC_MSG_RESULT([yes])
12494     else
12495         LO_CLANG_CXX="$CCACHE $LO_CLANG_CXX"
12496         AC_MSG_RESULT([no])
12497     fi
12498     CXXFLAGS=$save_CXXFLAGS
12499     CXX=$save_CXX
12500     AC_LANG_POP([C++])
12503 AC_SUBST(LO_CLANG_CC)
12504 AC_SUBST(LO_CLANG_CXX)
12505 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE2)
12506 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3)
12507 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE41)
12508 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE42)
12509 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX)
12510 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX2)
12511 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512)
12512 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F)
12513 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_F16C)
12514 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_FMA)
12515 AC_SUBST(LO_CLANG_SHOWINCLUDES_PREFIX)
12516 AC_SUBST(CLANG_USE_LD)
12517 AC_SUBST([HAVE_LO_CLANG_DLLEXPORTINLINES])
12519 SYSTEM_GPGMEPP=
12521 AC_MSG_CHECKING([whether to enable gpgmepp])
12522 if test "$enable_gpgmepp" = no; then
12523     AC_MSG_RESULT([no])
12524 elif test "$enable_mpl_subset" = "yes"; then
12525     AC_MSG_RESULT([no (MPL only])
12526 elif test "$enable_fuzzers" = "yes"; then
12527     AC_MSG_RESULT([no (oss-fuzz)])
12528 elif test \( \( "$_os" = "Linux" -o "$_os" = "Darwin" \) -a "$ENABLE_NSS" = TRUE \) -o "$_os" = "WINNT" ; then
12529     AC_MSG_RESULT([yes])
12530     dnl ===================================================================
12531     dnl Check for system gpgme
12532     dnl ===================================================================
12533     AC_MSG_CHECKING([which gpgmepp to use])
12534     if test "$with_system_gpgmepp" = "yes"; then
12535         AC_MSG_RESULT([external])
12536         SYSTEM_GPGMEPP=TRUE
12538         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
12539         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
12540             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp >= 1.14 development package])], [])
12541         # progress_callback is the only func with plain C linkage
12542         # checking for it also filters out older, KDE-dependent libgpgmepp versions
12543         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
12544             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
12545         AC_CHECK_HEADER(gpgme.h, [],
12546             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
12547     else
12548         AC_MSG_RESULT([internal])
12549         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
12551         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
12552         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
12553         if test "$_os" != "WINNT"; then
12554             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
12555             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
12556         fi
12557     fi
12558     ENABLE_GPGMEPP=TRUE
12559     AC_DEFINE([HAVE_FEATURE_GPGME])
12560     AC_PATH_PROG(GPG, gpg)
12561     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
12562     # so let's exclude that manually for the moment
12563     if test -n "$GPG" -a "$_os" != "WINNT"; then
12564         # make sure we not only have a working gpgme, but a full working
12565         # gpg installation to run OpenPGP signature verification
12566         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
12567     fi
12568     if test "$_os" = "Linux"; then
12569       uid=`id -u`
12570       AC_MSG_CHECKING([for /run/user/$uid])
12571       if test -d /run/user/$uid; then
12572         AC_MSG_RESULT([yes])
12573         AC_PATH_PROG(GPGCONF, gpgconf)
12575         # Older versions of gpgconf are not working as expected, since
12576         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
12577         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
12578         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
12579         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
12580         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
12581         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
12582         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
12583           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
12584           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
12585           if $GPGCONF --dump-options > /dev/null ; then
12586             if $GPGCONF --dump-options | grep -q create-socketdir ; then
12587               AC_MSG_RESULT([yes])
12588               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
12589               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
12590             else
12591               AC_MSG_RESULT([no])
12592             fi
12593           else
12594             AC_MSG_RESULT([no. missing or broken gpgconf?])
12595           fi
12596         else
12597           AC_MSG_RESULT([no, $GPGCONF_VERSION])
12598         fi
12599       else
12600         AC_MSG_RESULT([no])
12601      fi
12602    fi
12603 else
12604     AC_MSG_RESULT([no (unsupported OS or missing NSS)])
12606 AC_SUBST(ENABLE_GPGMEPP)
12607 AC_SUBST(SYSTEM_GPGMEPP)
12608 AC_SUBST(GPG_ERROR_CFLAGS)
12609 AC_SUBST(GPG_ERROR_LIBS)
12610 AC_SUBST(LIBASSUAN_CFLAGS)
12611 AC_SUBST(LIBASSUAN_LIBS)
12612 AC_SUBST(GPGMEPP_CFLAGS)
12613 AC_SUBST(GPGMEPP_LIBS)
12615 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
12616 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
12617     AC_MSG_RESULT([yes])
12618     ENABLE_MEDIAWIKI=TRUE
12619     BUILD_TYPE="$BUILD_TYPE XSLTML"
12620     if test  "x$with_java" = "xno"; then
12621         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
12622     fi
12623 else
12624     AC_MSG_RESULT([no])
12625     ENABLE_MEDIAWIKI=
12626     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
12628 AC_SUBST(ENABLE_MEDIAWIKI)
12630 AC_MSG_CHECKING([whether to build the Report Builder])
12631 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12632     AC_MSG_RESULT([yes])
12633     ENABLE_REPORTBUILDER=TRUE
12634     AC_MSG_CHECKING([which jfreereport libs to use])
12635     if test "$with_system_jfreereport" = "yes"; then
12636         SYSTEM_JFREEREPORT=TRUE
12637         AC_MSG_RESULT([external])
12638         if test -z $SAC_JAR; then
12639             SAC_JAR=/usr/share/java/sac.jar
12640         fi
12641         if ! test -f $SAC_JAR; then
12642              AC_MSG_ERROR(sac.jar not found.)
12643         fi
12645         if test -z $LIBXML_JAR; then
12646             if test -f /usr/share/java/libxml-1.0.0.jar; then
12647                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
12648             elif test -f /usr/share/java/libxml.jar; then
12649                 LIBXML_JAR=/usr/share/java/libxml.jar
12650             else
12651                 AC_MSG_ERROR(libxml.jar replacement not found.)
12652             fi
12653         elif ! test -f $LIBXML_JAR; then
12654             AC_MSG_ERROR(libxml.jar not found.)
12655         fi
12657         if test -z $FLUTE_JAR; then
12658             if test -f /usr/share/java/flute-1.3.0.jar; then
12659                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
12660             elif test -f /usr/share/java/flute.jar; then
12661                 FLUTE_JAR=/usr/share/java/flute.jar
12662             else
12663                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
12664             fi
12665         elif ! test -f $FLUTE_JAR; then
12666             AC_MSG_ERROR(flute-1.3.0.jar not found.)
12667         fi
12669         if test -z $JFREEREPORT_JAR; then
12670             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
12671                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
12672             elif test -f /usr/share/java/flow-engine.jar; then
12673                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
12674             else
12675                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
12676             fi
12677         elif ! test -f  $JFREEREPORT_JAR; then
12678                 AC_MSG_ERROR(jfreereport.jar not found.)
12679         fi
12681         if test -z $LIBLAYOUT_JAR; then
12682             if test -f /usr/share/java/liblayout-0.2.9.jar; then
12683                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
12684             elif test -f /usr/share/java/liblayout.jar; then
12685                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
12686             else
12687                 AC_MSG_ERROR(liblayout.jar replacement not found.)
12688             fi
12689         elif ! test -f $LIBLAYOUT_JAR; then
12690                 AC_MSG_ERROR(liblayout.jar not found.)
12691         fi
12693         if test -z $LIBLOADER_JAR; then
12694             if test -f /usr/share/java/libloader-1.0.0.jar; then
12695                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
12696             elif test -f /usr/share/java/libloader.jar; then
12697                 LIBLOADER_JAR=/usr/share/java/libloader.jar
12698             else
12699                 AC_MSG_ERROR(libloader.jar replacement not found.)
12700             fi
12701         elif ! test -f  $LIBLOADER_JAR; then
12702             AC_MSG_ERROR(libloader.jar not found.)
12703         fi
12705         if test -z $LIBFORMULA_JAR; then
12706             if test -f /usr/share/java/libformula-0.2.0.jar; then
12707                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
12708             elif test -f /usr/share/java/libformula.jar; then
12709                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
12710             else
12711                 AC_MSG_ERROR(libformula.jar replacement not found.)
12712             fi
12713         elif ! test -f $LIBFORMULA_JAR; then
12714                 AC_MSG_ERROR(libformula.jar not found.)
12715         fi
12717         if test -z $LIBREPOSITORY_JAR; then
12718             if test -f /usr/share/java/librepository-1.0.0.jar; then
12719                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
12720             elif test -f /usr/share/java/librepository.jar; then
12721                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
12722             else
12723                 AC_MSG_ERROR(librepository.jar replacement not found.)
12724             fi
12725         elif ! test -f $LIBREPOSITORY_JAR; then
12726             AC_MSG_ERROR(librepository.jar not found.)
12727         fi
12729         if test -z $LIBFONTS_JAR; then
12730             if test -f /usr/share/java/libfonts-1.0.0.jar; then
12731                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
12732             elif test -f /usr/share/java/libfonts.jar; then
12733                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
12734             else
12735                 AC_MSG_ERROR(libfonts.jar replacement not found.)
12736             fi
12737         elif ! test -f $LIBFONTS_JAR; then
12738                 AC_MSG_ERROR(libfonts.jar not found.)
12739         fi
12741         if test -z $LIBSERIALIZER_JAR; then
12742             if test -f /usr/share/java/libserializer-1.0.0.jar; then
12743                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
12744             elif test -f /usr/share/java/libserializer.jar; then
12745                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
12746             else
12747                 AC_MSG_ERROR(libserializer.jar replacement not found.)
12748             fi
12749         elif ! test -f $LIBSERIALIZER_JAR; then
12750                 AC_MSG_ERROR(libserializer.jar not found.)
12751         fi
12753         if test -z $LIBBASE_JAR; then
12754             if test -f /usr/share/java/libbase-1.0.0.jar; then
12755                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
12756             elif test -f /usr/share/java/libbase.jar; then
12757                 LIBBASE_JAR=/usr/share/java/libbase.jar
12758             else
12759                 AC_MSG_ERROR(libbase.jar replacement not found.)
12760             fi
12761         elif ! test -f $LIBBASE_JAR; then
12762             AC_MSG_ERROR(libbase.jar not found.)
12763         fi
12765     else
12766         AC_MSG_RESULT([internal])
12767         SYSTEM_JFREEREPORT=
12768         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
12769         NEED_ANT=TRUE
12770     fi
12771 else
12772     AC_MSG_RESULT([no])
12773     ENABLE_REPORTBUILDER=
12774     SYSTEM_JFREEREPORT=
12776 AC_SUBST(ENABLE_REPORTBUILDER)
12777 AC_SUBST(SYSTEM_JFREEREPORT)
12778 AC_SUBST(SAC_JAR)
12779 AC_SUBST(LIBXML_JAR)
12780 AC_SUBST(FLUTE_JAR)
12781 AC_SUBST(JFREEREPORT_JAR)
12782 AC_SUBST(LIBBASE_JAR)
12783 AC_SUBST(LIBLAYOUT_JAR)
12784 AC_SUBST(LIBLOADER_JAR)
12785 AC_SUBST(LIBFORMULA_JAR)
12786 AC_SUBST(LIBREPOSITORY_JAR)
12787 AC_SUBST(LIBFONTS_JAR)
12788 AC_SUBST(LIBSERIALIZER_JAR)
12790 # scripting provider for BeanShell?
12791 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
12792 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
12793     AC_MSG_RESULT([yes])
12794     ENABLE_SCRIPTING_BEANSHELL=TRUE
12796     dnl ===================================================================
12797     dnl Check for system beanshell
12798     dnl ===================================================================
12799     AC_MSG_CHECKING([which beanshell to use])
12800     if test "$with_system_beanshell" = "yes"; then
12801         AC_MSG_RESULT([external])
12802         SYSTEM_BSH=TRUE
12803         if test -z $BSH_JAR; then
12804             BSH_JAR=/usr/share/java/bsh.jar
12805         fi
12806         if ! test -f $BSH_JAR; then
12807             AC_MSG_ERROR(bsh.jar not found.)
12808         fi
12809     else
12810         AC_MSG_RESULT([internal])
12811         SYSTEM_BSH=
12812         BUILD_TYPE="$BUILD_TYPE BSH"
12813     fi
12814 else
12815     AC_MSG_RESULT([no])
12816     ENABLE_SCRIPTING_BEANSHELL=
12817     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
12819 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
12820 AC_SUBST(SYSTEM_BSH)
12821 AC_SUBST(BSH_JAR)
12823 # scripting provider for JavaScript?
12824 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
12825 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
12826     AC_MSG_RESULT([yes])
12827     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
12829     dnl ===================================================================
12830     dnl Check for system rhino
12831     dnl ===================================================================
12832     AC_MSG_CHECKING([which rhino to use])
12833     if test "$with_system_rhino" = "yes"; then
12834         AC_MSG_RESULT([external])
12835         SYSTEM_RHINO=TRUE
12836         if test -z $RHINO_JAR; then
12837             RHINO_JAR=/usr/share/java/js.jar
12838         fi
12839         if ! test -f $RHINO_JAR; then
12840             AC_MSG_ERROR(js.jar not found.)
12841         fi
12842     else
12843         AC_MSG_RESULT([internal])
12844         SYSTEM_RHINO=
12845         BUILD_TYPE="$BUILD_TYPE RHINO"
12846         NEED_ANT=TRUE
12847     fi
12848 else
12849     AC_MSG_RESULT([no])
12850     ENABLE_SCRIPTING_JAVASCRIPT=
12851     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
12853 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
12854 AC_SUBST(SYSTEM_RHINO)
12855 AC_SUBST(RHINO_JAR)
12857 # This is only used in Qt5/Qt6/KF5 checks to determine if /usr/lib64
12858 # paths should be added to library search path. So lets put all 64-bit
12859 # platforms there.
12860 supports_multilib=
12861 case "$host_cpu" in
12862 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
12863     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
12864         supports_multilib="yes"
12865     fi
12866     ;;
12868     ;;
12869 esac
12871 dnl ===================================================================
12872 dnl QT5 Integration
12873 dnl ===================================================================
12875 QT5_CFLAGS=""
12876 QT5_LIBS=""
12877 QMAKE5="qmake"
12878 MOC5="moc"
12879 QT5_GOBJECT_CFLAGS=""
12880 QT5_GOBJECT_LIBS=""
12881 QT5_HAVE_GOBJECT=""
12882 QT5_PLATFORMS_SRCDIR=""
12883 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
12884         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
12885         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
12886 then
12887     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
12888     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
12890     if test -n "$supports_multilib"; then
12891         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
12892     fi
12894     qt5_test_include="QtWidgets/qapplication.h"
12895     if test "$_os" = "Emscripten"; then
12896         qt5_test_library="libQt5Widgets.a"
12897     else
12898         qt5_test_library="libQt5Widgets.so"
12899     fi
12901     dnl Check for qmake5
12902     if test -n "$QT5DIR"; then
12903         AC_PATH_PROG(QMAKE5, [qmake], no, [$QT5DIR/bin])
12904     else
12905         AC_PATH_PROGS(QMAKE5, [qmake-qt5 qmake], no)
12906     fi
12907     if test "$QMAKE5" = "no"; then
12908         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12909     else
12910         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
12911         if test -z "$qmake5_test_ver"; then
12912             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12913         fi
12914         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
12915         qt5_minimal_minor="6"
12916         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
12917             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
12918         else
12919             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
12920         fi
12921     fi
12923     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
12924     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
12925     qt5_platformsdir="`$QMAKE5 -query QT_INSTALL_PLUGINS`/platforms"
12926     QT5_PLATFORMS_SRCDIR="$qt5_platformsdir"
12928     AC_MSG_CHECKING([for Qt5 headers])
12929     qt5_incdir="no"
12930     for inc_dir in $qt5_incdirs; do
12931         if test -r "$inc_dir/$qt5_test_include"; then
12932             qt5_incdir="$inc_dir"
12933             break
12934         fi
12935     done
12936     AC_MSG_RESULT([$qt5_incdir])
12937     if test "x$qt5_incdir" = "xno"; then
12938         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12939     fi
12940     # check for scenario: qt5-qtbase-devel-*.86_64 installed but host is i686
12941     AC_LANG_PUSH([C++])
12942     save_CPPFLAGS=$CPPFLAGS
12943     CPPFLAGS="${CPPFLAGS} -I${qt5_incdir}"
12944     AC_CHECK_HEADER(QtCore/qconfig.h, [],
12945         [AC_MSG_ERROR(qconfig.h header not found.)], [])
12946     CPPFLAGS=$save_CPPFLAGS
12947     AC_LANG_POP([C++])
12949     AC_MSG_CHECKING([for Qt5 libraries])
12950     qt5_libdir="no"
12951     for lib_dir in $qt5_libdirs; do
12952         if test -r "$lib_dir/$qt5_test_library"; then
12953             qt5_libdir="$lib_dir"
12954             break
12955         fi
12956     done
12957     AC_MSG_RESULT([$qt5_libdir])
12958     if test "x$qt5_libdir" = "xno"; then
12959         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12960     fi
12962     if test "$_os" = "Emscripten"; then
12963         if test ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html ; then
12964             QT5_PLATFORMS_SRCDIR="${QT5_PLATFORMS_SRCDIR/plugins/src\/plugins}/wasm"
12965         fi
12966         if test ! -f "${qt5_platformsdir}"/libqwasm.a -o ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html; then
12967             AC_MSG_ERROR([No Qt5 WASM QPA plugin found in ${qt5_platformsdir} or ${QT5_PLATFORMS_SRCDIR}])
12968         fi
12969     fi
12971     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
12972     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12973     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
12974     if test "$_os" = "Emscripten"; then
12975         QT5_LIBS="$QT5_LIBS -lqtpcre2 -lQt5EventDispatcherSupport -lQt5FontDatabaseSupport -L${qt5_platformsdir} -lqwasm"
12976     fi
12978     if test "$USING_X11" = TRUE; then
12979         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
12980         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
12981             QT5_HAVE_XCB_ICCCM=1
12982             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
12983         ],[
12984             AC_MSG_WARN([XCB ICCCM not found, which is needed for old Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)])
12985             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
12986         ])
12987         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
12988         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
12989         QT5_USING_X11=1
12990         AC_DEFINE(QT5_USING_X11)
12991     fi
12993     dnl Check for Meta Object Compiler
12995     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
12996     if test "$MOC5" = "no"; then
12997         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
12998 the root of your Qt installation by exporting QT5DIR before running "configure".])
12999     fi
13001     if test "$test_gstreamer_1_0" = yes; then
13002         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
13003                 QT5_HAVE_GOBJECT=1
13004                 AC_DEFINE(QT5_HAVE_GOBJECT)
13005             ],
13006             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
13007         )
13008     fi
13010 AC_SUBST(QT5_CFLAGS)
13011 AC_SUBST(QT5_LIBS)
13012 AC_SUBST(MOC5)
13013 AC_SUBST(QT5_GOBJECT_CFLAGS)
13014 AC_SUBST(QT5_GOBJECT_LIBS)
13015 AC_SUBST(QT5_HAVE_GOBJECT)
13016 AC_SUBST(QT5_PLATFORMS_SRCDIR)
13018 dnl ===================================================================
13019 dnl QT6 Integration
13020 dnl ===================================================================
13022 QT6_CFLAGS=""
13023 QT6_LIBS=""
13024 QMAKE6="qmake"
13025 MOC6="moc"
13026 QT6_PLATFORMS_SRCDIR=""
13027 if test \( "$test_qt6" = "yes" -a "$ENABLE_QT6" = "TRUE" \)
13028 then
13029     qt6_incdirs="$QT6INC /usr/include/qt6 /usr/include $x_includes"
13030     qt6_libdirs="$QT6LIB /usr/lib/qt6 /usr/lib $x_libraries"
13032     if test -n "$supports_multilib"; then
13033         qt6_libdirs="$qt6_libdirs /usr/lib64/qt6 /usr/lib64/qt /usr/lib64"
13034     fi
13036     qt6_test_include="QtWidgets/qapplication.h"
13037     if test "$_os" = "Emscripten"; then
13038         qt6_test_library="libQt6Widgets.a"
13039     else
13040         qt6_test_library="libQt6Widgets.so"
13041     fi
13043     dnl Check for qmake6
13044     if test -n "$QT6DIR"; then
13045         AC_PATH_PROG(QMAKE6, [qmake], no, [$QT6DIR/bin])
13046     else
13047         AC_PATH_PROGS(QMAKE6, [qmake-qt6 qmake], no)
13048     fi
13049     if test "$QMAKE6" = "no"; then
13050         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13051     else
13052         qmake6_test_ver="`$QMAKE6 -v 2>&1 | $SED -n -e 's/^Using Qt version \(6\.[[0-9.]]\+\).*$/\1/p'`"
13053         if test -z "$qmake6_test_ver"; then
13054             AC_MSG_ERROR([Wrong qmake for Qt6 found. Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13055         fi
13056         AC_MSG_NOTICE([Detected Qt6 version: $qmake6_test_ver])
13057     fi
13059     qt6_incdirs="`$QMAKE6 -query QT_INSTALL_HEADERS` $qt6_incdirs"
13060     qt6_libdirs="`$QMAKE6 -query QT_INSTALL_LIBS` $qt6_libdirs"
13061     qt6_platformsdir="`$QMAKE6 -query QT_INSTALL_PLUGINS`/platforms"
13062     QT6_PLATFORMS_SRCDIR="$qt6_platformsdir"
13064     AC_MSG_CHECKING([for Qt6 headers])
13065     qt6_incdir="no"
13066     for inc_dir in $qt6_incdirs; do
13067         if test -r "$inc_dir/$qt6_test_include"; then
13068             qt6_incdir="$inc_dir"
13069             break
13070         fi
13071     done
13072     AC_MSG_RESULT([$qt6_incdir])
13073     if test "x$qt6_incdir" = "xno"; then
13074         AC_MSG_ERROR([Qt6 headers not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13075     fi
13076     # check for scenario: qt6-qtbase-devel-*.86_64 installed but host is i686
13077     AC_LANG_PUSH([C++])
13078     save_CPPFLAGS=$CPPFLAGS
13079     CPPFLAGS="${CPPFLAGS} -I${qt6_incdir}"
13080     AC_CHECK_HEADER(QtCore/qconfig.h, [],
13081         [AC_MSG_ERROR(qconfig.h header not found.)], [])
13082     CPPFLAGS=$save_CPPFLAGS
13083     AC_LANG_POP([C++])
13085     AC_MSG_CHECKING([for Qt6 libraries])
13086     qt6_libdir="no"
13087     for lib_dir in $qt6_libdirs; do
13088         if test -r "$lib_dir/$qt6_test_library"; then
13089             qt6_libdir="$lib_dir"
13090             break
13091         fi
13092     done
13093     AC_MSG_RESULT([$qt6_libdir])
13094     if test "x$qt6_libdir" = "xno"; then
13095         AC_MSG_ERROR([Qt6 libraries not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13096     fi
13098     if test "$_os" = "Emscripten"; then
13099         if test ! -f "$QT6_PLATFORMS_SRCDIR"/wasm_shell.html ; then
13100             QT6_PLATFORMS_SRCDIR="${QT6_PLATFORMS_SRCDIR/plugins/src\/plugins}/wasm"
13101         fi
13102         if test ! -f "${qt6_platformsdir}"/libqwasm.a -o ! -f "$QT6_PLATFORMS_SRCDIR"/wasm_shell.html; then
13103             AC_MSG_ERROR([No Qt6 WASM QPA plugin found in ${qt6_platformsdir} or ${QT6_PLATFORMS_SRCDIR}])
13104         fi
13105     fi
13107     QT6_CFLAGS="-I$qt6_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
13108     QT6_CFLAGS=$(printf '%s' "$QT6_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13109     QT6_LIBS="-L$qt6_libdir -lQt6Core -lQt6Gui -lQt6Widgets -lQt6Network"
13110     if test "$_os" = "Emscripten"; then
13111         QT6_LIBS="$QT6_LIBS -lqtpcre2 -lQt6EventDispatcherSupport -lQt6FontDatabaseSupport -L${qt6_platformsdir} -lqwasm"
13112     fi
13114     if test "$USING_X11" = TRUE; then
13115         PKG_CHECK_MODULES(QT6_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for key modifier handling in X11.])])
13116         QT6_CFLAGS="$QT6_CFLAGS $QT6_XCB_CFLAGS"
13117         QT6_LIBS="$QT6_LIBS $QT6_XCB_LIBS"
13118         QT6_USING_X11=1
13119         AC_DEFINE(QT6_USING_X11)
13120     fi
13122     dnl Check for Meta Object Compiler
13124     AC_PATH_PROGS( MOC6, [moc-qt6 moc], no, [`dirname $qt6_libdir`/libexec:$QT6DIR/libexec:$PATH])
13125     if test "$MOC6" = "no"; then
13126         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
13127 the root of your Qt installation by exporting QT6DIR before running "configure".])
13128     fi
13130 AC_SUBST(QT6_CFLAGS)
13131 AC_SUBST(QT6_LIBS)
13132 AC_SUBST(MOC6)
13133 AC_SUBST(QT6_PLATFORMS_SRCDIR)
13135 dnl ===================================================================
13136 dnl KF5 Integration
13137 dnl ===================================================================
13139 KF5_CFLAGS=""
13140 KF5_LIBS=""
13141 KF5_CONFIG="kf5-config"
13142 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
13143         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
13144 then
13145     if test "$OS" = "HAIKU"; then
13146         haiku_arch="`echo $RTL_ARCH | tr X x`"
13147         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
13148         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
13149     fi
13151     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
13152     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
13153     if test -n "$supports_multilib"; then
13154         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
13155     fi
13157     kf5_test_include="KF5/KIOFileWidgets/KFileWidget"
13158     kf5_test_library="libKF5KIOFileWidgets.so"
13159     kf5_libdirs="$qt5_libdir $kf5_libdirs"
13161     dnl kf5 KDE4 support compatibility installed
13162     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
13163     if test "$KF5_CONFIG" != "no"; then
13164         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
13165         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
13166     fi
13168     dnl Check for KF5 headers
13169     AC_MSG_CHECKING([for KF5 headers])
13170     kf5_incdir="no"
13171     for kf5_check in $kf5_incdirs; do
13172         if test -r "$kf5_check/$kf5_test_include"; then
13173             kf5_incdir="$kf5_check/KF5"
13174             break
13175         fi
13176     done
13177     AC_MSG_RESULT([$kf5_incdir])
13178     if test "x$kf5_incdir" = "xno"; then
13179         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
13180     fi
13182     dnl Check for KF5 libraries
13183     AC_MSG_CHECKING([for KF5 libraries])
13184     kf5_libdir="no"
13185     for kf5_check in $kf5_libdirs; do
13186         if test -r "$kf5_check/$kf5_test_library"; then
13187             kf5_libdir="$kf5_check"
13188             break
13189         fi
13190     done
13192     AC_MSG_RESULT([$kf5_libdir])
13193     if test "x$kf5_libdir" = "xno"; then
13194         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
13195     fi
13197     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"
13198     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
13199     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13201     if test "$USING_X11" = TRUE; then
13202         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
13203     fi
13205     AC_LANG_PUSH([C++])
13206     save_CXXFLAGS=$CXXFLAGS
13207     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
13208     AC_MSG_CHECKING([whether KDE is >= 5.0])
13209        AC_RUN_IFELSE([AC_LANG_SOURCE([[
13210 #include <kcoreaddons_version.h>
13212 int main(int argc, char **argv) {
13213        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
13214        else return 1;
13216        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
13217     CXXFLAGS=$save_CXXFLAGS
13218     AC_LANG_POP([C++])
13220 AC_SUBST(KF5_CFLAGS)
13221 AC_SUBST(KF5_LIBS)
13223 dnl ===================================================================
13224 dnl Test whether to include Evolution 2 support
13225 dnl ===================================================================
13226 AC_MSG_CHECKING([whether to enable evolution 2 support])
13227 if test "$enable_evolution2" = yes; then
13228     AC_MSG_RESULT([yes])
13229     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
13230     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13231     FilterLibs "${GOBJECT_LIBS}"
13232     GOBJECT_LIBS="${filteredlibs}"
13233     ENABLE_EVOAB2="TRUE"
13234 else
13235     AC_MSG_RESULT([no])
13237 AC_SUBST(ENABLE_EVOAB2)
13238 AC_SUBST(GOBJECT_CFLAGS)
13239 AC_SUBST(GOBJECT_LIBS)
13241 dnl ===================================================================
13242 dnl Test which themes to include
13243 dnl ===================================================================
13244 AC_MSG_CHECKING([which themes to include])
13245 # if none given use default subset of available themes
13246 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
13247     with_theme="breeze breeze_dark breeze_dark_svg breeze_svg colibre colibre_svg colibre_dark colibre_dark_svg elementary elementary_svg karasa_jaga karasa_jaga_svg sifr sifr_svg sifr_dark sifr_dark_svg sukapura sukapura_svg"
13250 WITH_THEMES=""
13251 if test "x$with_theme" != "xno"; then
13252     for theme in $with_theme; do
13253         case $theme in
13254         breeze|breeze_dark|breeze_dark_svg|breeze_svg|colibre|colibre_svg|colibre_dark|colibre_dark_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg|sifr|sifr_svg|sifr_dark|sifr_dark_svg|sukapura|sukapura_svg) real_theme="$theme" ;;
13255         default) real_theme=colibre ;;
13256         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
13257         esac
13258         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
13259     done
13261 AC_MSG_RESULT([$WITH_THEMES])
13262 AC_SUBST([WITH_THEMES])
13263 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
13264 for theme in $with_theme; do
13265     case $theme in
13266     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
13267     *) ;;
13268     esac
13269 done
13271 ###############################################################################
13272 # Extensions checking
13273 ###############################################################################
13274 AC_MSG_CHECKING([for extensions integration])
13275 if test "x$enable_extension_integration" != "xno"; then
13276     WITH_EXTENSION_INTEGRATION=TRUE
13277     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
13278     AC_MSG_RESULT([yes, use integration])
13279 else
13280     WITH_EXTENSION_INTEGRATION=
13281     AC_MSG_RESULT([no, do not integrate])
13283 AC_SUBST(WITH_EXTENSION_INTEGRATION)
13285 dnl Should any extra extensions be included?
13286 dnl There are standalone tests for each of these below.
13287 WITH_EXTRA_EXTENSIONS=
13288 AC_SUBST([WITH_EXTRA_EXTENSIONS])
13290 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
13291 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
13292 if test "x$with_java" != "xno"; then
13293     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
13294     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
13297 AC_MSG_CHECKING([whether to build opens___.ttf])
13298 if test "$enable_build_opensymbol" = "yes"; then
13299     AC_MSG_RESULT([yes])
13300     AC_PATH_PROG(FONTFORGE, fontforge)
13301     if test -z "$FONTFORGE"; then
13302         AC_MSG_ERROR([fontforge not installed])
13303     fi
13304 else
13305     AC_MSG_RESULT([no])
13306     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
13308 AC_SUBST(FONTFORGE)
13310 dnl ===================================================================
13311 dnl Test whether to include fonts
13312 dnl ===================================================================
13313 AC_MSG_CHECKING([whether to include third-party fonts])
13314 if test "$with_fonts" != "no"; then
13315     AC_MSG_RESULT([yes])
13316     WITH_FONTS=TRUE
13317     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
13318     AC_DEFINE(HAVE_MORE_FONTS)
13319 else
13320     AC_MSG_RESULT([no])
13321     WITH_FONTS=
13322     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
13324 AC_SUBST(WITH_FONTS)
13327 dnl ===================================================================
13328 dnl Test whether to enable online update service
13329 dnl ===================================================================
13330 AC_MSG_CHECKING([whether to enable online update])
13331 ENABLE_ONLINE_UPDATE=
13332 ENABLE_ONLINE_UPDATE_MAR=
13333 UPDATE_CONFIG=
13334 if test "$enable_online_update" = ""; then
13335     AC_MSG_RESULT([no])
13336 else
13337     if test "$enable_online_update" = "mar"; then
13338         AC_MSG_RESULT([yes - MAR-based online update])
13339         ENABLE_ONLINE_UPDATE_MAR="TRUE"
13340         if test "$with_update_config" = ""; then
13341             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
13342         fi
13343         UPDATE_CONFIG="$with_update_config"
13344         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
13345     elif test "$enable_online_update" = "yes"; then
13346         AC_MSG_RESULT([yes])
13347         ENABLE_ONLINE_UPDATE="TRUE"
13348     else
13349         AC_MSG_RESULT([no])
13350     fi
13352 AC_SUBST(ENABLE_ONLINE_UPDATE)
13353 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
13354 AC_SUBST(UPDATE_CONFIG)
13357 PRIVACY_POLICY_URL="$with_privacy_policy_url"
13358 if test "$ENABLE_ONLINE_UPDATE" = TRUE -o "$ENABLE_BREAKPAD" = "TRUE"; then
13359     if test "x$with_privacy_policy_url" = "xundefined"; then
13360         AC_MSG_FAILURE([online update or breakpad/crashreporting are enabled, but no --with-privacy-policy-url=... was provided])
13361     fi
13363 AC_SUBST(PRIVACY_POLICY_URL)
13364 dnl ===================================================================
13365 dnl Test whether we need bzip2
13366 dnl ===================================================================
13367 SYSTEM_BZIP2=
13368 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
13369     AC_MSG_CHECKING([whether to use system bzip2])
13370     if test "$with_system_bzip2" = yes; then
13371         SYSTEM_BZIP2=TRUE
13372         AC_MSG_RESULT([yes])
13373         PKG_CHECK_MODULES(BZIP2, bzip2)
13374         FilterLibs "${BZIP2_LIBS}"
13375         BZIP2_LIBS="${filteredlibs}"
13376     else
13377         AC_MSG_RESULT([no])
13378         BUILD_TYPE="$BUILD_TYPE BZIP2"
13379     fi
13381 AC_SUBST(SYSTEM_BZIP2)
13382 AC_SUBST(BZIP2_CFLAGS)
13383 AC_SUBST(BZIP2_LIBS)
13385 dnl ===================================================================
13386 dnl Test whether to enable extension update
13387 dnl ===================================================================
13388 AC_MSG_CHECKING([whether to enable extension update])
13389 ENABLE_EXTENSION_UPDATE=
13390 if test "x$enable_extension_update" = "xno"; then
13391     AC_MSG_RESULT([no])
13392 else
13393     AC_MSG_RESULT([yes])
13394     ENABLE_EXTENSION_UPDATE="TRUE"
13395     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
13396     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
13398 AC_SUBST(ENABLE_EXTENSION_UPDATE)
13401 dnl ===================================================================
13402 dnl Test whether to create MSI with LIMITUI=1 (silent install)
13403 dnl ===================================================================
13404 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
13405 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
13406     AC_MSG_RESULT([no])
13407     ENABLE_SILENT_MSI=
13408 else
13409     AC_MSG_RESULT([yes])
13410     ENABLE_SILENT_MSI=TRUE
13411     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
13413 AC_SUBST(ENABLE_SILENT_MSI)
13415 AC_MSG_CHECKING([whether and how to use Xinerama])
13416 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
13417     if test "$x_libraries" = "default_x_libraries"; then
13418         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
13419         if test "x$XINERAMALIB" = x; then
13420            XINERAMALIB="/usr/lib"
13421         fi
13422     else
13423         XINERAMALIB="$x_libraries"
13424     fi
13425     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
13426         # we have both versions, let the user decide but use the dynamic one
13427         # per default
13428         USE_XINERAMA=TRUE
13429         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
13430             XINERAMA_LINK=dynamic
13431         else
13432             XINERAMA_LINK=static
13433         fi
13434     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
13435         # we have only the dynamic version
13436         USE_XINERAMA=TRUE
13437         XINERAMA_LINK=dynamic
13438     elif test -e "$XINERAMALIB/libXinerama.a"; then
13439         # static version
13440         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
13441             USE_XINERAMA=TRUE
13442             XINERAMA_LINK=static
13443         else
13444             USE_XINERAMA=
13445             XINERAMA_LINK=none
13446         fi
13447     else
13448         # no Xinerama
13449         USE_XINERAMA=
13450         XINERAMA_LINK=none
13451     fi
13452     if test "$USE_XINERAMA" = "TRUE"; then
13453         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
13454         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
13455             [AC_MSG_ERROR(Xinerama header not found.)], [])
13456         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
13457         if test "x$XEXTLIB" = x; then
13458            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
13459         fi
13460         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
13461         if test "$_os" = "FreeBSD"; then
13462             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
13463         fi
13464         if test "$_os" = "Linux"; then
13465             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
13466         fi
13467         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
13468             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
13469     else
13470         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
13471     fi
13472 else
13473     USE_XINERAMA=
13474     XINERAMA_LINK=none
13475     AC_MSG_RESULT([no])
13477 AC_SUBST(USE_XINERAMA)
13478 AC_SUBST(XINERAMA_LINK)
13480 dnl ===================================================================
13481 dnl Test whether to build cairo or rely on the system version
13482 dnl ===================================================================
13484 if test "$test_cairo" = "yes"; then
13485     AC_MSG_CHECKING([whether to use the system cairo])
13487     : ${with_system_cairo:=$with_system_libs}
13488     if test "$with_system_cairo" = "yes"; then
13489         SYSTEM_CAIRO=TRUE
13490         AC_MSG_RESULT([yes])
13492         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
13493         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13494         FilterLibs "${CAIRO_LIBS}"
13495         CAIRO_LIBS="${filteredlibs}"
13497         if test "$test_xrender" = "yes"; then
13498             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
13499             AC_LANG_PUSH([C])
13500             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
13501 #ifdef PictStandardA8
13502 #else
13503       return fail;
13504 #endif
13505 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
13507             AC_LANG_POP([C])
13508         fi
13509     else
13510         AC_MSG_RESULT([no])
13511         BUILD_TYPE="$BUILD_TYPE CAIRO"
13512     fi
13514     if test "$enable_cairo_canvas" != no; then
13515         AC_DEFINE(ENABLE_CAIRO_CANVAS)
13516         ENABLE_CAIRO_CANVAS=TRUE
13517     fi
13520 AC_SUBST(CAIRO_CFLAGS)
13521 AC_SUBST(CAIRO_LIBS)
13522 AC_SUBST(ENABLE_CAIRO_CANVAS)
13523 AC_SUBST(SYSTEM_CAIRO)
13525 dnl ===================================================================
13526 dnl Test whether to use avahi
13527 dnl ===================================================================
13528 if test "$_os" = "WINNT"; then
13529     # Windows uses bundled mDNSResponder
13530     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
13531 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
13532     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
13533                       [ENABLE_AVAHI="TRUE"])
13534     AC_DEFINE(HAVE_FEATURE_AVAHI)
13535     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13536     FilterLibs "${AVAHI_LIBS}"
13537     AVAHI_LIBS="${filteredlibs}"
13540 AC_SUBST(ENABLE_AVAHI)
13541 AC_SUBST(AVAHI_CFLAGS)
13542 AC_SUBST(AVAHI_LIBS)
13544 dnl ===================================================================
13545 dnl Test whether to use liblangtag
13546 dnl ===================================================================
13547 SYSTEM_LIBLANGTAG=
13548 AC_MSG_CHECKING([whether to use system liblangtag])
13549 if test "$with_system_liblangtag" = yes; then
13550     SYSTEM_LIBLANGTAG=TRUE
13551     AC_MSG_RESULT([yes])
13552     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
13553     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
13554     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
13555     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13556     FilterLibs "${LIBLANGTAG_LIBS}"
13557     LIBLANGTAG_LIBS="${filteredlibs}"
13558 else
13559     SYSTEM_LIBLANGTAG=
13560     AC_MSG_RESULT([no])
13561     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
13562     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
13563     if test "$COM" = "MSC"; then
13564         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
13565     else
13566         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
13567     fi
13569 AC_SUBST(SYSTEM_LIBLANGTAG)
13570 AC_SUBST(LIBLANGTAG_CFLAGS)
13571 AC_SUBST(LIBLANGTAG_LIBS)
13573 dnl ===================================================================
13574 dnl Test whether to build libpng or rely on the system version
13575 dnl ===================================================================
13577 LIBPNG_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/libpng"
13578 LIBPNG_LIBS_internal="-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"
13579 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng])
13581 dnl ===================================================================
13582 dnl Test whether to build libwebp or rely on the system version
13583 dnl ===================================================================
13585 libo_CHECK_SYSTEM_MODULE([libwebp],[LIBWEBP],[libwebp])
13587 dnl ===================================================================
13588 dnl Check for runtime JVM search path
13589 dnl ===================================================================
13590 if test "$ENABLE_JAVA" != ""; then
13591     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
13592     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
13593         AC_MSG_RESULT([yes])
13594         if ! test -d "$with_jvm_path"; then
13595             AC_MSG_ERROR(["$with_jvm_path" not a directory])
13596         fi
13597         if ! test -d "$with_jvm_path"jvm; then
13598             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
13599         fi
13600         JVM_ONE_PATH_CHECK="$with_jvm_path"
13601         AC_SUBST(JVM_ONE_PATH_CHECK)
13602     else
13603         AC_MSG_RESULT([no])
13604     fi
13607 dnl ===================================================================
13608 dnl Test for the presence of Ant and that it works
13609 dnl ===================================================================
13611 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE" -a "$cross_compiling" != "yes"; then
13612     ANT_HOME=; export ANT_HOME
13613     WITH_ANT_HOME=; export WITH_ANT_HOME
13614     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
13615         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
13616             if test "$_os" = "WINNT"; then
13617                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
13618             else
13619                 with_ant_home="$LODE_HOME/opt/ant"
13620             fi
13621         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
13622             with_ant_home="$LODE_HOME/opt/ant"
13623         fi
13624     fi
13625     if test -z "$with_ant_home"; then
13626         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
13627     else
13628         if test "$_os" = "WINNT"; then
13629             # AC_PATH_PROGS needs unix path
13630             with_ant_home=`cygpath -u "$with_ant_home"`
13631         fi
13632         AbsolutePath "$with_ant_home"
13633         with_ant_home=$absolute_path
13634         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
13635         WITH_ANT_HOME=$with_ant_home
13636         ANT_HOME=$with_ant_home
13637     fi
13639     if test -z "$ANT"; then
13640         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
13641     else
13642         # resolve relative or absolute symlink
13643         while test -h "$ANT"; do
13644             a_cwd=`pwd`
13645             a_basename=`basename "$ANT"`
13646             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
13647             cd "`dirname "$ANT"`"
13648             cd "`dirname "$a_script"`"
13649             ANT="`pwd`"/"`basename "$a_script"`"
13650             cd "$a_cwd"
13651         done
13653         AC_MSG_CHECKING([if $ANT works])
13654         mkdir -p conftest.dir
13655         a_cwd=$(pwd)
13656         cd conftest.dir
13657         cat > conftest.java << EOF
13658         public class conftest {
13659             int testmethod(int a, int b) {
13660                     return a + b;
13661             }
13662         }
13665         cat > conftest.xml << EOF
13666         <project name="conftest" default="conftest">
13667         <target name="conftest">
13668             <javac srcdir="." includes="conftest.java">
13669             </javac>
13670         </target>
13671         </project>
13674         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
13675         if test $? = 0 -a -f ./conftest.class; then
13676             AC_MSG_RESULT([Ant works])
13677             if test -z "$WITH_ANT_HOME"; then
13678                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
13679                 if test -z "$ANT_HOME"; then
13680                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
13681                 fi
13682             else
13683                 ANT_HOME="$WITH_ANT_HOME"
13684             fi
13685         else
13686             echo "configure: Ant test failed" >&5
13687             cat conftest.java >&5
13688             cat conftest.xml >&5
13689             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
13690         fi
13691         cd "$a_cwd"
13692         rm -fr conftest.dir
13693     fi
13694     if test -z "$ANT_HOME"; then
13695         ANT_HOME="NO_ANT_HOME"
13696     else
13697         PathFormat "$ANT_HOME"
13698         ANT_HOME="$formatted_path"
13699         PathFormat "$ANT"
13700         ANT="$formatted_path"
13701     fi
13703     dnl Checking for ant.jar
13704     if test "$ANT_HOME" != "NO_ANT_HOME"; then
13705         AC_MSG_CHECKING([Ant lib directory])
13706         if test -f $ANT_HOME/lib/ant.jar; then
13707             ANT_LIB="$ANT_HOME/lib"
13708         else
13709             if test -f $ANT_HOME/ant.jar; then
13710                 ANT_LIB="$ANT_HOME"
13711             else
13712                 if test -f /usr/share/java/ant.jar; then
13713                     ANT_LIB=/usr/share/java
13714                 else
13715                     if test -f /usr/share/ant-core/lib/ant.jar; then
13716                         ANT_LIB=/usr/share/ant-core/lib
13717                     else
13718                         if test -f $ANT_HOME/lib/ant/ant.jar; then
13719                             ANT_LIB="$ANT_HOME/lib/ant"
13720                         else
13721                             if test -f /usr/share/lib/ant/ant.jar; then
13722                                 ANT_LIB=/usr/share/lib/ant
13723                             else
13724                                 AC_MSG_ERROR([Ant libraries not found!])
13725                             fi
13726                         fi
13727                     fi
13728                 fi
13729             fi
13730         fi
13731         PathFormat "$ANT_LIB"
13732         ANT_LIB="$formatted_path"
13733         AC_MSG_RESULT([Ant lib directory found.])
13734     fi
13736     ant_minver=1.6.0
13737     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
13739     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
13740     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
13741     ant_version_major=`echo $ant_version | cut -d. -f1`
13742     ant_version_minor=`echo $ant_version | cut -d. -f2`
13743     echo "configure: ant_version $ant_version " >&5
13744     echo "configure: ant_version_major $ant_version_major " >&5
13745     echo "configure: ant_version_minor $ant_version_minor " >&5
13746     if test "$ant_version_major" -ge "2"; then
13747         AC_MSG_RESULT([yes, $ant_version])
13748     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
13749         AC_MSG_RESULT([yes, $ant_version])
13750     else
13751         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
13752     fi
13754     rm -f conftest* core core.* *.core
13756 AC_SUBST(ANT)
13757 AC_SUBST(ANT_HOME)
13758 AC_SUBST(ANT_LIB)
13760 OOO_JUNIT_JAR=
13761 HAMCREST_JAR=
13762 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no" -a "$cross_compiling" != "yes"; then
13763     AC_MSG_CHECKING([for JUnit 4])
13764     if test "$with_junit" = "yes"; then
13765         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
13766             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
13767         elif test -e /usr/share/java/junit4.jar; then
13768             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
13769         else
13770            if test -e /usr/share/lib/java/junit.jar; then
13771               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
13772            else
13773               OOO_JUNIT_JAR=/usr/share/java/junit.jar
13774            fi
13775         fi
13776     else
13777         OOO_JUNIT_JAR=$with_junit
13778     fi
13779     if test "$_os" = "WINNT"; then
13780         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
13781     fi
13782     printf 'import org.junit.Before;' > conftest.java
13783     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
13784         AC_MSG_RESULT([$OOO_JUNIT_JAR])
13785     else
13786         AC_MSG_ERROR(
13787 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
13788  specify its pathname via --with-junit=..., or disable it via --without-junit])
13789     fi
13790     rm -f conftest.class conftest.java
13791     if test $OOO_JUNIT_JAR != ""; then
13792         BUILD_TYPE="$BUILD_TYPE QADEVOOO"
13793     fi
13795     AC_MSG_CHECKING([for included Hamcrest])
13796     printf 'import org.hamcrest.BaseDescription;' > conftest.java
13797     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
13798         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
13799     else
13800         AC_MSG_RESULT([Not included])
13801         AC_MSG_CHECKING([for standalone hamcrest jar.])
13802         if test "$with_hamcrest" = "yes"; then
13803             if test -e /usr/share/lib/java/hamcrest.jar; then
13804                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
13805             elif test -e /usr/share/java/hamcrest/core.jar; then
13806                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
13807             elif test -e /usr/share/java/hamcrest/hamcrest.jar; then
13808                 HAMCREST_JAR=/usr/share/java/hamcrest/hamcrest.jar
13809             else
13810                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
13811             fi
13812         else
13813             HAMCREST_JAR=$with_hamcrest
13814         fi
13815         if test "$_os" = "WINNT"; then
13816             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
13817         fi
13818         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
13819             AC_MSG_RESULT([$HAMCREST_JAR])
13820         else
13821             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),
13822                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
13823         fi
13824     fi
13825     rm -f conftest.class conftest.java
13827 AC_SUBST(OOO_JUNIT_JAR)
13828 AC_SUBST(HAMCREST_JAR)
13831 AC_SUBST(SCPDEFS)
13834 # check for wget and curl
13836 WGET=
13837 CURL=
13839 if test "$enable_fetch_external" != "no"; then
13841 CURL=`which curl 2>/dev/null`
13843 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
13844     # wget new enough?
13845     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
13846     if test $? -eq 0; then
13847         WGET=$i
13848         break
13849     fi
13850 done
13852 if test -z "$WGET" -a -z "$CURL"; then
13853     AC_MSG_ERROR([neither wget nor curl found!])
13858 AC_SUBST(WGET)
13859 AC_SUBST(CURL)
13862 # check for sha256sum
13864 SHA256SUM=
13866 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
13867     eval "$i -a 256 --version" > /dev/null 2>&1
13868     ret=$?
13869     if test $ret -eq 0; then
13870         SHA256SUM="$i -a 256"
13871         break
13872     fi
13873 done
13875 if test -z "$SHA256SUM"; then
13876     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
13877         eval "$i --version" > /dev/null 2>&1
13878         ret=$?
13879         if test $ret -eq 0; then
13880             SHA256SUM=$i
13881             break
13882         fi
13883     done
13886 if test -z "$SHA256SUM"; then
13887     AC_MSG_ERROR([no sha256sum found!])
13890 AC_SUBST(SHA256SUM)
13892 dnl ===================================================================
13893 dnl Dealing with l10n options
13894 dnl ===================================================================
13895 AC_MSG_CHECKING([which languages to be built])
13896 # get list of all languages
13897 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
13898 # the sed command does the following:
13899 #   + if a line ends with a backslash, append the next line to it
13900 #   + adds " on the beginning of the value (after =)
13901 #   + adds " at the end of the value
13902 #   + removes en-US; we want to put it on the beginning
13903 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
13904 [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)]
13905 ALL_LANGS="en-US $completelangiso"
13906 # check the configured localizations
13907 WITH_LANG="$with_lang"
13909 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
13910 # (Norwegian is "nb" and "nn".)
13911 if test "$WITH_LANG" = "no"; then
13912     WITH_LANG=
13915 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
13916     AC_MSG_RESULT([en-US])
13917 else
13918     AC_MSG_RESULT([$WITH_LANG])
13919     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
13920     if test -z "$MSGFMT"; then
13921         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
13922             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
13923         elif test -x "/opt/lo/bin/msgfmt"; then
13924             MSGFMT="/opt/lo/bin/msgfmt"
13925         else
13926             AC_CHECK_PROGS(MSGFMT, [msgfmt])
13927             if test -z "$MSGFMT"; then
13928                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
13929             fi
13930         fi
13931     fi
13932     if test -z "$MSGUNIQ"; then
13933         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
13934             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
13935         elif test -x "/opt/lo/bin/msguniq"; then
13936             MSGUNIQ="/opt/lo/bin/msguniq"
13937         else
13938             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
13939             if test -z "$MSGUNIQ"; then
13940                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
13941             fi
13942         fi
13943     fi
13945 AC_SUBST(MSGFMT)
13946 AC_SUBST(MSGUNIQ)
13947 # check that the list is valid
13948 for lang in $WITH_LANG; do
13949     test "$lang" = "ALL" && continue
13950     # need to check for the exact string, so add space before and after the list of all languages
13951     for vl in $ALL_LANGS; do
13952         if test "$vl" = "$lang"; then
13953            break
13954         fi
13955     done
13956     if test "$vl" != "$lang"; then
13957         # if you're reading this - you prolly quoted your languages remove the quotes ...
13958         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
13959     fi
13960 done
13961 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
13962     echo $WITH_LANG | grep -q en-US
13963     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
13965 # list with substituted ALL
13966 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
13967 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
13968 test "$WITH_LANG" = "en-US" && WITH_LANG=
13969 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
13970     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
13971     ALL_LANGS=`echo $ALL_LANGS qtz`
13973 AC_SUBST(ALL_LANGS)
13974 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
13975 AC_SUBST(WITH_LANG)
13976 AC_SUBST(WITH_LANG_LIST)
13977 AC_SUBST(GIT_NEEDED_SUBMODULES)
13979 WITH_POOR_HELP_LOCALIZATIONS=
13980 if test -d "$SRC_ROOT/translations/source"; then
13981     for l in `ls -1 $SRC_ROOT/translations/source`; do
13982         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
13983             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
13984         fi
13985     done
13987 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
13989 if test -n "$with_locales" -a "$with_locales" != ALL; then
13990     WITH_LOCALES="$with_locales"
13992     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
13993     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
13994     # config_host/config_locales.h.in
13995     for locale in $WITH_LOCALES; do
13996         lang=${locale%_*}
13998         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
14000         case $lang in
14001         hi|mr*ne)
14002             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
14003             ;;
14004         bg|ru)
14005             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
14006             ;;
14007         esac
14008     done
14009 else
14010     AC_DEFINE(WITH_LOCALE_ALL)
14012 AC_SUBST(WITH_LOCALES)
14014 dnl git submodule update --reference
14015 dnl ===================================================================
14016 if test -n "${GIT_REFERENCE_SRC}"; then
14017     for repo in ${GIT_NEEDED_SUBMODULES}; do
14018         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
14019             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
14020         fi
14021     done
14023 AC_SUBST(GIT_REFERENCE_SRC)
14025 dnl git submodules linked dirs
14026 dnl ===================================================================
14027 if test -n "${GIT_LINK_SRC}"; then
14028     for repo in ${GIT_NEEDED_SUBMODULES}; do
14029         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
14030             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
14031         fi
14032     done
14034 AC_SUBST(GIT_LINK_SRC)
14036 dnl branding
14037 dnl ===================================================================
14038 AC_MSG_CHECKING([for alternative branding images directory])
14039 # initialize mapped arrays
14040 BRAND_INTRO_IMAGES="intro.png intro-highres.png"
14041 brand_files="$BRAND_INTRO_IMAGES logo.svg logo_inverted.svg logo-sc.svg logo-sc_inverted.svg about.svg"
14043 if test -z "$with_branding" -o "$with_branding" = "no"; then
14044     AC_MSG_RESULT([none])
14045     DEFAULT_BRAND_IMAGES="$brand_files"
14046 else
14047     if ! test -d $with_branding ; then
14048         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
14049     else
14050         AC_MSG_RESULT([$with_branding])
14051         CUSTOM_BRAND_DIR="$with_branding"
14052         for lfile in $brand_files
14053         do
14054             if ! test -f $with_branding/$lfile ; then
14055                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
14056                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
14057             else
14058                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
14059             fi
14060         done
14061         check_for_progress="yes"
14062     fi
14064 AC_SUBST([BRAND_INTRO_IMAGES])
14065 AC_SUBST([CUSTOM_BRAND_DIR])
14066 AC_SUBST([CUSTOM_BRAND_IMAGES])
14067 AC_SUBST([DEFAULT_BRAND_IMAGES])
14070 AC_MSG_CHECKING([for 'intro' progress settings])
14071 PROGRESSBARCOLOR=
14072 PROGRESSSIZE=
14073 PROGRESSPOSITION=
14074 PROGRESSFRAMECOLOR=
14075 PROGRESSTEXTCOLOR=
14076 PROGRESSTEXTBASELINE=
14078 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
14079     source "$with_branding/progress.conf"
14080     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
14081 else
14082     AC_MSG_RESULT([none])
14085 AC_SUBST(PROGRESSBARCOLOR)
14086 AC_SUBST(PROGRESSSIZE)
14087 AC_SUBST(PROGRESSPOSITION)
14088 AC_SUBST(PROGRESSFRAMECOLOR)
14089 AC_SUBST(PROGRESSTEXTCOLOR)
14090 AC_SUBST(PROGRESSTEXTBASELINE)
14093 dnl ===================================================================
14094 dnl Custom build version
14095 dnl ===================================================================
14096 AC_MSG_CHECKING([for extra build ID])
14097 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
14098     EXTRA_BUILDID="$with_extra_buildid"
14100 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
14101 if test -n "$EXTRA_BUILDID" ; then
14102     AC_MSG_RESULT([$EXTRA_BUILDID])
14103 else
14104     AC_MSG_RESULT([not set])
14106 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
14108 OOO_VENDOR=
14109 AC_MSG_CHECKING([for vendor])
14110 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
14111     OOO_VENDOR="$USERNAME"
14113     if test -z "$OOO_VENDOR"; then
14114         OOO_VENDOR="$USER"
14115     fi
14117     if test -z "$OOO_VENDOR"; then
14118         OOO_VENDOR="`id -u -n`"
14119     fi
14121     AC_MSG_RESULT([not set, using $OOO_VENDOR])
14122 else
14123     OOO_VENDOR="$with_vendor"
14124     AC_MSG_RESULT([$OOO_VENDOR])
14126 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
14127 AC_SUBST(OOO_VENDOR)
14129 if test "$_os" = "Android" ; then
14130     ANDROID_PACKAGE_NAME=
14131     AC_MSG_CHECKING([for Android package name])
14132     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
14133         if test -n "$ENABLE_DEBUG"; then
14134             # Default to the package name that makes ndk-gdb happy.
14135             ANDROID_PACKAGE_NAME="org.libreoffice"
14136         else
14137             ANDROID_PACKAGE_NAME="org.example.libreoffice"
14138         fi
14140         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
14141     else
14142         ANDROID_PACKAGE_NAME="$with_android_package_name"
14143         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
14144     fi
14145     AC_SUBST(ANDROID_PACKAGE_NAME)
14148 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
14149 if test "$with_compat_oowrappers" = "yes"; then
14150     WITH_COMPAT_OOWRAPPERS=TRUE
14151     AC_MSG_RESULT(yes)
14152 else
14153     WITH_COMPAT_OOWRAPPERS=
14154     AC_MSG_RESULT(no)
14156 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
14158 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
14159 AC_MSG_CHECKING([for install dirname])
14160 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
14161     INSTALLDIRNAME="$with_install_dirname"
14163 AC_MSG_RESULT([$INSTALLDIRNAME])
14164 AC_SUBST(INSTALLDIRNAME)
14166 AC_MSG_CHECKING([for prefix])
14167 test "x$prefix" = xNONE && prefix=$ac_default_prefix
14168 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
14169 PREFIXDIR="$prefix"
14170 AC_MSG_RESULT([$PREFIXDIR])
14171 AC_SUBST(PREFIXDIR)
14173 LIBDIR=[$(eval echo $(eval echo $libdir))]
14174 AC_SUBST(LIBDIR)
14176 DATADIR=[$(eval echo $(eval echo $datadir))]
14177 AC_SUBST(DATADIR)
14179 MANDIR=[$(eval echo $(eval echo $mandir))]
14180 AC_SUBST(MANDIR)
14182 DOCDIR=[$(eval echo $(eval echo $docdir))]
14183 AC_SUBST(DOCDIR)
14185 BINDIR=[$(eval echo $(eval echo $bindir))]
14186 AC_SUBST(BINDIR)
14188 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
14189 AC_SUBST(INSTALLDIR)
14191 TESTINSTALLDIR="${BUILDDIR}/test-install"
14192 AC_SUBST(TESTINSTALLDIR)
14195 # ===================================================================
14196 # OAuth2 id and secrets
14197 # ===================================================================
14199 AC_MSG_CHECKING([for Google Drive client id and secret])
14200 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
14201     AC_MSG_RESULT([not set])
14202     GDRIVE_CLIENT_ID="\"\""
14203     GDRIVE_CLIENT_SECRET="\"\""
14204 else
14205     AC_MSG_RESULT([set])
14206     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
14207     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
14209 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
14210 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
14212 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
14213 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
14214     AC_MSG_RESULT([not set])
14215     ALFRESCO_CLOUD_CLIENT_ID="\"\""
14216     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
14217 else
14218     AC_MSG_RESULT([set])
14219     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
14220     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
14222 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
14223 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
14225 AC_MSG_CHECKING([for OneDrive client id and secret])
14226 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
14227     AC_MSG_RESULT([not set])
14228     ONEDRIVE_CLIENT_ID="\"\""
14229     ONEDRIVE_CLIENT_SECRET="\"\""
14230 else
14231     AC_MSG_RESULT([set])
14232     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
14233     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
14235 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
14236 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
14239 dnl ===================================================================
14240 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
14241 dnl --enable-dependency-tracking configure option
14242 dnl ===================================================================
14243 AC_MSG_CHECKING([whether to enable dependency tracking])
14244 if test "$enable_dependency_tracking" = "no"; then
14245     nodep=TRUE
14246     AC_MSG_RESULT([no])
14247 else
14248     AC_MSG_RESULT([yes])
14250 AC_SUBST(nodep)
14252 dnl ===================================================================
14253 dnl Number of CPUs to use during the build
14254 dnl ===================================================================
14255 AC_MSG_CHECKING([for number of processors to use])
14256 # plain --with-parallelism is just the default
14257 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
14258     if test "$with_parallelism" = "no"; then
14259         PARALLELISM=0
14260     else
14261         PARALLELISM=$with_parallelism
14262     fi
14263 else
14264     if test "$enable_icecream" = "yes"; then
14265         PARALLELISM="40"
14266     else
14267         case `uname -s` in
14269         Darwin|FreeBSD|NetBSD|OpenBSD)
14270             PARALLELISM=`sysctl -n hw.ncpu`
14271             ;;
14273         Linux)
14274             PARALLELISM=`getconf _NPROCESSORS_ONLN`
14275         ;;
14276         # what else than above does profit here *and* has /proc?
14277         *)
14278             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
14279             ;;
14280         esac
14282         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
14283         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
14284     fi
14287 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
14288     if test -z "$with_parallelism"; then
14289             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
14290             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
14291             PARALLELISM="1"
14292     else
14293         add_warning "make 3.81 is prone to crashes with parallelism > 1. Since --with-parallelism was explicitly given, it is honored, but do not complain when make segfaults on you."
14294     fi
14297 if test $PARALLELISM -eq 0; then
14298     AC_MSG_RESULT([explicit make -j option needed])
14299 else
14300     AC_MSG_RESULT([$PARALLELISM])
14302 AC_SUBST(PARALLELISM)
14304 IWYU_PATH="$with_iwyu"
14305 AC_SUBST(IWYU_PATH)
14306 if test ! -z "$IWYU_PATH"; then
14307     if test ! -f "$IWYU_PATH"; then
14308         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
14309     fi
14313 # Set up ILIB for MSVC build
14315 ILIB1=
14316 if test "$build_os" = "cygwin"; then
14317     ILIB="."
14318     if test -n "$JAVA_HOME"; then
14319         ILIB="$ILIB;$JAVA_HOME/lib"
14320     fi
14321     ILIB1=-link
14322     ILIB="$ILIB;$COMPATH/lib/$WIN_HOST_ARCH"
14323     ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/$WIN_HOST_ARCH"
14324     ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
14325     ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
14326     if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
14327         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
14328         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
14329     fi
14330     PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/$WIN_HOST_ARCH"
14331     ucrtlibpath_formatted=$formatted_path
14332     ILIB="$ILIB;$ucrtlibpath_formatted"
14333     ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
14334     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
14335         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
14336     else
14337         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WIN_HOST_ARCH"
14338     fi
14340     if test "$cross_compiling" != "yes"; then
14341         ILIB_FOR_BUILD="$ILIB"
14342     fi
14344 AC_SUBST(ILIB)
14345 AC_SUBST(ILIB_FOR_BUILD)
14347 AC_MSG_CHECKING([whether $CXX_BASE supports a working C++20 consteval])
14348 dnl ...that does not suffer from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96994> "Missing code
14349 dnl from consteval constructor initializing const variable",
14350 dnl <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98752> "wrong 'error: â€˜this’ is not a constant
14351 dnl expression' with consteval constructor", <https://bugs.llvm.org/show_bug.cgi?id=50063> "code
14352 dnl using consteval: 'clang/lib/CodeGen/Address.h:38: llvm::Value*
14353 dnl clang::CodeGen::Address::getPointer() const: Assertion `isValid()' failed.'", or
14354 dnl <https://developercommunity.visualstudio.com/t/1581879> "Bogus error C7595 with consteval
14355 dnl constructor in ternary expression (/std:c++latest)":
14356 AC_LANG_PUSH([C++])
14357 save_CXX=$CXX
14358 if test "$COM" = MSC && test "$COM_IS_CLANG" != TRUE; then
14359     CXX="env LIB=$ILIB $CXX"
14361 save_CXXFLAGS=$CXXFLAGS
14362 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
14363 AC_RUN_IFELSE([AC_LANG_PROGRAM([
14364         struct S {
14365             consteval S() { i = 1; }
14366             int i = 0;
14367         };
14368         S const s;
14370         struct S1 { consteval S1(int) {} };
14371         struct S2 {
14372             S1 x;
14373             S2(): x(0) {}
14374         };
14376         struct S3 {
14377             consteval S3() {}
14378             union {
14379                 int a;
14380                 unsigned b = 0;
14381             };
14382         };
14383         void f() { S3(); }
14385         struct S4 { consteval S4() = default; };
14386         void f4(bool b) { b ? S4() : S4(); }
14387     ], [
14388         return (s.i == 1) ? 0 : 1;
14389     ])], [
14390         AC_DEFINE([HAVE_CPP_CONSTEVAL],[1])
14391         AC_MSG_RESULT([yes])
14392     ], [AC_MSG_RESULT([no])], [AC_MSG_RESULT([assumed no (cross compiling)])])
14393 CXX=$save_CXX
14394 CXXFLAGS=$save_CXXFLAGS
14395 AC_LANG_POP([C++])
14397 # ===================================================================
14398 # Creating bigger shared library to link against
14399 # ===================================================================
14400 AC_MSG_CHECKING([whether to create huge library])
14401 MERGELIBS=
14403 if test $_os = iOS -o $_os = Android; then
14404     # Never any point in mergelibs for these as we build just static
14405     # libraries anyway...
14406     enable_mergelibs=no
14409 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
14410     if test $_os != Linux -a $_os != WINNT; then
14411         add_warning "--enable-mergelibs is not tested for this platform"
14412     fi
14413     MERGELIBS="TRUE"
14414     AC_MSG_RESULT([yes])
14415     AC_DEFINE(ENABLE_MERGELIBS)
14416 else
14417     AC_MSG_RESULT([no])
14419 AC_SUBST([MERGELIBS])
14421 dnl ===================================================================
14422 dnl icerun is a wrapper that stops us spawning tens of processes
14423 dnl locally - for tools that can't be executed on the compile cluster
14424 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
14425 dnl ===================================================================
14426 AC_MSG_CHECKING([whether to use icerun wrapper])
14427 ICECREAM_RUN=
14428 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
14429     ICECREAM_RUN=icerun
14430     AC_MSG_RESULT([yes])
14431 else
14432     AC_MSG_RESULT([no])
14434 AC_SUBST(ICECREAM_RUN)
14436 dnl ===================================================================
14437 dnl Setup the ICECC_VERSION for the build the same way it was set for
14438 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
14439 dnl ===================================================================
14440 x_ICECC_VERSION=[\#]
14441 if test -n "$ICECC_VERSION" ; then
14442     x_ICECC_VERSION=
14444 AC_SUBST(x_ICECC_VERSION)
14445 AC_SUBST(ICECC_VERSION)
14447 dnl ===================================================================
14449 AC_MSG_CHECKING([MPL subset])
14450 MPL_SUBSET=
14452 if test "$enable_mpl_subset" = "yes"; then
14453     warn_report=false
14454     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
14455         warn_report=true
14456     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
14457         warn_report=true
14458     fi
14459     if test "$warn_report" = "true"; then
14460         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
14461     fi
14462     if test "x$enable_postgresql_sdbc" != "xno"; then
14463         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
14464     fi
14465     if test "$enable_lotuswordpro" = "yes"; then
14466         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
14467     fi
14468     if test -n "$ENABLE_POPPLER"; then
14469         if test "x$SYSTEM_POPPLER" = "x"; then
14470             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
14471         fi
14472     fi
14473     # cf. m4/libo_check_extension.m4
14474     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
14475         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
14476     fi
14477     for theme in $WITH_THEMES; do
14478         case $theme in
14479         breeze|breeze_dark|breeze_dark_svg|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #denylist of icon themes under GPL or LGPL
14480             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=colibre]) ;;
14481         *) : ;;
14482         esac
14483     done
14485     ENABLE_OPENGL_TRANSITIONS=
14487     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
14488         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
14489     fi
14491     MPL_SUBSET="TRUE"
14492     AC_DEFINE(MPL_HAVE_SUBSET)
14493     AC_MSG_RESULT([only])
14494 else
14495     AC_MSG_RESULT([no restrictions])
14497 AC_SUBST(MPL_SUBSET)
14499 dnl ===================================================================
14501 AC_MSG_CHECKING([formula logger])
14502 ENABLE_FORMULA_LOGGER=
14504 if test "x$enable_formula_logger" = "xyes"; then
14505     AC_MSG_RESULT([yes])
14506     AC_DEFINE(ENABLE_FORMULA_LOGGER)
14507     ENABLE_FORMULA_LOGGER=TRUE
14508 elif test -n "$ENABLE_DBGUTIL" ; then
14509     AC_MSG_RESULT([yes])
14510     AC_DEFINE(ENABLE_FORMULA_LOGGER)
14511     ENABLE_FORMULA_LOGGER=TRUE
14512 else
14513     AC_MSG_RESULT([no])
14516 AC_SUBST(ENABLE_FORMULA_LOGGER)
14518 dnl ===================================================================
14519 dnl Checking for active Antivirus software.
14520 dnl ===================================================================
14522 if test $_os = WINNT -a -f "$SRC_ROOT/antivirusDetection.vbs" ; then
14523     AC_MSG_CHECKING([for active Antivirus software])
14524     ANTIVIRUS_LIST=`cscript.exe //Nologo $SRC_ROOT/antivirusDetection.vbs`
14525     if [ [ "$ANTIVIRUS_LIST" != "NULL" ] ]; then
14526         if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then
14527             AC_MSG_RESULT([found])
14528             EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
14529             echo $EICAR_STRING > $SRC_ROOT/eicar
14530             EICAR_TEMP_FILE_CONTENTS=`cat $SRC_ROOT/eicar`
14531             rm $SRC_ROOT/eicar
14532             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
14533                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
14534             fi
14535             echo $EICAR_STRING > $BUILDDIR/eicar
14536             EICAR_TEMP_FILE_CONTENTS=`cat $BUILDDIR/eicar`
14537             rm $BUILDDIR/eicar
14538             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
14539                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
14540             fi
14541             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"
14542         else
14543             AC_MSG_RESULT([not found])
14544         fi
14545     else
14546         AC_MSG_RESULT([n/a])
14547     fi
14550 dnl ===================================================================
14551 dnl Setting up the environment.
14552 dnl ===================================================================
14553 AC_MSG_NOTICE([setting up the build environment variables...])
14555 AC_SUBST(COMPATH)
14557 if test "$build_os" = "cygwin"; then
14558     if test -d "$COMPATH/atlmfc/lib/spectre"; then
14559         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
14560         ATL_INCLUDE="$COMPATH/atlmfc/include"
14561     elif test -d "$COMPATH/atlmfc/lib"; then
14562         ATL_LIB="$COMPATH/atlmfc/lib"
14563         ATL_INCLUDE="$COMPATH/atlmfc/include"
14564     else
14565         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
14566         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
14567     fi
14568     ATL_LIB="$ATL_LIB/$WIN_HOST_ARCH"
14569     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
14570     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
14572     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
14573     PathFormat "/usr/bin/find.exe"
14574     FIND="$formatted_path"
14575     PathFormat "/usr/bin/sort.exe"
14576     SORT="$formatted_path"
14577     PathFormat "/usr/bin/grep.exe"
14578     WIN_GREP="$formatted_path"
14579     PathFormat "/usr/bin/ls.exe"
14580     WIN_LS="$formatted_path"
14581     PathFormat "/usr/bin/touch.exe"
14582     WIN_TOUCH="$formatted_path"
14583 else
14584     FIND=find
14585     SORT=sort
14588 AC_SUBST(ATL_INCLUDE)
14589 AC_SUBST(ATL_LIB)
14590 AC_SUBST(FIND)
14591 AC_SUBST(SORT)
14592 AC_SUBST(WIN_GREP)
14593 AC_SUBST(WIN_LS)
14594 AC_SUBST(WIN_TOUCH)
14596 AC_SUBST(BUILD_TYPE)
14598 AC_SUBST(SOLARINC)
14600 PathFormat "$PERL"
14601 PERL="$formatted_path"
14602 AC_SUBST(PERL)
14604 if test -n "$TMPDIR"; then
14605     TEMP_DIRECTORY="$TMPDIR"
14606 else
14607     TEMP_DIRECTORY="/tmp"
14609 if test "$build_os" = "cygwin"; then
14610     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
14612 AC_SUBST(TEMP_DIRECTORY)
14614 # setup the PATH for the environment
14615 if test -n "$LO_PATH_FOR_BUILD"; then
14616     LO_PATH="$LO_PATH_FOR_BUILD"
14617     case "$host_os" in
14618     cygwin*|wsl*)
14619         pathmunge "$MSVC_HOST_PATH" "before"
14620         ;;
14621     esac
14622 else
14623     LO_PATH="$PATH"
14625     case "$host_os" in
14627     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
14628         if test "$ENABLE_JAVA" != ""; then
14629             pathmunge "$JAVA_HOME/bin" "after"
14630         fi
14631         ;;
14633     cygwin*|wsl*)
14634         # Win32 make needs native paths
14635         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
14636             LO_PATH=`cygpath -p -m "$PATH"`
14637         fi
14638         if test "$WIN_BUILD_ARCH" = "x64"; then
14639             # needed for msi packaging
14640             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
14641         fi
14642         # .NET 4.6 and higher don't have bin directory
14643         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
14644             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
14645         fi
14646         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
14647         pathmunge "$CSC_PATH" "before"
14648         pathmunge "$MIDL_PATH" "before"
14649         pathmunge "$AL_PATH" "before"
14650         pathmunge "$MSVC_MULTI_PATH" "before"
14651         pathmunge "$MSVC_BUILD_PATH" "before"
14652         if test -n "$MSBUILD_PATH" ; then
14653             pathmunge "$MSBUILD_PATH" "before"
14654         fi
14655         pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/$WIN_BUILD_ARCH" "before"
14656         if test "$ENABLE_JAVA" != ""; then
14657             if test -d "$JAVA_HOME/jre/bin/client"; then
14658                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
14659             fi
14660             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
14661                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
14662             fi
14663             pathmunge "$JAVA_HOME/bin" "before"
14664         fi
14665         pathmunge "$MSVC_HOST_PATH" "before"
14666         ;;
14668     solaris*)
14669         pathmunge "/usr/css/bin" "before"
14670         if test "$ENABLE_JAVA" != ""; then
14671             pathmunge "$JAVA_HOME/bin" "after"
14672         fi
14673         ;;
14674     esac
14677 AC_SUBST(LO_PATH)
14679 # Allow to pass LO_ELFCHECK_ALLOWLIST from autogen.input to bin/check-elf-dynamic-objects:
14680 if test "$LO_ELFCHECK_ALLOWLIST" = x || test "${LO_ELFCHECK_ALLOWLIST-x}" != x; then
14681     x_LO_ELFCHECK_ALLOWLIST=
14682 else
14683     x_LO_ELFCHECK_ALLOWLIST=[\#]
14685 AC_SUBST(x_LO_ELFCHECK_ALLOWLIST)
14686 AC_SUBST(LO_ELFCHECK_ALLOWLIST)
14688 libo_FUZZ_SUMMARY
14690 # Generate a configuration sha256 we can use for deps
14691 if test -f config_host.mk; then
14692     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
14694 if test -f config_host_lang.mk; then
14695     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
14698 CFLAGS=$my_original_CFLAGS
14699 CXXFLAGS=$my_original_CXXFLAGS
14700 CPPFLAGS=$my_original_CPPFLAGS
14702 AC_CONFIG_LINKS([include:include])
14704 # Keep in sync with list of files far up, at AC_MSG_CHECKING([for
14705 # BUILD platform configuration] - otherwise breaks cross building
14706 AC_CONFIG_FILES([config_host.mk
14707                  config_host_lang.mk
14708                  Makefile
14709                  bin/bffvalidator.sh
14710                  bin/odfvalidator.sh
14711                  bin/officeotron.sh
14712                  hardened_runtime.xcent
14713                  instsetoo_native/util/openoffice.lst
14714                  sysui/desktop/macosx/Info.plist
14715                  vs-code.code-workspace.template:.vscode/vs-code-template.code-workspace.in])
14716 AC_CONFIG_HEADERS([config_host/config_buildid.h])
14717 AC_CONFIG_HEADERS([config_host/config_box2d.h])
14718 AC_CONFIG_HEADERS([config_host/config_clang.h])
14719 AC_CONFIG_HEADERS([config_host/config_crypto.h])
14720 AC_CONFIG_HEADERS([config_host/config_dconf.h])
14721 AC_CONFIG_HEADERS([config_host/config_eot.h])
14722 AC_CONFIG_HEADERS([config_host/config_extensions.h])
14723 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
14724 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
14725 AC_CONFIG_HEADERS([config_host/config_dbus.h])
14726 AC_CONFIG_HEADERS([config_host/config_features.h])
14727 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
14728 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
14729 AC_CONFIG_HEADERS([config_host/config_firebird.h])
14730 AC_CONFIG_HEADERS([config_host/config_folders.h])
14731 AC_CONFIG_HEADERS([config_host/config_fonts.h])
14732 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
14733 AC_CONFIG_HEADERS([config_host/config_gio.h])
14734 AC_CONFIG_HEADERS([config_host/config_global.h])
14735 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
14736 AC_CONFIG_HEADERS([config_host/config_java.h])
14737 AC_CONFIG_HEADERS([config_host/config_langs.h])
14738 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
14739 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
14740 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
14741 AC_CONFIG_HEADERS([config_host/config_locales.h])
14742 AC_CONFIG_HEADERS([config_host/config_mpl.h])
14743 AC_CONFIG_HEADERS([config_host/config_oox.h])
14744 AC_CONFIG_HEADERS([config_host/config_options.h])
14745 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
14746 AC_CONFIG_HEADERS([config_host/config_zxing.h])
14747 AC_CONFIG_HEADERS([config_host/config_skia.h])
14748 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
14749 AC_CONFIG_HEADERS([config_host/config_vendor.h])
14750 AC_CONFIG_HEADERS([config_host/config_vcl.h])
14751 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
14752 AC_CONFIG_HEADERS([config_host/config_version.h])
14753 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
14754 AC_CONFIG_HEADERS([config_host/config_poppler.h])
14755 AC_CONFIG_HEADERS([config_host/config_python.h])
14756 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
14757 AC_CONFIG_HEADERS([config_host/config_wasm_strip.h])
14758 AC_CONFIG_HEADERS([solenv/lockfile/autoconf.h])
14759 AC_OUTPUT
14761 if test "$CROSS_COMPILING" = TRUE; then
14762     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
14765 # touch the config timestamp file
14766 if test ! -f config_host.mk.stamp; then
14767     echo > config_host.mk.stamp
14768 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
14769     echo "Host Configuration unchanged - avoiding scp2 stamp update"
14770 else
14771     echo > config_host.mk.stamp
14774 # touch the config lang timestamp file
14775 if test ! -f config_host_lang.mk.stamp; then
14776     echo > config_host_lang.mk.stamp
14777 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
14778     echo "Language Configuration unchanged - avoiding scp2 stamp update"
14779 else
14780     echo > config_host_lang.mk.stamp
14784 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
14785         -a "$build_os" = "cygwin"; then
14787 cat << _EOS
14788 ****************************************************************************
14789 WARNING:
14790 Your make version is known to be horribly slow, and hard to debug
14791 problems with. To get a reasonably functional make please do:
14793 to install a pre-compiled binary make for Win32
14795  mkdir -p /opt/lo/bin
14796  cd /opt/lo/bin
14797  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
14798  cp make-4.2.1-msvc.exe make
14799  chmod +x make
14801 to install from source:
14802 place yourself in a working directory of you choice.
14804  git clone git://git.savannah.gnu.org/make.git
14806  [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"]
14807  set PATH=%PATH%;C:\Cygwin\bin
14808  [or Cygwin64, if that is what you have]
14809  cd path-to-make-repo-you-cloned-above
14810  build_w32.bat --without-guile
14812 should result in a WinRel/gnumake.exe.
14813 Copy it to the Cygwin /opt/lo/bin directory as make.exe
14815 Then re-run autogen.sh
14817 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
14818 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
14820 _EOS
14821 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
14822     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
14827 cat << _EOF
14828 ****************************************************************************
14830 To show information on various make targets and make flags, run:
14831 $GNUMAKE help
14833 To just build, run:
14834 $GNUMAKE
14836 _EOF
14838 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
14839     cat << _EOF
14840 After the build has finished successfully, you can immediately run what you built using the command:
14841 _EOF
14843     if test $_os = Darwin; then
14844         echo open instdir/$PRODUCTNAME_WITHOUT_SPACES.app
14845     else
14846         echo instdir/program/soffice
14847     fi
14848     cat << _EOF
14850 If you want to run the unit tests, run:
14851 $GNUMAKE check
14853 _EOF
14856 if test -s "$WARNINGS_FILE_FOR_BUILD"; then
14857     echo "BUILD / cross-toolset config, repeated ($WARNINGS_FILE_FOR_BUILD)"
14858     cat "$WARNINGS_FILE_FOR_BUILD"
14859     echo
14862 if test -s "$WARNINGS_FILE"; then
14863     echo "HOST config ($WARNINGS_FILE)"
14864     cat "$WARNINGS_FILE"
14867 # Remove unneeded emconfigure artifacts
14868 rm -f a.out a.wasm a.out.js a.out.wasm
14870 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: