Deduplicate rtl_uString_newReplaceFirst*
[LibreOffice.git] / configure.ac
blobaccb60493657a93bfb5076170b56332bb7cb531b
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, *colibre, *colibre_svg, *elementary,
2108          *elementary_svg, *karasa_jaga, *karasa_jaga_svg, *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg, *sukapura, *sukapura_svg.]),
2111 libo_FUZZ_ARG_WITH(helppack-integration,
2112     AS_HELP_STRING([--without-helppack-integration],
2113         [It will not integrate the helppacks to the installer
2114          of the product. Please use this switch to use the online help
2115          or separate help packages.]),
2118 libo_FUZZ_ARG_WITH(fonts,
2119     AS_HELP_STRING([--without-fonts],
2120         [LibreOffice includes some third-party fonts to provide a reliable basis for
2121          help content, templates, samples, etc. When these fonts are already
2122          known to be available on the system then you should use this option.]),
2125 AC_ARG_WITH(epm,
2126     AS_HELP_STRING([--with-epm],
2127         [Decides which epm to use. Default is to use the one from the system if
2128          one is built. When either this is not there or you say =internal epm
2129          will be built.]),
2132 AC_ARG_WITH(package-format,
2133     AS_HELP_STRING([--with-package-format],
2134         [Specify package format(s) for LibreOffice installation sets. The
2135          implicit --without-package-format leads to no installation sets being
2136          generated. Possible values: aix, archive, bsd, deb, dmg,
2137          installed, msi, pkg, and rpm.
2138          Example: --with-package-format='deb rpm']),
2141 AC_ARG_WITH(tls,
2142     AS_HELP_STRING([--with-tls],
2143         [Decides which TLS/SSL and cryptographic implementations to use for
2144          LibreOffice's code. Notice that this doesn't apply for depending
2145          libraries like "curl", for example. Default is to use NSS
2146          although OpenSSL is also possible. Notice that selecting NSS restricts
2147          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
2148          restrict by now the usage of NSS in LO's code. Possible values:
2149          openssl, nss. Example: --with-tls="nss"]),
2152 AC_ARG_WITH(system-libs,
2153     AS_HELP_STRING([--with-system-libs],
2154         [Use libraries already on system -- enables all --with-system-* flags.]),
2157 AC_ARG_WITH(system-bzip2,
2158     AS_HELP_STRING([--with-system-bzip2],
2159         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
2160     [with_system_bzip2="$with_system_libs"])
2162 AC_ARG_WITH(system-headers,
2163     AS_HELP_STRING([--with-system-headers],
2164         [Use headers already on system -- enables all --with-system-* flags for
2165          external packages whose headers are the only entities used i.e.
2166          boost/odbc/sane-header(s).]),,
2167     [with_system_headers="$with_system_libs"])
2169 AC_ARG_WITH(system-jars,
2170     AS_HELP_STRING([--without-system-jars],
2171         [When building with --with-system-libs, also the needed jars are expected
2172          on the system. Use this to disable that]),,
2173     [with_system_jars="$with_system_libs"])
2175 AC_ARG_WITH(system-cairo,
2176     AS_HELP_STRING([--with-system-cairo],
2177         [Use cairo libraries already on system.  Happens automatically for
2178          (implicit) --enable-gtk3.]))
2180 AC_ARG_WITH(system-epoxy,
2181     AS_HELP_STRING([--with-system-epoxy],
2182         [Use epoxy libraries already on system.  Happens automatically for
2183          (implicit) --enable-gtk3.]),,
2184        [with_system_epoxy="$with_system_libs"])
2186 AC_ARG_WITH(myspell-dicts,
2187     AS_HELP_STRING([--with-myspell-dicts],
2188         [Adds myspell dictionaries to the LibreOffice installation set]),
2191 AC_ARG_WITH(system-dicts,
2192     AS_HELP_STRING([--without-system-dicts],
2193         [Do not use dictionaries from system paths.]),
2196 AC_ARG_WITH(external-dict-dir,
2197     AS_HELP_STRING([--with-external-dict-dir],
2198         [Specify external dictionary dir.]),
2201 AC_ARG_WITH(external-hyph-dir,
2202     AS_HELP_STRING([--with-external-hyph-dir],
2203         [Specify external hyphenation pattern dir.]),
2206 AC_ARG_WITH(external-thes-dir,
2207     AS_HELP_STRING([--with-external-thes-dir],
2208         [Specify external thesaurus dir.]),
2211 AC_ARG_WITH(system-zlib,
2212     AS_HELP_STRING([--with-system-zlib],
2213         [Use zlib already on system.]),,
2214     [with_system_zlib=auto])
2216 AC_ARG_WITH(system-jpeg,
2217     AS_HELP_STRING([--with-system-jpeg],
2218         [Use jpeg already on system.]),,
2219     [with_system_jpeg="$with_system_libs"])
2221 AC_ARG_WITH(system-expat,
2222     AS_HELP_STRING([--with-system-expat],
2223         [Use expat already on system.]),,
2224     [with_system_expat="$with_system_libs"])
2226 AC_ARG_WITH(system-libxml,
2227     AS_HELP_STRING([--with-system-libxml],
2228         [Use libxml/libxslt already on system.]),,
2229     [with_system_libxml=auto])
2231 AC_ARG_WITH(system-ucpp,
2232     AS_HELP_STRING([--with-system-ucpp],
2233         [Use ucpp already on system.]),,
2234     [])
2236 AC_ARG_WITH(system-openldap,
2237     AS_HELP_STRING([--with-system-openldap],
2238         [Use the OpenLDAP LDAP SDK already on system.]),,
2239     [with_system_openldap="$with_system_libs"])
2241 libo_FUZZ_ARG_ENABLE(poppler,
2242     AS_HELP_STRING([--disable-poppler],
2243         [Disable building Poppler.])
2246 AC_ARG_WITH(system-poppler,
2247     AS_HELP_STRING([--with-system-poppler],
2248         [Use system poppler (only needed for PDF import).]),,
2249     [with_system_poppler="$with_system_libs"])
2251 AC_ARG_WITH(system-abseil,
2252     AS_HELP_STRING([--with-system-abseil],
2253         [Use the abseil libraries already on system.]),,
2254     [with_system_abseil="$with_system_libs"])
2256 AC_ARG_WITH(system-openjpeg,
2257     AS_HELP_STRING([--with-system-openjpeg],
2258         [Use the OpenJPEG library already on system.]),,
2259     [with_system_openjpeg="$with_system_libs"])
2261 libo_FUZZ_ARG_ENABLE(gpgmepp,
2262     AS_HELP_STRING([--disable-gpgmepp],
2263         [Disable building gpgmepp. Do not use in normal cases unless you want to fix potential problems it causes.])
2266 AC_ARG_WITH(system-gpgmepp,
2267     AS_HELP_STRING([--with-system-gpgmepp],
2268         [Use gpgmepp already on system]),,
2269     [with_system_gpgmepp="$with_system_libs"])
2271 AC_ARG_WITH(system-mariadb,
2272     AS_HELP_STRING([--with-system-mariadb],
2273         [Use MariaDB/MySQL libraries already on system.]),,
2274     [with_system_mariadb="$with_system_libs"])
2276 AC_ARG_ENABLE(bundle-mariadb,
2277     AS_HELP_STRING([--enable-bundle-mariadb],
2278         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
2281 AC_ARG_WITH(system-postgresql,
2282     AS_HELP_STRING([--with-system-postgresql],
2283         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
2284          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
2285     [with_system_postgresql="$with_system_libs"])
2287 AC_ARG_WITH(libpq-path,
2288     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
2289         [Use this PostgreSQL C interface (libpq) installation for building
2290          the PostgreSQL-SDBC extension.]),
2293 AC_ARG_WITH(system-firebird,
2294     AS_HELP_STRING([--with-system-firebird],
2295         [Use Firebird libraries already on system, for building the Firebird-SDBC
2296          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
2297     [with_system_firebird="$with_system_libs"])
2299 AC_ARG_WITH(system-libtommath,
2300             AS_HELP_STRING([--with-system-libtommath],
2301                            [Use libtommath already on system]),,
2302             [with_system_libtommath="$with_system_libs"])
2304 AC_ARG_WITH(system-hsqldb,
2305     AS_HELP_STRING([--with-system-hsqldb],
2306         [Use hsqldb already on system.]))
2308 AC_ARG_WITH(hsqldb-jar,
2309     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
2310         [Specify path to jarfile manually.]),
2311     HSQLDB_JAR=$withval)
2313 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
2314     AS_HELP_STRING([--disable-scripting-beanshell],
2315         [Disable support for scripts in BeanShell.]),
2319 AC_ARG_WITH(system-beanshell,
2320     AS_HELP_STRING([--with-system-beanshell],
2321         [Use beanshell already on system.]),,
2322     [with_system_beanshell="$with_system_jars"])
2324 AC_ARG_WITH(beanshell-jar,
2325     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
2326         [Specify path to jarfile manually.]),
2327     BSH_JAR=$withval)
2329 libo_FUZZ_ARG_ENABLE(scripting-javascript,
2330     AS_HELP_STRING([--disable-scripting-javascript],
2331         [Disable support for scripts in JavaScript.]),
2335 AC_ARG_WITH(system-rhino,
2336     AS_HELP_STRING([--with-system-rhino],
2337         [Use rhino already on system.]),,)
2338 #    [with_system_rhino="$with_system_jars"])
2339 # Above is not used as we have different debug interface
2340 # patched into internal rhino. This code needs to be fixed
2341 # before we can enable it by default.
2343 AC_ARG_WITH(rhino-jar,
2344     AS_HELP_STRING([--with-rhino-jar=JARFILE],
2345         [Specify path to jarfile manually.]),
2346     RHINO_JAR=$withval)
2348 AC_ARG_WITH(system-jfreereport,
2349     AS_HELP_STRING([--with-system-jfreereport],
2350         [Use JFreeReport already on system.]),,
2351     [with_system_jfreereport="$with_system_jars"])
2353 AC_ARG_WITH(sac-jar,
2354     AS_HELP_STRING([--with-sac-jar=JARFILE],
2355         [Specify path to jarfile manually.]),
2356     SAC_JAR=$withval)
2358 AC_ARG_WITH(libxml-jar,
2359     AS_HELP_STRING([--with-libxml-jar=JARFILE],
2360         [Specify path to jarfile manually.]),
2361     LIBXML_JAR=$withval)
2363 AC_ARG_WITH(flute-jar,
2364     AS_HELP_STRING([--with-flute-jar=JARFILE],
2365         [Specify path to jarfile manually.]),
2366     FLUTE_JAR=$withval)
2368 AC_ARG_WITH(jfreereport-jar,
2369     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
2370         [Specify path to jarfile manually.]),
2371     JFREEREPORT_JAR=$withval)
2373 AC_ARG_WITH(liblayout-jar,
2374     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
2375         [Specify path to jarfile manually.]),
2376     LIBLAYOUT_JAR=$withval)
2378 AC_ARG_WITH(libloader-jar,
2379     AS_HELP_STRING([--with-libloader-jar=JARFILE],
2380         [Specify path to jarfile manually.]),
2381     LIBLOADER_JAR=$withval)
2383 AC_ARG_WITH(libformula-jar,
2384     AS_HELP_STRING([--with-libformula-jar=JARFILE],
2385         [Specify path to jarfile manually.]),
2386     LIBFORMULA_JAR=$withval)
2388 AC_ARG_WITH(librepository-jar,
2389     AS_HELP_STRING([--with-librepository-jar=JARFILE],
2390         [Specify path to jarfile manually.]),
2391     LIBREPOSITORY_JAR=$withval)
2393 AC_ARG_WITH(libfonts-jar,
2394     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
2395         [Specify path to jarfile manually.]),
2396     LIBFONTS_JAR=$withval)
2398 AC_ARG_WITH(libserializer-jar,
2399     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
2400         [Specify path to jarfile manually.]),
2401     LIBSERIALIZER_JAR=$withval)
2403 AC_ARG_WITH(libbase-jar,
2404     AS_HELP_STRING([--with-libbase-jar=JARFILE],
2405         [Specify path to jarfile manually.]),
2406     LIBBASE_JAR=$withval)
2408 AC_ARG_WITH(system-odbc,
2409     AS_HELP_STRING([--with-system-odbc],
2410         [Use the odbc headers already on system.]),,
2411     [with_system_odbc="auto"])
2413 AC_ARG_WITH(system-sane,
2414     AS_HELP_STRING([--with-system-sane],
2415         [Use sane.h already on system.]),,
2416     [with_system_sane="$with_system_headers"])
2418 AC_ARG_WITH(system-bluez,
2419     AS_HELP_STRING([--with-system-bluez],
2420         [Use bluetooth.h already on system.]),,
2421     [with_system_bluez="$with_system_headers"])
2423 AC_ARG_WITH(system-boost,
2424     AS_HELP_STRING([--with-system-boost],
2425         [Use boost already on system.]),,
2426     [with_system_boost="$with_system_headers"])
2428 AC_ARG_WITH(system-cuckoo,
2429     AS_HELP_STRING([--with-system-cuckoo],
2430         [Use libcuckoo already on system.]),,
2431     [with_system_cuckoo="$with_system_headers"])
2433 AC_ARG_WITH(system-dragonbox,
2434     AS_HELP_STRING([--with-system-dragonbox],
2435         [Use dragonbox already on system.]),,
2436     [with_system_dragonbox="$with_system_headers"])
2438 AC_ARG_WITH(system-glm,
2439     AS_HELP_STRING([--with-system-glm],
2440         [Use glm already on system.]),,
2441     [with_system_glm="$with_system_headers"])
2443 AC_ARG_WITH(system-hunspell,
2444     AS_HELP_STRING([--with-system-hunspell],
2445         [Use libhunspell already on system.]),,
2446     [with_system_hunspell="$with_system_libs"])
2448 libo_FUZZ_ARG_ENABLE(zxing,
2449     AS_HELP_STRING([--disable-zxing],
2450        [Disable use of zxing external library.]))
2452 AC_ARG_WITH(system-zxing,
2453     AS_HELP_STRING([--with-system-zxing],
2454         [Use libzxing already on system.]),,
2455     [with_system_zxing="$with_system_libs"])
2457 AC_ARG_WITH(system-box2d,
2458     AS_HELP_STRING([--with-system-box2d],
2459         [Use box2d already on system.]),,
2460     [with_system_box2d="$with_system_libs"])
2462 AC_ARG_WITH(system-mythes,
2463     AS_HELP_STRING([--with-system-mythes],
2464         [Use mythes already on system.]),,
2465     [with_system_mythes="$with_system_libs"])
2467 AC_ARG_WITH(system-altlinuxhyph,
2468     AS_HELP_STRING([--with-system-altlinuxhyph],
2469         [Use ALTLinuxhyph already on system.]),,
2470     [with_system_altlinuxhyph="$with_system_libs"])
2472 AC_ARG_WITH(system-lpsolve,
2473     AS_HELP_STRING([--with-system-lpsolve],
2474         [Use lpsolve already on system.]),,
2475     [with_system_lpsolve="$with_system_libs"])
2477 AC_ARG_WITH(system-coinmp,
2478     AS_HELP_STRING([--with-system-coinmp],
2479         [Use CoinMP already on system.]),,
2480     [with_system_coinmp="$with_system_libs"])
2482 AC_ARG_WITH(system-liblangtag,
2483     AS_HELP_STRING([--with-system-liblangtag],
2484         [Use liblangtag library already on system.]),,
2485     [with_system_liblangtag="$with_system_libs"])
2487 AC_ARG_WITH(system-lockfile,
2488     AS_HELP_STRING([--with-system-lockfile[=file]],
2489         [Detect a system lockfile program or use the \$file argument.]))
2491 AC_ARG_WITH(webdav,
2492     AS_HELP_STRING([--without-webdav],
2493         [Disable WebDAV support in the UCB.]))
2495 AC_ARG_WITH(linker-hash-style,
2496     AS_HELP_STRING([--with-linker-hash-style],
2497         [Use linker with --hash-style=<style> when linking shared objects.
2498          Possible values: "sysv", "gnu", "both". The default value is "gnu"
2499          if supported on the build system, and "sysv" otherwise.]))
2501 AC_ARG_WITH(jdk-home,
2502     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
2503         [If you have installed JDK 9 or later on your system please supply the
2504          path here. Note that this is not the location of the java command but the
2505          location of the entire distribution. In case of cross-compiling, this
2506          is the JDK of the host os. Use --with-build-platform-configure-options
2507          to point to a different build platform JDK.]),
2510 AC_ARG_WITH(help,
2511     AS_HELP_STRING([--with-help],
2512         [Enable the build of help. There is a special parameter "common" that
2513          can be used to bundle only the common part, .e.g help-specific icons.
2514          This is useful when you build the helpcontent separately.])
2515     [
2516                           Usage:     --with-help    build the old local help
2517                                  --without-help     no local help (default)
2518                                  --with-help=html   build the new HTML local help
2519                                  --with-help=online build the new HTML online help
2520     ],
2523 AC_ARG_WITH(omindex,
2524    AS_HELP_STRING([--with-omindex],
2525         [Enable the support of xapian-omega index for online help.])
2526    [
2527                          Usage: --with-omindex=server prepare the pages for omindex
2528                                 but let xapian-omega be built in server.
2529                                 --with-omindex=noxap do not prepare online pages
2530                                 for xapian-omega
2531   ],
2534 libo_FUZZ_ARG_WITH(java,
2535     AS_HELP_STRING([--with-java=<java command>],
2536         [Specify the name of the Java interpreter command. Typically "java"
2537          which is the default.
2539          To build without support for Java components, applets, accessibility
2540          or the XML filters written in Java, use --without-java or --with-java=no.]),
2541     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2542     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2545 AC_ARG_WITH(jvm-path,
2546     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2547         [Use a specific JVM search path at runtime.
2548          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2551 AC_ARG_WITH(ant-home,
2552     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2553         [If you have installed Apache Ant on your system, please supply the path here.
2554          Note that this is not the location of the Ant binary but the location
2555          of the entire distribution.]),
2558 AC_ARG_WITH(symbol-config,
2559     AS_HELP_STRING([--with-symbol-config],
2560         [Configuration for the crashreport symbol upload]),
2561         [],
2562         [with_symbol_config=no])
2564 AC_ARG_WITH(export-validation,
2565     AS_HELP_STRING([--without-export-validation],
2566         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2567 ,with_export_validation=auto)
2569 AC_ARG_WITH(bffvalidator,
2570     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2571         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2572          Requires installed Microsoft Office Binary File Format Validator.
2573          Note: export-validation (--with-export-validation) is required to be turned on.
2574          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2575 ,with_bffvalidator=no)
2577 libo_FUZZ_ARG_WITH(junit,
2578     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2579         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2580          --without-junit disables those tests. Not relevant in the --without-java case.]),
2581 ,with_junit=yes)
2583 AC_ARG_WITH(hamcrest,
2584     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2585         [Specifies the hamcrest jar file to use for JUnit-based tests.
2586          --without-junit disables those tests. Not relevant in the --without-java case.]),
2587 ,with_hamcrest=yes)
2589 AC_ARG_WITH(perl-home,
2590     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2591         [If you have installed Perl 5 Distribution, on your system, please
2592          supply the path here. Note that this is not the location of the Perl
2593          binary but the location of the entire distribution.]),
2596 libo_FUZZ_ARG_WITH(doxygen,
2597     AS_HELP_STRING(
2598         [--with-doxygen=<absolute path to doxygen executable>],
2599         [Specifies the doxygen executable to use when generating ODK C/C++
2600          documentation. --without-doxygen disables generation of ODK C/C++
2601          documentation. Not relevant in the --disable-odk case.]),
2602 ,with_doxygen=yes)
2604 AC_ARG_WITH(visual-studio,
2605     AS_HELP_STRING([--with-visual-studio=<2019/2022>],
2606         [Specify which Visual Studio version to use in case several are
2607          installed. Currently 2019 (default) and 2022 are supported.]),
2610 AC_ARG_WITH(windows-sdk,
2611     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10.0>],
2612         [Specify which Windows SDK, or "Windows Kit", version to use
2613          in case the one that came with the selected Visual Studio
2614          is not what you want for some reason. Note that not all compiler/SDK
2615          combinations are supported. The intent is that this option should not
2616          be needed.]),
2619 AC_ARG_WITH(lang,
2620     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2621         [Use this option to build LibreOffice with additional UI language support.
2622          English (US) is always included by default.
2623          Separate multiple languages with space.
2624          For all languages, use --with-lang=ALL.]),
2627 AC_ARG_WITH(locales,
2628     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2629         [Use this option to limit the locale information built in.
2630          Separate multiple locales with space.
2631          Very experimental and might well break stuff.
2632          Just a desperate measure to shrink code and data size.
2633          By default all the locales available is included.
2634          Just works with --disable-dynloading. Defaults to "ALL".
2635          This option is completely unrelated to --with-lang.])
2636     [
2637                           Affects also our character encoding conversion
2638                           tables for encodings mainly targeted for a
2639                           particular locale, like EUC-CN and EUC-TW for
2640                           zh, ISO-2022-JP for ja.
2642                           Affects also our add-on break iterator data for
2643                           some languages.
2645                           For the default, all locales, don't use this switch at all.
2646                           Specifying just the language part of a locale means all matching
2647                           locales will be included.
2648     ],
2651 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2652 libo_FUZZ_ARG_WITH(krb5,
2653     AS_HELP_STRING([--with-krb5],
2654         [Enable MIT Kerberos 5 support in modules that support it.
2655          By default automatically enabled on platforms
2656          where a good system Kerberos 5 is available.]),
2659 libo_FUZZ_ARG_WITH(gssapi,
2660     AS_HELP_STRING([--with-gssapi],
2661         [Enable GSSAPI support in modules that support it.
2662          By default automatically enabled on platforms
2663          where a good system GSSAPI is available.]),
2666 AC_ARG_WITH(iwyu,
2667     AS_HELP_STRING([--with-iwyu],
2668         [Use given IWYU binary path to check unneeded includes instead of building.
2669          Use only if you are hacking on it.]),
2672 libo_FUZZ_ARG_WITH(lxml,
2673     AS_HELP_STRING([--without-lxml],
2674         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2675          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2676          report widget classes and ids.]),
2679 libo_FUZZ_ARG_WITH(latest-c++,
2680     AS_HELP_STRING([--with-latest-c++],
2681         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2682          published standard.]),,
2683         [with_latest_c__=no])
2685 dnl ===================================================================
2686 dnl Branding
2687 dnl ===================================================================
2689 AC_ARG_WITH(branding,
2690     AS_HELP_STRING([--with-branding=/path/to/images],
2691         [Use given path to retrieve branding images set.])
2692     [
2693                           Search for intro.png about.svg and logo.svg.
2694                           If any is missing, default ones will be used instead.
2696                           Search also progress.conf for progress
2697                           settings on intro screen :
2699                           PROGRESSBARCOLOR="255,255,255" Set color of
2700                           progress bar. Comma separated RGB decimal values.
2701                           PROGRESSSIZE="407,6" Set size of progress bar.
2702                           Comma separated decimal values (width, height).
2703                           PROGRESSPOSITION="61,317" Set position of progress
2704                           bar from left,top. Comma separated decimal values.
2705                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2706                           bar frame. Comma separated RGB decimal values.
2707                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2708                           bar text. Comma separated RGB decimal values.
2709                           PROGRESSTEXTBASELINE="287" Set vertical position of
2710                           progress bar text from top. Decimal value.
2712                           Default values will be used if not found.
2713     ],
2717 AC_ARG_WITH(extra-buildid,
2718     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2719         [Show addition build identification in about dialog.]),
2723 AC_ARG_WITH(vendor,
2724     AS_HELP_STRING([--with-vendor="John the Builder"],
2725         [Set vendor of the build.]),
2728 AC_ARG_WITH(privacy-policy-url,
2729     AS_HELP_STRING([--with-privacy-policy-url="https://yourdomain/privacy-policy"],
2730         [The URL to your privacy policy (needed when
2731          enabling online-update or crashreporting via breakpad)]),
2732         [if test "x$with_privacy_policy_url" = "xyes"; then
2733             AC_MSG_FAILURE([you need to specify an argument when using --with-privacy-policy-url])
2734          elif test "x$with_privacy_policy_url" = "xno"; then
2735             with_privacy_policy_url="undefined"
2736          fi]
2737 ,[with_privacy_policy_url="undefined"])
2739 AC_ARG_WITH(android-package-name,
2740     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2741         [Set Android package name of the build.]),
2744 AC_ARG_WITH(compat-oowrappers,
2745     AS_HELP_STRING([--with-compat-oowrappers],
2746         [Install oo* wrappers in parallel with
2747          lo* ones to keep backward compatibility.
2748          Has effect only with make distro-pack-install]),
2751 AC_ARG_WITH(os-version,
2752     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2753         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2756 AC_ARG_WITH(idlc-cpp,
2757     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2758         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2761 AC_ARG_WITH(parallelism,
2762     AS_HELP_STRING([--with-parallelism],
2763         [Number of jobs to run simultaneously during build. Parallel builds can
2764         save a lot of time on multi-cpu machines. Defaults to the number of
2765         CPUs on the machine, unless you configure --enable-icecream - then to
2766         40.]),
2769 AC_ARG_WITH(all-tarballs,
2770     AS_HELP_STRING([--with-all-tarballs],
2771         [Download all external tarballs unconditionally]))
2773 AC_ARG_WITH(gdrive-client-id,
2774     AS_HELP_STRING([--with-gdrive-client-id],
2775         [Provides the client id of the application for OAuth2 authentication
2776         on Google Drive. If either this or --with-gdrive-client-secret is
2777         empty, the feature will be disabled]),
2780 AC_ARG_WITH(gdrive-client-secret,
2781     AS_HELP_STRING([--with-gdrive-client-secret],
2782         [Provides the client secret of the application for OAuth2
2783         authentication on Google Drive. If either this or
2784         --with-gdrive-client-id is empty, the feature will be disabled]),
2787 AC_ARG_WITH(alfresco-cloud-client-id,
2788     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2789         [Provides the client id of the application for OAuth2 authentication
2790         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2791         empty, the feature will be disabled]),
2794 AC_ARG_WITH(alfresco-cloud-client-secret,
2795     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2796         [Provides the client secret of the application for OAuth2
2797         authentication on Alfresco Cloud. If either this or
2798         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2801 AC_ARG_WITH(onedrive-client-id,
2802     AS_HELP_STRING([--with-onedrive-client-id],
2803         [Provides the client id of the application for OAuth2 authentication
2804         on OneDrive. If either this or --with-onedrive-client-secret is
2805         empty, the feature will be disabled]),
2808 AC_ARG_WITH(onedrive-client-secret,
2809     AS_HELP_STRING([--with-onedrive-client-secret],
2810         [Provides the client secret of the application for OAuth2
2811         authentication on OneDrive. If either this or
2812         --with-onedrive-client-id is empty, the feature will be disabled]),
2814 dnl ===================================================================
2815 dnl Do we want to use pre-build binary tarball for recompile
2816 dnl ===================================================================
2818 if test "$enable_library_bin_tar" = "yes" ; then
2819     USE_LIBRARY_BIN_TAR=TRUE
2820 else
2821     USE_LIBRARY_BIN_TAR=
2823 AC_SUBST(USE_LIBRARY_BIN_TAR)
2825 dnl ===================================================================
2826 dnl Test whether build target is Release Build
2827 dnl ===================================================================
2828 AC_MSG_CHECKING([whether build target is Release Build])
2829 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2830     AC_MSG_RESULT([no])
2831     ENABLE_RELEASE_BUILD=
2832     GET_TASK_ALLOW_ENTITLEMENT='
2833         <!-- We want to be able to debug a hardened process when not building for release -->
2834         <key>com.apple.security.get-task-allow</key>
2835         <true/>'
2836 else
2837     AC_MSG_RESULT([yes])
2838     ENABLE_RELEASE_BUILD=TRUE
2839     GET_TASK_ALLOW_ENTITLEMENT=''
2841 AC_SUBST(ENABLE_RELEASE_BUILD)
2842 AC_SUBST(GET_TASK_ALLOW_ENTITLEMENT)
2844 AC_MSG_CHECKING([whether to build a Community flavor])
2845 if test -z "$enable_community_flavor" -o "$enable_community_flavor" = "yes"; then
2846     AC_DEFINE(HAVE_FEATURE_COMMUNITY_FLAVOR)
2847     AC_MSG_RESULT([yes])
2848 else
2849     AC_MSG_RESULT([no])
2852 dnl ===================================================================
2853 dnl Test whether to sign Windows Build
2854 dnl ===================================================================
2855 AC_MSG_CHECKING([whether to sign windows build])
2856 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2857     AC_MSG_RESULT([yes])
2858     WINDOWS_BUILD_SIGNING="TRUE"
2859 else
2860     AC_MSG_RESULT([no])
2861     WINDOWS_BUILD_SIGNING="FALSE"
2863 AC_SUBST(WINDOWS_BUILD_SIGNING)
2865 dnl ===================================================================
2866 dnl MacOSX build and runtime environment options
2867 dnl ===================================================================
2869 AC_ARG_WITH(macosx-version-min-required,
2870     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2871         [set the minimum OS version needed to run the built LibreOffice])
2872     [
2873                           e. g.: --with-macosx-version-min-required=10.13
2874     ],
2877 dnl ===================================================================
2878 dnl Check for incompatible options set by fuzzing, and reset those
2879 dnl automatically to working combinations
2880 dnl ===================================================================
2882 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2883         "$enable_dbus" != "$enable_avahi"; then
2884     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2885     enable_avahi=$enable_dbus
2888 add_lopath_after ()
2890     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2891         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2892     fi
2895 add_lopath_before ()
2897     local IFS=${P_SEP}
2898     local path_cleanup
2899     local dir
2900     for dir in $LO_PATH ; do
2901         if test "$dir" != "$1" ; then
2902             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2903         fi
2904     done
2905     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2908 dnl ===================================================================
2909 dnl check for required programs (grep, awk, sed, bash)
2910 dnl ===================================================================
2912 pathmunge ()
2914     local new_path
2915     if test -n "$1"; then
2916         if test "$build_os" = "cygwin"; then
2917             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2918                 PathFormat "$1"
2919                 new_path=`cygpath -sm "$formatted_path"`
2920             else
2921                 PathFormat "$1"
2922                 new_path=`cygpath -u "$formatted_path"`
2923             fi
2924         else
2925             new_path="$1"
2926         fi
2927         if test "$2" = "after"; then
2928             add_lopath_after "$new_path"
2929         else
2930             add_lopath_before "$new_path"
2931         fi
2932     fi
2935 AC_PROG_AWK
2936 AC_PATH_PROG( AWK, $AWK)
2937 if test -z "$AWK"; then
2938     AC_MSG_ERROR([install awk to run this script])
2941 AC_PATH_PROG(BASH, bash)
2942 if test -z "$BASH"; then
2943     AC_MSG_ERROR([bash not found in \$PATH])
2945 AC_SUBST(BASH)
2947 # prefer parallel compression tools, if available
2948 AC_PATH_PROG(COMPRESSIONTOOL, pigz)
2949 if test -z "$COMPRESSIONTOOL"; then
2950     AC_PATH_PROG(COMPRESSIONTOOL, gzip)
2951     if test -z "$COMPRESSIONTOOL"; then
2952         AC_MSG_ERROR([gzip not found in \$PATH])
2953     fi
2955 AC_SUBST(COMPRESSIONTOOL)
2957 AC_MSG_CHECKING([for GNU or BSD tar])
2958 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2959     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2960     if test $? -eq 0;  then
2961         GNUTAR=$a
2962         break
2963     fi
2964 done
2965 AC_MSG_RESULT($GNUTAR)
2966 if test -z "$GNUTAR"; then
2967     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2969 AC_SUBST(GNUTAR)
2971 AC_MSG_CHECKING([for tar's option to strip components])
2972 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2973 if test $? -eq 0; then
2974     STRIP_COMPONENTS="--strip-components"
2975 else
2976     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2977     if test $? -eq 0; then
2978         STRIP_COMPONENTS="--strip-path"
2979     else
2980         STRIP_COMPONENTS="unsupported"
2981     fi
2983 AC_MSG_RESULT($STRIP_COMPONENTS)
2984 if test x$STRIP_COMPONENTS = xunsupported; then
2985     AC_MSG_ERROR([you need a tar that is able to strip components.])
2987 AC_SUBST(STRIP_COMPONENTS)
2989 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2990 dnl desktop OSes from "mobile" ones.
2992 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2993 dnl In other words, that when building for an OS that is not a
2994 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2996 dnl Note the direction of the implication; there is no assumption that
2997 dnl cross-compiling would imply a non-desktop OS.
2999 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
3000     BUILD_TYPE="$BUILD_TYPE DESKTOP"
3001     AC_DEFINE(HAVE_FEATURE_DESKTOP)
3002     if test "$_os" != Emscripten; then
3003         AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
3004     fi
3007 # explicitly doesn't include enable_gtk3=no and enable_qt5=yes, so it should
3008 # also work with the default gtk3 plugin.
3009 if test "$enable_wasm_strip" = "yes"; then
3010     enable_avmedia=no
3011     enable_cmis=no
3012     enable_coinmp=no
3013     enable_cups=no
3014     test "$_os" = Emscripten && enable_curl=no
3015     enable_database_connectivity=no
3016     enable_dbus=no
3017     enable_dconf=no
3018     test "${enable_dynamic_loading+set}" = set -o "$_os" != Emscripten || enable_dynamic_loading=no
3019     enable_extension_integration=no
3020     enable_extensions=no
3021     enable_extension_update=no
3022     enable_gio=no
3023     enable_gpgmepp=no
3024     enable_ldap=no
3025     enable_lotuswordpro=no
3026     enable_lpsolve=no
3027     enable_nss=no
3028     enable_odk=no
3029     enable_online_update=no
3030     enable_opencl=no
3031     enable_pdfimport=no
3032     enable_randr=no
3033     enable_report_builder=no
3034     enable_scripting=no
3035     enable_sdremote_bluetooth=no
3036     enable_skia=no
3037     enable_xmlhelp=no
3038     enable_zxing=no
3039     test_libepubgen=no
3040     test_libcdr=no
3041     test_libcmis=no
3042     test_libetonyek=no
3043     test_libfreehand=no
3044     test_libmspub=no
3045     test_libpagemaker=no
3046     test_libqxp=no
3047     test_libvisio=no
3048     test_libzmf=no
3049     test_webdav=no
3050     with_galleries=no
3051     with_webdav=no
3052     with_x=no
3054     test "${with_fonts+set}" = set || with_fonts=yes
3055     test "${with_locales+set}" = set || with_locales=en
3057     AC_DEFINE(ENABLE_WASM_STRIP_ACCESSIBILITY)
3058     AC_DEFINE(ENABLE_WASM_STRIP_CANVAS)
3059 #    AC_DEFINE(ENABLE_WASM_STRIP_CHART)
3060     AC_DEFINE(ENABLE_WASM_STRIP_DBACCESS)
3061     AC_DEFINE(ENABLE_WASM_STRIP_EPUB)
3062     AC_DEFINE(ENABLE_WASM_STRIP_EXTRA)
3063     AC_DEFINE(ENABLE_WASM_STRIP_GUESSLANG)
3064 #    AC_DEFINE(ENABLE_WASM_STRIP_HUNSPELL)
3065     AC_DEFINE(ENABLE_WASM_STRIP_PINGUSER)
3066     AC_DEFINE(ENABLE_WASM_STRIP_PREMULTIPLY)
3067     AC_DEFINE(ENABLE_WASM_STRIP_RECENT)
3068     AC_DEFINE(ENABLE_WASM_STRIP_RECOVERYUI)
3069     AC_DEFINE(ENABLE_WASM_STRIP_SPLASH)
3070     AC_DEFINE(ENABLE_WASM_STRIP_SWEXPORTS)
3073 EMSCRIPTEN_NEH_MAJOR=3
3074 EMSCRIPTEN_NEH_MINOR=1
3075 EMSCRIPTEN_NEH_TINY=3
3076 EMSCRIPTEN_NEH_VERSION="${EMSCRIPTEN_NEH_MAJOR}.${EMSCRIPTEN_NEH_MINOR}.${EMSCRIPTEN_NEH_TINY}"
3078 if test "$enable_wasm_exceptions" = yes; then
3079     AC_MSG_CHECKING([if Emscripten version is at least $EMSCRIPTEN_NEH_VERSION for SjLj + native EH])
3080     check_semantic_version_three_prefixed EMSCRIPTEN NEH
3081     if test $? -ne 0; then
3082         AC_MSG_ERROR([no, found $EMSCRIPTEN_VERSION])
3083     else
3084         AC_MSG_RESULT([yes ($EMSCRIPTEN_VERSION)])
3085     fi
3086     ENABLE_WASM_EXCEPTIONS=TRUE
3088 AC_SUBST(ENABLE_WASM_EXCEPTIONS)
3090 # Whether to build "avmedia" functionality or not.
3092 if test "$enable_avmedia" = yes; then
3093     BUILD_TYPE="$BUILD_TYPE AVMEDIA"
3094     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
3095 else
3096     test_gstreamer_1_0=no
3099 # Decide whether to build database connectivity stuff (including Base) or not.
3100 if test "$enable_database_connectivity" != no; then
3101     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
3102     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
3103 else
3104     if test "$_os" = iOS; then
3105         AC_MSG_ERROR([Presumly can't disable DB connectivity on iOS.])
3106     fi
3107     disable_database_connectivity_dependencies
3110 if test -z "$enable_extensions"; then
3111     # For iOS and Android Viewer, disable extensions unless specifically overridden with --enable-extensions.
3112     if test $_os != iOS && test $_os != Android -o "$ENABLE_ANDROID_LOK" = TRUE ; then
3113         enable_extensions=yes
3114     fi
3117 DISABLE_SCRIPTING=''
3118 if test "$enable_scripting" = yes; then
3119     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
3120     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
3121 else
3122     DISABLE_SCRIPTING='TRUE'
3123     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
3126 if test $_os = iOS -o $_os = Android -o $_os = Emscripten; then
3127     # Disable dynamic_loading always for iOS and Android
3128     enable_dynamic_loading=no
3129 elif test -z "$enable_dynamic_loading"; then
3130     # Otherwise enable it unless specifically disabled
3131     enable_dynamic_loading=yes
3134 DISABLE_DYNLOADING=''
3135 if test "$enable_dynamic_loading" = yes; then
3136     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
3137 else
3138     DISABLE_DYNLOADING='TRUE'
3139     if test $_os != iOS -a $_os != Android; then
3140         enable_database_connectivity=no
3141         enable_nss=no
3142         enable_odk=no
3143         enable_python=no
3144         enable_skia=no
3145         with_java=no
3146     fi
3148 AC_SUBST(DISABLE_DYNLOADING)
3150 ENABLE_CUSTOMTARGET_COMPONENTS=
3151 if test "$enable_customtarget_components" = yes -a "$DISABLE_DYNLOADING" = TRUE; then
3152     ENABLE_CUSTOMTARGET_COMPONENTS=TRUE
3153     if test -n "$with_locales" -a "$with_locales" != en -a "$with_locales" != ALL; then
3154         AC_MSG_ERROR([Currently just --with-locales=all or en is supported with --enable-customtarget-components])
3155     fi
3157 AC_SUBST(ENABLE_CUSTOMTARGET_COMPONENTS)
3159 if test "$enable_extensions" = yes; then
3160     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
3161     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
3162 else
3163     enable_extension_integration=no
3164     enable_extension_update=no
3167 # remember SYSBASE value
3168 AC_SUBST(SYSBASE)
3170 dnl ===================================================================
3171 dnl  Sort out various gallery compilation options
3172 dnl ===================================================================
3173 WITH_GALLERY_BUILD=TRUE
3174 AC_MSG_CHECKING([how to build and package galleries])
3175 if test -n "${with_galleries}"; then
3176     if test "$with_galleries" = "build"; then
3177         if test "$enable_database_connectivity" = no; then
3178             AC_MSG_ERROR([DB connectivity is needed for gengal / svx])
3179         fi
3180         AC_MSG_RESULT([build from source images internally])
3181     elif test "$with_galleries" = "no"; then
3182         WITH_GALLERY_BUILD=
3183         AC_MSG_RESULT([disable non-internal gallery build])
3184     else
3185         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
3186     fi
3187 else
3188     if test $_os != iOS -a $_os != Android; then
3189         AC_MSG_RESULT([internal src images for desktop])
3190     else
3191         WITH_GALLERY_BUILD=
3192         AC_MSG_RESULT([disable src image build])
3193     fi
3195 AC_SUBST(WITH_GALLERY_BUILD)
3197 dnl ===================================================================
3198 dnl  Checks if ccache is available
3199 dnl ===================================================================
3200 CCACHE_DEPEND_MODE=
3201 if test "$enable_ccache" = "no"; then
3202     CCACHE=""
3203 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
3204     case "%$CC%$CXX%" in
3205     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
3206     # assume that's good then
3207     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
3208         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
3209         CCACHE_DEPEND_MODE=1
3210         ;;
3211     *)
3212         # try to use our own ccache if it is available and CCACHE was not already defined
3213         if test -z "$CCACHE"; then
3214             if test "$_os" = "WINNT"; then
3215                 ccache_ext=.exe # e.g. openssl build needs ccache.exe, not just ccache
3216             fi
3217             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/ccache$ccache_ext" ; then
3218                 CCACHE="$LODE_HOME/opt/bin/ccache$ccache_ext"
3219             elif test -x "/opt/lo/bin/ccache$ccache_ext"; then
3220                 CCACHE="/opt/lo/bin/ccache$ccache_ext"
3221             fi
3222         fi
3223         AC_PATH_PROG([CCACHE],[ccache],[not found])
3224         if test "$CCACHE" != "not found" -a "$_os" = "WINNT"; then
3225             CCACHE=`win_short_path_for_make "$CCACHE"`
3226             # check that it has MSVC support (it should recognize it in CCACHE_COMPILERTYPE)
3227             rm -f conftest.txt
3228             AC_MSG_CHECKING([whether $CCACHE has MSVC support])
3229             CCACHE_COMPILERTYPE=cl CCACHE_LOGFILE=conftest.txt $CCACHE echo >/dev/null 2>/dev/null
3230             if grep -q 'Config: (environment) compiler_type = cl' conftest.txt; then
3231                 AC_MSG_RESULT(yes)
3232             else
3233                 AC_MSG_RESULT(no)
3234                 CCACHE="not found"
3235             fi
3236             rm -f conftest.txt
3237         fi
3238         if test "$CCACHE" = "not found" -a "$_os" = "WINNT"; then
3239             # on windows/VC perhaps sccache is around?
3240             case "%$CC%$CXX%" in
3241             # If $CC and/or $CXX already contain "sccache" (possibly suffixed with some version number etc),
3242             # assume that's good then
3243             *%sccache[[-_' ']]*|*/sccache[[-_' ']]*)
3244                 AC_MSG_NOTICE([sccache seems to be included in a pre-defined CC and/or CXX])
3245                 CCACHE_DEPEND_MODE=1
3246                 SCCACHE=1
3247                 ;;
3248             *)
3249                 # for sharing code below, reuse CCACHE env var
3250                 AC_PATH_PROG([CCACHE],[sccache],[not found])
3251                 if test "$CCACHE" != "not found"; then
3252                     CCACHE=`win_short_path_for_make "$CCACHE"`
3253                     SCCACHE=1
3254                     CCACHE_DEPEND_MODE=1
3255                 fi
3256                 ;;
3257             esac
3258         fi
3259         if test "$CCACHE" = "not found"; then
3260             CCACHE=""
3261         fi
3262         if test -n "$CCACHE" -a -z "$SCCACHE"; then
3263             CCACHE_DEPEND_MODE=1
3264             # Need to check for ccache version: otherwise prevents
3265             # caching of the results (like "-x objective-c++" for Mac)
3266             if test $_os = Darwin -o $_os = iOS; then
3267                 # Check ccache version
3268                 AC_MSG_CHECKING([whether version of ccache is suitable])
3269                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
3270                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3271                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
3272                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
3273                 else
3274                     AC_MSG_RESULT([no, $CCACHE_VERSION])
3275                     CCACHE=""
3276                     CCACHE_DEPEND_MODE=
3277                 fi
3278             fi
3279         fi
3280         ;;
3281     esac
3282 else
3283     CCACHE=""
3285 if test "$enable_ccache" = "nodepend"; then
3286     CCACHE_DEPEND_MODE=""
3288 AC_SUBST(CCACHE_DEPEND_MODE)
3290 # sccache defaults are good enough
3291 if test "$CCACHE" != "" -a -z "$SCCACHE"; then
3292     # e.g. (/home/rene/.config/ccache/ccache.conf) max_size = 20.0G
3293     # -p works with both 4.2 and 4.4
3294     ccache_size_msg=$([$CCACHE -p | $AWK /max_size/'{ print $4 }' | sed -e 's/\.[0-9]*//'])
3295     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
3296     if test "$ccache_size" = ""; then
3297         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
3298         if test "$ccache_size" = ""; then
3299             ccache_size=0
3300         fi
3301         # we could not determine the size or it was less than 1GB -> disable auto-ccache
3302         if test $ccache_size -lt 1024; then
3303             CCACHE=""
3304             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
3305             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
3306         else
3307             # warn that ccache may be too small for debug build
3308             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3309             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3310         fi
3311     else
3312         if test $ccache_size -lt 5; then
3313             #warn that ccache may be too small for debug build
3314             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3315             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3316         fi
3317     fi
3320 ENABLE_Z7_DEBUG=
3321 if test "$enable_z7_debug" != no; then
3322     if test "$enable_z7_debug" = yes -o -n "$CCACHE"; then
3323         ENABLE_Z7_DEBUG=TRUE
3324     fi
3325 else
3326     AC_MSG_WARN([ccache will not work with --disable-z7-debug])
3327     add_warning "ccache will not work with --disable-z7-debug"
3329 AC_SUBST(ENABLE_Z7_DEBUG)
3331 dnl ===================================================================
3332 dnl  Checks for C compiler,
3333 dnl  The check for the C++ compiler is later on.
3334 dnl ===================================================================
3335 if test "$_os" != "WINNT"; then
3336     GCC_HOME_SET="true"
3337     AC_MSG_CHECKING([gcc home])
3338     if test -z "$with_gcc_home"; then
3339         if test "$enable_icecream" = "yes"; then
3340             if test -d "/usr/lib/icecc/bin"; then
3341                 GCC_HOME="/usr/lib/icecc/"
3342             elif test -d "/usr/libexec/icecc/bin"; then
3343                 GCC_HOME="/usr/libexec/icecc/"
3344             elif test -d "/opt/icecream/bin"; then
3345                 GCC_HOME="/opt/icecream/"
3346             else
3347                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
3349             fi
3350         else
3351             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
3352             GCC_HOME_SET="false"
3353         fi
3354     else
3355         GCC_HOME="$with_gcc_home"
3356     fi
3357     AC_MSG_RESULT($GCC_HOME)
3358     AC_SUBST(GCC_HOME)
3360     if test "$GCC_HOME_SET" = "true"; then
3361         if test -z "$CC"; then
3362             CC="$GCC_HOME/bin/gcc"
3363             CC_BASE="gcc"
3364         fi
3365         if test -z "$CXX"; then
3366             CXX="$GCC_HOME/bin/g++"
3367             CXX_BASE="g++"
3368         fi
3369     fi
3372 COMPATH=`dirname "$CC"`
3373 if test "$COMPATH" = "."; then
3374     AC_PATH_PROGS(COMPATH, $CC)
3375     dnl double square bracket to get single because of M4 quote...
3376     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
3378 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
3380 dnl ===================================================================
3381 dnl Java support
3382 dnl ===================================================================
3383 AC_MSG_CHECKING([whether to build with Java support])
3384 if test "$with_java" != "no"; then
3385     if test "$DISABLE_SCRIPTING" = TRUE; then
3386         AC_MSG_RESULT([no, overridden by --disable-scripting])
3387         ENABLE_JAVA=""
3388         with_java=no
3389     else
3390         AC_MSG_RESULT([yes])
3391         ENABLE_JAVA="TRUE"
3392         AC_DEFINE(HAVE_FEATURE_JAVA)
3393     fi
3394 else
3395     AC_MSG_RESULT([no])
3396     ENABLE_JAVA=""
3399 AC_SUBST(ENABLE_JAVA)
3401 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
3403 dnl ENABLE_JAVA="" indicate no Java support at all
3405 dnl ===================================================================
3406 dnl Check macOS SDK and compiler
3407 dnl ===================================================================
3409 if test $_os = Darwin; then
3411     # The SDK in the currently selected Xcode should be found.
3413     AC_MSG_CHECKING([what macOS SDK to use])
3414     for macosx_sdk in 12.1 12.0 11.3 11.1 11.0 10.15 10.14 10.13; do
3415         MACOSX_SDK_PATH=`xcrun --sdk macosx${macosx_sdk} --show-sdk-path 2> /dev/null`
3416         if test -d "$MACOSX_SDK_PATH"; then
3417             break
3418         else
3419             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${macosx_sdk}.sdk"
3420             if test -d "$MACOSX_SDK_PATH"; then
3421                 break
3422             fi
3423         fi
3424     done
3425     if test ! -d "$MACOSX_SDK_PATH"; then
3426         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
3427     fi
3429     AC_MSG_RESULT([macOS SDK $macosx_sdk at $MACOSX_SDK_PATH])
3431     case $macosx_sdk in
3432     10.13)
3433         MACOSX_SDK_VERSION=101300
3434         ;;
3435     10.14)
3436         MACOSX_SDK_VERSION=101400
3437         ;;
3438     10.15)
3439         MACOSX_SDK_VERSION=101500
3440         ;;
3441     11.0)
3442         MACOSX_SDK_VERSION=110000
3443         ;;
3444     11.1)
3445         MACOSX_SDK_VERSION=110100
3446         ;;
3447     11.3)
3448         MACOSX_SDK_VERSION=110300
3449         ;;
3450     12.0)
3451         MACOSX_SDK_VERSION=120000
3452         ;;
3453     12.1)
3454         MACOSX_SDK_VERSION=120100
3455         ;;
3456     *)
3457         AC_MSG_ERROR([macOS SDK $macosx_sdk is not supported])
3458         ;;
3459     esac
3461     if test "$host_cpu" = arm64 -a $MACOSX_SDK_VERSION -lt 110000; then
3462         AC_MSG_ERROR([macOS SDK $macosx_sdk is not supported for Apple Silicon])
3463     fi
3465     if test "$with_macosx_version_min_required" = "" ; then
3466         if test "$host_cpu" = x86_64; then
3467             with_macosx_version_min_required="10.13";
3468         else
3469             with_macosx_version_min_required="11.0";
3470         fi
3471     fi
3473     # export this so that "xcrun" invocations later return matching values
3474     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
3475     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
3476     export DEVELOPER_DIR
3477     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
3478     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
3480     AC_MSG_CHECKING([whether Xcode is new enough])
3481     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
3482     my_xcode_ver2=${my_xcode_ver1#Xcode }
3483     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
3484     if test "$my_xcode_ver3" -ge 1205; then
3485         AC_MSG_RESULT([yes ($my_xcode_ver2)])
3486     else
3487         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 12.5])
3488     fi
3490     case "$with_macosx_version_min_required" in
3491     10.13)
3492         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
3493         ;;
3494     10.14)
3495         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
3496         ;;
3497     10.15)
3498         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
3499         ;;
3500     10.16)
3501         MAC_OS_X_VERSION_MIN_REQUIRED="101600"
3502         ;;
3503     11.0)
3504         MAC_OS_X_VERSION_MIN_REQUIRED="110000"
3505         ;;
3506     11.1)
3507         MAC_OS_X_VERSION_MIN_REQUIRED="110100"
3508         ;;
3509     11.3)
3510         MAC_OS_X_VERSION_MIN_REQUIRED="110300"
3511         ;;
3512     12.0)
3513         MAC_OS_X_VERSION_MIN_REQUIRED="120000"
3514         ;;
3515     12.1)
3516         MAC_OS_X_VERSION_MIN_REQUIRED="120100"
3517         ;;
3518     *)
3519         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.13--12.1])
3520         ;;
3521     esac
3523     LIBTOOL=/usr/bin/libtool
3524     INSTALL_NAME_TOOL=install_name_tool
3525     if test -z "$save_CC"; then
3526         stdlib=-stdlib=libc++
3528         AC_MSG_CHECKING([what C compiler to use])
3529         CC="`xcrun -find clang`"
3530         CC_BASE=`first_arg_basename "$CC"`
3531         if test "$host_cpu" = x86_64; then
3532             CC+=" -target x86_64-apple-macos"
3533         else
3534             CC+=" -target arm64-apple-macos"
3535         fi
3536         CC+=" -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3537         AC_MSG_RESULT([$CC])
3539         AC_MSG_CHECKING([what C++ compiler to use])
3540         CXX="`xcrun -find clang++`"
3541         CXX_BASE=`first_arg_basename "$CXX"`
3542         if test "$host_cpu" = x86_64; then
3543             CXX+=" -target x86_64-apple-macos"
3544         else
3545             CXX+=" -target arm64-apple-macos"
3546         fi
3547         CXX+=" $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3548         AC_MSG_RESULT([$CXX])
3550         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3551         AR=`xcrun -find ar`
3552         NM=`xcrun -find nm`
3553         STRIP=`xcrun -find strip`
3554         LIBTOOL=`xcrun -find libtool`
3555         RANLIB=`xcrun -find ranlib`
3556     fi
3558     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macos-with-sdk])
3559     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MACOSX_SDK_VERSION; then
3560         AC_MSG_ERROR([the version minimum required cannot be greater than the sdk level])
3561     else
3562         AC_MSG_RESULT([ok])
3563     fi
3564     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
3566     AC_MSG_CHECKING([whether to do code signing])
3568     if test "$enable_macosx_code_signing" = yes; then
3569         # By default use the first suitable certificate (?).
3571         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
3572         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
3573         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
3574         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
3575         # "Developer ID Application" one.
3577         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
3578         if test -n "$identity"; then
3579             MACOSX_CODESIGNING_IDENTITY=$identity
3580             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3581             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3582         else
3583             AC_MSG_ERROR([cannot determine identity to use])
3584         fi
3585     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
3586         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
3587         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3588         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3589     else
3590         AC_MSG_RESULT([no])
3591     fi
3593     AC_MSG_CHECKING([whether to create a Mac App Store package])
3595     if test -z "$enable_macosx_package_signing" || test "$enable_macosx_package_signing" == no; then
3596         AC_MSG_RESULT([no])
3597     elif test -z "$MACOSX_CODESIGNING_IDENTITY"; then
3598         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3599     elif test "$enable_macosx_package_signing" = yes; then
3600         # By default use the first suitable certificate.
3601         # It should be a "3rd Party Mac Developer Installer" one
3603         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
3604         if test -n "$identity"; then
3605             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3606             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3607             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3608         else
3609             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3610         fi
3611     else
3612         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
3613         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3614         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3615     fi
3617     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3618         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3619     fi
3621     AC_MSG_CHECKING([whether to sandbox the application])
3623     if test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3624         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3625     elif test "$enable_macosx_sandbox" = yes; then
3626         ENABLE_MACOSX_SANDBOX=TRUE
3627         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3628         AC_MSG_RESULT([yes])
3629     else
3630         AC_MSG_RESULT([no])
3631     fi
3633     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3634     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3635     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3637 AC_SUBST(MACOSX_SDK_PATH)
3638 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3639 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3640 AC_SUBST(INSTALL_NAME_TOOL)
3641 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3642 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3643 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3644 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3645 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3647 dnl ===================================================================
3648 dnl Check iOS SDK and compiler
3649 dnl ===================================================================
3651 if test $_os = iOS; then
3652     AC_MSG_CHECKING([what iOS SDK to use])
3653     current_sdk_ver=15.2
3654     older_sdk_vers="15.0 14.5"
3655     if test "$enable_ios_simulator" = "yes"; then
3656         platform=iPhoneSimulator
3657         versionmin=-mios-simulator-version-min=13.6
3658     else
3659         platform=iPhoneOS
3660         versionmin=-miphoneos-version-min=13.6
3661     fi
3662     xcode_developer=`xcode-select -print-path`
3664     for sdkver in $current_sdk_ver $older_sdk_vers; do
3665         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3666         if test -d $t; then
3667             sysroot=$t
3668             break
3669         fi
3670     done
3672     if test -z "$sysroot"; then
3673         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3674     fi
3676     AC_MSG_RESULT($sysroot)
3678     stdlib="-stdlib=libc++"
3680     AC_MSG_CHECKING([what C compiler to use])
3681     CC="`xcrun -find clang`"
3682     CC_BASE=`first_arg_basename "$CC"`
3683     CC+=" -arch $host_cpu_for_clang -isysroot $sysroot $versionmin"
3684     AC_MSG_RESULT([$CC])
3686     AC_MSG_CHECKING([what C++ compiler to use])
3687     CXX="`xcrun -find clang++`"
3688     CXX_BASE=`first_arg_basename "$CXX"`
3689     CXX+=" -arch $host_cpu_for_clang $stdlib -isysroot $sysroot $versionmin"
3690     AC_MSG_RESULT([$CXX])
3692     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3693     AR=`xcrun -find ar`
3694     NM=`xcrun -find nm`
3695     STRIP=`xcrun -find strip`
3696     LIBTOOL=`xcrun -find libtool`
3697     RANLIB=`xcrun -find ranlib`
3700 AC_MSG_CHECKING([whether to treat the installation as read-only])
3702 if test $_os = Darwin; then
3703     enable_readonly_installset=yes
3704 elif test "$enable_extensions" != yes; then
3705     enable_readonly_installset=yes
3707 if test "$enable_readonly_installset" = yes; then
3708     AC_MSG_RESULT([yes])
3709     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3710 else
3711     AC_MSG_RESULT([no])
3714 dnl ===================================================================
3715 dnl Structure of install set
3716 dnl ===================================================================
3718 if test $_os = Darwin; then
3719     LIBO_BIN_FOLDER=MacOS
3720     LIBO_ETC_FOLDER=Resources
3721     LIBO_LIBEXEC_FOLDER=MacOS
3722     LIBO_LIB_FOLDER=Frameworks
3723     LIBO_LIB_PYUNO_FOLDER=Resources
3724     LIBO_SHARE_FOLDER=Resources
3725     LIBO_SHARE_HELP_FOLDER=Resources/help
3726     LIBO_SHARE_JAVA_FOLDER=Resources/java
3727     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3728     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3729     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3730     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3731     LIBO_URE_BIN_FOLDER=MacOS
3732     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3733     LIBO_URE_LIB_FOLDER=Frameworks
3734     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3735     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3736 elif test $_os = WINNT; then
3737     LIBO_BIN_FOLDER=program
3738     LIBO_ETC_FOLDER=program
3739     LIBO_LIBEXEC_FOLDER=program
3740     LIBO_LIB_FOLDER=program
3741     LIBO_LIB_PYUNO_FOLDER=program
3742     LIBO_SHARE_FOLDER=share
3743     LIBO_SHARE_HELP_FOLDER=help
3744     LIBO_SHARE_JAVA_FOLDER=program/classes
3745     LIBO_SHARE_PRESETS_FOLDER=presets
3746     LIBO_SHARE_READMES_FOLDER=readmes
3747     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3748     LIBO_SHARE_SHELL_FOLDER=program/shell
3749     LIBO_URE_BIN_FOLDER=program
3750     LIBO_URE_ETC_FOLDER=program
3751     LIBO_URE_LIB_FOLDER=program
3752     LIBO_URE_MISC_FOLDER=program
3753     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3754 else
3755     LIBO_BIN_FOLDER=program
3756     LIBO_ETC_FOLDER=program
3757     LIBO_LIBEXEC_FOLDER=program
3758     LIBO_LIB_FOLDER=program
3759     LIBO_LIB_PYUNO_FOLDER=program
3760     LIBO_SHARE_FOLDER=share
3761     LIBO_SHARE_HELP_FOLDER=help
3762     LIBO_SHARE_JAVA_FOLDER=program/classes
3763     LIBO_SHARE_PRESETS_FOLDER=presets
3764     LIBO_SHARE_READMES_FOLDER=readmes
3765     if test "$enable_fuzzers" != yes; then
3766         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3767     else
3768         LIBO_SHARE_RESOURCE_FOLDER=resource
3769     fi
3770     LIBO_SHARE_SHELL_FOLDER=program/shell
3771     LIBO_URE_BIN_FOLDER=program
3772     LIBO_URE_ETC_FOLDER=program
3773     LIBO_URE_LIB_FOLDER=program
3774     LIBO_URE_MISC_FOLDER=program
3775     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3777 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3778 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3779 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3780 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3781 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3782 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3783 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3784 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3785 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3786 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3787 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3788 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3789 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3790 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3791 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3792 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3794 # Not all of them needed in config_host.mk, add more if need arises
3795 AC_SUBST(LIBO_BIN_FOLDER)
3796 AC_SUBST(LIBO_ETC_FOLDER)
3797 AC_SUBST(LIBO_LIB_FOLDER)
3798 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3799 AC_SUBST(LIBO_SHARE_FOLDER)
3800 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3801 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3802 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3803 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3804 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3805 AC_SUBST(LIBO_URE_BIN_FOLDER)
3806 AC_SUBST(LIBO_URE_ETC_FOLDER)
3807 AC_SUBST(LIBO_URE_LIB_FOLDER)
3808 AC_SUBST(LIBO_URE_MISC_FOLDER)
3809 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3811 dnl ===================================================================
3812 dnl Windows specific tests and stuff
3813 dnl ===================================================================
3815 reg_get_value()
3817     # Return value: $regvalue
3818     unset regvalue
3820     if test "$build_os" = "wsl"; then
3821         regvalue=$($BUILDDIR/solenv/wsl/wsl-lo-helper.exe --read-registry $1 "$2" 2>/dev/null)
3822         return
3823     fi
3825     local _regentry="/proc/registry${1}/${2}"
3826     if test -f "$_regentry"; then
3827         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3828         # Registry keys read via /proc/registry* are always \0 terminated!
3829         local _regvalue=$(tr -d '\0' < "$_regentry")
3830         if test $? -eq 0; then
3831             regvalue=$_regvalue
3832         fi
3833     fi
3836 # Get a value from the 32-bit side of the Registry
3837 reg_get_value_32()
3839     reg_get_value "32" "$1"
3842 # Get a value from the 64-bit side of the Registry
3843 reg_get_value_64()
3845     reg_get_value "64" "$1"
3848 case "$host_os" in
3849 cygwin*|wsl*)
3850     COM=MSC
3851     OS=WNT
3852     RTL_OS=Windows
3853     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3854         P_SEP=";"
3855     else
3856         P_SEP=:
3857     fi
3858     case "$host_cpu" in
3859     x86_64)
3860         CPUNAME=X86_64
3861         RTL_ARCH=X86_64
3862         PLATFORMID=windows_x86_64
3863         WINDOWS_X64=1
3864         SCPDEFS="$SCPDEFS -DWINDOWS_X64"
3865         WIN_HOST_ARCH="x64"
3866         WIN_MULTI_ARCH="x86"
3867         WIN_HOST_BITS=64
3868         ;;
3869     i*86)
3870         CPUNAME=INTEL
3871         RTL_ARCH=x86
3872         PLATFORMID=windows_x86
3873         WIN_HOST_ARCH="x86"
3874         WIN_HOST_BITS=32
3875         WIN_OTHER_ARCH="x64"
3876         ;;
3877     aarch64)
3878         CPUNAME=AARCH64
3879         RTL_ARCH=AARCH64
3880         PLATFORMID=windows_aarch64
3881         WINDOWS_X64=1
3882         SCPDEFS="$SCPDEFS -DWINDOWS_AARCH64"
3883         WIN_HOST_ARCH="arm64"
3884         WIN_HOST_BITS=64
3885         with_ucrt_dir=no
3886         ;;
3887     *)
3888         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3889         ;;
3890     esac
3892     case "$build_cpu" in
3893     x86_64) WIN_BUILD_ARCH="x64" ;;
3894     i*86) WIN_BUILD_ARCH="x86" ;;
3895     aarch64) WIN_BUILD_ARCH="arm64" ;;
3896     *)
3897         AC_MSG_ERROR([Unsupported build_cpu $build_cpu for host_os $host_os])
3898         ;;
3899     esac
3901     SCPDEFS="$SCPDEFS -D_MSC_VER"
3902     ;;
3903 esac
3905 # multi-arch is an arch, which can execute on the host (x86 on x64), while
3906 # other-arch won't, but wouldn't break the build (x64 on x86).
3907 if test -n "$WIN_MULTI_ARCH" -a -n "$WIN_OTHER_ARCH"; then
3908     AC_MSG_ERROR([Broken configure.ac file: can't have set \$WIN_MULTI_ARCH and $WIN_OTHER_ARCH])
3912 if test "$build_cpu" != "$host_cpu" -o "$DISABLE_DYNLOADING" = TRUE; then
3913     # To allow building Windows multi-arch releases without cross-tooling
3914     if test "$DISABLE_DYNLOADING" = TRUE -o \( -z "$WIN_MULTI_ARCH" -a -z "$WIN_OTHER_ARCH" \); then
3915         cross_compiling="yes"
3916     fi
3919 if test "$cross_compiling" = "yes"; then
3920     export CROSS_COMPILING=TRUE
3921     if test "$enable_dynamic_loading" != yes -a "$enable_wasm_strip" = yes; then
3922         ENABLE_WASM_STRIP=TRUE
3923     fi
3924 else
3925     CROSS_COMPILING=
3926     BUILD_TYPE="$BUILD_TYPE NATIVE"
3928 AC_SUBST(CROSS_COMPILING)
3929 AC_SUBST(ENABLE_WASM_STRIP)
3931 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3932 # NOTE: must _not_ be used for bundled external libraries!
3933 ISYSTEM=
3934 if test "$GCC" = "yes"; then
3935     AC_MSG_CHECKING( for -isystem )
3936     save_CFLAGS=$CFLAGS
3937     CFLAGS="$CFLAGS -isystem /usr/include -Werror"
3938     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3939     CFLAGS=$save_CFLAGS
3940     if test -n "$ISYSTEM"; then
3941         AC_MSG_RESULT(yes)
3942     else
3943         AC_MSG_RESULT(no)
3944     fi
3946 if test -z "$ISYSTEM"; then
3947     # fall back to using -I
3948     ISYSTEM=-I
3950 AC_SUBST(ISYSTEM)
3952 dnl ===================================================================
3953 dnl  Check which Visual Studio compiler is used
3954 dnl ===================================================================
3956 map_vs_year_to_version()
3958     # Return value: $vsversion
3960     unset vsversion
3962     case $1 in
3963     2019)
3964         vsversion=16;;
3965     2022)
3966         vsversion=17;;
3967     *)
3968         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3969     esac
3972 vs_versions_to_check()
3974     # Args: $1 (optional) : versions to check, in the order of preference
3975     # Return value: $vsversions
3977     unset vsversions
3979     if test -n "$1"; then
3980         map_vs_year_to_version "$1"
3981         vsversions=$vsversion
3982     else
3983         # Default version is 2019
3984         vsversions="16"
3985     fi
3988 win_get_env_from_vsvars32bat()
3990     local WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3991     # Also seems to be located in another directory under the same name: vsvars32.bat
3992     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3993     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3994     # use 'echo.%ENV%' syntax (instead of 'echo %ENV%') to avoid outputting "ECHO is off." in case when ENV is empty or a space
3995     printf '@setlocal\r\n@echo.%%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3996     local result
3997     if test "$build_os" = "wsl"; then
3998         result=$(cd /mnt/c && cmd.exe /c $(wslpath -w $WRAPPERBATCHFILEPATH) | tr -d '\r')
3999     else
4000         chmod +x $WRAPPERBATCHFILEPATH
4001         result=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
4002     fi
4003     rm -f $WRAPPERBATCHFILEPATH
4004     printf '%s' "$result"
4007 find_ucrt()
4009     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
4010     if test -n "$regvalue"; then
4011         PathFormat "$regvalue"
4012         UCRTSDKDIR=$formatted_path_unix
4013         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
4014         UCRTVERSION=$regvalue
4015         # Rest if not exist
4016         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
4017           UCRTSDKDIR=
4018         fi
4019     fi
4020     if test -z "$UCRTSDKDIR"; then
4021         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
4022         ide_env_file="${ide_env_dir}VsDevCmd.bat"
4023         if test -f "$ide_env_file"; then
4024             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
4025             UCRTSDKDIR=$formatted_path
4026             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
4027             dnl Hack needed at least by tml:
4028             if test "$UCRTVERSION" = 10.0.15063.0 \
4029                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
4030                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
4031             then
4032                 UCRTVERSION=10.0.14393.0
4033             fi
4034         else
4035           AC_MSG_ERROR([No UCRT found])
4036         fi
4037     fi
4040 find_msvc()
4042     # Find Visual C++
4043     # Args: $1 (optional) : The VS version year
4044     # Return values: $vctest, $vcyear, $vctoolset, $vcnumwithdot, $vcbuildnumber
4046     unset vctest vctoolset vcnumwithdot vcbuildnumber
4048     vs_versions_to_check "$1"
4049     if test "$build_os" = wsl; then
4050         vswhere="$PROGRAMFILESX86"
4051     else
4052         vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
4053     fi
4054     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
4055     PathFormat "$vswhere"
4056     vswhere=$formatted_path_unix
4057     for ver in $vsversions; do
4058         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4059         if test -z "$vswhereoutput"; then
4060             vswhereoutput=`$vswhere -prerelease -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4061         fi
4062         # Fall back to all MS products (this includes VC++ Build Tools)
4063         if ! test -n "$vswhereoutput"; then
4064             AC_MSG_CHECKING([VC++ Build Tools and similar])
4065             vswhereoutput=`$vswhere -products \* -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
4066         fi
4067         if test -n "$vswhereoutput"; then
4068             PathFormat "$vswhereoutput"
4069             vctest=$formatted_path_unix
4070             break
4071         fi
4072     done
4074     if test -n "$vctest"; then
4075         vcnumwithdot="$ver.0"
4076         case "$vcnumwithdot" in
4077         16.0)
4078             vcyear=2019
4079             vctoolset=v142
4080             ;;
4081         17.0)
4082             vcyear=2022
4083             vctoolset=v143
4084             ;;
4085         esac
4086         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
4088     fi
4091 test_cl_exe()
4093     AC_MSG_CHECKING([$1 compiler])
4095     CL_EXE_PATH="$2/cl.exe"
4097     if test ! -f "$CL_EXE_PATH"; then
4098         if test "$1" = "multi-arch"; then
4099             AC_MSG_WARN([no compiler (cl.exe) in $2])
4100             return 1
4101         else
4102             AC_MSG_ERROR([no compiler (cl.exe) in $2])
4103         fi
4104     fi
4106     dnl ===========================================================
4107     dnl  Check for the corresponding mspdb*.dll
4108     dnl ===========================================================
4110     # MSVC 15.0 has libraries from 14.0?
4111     mspdbnum="140"
4113     if test ! -e "$2/mspdb${mspdbnum}.dll"; then
4114         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $2, Visual Studio installation broken?])
4115     fi
4117     # The compiles has to find its shared libraries
4118     OLD_PATH="$PATH"
4119     TEMP_PATH=`cygpath -d "$2"`
4120     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
4122     if ! "$CL_EXE_PATH" -? </dev/null >/dev/null 2>&1; then
4123         AC_MSG_ERROR([no compiler (cl.exe) in $2])
4124     fi
4126     PATH="$OLD_PATH"
4128     AC_MSG_RESULT([$CL_EXE_PATH])
4131 SOLARINC=
4132 MSBUILD_PATH=
4133 DEVENV=
4134 if test "$_os" = "WINNT"; then
4135     AC_MSG_CHECKING([Visual C++])
4136     find_msvc "$with_visual_studio"
4137     if test -z "$vctest"; then
4138         if test -n "$with_visual_studio"; then
4139             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
4140         else
4141             AC_MSG_ERROR([no Visual Studio installation found])
4142         fi
4143     fi
4144     AC_MSG_RESULT([])
4146     VC_PRODUCT_DIR="$vctest/VC"
4147     COMPATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber"
4149     # $WIN_OTHER_ARCH is a hack to test the x64 compiler on x86, even if it's not multi-arch
4150     if test -n "$WIN_MULTI_ARCH" -o -n "$WIN_OTHER_ARCH"; then
4151         MSVC_MULTI_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/${WIN_MULTI_ARCH}${WIN_OTHER_ARCH}"
4152         test_cl_exe "multi-arch" "$MSVC_MULTI_PATH"
4153         if test $? -ne 0; then
4154             WIN_MULTI_ARCH=""
4155             WIN_OTHER_ARCH=""
4156         fi
4157     fi
4159     if test "$WIN_BUILD_ARCH" = "$WIN_HOST_ARCH"; then
4160         MSVC_BUILD_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_BUILD_ARCH"
4161         test_cl_exe "build" "$MSVC_BUILD_PATH"
4162     fi
4164     if test "$WIN_BUILD_ARCH" != "$WIN_HOST_ARCH"; then
4165         MSVC_HOST_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_HOST_ARCH"
4166         test_cl_exe "host" "$MSVC_HOST_PATH"
4167     else
4168         MSVC_HOST_PATH="$MSVC_BUILD_PATH"
4169     fi
4171     AC_MSG_CHECKING([for short pathname of VC product directory])
4172     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
4173     AC_MSG_RESULT([$VC_PRODUCT_DIR])
4175     UCRTSDKDIR=
4176     UCRTVERSION=
4178     AC_MSG_CHECKING([for UCRT location])
4179     find_ucrt
4180     # find_ucrt errors out if it doesn't find it
4181     AC_MSG_RESULT([$UCRTSDKDIR ($UCRTVERSION)])
4182     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
4183     ucrtincpath_formatted=$formatted_path
4184     # SOLARINC is used for external modules and must be set too.
4185     # And no, it's not sufficient to set SOLARINC only, as configure
4186     # itself doesn't honour it.
4187     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
4188     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
4189     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
4190     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
4192     AC_SUBST(UCRTSDKDIR)
4193     AC_SUBST(UCRTVERSION)
4195     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
4196     # Find the proper version of MSBuild.exe to use based on the VS version
4197     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
4198     if test -z "$regvalue" ; then
4199         if test "$WIN_BUILD_ARCH" != "x64"; then
4200             regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
4201         else
4202             regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
4203         fi
4204     fi
4205     if test -d "$regvalue" ; then
4206         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
4207         AC_MSG_RESULT([$regvalue])
4208     else
4209         AC_MSG_ERROR([MSBuild.exe location not found])
4210     fi
4212     # Find the version of devenv.exe
4213     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
4214     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
4215     DEVENV_unix=$(cygpath -u "$DEVENV")
4216     if test ! -e "$DEVENV_unix"; then
4217         AC_MSG_WARN([No devenv.exe found - this is expected for VC++ Build Tools])
4218     fi
4220     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
4221     dnl needed when building CLR code:
4222     if test -z "$MSVC_CXX"; then
4223         # This gives us a posix path with 8.3 filename restrictions
4224         MSVC_CXX=`win_short_path_for_make "$MSVC_HOST_PATH/cl.exe"`
4225     fi
4227     if test -z "$CC"; then
4228         CC=$MSVC_CXX
4229         CC_BASE=`first_arg_basename "$CC"`
4230     fi
4231     if test -z "$CXX"; then
4232         CXX=$MSVC_CXX
4233         CXX_BASE=`first_arg_basename "$CXX"`
4234     fi
4236     if test -n "$CC"; then
4237         # Remove /cl.exe from CC case insensitive
4238         AC_MSG_NOTICE([found Visual C++ $vcyear])
4240         main_include_dir=`cygpath -d -m "$COMPATH/Include"`
4241         CPPFLAGS="$CPPFLAGS -I$main_include_dir"
4243         PathFormat "$COMPATH"
4244         COMPATH=`win_short_path_for_make "$formatted_path"`
4246         VCVER=$vcnumwithdot
4247         VCTOOLSET=$vctoolset
4249         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
4250         # are always "better", we list them in reverse chronological order.
4252         case "$vcnumwithdot" in
4253         16.0 | 17.0)
4254             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
4255             ;;
4256         esac
4258         # The expectation is that --with-windows-sdk should not need to be used
4259         if test -n "$with_windows_sdk"; then
4260             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
4261             *" "$with_windows_sdk" "*)
4262                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
4263                 ;;
4264             *)
4265                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $vcyear])
4266                 ;;
4267             esac
4268         fi
4270         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
4271         ac_objext=obj
4272         ac_exeext=exe
4274     else
4275         AC_MSG_ERROR([Visual C++ not found after all, huh])
4276     fi
4278     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.5])
4279     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4280         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
4281         // between Visual Studio versions and _MSC_VER:
4282         #if _MSC_VER < 1925
4283         #error
4284         #endif
4285     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
4287     # Check for 64-bit (cross-)compiler to use to build the 64-bit
4288     # version of the Explorer extension (and maybe other small
4289     # bits, too) needed when installing a 32-bit LibreOffice on a
4290     # 64-bit OS. The 64-bit Explorer extension is a feature that
4291     # has been present since long in OOo. Don't confuse it with
4292     # building LibreOffice itself as 64-bit code.
4294     BUILD_X64=
4295     CXX_X64_BINARY=
4297     if test "$WIN_HOST_ARCH" = "x86" -a -n "$WIN_OTHER_ARCH"; then
4298         AC_MSG_CHECKING([for the libraries to build the 64-bit Explorer extensions])
4299         if test -f "$COMPATH/atlmfc/lib/x64/atls.lib" -o \
4300              -f "$COMPATH/atlmfc/lib/spectre/x64/atls.lib"
4301         then
4302             BUILD_X64=TRUE
4303             CXX_X64_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4304             AC_MSG_RESULT([found])
4305         else
4306             AC_MSG_RESULT([not found])
4307             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
4308         fi
4309     elif test "$WIN_HOST_ARCH" = "x64"; then
4310         CXX_X64_BINARY=$CXX
4311     fi
4312     AC_SUBST(BUILD_X64)
4314     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
4315     AC_SUBST(CXX_X64_BINARY)
4317     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
4318     # needed to support TWAIN scan on both 32- and 64-bit systems
4320     case "$WIN_HOST_ARCH" in
4321     x64)
4322         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
4323         if test -n "$CXX_X86_BINARY"; then
4324             BUILD_X86=TRUE
4325             AC_MSG_RESULT([preset])
4326         elif test -n "$WIN_MULTI_ARCH"; then
4327             BUILD_X86=TRUE
4328             CXX_X86_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4329             AC_MSG_RESULT([found])
4330         else
4331             AC_MSG_RESULT([not found])
4332             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
4333         fi
4334         ;;
4335     x86)
4336         BUILD_X86=TRUE
4337         CXX_X86_BINARY=$MSVC_CXX
4338         ;;
4339     esac
4340     AC_SUBST(BUILD_X86)
4341     AC_SUBST(CXX_X86_BINARY)
4343 AC_SUBST(VCVER)
4344 AC_SUBST(VCTOOLSET)
4345 AC_SUBST(DEVENV)
4346 AC_SUBST(MSVC_CXX)
4348 COM_IS_CLANG=
4349 AC_MSG_CHECKING([whether the compiler is actually Clang])
4350 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4351     #ifndef __clang__
4352     you lose
4353     #endif
4354     int foo=42;
4355     ]])],
4356     [AC_MSG_RESULT([yes])
4357      COM_IS_CLANG=TRUE],
4358     [AC_MSG_RESULT([no])])
4359 AC_SUBST(COM_IS_CLANG)
4361 CLANGVER=
4362 if test "$COM_IS_CLANG" = TRUE; then
4363     AC_MSG_CHECKING([whether Clang is new enough])
4364     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4365         #if !defined __apple_build_version__
4366         #error
4367         #endif
4368         ]])],
4369         [my_apple_clang=yes],[my_apple_clang=])
4370     if test "$my_apple_clang" = yes; then
4371         AC_MSG_RESULT([assumed yes (Apple Clang)])
4372     elif test "$_os" = Emscripten; then
4373         AC_MSG_RESULT([assumed yes (Emscripten Clang)])
4374     else
4375         if test "$_os" = WINNT; then
4376             dnl In which case, assume clang-cl:
4377             my_args="/EP /TC"
4378         else
4379             my_args="-E -P"
4380         fi
4381         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC $my_args - | sed 's/ //g'`
4382         CLANG_FULL_VERSION=`echo __clang_version__ | $CC $my_args -`
4383         CLANGVER=`echo $clang_version \
4384             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
4385         if test "$CLANGVER" -ge 80001; then
4386             AC_MSG_RESULT([yes ($clang_version)])
4387         else
4388             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 8.0.1])
4389         fi
4390         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
4391         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
4392     fi
4395 SHOWINCLUDES_PREFIX=
4396 if test "$_os" = WINNT; then
4397     dnl We need to guess the prefix of the -showIncludes output, it can be
4398     dnl localized
4399     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
4400     echo "#include <stdlib.h>" > conftest.c
4401     SHOWINCLUDES_PREFIX=`$CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
4402         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
4403     rm -f conftest.c conftest.obj
4404     if test -z "$SHOWINCLUDES_PREFIX"; then
4405         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
4406     else
4407         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
4408     fi
4410 AC_SUBST(SHOWINCLUDES_PREFIX)
4413 # prefix C with ccache if needed
4415 if test "$CCACHE" != ""; then
4416     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
4418     AC_LANG_PUSH([C])
4419     save_CFLAGS=$CFLAGS
4420     CFLAGS="$CFLAGS --ccache-skip -O2"
4421     # msvc does not fail on unknown options, check stdout
4422     if test "$COM" = MSC; then
4423         CFLAGS="$CFLAGS -nologo"
4424     fi
4425     save_ac_c_werror_flag=$ac_c_werror_flag
4426     ac_c_werror_flag=yes
4427     dnl an empty program will do, we're checking the compiler flags
4428     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
4429                       [use_ccache=yes], [use_ccache=no])
4430     CFLAGS=$save_CFLAGS
4431     ac_c_werror_flag=$save_ac_c_werror_flag
4432     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
4433         AC_MSG_RESULT([yes])
4434     else
4435         CC="$CCACHE $CC"
4436         CC_BASE="ccache $CC_BASE"
4437         AC_MSG_RESULT([no])
4438     fi
4439     AC_LANG_POP([C])
4442 # ===================================================================
4443 # check various GCC options that Clang does not support now but maybe
4444 # will somewhen in the future, check them even for GCC, so that the
4445 # flags are set
4446 # ===================================================================
4448 HAVE_GCC_GGDB2=
4449 if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4450     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
4451     save_CFLAGS=$CFLAGS
4452     CFLAGS="$CFLAGS -Werror -ggdb2"
4453     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
4454     CFLAGS=$save_CFLAGS
4455     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
4456         AC_MSG_RESULT([yes])
4457     else
4458         AC_MSG_RESULT([no])
4459     fi
4461     if test "$host_cpu" = "m68k"; then
4462         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
4463         save_CFLAGS=$CFLAGS
4464         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
4465         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
4466         CFLAGS=$save_CFLAGS
4467         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
4468             AC_MSG_RESULT([yes])
4469         else
4470             AC_MSG_ERROR([no])
4471         fi
4472     fi
4474 AC_SUBST(HAVE_GCC_GGDB2)
4476 dnl ===================================================================
4477 dnl  Test the gcc version
4478 dnl ===================================================================
4479 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
4480     AC_MSG_CHECKING([the GCC version])
4481     _gcc_version=`$CC -dumpfullversion`
4482     gcc_full_version=$(printf '%s' "$_gcc_version" | \
4483         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
4484     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
4486     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
4488     if test "$gcc_full_version" -lt 70000; then
4489         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
4490     fi
4491 else
4492     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
4493     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
4494     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
4495     # (which reports itself as GCC 4.2.1).
4496     GCC_VERSION=
4498 AC_SUBST(GCC_VERSION)
4500 dnl Set the ENABLE_DBGUTIL variable
4501 dnl ===================================================================
4502 AC_MSG_CHECKING([whether to build with additional debug utilities])
4503 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
4504     ENABLE_DBGUTIL="TRUE"
4505     # this is an extra var so it can have different default on different MSVC
4506     # versions (in case there are version specific problems with it)
4507     MSVC_USE_DEBUG_RUNTIME="TRUE"
4509     AC_MSG_RESULT([yes])
4510     # cppunit and graphite expose STL in public headers
4511     if test "$with_system_cppunit" = "yes"; then
4512         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
4513     else
4514         with_system_cppunit=no
4515     fi
4516     if test "$with_system_graphite" = "yes"; then
4517         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
4518     else
4519         with_system_graphite=no
4520     fi
4521     if test "$with_system_orcus" = "yes"; then
4522         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
4523     else
4524         with_system_orcus=no
4525     fi
4526     if test "$with_system_libcmis" = "yes"; then
4527         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
4528     else
4529         with_system_libcmis=no
4530     fi
4531     if test "$with_system_hunspell" = "yes"; then
4532         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
4533     else
4534         with_system_hunspell=no
4535     fi
4536     if test "$with_system_gpgmepp" = "yes"; then
4537         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
4538     else
4539         with_system_gpgmepp=no
4540     fi
4541     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
4542     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
4543     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
4544     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
4545     # of those two is using the system variant:
4546     if test "$with_system_libnumbertext" = "yes"; then
4547         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
4548     else
4549         with_system_libnumbertext=no
4550     fi
4551     if test "$with_system_libwps" = "yes"; then
4552         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
4553     else
4554         with_system_libwps=no
4555     fi
4556 else
4557     ENABLE_DBGUTIL=""
4558     MSVC_USE_DEBUG_RUNTIME=""
4559     AC_MSG_RESULT([no])
4561 AC_SUBST(ENABLE_DBGUTIL)
4562 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
4564 dnl Set the ENABLE_DEBUG variable.
4565 dnl ===================================================================
4566 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
4567     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
4569 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
4570     if test -z "$libo_fuzzed_enable_debug"; then
4571         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
4572     else
4573         AC_MSG_NOTICE([Resetting --enable-debug=yes])
4574         enable_debug=yes
4575     fi
4578 AC_MSG_CHECKING([whether to do a debug build])
4579 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
4580     ENABLE_DEBUG="TRUE"
4581     if test -n "$ENABLE_DBGUTIL" ; then
4582         AC_MSG_RESULT([yes (dbgutil)])
4583     else
4584         AC_MSG_RESULT([yes])
4585     fi
4586 else
4587     ENABLE_DEBUG=""
4588     AC_MSG_RESULT([no])
4590 AC_SUBST(ENABLE_DEBUG)
4592 dnl ===================================================================
4593 dnl Select the linker to use (gold/lld/ld.bfd).
4594 dnl This is done only after compiler checks (need to know if Clang is
4595 dnl used, for different defaults) and after checking if a debug build
4596 dnl is wanted (non-debug builds get the default linker if not explicitly
4597 dnl specified otherwise).
4598 dnl All checks for linker features/options should come after this.
4599 dnl ===================================================================
4600 check_use_ld()
4602     use_ld=-fuse-ld=${1%%:*}
4603     use_ld_path=${1#*:}
4604     if test "$use_ld_path" != "$1"; then
4605         if test "$COM_IS_CLANG" = TRUE; then
4606             if test "$CLANGVER" -ge 120000; then
4607                 use_ld="${use_ld} --ld-path=${use_ld_path}"
4608             else
4609                 use_ld="-fuse-ld=${use_ld_path}"
4610             fi
4611         else
4612             # I tried to use gcc's '-B<path>' and a directory + symlink setup in
4613             # $BUILDDIR, but libtool always filtered-out that option, so gcc wouldn't
4614             # pickup the alternative linker, when called by libtool for linking.
4615             # For mold, one can use LD_PRELOAD=/usr/lib/mold/mold-wrapper.so instead.
4616             AC_MSG_ERROR([A linker path is just supported with clang, because of libtool's -B filtering!])
4617         fi
4618     fi
4619     use_ld_fail_if_error=$2
4620     use_ld_ok=
4621     AC_MSG_CHECKING([for $use_ld linker support])
4622     use_ld_ldflags_save="$LDFLAGS"
4623     LDFLAGS="$LDFLAGS $use_ld"
4624     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4625 #include <stdio.h>
4626         ],[
4627 printf ("hello world\n");
4628         ])], USE_LD=$use_ld, [])
4629     if test -n "$USE_LD"; then
4630         AC_MSG_RESULT( yes )
4631         use_ld_ok=yes
4632     else
4633         if test -n "$use_ld_fail_if_error"; then
4634             AC_MSG_ERROR( no )
4635         else
4636             AC_MSG_RESULT( no )
4637         fi
4638     fi
4639     if test -n "$use_ld_ok"; then
4640         dnl keep the value of LDFLAGS
4641         return 0
4642     fi
4643     LDFLAGS="$use_ld_ldflags_save"
4644     return 1
4646 USE_LD=
4647 if test "$enable_ld" != "no"; then
4648     if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4649         if test -n "$enable_ld"; then
4650             check_use_ld "$enable_ld" fail_if_error
4651         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4652             dnl non-debug builds default to the default linker
4653             true
4654         elif test -n "$COM_IS_CLANG"; then
4655             check_use_ld lld
4656             if test $? -ne 0; then
4657                 check_use_ld gold
4658             fi
4659         else
4660             # For gcc first try gold, new versions also support lld.
4661             check_use_ld gold
4662             if test $? -ne 0; then
4663                 check_use_ld lld
4664             fi
4665         fi
4666         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4667         rm conftest.out
4668         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4669         if test -z "$ld_used"; then
4670             ld_used="unknown"
4671         fi
4672         AC_MSG_CHECKING([for linker that is used])
4673         AC_MSG_RESULT([$ld_used])
4674         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4675             if echo "$ld_used" | grep -q "^GNU ld"; then
4676                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4677                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4678             fi
4679         fi
4680     else
4681         if test "$enable_ld" = "yes"; then
4682             AC_MSG_ERROR([--enable-ld not supported])
4683         fi
4684     fi
4686 AC_SUBST(USE_LD)
4688 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4689 if test "$GCC" = "yes" -a "$_os" != Emscripten ; then
4690     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4691     bsymbolic_functions_ldflags_save=$LDFLAGS
4692     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4693     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4694 #include <stdio.h>
4695         ],[
4696 printf ("hello world\n");
4697         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4698     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4699         AC_MSG_RESULT( found )
4700     else
4701         AC_MSG_RESULT( not found )
4702     fi
4703     LDFLAGS=$bsymbolic_functions_ldflags_save
4705 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4707 LD_GC_SECTIONS=
4708 if test "$GCC" = "yes"; then
4709     for flag in "--gc-sections" "-dead_strip"; do
4710         AC_MSG_CHECKING([for $flag linker support])
4711         ldflags_save=$LDFLAGS
4712         LDFLAGS="$LDFLAGS -Wl,$flag"
4713         AC_LINK_IFELSE([AC_LANG_PROGRAM([
4714 #include <stdio.h>
4715             ],[
4716 printf ("hello world\n");
4717             ])],[
4718             LD_GC_SECTIONS="-Wl,$flag"
4719             AC_MSG_RESULT( found )
4720             ], [
4721             AC_MSG_RESULT( not found )
4722             ])
4723         LDFLAGS=$ldflags_save
4724         if test -n "$LD_GC_SECTIONS"; then
4725             break
4726         fi
4727     done
4729 AC_SUBST(LD_GC_SECTIONS)
4731 HAVE_EXTERNAL_DWARF=
4732 if test "$enable_split_debug" != no; then
4733     use_split_debug=
4734     if test -n "$ENABLE_LTO"; then
4735         : # Inherently incompatible, since no debug info is created while compiling, GCC complains.
4736     elif test "$enable_split_debug" = yes; then
4737         use_split_debug=1
4738     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4739     elif test "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4740         use_split_debug=1
4741     fi
4742     if test -n "$use_split_debug"; then
4743         if test "$_os" = "Emscripten"; then
4744             TEST_CC_FLAG=-gseparate-dwarf
4745         else
4746             TEST_CC_FLAG=-gsplit-dwarf
4747         fi
4748         AC_MSG_CHECKING([whether $CC_BASE supports $TEST_CC_FLAG])
4749         save_CFLAGS=$CFLAGS
4750         CFLAGS="$CFLAGS -Werror $TEST_CC_FLAG"
4751         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_EXTERNAL_DWARF=TRUE ],[])
4752         CFLAGS=$save_CFLAGS
4753         if test "$HAVE_EXTERNAL_DWARF" = "TRUE"; then
4754             AC_MSG_RESULT([yes])
4755         else
4756             if test "$enable_split_debug" = yes; then
4757                 AC_MSG_ERROR([no])
4758             else
4759                 AC_MSG_RESULT([no])
4760             fi
4761         fi
4762     fi
4763     if test -z "$HAVE_EXTERNAL_DWARF" -a "$test_split_debug" = "yes" -a -n "$use_split_debug"; then
4764         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4765         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4766     fi
4768 AC_SUBST(HAVE_EXTERNAL_DWARF)
4770 HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=
4771 AC_MSG_CHECKING([whether $CC_BASE supports -Xclang -debug-info-kind=constructor])
4772 save_CFLAGS=$CFLAGS
4773 CFLAGS="$CFLAGS -Werror -Xclang -debug-info-kind=constructor"
4774 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=TRUE ],[])
4775 CFLAGS=$save_CFLAGS
4776 if test "$HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR" = "TRUE"; then
4777     AC_MSG_RESULT([yes])
4778 else
4779     AC_MSG_RESULT([no])
4781 AC_SUBST(HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR)
4783 ENABLE_GDB_INDEX=
4784 if test "$enable_gdb_index" != "no"; then
4785     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4786     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4787         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4788         save_CFLAGS=$CFLAGS
4789         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4790         have_ggnu_pubnames=
4791         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4792         if test "$have_ggnu_pubnames" != "TRUE"; then
4793             if test "$enable_gdb_index" = "yes"; then
4794                 AC_MSG_ERROR([no, --enable-gdb-index not supported])
4795             else
4796                 AC_MSG_RESULT( no )
4797             fi
4798         else
4799             AC_MSG_RESULT( yes )
4800             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4801             ldflags_save=$LDFLAGS
4802             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4803             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4804 #include <stdio.h>
4805                 ],[
4806 printf ("hello world\n");
4807                 ])], ENABLE_GDB_INDEX=TRUE, [])
4808             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4809                 AC_MSG_RESULT( yes )
4810             else
4811                 if test "$enable_gdb_index" = "yes"; then
4812                     AC_MSG_ERROR( no )
4813                 else
4814                     AC_MSG_RESULT( no )
4815                 fi
4816             fi
4817             LDFLAGS=$ldflags_save
4818         fi
4819         CFLAGS=$save_CFLAGS
4820         fi
4821     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4822         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4823         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4824     fi
4826 AC_SUBST(ENABLE_GDB_INDEX)
4828 if test -z "$enable_sal_log" && test "$ENABLE_DEBUG" = TRUE; then
4829     enable_sal_log=yes
4831 if test "$enable_sal_log" = yes; then
4832     ENABLE_SAL_LOG=TRUE
4834 AC_SUBST(ENABLE_SAL_LOG)
4836 dnl Check for enable symbols option
4837 dnl ===================================================================
4838 AC_MSG_CHECKING([whether to generate debug information])
4839 if test -z "$enable_symbols"; then
4840     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4841         enable_symbols=yes
4842     else
4843         enable_symbols=no
4844     fi
4846 if test "$enable_symbols" = yes; then
4847     ENABLE_SYMBOLS_FOR=all
4848     AC_MSG_RESULT([yes])
4849 elif test "$enable_symbols" = no; then
4850     ENABLE_SYMBOLS_FOR=
4851     AC_MSG_RESULT([no])
4852 else
4853     # Selective debuginfo.
4854     ENABLE_SYMBOLS_FOR="$enable_symbols"
4855     AC_MSG_RESULT([for "$enable_symbols"])
4857 AC_SUBST(ENABLE_SYMBOLS_FOR)
4859 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4860     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4861     AC_MSG_CHECKING([whether enough memory is available for linking])
4862     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4863     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4864     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4865         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4866     else
4867         AC_MSG_RESULT([yes])
4868     fi
4871 ENABLE_OPTIMIZED=
4872 ENABLE_OPTIMIZED_DEBUG=
4873 AC_MSG_CHECKING([whether to compile with optimization flags])
4874 if test -z "$enable_optimized"; then
4875     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4876         enable_optimized=no
4877     else
4878         enable_optimized=yes
4879     fi
4881 if test "$enable_optimized" = yes; then
4882     ENABLE_OPTIMIZED=TRUE
4883     AC_MSG_RESULT([yes])
4884 elif test "$enable_optimized" = debug; then
4885     ENABLE_OPTIMIZED_DEBUG=TRUE
4886     AC_MSG_RESULT([yes (debug)])
4887     HAVE_GCC_OG=
4888     if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4889         AC_MSG_CHECKING([whether $CC_BASE supports -Og])
4890         save_CFLAGS=$CFLAGS
4891         CFLAGS="$CFLAGS -Werror -Og"
4892         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[])
4893         CFLAGS=$save_CFLAGS
4894         if test "$HAVE_GCC_OG" = "TRUE"; then
4895             AC_MSG_RESULT([yes])
4896         else
4897             AC_MSG_RESULT([no])
4898         fi
4899     fi
4900     if test -z "$HAVE_GCC_OG" -a "$_os" != "Emscripten"; then
4901         AC_MSG_ERROR([The compiler does not support optimizations suitable for debugging.])
4902     fi
4903 else
4904     AC_MSG_RESULT([no])
4906 AC_SUBST(ENABLE_OPTIMIZED)
4907 AC_SUBST(ENABLE_OPTIMIZED_DEBUG)
4910 # determine CPUNAME, OS, ...
4912 case "$host_os" in
4914 aix*)
4915     COM=GCC
4916     CPUNAME=POWERPC
4917     OS=AIX
4918     RTL_OS=AIX
4919     RTL_ARCH=PowerPC
4920     PLATFORMID=aix_powerpc
4921     P_SEP=:
4922     ;;
4924 cygwin*|wsl*)
4925     # Already handled
4926     ;;
4928 darwin*)
4929     COM=GCC
4930     OS=MACOSX
4931     RTL_OS=MacOSX
4932     P_SEP=:
4934     case "$host_cpu" in
4935     aarch64|arm64)
4936         if test "$enable_ios_simulator" = "yes"; then
4937             OS=iOS
4938         else
4939             CPUNAME=AARCH64
4940             RTL_ARCH=AARCH64
4941             PLATFORMID=macosx_aarch64
4942         fi
4943         ;;
4944     x86_64)
4945         if test "$enable_ios_simulator" = "yes"; then
4946             OS=iOS
4947         fi
4948         CPUNAME=X86_64
4949         RTL_ARCH=X86_64
4950         PLATFORMID=macosx_x86_64
4951         ;;
4952     *)
4953         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4954         ;;
4955     esac
4956     ;;
4958 ios*)
4959     COM=GCC
4960     OS=iOS
4961     RTL_OS=iOS
4962     P_SEP=:
4964     case "$host_cpu" in
4965     aarch64|arm64)
4966         if test "$enable_ios_simulator" = "yes"; then
4967             AC_MSG_ERROR([iOS simulator is only available in macOS not iOS])
4968         fi
4969         ;;
4970     *)
4971         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4972         ;;
4973     esac
4974     CPUNAME=AARCH64
4975     RTL_ARCH=AARCH64
4976     PLATFORMID=ios_arm64
4977     ;;
4979 dragonfly*)
4980     COM=GCC
4981     OS=DRAGONFLY
4982     RTL_OS=DragonFly
4983     P_SEP=:
4985     case "$host_cpu" in
4986     i*86)
4987         CPUNAME=INTEL
4988         RTL_ARCH=x86
4989         PLATFORMID=dragonfly_x86
4990         ;;
4991     x86_64)
4992         CPUNAME=X86_64
4993         RTL_ARCH=X86_64
4994         PLATFORMID=dragonfly_x86_64
4995         ;;
4996     *)
4997         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4998         ;;
4999     esac
5000     ;;
5002 freebsd*)
5003     COM=GCC
5004     RTL_OS=FreeBSD
5005     OS=FREEBSD
5006     P_SEP=:
5008     case "$host_cpu" in
5009     aarch64)
5010         CPUNAME=AARCH64
5011         PLATFORMID=freebsd_aarch64
5012         RTL_ARCH=AARCH64
5013         ;;
5014     i*86)
5015         CPUNAME=INTEL
5016         RTL_ARCH=x86
5017         PLATFORMID=freebsd_x86
5018         ;;
5019     x86_64|amd64)
5020         CPUNAME=X86_64
5021         RTL_ARCH=X86_64
5022         PLATFORMID=freebsd_x86_64
5023         ;;
5024     powerpc64)
5025         CPUNAME=POWERPC64
5026         RTL_ARCH=PowerPC_64
5027         PLATFORMID=freebsd_powerpc64
5028         ;;
5029     powerpc|powerpcspe)
5030         CPUNAME=POWERPC
5031         RTL_ARCH=PowerPC
5032         PLATFORMID=freebsd_powerpc
5033         ;;
5034     *)
5035         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5036         ;;
5037     esac
5038     ;;
5040 haiku*)
5041     COM=GCC
5042     GUIBASE=haiku
5043     RTL_OS=Haiku
5044     OS=HAIKU
5045     P_SEP=:
5047     case "$host_cpu" in
5048     i*86)
5049         CPUNAME=INTEL
5050         RTL_ARCH=x86
5051         PLATFORMID=haiku_x86
5052         ;;
5053     x86_64|amd64)
5054         CPUNAME=X86_64
5055         RTL_ARCH=X86_64
5056         PLATFORMID=haiku_x86_64
5057         ;;
5058     *)
5059         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5060         ;;
5061     esac
5062     ;;
5064 kfreebsd*)
5065     COM=GCC
5066     OS=LINUX
5067     RTL_OS=kFreeBSD
5068     P_SEP=:
5070     case "$host_cpu" in
5072     i*86)
5073         CPUNAME=INTEL
5074         RTL_ARCH=x86
5075         PLATFORMID=kfreebsd_x86
5076         ;;
5077     x86_64)
5078         CPUNAME=X86_64
5079         RTL_ARCH=X86_64
5080         PLATFORMID=kfreebsd_x86_64
5081         ;;
5082     *)
5083         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5084         ;;
5085     esac
5086     ;;
5088 linux-gnu*|linux-musl*)
5089     COM=GCC
5090     OS=LINUX
5091     RTL_OS=Linux
5092     P_SEP=:
5094     case "$host_cpu" in
5096     aarch64)
5097         CPUNAME=AARCH64
5098         PLATFORMID=linux_aarch64
5099         RTL_ARCH=AARCH64
5100         EPM_FLAGS="-a arm64"
5101         ;;
5102     alpha)
5103         CPUNAME=AXP
5104         RTL_ARCH=ALPHA
5105         PLATFORMID=linux_alpha
5106         ;;
5107     arm*)
5108         CPUNAME=ARM
5109         EPM_FLAGS="-a arm"
5110         RTL_ARCH=ARM_EABI
5111         PLATFORMID=linux_arm_eabi
5112         case "$host_cpu" in
5113         arm*-linux)
5114             RTL_ARCH=ARM_OABI
5115             PLATFORMID=linux_arm_oabi
5116             ;;
5117         esac
5118         ;;
5119     hppa)
5120         CPUNAME=HPPA
5121         RTL_ARCH=HPPA
5122         EPM_FLAGS="-a hppa"
5123         PLATFORMID=linux_hppa
5124         ;;
5125     i*86)
5126         CPUNAME=INTEL
5127         RTL_ARCH=x86
5128         PLATFORMID=linux_x86
5129         ;;
5130     ia64)
5131         CPUNAME=IA64
5132         RTL_ARCH=IA64
5133         PLATFORMID=linux_ia64
5134         ;;
5135     mips)
5136         CPUNAME=GODSON
5137         RTL_ARCH=MIPS_EB
5138         EPM_FLAGS="-a mips"
5139         PLATFORMID=linux_mips_eb
5140         ;;
5141     mips64)
5142         CPUNAME=GODSON64
5143         RTL_ARCH=MIPS64_EB
5144         EPM_FLAGS="-a mips64"
5145         PLATFORMID=linux_mips64_eb
5146         ;;
5147     mips64el)
5148         CPUNAME=GODSON64
5149         RTL_ARCH=MIPS64_EL
5150         EPM_FLAGS="-a mips64el"
5151         PLATFORMID=linux_mips64_el
5152         ;;
5153     mipsel)
5154         CPUNAME=GODSON
5155         RTL_ARCH=MIPS_EL
5156         EPM_FLAGS="-a mipsel"
5157         PLATFORMID=linux_mips_el
5158         ;;
5159     m68k)
5160         CPUNAME=M68K
5161         RTL_ARCH=M68K
5162         PLATFORMID=linux_m68k
5163         ;;
5164     powerpc)
5165         CPUNAME=POWERPC
5166         RTL_ARCH=PowerPC
5167         PLATFORMID=linux_powerpc
5168         ;;
5169     powerpc64)
5170         CPUNAME=POWERPC64
5171         RTL_ARCH=PowerPC_64
5172         PLATFORMID=linux_powerpc64
5173         ;;
5174     powerpc64le)
5175         CPUNAME=POWERPC64
5176         RTL_ARCH=PowerPC_64_LE
5177         PLATFORMID=linux_powerpc64_le
5178         ;;
5179     sparc)
5180         CPUNAME=SPARC
5181         RTL_ARCH=SPARC
5182         PLATFORMID=linux_sparc
5183         ;;
5184     sparc64)
5185         CPUNAME=SPARC64
5186         RTL_ARCH=SPARC64
5187         PLATFORMID=linux_sparc64
5188         ;;
5189     s390)
5190         CPUNAME=S390
5191         RTL_ARCH=S390
5192         PLATFORMID=linux_s390
5193         ;;
5194     s390x)
5195         CPUNAME=S390X
5196         RTL_ARCH=S390x
5197         PLATFORMID=linux_s390x
5198         ;;
5199     x86_64)
5200         CPUNAME=X86_64
5201         RTL_ARCH=X86_64
5202         PLATFORMID=linux_x86_64
5203         ;;
5204     *)
5205         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5206         ;;
5207     esac
5208     ;;
5210 linux-android*)
5211     COM=GCC
5212     OS=ANDROID
5213     RTL_OS=Android
5214     P_SEP=:
5216     case "$host_cpu" in
5218     arm|armel)
5219         CPUNAME=ARM
5220         RTL_ARCH=ARM_EABI
5221         PLATFORMID=android_arm_eabi
5222         ;;
5223     aarch64)
5224         CPUNAME=AARCH64
5225         RTL_ARCH=AARCH64
5226         PLATFORMID=android_aarch64
5227         ;;
5228     i*86)
5229         CPUNAME=INTEL
5230         RTL_ARCH=x86
5231         PLATFORMID=android_x86
5232         ;;
5233     x86_64)
5234         CPUNAME=X86_64
5235         RTL_ARCH=X86_64
5236         PLATFORMID=android_x86_64
5237         ;;
5238     *)
5239         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5240         ;;
5241     esac
5242     ;;
5244 *netbsd*)
5245     COM=GCC
5246     OS=NETBSD
5247     RTL_OS=NetBSD
5248     P_SEP=:
5250     case "$host_cpu" in
5251     i*86)
5252         CPUNAME=INTEL
5253         RTL_ARCH=x86
5254         PLATFORMID=netbsd_x86
5255         ;;
5256     powerpc)
5257         CPUNAME=POWERPC
5258         RTL_ARCH=PowerPC
5259         PLATFORMID=netbsd_powerpc
5260         ;;
5261     sparc)
5262         CPUNAME=SPARC
5263         RTL_ARCH=SPARC
5264         PLATFORMID=netbsd_sparc
5265         ;;
5266     x86_64)
5267         CPUNAME=X86_64
5268         RTL_ARCH=X86_64
5269         PLATFORMID=netbsd_x86_64
5270         ;;
5271     *)
5272         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5273         ;;
5274     esac
5275     ;;
5277 openbsd*)
5278     COM=GCC
5279     OS=OPENBSD
5280     RTL_OS=OpenBSD
5281     P_SEP=:
5283     case "$host_cpu" in
5284     i*86)
5285         CPUNAME=INTEL
5286         RTL_ARCH=x86
5287         PLATFORMID=openbsd_x86
5288         ;;
5289     x86_64)
5290         CPUNAME=X86_64
5291         RTL_ARCH=X86_64
5292         PLATFORMID=openbsd_x86_64
5293         ;;
5294     *)
5295         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5296         ;;
5297     esac
5298     SOLARINC="$SOLARINC -I/usr/local/include"
5299     ;;
5301 solaris*)
5302     COM=GCC
5303     OS=SOLARIS
5304     RTL_OS=Solaris
5305     P_SEP=:
5307     case "$host_cpu" in
5308     i*86)
5309         CPUNAME=INTEL
5310         RTL_ARCH=x86
5311         PLATFORMID=solaris_x86
5312         ;;
5313     sparc)
5314         CPUNAME=SPARC
5315         RTL_ARCH=SPARC
5316         PLATFORMID=solaris_sparc
5317         ;;
5318     sparc64)
5319         CPUNAME=SPARC64
5320         RTL_ARCH=SPARC64
5321         PLATFORMID=solaris_sparc64
5322         ;;
5323     *)
5324         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5325         ;;
5326     esac
5327     SOLARINC="$SOLARINC -I/usr/local/include"
5328     ;;
5330 emscripten*)
5331     COM=GCC
5332     OS=EMSCRIPTEN
5333     RTL_OS=Emscripten
5334     P_SEP=:
5336     case "$host_cpu" in
5337     wasm32|wasm64)
5338         ;;
5339     *)
5340         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5341         ;;
5342     esac
5343     CPUNAME=INTEL
5344     RTL_ARCH=x86
5345     PLATFORMID=linux_x86
5346     ;;
5349     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
5350     ;;
5351 esac
5353 DISABLE_GUI=""
5354 if test "$enable_gui" = "no"; then
5355     if test "$using_x11" != yes; then
5356         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
5357     fi
5358     USING_X11=
5359     DISABLE_GUI=TRUE
5360     test_epoxy=no
5361 else
5362     AC_DEFINE(HAVE_FEATURE_UI)
5364 AC_SUBST(DISABLE_GUI)
5366 if test "$with_x" = "no"; then
5367     USING_X11=
5370 if test -z "$USING_X11" -a "$DISABLE_DYNLOADING" = TRUE -a "$enable_gen" = "yes"; then
5371     AC_MSG_ERROR([Can't select gen VCL plugin, if --without-x is used!])
5374 if test "$using_x11" = yes; then
5375     if test "$USING_X11" = TRUE; then
5376         AC_DEFINE(USING_X11)
5377     else
5378         disable_x11_tests
5379         if test "$DISABLE_DYNLOADING" = TRUE; then
5380             test_qt5=yes
5381         fi
5382     fi
5383 else
5384     if test "$USING_X11" = TRUE; then
5385         AC_MSG_ERROR([Platform doesn't support X11 (\$using_x11), but \$USING_X11 is set!])
5386     fi
5389 WORKDIR="${BUILDDIR}/workdir"
5390 INSTDIR="${BUILDDIR}/instdir"
5391 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
5392 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
5393 AC_SUBST(COM)
5394 AC_SUBST(CPUNAME)
5395 AC_SUBST(RTL_OS)
5396 AC_SUBST(RTL_ARCH)
5397 AC_SUBST(EPM_FLAGS)
5398 AC_SUBST(USING_X11)
5399 AC_SUBST([INSTDIR])
5400 AC_SUBST([INSTROOT])
5401 AC_SUBST([INSTROOTBASE])
5402 AC_SUBST(OS)
5403 AC_SUBST(P_SEP)
5404 AC_SUBST(WORKDIR)
5405 AC_SUBST(PLATFORMID)
5406 AC_SUBST(WINDOWS_X64)
5407 AC_DEFINE_UNQUOTED(SDKDIR, "$INSTDIR/$SDKDIRNAME")
5408 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
5410 if test "$OS" = WNT -a "$COM" = MSC; then
5411     case "$CPUNAME" in
5412     INTEL) CPPU_ENV=msci ;;
5413     X86_64) CPPU_ENV=mscx ;;
5414     AARCH64) CPPU_ENV=msca ;;
5415     *)
5416         AC_MSG_ERROR([Unknown \$CPUNAME '$CPUNAME' for $OS / $COM"])
5417         ;;
5418     esac
5419 else
5420     CPPU_ENV=gcc3
5422 AC_SUBST(CPPU_ENV)
5424 dnl ===================================================================
5425 dnl Test which package format to use
5426 dnl ===================================================================
5427 AC_MSG_CHECKING([which package format to use])
5428 if test -n "$with_package_format" -a "$with_package_format" != no; then
5429     for i in $with_package_format; do
5430         case "$i" in
5431         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
5432             ;;
5433         *)
5434             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
5435 aix - AIX software distribution
5436 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
5437 deb - Debian software distribution
5438 pkg - Solaris software distribution
5439 rpm - RedHat software distribution
5441 LibreOffice additionally supports:
5442 archive - .tar.gz or .zip
5443 dmg - macOS .dmg
5444 installed - installation tree
5445 msi - Windows .msi
5446         ])
5447             ;;
5448         esac
5449     done
5450     # fakeroot is needed to ensure correct file ownerships/permissions
5451     # inside deb packages and tar archives created on Linux and Solaris.
5452     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
5453         AC_PATH_PROG(FAKEROOT, fakeroot, no)
5454         if test "$FAKEROOT" = "no"; then
5455             AC_MSG_ERROR(
5456                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
5457         fi
5458     fi
5459     PKGFORMAT="$with_package_format"
5460     AC_MSG_RESULT([$PKGFORMAT])
5461 else
5462     PKGFORMAT=
5463     AC_MSG_RESULT([none])
5465 AC_SUBST(PKGFORMAT)
5467 dnl ===================================================================
5468 dnl handle help related options
5470 dnl If you change help related options, please update README.help
5471 dnl ===================================================================
5473 ENABLE_HTMLHELP=
5474 HELP_OMINDEX_PAGE=
5475 HELP_ONLINE=
5476 WITH_HELPPACKS=
5478 AC_MSG_CHECKING([which help to build])
5479 if test -n "$with_help" -a "$with_help" != "no"; then
5480     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5481     BUILD_TYPE="$BUILD_TYPE HELP"
5482     case "$with_help" in
5483     "html")
5484         ENABLE_HTMLHELP=TRUE
5485         WITH_HELPPACKS=TRUE
5486         SCPDEFS="$SCPDEFS -DWITH_HELPPACKS"
5487         AC_MSG_RESULT([HTML (local)])
5488         ;;
5489     "online")
5490         ENABLE_HTMLHELP=TRUE
5491         HELP_ONLINE=TRUE
5492         AC_MSG_RESULT([HTML (online)])
5493         ;;
5494     yes)
5495         WITH_HELPPACKS=TRUE
5496         SCPDEFS="$SCPDEFS -DWITH_HELPPACKS"
5497         AC_MSG_RESULT([XML (local)])
5498         ;;
5499     *)
5500         AC_MSG_ERROR([Unknown --with-help=$with_help])
5501         ;;
5502     esac
5503 else
5504     AC_MSG_RESULT([no])
5507 AC_MSG_CHECKING([if we need to build the help index tooling])
5508 if test \( "$with_help" = yes -o "$enable_extension_integration" != no \) -a -z "$DISABLE_DYNLOADING"; then
5509     BUILD_TYPE="$BUILD_TYPE HELPTOOLS"
5510     test_clucene=yes
5511     AC_MSG_RESULT([yes])
5512 else
5513     AC_MSG_RESULT([no])
5516 AC_MSG_CHECKING([whether to enable xapian-omega support for online help])
5517 if test -n "$with_omindex" -a "$with_omindex" != "no"; then
5518     if test "$HELP_ONLINE" != TRUE; then
5519         AC_MSG_ERROR([Can't build xapian-omega index without --help=online])
5520     fi
5521     case "$with_omindex" in
5522     "server")
5523         HELP_OMINDEX_PAGE=TRUE
5524         AC_MSG_RESULT([SERVER])
5525         ;;
5526     "noxap")
5527         AC_MSG_RESULT([NOXAP])
5528         ;;
5529     *)
5530         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5531         ;;
5532     esac
5533 else
5534     AC_MSG_RESULT([no])
5537 AC_MSG_CHECKING([whether to include the XML-help support])
5538 if test "$enable_xmlhelp" = yes; then
5539     BUILD_TYPE="$BUILD_TYPE XMLHELP"
5540     test_clucene=yes
5541     AC_DEFINE(HAVE_FEATURE_XMLHELP)
5542     AC_MSG_RESULT([yes])
5543 else
5544     if test "$with_help" = yes; then
5545         add_warning "Building the XML help, but LO with disabled xmlhelp support. Generated help can't be accessed from this LO build!"
5546     fi
5547     AC_MSG_RESULT([no])
5550 dnl Test whether to integrate helppacks into the product's installer
5551 AC_MSG_CHECKING([for helppack integration])
5552 if test -z "$WITH_HELPPACKS" -o "$with_helppack_integration" = no; then
5553     AC_MSG_RESULT([no integration])
5554 else
5555     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
5556     AC_MSG_RESULT([integration])
5559 AC_SUBST([ENABLE_HTMLHELP])
5560 AC_SUBST([HELP_OMINDEX_PAGE])
5561 AC_SUBST([HELP_ONLINE])
5562 # WITH_HELPPACKS is used only in configure
5564 dnl ===================================================================
5565 dnl Set up a different compiler to produce tools to run on the build
5566 dnl machine when doing cross-compilation
5567 dnl ===================================================================
5569 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
5570 m4_pattern_allow([PKG_CONFIG_LIBDIR])
5571 if test "$cross_compiling" = "yes"; then
5572     AC_MSG_CHECKING([for BUILD platform configuration])
5573     echo
5574     rm -rf CONF-FOR-BUILD config_build.mk
5575     mkdir CONF-FOR-BUILD
5576     # Here must be listed all files needed when running the configure script. In particular, also
5577     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
5578     # keep them in the same order as there.
5579     (cd $SRC_ROOT && tar cf - \
5580         config.guess \
5581         bin/get_config_variables \
5582         solenv/bin/getcompver.awk \
5583         solenv/inc/langlist.mk \
5584         download.lst \
5585         config_host.mk.in \
5586         config_host_lang.mk.in \
5587         Makefile.in \
5588         bin/bffvalidator.sh.in \
5589         bin/odfvalidator.sh.in \
5590         bin/officeotron.sh.in \
5591         hardened_runtime.xcent.in \
5592         instsetoo_native/util/openoffice.lst.in \
5593         config_host/*.in \
5594         sysui/desktop/macosx/Info.plist.in \
5595         .vscode/vs-code-template.code-workspace.in \
5596         solenv/lockfile/autoconf.h.in \
5597         ) \
5598     | (cd CONF-FOR-BUILD && tar xf -)
5599     cp configure CONF-FOR-BUILD
5600     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
5601     (
5602     unset COM USING_X11 OS CPUNAME
5603     unset CC CXX SYSBASE CFLAGS
5604     unset AR LD NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
5605     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
5606     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
5607     unset PKG_CONFIG_LIBDIR PKG_CONFIG_PATH
5608     if test -n "$CC_FOR_BUILD"; then
5609         export CC="$CC_FOR_BUILD"
5610         CC_BASE=`first_arg_basename "$CC"`
5611     fi
5612     if test -n "$CXX_FOR_BUILD"; then
5613         export CXX="$CXX_FOR_BUILD"
5614         CXX_BASE=`first_arg_basename "$CXX"`
5615     fi
5616     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
5617     cd CONF-FOR-BUILD
5619     # Handle host configuration, which affects the cross-toolset too
5620     sub_conf_opts=""
5621     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
5622     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
5623     test "$with_junit" = "no" && sub_conf_opts="$sub_conf_opts --without-junit"
5624     # While we don't need scripting support, we don't have a PYTHON_FOR_BUILD Java equivalent, so must enable scripting for Java
5625     if test -n "$ENABLE_JAVA"; then
5626         case "$_os" in
5627         Android)
5628             # Hack for Android - the build doesn't need a host JDK, so just forward to build for convenience
5629             test -n "$with_jdk_home" && sub_conf_opts="$sub_conf_opts --with-jdk-home=$with_jdk_home"
5630             ;;
5631         *)
5632             if test -z "$with_jdk_home"; then
5633                 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.])
5634             fi
5635             ;;
5636         esac
5637     else
5638         sub_conf_opts="$sub_conf_opts --disable-scripting"
5639     fi
5640     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
5641     test "$with_galleries" = "no" -o -z "$WITH_GALLERY_BUILD" && sub_conf_opts="$sub_conf_opts --with-galleries=no --disable-database-connectivity"
5642     test -n "$with_help" -a "$with_help" != "no" && sub_conf_opts="$sub_conf_opts --with-help=$with_help"
5643     test "$enable_extensions" = yes || sub_conf_opts="$sub_conf_opts --disable-extensions"
5644     test "${enable_ld+set}" = set -a "$build_cpu" = "$host_cpu" && sub_conf_opts="$sub_conf_opts --enable-ld=${enable_ld}"
5645     test "${enable_pch+set}" = set && sub_conf_opts="$sub_conf_opts --enable-pch=${enable_pch}"
5646     test "$enable_wasm_strip" = "yes" && sub_conf_opts="$sub_conf_opts --enable-wasm-strip"
5647     test "${with_system_lockfile+set}" = set && sub_conf_opts="$sub_conf_opts --with-system-lockfile=${with_system_lockfile}"
5648     test "${enable_fuzzers}" = yes && sub_conf_opts="$sub_conf_opts --without-system-libxml"
5649     if test "$_os" = "Emscripten"; then
5650         sub_conf_opts="$sub_conf_opts --without-system-libxml --without-system-fontconfig --without-system-freetype --without-system-zlib"
5651     fi
5653     # Don't bother having configure look for stuff not needed for the build platform anyway
5654     # WARNING: any option with an argument containing spaces must be handled separately (see --with-theme)
5655     sub_conf_defaults=" \
5656         --build="$build_alias" \
5657         --disable-cairo-canvas \
5658         --disable-cups \
5659         --disable-customtarget-components \
5660         --disable-firebird-sdbc \
5661         --disable-gpgmepp \
5662         --disable-gstreamer-1-0 \
5663         --disable-gtk3 \
5664         --disable-gtk4 \
5665         --disable-libcmis \
5666         --disable-mariadb-sdbc \
5667         --disable-nss \
5668         --disable-online-update \
5669         --disable-opencl \
5670         --disable-pdfimport \
5671         --disable-postgresql-sdbc \
5672         --disable-skia \
5673         --disable-xmlhelp \
5674         --enable-dynamic-loading \
5675         --enable-icecream="$enable_icecream" \
5676         --without-doxygen \
5677         --without-webdav \
5678         --without-x \
5679         --with-tls=openssl \
5681     # single quotes added for better readability in case of spaces
5682     echo "    Running CONF-FOR-BUILD/configure" \
5683         $sub_conf_defaults \
5684         --with-parallelism="'$with_parallelism'" \
5685         --with-theme="'$with_theme'" \
5686         $sub_conf_opts \
5687         $with_build_platform_configure_options \
5688         --srcdir=$srcdir
5690     ./configure \
5691         $sub_conf_defaults \
5692         --with-parallelism="$with_parallelism" \
5693         --with-theme="$with_theme" \
5694         $sub_conf_opts \
5695         $with_build_platform_configure_options \
5696         --srcdir=$srcdir \
5697         2>&1 | sed -e 's/^/    /'
5698     if test [${PIPESTATUS[0]}] -ne 0; then
5699         AC_MSG_ERROR([Running the configure script for BUILD side failed, see CONF-FOR-BUILD/config.log])
5700     fi
5702     # filter permitted build targets
5703     PERMITTED_BUILD_TARGETS="
5704         AVMEDIA
5705         BOOST
5706         CAIRO
5707         CLUCENE
5708         CUCKOO
5709         CURL
5710         DBCONNECTIVITY
5711         DESKTOP
5712         DRAGONBOX
5713         DYNLOADING
5714         EPOXY
5715         EXPAT
5716         GLM
5717         GRAPHITE
5718         HARFBUZZ
5719         HELPTOOLS
5720         ICU
5721         LCMS2
5722         LIBJPEG_TURBO
5723         LIBLANGTAG
5724         LibO
5725         LIBFFI
5726         LIBPN
5727         LIBWEBP
5728         LIBXML2
5729         LIBXSLT
5730         MDDS
5731         NATIVE
5732         OPENSSL
5733         ORCUS
5734         PYTHON
5735         SCRIPTING
5736         ZLIB
5738     # converts BUILD_TYPE and PERMITTED_BUILD_TARGETS into non-whitespace,
5739     # newlined lists, to use grep as a filter
5740     PERMITTED_BUILD_TARGETS=$(echo "$PERMITTED_BUILD_TARGETS" | sed -e '/^ *$/d' -e 's/ *//')
5741     BUILD_TARGETS="$(sed -n -e '/^export BUILD_TYPE=/ s/.*=//p' config_host.mk | tr ' ' '\n')"
5742     BUILD_TARGETS="$(echo "$BUILD_TARGETS" | grep -F "$PERMITTED_BUILD_TARGETS" | tr '\n' ' ')"
5743     sed -i -e "s/ BUILD_TYPE=.*$/ BUILD_TYPE=$BUILD_TARGETS/" config_host.mk
5745     cp config_host.mk ../config_build.mk
5746     cp config_host_lang.mk ../config_build_lang.mk
5747     mv config.log ../config.Build.log
5748     mkdir -p ../config_build
5749     mv config_host/*.h ../config_build
5750     test -f "$WARNINGS_FILE" && mv "$WARNINGS_FILE" "../$WARNINGS_FILE_FOR_BUILD"
5752     # all these will get a _FOR_BUILD postfix
5753     DIRECT_FOR_BUILD_SETTINGS="
5754         CC
5755         CPPU_ENV
5756         CXX
5757         ILIB
5758         JAVA_HOME
5759         JAVAIFLAGS
5760         JDK
5761         LIBO_BIN_FOLDER
5762         LIBO_LIB_FOLDER
5763         LIBO_URE_LIB_FOLDER
5764         LIBO_URE_MISC_FOLDER
5765         OS
5766         SDKDIRNAME
5767         SYSTEM_LIBXML
5768         SYSTEM_LIBXSLT
5770     # these overwrite host config with build config
5771     OVERWRITING_SETTINGS="
5772         ANT
5773         ANT_HOME
5774         ANT_LIB
5775         HSQLDB_USE_JDBC_4_1
5776         JAVA_CLASSPATH_NOT_SET
5777         JAVA_SOURCE_VER
5778         JAVA_TARGET_VER
5779         JAVACFLAGS
5780         JAVACOMPILER
5781         JAVADOC
5782         JAVADOCISGJDOC
5783         LOCKFILE
5784         SYSTEM_GENBRK
5785         SYSTEM_GENCCODE
5786         SYSTEM_GENCMN
5788     # these need some special handling
5789     EXTRA_HANDLED_SETTINGS="
5790         INSTDIR
5791         INSTROOT
5792         PATH
5793         WORKDIR
5795     OLD_PATH=$PATH
5796     . ./bin/get_config_variables $DIRECT_FOR_BUILD_SETTINGS $OVERWRITING_SETTINGS $EXTRA_HANDLED_SETTINGS
5797     BUILD_PATH=$PATH
5798     PATH=$OLD_PATH
5800     line=`echo "LO_PATH_FOR_BUILD='${BUILD_PATH}'" | sed -e 's,/CONF-FOR-BUILD,,g'`
5801     echo "$line" >>build-config
5803     for V in $DIRECT_FOR_BUILD_SETTINGS; do
5804         VV='$'$V
5805         VV=`eval "echo $VV"`
5806         if test -n "$VV"; then
5807             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
5808             echo "$line" >>build-config
5809         fi
5810     done
5812     for V in $OVERWRITING_SETTINGS; do
5813         VV='$'$V
5814         VV=`eval "echo $VV"`
5815         if test -n "$VV"; then
5816             line=${V}='${'${V}:-$VV'}'
5817             echo "$line" >>build-config
5818         fi
5819     done
5821     for V in INSTDIR INSTROOT WORKDIR; do
5822         VV='$'$V
5823         VV=`eval "echo $VV"`
5824         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
5825         if test -n "$VV"; then
5826             line="${V}_FOR_BUILD='$VV'"
5827             echo "$line" >>build-config
5828         fi
5829     done
5831     )
5832     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([setup/configure for BUILD side failed, see CONF-FOR-BUILD/config.log])
5833     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])
5834     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
5835              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
5837     eval `cat CONF-FOR-BUILD/build-config`
5839     AC_MSG_RESULT([checking for BUILD platform configuration... done])
5841     rm -rf CONF-FOR-BUILD
5842 else
5843     OS_FOR_BUILD="$OS"
5844     CC_FOR_BUILD="$CC"
5845     CPPU_ENV_FOR_BUILD="$CPPU_ENV"
5846     CXX_FOR_BUILD="$CXX"
5847     INSTDIR_FOR_BUILD="$INSTDIR"
5848     INSTROOT_FOR_BUILD="$INSTROOT"
5849     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
5850     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
5851     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
5852     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
5853     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
5854     WORKDIR_FOR_BUILD="$WORKDIR"
5856 AC_SUBST(OS_FOR_BUILD)
5857 AC_SUBST(INSTDIR_FOR_BUILD)
5858 AC_SUBST(INSTROOT_FOR_BUILD)
5859 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
5860 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
5861 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
5862 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
5863 AC_SUBST(SDKDIRNAME_FOR_BUILD)
5864 AC_SUBST(WORKDIR_FOR_BUILD)
5865 AC_SUBST(CC_FOR_BUILD)
5866 AC_SUBST(CXX_FOR_BUILD)
5867 AC_SUBST(CPPU_ENV_FOR_BUILD)
5869 dnl ===================================================================
5870 dnl Check for lockfile deps
5871 dnl ===================================================================
5872 if test -z "$CROSS_COMPILING"; then
5873     test -n "$LOCKFILE" -a "${with_system_lockfile+set}" != set && with_system_lockfile="$LOCKFILE"
5874     test "${with_system_lockfile+set}" = set || with_system_lockfile=no
5875     AC_MSG_CHECKING([which lockfile binary to use])
5876     case "$with_system_lockfile" in
5877     yes)
5878         AC_MSG_RESULT([external])
5879         AC_PATH_PROGS([LOCKFILE],[dotlockfile lockfile])
5880         ;;
5881     no)
5882         AC_MSG_RESULT([internal])
5883         ;;
5884     *)
5885         if test -x "$with_system_lockfile"; then
5886             LOCKFILE="$with_system_lockfile"
5887         else
5888             AC_MSG_ERROR(['$with_system_lockfile' is not executable.])
5889         fi
5890         AC_MSG_RESULT([$with_system_lockfile])
5891         ;;
5892     esac
5895 if test -n "$LOCKFILE" -a "$DISABLE_DYNLOADING" = TRUE; then
5896     add_warning "The default system lockfile has increasing poll intervals up to 60s, so linking executables may be delayed."
5899 AC_CHECK_HEADERS([getopt.h paths.h sys/param.h])
5900 AC_CHECK_FUNCS([utime utimes])
5901 AC_SUBST(LOCKFILE)
5903 dnl ===================================================================
5904 dnl Check for syslog header
5905 dnl ===================================================================
5906 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
5908 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
5909 dnl ===================================================================
5910 AC_MSG_CHECKING([whether to turn warnings to errors])
5911 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
5912     ENABLE_WERROR="TRUE"
5913     PYTHONWARNINGS="error"
5914     AC_MSG_RESULT([yes])
5915 else
5916     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
5917         ENABLE_WERROR="TRUE"
5918         PYTHONWARNINGS="error"
5919         AC_MSG_RESULT([yes])
5920     else
5921         AC_MSG_RESULT([no])
5922     fi
5924 AC_SUBST(ENABLE_WERROR)
5925 AC_SUBST(PYTHONWARNINGS)
5927 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
5928 dnl ===================================================================
5929 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
5930 if test -z "$enable_assert_always_abort"; then
5931    if test "$ENABLE_DEBUG" = TRUE; then
5932        enable_assert_always_abort=yes
5933    else
5934        enable_assert_always_abort=no
5935    fi
5937 if test "$enable_assert_always_abort" = "yes"; then
5938     ASSERT_ALWAYS_ABORT="TRUE"
5939     AC_MSG_RESULT([yes])
5940 else
5941     ASSERT_ALWAYS_ABORT="FALSE"
5942     AC_MSG_RESULT([no])
5944 AC_SUBST(ASSERT_ALWAYS_ABORT)
5946 # Determine whether to use ooenv for the instdir installation
5947 # ===================================================================
5948 if test $_os != "WINNT" -a $_os != "Darwin"; then
5949     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
5950     if test -z "$enable_ooenv"; then
5951         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5952             enable_ooenv=yes
5953         else
5954             enable_ooenv=no
5955         fi
5956     fi
5957     if test "$enable_ooenv" = "no"; then
5958         AC_MSG_RESULT([no])
5959     else
5960         ENABLE_OOENV="TRUE"
5961         AC_MSG_RESULT([yes])
5962     fi
5964 AC_SUBST(ENABLE_OOENV)
5966 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
5967     if test "$enable_qt5" = "no"; then
5968         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
5969     else
5970         enable_qt5=yes
5971     fi
5974 AC_MSG_CHECKING([whether to build the pagein binaries for oosplash])
5975 if test "${enable_pagein}" != no -a -z "$DISABLE_DYNLOADING"; then
5976     AC_MSG_RESULT([yes])
5977     ENABLE_PAGEIN=TRUE
5978     AC_DEFINE(HAVE_FEATURE_PAGEIN)
5979 else
5980     AC_MSG_RESULT([no])
5982 AC_SUBST(ENABLE_PAGEIN)
5984 dnl ===================================================================
5985 dnl check for cups support
5986 dnl ===================================================================
5988 AC_MSG_CHECKING([whether to enable CUPS support])
5989 if test "$test_cups" = yes -a "$enable_cups" != no; then
5990     ENABLE_CUPS=TRUE
5991     AC_MSG_RESULT([yes])
5993     AC_MSG_CHECKING([whether cups support is present])
5994     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
5995     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
5996     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
5997         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
5998     fi
5999 else
6000     AC_MSG_RESULT([no])
6003 AC_SUBST(ENABLE_CUPS)
6005 libo_CHECK_SYSTEM_MODULE([fontconfig],[FONTCONFIG],[fontconfig >= 2.4.1],,system,TRUE)
6007 dnl whether to find & fetch external tarballs?
6008 dnl ===================================================================
6009 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
6010    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6011        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
6012    else
6013        TARFILE_LOCATION="$LODE_HOME/ext_tar"
6014    fi
6016 if test -z "$TARFILE_LOCATION"; then
6017     if test -d "$SRC_ROOT/src" ; then
6018         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
6019         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
6020     fi
6021     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
6022 else
6023     AbsolutePath "$TARFILE_LOCATION"
6024     PathFormat "${absolute_path}"
6025     TARFILE_LOCATION="${formatted_path}"
6027 AC_SUBST(TARFILE_LOCATION)
6029 AC_MSG_CHECKING([whether we want to fetch tarballs])
6030 if test "$enable_fetch_external" != "no"; then
6031     if test "$with_all_tarballs" = "yes"; then
6032         AC_MSG_RESULT([yes, all of them])
6033         DO_FETCH_TARBALLS="ALL"
6034     else
6035         AC_MSG_RESULT([yes, if we use them])
6036         DO_FETCH_TARBALLS="TRUE"
6037     fi
6038 else
6039     AC_MSG_RESULT([no])
6040     DO_FETCH_TARBALLS=
6042 AC_SUBST(DO_FETCH_TARBALLS)
6044 dnl Test whether to include MySpell dictionaries
6045 dnl ===================================================================
6046 AC_MSG_CHECKING([whether to include MySpell dictionaries])
6047 if test "$with_myspell_dicts" = "yes"; then
6048     AC_MSG_RESULT([yes])
6049     WITH_MYSPELL_DICTS=TRUE
6050     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
6051     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
6052 else
6053     AC_MSG_RESULT([no])
6054     WITH_MYSPELL_DICTS=
6056 AC_SUBST(WITH_MYSPELL_DICTS)
6058 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
6059 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
6060     if test "$with_system_dicts" = yes; then
6061         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
6062     fi
6063     with_system_dicts=no
6066 AC_MSG_CHECKING([whether to use dicts from external paths])
6067 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
6068     AC_MSG_RESULT([yes])
6069     SYSTEM_DICTS=TRUE
6070     AC_MSG_CHECKING([for spelling dictionary directory])
6071     if test -n "$with_external_dict_dir"; then
6072         DICT_SYSTEM_DIR=file://$with_external_dict_dir
6073     else
6074         DICT_SYSTEM_DIR=file:///usr/share/hunspell
6075         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
6076             DICT_SYSTEM_DIR=file:///usr/share/myspell
6077         fi
6078     fi
6079     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
6080     AC_MSG_CHECKING([for hyphenation patterns directory])
6081     if test -n "$with_external_hyph_dir"; then
6082         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
6083     else
6084         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
6085     fi
6086     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
6087     AC_MSG_CHECKING([for thesaurus directory])
6088     if test -n "$with_external_thes_dir"; then
6089         THES_SYSTEM_DIR=file://$with_external_thes_dir
6090     else
6091         THES_SYSTEM_DIR=file:///usr/share/mythes
6092     fi
6093     AC_MSG_RESULT([$THES_SYSTEM_DIR])
6094 else
6095     AC_MSG_RESULT([no])
6096     SYSTEM_DICTS=
6098 AC_SUBST(SYSTEM_DICTS)
6099 AC_SUBST(DICT_SYSTEM_DIR)
6100 AC_SUBST(HYPH_SYSTEM_DIR)
6101 AC_SUBST(THES_SYSTEM_DIR)
6103 dnl ===================================================================
6104 dnl Precompiled headers.
6105 ENABLE_PCH=""
6106 AC_MSG_CHECKING([whether to enable pch feature])
6107 if test -z "$enable_pch"; then
6108     if test "$_os" = "WINNT"; then
6109         # Enabled by default on Windows.
6110         enable_pch=yes
6111         # never use sccache on auto-enabled PCH builds, except if requested explicitly
6112         if test -z "$enable_ccache" -a "$SCCACHE"; then
6113             CCACHE=""
6114         fi
6115     else
6116         enable_pch=no
6117     fi
6119 if test "$enable_pch" != no -a "$_os" = Emscripten -a "$ENABLE_WASM_EXCEPTIONS" = TRUE; then
6120     AC_MSG_ERROR([PCH currently isn't supported for Emscripten with native EH (nEH) because of missing Sj/Lj support with nEH in clang.])
6122 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
6123     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
6125 if test "$enable_pch" = "system"; then
6126     ENABLE_PCH="1"
6127     AC_MSG_RESULT([yes (system headers)])
6128 elif test "$enable_pch" = "base"; then
6129     ENABLE_PCH="2"
6130     AC_MSG_RESULT([yes (system and base headers)])
6131 elif test "$enable_pch" = "normal"; then
6132     ENABLE_PCH="3"
6133     AC_MSG_RESULT([yes (normal)])
6134 elif test "$enable_pch" = "full"; then
6135     ENABLE_PCH="4"
6136     AC_MSG_RESULT([yes (full)])
6137 elif test "$enable_pch" = "yes"; then
6138     # Pick a suitable default.
6139     if test "$GCC" = "yes"; then
6140         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
6141         # while making the PCHs larger and rebuilds more likely.
6142         ENABLE_PCH="2"
6143         AC_MSG_RESULT([yes (system and base headers)])
6144     else
6145         # With MSVC the highest level makes a significant difference,
6146         # and it was the default when there used to be no PCH levels.
6147         ENABLE_PCH="4"
6148         AC_MSG_RESULT([yes (full)])
6149     fi
6150 elif test "$enable_pch" = "no"; then
6151     AC_MSG_RESULT([no])
6152 else
6153     AC_MSG_ERROR([Unknown value for --enable-pch])
6155 AC_SUBST(ENABLE_PCH)
6156 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
6157 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
6158     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
6159     if test "$CCACHE_BIN" != "not found"; then
6160         AC_MSG_CHECKING([ccache version])
6161         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
6162         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6163         AC_MSG_RESULT([$CCACHE_VERSION])
6164         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
6165         if test "$CCACHE_NUMVER" -gt "030701"; then
6166             AC_MSG_RESULT([yes])
6167         else
6168             AC_MSG_RESULT([no (not newer than 3.7.1)])
6169             CCACHE_DEPEND_MODE=
6170         fi
6171     fi
6174 PCH_INSTANTIATE_TEMPLATES=
6175 if test -n "$ENABLE_PCH"; then
6176     AC_MSG_CHECKING([whether $CC supports -fpch-instantiate-templates])
6177     save_CFLAGS=$CFLAGS
6178     CFLAGS="$CFLAGS -Werror -fpch-instantiate-templates"
6179     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_INSTANTIATE_TEMPLATES="-fpch-instantiate-templates" ],[])
6180     CFLAGS=$save_CFLAGS
6181     if test -n "$PCH_INSTANTIATE_TEMPLATES"; then
6182         AC_MSG_RESULT(yes)
6183     else
6184         AC_MSG_RESULT(no)
6185     fi
6187 AC_SUBST(PCH_INSTANTIATE_TEMPLATES)
6189 BUILDING_PCH_WITH_OBJ=
6190 if test -n "$ENABLE_PCH"; then
6191     AC_MSG_CHECKING([whether $CC supports -Xclang -building-pch-with-obj])
6192     save_CFLAGS=$CFLAGS
6193     CFLAGS="$CFLAGS -Werror -Xclang -building-pch-with-obj"
6194     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ BUILDING_PCH_WITH_OBJ="-Xclang -building-pch-with-obj" ],[])
6195     CFLAGS=$save_CFLAGS
6196     if test -n "$BUILDING_PCH_WITH_OBJ"; then
6197         AC_MSG_RESULT(yes)
6198     else
6199         AC_MSG_RESULT(no)
6200     fi
6202 AC_SUBST(BUILDING_PCH_WITH_OBJ)
6204 PCH_CODEGEN=
6205 PCH_NO_CODEGEN=
6206 fpch_prefix=
6207 if test "$COM" = MSC; then
6208     fpch_prefix="-Xclang "
6210 if test -n "$BUILDING_PCH_WITH_OBJ"; then
6211     AC_MSG_CHECKING([whether $CC supports ${fpch_prefix}-fpch-codegen])
6212     save_CFLAGS=$CFLAGS
6213     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fpch-codegen"
6214     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
6215         [ PCH_CODEGEN="${fpch_prefix}-fpch-codegen" ],[])
6216     CFLAGS=$save_CFLAGS
6217     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fno-pch-codegen"
6218     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
6219         [ PCH_NO_CODEGEN="${fpch_prefix}-fno-pch-codegen" ],[])
6220     CFLAGS=$save_CFLAGS
6221     if test -n "$PCH_CODEGEN"; then
6222         AC_MSG_RESULT(yes)
6223     else
6224         AC_MSG_RESULT(no)
6225     fi
6227 AC_SUBST(PCH_CODEGEN)
6228 AC_SUBST(PCH_NO_CODEGEN)
6229 PCH_DEBUGINFO=
6230 if test -n "$BUILDING_PCH_WITH_OBJ"; then
6231     AC_MSG_CHECKING([whether $CC supports ${fpch_prefix}-fpch-debuginfo])
6232     save_CFLAGS=$CFLAGS
6233     CFLAGS="$CFLAGS -Werror ${fpch_prefix}-fpch-debuginfo"
6234     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_DEBUGINFO="${fpch_prefix}-fpch-debuginfo" ],[])
6235     CFLAGS=$save_CFLAGS
6236     if test -n "$PCH_DEBUGINFO"; then
6237         AC_MSG_RESULT(yes)
6238     else
6239         AC_MSG_RESULT(no)
6240     fi
6242 AC_SUBST(PCH_DEBUGINFO)
6244 TAB=`printf '\t'`
6246 AC_MSG_CHECKING([the GNU Make version])
6247 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
6248 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6249 if test "$_make_longver" -ge "038200"; then
6250     AC_MSG_RESULT([$GNUMAKE $_make_version])
6252 elif test "$_make_longver" -ge "038100"; then
6253     if test "$build_os" = "cygwin"; then
6254         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
6255     fi
6256     AC_MSG_RESULT([$GNUMAKE $_make_version])
6258     dnl ===================================================================
6259     dnl Search all the common names for sha1sum
6260     dnl ===================================================================
6261     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
6262     if test -z "$SHA1SUM"; then
6263         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
6264     elif test "$SHA1SUM" = "openssl"; then
6265         SHA1SUM="openssl sha1"
6266     fi
6267     AC_MSG_CHECKING([for GNU Make bug 20033])
6268     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
6269     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
6270 A := \$(wildcard *.a)
6272 .PHONY: all
6273 all: \$(A:.a=.b)
6274 <TAB>@echo survived bug20033.
6276 .PHONY: setup
6277 setup:
6278 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
6280 define d1
6281 @echo lala \$(1)
6282 @sleep 1
6283 endef
6285 define d2
6286 @echo tyty \$(1)
6287 @sleep 1
6288 endef
6290 %.b : %.a
6291 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
6292 <TAB>\$(call d1,\$(CHECKSUM)),\
6293 <TAB>\$(call d2,\$(CHECKSUM)))
6295     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
6296         no_parallelism_make="YES"
6297         AC_MSG_RESULT([yes, disable parallelism])
6298     else
6299         AC_MSG_RESULT([no, keep parallelism enabled])
6300     fi
6301     rm -rf $TESTGMAKEBUG20033
6302 else
6303     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
6306 # find if gnumake support file function
6307 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
6308 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
6309 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6310     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
6312 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
6313 \$(file >test.txt,Success )
6315 .PHONY: all
6316 all:
6317 <TAB>@cat test.txt
6320 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
6321 if test -f $TESTGMAKEFILEFUNC/test.txt; then
6322     HAVE_GNUMAKE_FILE_FUNC=TRUE
6323     AC_MSG_RESULT([yes])
6324 else
6325     AC_MSG_RESULT([no])
6327 rm -rf $TESTGMAKEFILEFUNC
6328 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
6330 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
6331 STALE_MAKE=
6332 if test "$_make_ver_check" = ""; then
6333    STALE_MAKE=TRUE
6336 HAVE_LD_HASH_STYLE=FALSE
6337 WITH_LINKER_HASH_STYLE=
6338 AC_MSG_CHECKING([for --hash-style gcc linker support])
6339 if test "$GCC" = "yes"; then
6340     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
6341         hash_styles="gnu sysv"
6342     elif test "$with_linker_hash_style" = "no"; then
6343         hash_styles=
6344     else
6345         hash_styles="$with_linker_hash_style"
6346     fi
6348     for hash_style in $hash_styles; do
6349         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
6350         hash_style_ldflags_save=$LDFLAGS
6351         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
6353         AC_RUN_IFELSE([AC_LANG_PROGRAM(
6354             [
6355 #include <stdio.h>
6356             ],[
6357 printf ("");
6358             ])],
6359             [
6360                   HAVE_LD_HASH_STYLE=TRUE
6361                   WITH_LINKER_HASH_STYLE=$hash_style
6362             ],
6363             [HAVE_LD_HASH_STYLE=FALSE],
6364             [HAVE_LD_HASH_STYLE=FALSE])
6365         LDFLAGS=$hash_style_ldflags_save
6366     done
6368     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
6369         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
6370     else
6371         AC_MSG_RESULT( no )
6372     fi
6373     LDFLAGS=$hash_style_ldflags_save
6374 else
6375     AC_MSG_RESULT( no )
6377 AC_SUBST(HAVE_LD_HASH_STYLE)
6378 AC_SUBST(WITH_LINKER_HASH_STYLE)
6380 dnl ===================================================================
6381 dnl Check whether there's a Perl version available.
6382 dnl ===================================================================
6383 if test -z "$with_perl_home"; then
6384     AC_PATH_PROG(PERL, perl)
6385 else
6386     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
6387     _perl_path="$with_perl_home/bin/perl"
6388     if test -x "$_perl_path"; then
6389         PERL=$_perl_path
6390     else
6391         AC_MSG_ERROR([$_perl_path not found])
6392     fi
6395 dnl ===================================================================
6396 dnl Testing for Perl version 5 or greater.
6397 dnl $] is the Perl version variable, it is returned as an integer
6398 dnl ===================================================================
6399 if test "$PERL"; then
6400     AC_MSG_CHECKING([the Perl version])
6401     ${PERL} -e "exit($]);"
6402     _perl_version=$?
6403     if test "$_perl_version" -lt 5; then
6404         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
6405     fi
6406     AC_MSG_RESULT([Perl $_perl_version])
6407 else
6408     AC_MSG_ERROR([Perl not found, install Perl 5])
6411 dnl ===================================================================
6412 dnl Testing for required Perl modules
6413 dnl ===================================================================
6415 AC_MSG_CHECKING([for required Perl modules])
6416 perl_use_string="use Cwd ; use Digest::MD5"
6417 if test "$_os" = "WINNT"; then
6418     if test -n "$PKGFORMAT"; then
6419         for i in $PKGFORMAT; do
6420             case "$i" in
6421             msi)
6422                 # for getting fonts versions to use in MSI
6423                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
6424                 ;;
6425             esac
6426         done
6427     fi
6429 if test "$with_system_hsqldb" = "yes"; then
6430     perl_use_string="$perl_use_string ; use Archive::Zip"
6432 if test "$enable_openssl" = "yes" -a "$with_system_openssl" != "yes"; then
6433     # OpenSSL needs that to build
6434     perl_use_string="$perl_use_string ; use FindBin"
6436 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
6437     AC_MSG_RESULT([all modules found])
6438 else
6439     AC_MSG_RESULT([failed to find some modules])
6440     # Find out which modules are missing.
6441     for i in $perl_use_string; do
6442         if test "$i" != "use" -a "$i" != ";"; then
6443             if ! $PERL -e "use $i;">/dev/null 2>&1; then
6444                 missing_perl_modules="$missing_perl_modules $i"
6445             fi
6446         fi
6447     done
6448     AC_MSG_ERROR([
6449     The missing Perl modules are: $missing_perl_modules
6450     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
6453 dnl ===================================================================
6454 dnl Check for pkg-config
6455 dnl ===================================================================
6456 if test "$_os" != "WINNT"; then
6457     PKG_PROG_PKG_CONFIG
6460 if test "$_os" != "WINNT"; then
6462     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
6463     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
6464     # explicitly. Or put /path/to/compiler in PATH yourself.
6466     # Use wrappers for LTO
6467     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
6468         AC_CHECK_TOOL(AR,gcc-ar)
6469         AC_CHECK_TOOL(NM,gcc-nm)
6470         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
6471     else
6472         AC_CHECK_TOOL(AR,ar)
6473         AC_CHECK_TOOL(NM,nm)
6474         AC_CHECK_TOOL(RANLIB,ranlib)
6475     fi
6476     AC_CHECK_TOOL(OBJDUMP,objdump)
6477     AC_CHECK_TOOL(READELF,readelf)
6478     AC_CHECK_TOOL(STRIP,strip)
6480 AC_SUBST(AR)
6481 AC_SUBST(LD)
6482 AC_SUBST(NM)
6483 AC_SUBST(OBJDUMP)
6484 AC_SUBST(PKG_CONFIG)
6485 AC_SUBST(PKG_CONFIG_PATH)
6486 AC_SUBST(PKG_CONFIG_LIBDIR)
6487 AC_SUBST(RANLIB)
6488 AC_SUBST(READELF)
6489 AC_SUBST(STRIP)
6491 dnl ===================================================================
6492 dnl pkg-config checks on macOS
6493 dnl ===================================================================
6495 if test $_os = Darwin; then
6496     AC_MSG_CHECKING([for bogus pkg-config])
6497     if test -n "$PKG_CONFIG"; then
6498         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
6499             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
6500         else
6501             if test "$enable_bogus_pkg_config" = "yes"; then
6502                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
6503             else
6504                 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.])
6505             fi
6506         fi
6507     else
6508         AC_MSG_RESULT([no, good])
6509     fi
6512 find_csc()
6514     # Return value: $csctest
6516     unset csctest
6518     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
6519     if test -n "$regvalue"; then
6520         csctest=$regvalue
6521         return
6522     fi
6525 find_al()
6527     # Return value: $altest
6529     unset altest
6531     # We need this check to detect 4.6.1 or above.
6532     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
6533         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
6534         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
6535             altest=$regvalue
6536             return
6537         fi
6538     done
6540     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
6541         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
6542         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
6543             altest=$regvalue
6544             return
6545         fi
6546     done
6549 find_dotnetsdk46()
6551     unset frametest
6553     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
6554         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
6555         if test -n "$regvalue"; then
6556             frametest=$regvalue
6557             return
6558         fi
6559     done
6562 find_winsdk_version()
6564     # Args: $1 : SDK version as in "8.0", "8.1A" etc
6565     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
6567     unset winsdktest winsdkbinsubdir winsdklibsubdir
6569     case "$1" in
6570     8.0|8.0A)
6571         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
6572         if test -n "$regvalue"; then
6573             winsdktest=$regvalue
6574             winsdklibsubdir=win8
6575             return
6576         fi
6577         ;;
6578     8.1|8.1A)
6579         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
6580         if test -n "$regvalue"; then
6581             winsdktest=$regvalue
6582             winsdklibsubdir=winv6.3
6583             return
6584         fi
6585         ;;
6586     10.0)
6587         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
6588         if test -n "$regvalue"; then
6589             winsdktest=$regvalue
6590             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
6591             if test -n "$regvalue"; then
6592                 winsdkbinsubdir="$regvalue".0
6593                 winsdklibsubdir=$winsdkbinsubdir
6594                 local tmppath="$winsdktest\\Include\\$winsdklibsubdir"
6595                 local tmppath_unix=$(cygpath -u "$tmppath")
6596                 # test exist the SDK path
6597                 if test -d "$tmppath_unix"; then
6598                    # when path is convertible to a short path then path is okay
6599                    cygpath -d "$tmppath" >/dev/null 2>&1
6600                    if test $? -ne 0; then
6601                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
6602                    fi
6603                 else
6604                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
6605                 fi
6606             fi
6607             return
6608         fi
6609         ;;
6610     esac
6613 find_winsdk()
6615     # Return value: From find_winsdk_version
6617     unset winsdktest
6619     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
6620         find_winsdk_version $ver
6621         if test -n "$winsdktest"; then
6622             return
6623         fi
6624     done
6627 find_msms()
6629     # Return value: $msmdir
6631     AC_MSG_CHECKING([for MSVC merge modules directory])
6632     local my_msm_files
6633     local my_msm_dir
6635     dnl Order my_msm_files in increasing order. Then check the directories returned
6636     dnl by ls in an inner loop; assuming they are also ordered in increasing order,
6637     dnl the result will be the highest MSM version found in the highest directory.
6639     case "$VCVER" in
6640         16.0 | 17.0)
6641         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
6642         ;;
6643     esac
6644     for f in $my_msm_files; do
6645         echo "$as_me:$LINENO: searching for $f" >&5
6646     done
6648     msmdir=
6649     case "$VCVER" in
6650     16.0 | 17.0)
6651         for f in ${my_msm_files}; do
6652             for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6653                 my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
6654                 echo "$as_me:$LINENO: looking for $my_msm_dir${f}])" >&5
6655                 if test -e "$my_msm_dir${f}"; then
6656                     msmdir=$my_msm_dir
6657                 fi
6658             done
6659         done
6660         ;;
6661     esac
6663     if test -n "$msmdir"; then
6664         msmdir=`cygpath -m "$msmdir"`
6665         AC_MSG_RESULT([$msmdir])
6666     else
6667         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
6668             AC_MSG_FAILURE([not found])
6669         else
6670             AC_MSG_WARN([not found (check config.log)])
6671             add_warning "MSM none of ${my_msm_files} found"
6672         fi
6673     fi
6676 find_msvc_x64_dlls()
6678     # Return value: $msvcdllpath, $msvcdlls
6680     AC_MSG_CHECKING([for MSVC x64 DLL path])
6682     dnl Order crtver in increasing order. Then check the directories returned by
6683     dnl ls in an inner loop; assuming they are also ordered in increasing order,
6684     dnl the result will be the highest CRT version found in the highest directory.
6686     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
6687     case "$VCVER" in
6688     16.0 | 17.0)
6689         for crtver in 141 142 143; do
6690             for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6691                 echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT" >&5
6692                 if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT"; then
6693                     msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT"
6694                 fi
6695             done
6696         done
6697         ;;
6698     esac
6699     AC_MSG_RESULT([$msvcdllpath])
6700     AC_MSG_CHECKING([for MSVC x64 DLLs])
6701     msvcdlls="msvcp140.dll vcruntime140.dll"
6702     for dll in $msvcdlls; do
6703         if ! test -f "$msvcdllpath/$dll"; then
6704             AC_MSG_FAILURE([missing $dll])
6705         fi
6706     done
6707     AC_MSG_RESULT([found all ($msvcdlls)])
6710 dnl =========================================
6711 dnl Check for the Windows  SDK.
6712 dnl =========================================
6713 if test "$_os" = "WINNT"; then
6714     AC_MSG_CHECKING([for Windows SDK])
6715     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6716         find_winsdk
6717         WINDOWS_SDK_HOME=$winsdktest
6719         # normalize if found
6720         if test -n "$WINDOWS_SDK_HOME"; then
6721             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
6722             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
6723         fi
6725         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
6726     fi
6728     if test -n "$WINDOWS_SDK_HOME"; then
6729         # Remove a possible trailing backslash
6730         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
6732         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
6733              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
6734              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
6735             have_windows_sdk_headers=yes
6736         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
6737              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
6738              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
6739             have_windows_sdk_headers=yes
6740         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
6741              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
6742              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
6743             have_windows_sdk_headers=yes
6744         else
6745             have_windows_sdk_headers=no
6746         fi
6748         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
6749             have_windows_sdk_libs=yes
6750         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/user32.lib"; then
6751             have_windows_sdk_libs=yes
6752         else
6753             have_windows_sdk_libs=no
6754         fi
6756         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
6757             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
6758 the  Windows SDK are installed.])
6759         fi
6760     fi
6762     if test -z "$WINDOWS_SDK_HOME"; then
6763         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
6764     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
6765         WINDOWS_SDK_VERSION=80
6766         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
6767     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
6768         WINDOWS_SDK_VERSION=81
6769         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
6770     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
6771         WINDOWS_SDK_VERSION=10
6772         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
6773     else
6774         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
6775     fi
6776     PathFormat "$WINDOWS_SDK_HOME"
6777     WINDOWS_SDK_HOME="$formatted_path"
6778     WINDOWS_SDK_HOME_unix="$formatted_path_unix"
6779     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6780         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
6781         if test -d "$WINDOWS_SDK_HOME/include/um"; then
6782             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
6783         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
6784             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
6785         fi
6786     fi
6788     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
6789     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
6790     dnl but not in v8.0), so allow this to be overridden with a
6791     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
6792     dnl and configuration error if no WiLangId.vbs is found would arguably be
6793     dnl better, but I do not know under which conditions exactly it is needed by
6794     dnl msiglobal.pm:
6795     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
6796         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
6797         WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6798         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6799             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WIN_BUILD_ARCH}/WiLangId.vbs"
6800             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6801         fi
6802         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6803             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WIN_BUILD_ARCH/WiLangId.vbs
6804             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6805         fi
6806         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6807             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WIN_BUILD_ARCH/WiLangId.vbs")
6808             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6809         fi
6810     fi
6811     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
6812         if test -n "$with_package_format" -a "$with_package_format" != no; then
6813             for i in "$with_package_format"; do
6814                 if test "$i" = "msi"; then
6815                     if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6816                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
6817                     fi
6818                 fi
6819             done
6820         fi
6821     fi
6823 AC_SUBST(WINDOWS_SDK_HOME)
6824 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
6825 AC_SUBST(WINDOWS_SDK_VERSION)
6826 AC_SUBST(WINDOWS_SDK_WILANGID)
6828 if test "$build_os" = "cygwin"; then
6829     dnl Check midl.exe; this being the first check for a tool in the SDK bin
6830     dnl dir, it also determines that dir's path w/o an arch segment if any,
6831     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
6832     AC_MSG_CHECKING([for midl.exe])
6834     find_winsdk
6835     if test -n "$winsdkbinsubdir" \
6836         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/midl.exe"
6837     then
6838         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH
6839         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
6840     elif test -f "$winsdktest/Bin/$WIN_BUILD_ARCH/midl.exe"; then
6841         MIDL_PATH=$winsdktest/Bin/$WIN_BUILD_ARCH
6842         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
6843     elif test -f "$winsdktest/Bin/midl.exe"; then
6844         MIDL_PATH=$winsdktest/Bin
6845         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
6846     fi
6847     if test ! -f "$MIDL_PATH/midl.exe"; then
6848         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WIN_BUILD_ARCH, Windows SDK installation broken?])
6849     else
6850         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
6851     fi
6853     # Convert to posix path with 8.3 filename restrictions ( No spaces )
6854     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
6856     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
6857          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
6858          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
6859          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
6860     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
6861          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
6862          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6863          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
6864     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
6865          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
6866          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6867          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
6868     else
6869         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
6870     fi
6872     dnl Check csc.exe
6873     AC_MSG_CHECKING([for csc.exe])
6874     find_csc
6875     if test -f "$csctest/csc.exe"; then
6876         CSC_PATH="$csctest"
6877     fi
6878     if test ! -f "$CSC_PATH/csc.exe"; then
6879         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
6880     else
6881         AC_MSG_RESULT([$CSC_PATH/csc.exe])
6882     fi
6884     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
6886     dnl Check al.exe
6887     AC_MSG_CHECKING([for al.exe])
6888     find_winsdk
6889     if test -n "$winsdkbinsubdir" \
6890         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/al.exe"
6891     then
6892         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH"
6893     elif test -f "$winsdktest/Bin/$WIN_BUILD_ARCH/al.exe"; then
6894         AL_PATH="$winsdktest/Bin/$WIN_BUILD_ARCH"
6895     elif test -f "$winsdktest/Bin/al.exe"; then
6896         AL_PATH="$winsdktest/Bin"
6897     fi
6899     if test -z "$AL_PATH"; then
6900         find_al
6901         if test -f "$altest/bin/al.exe"; then
6902             AL_PATH="$altest/bin"
6903         elif test -f "$altest/al.exe"; then
6904             AL_PATH="$altest"
6905         fi
6906     fi
6907     if test ! -f "$AL_PATH/al.exe"; then
6908         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
6909     else
6910         AC_MSG_RESULT([$AL_PATH/al.exe])
6911     fi
6913     AL_PATH=`win_short_path_for_make "$AL_PATH"`
6915     dnl Check mscoree.lib / .NET Framework dir
6916     AC_MSG_CHECKING(.NET Framework)
6917     find_dotnetsdk46
6918     PathFormat "$frametest"
6919     frametest="$formatted_path"
6920     if test -f "$frametest/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6921         DOTNET_FRAMEWORK_HOME="$frametest"
6922     else
6923         find_winsdk
6924         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6925             DOTNET_FRAMEWORK_HOME="$winsdktest"
6926         fi
6927     fi
6928     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
6929         AC_MSG_ERROR([mscoree.lib not found])
6930     fi
6931     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
6933     PathFormat "$MIDL_PATH"
6934     MIDL_PATH="$formatted_path"
6936     PathFormat "$AL_PATH"
6937     AL_PATH="$formatted_path"
6939     PathFormat "$DOTNET_FRAMEWORK_HOME"
6940     DOTNET_FRAMEWORK_HOME="$formatted_path"
6942     PathFormat "$CSC_PATH"
6943     CSC_PATH="$formatted_path"
6946 dnl ===================================================================
6947 dnl Testing for C++ compiler and version...
6948 dnl ===================================================================
6950 if test "$_os" != "WINNT"; then
6951     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
6952     save_CXXFLAGS=$CXXFLAGS
6953     AC_PROG_CXX
6954     CXXFLAGS=$save_CXXFLAGS
6955     if test -z "$CXX_BASE"; then
6956         CXX_BASE=`first_arg_basename "$CXX"`
6957     fi
6960 dnl check for GNU C++ compiler version
6961 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
6962     AC_MSG_CHECKING([the GNU C++ compiler version])
6964     _gpp_version=`$CXX -dumpversion`
6965     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
6967     if test "$_gpp_majmin" -lt "700"; then
6968         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
6969     else
6970         AC_MSG_RESULT([ok (g++ $_gpp_version)])
6971     fi
6973     dnl see https://code.google.com/p/android/issues/detail?id=41770
6974         glibcxx_threads=no
6975         AC_LANG_PUSH([C++])
6976         AC_REQUIRE_CPP
6977         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
6978         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
6979             #include <bits/c++config.h>]],[[
6980             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
6981             && !defined(_GLIBCXX__PTHREADS) \
6982             && !defined(_GLIBCXX_HAS_GTHREADS)
6983             choke me
6984             #endif
6985         ]])],[AC_MSG_RESULT([yes])
6986         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
6987         AC_LANG_POP([C++])
6988         if test $glibcxx_threads = yes; then
6989             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
6990         fi
6992 AC_SUBST(BOOST_CXXFLAGS)
6995 # prefx CXX with ccache if needed
6997 if test "$CCACHE" != ""; then
6998     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
6999     AC_LANG_PUSH([C++])
7000     save_CXXFLAGS=$CXXFLAGS
7001     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
7002     # msvc does not fail on unknown options, check stdout
7003     if test "$COM" = MSC; then
7004         CXXFLAGS="$CXXFLAGS -nologo"
7005     fi
7006     save_ac_cxx_werror_flag=$ac_cxx_werror_flag
7007     ac_cxx_werror_flag=yes
7008     dnl an empty program will do, we're checking the compiler flags
7009     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
7010                       [use_ccache=yes], [use_ccache=no])
7011     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
7012         AC_MSG_RESULT([yes])
7013     else
7014         CXX="$CCACHE $CXX"
7015         CXX_BASE="ccache $CXX_BASE"
7016         AC_MSG_RESULT([no])
7017     fi
7018     CXXFLAGS=$save_CXXFLAGS
7019     ac_cxx_werror_flag=$save_ac_cxx_werror_flag
7020     AC_LANG_POP([C++])
7023 dnl ===================================================================
7024 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
7025 dnl ===================================================================
7027 if test "$_os" != "WINNT"; then
7028     AC_PROG_CXXCPP
7030     dnl Check whether there's a C pre-processor.
7031     AC_PROG_CPP
7035 dnl ===================================================================
7036 dnl Find integral type sizes and alignments
7037 dnl ===================================================================
7039 if test "$_os" != "WINNT"; then
7041     AC_CHECK_SIZEOF(long)
7042     AC_CHECK_SIZEOF(short)
7043     AC_CHECK_SIZEOF(int)
7044     AC_CHECK_SIZEOF(long long)
7045     AC_CHECK_SIZEOF(double)
7046     AC_CHECK_SIZEOF(void*)
7047     AC_CHECK_SIZEOF(size_t)
7049     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
7050     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
7051     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
7052     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
7053     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
7054     SIZEOF_SIZE_T=$ac_cv_sizeof_size_t
7056     dnl Allow build without AC_CHECK_ALIGNOF, grrr
7057     m4_pattern_allow([AC_CHECK_ALIGNOF])
7058     m4_ifdef([AC_CHECK_ALIGNOF],
7059         [
7060             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
7061             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
7062             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
7063             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
7064         ],
7065         [
7066             case "$_os-$host_cpu" in
7067             Linux-i686)
7068                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
7069                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
7070                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
7071                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
7072                 ;;
7073             Linux-x86_64)
7074                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
7075                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
7076                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
7077                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
7078                 ;;
7079             *)
7080                 if test -z "$ac_cv_alignof_short" -o \
7081                         -z "$ac_cv_alignof_int" -o \
7082                         -z "$ac_cv_alignof_long" -o \
7083                         -z "$ac_cv_alignof_double"; then
7084                    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.])
7085                 fi
7086                 ;;
7087             esac
7088         ])
7090     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
7091     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
7092     if test $ac_cv_sizeof_long -eq 8; then
7093         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
7094     elif test $ac_cv_sizeof_double -eq 8; then
7095         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
7096     else
7097         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
7098     fi
7100     dnl Check for large file support
7101     AC_SYS_LARGEFILE
7102     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
7103         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
7104     fi
7105     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
7106         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
7107     fi
7108 else
7109     # Hardcode for MSVC
7110     SAL_TYPES_SIZEOFSHORT=2
7111     SAL_TYPES_SIZEOFINT=4
7112     SAL_TYPES_SIZEOFLONG=4
7113     SAL_TYPES_SIZEOFLONGLONG=8
7114     if test $WIN_HOST_BITS -eq 32; then
7115         SAL_TYPES_SIZEOFPOINTER=4
7116         SIZEOF_SIZE_T=4
7117     else
7118         SAL_TYPES_SIZEOFPOINTER=8
7119         SIZEOF_SIZE_T=8
7120     fi
7121     SAL_TYPES_ALIGNMENT2=2
7122     SAL_TYPES_ALIGNMENT4=4
7123     SAL_TYPES_ALIGNMENT8=8
7124     LFS_CFLAGS=''
7126 AC_SUBST(LFS_CFLAGS)
7127 AC_SUBST(SIZEOF_SIZE_T)
7129 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
7130 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
7131 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
7132 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
7133 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
7134 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
7135 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
7136 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
7138 dnl ===================================================================
7139 dnl Check whether to enable runtime optimizations
7140 dnl ===================================================================
7141 ENABLE_RUNTIME_OPTIMIZATIONS=
7142 AC_MSG_CHECKING([whether to enable runtime optimizations])
7143 if test -z "$enable_runtime_optimizations"; then
7144     for i in $CC; do
7145         case $i in
7146         -fsanitize=*)
7147             enable_runtime_optimizations=no
7148             break
7149             ;;
7150         esac
7151     done
7153 if test "$enable_runtime_optimizations" != no; then
7154     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
7155     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
7156     AC_MSG_RESULT([yes])
7157 else
7158     AC_MSG_RESULT([no])
7160 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
7162 dnl ===================================================================
7163 dnl Check if valgrind headers are available
7164 dnl ===================================================================
7165 ENABLE_VALGRIND=
7166 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
7167     prev_cppflags=$CPPFLAGS
7168     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
7169     # or where does it come from?
7170     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
7171     AC_CHECK_HEADER([valgrind/valgrind.h],
7172         [ENABLE_VALGRIND=TRUE])
7173     CPPFLAGS=$prev_cppflags
7175 AC_SUBST([ENABLE_VALGRIND])
7176 if test -z "$ENABLE_VALGRIND"; then
7177     if test "$with_valgrind" = yes; then
7178         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
7179     fi
7180     VALGRIND_CFLAGS=
7182 AC_SUBST([VALGRIND_CFLAGS])
7185 dnl ===================================================================
7186 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
7187 dnl ===================================================================
7189 # We need at least the sys/sdt.h include header.
7190 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
7191 if test "$SDT_H_FOUND" = "TRUE"; then
7192     # Found sys/sdt.h header, now make sure the c++ compiler works.
7193     # Old g++ versions had problems with probes in constructors/destructors.
7194     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
7195     AC_LANG_PUSH([C++])
7196     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
7197     #include <sys/sdt.h>
7198     class ProbeClass
7199     {
7200     private:
7201       int& ref;
7202       const char *name;
7204     public:
7205       ProbeClass(int& v, const char *n) : ref(v), name(n)
7206       {
7207         DTRACE_PROBE2(_test_, cons, name, ref);
7208       }
7210       void method(int min)
7211       {
7212         DTRACE_PROBE3(_test_, meth, name, ref, min);
7213         ref -= min;
7214       }
7216       ~ProbeClass()
7217       {
7218         DTRACE_PROBE2(_test_, dest, name, ref);
7219       }
7220     };
7221     ]],[[
7222     int i = 64;
7223     DTRACE_PROBE1(_test_, call, i);
7224     ProbeClass inst = ProbeClass(i, "call");
7225     inst.method(24);
7226     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
7227           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
7228     AC_LANG_POP([C++])
7230 AC_CONFIG_HEADERS([config_host/config_probes.h])
7232 dnl ===================================================================
7233 dnl GCC features
7234 dnl ===================================================================
7235 HAVE_GCC_STACK_CLASH_PROTECTION=
7236 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7237     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
7238     save_CFLAGS=$CFLAGS
7239     CFLAGS="$CFLAGS -Werror -fstack-clash-protection"
7240     AC_LINK_IFELSE(
7241         [AC_LANG_PROGRAM(, [[return 0;]])],
7242         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
7243         [AC_MSG_RESULT([no])])
7244     CFLAGS=$save_CFLAGS
7246     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
7247     save_CFLAGS=$CFLAGS
7248     CFLAGS="$CFLAGS -Werror -mno-avx"
7249     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
7250     CFLAGS=$save_CFLAGS
7251     if test "$HAVE_GCC_AVX" = "TRUE"; then
7252         AC_MSG_RESULT([yes])
7253     else
7254         AC_MSG_RESULT([no])
7255     fi
7257     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
7258     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
7259     int v = 0;
7260     if (__sync_add_and_fetch(&v, 1) != 1 ||
7261         __sync_sub_and_fetch(&v, 1) != 0)
7262         return 1;
7263     __sync_synchronize();
7264     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
7265         v != 1)
7266         return 1;
7267     return 0;
7268 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
7269     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
7270         AC_MSG_RESULT([yes])
7271         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
7272     else
7273         AC_MSG_RESULT([no])
7274     fi
7276     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
7277     AC_LANG_PUSH([C++])
7278     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7279             #include <cstddef>
7280             #include <cxxabi.h>
7281             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
7282         ])], [
7283             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
7284             AC_MSG_RESULT([yes])
7285         ], [AC_MSG_RESULT([no])])
7286     AC_LANG_POP([C++])
7288     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
7289     AC_LANG_PUSH([C++])
7290     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7291             #include <cstddef>
7292             #include <cxxabi.h>
7293             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
7294         ])], [
7295             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
7296             AC_MSG_RESULT([yes])
7297         ], [AC_MSG_RESULT([no])])
7298     AC_LANG_POP([C++])
7300     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
7301     AC_LANG_PUSH([C++])
7302     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7303             #include <cxxabi.h>
7304             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
7305         ])], [
7306             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
7307             AC_MSG_RESULT([yes])
7308         ], [AC_MSG_RESULT([no])])
7309     AC_LANG_POP([C++])
7311     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
7312     AC_LANG_PUSH([C++])
7313     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7314             #include <cstddef>
7315             #include <cxxabi.h>
7316             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
7317         ])], [
7318             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
7319             AC_MSG_RESULT([yes])
7320         ], [AC_MSG_RESULT([no])])
7321     AC_LANG_POP([C++])
7323     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exception in cxxabi.h])
7324     AC_LANG_PUSH([C++])
7325     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7326             #include <cstddef>
7327             #include <cxxabi.h>
7328             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exception); }
7329         ])], [
7330             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTION],[1])
7331             AC_MSG_RESULT([yes])
7332         ], [AC_MSG_RESULT([no])])
7333     AC_LANG_POP([C++])
7335     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
7336     AC_LANG_PUSH([C++])
7337     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7338             #include <cxxabi.h>
7339             void * f() { return __cxxabiv1::__cxa_get_globals(); }
7340         ])], [
7341             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
7342             AC_MSG_RESULT([yes])
7343         ], [AC_MSG_RESULT([no])])
7344     AC_LANG_POP([C++])
7346     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
7347     AC_LANG_PUSH([C++])
7348     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7349             #include <cxxabi.h>
7350             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
7351         ])], [
7352             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
7353             AC_MSG_RESULT([yes])
7354         ], [AC_MSG_RESULT([no])])
7355     AC_LANG_POP([C++])
7357     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
7358     AC_LANG_PUSH([C++])
7359     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7360             #include <cxxabi.h>
7361             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
7362         ])], [
7363             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
7364             AC_MSG_RESULT([yes])
7365         ], [AC_MSG_RESULT([no])])
7366     AC_LANG_POP([C++])
7368     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
7369     AC_LANG_PUSH([C++])
7370     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7371             #include <cstddef>
7372             #include <cxxabi.h>
7373             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
7374         ])], [
7375             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
7376             AC_MSG_RESULT([yes])
7377         ], [AC_MSG_RESULT([no])])
7378     AC_LANG_POP([C++])
7380     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
7381     AC_LANG_PUSH([C++])
7382     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7383             #include <cstddef>
7384             #include <cxxabi.h>
7385             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
7386         ])], [
7387             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
7388             AC_MSG_RESULT([yes])
7389         ], [AC_MSG_RESULT([no])])
7390     AC_LANG_POP([C++])
7393 AC_SUBST(HAVE_GCC_AVX)
7394 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
7395 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
7397 dnl ===================================================================
7398 dnl Identify the C++ library
7399 dnl ===================================================================
7401 AC_MSG_CHECKING([what the C++ library is])
7402 HAVE_LIBSTDCPP=
7403 AC_LANG_PUSH([C++])
7404 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7405 #include <utility>
7406 #ifndef __GLIBCXX__
7407 foo bar
7408 #endif
7409 ]])],
7410     [CPP_LIBRARY=GLIBCXX
7411      cpp_library_name="GNU libstdc++"
7412      HAVE_LIBSTDCPP=TRUE
7413     ],
7414     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7415 #include <utility>
7416 #ifndef _LIBCPP_VERSION
7417 foo bar
7418 #endif
7419 ]])],
7420     [CPP_LIBRARY=LIBCPP
7421      cpp_library_name="LLVM libc++"
7422      AC_DEFINE([HAVE_LIBCXX])
7423     ],
7424     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7425 #include <utility>
7426 #ifndef _MSC_VER
7427 foo bar
7428 #endif
7429 ]])],
7430     [CPP_LIBRARY=MSVCRT
7431      cpp_library_name="Microsoft"
7432     ],
7433     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
7434 AC_MSG_RESULT([$cpp_library_name])
7435 AC_LANG_POP([C++])
7436 AC_SUBST([HAVE_LIBSTDCPP])
7438 dnl ===================================================================
7439 dnl Check for gperf
7440 dnl ===================================================================
7441 AC_PATH_PROG(GPERF, gperf)
7442 if test -z "$GPERF"; then
7443     AC_MSG_ERROR([gperf not found but needed. Install it.])
7445 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7446     GPERF=`cygpath -m $GPERF`
7448 AC_MSG_CHECKING([whether gperf is new enough])
7449 my_gperf_ver1=$($GPERF --version | head -n 1)
7450 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
7451 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
7452 if test "$my_gperf_ver3" -ge 301; then
7453     AC_MSG_RESULT([yes ($my_gperf_ver2)])
7454 else
7455     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
7457 AC_SUBST(GPERF)
7459 dnl ===================================================================
7460 dnl Check for system libcmis
7461 dnl ===================================================================
7462 libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2],enabled)
7464 dnl ===================================================================
7465 dnl C++11
7466 dnl ===================================================================
7468 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
7469 CXXFLAGS_CXX11=
7470 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
7471     if test "$with_latest_c__" = yes; then
7472         CXXFLAGS_CXX11=-std:c++latest
7473     else
7474         CXXFLAGS_CXX11=-std:c++17
7475     fi
7476     CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -permissive- -Zc:__cplusplus"
7477 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7478     my_flags='-std=c++17 -std=c++1z'
7479     if test "$with_latest_c__" = yes; then
7480         my_flags="-std=c++23 -std=c++2b -std=c++20 -std=c++2a $my_flags"
7481     fi
7482     for flag in $my_flags; do
7483         if test "$COM" = MSC; then
7484             flag="-Xclang $flag"
7485         fi
7486         save_CXXFLAGS=$CXXFLAGS
7487         CXXFLAGS="$CXXFLAGS $flag -Werror"
7488         if test "$SYSTEM_LIBCMIS" = TRUE; then
7489             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
7490         fi
7491         AC_LANG_PUSH([C++])
7492         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7493             #include <algorithm>
7494             #include <functional>
7495             #include <vector>
7497             #if defined SYSTEM_LIBCMIS
7498             // See ucb/source/ucp/cmis/auth_provider.hxx:
7499             #if !defined __clang__
7500             #pragma GCC diagnostic push
7501             #pragma GCC diagnostic ignored "-Wdeprecated"
7502             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
7503             #endif
7504             #include <libcmis/libcmis.hxx>
7505             #if !defined __clang__
7506             #pragma GCC diagnostic pop
7507             #endif
7508             #endif
7510             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
7511                 std::sort(v.begin(), v.end(), fn);
7512             }
7513             ]])],[CXXFLAGS_CXX11=$flag])
7514         AC_LANG_POP([C++])
7515         CXXFLAGS=$save_CXXFLAGS
7516         if test -n "$CXXFLAGS_CXX11"; then
7517             break
7518         fi
7519     done
7521 if test -n "$CXXFLAGS_CXX11"; then
7522     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
7523 else
7524     AC_MSG_ERROR(no)
7526 AC_SUBST(CXXFLAGS_CXX11)
7528 if test "$GCC" = "yes"; then
7529     save_CXXFLAGS=$CXXFLAGS
7530     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7531     CHECK_L_ATOMIC
7532     CXXFLAGS=$save_CXXFLAGS
7533     AC_SUBST(ATOMIC_LIB)
7536 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
7537 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
7538 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
7539 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
7540 dnl again towards 4.7.2:
7541 if test $CPP_LIBRARY = GLIBCXX; then
7542     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
7543     AC_LANG_PUSH([C++])
7544     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7545 #include <list>
7546 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
7547     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
7548     //   GCC 4.7.0: 20120322
7549     //   GCC 4.7.1: 20120614
7550     // and using a range check is not possible as the mapping between
7551     // __GLIBCXX__ values and GCC versions is not monotonic
7552 /* ok */
7553 #else
7554 abi broken
7555 #endif
7556         ]])], [AC_MSG_RESULT(no, ok)],
7557         [AC_MSG_ERROR(yes)])
7558     AC_LANG_POP([C++])
7561 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
7562 save_CXXFLAGS=$CXXFLAGS
7563 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7564 AC_LANG_PUSH([C++])
7566 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7567 #include <stddef.h>
7569 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
7571 namespace
7573         struct b
7574         {
7575                 int i;
7576                 int j;
7577         };
7579 ]], [[
7580 struct a
7582         int i;
7583         int j;
7585 a thinga[]={{0,0}, {1,1}};
7586 b thingb[]={{0,0}, {1,1}};
7587 size_t i = sizeof(sal_n_array_size(thinga));
7588 size_t j = sizeof(sal_n_array_size(thingb));
7589 return !(i != 0 && j != 0);
7591     ], [ AC_MSG_RESULT(yes) ],
7592     [ AC_MSG_ERROR(no)])
7593 AC_LANG_POP([C++])
7594 CXXFLAGS=$save_CXXFLAGS
7596 HAVE_GCC_FNO_SIZED_DEALLOCATION=
7597 if test "$GCC" = yes; then
7598     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
7599     AC_LANG_PUSH([C++])
7600     save_CXXFLAGS=$CXXFLAGS
7601     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
7602     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
7603     CXXFLAGS=$save_CXXFLAGS
7604     AC_LANG_POP([C++])
7605     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
7606         AC_MSG_RESULT([yes])
7607     else
7608         AC_MSG_RESULT([no])
7609     fi
7611 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
7613 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
7614 AC_LANG_PUSH([C++])
7615 save_CXXFLAGS=$CXXFLAGS
7616 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7617 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7618         #include <algorithm>
7619         #include <initializer_list>
7620         #include <vector>
7621         template<typename T> class S {
7622         private:
7623             std::vector<T> v_;
7624         public:
7625             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
7626         };
7627         constinit S<int> s{3, 2, 1};
7628     ])], [
7629         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
7630         AC_MSG_RESULT([yes])
7631     ], [AC_MSG_RESULT([no])])
7632 CXXFLAGS=$save_CXXFLAGS
7633 AC_LANG_POP([C++])
7635 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
7636 AC_LANG_PUSH([C++])
7637 save_CXXFLAGS=$CXXFLAGS
7638 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7639 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7640         #include <span>
7641         #include <type_traits>
7642         // Don't check size_type directly, as it was called index_type before P1872R0:
7643         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
7644     ])], [
7645         AC_DEFINE([HAVE_CPP_SPAN],[1])
7646         AC_MSG_RESULT([yes])
7647     ], [AC_MSG_RESULT([no])])
7648 CXXFLAGS=$save_CXXFLAGS
7649 AC_LANG_POP([C++])
7651 AC_MSG_CHECKING([whether $CXX_BASE implements C++ DR P1155R3])
7652 AC_LANG_PUSH([C++])
7653 save_CXXFLAGS=$CXXFLAGS
7654 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7655 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7656         struct S1 { S1(S1 &&); };
7657         struct S2: S1 {};
7658         S1 f(S2 s) { return s; }
7659     ])], [
7660         AC_DEFINE([HAVE_P1155R3],[1])
7661         AC_MSG_RESULT([yes])
7662     ], [AC_MSG_RESULT([no])])
7663 CXXFLAGS=$save_CXXFLAGS
7664 AC_LANG_POP([C++])
7666 AC_MSG_CHECKING([whether $CXX_BASE supports C++20 std::atomic_ref])
7667 HAVE_CXX20_ATOMIC_REF=
7668 AC_LANG_PUSH([C++])
7669 save_CXXFLAGS=$CXXFLAGS
7670 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7671 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7672         #include <atomic>
7673         int x;
7674         std::atomic_ref<int> y(x);
7675     ])], [
7676         HAVE_CXX20_ATOMIC_REF=TRUE
7677         AC_MSG_RESULT([yes])
7678     ], [AC_MSG_RESULT([no])])
7679 CXXFLAGS=$save_CXXFLAGS
7680 AC_LANG_POP([C++])
7681 AC_SUBST([HAVE_CXX20_ATOMIC_REF])
7683 dnl Supported since GCC 9 and Clang 10 (which each also started to support -Wdeprecated-copy, but
7684 dnl which is included in -Wextra anyway):
7685 HAVE_WDEPRECATED_COPY_DTOR=
7686 if test "$GCC" = yes; then
7687     AC_MSG_CHECKING([whether $CXX_BASE supports -Wdeprecated-copy-dtor])
7688     AC_LANG_PUSH([C++])
7689     save_CXXFLAGS=$CXXFLAGS
7690     CXXFLAGS="$CXXFLAGS -Werror -Wdeprecated-copy-dtor"
7691     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
7692             HAVE_WDEPRECATED_COPY_DTOR=TRUE
7693             AC_MSG_RESULT([yes])
7694         ], [AC_MSG_RESULT([no])])
7695     CXXFLAGS=$save_CXXFLAGS
7696     AC_LANG_POP([C++])
7698 AC_SUBST([HAVE_WDEPRECATED_COPY_DTOR])
7700 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
7701 dnl uninitialized warning for code like
7703 dnl   OString f();
7704 dnl   boost::optional<OString> * g(bool b) {
7705 dnl       boost::optional<OString> o;
7706 dnl       if (b) o = f();
7707 dnl       return new boost::optional<OString>(o);
7708 dnl   }
7710 dnl (as is e.g. present, in a slightly more elaborate form, in
7711 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
7712 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
7713 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
7714 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7715     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
7716     AC_LANG_PUSH([C++])
7717     save_CXXFLAGS=$CXXFLAGS
7718     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
7719     if test "$ENABLE_OPTIMIZED" = TRUE; then
7720         CXXFLAGS="$CXXFLAGS -O2"
7721     else
7722         CXXFLAGS="$CXXFLAGS -O0"
7723     fi
7724     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7725             #include <new>
7726             void f1(int);
7727             struct S1 {
7728                 ~S1() { f1(n); }
7729                 int n = 0;
7730             };
7731             struct S2 {
7732                 S2() {}
7733                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
7734                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
7735                 void set(S1 s) {
7736                     new (stg) S1(s);
7737                     init = true;
7738                 }
7739                 bool init = false;
7740                 char stg[sizeof (S1)];
7741             } ;
7742             S1 f2();
7743             S2 * f3(bool b) {
7744                 S2 o;
7745                 if (b) o.set(f2());
7746                 return new S2(o);
7747             }
7748         ]])], [AC_MSG_RESULT([no])], [
7749             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
7750             AC_MSG_RESULT([yes])
7751         ])
7752     CXXFLAGS=$save_CXXFLAGS
7753     AC_LANG_POP([C++])
7755 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
7757 dnl Check for <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c5> "[8/9/10/11 Regression]
7758 dnl -Wstringop-overflow false positive due to using MEM_REF type of &MEM" (fixed in GCC 11), which
7759 dnl hits us e.g. with GCC 10 and --enable-optimized at
7761 dnl   In file included from include/rtl/string.hxx:49,
7762 dnl                    from include/rtl/ustring.hxx:43,
7763 dnl                    from include/osl/file.hxx:35,
7764 dnl                    from include/codemaker/global.hxx:28,
7765 dnl                    from include/codemaker/options.hxx:23,
7766 dnl                    from codemaker/source/commoncpp/commoncpp.cxx:24:
7767 dnl   In function â€˜char* rtl::addDataHelper(char*, const char*, std::size_t)’,
7768 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,
7769 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,
7770 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,
7771 dnl       inlined from â€˜rtl::OString codemaker::cpp::scopedCppName(const rtl::OString&, bool)’ at codemaker/source/commoncpp/commoncpp.cxx:53:55:
7772 dnl   include/rtl/stringconcat.hxx:78:15: error: writing 2 bytes into a region of size 1 [-Werror=stringop-overflow=]
7773 dnl      78 |         memcpy( buffer, data, length );
7774 dnl         |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
7775 HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=
7776 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7777     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=stringop-overflow=])
7778     AC_LANG_PUSH([C++])
7779     save_CXXFLAGS=$CXXFLAGS
7780     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wstringop-overflow"
7781     if test "$ENABLE_OPTIMIZED" = TRUE; then
7782         CXXFLAGS="$CXXFLAGS -O2"
7783     else
7784         CXXFLAGS="$CXXFLAGS -O0"
7785     fi
7786     dnl Test code taken from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c0>:
7787     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7788             void fill(char const * begin, char const * end, char c);
7789             struct q {
7790                 char ids[4];
7791                 char username[6];
7792             };
7793             void test(q & c) {
7794                 fill(c.ids, c.ids + sizeof(c.ids), '\0');
7795                 __builtin_strncpy(c.username, "root", sizeof(c.username));
7796             }
7797         ]])], [AC_MSG_RESULT([no])], [
7798             HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=TRUE
7799             AC_MSG_RESULT([yes])
7800         ])
7801     CXXFLAGS=$save_CXXFLAGS
7802     AC_LANG_POP([C++])
7804 AC_SUBST([HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW])
7806 HAVE_DLLEXPORTINLINES=
7807 if test "$_os" = "WINNT"; then
7808     AC_MSG_CHECKING([whether $CXX_BASE supports -Zc:dllexportInlines-])
7809     AC_LANG_PUSH([C++])
7810     save_CXXFLAGS=$CXXFLAGS
7811     CXXFLAGS="$CXXFLAGS -Werror -Zc:dllexportInlines-"
7812     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
7813             HAVE_DLLEXPORTINLINES=TRUE
7814             AC_MSG_RESULT([yes])
7815         ], [AC_MSG_RESULT([no])])
7816     CXXFLAGS=$save_CXXFLAGS
7817     AC_LANG_POP([C++])
7819 AC_SUBST([HAVE_DLLEXPORTINLINES])
7821 dnl ===================================================================
7822 dnl CPU Intrinsics support - SSE, AVX
7823 dnl ===================================================================
7825 CXXFLAGS_INTRINSICS_SSE2=
7826 CXXFLAGS_INTRINSICS_SSSE3=
7827 CXXFLAGS_INTRINSICS_SSE41=
7828 CXXFLAGS_INTRINSICS_SSE42=
7829 CXXFLAGS_INTRINSICS_AVX=
7830 CXXFLAGS_INTRINSICS_AVX2=
7831 CXXFLAGS_INTRINSICS_AVX512=
7832 CXXFLAGS_INTRINSICS_AVX512F=
7833 CXXFLAGS_INTRINSICS_F16C=
7834 CXXFLAGS_INTRINSICS_FMA=
7836 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7837     # GCC, Clang or Clang-cl (clang-cl + MSVC's -arch options don't work well together)
7838     flag_sse2=-msse2
7839     flag_ssse3=-mssse3
7840     flag_sse41=-msse4.1
7841     flag_sse42=-msse4.2
7842     flag_avx=-mavx
7843     flag_avx2=-mavx2
7844     flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
7845     flag_avx512f=-mavx512f
7846     flag_f16c=-mf16c
7847     flag_fma=-mfma
7848 else
7849     # With MSVC using -arch is in fact not necessary for being able
7850     # to use CPU intrinsics, code using AVX512F intrinsics will compile
7851     # even if compiled with -arch:AVX, the -arch option really only affects
7852     # instructions generated for C/C++ code.
7853     # So use the matching same (or lower) -arch options, but only in order
7854     # to generate the best matching instructions for the C++ code surrounding
7855     # the intrinsics.
7856     # SSE2 is the default for x86/x64, so no need to specify the option.
7857     flag_sse2=
7858     # No specific options for these, use the next lower.
7859     flag_ssse3="$flag_sse2"
7860     flag_sse41="$flag_sse2"
7861     flag_sse42="$flag_sse2"
7862     flag_avx=-arch:AVX
7863     flag_avx2=-arch:AVX2
7864     flag_avx512=-arch:AVX512
7865     # Using -arch:AVX512 would enable more than just AVX512F, so use only AVX2.
7866     flag_avx512f=-arch:AVX2
7867     # No MSVC options for these.
7868     flag_f16c="$flag_sse2"
7869     flag_fma="$flag_sse2"
7872 AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
7873 AC_LANG_PUSH([C++])
7874 save_CXXFLAGS=$CXXFLAGS
7875 CXXFLAGS="$CXXFLAGS $flag_sse2"
7876 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7877     #include <emmintrin.h>
7878     int main () {
7879         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7880         c = _mm_xor_si128 (a, b);
7881         return 0;
7882     }
7883     ])],
7884     [can_compile_sse2=yes],
7885     [can_compile_sse2=no])
7886 AC_LANG_POP([C++])
7887 CXXFLAGS=$save_CXXFLAGS
7888 AC_MSG_RESULT([${can_compile_sse2}])
7889 if test "${can_compile_sse2}" = "yes" ; then
7890     CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
7893 AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
7894 AC_LANG_PUSH([C++])
7895 save_CXXFLAGS=$CXXFLAGS
7896 CXXFLAGS="$CXXFLAGS $flag_ssse3"
7897 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7898     #include <tmmintrin.h>
7899     int main () {
7900         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7901         c = _mm_maddubs_epi16 (a, b);
7902         return 0;
7903     }
7904     ])],
7905     [can_compile_ssse3=yes],
7906     [can_compile_ssse3=no])
7907 AC_LANG_POP([C++])
7908 CXXFLAGS=$save_CXXFLAGS
7909 AC_MSG_RESULT([${can_compile_ssse3}])
7910 if test "${can_compile_ssse3}" = "yes" ; then
7911     CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
7914 AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
7915 AC_LANG_PUSH([C++])
7916 save_CXXFLAGS=$CXXFLAGS
7917 CXXFLAGS="$CXXFLAGS $flag_sse41"
7918 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7919     #include <smmintrin.h>
7920     int main () {
7921         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7922         c = _mm_cmpeq_epi64 (a, b);
7923         return 0;
7924     }
7925     ])],
7926     [can_compile_sse41=yes],
7927     [can_compile_sse41=no])
7928 AC_LANG_POP([C++])
7929 CXXFLAGS=$save_CXXFLAGS
7930 AC_MSG_RESULT([${can_compile_sse41}])
7931 if test "${can_compile_sse41}" = "yes" ; then
7932     CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
7935 AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
7936 AC_LANG_PUSH([C++])
7937 save_CXXFLAGS=$CXXFLAGS
7938 CXXFLAGS="$CXXFLAGS $flag_sse42"
7939 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7940     #include <nmmintrin.h>
7941     int main () {
7942         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7943         c = _mm_cmpgt_epi64 (a, b);
7944         return 0;
7945     }
7946     ])],
7947     [can_compile_sse42=yes],
7948     [can_compile_sse42=no])
7949 AC_LANG_POP([C++])
7950 CXXFLAGS=$save_CXXFLAGS
7951 AC_MSG_RESULT([${can_compile_sse42}])
7952 if test "${can_compile_sse42}" = "yes" ; then
7953     CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
7956 AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
7957 AC_LANG_PUSH([C++])
7958 save_CXXFLAGS=$CXXFLAGS
7959 CXXFLAGS="$CXXFLAGS $flag_avx"
7960 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7961     #include <immintrin.h>
7962     int main () {
7963         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
7964         c = _mm256_xor_ps(a, b);
7965         return 0;
7966     }
7967     ])],
7968     [can_compile_avx=yes],
7969     [can_compile_avx=no])
7970 AC_LANG_POP([C++])
7971 CXXFLAGS=$save_CXXFLAGS
7972 AC_MSG_RESULT([${can_compile_avx}])
7973 if test "${can_compile_avx}" = "yes" ; then
7974     CXXFLAGS_INTRINSICS_AVX="$flag_avx"
7977 AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
7978 AC_LANG_PUSH([C++])
7979 save_CXXFLAGS=$CXXFLAGS
7980 CXXFLAGS="$CXXFLAGS $flag_avx2"
7981 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7982     #include <immintrin.h>
7983     int main () {
7984         __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
7985         c = _mm256_maddubs_epi16(a, b);
7986         return 0;
7987     }
7988     ])],
7989     [can_compile_avx2=yes],
7990     [can_compile_avx2=no])
7991 AC_LANG_POP([C++])
7992 CXXFLAGS=$save_CXXFLAGS
7993 AC_MSG_RESULT([${can_compile_avx2}])
7994 if test "${can_compile_avx2}" = "yes" ; then
7995     CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
7998 AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
7999 AC_LANG_PUSH([C++])
8000 save_CXXFLAGS=$CXXFLAGS
8001 CXXFLAGS="$CXXFLAGS $flag_avx512"
8002 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8003     #include <immintrin.h>
8004     int main () {
8005         __m512i a = _mm512_loadu_si512(0);
8006         __m512d v1 = _mm512_load_pd(0);
8007         // https://gcc.gnu.org/git/?p=gcc.git;a=commit;f=gcc/config/i386/avx512fintrin.h;h=23bce99cbe7016a04e14c2163ed3fe6a5a64f4e2
8008         __m512d v2 = _mm512_abs_pd(v1);
8009         return 0;
8010     }
8011     ])],
8012     [can_compile_avx512=yes],
8013     [can_compile_avx512=no])
8014 AC_LANG_POP([C++])
8015 CXXFLAGS=$save_CXXFLAGS
8016 AC_MSG_RESULT([${can_compile_avx512}])
8017 if test "${can_compile_avx512}" = "yes" ; then
8018     CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
8019     CXXFLAGS_INTRINSICS_AVX512F="$flag_avx512f"
8022 AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
8023 AC_LANG_PUSH([C++])
8024 save_CXXFLAGS=$CXXFLAGS
8025 CXXFLAGS="$CXXFLAGS $flag_f16c"
8026 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8027     #include <immintrin.h>
8028     int main () {
8029         __m128i a = _mm_set1_epi32 (0);
8030         __m128 c;
8031         c = _mm_cvtph_ps(a);
8032         return 0;
8033     }
8034     ])],
8035     [can_compile_f16c=yes],
8036     [can_compile_f16c=no])
8037 AC_LANG_POP([C++])
8038 CXXFLAGS=$save_CXXFLAGS
8039 AC_MSG_RESULT([${can_compile_f16c}])
8040 if test "${can_compile_f16c}" = "yes" ; then
8041     CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
8044 AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
8045 AC_LANG_PUSH([C++])
8046 save_CXXFLAGS=$CXXFLAGS
8047 CXXFLAGS="$CXXFLAGS $flag_fma"
8048 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
8049     #include <immintrin.h>
8050     int main () {
8051         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
8052         d = _mm256_fmadd_ps(a, b, c);
8053         return 0;
8054     }
8055     ])],
8056     [can_compile_fma=yes],
8057     [can_compile_fma=no])
8058 AC_LANG_POP([C++])
8059 CXXFLAGS=$save_CXXFLAGS
8060 AC_MSG_RESULT([${can_compile_fma}])
8061 if test "${can_compile_fma}" = "yes" ; then
8062     CXXFLAGS_INTRINSICS_FMA="$flag_fma"
8065 AC_SUBST([CXXFLAGS_INTRINSICS_SSE2])
8066 AC_SUBST([CXXFLAGS_INTRINSICS_SSSE3])
8067 AC_SUBST([CXXFLAGS_INTRINSICS_SSE41])
8068 AC_SUBST([CXXFLAGS_INTRINSICS_SSE42])
8069 AC_SUBST([CXXFLAGS_INTRINSICS_AVX])
8070 AC_SUBST([CXXFLAGS_INTRINSICS_AVX2])
8071 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512])
8072 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512F])
8073 AC_SUBST([CXXFLAGS_INTRINSICS_F16C])
8074 AC_SUBST([CXXFLAGS_INTRINSICS_FMA])
8076 dnl ===================================================================
8077 dnl system stl sanity tests
8078 dnl ===================================================================
8079 if test "$_os" != "WINNT"; then
8081     AC_LANG_PUSH([C++])
8083     save_CPPFLAGS="$CPPFLAGS"
8084     if test -n "$MACOSX_SDK_PATH"; then
8085         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
8086     fi
8088     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
8089     # only.
8090     if test "$CPP_LIBRARY" = GLIBCXX; then
8091         dnl gcc#19664, gcc#22482, rhbz#162935
8092         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
8093         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
8094         AC_MSG_RESULT([$stlvisok])
8095         if test "$stlvisok" = "no"; then
8096             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
8097         fi
8098     fi
8100     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
8101     # when we don't make any dynamic libraries?
8102     if test "$DISABLE_DYNLOADING" = ""; then
8103         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
8104         cat > conftestlib1.cc <<_ACEOF
8105 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
8106 struct S2: S1<int> { virtual ~S2(); };
8107 S2::~S2() {}
8108 _ACEOF
8109         cat > conftestlib2.cc <<_ACEOF
8110 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
8111 struct S2: S1<int> { virtual ~S2(); };
8112 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
8113 _ACEOF
8114         gccvisinlineshiddenok=yes
8115         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
8116             gccvisinlineshiddenok=no
8117         else
8118             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
8119             dnl known to not work with -z defs (unsetting which makes the test
8120             dnl moot, though):
8121             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
8122             if test "$COM_IS_CLANG" = TRUE; then
8123                 for i in $CXX $CXXFLAGS; do
8124                     case $i in
8125                     -fsanitize=*)
8126                         my_linkflagsnoundefs=
8127                         break
8128                         ;;
8129                     esac
8130                 done
8131             fi
8132             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
8133                 gccvisinlineshiddenok=no
8134             fi
8135         fi
8137         rm -fr libconftest*
8138         AC_MSG_RESULT([$gccvisinlineshiddenok])
8139         if test "$gccvisinlineshiddenok" = "no"; then
8140             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
8141         fi
8142     fi
8144    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
8145     cat >visibility.cxx <<_ACEOF
8146 #pragma GCC visibility push(hidden)
8147 struct __attribute__ ((visibility ("default"))) TestStruct {
8148   static void Init();
8150 __attribute__ ((visibility ("default"))) void TestFunc() {
8151   TestStruct::Init();
8153 _ACEOF
8154     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
8155         gccvisbroken=yes
8156     else
8157         case "$host_cpu" in
8158         i?86|x86_64)
8159             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
8160                 gccvisbroken=no
8161             else
8162                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
8163                     gccvisbroken=no
8164                 else
8165                     gccvisbroken=yes
8166                 fi
8167             fi
8168             ;;
8169         *)
8170             gccvisbroken=no
8171             ;;
8172         esac
8173     fi
8174     rm -f visibility.s visibility.cxx
8176     AC_MSG_RESULT([$gccvisbroken])
8177     if test "$gccvisbroken" = "yes"; then
8178         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
8179     fi
8181     CPPFLAGS="$save_CPPFLAGS"
8183     AC_MSG_CHECKING([if CET endbranch is recognized])
8184 cat > endbr.s <<_ACEOF
8185 endbr32
8186 _ACEOF
8187     HAVE_ASM_END_BRANCH_INS_SUPPORT=
8188     if $CXX -c endbr.s -o endbr.o >/dev/null 2>&5; then
8189         AC_MSG_RESULT([yes])
8190         HAVE_ASM_END_BRANCH_INS_SUPPORT=TRUE
8191     else
8192         AC_MSG_RESULT([no])
8193     fi
8194     rm -f endbr.s endbr.o
8195     AC_SUBST(HAVE_ASM_END_BRANCH_INS_SUPPORT)
8197     AC_LANG_POP([C++])
8200 dnl ===================================================================
8201 dnl  Clang++ tests
8202 dnl ===================================================================
8204 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
8205 if test "$GCC" = "yes"; then
8206     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
8207     AC_LANG_PUSH([C++])
8208     save_CXXFLAGS=$CXXFLAGS
8209     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
8210     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
8211     CXXFLAGS=$save_CXXFLAGS
8212     AC_LANG_POP([C++])
8213     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
8214         AC_MSG_RESULT([yes])
8215     else
8216         AC_MSG_RESULT([no])
8217     fi
8219 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
8221 dnl ===================================================================
8222 dnl Compiler plugins
8223 dnl ===================================================================
8225 COMPILER_PLUGINS=
8226 # currently only Clang
8228 if test "$COM_IS_CLANG" != "TRUE"; then
8229     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
8230         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
8231         enable_compiler_plugins=no
8232     fi
8235 COMPILER_PLUGINS_COM_IS_CLANG=
8236 if test "$COM_IS_CLANG" = "TRUE"; then
8237     if test -n "$enable_compiler_plugins"; then
8238         compiler_plugins="$enable_compiler_plugins"
8239     elif test -n "$ENABLE_DBGUTIL"; then
8240         compiler_plugins=test
8241     else
8242         compiler_plugins=no
8243     fi
8244     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
8245         if test "$CLANGVER" -lt 120001; then
8246             if test "$compiler_plugins" = yes; then
8247                 AC_MSG_ERROR(
8248                     [Clang $CLANGVER is too old to build compiler plugins; need >= 12.0.1.])
8249             else
8250                 compiler_plugins=no
8251             fi
8252         fi
8253     fi
8254     if test "$compiler_plugins" != "no"; then
8255         dnl The prefix where Clang resides, override to where Clang resides if
8256         dnl using a source build:
8257         if test -z "$CLANGDIR"; then
8258             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $(printf '%s\n' $CXX | grep clang | head -n 1)))))
8259         fi
8260         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
8261         if test -z "$COMPILER_PLUGINS_CXX"; then
8262             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
8263         fi
8264         clangbindir=$CLANGDIR/bin
8265         if test "$build_os" = "cygwin"; then
8266             clangbindir=$(cygpath -u "$clangbindir")
8267         fi
8268         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
8269         if test -n "$LLVM_CONFIG"; then
8270             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
8271             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
8272             if test -z "$CLANGLIBDIR"; then
8273                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
8274             fi
8275             # Try if clang is built from source (in which case its includes are not together with llvm includes).
8276             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
8277             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
8278             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
8279                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
8280             fi
8281             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
8282             clangobjdir=$($LLVM_CONFIG --obj-root)
8283             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
8284                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
8285             fi
8286         fi
8287         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
8288         AC_LANG_PUSH([C++])
8289         save_CXX=$CXX
8290         save_CXXCPP=$CXXCPP
8291         save_CPPFLAGS=$CPPFLAGS
8292         save_CXXFLAGS=$CXXFLAGS
8293         save_LDFLAGS=$LDFLAGS
8294         save_LIBS=$LIBS
8295         CXX=$COMPILER_PLUGINS_CXX
8296         CXXCPP="$COMPILER_PLUGINS_CXX -E"
8297         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
8298         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
8299         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
8300             [COMPILER_PLUGINS=TRUE],
8301             [
8302             if test "$compiler_plugins" = "yes"; then
8303                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
8304             else
8305                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
8306                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
8307             fi
8308             ])
8309         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
8310         dnl comment in compilerplugins/Makefile-clang.mk:
8311         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
8312             LDFLAGS=""
8313             AC_MSG_CHECKING([for clang libraries to use])
8314             if test -z "$CLANGTOOLLIBS"; then
8315                 LIBS="-lclangTooling -lclangFrontend -lclangDriver -lclangParse -lclangSema -lclangEdit \
8316  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
8317                 AC_LINK_IFELSE([
8318                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8319                         [[ clang::FullSourceLoc().dump(); ]])
8320                 ],[CLANGTOOLLIBS="$LIBS"],[])
8321             fi
8322             if test -z "$CLANGTOOLLIBS"; then
8323                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
8324                 AC_LINK_IFELSE([
8325                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8326                         [[ clang::FullSourceLoc().dump(); ]])
8327                 ],[CLANGTOOLLIBS="$LIBS"],[])
8328             fi
8329             AC_MSG_RESULT([$CLANGTOOLLIBS])
8330             if test -z "$CLANGTOOLLIBS"; then
8331                 if test "$compiler_plugins" = "yes"; then
8332                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
8333                 else
8334                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
8335                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
8336                 fi
8337                 COMPILER_PLUGINS=
8338             fi
8339             if test -n "$COMPILER_PLUGINS"; then
8340                 if test -z "$CLANGSYSINCLUDE"; then
8341                     if test -n "$LLVM_CONFIG"; then
8342                         # Path to the clang system headers (no idea if there's a better way to get it).
8343                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/git\|svn//')/include
8344                     fi
8345                 fi
8346             fi
8347         fi
8348         CXX=$save_CXX
8349         CXXCPP=$save_CXXCPP
8350         CPPFLAGS=$save_CPPFLAGS
8351         CXXFLAGS=$save_CXXFLAGS
8352         LDFLAGS=$save_LDFLAGS
8353         LIBS="$save_LIBS"
8354         AC_LANG_POP([C++])
8356         AC_MSG_CHECKING([whether the compiler for building compilerplugins is actually Clang])
8357         AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
8358             #ifndef __clang__
8359             you lose
8360             #endif
8361             int foo=42;
8362             ]])],
8363             [AC_MSG_RESULT([yes])
8364              COMPILER_PLUGINS_COM_IS_CLANG=TRUE],
8365             [AC_MSG_RESULT([no])])
8366         AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8367     fi
8368 else
8369     if test "$enable_compiler_plugins" = "yes"; then
8370         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
8371     fi
8373 COMPILER_PLUGINS_ANALYZER_PCH=
8374 if test "$enable_compiler_plugins_analyzer_pch" != no; then
8375     COMPILER_PLUGINS_ANALYZER_PCH=TRUE
8377 AC_SUBST(COMPILER_PLUGINS)
8378 AC_SUBST(COMPILER_PLUGINS_ANALYZER_PCH)
8379 AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8380 AC_SUBST(COMPILER_PLUGINS_CXX)
8381 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
8382 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
8383 AC_SUBST(COMPILER_PLUGINS_DEBUG)
8384 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
8385 AC_SUBST(CLANGDIR)
8386 AC_SUBST(CLANGLIBDIR)
8387 AC_SUBST(CLANGTOOLLIBS)
8388 AC_SUBST(CLANGSYSINCLUDE)
8390 # Plugin to help linker.
8391 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
8392 # This makes --enable-lto build with clang work.
8393 AC_SUBST(LD_PLUGIN)
8395 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
8396 AC_SUBST(HAVE_POSIX_FALLOCATE)
8398 JITC_PROCESSOR_TYPE=""
8399 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
8400     # IBMs JDK needs this...
8401     JITC_PROCESSOR_TYPE=6
8402     export JITC_PROCESSOR_TYPE
8404 AC_SUBST([JITC_PROCESSOR_TYPE])
8406 # Misc Windows Stuff
8407 AC_ARG_WITH(ucrt-dir,
8408     AS_HELP_STRING([--with-ucrt-dir],
8409         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
8410         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
8411         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
8412             Windows6.1-KB2999226-x64.msu
8413             Windows6.1-KB2999226-x86.msu
8414             Windows8.1-KB2999226-x64.msu
8415             Windows8.1-KB2999226-x86.msu
8416             Windows8-RT-KB2999226-x64.msu
8417             Windows8-RT-KB2999226-x86.msu
8418         A zip archive including those files is available from Microsoft site:
8419         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
8422 UCRT_REDISTDIR="$with_ucrt_dir"
8423 if test $_os = "WINNT"; then
8424     find_msvc_x64_dlls
8425     for i in $PKGFORMAT; do
8426         if test "$i" = msi; then
8427             find_msms
8428             break
8429         fi
8430     done
8431     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
8432     MSVC_DLLS="$msvcdlls"
8433     test -n "$msmdir" && MSM_PATH=`win_short_path_for_make "$msmdir"`
8434     # MSVC 15.3 changed it to VC141
8435     if echo "$msvcdllpath" | grep -q "VC143.CRT$"; then
8436         SCPDEFS="$SCPDEFS -DWITH_VC143_REDIST"
8437     elif echo "$msvcdllpath" | grep -q "VC142.CRT$"; then
8438         SCPDEFS="$SCPDEFS -DWITH_VC142_REDIST"
8439     elif echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
8440         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
8441     else
8442         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
8443     fi
8445     if test "$UCRT_REDISTDIR" = "no"; then
8446         dnl explicitly disabled
8447         UCRT_REDISTDIR=""
8448     else
8449         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
8450                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
8451                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
8452                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
8453                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
8454                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
8455             UCRT_REDISTDIR=""
8456             if test -n "$PKGFORMAT"; then
8457                for i in $PKGFORMAT; do
8458                    case "$i" in
8459                    msi)
8460                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
8461                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
8462                        ;;
8463                    esac
8464                done
8465             fi
8466         fi
8467     fi
8470 AC_SUBST(UCRT_REDISTDIR)
8471 AC_SUBST(MSVC_DLL_PATH)
8472 AC_SUBST(MSVC_DLLS)
8473 AC_SUBST(MSM_PATH)
8476 dnl ===================================================================
8477 dnl Checks for Java
8478 dnl ===================================================================
8479 if test "$ENABLE_JAVA" != ""; then
8481     # Windows-specific tests
8482     if test "$build_os" = "cygwin"; then
8483         if test -z "$with_jdk_home"; then
8484             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
8485             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
8486             reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
8487             if test -n "$regvalue"; then
8488                 ver=$regvalue
8489                 reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
8490                 with_jdk_home=$regvalue
8491             fi
8492             howfound="found automatically"
8493         else
8494             with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
8495             howfound="you passed"
8496         fi
8498         if ! test -f "$with_jdk_home/lib/jvm.lib" -a -f "$with_jdk_home/bin/java.exe"; then
8499             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])
8500         fi
8501     fi
8503     # 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.
8504     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
8505     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
8506         with_jdk_home=`/usr/libexec/java_home`
8507     fi
8509     JAVA_HOME=; export JAVA_HOME
8510     if test -z "$with_jdk_home"; then
8511         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
8512     else
8513         _java_path="$with_jdk_home/bin/$with_java"
8514         dnl Check if there is a Java interpreter at all.
8515         if test -x "$_java_path"; then
8516             JAVAINTERPRETER=$_java_path
8517         else
8518             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
8519         fi
8520     fi
8522     dnl Check that the JDK found is correct architecture (at least 2 reasons to
8523     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
8524     dnl loaded by java to run JunitTests:
8525     if test "$build_os" = "cygwin" -a "$cross_compiling" != "yes"; then
8526         shortjdkhome=`cygpath -d "$with_jdk_home"`
8527         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
8528             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
8529             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8530         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
8531             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8532             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8533         fi
8535         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
8536             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
8537         fi
8538         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
8539     elif test "$cross_compiling" != "yes"; then
8540         case $CPUNAME in
8541             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
8542                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
8543                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
8544                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8545                 fi
8546                 ;;
8547             *) # assumption: everything else 32-bit
8548                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
8549                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8550                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8551                 fi
8552                 ;;
8553         esac
8554     fi
8557 dnl ===================================================================
8558 dnl Checks for JDK.
8559 dnl ===================================================================
8561 # Whether all the complexity here actually is needed any more or not, no idea.
8563 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8564     _gij_longver=0
8565     AC_MSG_CHECKING([the installed JDK])
8566     if test -n "$JAVAINTERPRETER"; then
8567         dnl java -version sends output to stderr!
8568         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
8569             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8570         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
8571             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8572         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
8573             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8574         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
8575             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8576         else
8577             JDK=sun
8579             dnl Sun JDK specific tests
8580             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
8581             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
8583             if test "$_jdk_ver" -lt 10900; then
8584                 AC_MSG_ERROR([JDK is too old, you need at least 9 ($_jdk_ver < 10900)])
8585             fi
8586             if test "$_jdk_ver" -gt 10900; then
8587                 JAVA_CLASSPATH_NOT_SET=TRUE
8588             fi
8590             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
8591             if test "$_os" = "WINNT"; then
8592                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
8593             fi
8594             AC_MSG_RESULT([found $JAVA_HOME (JDK $_jdk)])
8596             # set to limit VM usage for JunitTests
8597             JAVAIFLAGS=-Xmx64M
8598             # set to limit VM usage for javac
8599             JAVACFLAGS=-J-Xmx128M
8600         fi
8601     else
8602         AC_MSG_ERROR([Java not found. You need at least JDK 9])
8603     fi
8604 else
8605     if test -z "$ENABLE_JAVA"; then
8606         dnl Java disabled
8607         JAVA_HOME=
8608         export JAVA_HOME
8609     elif test "$cross_compiling" = "yes"; then
8610         # Just assume compatibility of build and host JDK
8611         JDK=$JDK_FOR_BUILD
8612         JAVAIFLAGS=$JAVAIFLAGS_FOR_BUILD
8613     fi
8616 dnl ===================================================================
8617 dnl Checks for javac
8618 dnl ===================================================================
8619 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8620     javacompiler="javac"
8621     : ${JAVA_SOURCE_VER=8}
8622     : ${JAVA_TARGET_VER=8}
8623     if test -z "$with_jdk_home"; then
8624         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
8625     else
8626         _javac_path="$with_jdk_home/bin/$javacompiler"
8627         dnl Check if there is a Java compiler at all.
8628         if test -x "$_javac_path"; then
8629             JAVACOMPILER=$_javac_path
8630         fi
8631     fi
8632     if test -z "$JAVACOMPILER"; then
8633         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
8634     fi
8635     if test "$build_os" = "cygwin"; then
8636         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
8637             JAVACOMPILER="${JAVACOMPILER}.exe"
8638         fi
8639         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
8640     fi
8643 dnl ===================================================================
8644 dnl Checks for javadoc
8645 dnl ===================================================================
8646 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8647     if test -z "$with_jdk_home"; then
8648         AC_PATH_PROG(JAVADOC, javadoc)
8649     else
8650         _javadoc_path="$with_jdk_home/bin/javadoc"
8651         dnl Check if there is a javadoc at all.
8652         if test -x "$_javadoc_path"; then
8653             JAVADOC=$_javadoc_path
8654         else
8655             AC_PATH_PROG(JAVADOC, javadoc)
8656         fi
8657     fi
8658     if test -z "$JAVADOC"; then
8659         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
8660     fi
8661     if test "$build_os" = "cygwin"; then
8662         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
8663             JAVADOC="${JAVADOC}.exe"
8664         fi
8665         JAVADOC=`win_short_path_for_make "$JAVADOC"`
8666     fi
8668     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
8669     JAVADOCISGJDOC="yes"
8670     fi
8672 AC_SUBST(JAVADOC)
8673 AC_SUBST(JAVADOCISGJDOC)
8675 if test "$ENABLE_JAVA" != "" -a \( "$cross_compiling" != "yes" -o -n "$with_jdk_home" \); then
8676     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
8677     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
8678         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
8679            # try to recover first by looking whether we have an alternative
8680            # system as in Debian or newer SuSEs where following /usr/bin/javac
8681            # over /etc/alternatives/javac leads to the right bindir where we
8682            # just need to strip a bit away to get a valid JAVA_HOME
8683            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
8684         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
8685             # maybe only one level of symlink (e.g. on Mac)
8686             JAVA_HOME=$(readlink $JAVACOMPILER)
8687             if test "$(dirname $JAVA_HOME)" = "."; then
8688                 # we've got no path to trim back
8689                 JAVA_HOME=""
8690             fi
8691         else
8692             # else warn
8693             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
8694             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
8695             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
8696             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
8697         fi
8698         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
8699         if test "$JAVA_HOME" != "/usr"; then
8700             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8701                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
8702                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
8703                 dnl Tiger already returns a JDK path...
8704                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
8705             else
8706                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
8707                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
8708                 dnl that checks which version to run
8709                 if test -f "$JAVA_HOME"; then
8710                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
8711                 fi
8712             fi
8713         fi
8714     fi
8715     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
8717     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
8718     if test -z "$JAVA_HOME"; then
8719         if test "x$with_jdk_home" = "x"; then
8720             cat > findhome.java <<_ACEOF
8721 [import java.io.File;
8723 class findhome
8725     public static void main(String args[])
8726     {
8727         String jrelocation = System.getProperty("java.home");
8728         File jre = new File(jrelocation);
8729         System.out.println(jre.getParent());
8730     }
8732 _ACEOF
8733             AC_MSG_CHECKING([if javac works])
8734             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
8735             AC_TRY_EVAL(javac_cmd)
8736             if test $? = 0 -a -f ./findhome.class; then
8737                 AC_MSG_RESULT([javac works])
8738             else
8739                 echo "configure: javac test failed" >&5
8740                 cat findhome.java >&5
8741                 AC_MSG_ERROR([javac does not work - java projects will not build!])
8742             fi
8743             AC_MSG_CHECKING([if gij knows its java.home])
8744             JAVA_HOME=`$JAVAINTERPRETER findhome`
8745             if test $? = 0 -a "$JAVA_HOME" != ""; then
8746                 AC_MSG_RESULT([$JAVA_HOME])
8747             else
8748                 echo "configure: java test failed" >&5
8749                 cat findhome.java >&5
8750                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
8751             fi
8752             # clean-up after ourselves
8753             rm -f ./findhome.java ./findhome.class
8754         else
8755             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
8756         fi
8757     fi
8759     # now check if $JAVA_HOME is really valid
8760     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8761         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
8762             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
8763             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
8764             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
8765             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
8766             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
8767             add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
8768         fi
8769     fi
8770     PathFormat "$JAVA_HOME"
8771     JAVA_HOME="$formatted_path"
8774 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
8775     "$_os" != Darwin
8776 then
8777     AC_MSG_CHECKING([for JAWT lib])
8778     if test "$_os" = WINNT; then
8779         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
8780         JAWTLIB=jawt.lib
8781     else
8782         case "$host_cpu" in
8783         arm*)
8784             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
8785             JAVA_ARCH=$my_java_arch
8786             ;;
8787         i*86)
8788             my_java_arch=i386
8789             ;;
8790         m68k)
8791             my_java_arch=m68k
8792             ;;
8793         powerpc)
8794             my_java_arch=ppc
8795             ;;
8796         powerpc64)
8797             my_java_arch=ppc64
8798             ;;
8799         powerpc64le)
8800             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
8801             JAVA_ARCH=$my_java_arch
8802             ;;
8803         sparc64)
8804             my_java_arch=sparcv9
8805             ;;
8806         x86_64)
8807             my_java_arch=amd64
8808             ;;
8809         *)
8810             my_java_arch=$host_cpu
8811             ;;
8812         esac
8813         # This is where JDK9 puts the library
8814         if test -e "$JAVA_HOME/lib/libjawt.so"; then
8815             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
8816         else
8817             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
8818         fi
8819         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
8820     fi
8821     AC_MSG_RESULT([$JAWTLIB])
8823 AC_SUBST(JAWTLIB)
8825 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
8826     case "$host_os" in
8828     aix*)
8829         JAVAINC="-I$JAVA_HOME/include"
8830         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
8831         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8832         ;;
8834     cygwin*|wsl*)
8835         JAVAINC="-I$JAVA_HOME/include/win32"
8836         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
8837         ;;
8839     darwin*)
8840         if test -d "$JAVA_HOME/include/darwin"; then
8841             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
8842         else
8843             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
8844         fi
8845         ;;
8847     dragonfly*)
8848         JAVAINC="-I$JAVA_HOME/include"
8849         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8850         ;;
8852     freebsd*)
8853         JAVAINC="-I$JAVA_HOME/include"
8854         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
8855         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
8856         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8857         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8858         ;;
8860     k*bsd*-gnu*)
8861         JAVAINC="-I$JAVA_HOME/include"
8862         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8863         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8864         ;;
8866     linux-gnu*)
8867         JAVAINC="-I$JAVA_HOME/include"
8868         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8869         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8870         ;;
8872     *netbsd*)
8873         JAVAINC="-I$JAVA_HOME/include"
8874         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
8875         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8876        ;;
8878     openbsd*)
8879         JAVAINC="-I$JAVA_HOME/include"
8880         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
8881         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8882         ;;
8884     solaris*)
8885         JAVAINC="-I$JAVA_HOME/include"
8886         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
8887         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8888         ;;
8889     esac
8891 SOLARINC="$SOLARINC $JAVAINC"
8893 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8894     JAVA_HOME_FOR_BUILD=$JAVA_HOME
8895     JAVAIFLAGS_FOR_BUILD=$JAVAIFLAGS
8896     JDK_FOR_BUILD=$JDK
8899 AC_SUBST(JAVACFLAGS)
8900 AC_SUBST(JAVACOMPILER)
8901 AC_SUBST(JAVAINTERPRETER)
8902 AC_SUBST(JAVAIFLAGS)
8903 AC_SUBST(JAVAIFLAGS_FOR_BUILD)
8904 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
8905 AC_SUBST(JAVA_HOME)
8906 AC_SUBST(JAVA_HOME_FOR_BUILD)
8907 AC_SUBST(JDK)
8908 AC_SUBST(JDK_FOR_BUILD)
8909 AC_SUBST(JAVA_SOURCE_VER)
8910 AC_SUBST(JAVA_TARGET_VER)
8913 dnl ===================================================================
8914 dnl Export file validation
8915 dnl ===================================================================
8916 AC_MSG_CHECKING([whether to enable export file validation])
8917 if test "$with_export_validation" != "no"; then
8918     if test -z "$ENABLE_JAVA"; then
8919         if test "$with_export_validation" = "yes"; then
8920             AC_MSG_ERROR([requested, but Java is disabled])
8921         else
8922             AC_MSG_RESULT([no, as Java is disabled])
8923         fi
8924     elif ! test -d "${SRC_ROOT}/schema"; then
8925         if test "$with_export_validation" = "yes"; then
8926             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
8927         else
8928             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
8929         fi
8930     else
8931         AC_MSG_RESULT([yes])
8932         AC_DEFINE(HAVE_EXPORT_VALIDATION)
8934         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
8935         if test -z "$ODFVALIDATOR"; then
8936             # remember to download the ODF toolkit with validator later
8937             AC_MSG_NOTICE([no odfvalidator found, will download it])
8938             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
8939             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
8941             # and fetch name of odfvalidator jar name from download.lst
8942             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
8943             AC_SUBST(ODFVALIDATOR_JAR)
8945             if test -z "$ODFVALIDATOR_JAR"; then
8946                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
8947             fi
8948         fi
8949         if test "$build_os" = "cygwin"; then
8950             # In case of Cygwin it will be executed from Windows,
8951             # so we need to run bash and absolute path to validator
8952             # so instead of "odfvalidator" it will be
8953             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
8954             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
8955         else
8956             ODFVALIDATOR="sh $ODFVALIDATOR"
8957         fi
8958         AC_SUBST(ODFVALIDATOR)
8961         AC_PATH_PROGS(OFFICEOTRON, officeotron)
8962         if test -z "$OFFICEOTRON"; then
8963             # remember to download the officeotron with validator later
8964             AC_MSG_NOTICE([no officeotron found, will download it])
8965             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
8966             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
8968             # and fetch name of officeotron jar name from download.lst
8969             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
8970             AC_SUBST(OFFICEOTRON_JAR)
8972             if test -z "$OFFICEOTRON_JAR"; then
8973                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
8974             fi
8975         else
8976             # check version of existing officeotron
8977             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
8978             if test 0"$OFFICEOTRON_VER" -lt 704; then
8979                 AC_MSG_ERROR([officeotron too old])
8980             fi
8981         fi
8982         if test "$build_os" = "cygwin"; then
8983             # In case of Cygwin it will be executed from Windows,
8984             # so we need to run bash and absolute path to validator
8985             # so instead of "odfvalidator" it will be
8986             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
8987             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
8988         else
8989             OFFICEOTRON="sh $OFFICEOTRON"
8990         fi
8991     fi
8992     AC_SUBST(OFFICEOTRON)
8993 else
8994     AC_MSG_RESULT([no])
8997 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
8998 if test "$with_bffvalidator" != "no"; then
8999     AC_DEFINE(HAVE_BFFVALIDATOR)
9001     if test "$with_export_validation" = "no"; then
9002         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
9003     fi
9005     if test "$with_bffvalidator" = "yes"; then
9006         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
9007     else
9008         BFFVALIDATOR="$with_bffvalidator"
9009     fi
9011     if test "$build_os" = "cygwin"; then
9012         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
9013             AC_MSG_RESULT($BFFVALIDATOR)
9014         else
9015             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
9016         fi
9017     elif test -n "$BFFVALIDATOR"; then
9018         # We are not in Cygwin but need to run Windows binary with wine
9019         AC_PATH_PROGS(WINE, wine)
9021         # so swap in a shell wrapper that converts paths transparently
9022         BFFVALIDATOR_EXE="$BFFVALIDATOR"
9023         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
9024         AC_SUBST(BFFVALIDATOR_EXE)
9025         AC_MSG_RESULT($BFFVALIDATOR)
9026     else
9027         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
9028     fi
9029     AC_SUBST(BFFVALIDATOR)
9030 else
9031     AC_MSG_RESULT([no])
9034 dnl ===================================================================
9035 dnl Check for C preprocessor to use
9036 dnl ===================================================================
9037 AC_MSG_CHECKING([which C preprocessor to use in idlc])
9038 SYSTEM_UCPP_IS_GCC=
9039 if test -n "$with_idlc_cpp"; then
9040     AC_MSG_RESULT([$with_idlc_cpp])
9041     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
9042     AC_MSG_CHECKING([if $with_idlc_cpp is GCC CPP])
9043     # ucpp will accept -v (to output version), warn about the others as unknown
9044     # and return 1 (due to -v)
9045     # gcc will accept -v (as verbose), --version (to output version) and -nostdinc
9046     # and return 0 (due to --version ) if all options are supported
9047     $SYSTEM_UCPP -v --version -nostdinc >/dev/null 2>/dev/null
9048     if test $? -eq 0;  then
9049         SYSTEM_UCPP_IS_GCC=TRUE
9050         AC_MSG_RESULT([yes])
9051     else
9052         AC_MSG_RESULT([no])
9053     fi
9054 else
9055     AC_MSG_RESULT([ucpp])
9056     AC_MSG_CHECKING([which ucpp to use])
9057     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
9058         AC_MSG_RESULT([external])
9059         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
9060     else
9061         AC_MSG_RESULT([internal])
9062         BUILD_TYPE="$BUILD_TYPE UCPP"
9063     fi
9065 AC_SUBST(SYSTEM_UCPP)
9066 AC_SUBST(SYSTEM_UCPP_IS_GCC)
9068 dnl ===================================================================
9069 dnl Check for epm (not needed for Windows)
9070 dnl ===================================================================
9071 AC_MSG_CHECKING([whether to enable EPM for packing])
9072 if test "$enable_epm" = "yes"; then
9073     AC_MSG_RESULT([yes])
9074     if test "$_os" != "WINNT"; then
9075         if test $_os = Darwin; then
9076             EPM=internal
9077         elif test -n "$with_epm"; then
9078             EPM=$with_epm
9079         else
9080             AC_PATH_PROG(EPM, epm, no)
9081         fi
9082         if test "$EPM" = "no" -o "$EPM" = "internal"; then
9083             AC_MSG_NOTICE([EPM will be built.])
9084             BUILD_TYPE="$BUILD_TYPE EPM"
9085             EPM=${WORKDIR}/UnpackedTarball/epm/epm
9086         else
9087             # Gentoo has some epm which is something different...
9088             AC_MSG_CHECKING([whether the found epm is the right epm])
9089             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
9090                 AC_MSG_RESULT([yes])
9091             else
9092                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
9093             fi
9094             AC_MSG_CHECKING([epm version])
9095             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
9096             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
9097                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
9098                 AC_MSG_RESULT([OK, >= 3.7])
9099             else
9100                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
9101                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
9102             fi
9103         fi
9104     fi
9106     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
9107         AC_MSG_CHECKING([for rpm])
9108         for a in "$RPM" rpmbuild rpm; do
9109             $a --usage >/dev/null 2> /dev/null
9110             if test $? -eq 0; then
9111                 RPM=$a
9112                 break
9113             else
9114                 $a --version >/dev/null 2> /dev/null
9115                 if test $? -eq 0; then
9116                     RPM=$a
9117                     break
9118                 fi
9119             fi
9120         done
9121         if test -z "$RPM"; then
9122             AC_MSG_ERROR([not found])
9123         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
9124             RPM_PATH=`which $RPM`
9125             AC_MSG_RESULT([$RPM_PATH])
9126             SCPDEFS="$SCPDEFS -DWITH_RPM"
9127         else
9128             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
9129         fi
9130     fi
9131     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
9132         AC_PATH_PROG(DPKG, dpkg, no)
9133         if test "$DPKG" = "no"; then
9134             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
9135         fi
9136     fi
9137     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
9138        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
9139         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
9140             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
9141                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
9142                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
9143                     AC_MSG_RESULT([yes])
9144                 else
9145                     AC_MSG_RESULT([no])
9146                     if echo "$PKGFORMAT" | $GREP -q rpm; then
9147                         _pt="rpm"
9148                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
9149                         add_warning "the rpms will need to be installed with --nodeps"
9150                     else
9151                         _pt="pkg"
9152                     fi
9153                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
9154                     add_warning "the ${_pt}s will not be relocatable"
9155                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
9156                                  relocation will work, you need to patch your epm with the
9157                                  patch in epm/epm-3.7.patch or build with
9158                                  --with-epm=internal which will build a suitable epm])
9159                 fi
9160             fi
9161         fi
9162     fi
9163     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
9164         AC_PATH_PROG(PKGMK, pkgmk, no)
9165         if test "$PKGMK" = "no"; then
9166             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
9167         fi
9168     fi
9169     AC_SUBST(RPM)
9170     AC_SUBST(DPKG)
9171     AC_SUBST(PKGMK)
9172 else
9173     for i in $PKGFORMAT; do
9174         case "$i" in
9175         aix | bsd | deb | pkg | rpm | native | portable)
9176             AC_MSG_ERROR(
9177                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
9178             ;;
9179         esac
9180     done
9181     AC_MSG_RESULT([no])
9182     EPM=NO
9184 AC_SUBST(EPM)
9186 ENABLE_LWP=
9187 if test "$enable_lotuswordpro" = "yes"; then
9188     ENABLE_LWP="TRUE"
9190 AC_SUBST(ENABLE_LWP)
9192 dnl ===================================================================
9193 dnl Check for building ODK
9194 dnl ===================================================================
9195 AC_MSG_CHECKING([whether to build the ODK])
9196 if test "$enable_odk" = yes; then
9197     if test "$DISABLE_DYNLOADING" = TRUE; then
9198         AC_MSG_ERROR([can't build ODK for --disable-dynamic-loading builds])
9199     fi
9200     AC_MSG_RESULT([yes])
9201     BUILD_TYPE="$BUILD_TYPE ODK"
9202 else
9203     AC_MSG_RESULT([no])
9206 if test "$enable_odk" != yes; then
9207     unset DOXYGEN
9208 else
9209     if test "$with_doxygen" = no; then
9210         AC_MSG_CHECKING([for doxygen])
9211         unset DOXYGEN
9212         AC_MSG_RESULT([no])
9213     else
9214         if test "$with_doxygen" = yes; then
9215             AC_PATH_PROG([DOXYGEN], [doxygen])
9216             if test -z "$DOXYGEN"; then
9217                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
9218             fi
9219             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
9220                 if ! dot -V 2>/dev/null; then
9221                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
9222                 fi
9223             fi
9224         else
9225             AC_MSG_CHECKING([for doxygen])
9226             DOXYGEN=$with_doxygen
9227             AC_MSG_RESULT([$DOXYGEN])
9228         fi
9229         if test -n "$DOXYGEN"; then
9230             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
9231             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
9232             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
9233                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
9234             fi
9235         fi
9236     fi
9238 AC_SUBST([DOXYGEN])
9240 dnl ==================================================================
9241 dnl libfuzzer
9242 dnl ==================================================================
9243 AC_MSG_CHECKING([whether to enable fuzzers])
9244 if test "$enable_fuzzers" != yes; then
9245     AC_MSG_RESULT([no])
9246 else
9247     if test -z $LIB_FUZZING_ENGINE; then
9248       AC_MSG_ERROR(['LIB_FUZZING_ENGINE' must be set when using --enable-fuzzers. Examples include '-fsanitize=fuzzer'.])
9249     fi
9250     AC_MSG_RESULT([yes])
9251     ENABLE_FUZZERS="TRUE"
9252     AC_DEFINE([ENABLE_FUZZERS],1)
9253     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9255 AC_SUBST(LIB_FUZZING_ENGINE)
9257 dnl ===================================================================
9258 dnl Check for system zlib
9259 dnl ===================================================================
9260 if test "$with_system_zlib" = "auto"; then
9261     case "$_os" in
9262     WINNT)
9263         with_system_zlib="$with_system_libs"
9264         ;;
9265     *)
9266         if test "$enable_fuzzers" != "yes"; then
9267             with_system_zlib=yes
9268         else
9269             with_system_zlib=no
9270         fi
9271         ;;
9272     esac
9275 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
9276 dnl and has no pkg-config for it at least on some tinderboxes,
9277 dnl so leaving that out for now
9278 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
9279 AC_MSG_CHECKING([which zlib to use])
9280 if test "$with_system_zlib" = "yes"; then
9281     AC_MSG_RESULT([external])
9282     SYSTEM_ZLIB=TRUE
9283     AC_CHECK_HEADER(zlib.h, [],
9284         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
9285     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
9286         [AC_MSG_ERROR(zlib not found or functional)], [])
9287 else
9288     AC_MSG_RESULT([internal])
9289     SYSTEM_ZLIB=
9290     BUILD_TYPE="$BUILD_TYPE ZLIB"
9291     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
9292     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
9294 AC_SUBST(ZLIB_CFLAGS)
9295 AC_SUBST(ZLIB_LIBS)
9296 AC_SUBST(SYSTEM_ZLIB)
9298 dnl ===================================================================
9299 dnl Check for system jpeg
9300 dnl ===================================================================
9301 AC_MSG_CHECKING([which libjpeg to use])
9302 if test "$with_system_jpeg" = "yes"; then
9303     AC_MSG_RESULT([external])
9304     SYSTEM_LIBJPEG=TRUE
9305     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
9306         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
9307     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
9308         [AC_MSG_ERROR(jpeg library not found or functional)], [])
9309 else
9310     SYSTEM_LIBJPEG=
9311     AC_MSG_RESULT([internal, libjpeg-turbo])
9312     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
9314     case "$host_cpu" in
9315     x86_64 | amd64 | i*86 | x86 | ia32)
9316         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
9317         if test -z "$NASM" -a "$build_os" = "cygwin"; then
9318             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
9319                 NASM="$LODE_HOME/opt/bin/nasm"
9320             elif test -x "/opt/lo/bin/nasm"; then
9321                 NASM="/opt/lo/bin/nasm"
9322             fi
9323         fi
9325         if test -n "$NASM"; then
9326             AC_MSG_CHECKING([for object file format of host system])
9327             case "$host_os" in
9328               cygwin* | mingw* | pw32* | wsl*)
9329                 case "$host_cpu" in
9330                   x86_64)
9331                     objfmt='Win64-COFF'
9332                     ;;
9333                   *)
9334                     objfmt='Win32-COFF'
9335                     ;;
9336                 esac
9337               ;;
9338               msdosdjgpp* | go32*)
9339                 objfmt='COFF'
9340               ;;
9341               os2-emx*) # not tested
9342                 objfmt='MSOMF' # obj
9343               ;;
9344               linux*coff* | linux*oldld*)
9345                 objfmt='COFF' # ???
9346               ;;
9347               linux*aout*)
9348                 objfmt='a.out'
9349               ;;
9350               linux*)
9351                 case "$host_cpu" in
9352                   x86_64)
9353                     objfmt='ELF64'
9354                     ;;
9355                   *)
9356                     objfmt='ELF'
9357                     ;;
9358                 esac
9359               ;;
9360               kfreebsd* | freebsd* | netbsd* | openbsd*)
9361                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
9362                   objfmt='BSD-a.out'
9363                 else
9364                   case "$host_cpu" in
9365                     x86_64 | amd64)
9366                       objfmt='ELF64'
9367                       ;;
9368                     *)
9369                       objfmt='ELF'
9370                       ;;
9371                   esac
9372                 fi
9373               ;;
9374               solaris* | sunos* | sysv* | sco*)
9375                 case "$host_cpu" in
9376                   x86_64)
9377                     objfmt='ELF64'
9378                     ;;
9379                   *)
9380                     objfmt='ELF'
9381                     ;;
9382                 esac
9383               ;;
9384               darwin* | rhapsody* | nextstep* | openstep* | macos*)
9385                 case "$host_cpu" in
9386                   x86_64)
9387                     objfmt='Mach-O64'
9388                     ;;
9389                   *)
9390                     objfmt='Mach-O'
9391                     ;;
9392                 esac
9393               ;;
9394               *)
9395                 objfmt='ELF ?'
9396               ;;
9397             esac
9399             AC_MSG_RESULT([$objfmt])
9400             if test "$objfmt" = 'ELF ?'; then
9401               objfmt='ELF'
9402               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
9403             fi
9405             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
9406             case "$objfmt" in
9407               MSOMF)      NAFLAGS='-fobj -DOBJ32 -DPIC';;
9408               Win32-COFF) NAFLAGS='-fwin32 -DWIN32 -DPIC';;
9409               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__ -DPIC';;
9410               COFF)       NAFLAGS='-fcoff -DCOFF -DPIC';;
9411               a.out)      NAFLAGS='-faout -DAOUT -DPIC';;
9412               BSD-a.out)  NAFLAGS='-faoutb -DAOUT -DPIC';;
9413               ELF)        NAFLAGS='-felf -DELF -DPIC';;
9414               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__ -DPIC';;
9415               RDF)        NAFLAGS='-frdf -DRDF -DPIC';;
9416               Mach-O)     NAFLAGS='-fmacho -DMACHO -DPIC';;
9417               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__ -DPIC';;
9418             esac
9419             AC_MSG_RESULT([$NAFLAGS])
9421             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
9422             cat > conftest.asm << EOF
9423             [%line __oline__ "configure"
9424                     section .text
9425                     global  _main,main
9426             _main:
9427             main:   xor     eax,eax
9428                     ret
9429             ]
9431             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
9432             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
9433               AC_MSG_RESULT(yes)
9434             else
9435               echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
9436               cat conftest.asm >&AS_MESSAGE_LOG_FD
9437               rm -rf conftest*
9438               AC_MSG_RESULT(no)
9439               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
9440               NASM=""
9441             fi
9443         fi
9445         if test -z "$NASM"; then
9446 cat << _EOS
9447 ****************************************************************************
9448 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
9449 To get one please:
9451 _EOS
9452             if test "$build_os" = "cygwin"; then
9453 cat << _EOS
9454 install a pre-compiled binary for Win32
9456 mkdir -p /opt/lo/bin
9457 cd /opt/lo/bin
9458 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
9459 chmod +x nasm
9461 or get and install one from http://www.nasm.us/
9463 Then re-run autogen.sh
9465 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
9466 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
9468 _EOS
9469             else
9470 cat << _EOS
9471 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
9473 _EOS
9474             fi
9475             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
9476             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
9477         fi
9478       ;;
9479     esac
9482 AC_SUBST(NASM)
9483 AC_SUBST(NAFLAGS)
9484 AC_SUBST(LIBJPEG_CFLAGS)
9485 AC_SUBST(LIBJPEG_LIBS)
9486 AC_SUBST(SYSTEM_LIBJPEG)
9488 dnl ===================================================================
9489 dnl Check for system clucene
9490 dnl ===================================================================
9491 libo_CHECK_SYSTEM_MODULE([clucene],[CLUCENE],[libclucene-core])
9492 if test "$SYSTEM_CLUCENE" = TRUE; then
9493     AC_LANG_PUSH([C++])
9494     save_CXXFLAGS=$CXXFLAGS
9495     save_CPPFLAGS=$CPPFLAGS
9496     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
9497     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
9498     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
9499     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
9500     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
9501                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
9502     CXXFLAGS=$save_CXXFLAGS
9503     CPPFLAGS=$save_CPPFLAGS
9504     AC_LANG_POP([C++])
9505     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
9508 dnl ===================================================================
9509 dnl Check for system expat
9510 dnl ===================================================================
9511 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
9513 dnl ===================================================================
9514 dnl Check for system xmlsec
9515 dnl ===================================================================
9516 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
9518 libo_CHECK_SYSTEM_MODULE([eot],[LIBEOT],[libeot >= 0.01],disabled)
9520 dnl ===================================================================
9521 dnl Check for DLP libs
9522 dnl ===================================================================
9523 REVENGE_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/librevenge/inc"
9524 AS_IF([test "$COM" = "MSC"],
9525       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
9526       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
9528 REVENGE_LIBS_internal="-L${librevenge_libdir} -lrevenge-0.0"
9529 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1])
9531 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
9533 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
9535 WPD_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/libwpd/inc"
9536 AS_IF([test "$COM" = "MSC"],
9537       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
9538       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
9540 WPD_LIBS_internal="-L${libwpd_libdir} -lwpd-0.10"
9541 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10])
9543 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
9545 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
9546 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.12])
9548 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
9550 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
9552 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
9554 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
9555 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.21])
9557 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
9558 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.10])
9560 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
9562 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
9563 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
9565 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
9567 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
9569 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
9571 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
9573 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
9574 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.7])
9576 dnl ===================================================================
9577 dnl Check for system lcms2
9578 dnl ===================================================================
9579 if test "$with_system_lcms2" != "yes"; then
9580     SYSTEM_LCMS2=
9582 LCMS2_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/lcms2/include"
9583 LCMS2_LIBS_internal="-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"
9584 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2])
9585 if test "$GCC" = "yes"; then
9586     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
9588 if test "$COM" = "MSC"; then # override the above
9589     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
9592 dnl ===================================================================
9593 dnl Check for system cppunit
9594 dnl ===================================================================
9595 if test "$_os" != "Android" ; then
9596     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
9599 dnl ===================================================================
9600 dnl Check whether freetype is available
9602 dnl FreeType has 3 different kinds of versions
9603 dnl * release, like 2.4.10
9604 dnl * libtool, like 13.0.7 (this what pkg-config returns)
9605 dnl * soname
9606 dnl FreeType's docs/VERSION.DLL provides a table mapping between the three
9608 dnl 9.9.3 is 2.2.0
9609 dnl When the minimal version is at least 2.8.1, remove Skia's check down below.
9610 dnl ===================================================================
9611 FREETYPE_CFLAGS_internal="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
9612 if test "x$ac_config_site_64bit_host" = xYES; then
9613     FREETYPE_LIBS_internal="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
9614 else
9615     FREETYPE_LIBS_internal="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
9617 libo_CHECK_SYSTEM_MODULE([freetype],[FREETYPE],[freetype2 >= 9.9.3],,system,TRUE)
9619 # ===================================================================
9620 # Check for system libxslt
9621 # to prevent incompatibilities between internal libxml2 and external libxslt,
9622 # or vice versa, use with_system_libxml here
9623 # ===================================================================
9624 if test "$with_system_libxml" = "auto"; then
9625     case "$_os" in
9626     WINNT|iOS|Android)
9627         with_system_libxml="$with_system_libs"
9628         ;;
9629     Emscripten)
9630         with_system_libxml=no
9631         ;;
9632     *)
9633         if test "$enable_fuzzers" != "yes"; then
9634             with_system_libxml=yes
9635         else
9636             with_system_libxml=no
9637         fi
9638         ;;
9639     esac
9642 AC_MSG_CHECKING([which libxslt to use])
9643 if test "$with_system_libxml" = "yes"; then
9644     AC_MSG_RESULT([external])
9645     SYSTEM_LIBXSLT=TRUE
9646     if test "$_os" = "Darwin"; then
9647         dnl make sure to use SDK path
9648         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9649         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
9650         dnl omit -L/usr/lib
9651         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
9652         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
9653     else
9654         PKG_CHECK_MODULES(LIBXSLT, libxslt)
9655         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9656         FilterLibs "${LIBXSLT_LIBS}"
9657         LIBXSLT_LIBS="${filteredlibs}"
9658         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
9659         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9660         FilterLibs "${LIBEXSLT_LIBS}"
9661         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
9662     fi
9664     dnl Check for xsltproc
9665     AC_PATH_PROG(XSLTPROC, xsltproc, no)
9666     if test "$XSLTPROC" = "no"; then
9667         AC_MSG_ERROR([xsltproc is required])
9668     fi
9669 else
9670     AC_MSG_RESULT([internal])
9671     SYSTEM_LIBXSLT=
9672     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
9674 AC_SUBST(SYSTEM_LIBXSLT)
9675 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
9676     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
9678 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
9680 AC_SUBST(LIBEXSLT_CFLAGS)
9681 AC_SUBST(LIBEXSLT_LIBS)
9682 AC_SUBST(LIBXSLT_CFLAGS)
9683 AC_SUBST(LIBXSLT_LIBS)
9684 AC_SUBST(XSLTPROC)
9686 # ===================================================================
9687 # Check for system libxml
9688 # ===================================================================
9689 AC_MSG_CHECKING([which libxml to use])
9690 if test "$with_system_libxml" = "yes"; then
9691     AC_MSG_RESULT([external])
9692     SYSTEM_LIBXML=TRUE
9693     if test "$_os" = "Darwin"; then
9694         dnl make sure to use SDK path
9695         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9696         dnl omit -L/usr/lib
9697         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
9698     elif test $_os = iOS; then
9699         dnl make sure to use SDK path
9700         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
9701         LIBXML_CFLAGS="-I$usr/include/libxml2"
9702         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
9703     else
9704         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
9705         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9706         FilterLibs "${LIBXML_LIBS}"
9707         LIBXML_LIBS="${filteredlibs}"
9708     fi
9710     dnl Check for xmllint
9711     AC_PATH_PROG(XMLLINT, xmllint, no)
9712     if test "$XMLLINT" = "no"; then
9713         AC_MSG_ERROR([xmllint is required])
9714     fi
9715 else
9716     AC_MSG_RESULT([internal])
9717     SYSTEM_LIBXML=
9718     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
9719     if test "$COM" = "MSC"; then
9720         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9721     fi
9722     if test "$COM" = "MSC"; then
9723         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
9724     else
9725         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
9726         if test "$DISABLE_DYNLOADING" = TRUE; then
9727             LIBXML_LIBS="$LIBXML_LIBS -lm"
9728         fi
9729     fi
9730     BUILD_TYPE="$BUILD_TYPE LIBXML2"
9732 AC_SUBST(SYSTEM_LIBXML)
9733 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
9734     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
9736 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
9737 AC_SUBST(LIBXML_CFLAGS)
9738 AC_SUBST(LIBXML_LIBS)
9739 AC_SUBST(XMLLINT)
9741 # =====================================================================
9742 # Checking for a Python interpreter with version >= 3.3.
9743 # Optionally user can pass an option to configure, i. e.
9744 # ./configure PYTHON=/usr/bin/python
9745 # =====================================================================
9746 if test $_os = Darwin -a "$enable_python" != no -a "$enable_python" != fully-internal -a "$enable_python" != internal -a "$enable_python" != system; then
9747     # Only allowed choices for macOS are 'no', 'internal' (default), and 'fully-internal'
9748     # unless PYTHON is defined as above which allows 'system'
9749     enable_python=internal
9751 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
9752     if test -n "$PYTHON"; then
9753         PYTHON_FOR_BUILD=$PYTHON
9754     else
9755         # This allows a lack of system python with no error, we use internal one in that case.
9756         AM_PATH_PYTHON([3.3],, [:])
9757         # Clean PYTHON_VERSION checked below if cross-compiling
9758         PYTHON_VERSION=""
9759         if test "$PYTHON" != ":"; then
9760             PYTHON_FOR_BUILD=$PYTHON
9761         fi
9762     fi
9765 # Checks for Python to use for Pyuno
9766 AC_MSG_CHECKING([which Python to use for Pyuno])
9767 case "$enable_python" in
9768 no|disable)
9769     if test -z "$PYTHON_FOR_BUILD" -a "$cross_compiling" != yes; then
9770         # Python is required to build LibreOffice. In theory we could separate the build-time Python
9771         # requirement from the choice whether to include Python stuff in the installer, but why
9772         # bother?
9773         AC_MSG_ERROR([Python is required at build time.])
9774     fi
9775     enable_python=no
9776     AC_MSG_RESULT([none])
9777     ;;
9778 ""|yes|auto)
9779     if test "$DISABLE_SCRIPTING" = TRUE; then
9780         if test -z "$PYTHON_FOR_BUILD" -a "$cross_compiling" != yes; then
9781             AC_MSG_ERROR([Python support can't be disabled without cross-compiling or a system python.])
9782         fi
9783         AC_MSG_RESULT([none, overridden by --disable-scripting])
9784         enable_python=no
9785     elif test $build_os = cygwin; then
9786         dnl When building on Windows we don't attempt to use any installed
9787         dnl "system"  Python.
9788         AC_MSG_RESULT([fully internal])
9789         enable_python=internal
9790     elif test "$cross_compiling" = yes; then
9791         AC_MSG_RESULT([system])
9792         enable_python=system
9793     else
9794         # Unset variables set by the above AM_PATH_PYTHON so that
9795         # we actually do check anew.
9796         AC_MSG_RESULT([])
9797         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
9798         AM_PATH_PYTHON([3.3],, [:])
9799         AC_MSG_CHECKING([which Python to use for Pyuno])
9800         if test "$PYTHON" = ":"; then
9801             if test -z "$PYTHON_FOR_BUILD"; then
9802                 AC_MSG_RESULT([fully internal])
9803             else
9804                 AC_MSG_RESULT([internal])
9805             fi
9806             enable_python=internal
9807         else
9808             AC_MSG_RESULT([system])
9809             enable_python=system
9810         fi
9811     fi
9812     ;;
9813 internal)
9814     AC_MSG_RESULT([internal])
9815     ;;
9816 fully-internal)
9817     AC_MSG_RESULT([fully internal])
9818     enable_python=internal
9819     ;;
9820 system)
9821     AC_MSG_RESULT([system])
9822     if test "$_os" = Darwin -a -z "$PYTHON"; then
9823         AC_MSG_ERROR([--enable-python=system doesn't work on macOS because the version provided is obsolete])
9824     fi
9825     ;;
9827     AC_MSG_ERROR([Incorrect --enable-python option])
9828     ;;
9829 esac
9831 if test $enable_python != no; then
9832     BUILD_TYPE="$BUILD_TYPE PYUNO"
9835 if test $enable_python = system; then
9836     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
9837         # Fallback: Accept these in the environment, or as set above
9838         # for MacOSX.
9839         :
9840     elif test "$cross_compiling" != yes; then
9841         # Unset variables set by the above AM_PATH_PYTHON so that
9842         # we actually do check anew.
9843         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
9844         # This causes an error if no python command is found
9845         AM_PATH_PYTHON([3.3])
9846         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
9847         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
9848         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
9849         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
9850         if test -z "$PKG_CONFIG"; then
9851             PYTHON_CFLAGS="-I$python_include"
9852             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
9853         elif $PKG_CONFIG --exists python-$python_version-embed; then
9854             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
9855             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
9856         elif $PKG_CONFIG --exists python-$python_version; then
9857             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
9858             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
9859         else
9860             PYTHON_CFLAGS="-I$python_include"
9861             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
9862         fi
9863         FilterLibs "${PYTHON_LIBS}"
9864         PYTHON_LIBS="${filteredlibs}"
9865     else
9866         dnl How to find out the cross-compilation Python installation path?
9867         AC_MSG_CHECKING([for python version])
9868         AS_IF([test -n "$PYTHON_VERSION"],
9869               [AC_MSG_RESULT([$PYTHON_VERSION])],
9870               [AC_MSG_RESULT([not found])
9871                AC_MSG_ERROR([no usable python found])])
9872         test -n "$PYTHON_CFLAGS" && break
9873     fi
9875     dnl Check if the headers really work
9876     save_CPPFLAGS="$CPPFLAGS"
9877     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
9878     AC_CHECK_HEADER(Python.h)
9879     CPPFLAGS="$save_CPPFLAGS"
9881     # let the PYTHON_FOR_BUILD match the same python installation that
9882     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
9883     # better for PythonTests.
9884     PYTHON_FOR_BUILD=$PYTHON
9887 if test "$with_lxml" != no; then
9888     if test -z "$PYTHON_FOR_BUILD"; then
9889         case $build_os in
9890             cygwin)
9891                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
9892                 ;;
9893             *)
9894                 if test "$cross_compiling" != yes ; then
9895                     BUILD_TYPE="$BUILD_TYPE LXML"
9896                 fi
9897                 ;;
9898         esac
9899     else
9900         AC_MSG_CHECKING([for python lxml])
9901         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
9902             AC_MSG_RESULT([yes])
9903         else
9904             case $build_os in
9905                 cygwin)
9906                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
9907                     ;;
9908                 *)
9909                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
9910                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
9911                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
9912                         else
9913                             BUILD_TYPE="$BUILD_TYPE LXML"
9914                             AC_MSG_RESULT([no, using internal lxml])
9915                         fi
9916                     else
9917                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
9918                     fi
9919                     ;;
9920             esac
9921         fi
9922     fi
9925 if test \( "$cross_compiling" = yes -a -z "$PYTHON_FOR_BUILD" \) -o "$enable_python" = internal; then
9926     SYSTEM_PYTHON=
9927     PYTHON_VERSION_MAJOR=3
9928     PYTHON_VERSION_MINOR=8
9929     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.12
9930     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
9931         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
9932     fi
9933     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
9935     # Embedded Python dies without Home set
9936     if test "$HOME" = ""; then
9937         export HOME=""
9938     fi
9941 dnl By now enable_python should be "system", "internal" or "no"
9942 case $enable_python in
9943 system)
9944     SYSTEM_PYTHON=TRUE
9946     if test "x$ac_cv_header_Python_h" != "xyes"; then
9947        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
9948     fi
9950     AC_LANG_PUSH(C)
9951     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
9952     AC_MSG_CHECKING([for correct python library version])
9953        AC_RUN_IFELSE([AC_LANG_SOURCE([[
9954 #include <Python.h>
9956 int main(int argc, char **argv) {
9957    if ((PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
9958    else return 1;
9960        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3])],[AC_MSG_RESULT([skipped; cross-compiling])])
9961     AC_LANG_POP(C)
9963     dnl FIXME Check if the Python library can be linked with, too?
9964     ;;
9966 internal)
9967     BUILD_TYPE="$BUILD_TYPE PYTHON"
9968     if test "$OS" = LINUX -o "$OS" = WNT ; then
9969         BUILD_TYPE="$BUILD_TYPE LIBFFI"
9970     fi
9971     ;;
9973     DISABLE_PYTHON=TRUE
9974     SYSTEM_PYTHON=
9975     ;;
9977     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
9978     ;;
9979 esac
9981 AC_SUBST(DISABLE_PYTHON)
9982 AC_SUBST(SYSTEM_PYTHON)
9983 AC_SUBST(PYTHON_CFLAGS)
9984 AC_SUBST(PYTHON_FOR_BUILD)
9985 AC_SUBST(PYTHON_LIBS)
9986 AC_SUBST(PYTHON_VERSION)
9987 AC_SUBST(PYTHON_VERSION_MAJOR)
9988 AC_SUBST(PYTHON_VERSION_MINOR)
9990 AC_MSG_CHECKING([whether to build LibreLogo])
9991 case "$enable_python" in
9992 no|disable)
9993     AC_MSG_RESULT([no; Python disabled])
9994     ;;
9996     if test "${enable_librelogo}" = "no"; then
9997         AC_MSG_RESULT([no])
9998     else
9999         AC_MSG_RESULT([yes])
10000         BUILD_TYPE="${BUILD_TYPE} LIBRELOGO"
10001         AC_DEFINE([ENABLE_LIBRELOGO],1)
10002     fi
10003     ;;
10004 esac
10005 AC_SUBST(ENABLE_LIBRELOGO)
10007 ENABLE_MARIADBC=
10008 MARIADBC_MAJOR=1
10009 MARIADBC_MINOR=0
10010 MARIADBC_MICRO=2
10011 AC_MSG_CHECKING([whether to build the MariaDB/MySQL SDBC driver])
10012 if test "x$enable_mariadb_sdbc" != "xno" -a "$enable_mpl_subset" != "yes"; then
10013     ENABLE_MARIADBC=TRUE
10014     AC_MSG_RESULT([yes])
10015     BUILD_TYPE="$BUILD_TYPE MARIADBC"
10016 else
10017     AC_MSG_RESULT([no])
10019 AC_SUBST(ENABLE_MARIADBC)
10020 AC_SUBST(MARIADBC_MAJOR)
10021 AC_SUBST(MARIADBC_MINOR)
10022 AC_SUBST(MARIADBC_MICRO)
10024 if test "$ENABLE_MARIADBC" = "TRUE"; then
10025     dnl ===================================================================
10026     dnl Check for system MariaDB
10027     dnl ===================================================================
10028     AC_MSG_CHECKING([which MariaDB to use])
10029     if test "$with_system_mariadb" = "yes"; then
10030         AC_MSG_RESULT([external])
10031         SYSTEM_MARIADB_CONNECTOR_C=TRUE
10032         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
10033         if test -z "$MARIADBCONFIG"; then
10034             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
10035             if test -z "$MARIADBCONFIG"; then
10036                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
10037                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
10038             fi
10039         fi
10040         AC_MSG_CHECKING([MariaDB version])
10041         MARIADB_VERSION=`$MARIADBCONFIG --version`
10042         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
10043         if test "$MARIADB_MAJOR" -ge "5"; then
10044             AC_MSG_RESULT([OK])
10045         else
10046             AC_MSG_ERROR([too old, use 5.0.x or later])
10047         fi
10048         AC_MSG_CHECKING([for MariaDB Client library])
10049         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
10050         if test "$COM_IS_CLANG" = TRUE; then
10051             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
10052         fi
10053         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
10054         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
10055         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
10056         dnl linux32:
10057         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
10058             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
10059             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
10060                 | sed -e 's|/lib64/|/lib/|')
10061         fi
10062         FilterLibs "${MARIADB_LIBS}"
10063         MARIADB_LIBS="${filteredlibs}"
10064         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
10065         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
10066         if test "$enable_bundle_mariadb" = "yes"; then
10067             AC_MSG_RESULT([yes])
10068             BUNDLE_MARIADB_CONNECTOR_C=TRUE
10069             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
10071 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
10073 /g' | grep -E '(mysqlclient|mariadb)')
10074             if test "$_os" = "Darwin"; then
10075                 LIBMARIADB=${LIBMARIADB}.dylib
10076             elif test "$_os" = "WINNT"; then
10077                 LIBMARIADB=${LIBMARIADB}.dll
10078             else
10079                 LIBMARIADB=${LIBMARIADB}.so
10080             fi
10081             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
10082             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
10083             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
10084                 AC_MSG_RESULT([found.])
10085                 PathFormat "$LIBMARIADB_PATH"
10086                 LIBMARIADB_PATH="$formatted_path"
10087             else
10088                 AC_MSG_ERROR([not found.])
10089             fi
10090         else
10091             AC_MSG_RESULT([no])
10092             BUNDLE_MARIADB_CONNECTOR_C=
10093         fi
10094     else
10095         AC_MSG_RESULT([internal])
10096         SYSTEM_MARIADB_CONNECTOR_C=
10097         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
10098         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
10099         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
10100     fi
10102     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
10103     AC_SUBST(MARIADB_CFLAGS)
10104     AC_SUBST(MARIADB_LIBS)
10105     AC_SUBST(LIBMARIADB)
10106     AC_SUBST(LIBMARIADB_PATH)
10107     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
10110 dnl ===================================================================
10111 dnl Check for system hsqldb
10112 dnl ===================================================================
10113 if test "$with_java" != "no" -a "$cross_compiling" != "yes"; then
10114     HSQLDB_USE_JDBC_4_1=
10115     AC_MSG_CHECKING([which hsqldb to use])
10116     if test "$with_system_hsqldb" = "yes"; then
10117         AC_MSG_RESULT([external])
10118         SYSTEM_HSQLDB=TRUE
10119         if test -z $HSQLDB_JAR; then
10120             HSQLDB_JAR=/usr/share/java/hsqldb.jar
10121         fi
10122         if ! test -f $HSQLDB_JAR; then
10123                AC_MSG_ERROR(hsqldb.jar not found.)
10124         fi
10125         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
10126         export HSQLDB_JAR
10127         if $PERL -e \
10128            'use Archive::Zip;
10129             my $file = "$ENV{'HSQLDB_JAR'}";
10130             my $zip = Archive::Zip->new( $file );
10131             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
10132             if ( $mf =~ m/Specification-Version: 1.8.*/ )
10133             {
10134                 push @l, split(/\n/, $mf);
10135                 foreach my $line (@l)
10136                 {
10137                     if ($line =~ m/Specification-Version:/)
10138                     {
10139                         ($t, $version) = split (/:/,$line);
10140                         $version =~ s/^\s//;
10141                         ($a, $b, $c, $d) = split (/\./,$version);
10142                         if ($c == "0" && $d > "8")
10143                         {
10144                             exit 0;
10145                         }
10146                         else
10147                         {
10148                             exit 1;
10149                         }
10150                     }
10151                 }
10152             }
10153             else
10154             {
10155                 exit 1;
10156             }'; then
10157             AC_MSG_RESULT([yes])
10158         else
10159             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
10160         fi
10161     else
10162         AC_MSG_RESULT([internal])
10163         SYSTEM_HSQLDB=
10164         BUILD_TYPE="$BUILD_TYPE HSQLDB"
10165         NEED_ANT=TRUE
10166         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
10167         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
10168         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
10169             AC_MSG_RESULT([yes])
10170             HSQLDB_USE_JDBC_4_1=TRUE
10171         else
10172             AC_MSG_RESULT([no])
10173         fi
10174     fi
10175 else
10176     if test "$with_java" != "no" -a -z "$HSQLDB_JAR"; then
10177         BUILD_TYPE="$BUILD_TYPE HSQLDB"
10178     fi
10180 AC_SUBST(SYSTEM_HSQLDB)
10181 AC_SUBST(HSQLDB_JAR)
10182 AC_SUBST([HSQLDB_USE_JDBC_4_1])
10184 dnl ===================================================================
10185 dnl Check for PostgreSQL stuff
10186 dnl ===================================================================
10187 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
10188 if test "x$enable_postgresql_sdbc" != "xno"; then
10189     AC_MSG_RESULT([yes])
10190     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
10192     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
10193         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
10194     fi
10195     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
10196         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
10197     fi
10199     postgres_interface=""
10200     if test "$with_system_postgresql" = "yes"; then
10201         postgres_interface="external PostgreSQL"
10202         SYSTEM_POSTGRESQL=TRUE
10203         if test "$_os" = Darwin; then
10204             supp_path=''
10205             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
10206                 pg_supp_path="$P_SEP$d$pg_supp_path"
10207             done
10208         fi
10209         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
10210         if test -n "$PGCONFIG"; then
10211             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
10212             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
10213         else
10214             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
10215               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
10216               POSTGRESQL_LIB=$POSTGRESQL_LIBS
10217             ],[
10218               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
10219             ])
10220         fi
10221         FilterLibs "${POSTGRESQL_LIB}"
10222         POSTGRESQL_LIB="${filteredlibs}"
10223     else
10224         # if/when anything else than PostgreSQL uses Kerberos,
10225         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
10226         WITH_KRB5=
10227         WITH_GSSAPI=
10228         case "$_os" in
10229         Darwin)
10230             # macOS has system MIT Kerberos 5 since 10.4
10231             if test "$with_krb5" != "no"; then
10232                 WITH_KRB5=TRUE
10233                 save_LIBS=$LIBS
10234                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
10235                 # that the libraries where these functions are located on macOS will change, is it?
10236                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10237                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10238                 KRB5_LIBS=$LIBS
10239                 LIBS=$save_LIBS
10240                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10241                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10242                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10243                 LIBS=$save_LIBS
10244             fi
10245             if test "$with_gssapi" != "no"; then
10246                 WITH_GSSAPI=TRUE
10247                 save_LIBS=$LIBS
10248                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10249                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10250                 GSSAPI_LIBS=$LIBS
10251                 LIBS=$save_LIBS
10252             fi
10253             ;;
10254         WINNT)
10255             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
10256                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
10257             fi
10258             ;;
10259         Linux|GNU|*BSD|DragonFly)
10260             if test "$with_krb5" != "no"; then
10261                 WITH_KRB5=TRUE
10262                 save_LIBS=$LIBS
10263                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10264                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10265                 KRB5_LIBS=$LIBS
10266                 LIBS=$save_LIBS
10267                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10268                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10269                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10270                 LIBS=$save_LIBS
10271             fi
10272             if test "$with_gssapi" != "no"; then
10273                 WITH_GSSAPI=TRUE
10274                 save_LIBS=$LIBS
10275                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10276                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10277                 GSSAPI_LIBS=$LIBS
10278                 LIBS=$save_LIBS
10279             fi
10280             ;;
10281         *)
10282             if test "$with_krb5" = "yes"; then
10283                 WITH_KRB5=TRUE
10284                 save_LIBS=$LIBS
10285                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10286                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10287                 KRB5_LIBS=$LIBS
10288                 LIBS=$save_LIBS
10289                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10290                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10291                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10292                 LIBS=$save_LIBS
10293             fi
10294             if test "$with_gssapi" = "yes"; then
10295                 WITH_GSSAPI=TRUE
10296                 save_LIBS=$LIBS
10297                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10298                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10299                 LIBS=$save_LIBS
10300                 GSSAPI_LIBS=$LIBS
10301             fi
10302         esac
10304         if test -n "$with_libpq_path"; then
10305             SYSTEM_POSTGRESQL=TRUE
10306             postgres_interface="external libpq"
10307             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
10308             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
10309         else
10310             SYSTEM_POSTGRESQL=
10311             postgres_interface="internal"
10312             POSTGRESQL_LIB=""
10313             POSTGRESQL_INC="%OVERRIDE_ME%"
10314             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
10315         fi
10316     fi
10318     AC_MSG_CHECKING([PostgreSQL C interface])
10319     AC_MSG_RESULT([$postgres_interface])
10321     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
10322         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
10323         save_CFLAGS=$CFLAGS
10324         save_CPPFLAGS=$CPPFLAGS
10325         save_LIBS=$LIBS
10326         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
10327         LIBS="${LIBS} ${POSTGRESQL_LIB}"
10328         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
10329         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
10330             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
10331         CFLAGS=$save_CFLAGS
10332         CPPFLAGS=$save_CPPFLAGS
10333         LIBS=$save_LIBS
10334     fi
10335     BUILD_POSTGRESQL_SDBC=TRUE
10336 else
10337     AC_MSG_RESULT([no])
10339 AC_SUBST(WITH_KRB5)
10340 AC_SUBST(WITH_GSSAPI)
10341 AC_SUBST(GSSAPI_LIBS)
10342 AC_SUBST(KRB5_LIBS)
10343 AC_SUBST(BUILD_POSTGRESQL_SDBC)
10344 AC_SUBST(SYSTEM_POSTGRESQL)
10345 AC_SUBST(POSTGRESQL_INC)
10346 AC_SUBST(POSTGRESQL_LIB)
10348 dnl ===================================================================
10349 dnl Check for Firebird stuff
10350 dnl ===================================================================
10351 ENABLE_FIREBIRD_SDBC=
10352 if test "$enable_firebird_sdbc" = "yes" ; then
10353     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
10355     dnl ===================================================================
10356     dnl Check for system Firebird
10357     dnl ===================================================================
10358     AC_MSG_CHECKING([which Firebird to use])
10359     if test "$with_system_firebird" = "yes"; then
10360         AC_MSG_RESULT([external])
10361         SYSTEM_FIREBIRD=TRUE
10362         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
10363         if test -z "$FIREBIRDCONFIG"; then
10364             AC_MSG_NOTICE([No fb_config -- using pkg-config])
10365             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
10366                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
10367             ])
10368             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
10369         else
10370             AC_MSG_NOTICE([fb_config found])
10371             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
10372             AC_MSG_CHECKING([for Firebird Client library])
10373             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
10374             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
10375             FilterLibs "${FIREBIRD_LIBS}"
10376             FIREBIRD_LIBS="${filteredlibs}"
10377         fi
10378         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
10379         AC_MSG_CHECKING([Firebird version])
10380         if test -n "${FIREBIRD_VERSION}"; then
10381             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
10382             if test "$FIREBIRD_MAJOR" -ge "3"; then
10383                 AC_MSG_RESULT([OK])
10384             else
10385                 AC_MSG_ERROR([Ensure firebird >= 3 is installed])
10386             fi
10387         else
10388             save_CFLAGS="${CFLAGS}"
10389             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
10390             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
10391 #if defined(FB_API_VER) && FB_API_VER == 30
10392 int fb_api_is_30(void) { return 0; }
10393 #else
10394 #error "Wrong Firebird API version"
10395 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
10396             CFLAGS="$save_CFLAGS"
10397         fi
10398         ENABLE_FIREBIRD_SDBC=TRUE
10399         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10400     elif test "$enable_database_connectivity" = no; then
10401         AC_MSG_RESULT([none])
10402     elif test "$cross_compiling" = "yes"; then
10403         AC_MSG_RESULT([none])
10404     else
10405         dnl Embedded Firebird has version 3.0
10406         dnl We need libatomic_ops for any non X86/X64 system
10407         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
10408             dnl ===================================================================
10409             dnl Check for system libatomic_ops
10410             dnl ===================================================================
10411             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[LIBATOMIC_OPS],[atomic_ops >= 0.7.2])
10412             if test "$with_system_libatomic_ops" = "yes"; then
10413                 SYSTEM_LIBATOMIC_OPS=TRUE
10414                 AC_CHECK_HEADERS(atomic_ops.h, [],
10415                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
10416             else
10417                 SYSTEM_LIBATOMIC_OPS=
10418                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
10419                 LIBATOMIC_OPS_LIBS="-latomic_ops"
10420                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
10421             fi
10422         fi
10424         AC_MSG_RESULT([internal])
10425         SYSTEM_FIREBIRD=
10426         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
10427         FIREBIRD_LIBS="-lfbclient"
10429         if test "$with_system_libtommath" = "yes"; then
10430             SYSTEM_LIBTOMMATH=TRUE
10431             dnl check for tommath presence
10432             save_LIBS=$LIBS
10433             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
10434             AC_CHECK_LIB(tommath, mp_init, LIBTOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
10435             LIBS=$save_LIBS
10436         else
10437             SYSTEM_LIBTOMMATH=
10438             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
10439             LIBTOMMATH_LIBS="-ltommath"
10440             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
10441         fi
10443         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
10444         ENABLE_FIREBIRD_SDBC=TRUE
10445         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10446     fi
10448 AC_SUBST(ENABLE_FIREBIRD_SDBC)
10449 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
10450 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
10451 AC_SUBST(LIBATOMIC_OPS_LIBS)
10452 AC_SUBST(SYSTEM_FIREBIRD)
10453 AC_SUBST(FIREBIRD_CFLAGS)
10454 AC_SUBST(FIREBIRD_LIBS)
10455 AC_SUBST(SYSTEM_LIBTOMMATH)
10456 AC_SUBST(LIBTOMMATH_CFLAGS)
10457 AC_SUBST(LIBTOMMATH_LIBS)
10459 dnl ===================================================================
10460 dnl Check for system curl
10461 dnl ===================================================================
10462 libo_CHECK_SYSTEM_MODULE([curl],[CURL],[libcurl >= 7.68.0],enabled)
10464 dnl ===================================================================
10465 dnl Check for system boost
10466 dnl ===================================================================
10467 AC_MSG_CHECKING([which boost to use])
10468 if test "$with_system_boost" = "yes"; then
10469     AC_MSG_RESULT([external])
10470     SYSTEM_BOOST=TRUE
10471     AX_BOOST_BASE([1.66],,[AC_MSG_ERROR([no suitable Boost found])])
10472     AX_BOOST_DATE_TIME
10473     AX_BOOST_FILESYSTEM
10474     AX_BOOST_IOSTREAMS
10475     AX_BOOST_LOCALE
10476     AC_LANG_PUSH([C++])
10477     save_CXXFLAGS=$CXXFLAGS
10478     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
10479     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
10480        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
10481     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
10482        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
10483     CXXFLAGS=$save_CXXFLAGS
10484     AC_LANG_POP([C++])
10485     # this is in m4/ax_boost_base.m4
10486     FilterLibs "${BOOST_LDFLAGS}"
10487     BOOST_LDFLAGS="${filteredlibs}"
10488 else
10489     AC_MSG_RESULT([internal])
10490     BUILD_TYPE="$BUILD_TYPE BOOST"
10491     SYSTEM_BOOST=
10492     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
10493         # use warning-suppressing wrapper headers
10494         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
10495     else
10496         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
10497     fi
10499 AC_SUBST(SYSTEM_BOOST)
10501 dnl ===================================================================
10502 dnl Check for system mdds
10503 dnl ===================================================================
10504 MDDS_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/mdds/include"
10505 libo_CHECK_SYSTEM_MODULE([mdds],[MDDS],[mdds-2.0 >= 2.0.0])
10507 dnl ===================================================================
10508 dnl Check for system cuckoo
10509 dnl ===================================================================
10510 AC_MSG_CHECKING([which cuckoo to use])
10511 if test "$with_system_cuckoo" = "yes"; then
10512     AC_MSG_RESULT([external])
10513     SYSTEM_CUCKOO=TRUE
10514     AC_LANG_PUSH([C++])
10515     AC_CHECK_HEADER([libcuckoo/cuckoohash_map.hh], [],
10516        [AC_MSG_ERROR([libcuckoo/cuckoohash_map.hh not found. install cuckoo])], [])
10517     AC_LANG_POP([C++])
10518 else
10519     AC_MSG_RESULT([internal])
10520     BUILD_TYPE="$BUILD_TYPE CUCKOO"
10521     SYSTEM_CUCKOO=
10523 AC_SUBST([SYSTEM_CUCKOO])
10525 dnl ===================================================================
10526 dnl Check for system dragonbox
10527 dnl ===================================================================
10528 AC_MSG_CHECKING([which dragonbox to use])
10529 if test "$with_system_dragonbox" = "yes"; then
10530     AC_MSG_RESULT([external])
10531     SYSTEM_DRAGONBOX=TRUE
10532     AC_LANG_PUSH([C++])
10533     save_CPPFLAGS=$CPPFLAGS
10534     # This is where upstream installs to, unfortunately no .pc or so...
10535     DRAGONBOX_CFLAGS=-I/usr/include/dragonbox-1.0.0
10536     CPPFLAGS="$CPPFLAGS $DRAGONBOX_CFLAGS"
10537     AC_CHECK_HEADER([dragonbox/dragonbox.h], [],
10538        [AC_MSG_ERROR([dragonbox/dragonbox.h not found. install dragonbox])], [])
10539     AC_LANG_POP([C++])
10540     CPPFLAGS=$save_CPPFLAGS
10541 else
10542     AC_MSG_RESULT([internal])
10543     BUILD_TYPE="$BUILD_TYPE DRAGONBOX"
10544     SYSTEM_DRAGONBOX=
10546 AC_SUBST([SYSTEM_DRAGONBOX])
10547 AC_SUBST([DRAGONBOX_CFLAGS])
10549 dnl ===================================================================
10550 dnl Check for system glm
10551 dnl ===================================================================
10552 AC_MSG_CHECKING([which glm to use])
10553 if test "$with_system_glm" = "yes"; then
10554     AC_MSG_RESULT([external])
10555     SYSTEM_GLM=TRUE
10556     AC_LANG_PUSH([C++])
10557     AC_CHECK_HEADER([glm/glm.hpp], [],
10558        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
10559     AC_LANG_POP([C++])
10560 else
10561     AC_MSG_RESULT([internal])
10562     BUILD_TYPE="$BUILD_TYPE GLM"
10563     SYSTEM_GLM=
10564     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
10566 AC_SUBST([GLM_CFLAGS])
10567 AC_SUBST([SYSTEM_GLM])
10569 dnl ===================================================================
10570 dnl Check for system odbc
10571 dnl ===================================================================
10572 AC_MSG_CHECKING([which odbc headers to use])
10573 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
10574     AC_MSG_RESULT([external])
10575     SYSTEM_ODBC_HEADERS=TRUE
10577     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
10578         save_CPPFLAGS=$CPPFLAGS
10579         find_winsdk
10580         PathFormat "$winsdktest"
10581         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"
10582         AC_CHECK_HEADER(sqlext.h, [],
10583             [AC_MSG_ERROR(odbc not found. install odbc)],
10584             [#include <windows.h>])
10585         CPPFLAGS=$save_CPPFLAGS
10586     else
10587         AC_CHECK_HEADER(sqlext.h, [],
10588             [AC_MSG_ERROR(odbc not found. install odbc)],[])
10589     fi
10590 elif test "$enable_database_connectivity" = no; then
10591     AC_MSG_RESULT([none])
10592 else
10593     AC_MSG_RESULT([internal])
10594     SYSTEM_ODBC_HEADERS=
10596 AC_SUBST(SYSTEM_ODBC_HEADERS)
10598 dnl ===================================================================
10599 dnl Check for system NSS
10600 dnl ===================================================================
10601 if test "$enable_fuzzers" != "yes" -a "$enable_nss" = "yes"; then
10602     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
10603     AC_DEFINE(HAVE_FEATURE_NSS)
10604     ENABLE_NSS=TRUE
10605 elif test $_os != iOS ; then
10606     with_tls=openssl
10608 AC_SUBST(ENABLE_NSS)
10610 dnl ===================================================================
10611 dnl Enable LDAP support
10612 dnl ===================================================================
10614 if test "$test_openldap" = yes; then
10615     AC_MSG_CHECKING([whether to enable LDAP support])
10616     if test "$enable_ldap" = yes -a \( "$ENABLE_NSS" = TRUE -o "$with_system_openldap" = yes \); then
10617         AC_MSG_RESULT([yes])
10618         ENABLE_LDAP=TRUE
10619     else
10620         if test "$enable_ldap" != "yes"; then
10621             AC_MSG_RESULT([no])
10622         else
10623             AC_MSG_RESULT([no (needs NSS or system openldap)])
10624         fi
10625     fi
10627 dnl ===================================================================
10628 dnl Check for system openldap
10629 dnl ===================================================================
10631     if test "$ENABLE_LDAP" = TRUE; then
10632         AC_MSG_CHECKING([which openldap library to use])
10633         if test "$with_system_openldap" = yes; then
10634             AC_MSG_RESULT([external])
10635             SYSTEM_OPENLDAP=TRUE
10636             AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
10637             AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10638             AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10639         else
10640             AC_MSG_RESULT([internal])
10641             BUILD_TYPE="$BUILD_TYPE OPENLDAP"
10642         fi
10643     fi
10646 AC_SUBST(ENABLE_LDAP)
10647 AC_SUBST(SYSTEM_OPENLDAP)
10649 dnl ===================================================================
10650 dnl Check for TLS/SSL and cryptographic implementation to use
10651 dnl ===================================================================
10652 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
10653 if test -n "$with_tls"; then
10654     case $with_tls in
10655     openssl)
10656         AC_DEFINE(USE_TLS_OPENSSL)
10657         TLS=OPENSSL
10658         AC_MSG_RESULT([$TLS])
10660         if test "$enable_openssl" != "yes"; then
10661             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
10662         fi
10664         # warn that OpenSSL has been selected but not all TLS code has this option
10665         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS])
10666         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS"
10667         ;;
10668     nss)
10669         AC_DEFINE(USE_TLS_NSS)
10670         TLS=NSS
10671         AC_MSG_RESULT([$TLS])
10672         ;;
10673     no)
10674         AC_MSG_RESULT([none])
10675         AC_MSG_WARN([Skipping TLS/SSL])
10676         ;;
10677     *)
10678         AC_MSG_RESULT([])
10679         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
10680 openssl - OpenSSL
10681 nss - Mozilla's Network Security Services (NSS)
10682     ])
10683         ;;
10684     esac
10685 else
10686     # default to using NSS, it results in smaller oox lib
10687     AC_DEFINE(USE_TLS_NSS)
10688     TLS=NSS
10689     AC_MSG_RESULT([$TLS])
10691 AC_SUBST(TLS)
10693 dnl ===================================================================
10694 dnl Check for system sane
10695 dnl ===================================================================
10696 AC_MSG_CHECKING([which sane header to use])
10697 if test "$with_system_sane" = "yes"; then
10698     AC_MSG_RESULT([external])
10699     AC_CHECK_HEADER(sane/sane.h, [],
10700       [AC_MSG_ERROR(sane not found. install sane)], [])
10701 else
10702     AC_MSG_RESULT([internal])
10703     BUILD_TYPE="$BUILD_TYPE SANE"
10706 dnl ===================================================================
10707 dnl Check for system icu
10708 dnl ===================================================================
10709 ICU_MAJOR=70
10710 ICU_MINOR=1
10711 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
10712 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
10713 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
10714 ICU_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
10715 ICU_LIBS_internal="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
10716 libo_CHECK_SYSTEM_MODULE([icu],[ICU],[icu-i18n >= 4.6])
10717 if test "$SYSTEM_ICU" = TRUE; then
10718     AC_LANG_PUSH([C++])
10719     AC_MSG_CHECKING([for unicode/rbbi.h])
10720     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
10721     AC_LANG_POP([C++])
10723     ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
10724     ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
10725     ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
10727     if test "$ICU_MAJOR" -ge 50; then
10728         AC_MSG_NOTICE([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
10729         ICU_MINOR=
10730     fi
10732     if test "$CROSS_COMPILING" != TRUE; then
10733         # using the system icu tools can lead to version confusion, use the
10734         # ones from the build environment when cross-compiling
10735         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
10736         if test -z "$SYSTEM_GENBRK"; then
10737             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
10738         fi
10739         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
10740         if test -z "$SYSTEM_GENCCODE"; then
10741             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
10742         fi
10743         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
10744         if test -z "$SYSTEM_GENCMN"; then
10745             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
10746         fi
10747         if test "$ICU_MAJOR" -lt 49; then
10748             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
10749             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
10750             ICU_RECLASSIFIED_HEBREW_LETTER=
10751         fi
10752     fi
10754 if test "$ICU_MAJOR" -ge "59"; then
10755     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
10756     # with -std=c++11 but not all external libraries can be built with that,
10757     # for those use a bit-compatible typedef uint16_t UChar; see
10758     # icu/source/common/unicode/umachine.h
10759     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
10760 else
10761     ICU_UCHAR_TYPE=""
10763 AC_SUBST(SYSTEM_GENBRK)
10764 AC_SUBST(SYSTEM_GENCCODE)
10765 AC_SUBST(SYSTEM_GENCMN)
10766 AC_SUBST(ICU_MAJOR)
10767 AC_SUBST(ICU_MINOR)
10768 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
10769 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
10770 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
10771 AC_SUBST(ICU_UCHAR_TYPE)
10773 dnl ==================================================================
10774 dnl Breakpad
10775 dnl ==================================================================
10776 DEFAULT_CRASHDUMP_VALUE="true"
10777 AC_MSG_CHECKING([whether to enable breakpad])
10778 if test "$enable_breakpad" != yes; then
10779     AC_MSG_RESULT([no])
10780 else
10781     AC_MSG_RESULT([yes])
10782     ENABLE_BREAKPAD="TRUE"
10783     AC_DEFINE(ENABLE_BREAKPAD)
10784     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
10785     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
10787     AC_MSG_CHECKING([for disable crash dump])
10788     if test "$enable_crashdump" = no; then
10789         DEFAULT_CRASHDUMP_VALUE="false"
10790         AC_MSG_RESULT([yes])
10791     else
10792        AC_MSG_RESULT([no])
10793     fi
10795     AC_MSG_CHECKING([for crashreport config])
10796     if test "$with_symbol_config" = "no"; then
10797         BREAKPAD_SYMBOL_CONFIG="invalid"
10798         AC_MSG_RESULT([no])
10799     else
10800         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
10801         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
10802         AC_MSG_RESULT([yes])
10803     fi
10804     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
10806 AC_SUBST(ENABLE_BREAKPAD)
10807 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
10809 dnl ===================================================================
10810 dnl Orcus
10811 dnl ===================================================================
10812 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.17 >= 0.17.2])
10813 if test "$with_system_orcus" != "yes"; then
10814     if test "$SYSTEM_BOOST" = "TRUE"; then
10815         dnl Link with Boost.System
10816         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
10817         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
10818         dnl in documentation has no effect.
10819         AX_BOOST_SYSTEM
10820     fi
10822 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
10823 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
10824 AC_SUBST([BOOST_SYSTEM_LIB])
10825 AC_SUBST(SYSTEM_LIBORCUS)
10827 dnl ===================================================================
10828 dnl HarfBuzz
10829 dnl ===================================================================
10831 GRAPHITE_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"
10832 GRAPHITE_LIBS_internal="-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"
10833 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3])
10835 HARFBUZZ_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/harfbuzz/src"
10836 HARFBUZZ_LIBS_internal="-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"
10837 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42])
10839 if test "$COM" = "MSC"; then # override the above
10840     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
10841     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
10844 if test "$with_system_harfbuzz" = "yes"; then
10845     if test "$with_system_graphite" = "no"; then
10846         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
10847     fi
10848     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
10849     save_LIBS="$LIBS"
10850     save_CFLAGS="$CFLAGS"
10851     LIBS="$LIBS $HARFBUZZ_LIBS"
10852     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
10853     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
10854     LIBS="$save_LIBS"
10855     CFLAGS="$save_CFLAGS"
10856 else
10857     if test "$with_system_graphite" = "yes"; then
10858         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
10859     fi
10862 if test "$USING_X11" = TRUE; then
10863     AC_PATH_X
10864     AC_PATH_XTRA
10865     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
10867     if test -z "$x_includes"; then
10868         x_includes="default_x_includes"
10869     fi
10870     if test -z "$x_libraries"; then
10871         x_libraries="default_x_libraries"
10872     fi
10873     CFLAGS="$CFLAGS $X_CFLAGS"
10874     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
10875     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
10876 else
10877     x_includes="no_x_includes"
10878     x_libraries="no_x_libraries"
10881 if test "$USING_X11" = TRUE; then
10882     dnl ===================================================================
10883     dnl Check for extension headers
10884     dnl ===================================================================
10885     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
10886      [#include <X11/extensions/shape.h>])
10888     # vcl needs ICE and SM
10889     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
10890     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
10891         [AC_MSG_ERROR(ICE library not found)])
10892     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
10893     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
10894         [AC_MSG_ERROR(SM library not found)])
10897 if test "$USING_X11" = TRUE -a "$ENABLE_JAVA" != ""; then
10898     # bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c needs Xt
10899     AC_CHECK_HEADERS(X11/Intrinsic.h,[],[AC_MSG_ERROR([libXt headers not found])])
10902 dnl ===================================================================
10903 dnl Check for system Xrender
10904 dnl ===================================================================
10905 AC_MSG_CHECKING([whether to use Xrender])
10906 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
10907     AC_MSG_RESULT([yes])
10908     PKG_CHECK_MODULES(XRENDER, xrender)
10909     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10910     FilterLibs "${XRENDER_LIBS}"
10911     XRENDER_LIBS="${filteredlibs}"
10912     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
10913       [AC_MSG_ERROR(libXrender not found or functional)], [])
10914     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
10915       [AC_MSG_ERROR(Xrender not found. install X)], [])
10916 else
10917     AC_MSG_RESULT([no])
10919 AC_SUBST(XRENDER_CFLAGS)
10920 AC_SUBST(XRENDER_LIBS)
10922 dnl ===================================================================
10923 dnl Check for XRandr
10924 dnl ===================================================================
10925 AC_MSG_CHECKING([whether to enable RandR support])
10926 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
10927     AC_MSG_RESULT([yes])
10928     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
10929     if test "$ENABLE_RANDR" != "TRUE"; then
10930         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
10931                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
10932         XRANDR_CFLAGS=" "
10933         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
10934           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
10935         XRANDR_LIBS="-lXrandr "
10936         ENABLE_RANDR="TRUE"
10937     fi
10938     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10939     FilterLibs "${XRANDR_LIBS}"
10940     XRANDR_LIBS="${filteredlibs}"
10941 else
10942     ENABLE_RANDR=""
10943     AC_MSG_RESULT([no])
10945 AC_SUBST(XRANDR_CFLAGS)
10946 AC_SUBST(XRANDR_LIBS)
10947 AC_SUBST(ENABLE_RANDR)
10949 if test -z "$with_webdav"; then
10950     with_webdav=$test_webdav
10953 AC_MSG_CHECKING([for WebDAV support])
10954 case "$with_webdav" in
10956     AC_MSG_RESULT([no])
10957     WITH_WEBDAV=""
10958     ;;
10960     AC_MSG_RESULT([yes])
10961     # curl is already mandatory (almost) and checked elsewhere
10962     if test "$enable_curl" = "no"; then
10963         AC_MSG_ERROR(["--with-webdav conflicts with --disable-curl"])
10964     fi
10965     WITH_WEBDAV=TRUE
10966     ;;
10967 esac
10968 AC_SUBST(WITH_WEBDAV)
10970 dnl ===================================================================
10971 dnl Check for disabling cve_tests
10972 dnl ===================================================================
10973 AC_MSG_CHECKING([whether to execute CVE tests])
10974 # If not explicitly enabled or disabled, default
10975 if test -z "$enable_cve_tests"; then
10976     case "$OS" in
10977     WNT)
10978         # Default cves off for Windows with its wild and wonderful
10979         # variety of AV software kicking in and panicking
10980         enable_cve_tests=no
10981         ;;
10982     *)
10983         # otherwise yes
10984         enable_cve_tests=yes
10985         ;;
10986     esac
10988 if test "$enable_cve_tests" = "no"; then
10989     AC_MSG_RESULT([no])
10990     DISABLE_CVE_TESTS=TRUE
10991     AC_SUBST(DISABLE_CVE_TESTS)
10992 else
10993     AC_MSG_RESULT([yes])
10996 dnl ===================================================================
10997 dnl Check for enabling chart XShape tests
10998 dnl ===================================================================
10999 AC_MSG_CHECKING([whether to execute chart XShape tests])
11000 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
11001     AC_MSG_RESULT([yes])
11002     ENABLE_CHART_TESTS=TRUE
11003     AC_SUBST(ENABLE_CHART_TESTS)
11004 else
11005     AC_MSG_RESULT([no])
11008 dnl ===================================================================
11009 dnl Check for system openssl
11010 dnl ===================================================================
11011 ENABLE_OPENSSL=
11012 AC_MSG_CHECKING([whether to disable OpenSSL usage])
11013 if test "$enable_openssl" = "yes"; then
11014     AC_MSG_RESULT([no])
11015     ENABLE_OPENSSL=TRUE
11016     if test "$_os" = Darwin ; then
11017         # OpenSSL is deprecated when building for 10.7 or later.
11018         #
11019         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
11020         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
11022         with_system_openssl=no
11023         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
11024     elif test "$_os" = "FreeBSD" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
11025             && test "$with_system_openssl" != "no"; then
11026         with_system_openssl=yes
11027         SYSTEM_OPENSSL=TRUE
11028         OPENSSL_CFLAGS=
11029         OPENSSL_LIBS="-lssl -lcrypto"
11030     else
11031         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
11032     fi
11033     if test "$with_system_openssl" = "yes"; then
11034         AC_MSG_CHECKING([whether openssl supports SHA512])
11035         AC_LANG_PUSH([C])
11036         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
11037             SHA512_CTX context;
11038 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
11039         AC_LANG_POP(C)
11040     fi
11041 else
11042     AC_MSG_RESULT([yes])
11044     # warn that although OpenSSL is disabled, system libraries may depend on it
11045     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
11046     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
11049 AC_SUBST([ENABLE_OPENSSL])
11051 if test "$enable_cipher_openssl_backend" = yes && test "$ENABLE_OPENSSL" != TRUE; then
11052     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
11053         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
11054         enable_cipher_openssl_backend=no
11055     else
11056         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
11057     fi
11059 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
11060 ENABLE_CIPHER_OPENSSL_BACKEND=
11061 if test "$enable_cipher_openssl_backend" = yes; then
11062     AC_MSG_RESULT([yes])
11063     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
11064 else
11065     AC_MSG_RESULT([no])
11067 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
11069 dnl ===================================================================
11070 dnl Select the crypto backends used by LO
11071 dnl ===================================================================
11073 if test "$build_crypto" = yes; then
11074     if test "$OS" = WNT; then
11075         BUILD_TYPE="$BUILD_TYPE CRYPTO_MSCAPI"
11076         AC_DEFINE([USE_CRYPTO_MSCAPI])
11077     elif test "$ENABLE_NSS" = TRUE; then
11078         BUILD_TYPE="$BUILD_TYPE CRYPTO_NSS"
11079         AC_DEFINE([USE_CRYPTO_NSS])
11080     fi
11083 dnl ===================================================================
11084 dnl Check for system redland
11085 dnl ===================================================================
11086 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
11087 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
11088 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
11089 if test "$with_system_redland" = "yes"; then
11090     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
11091             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
11092 else
11093     RAPTOR_MAJOR="0"
11094     RASQAL_MAJOR="3"
11095     REDLAND_MAJOR="0"
11097 AC_SUBST(RAPTOR_MAJOR)
11098 AC_SUBST(RASQAL_MAJOR)
11099 AC_SUBST(REDLAND_MAJOR)
11101 dnl ===================================================================
11102 dnl Check for system hunspell
11103 dnl ===================================================================
11104 AC_MSG_CHECKING([which libhunspell to use])
11105 if test "$with_system_hunspell" = "yes"; then
11106     AC_MSG_RESULT([external])
11107     SYSTEM_HUNSPELL=TRUE
11108     AC_LANG_PUSH([C++])
11109     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
11110     if test "$HUNSPELL_PC" != "TRUE"; then
11111         AC_CHECK_HEADER(hunspell.hxx, [],
11112             [
11113             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
11114             [AC_MSG_ERROR(hunspell headers not found.)], [])
11115             ], [])
11116         AC_CHECK_LIB([hunspell], [main], [:],
11117            [ AC_MSG_ERROR(hunspell library not found.) ], [])
11118         HUNSPELL_LIBS=-lhunspell
11119     fi
11120     AC_LANG_POP([C++])
11121     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11122     FilterLibs "${HUNSPELL_LIBS}"
11123     HUNSPELL_LIBS="${filteredlibs}"
11124 else
11125     AC_MSG_RESULT([internal])
11126     SYSTEM_HUNSPELL=
11127     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
11128     if test "$COM" = "MSC"; then
11129         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
11130     else
11131         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
11132     fi
11133     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
11135 AC_SUBST(SYSTEM_HUNSPELL)
11136 AC_SUBST(HUNSPELL_CFLAGS)
11137 AC_SUBST(HUNSPELL_LIBS)
11139 dnl ===================================================================
11140 dnl Check for system zxing
11141 dnl ===================================================================
11142 AC_MSG_CHECKING([whether to use zxing])
11143 if test "$enable_zxing" = "no"; then
11144     AC_MSG_RESULT([no])
11145     ENABLE_ZXING=
11146     SYSTEM_ZXING=
11147 else
11148     AC_MSG_RESULT([yes])
11149     ENABLE_ZXING=TRUE
11150     AC_MSG_CHECKING([which libzxing to use])
11151     if test "$with_system_zxing" = "yes"; then
11152         AC_MSG_RESULT([external])
11153         SYSTEM_ZXING=TRUE
11154         AC_LANG_PUSH([C++])
11155         AC_CHECK_HEADER(ZXing/MultiFormatWriter.h, [],
11156             [AC_MSG_ERROR(zxing headers not found.)], [#include <stdexcept>])
11157         ZXING_CFLAGS=-I/usr/include/ZXing
11158         AC_CHECK_LIB([ZXing], [main], [ZXING_LIBS=-lZXing],
11159             [ AC_CHECK_LIB([ZXingCore], [main], [ZXING_LIBS=-lZXingCore],
11160             [ AC_MSG_ERROR(zxing C++ library not found.) ])], [])
11161         AC_LANG_POP([C++])
11162         ZXING_CFLAGS=$(printf '%s' "$ZXING_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11163         FilterLibs "${ZXING_LIBS}"
11164         ZXING_LIBS="${filteredlibs}"
11165     else
11166         AC_MSG_RESULT([internal])
11167         SYSTEM_ZXING=
11168         BUILD_TYPE="$BUILD_TYPE ZXING"
11169     fi
11170     if test "$ENABLE_ZXING" = TRUE; then
11171         AC_DEFINE(ENABLE_ZXING)
11172     fi
11174 AC_SUBST(SYSTEM_ZXING)
11175 AC_SUBST(ENABLE_ZXING)
11176 AC_SUBST(ZXING_CFLAGS)
11177 AC_SUBST(ZXING_LIBS)
11179 dnl ===================================================================
11180 dnl Check for system box2d
11181 dnl ===================================================================
11182 AC_MSG_CHECKING([which box2d to use])
11183 if test "$with_system_box2d" = "yes"; then
11184     AC_MSG_RESULT([external])
11185     SYSTEM_BOX2D=TRUE
11186     AC_LANG_PUSH([C++])
11187     AC_CHECK_HEADER(box2d/box2d.h, [BOX2D_H_FOUND='TRUE'],
11188         [BOX2D_H_FOUND='FALSE'])
11189     if test "$BOX2D_H_FOUND" = "TRUE"; then # 2.4.0+
11190         _BOX2D_LIB=box2d
11191         AC_DEFINE(BOX2D_HEADER,<box2d/box2d.h>)
11192     else
11193         # fail this. there's no other alternative to check when we are here.
11194         AC_CHECK_HEADER([Box2D/Box2D.h], [],
11195             [AC_MSG_ERROR(box2d headers not found.)])
11196         _BOX2D_LIB=Box2D
11197         AC_DEFINE(BOX2D_HEADER,<Box2D/Box2D.h>)
11198     fi
11199     AC_CHECK_LIB([$_BOX2D_LIB], [main], [:],
11200         [ AC_MSG_ERROR(box2d library not found.) ], [])
11201     BOX2D_LIBS=-l$_BOX2D_LIB
11202     AC_LANG_POP([C++])
11203     BOX2D_CFLAGS=$(printf '%s' "$BOX2D_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11204     FilterLibs "${BOX2D_LIBS}"
11205     BOX2D_LIBS="${filteredlibs}"
11206 else
11207     AC_MSG_RESULT([internal])
11208     SYSTEM_BOX2D=
11209     BUILD_TYPE="$BUILD_TYPE BOX2D"
11211 AC_SUBST(SYSTEM_BOX2D)
11212 AC_SUBST(BOX2D_CFLAGS)
11213 AC_SUBST(BOX2D_LIBS)
11215 dnl ===================================================================
11216 dnl Checking for altlinuxhyph
11217 dnl ===================================================================
11218 AC_MSG_CHECKING([which altlinuxhyph to use])
11219 if test "$with_system_altlinuxhyph" = "yes"; then
11220     AC_MSG_RESULT([external])
11221     SYSTEM_HYPH=TRUE
11222     AC_CHECK_HEADER(hyphen.h, [],
11223        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
11224     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
11225        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
11226        [#include <hyphen.h>])
11227     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
11228         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11229     if test -z "$HYPHEN_LIB"; then
11230         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
11231            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11232     fi
11233     if test -z "$HYPHEN_LIB"; then
11234         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
11235            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11236     fi
11237 else
11238     AC_MSG_RESULT([internal])
11239     SYSTEM_HYPH=
11240     BUILD_TYPE="$BUILD_TYPE HYPHEN"
11241     if test "$COM" = "MSC"; then
11242         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
11243     else
11244         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
11245     fi
11247 AC_SUBST(SYSTEM_HYPH)
11248 AC_SUBST(HYPHEN_LIB)
11250 dnl ===================================================================
11251 dnl Checking for mythes
11252 dnl ===================================================================
11253 AC_MSG_CHECKING([which mythes to use])
11254 if test "$with_system_mythes" = "yes"; then
11255     AC_MSG_RESULT([external])
11256     SYSTEM_MYTHES=TRUE
11257     AC_LANG_PUSH([C++])
11258     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
11259     if test "$MYTHES_PKGCONFIG" = "no"; then
11260         AC_CHECK_HEADER(mythes.hxx, [],
11261             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
11262         AC_CHECK_LIB([mythes-1.2], [main], [:],
11263             [ MYTHES_FOUND=no], [])
11264     if test "$MYTHES_FOUND" = "no"; then
11265         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
11266                 [ MYTHES_FOUND=no], [])
11267     fi
11268     if test "$MYTHES_FOUND" = "no"; then
11269         AC_MSG_ERROR([mythes library not found!.])
11270     fi
11271     fi
11272     AC_LANG_POP([C++])
11273     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11274     FilterLibs "${MYTHES_LIBS}"
11275     MYTHES_LIBS="${filteredlibs}"
11276 else
11277     AC_MSG_RESULT([internal])
11278     SYSTEM_MYTHES=
11279     BUILD_TYPE="$BUILD_TYPE MYTHES"
11280     if test "$COM" = "MSC"; then
11281         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
11282     else
11283         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
11284     fi
11286 AC_SUBST(SYSTEM_MYTHES)
11287 AC_SUBST(MYTHES_CFLAGS)
11288 AC_SUBST(MYTHES_LIBS)
11290 dnl ===================================================================
11291 dnl How should we build the linear programming solver ?
11292 dnl ===================================================================
11294 ENABLE_COINMP=
11295 AC_MSG_CHECKING([whether to build with CoinMP])
11296 if test "$enable_coinmp" != "no"; then
11297     ENABLE_COINMP=TRUE
11298     AC_MSG_RESULT([yes])
11299     if test "$with_system_coinmp" = "yes"; then
11300         SYSTEM_COINMP=TRUE
11301         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
11302         FilterLibs "${COINMP_LIBS}"
11303         COINMP_LIBS="${filteredlibs}"
11304     else
11305         BUILD_TYPE="$BUILD_TYPE COINMP"
11306     fi
11307 else
11308     AC_MSG_RESULT([no])
11310 AC_SUBST(ENABLE_COINMP)
11311 AC_SUBST(SYSTEM_COINMP)
11312 AC_SUBST(COINMP_CFLAGS)
11313 AC_SUBST(COINMP_LIBS)
11315 ENABLE_LPSOLVE=
11316 AC_MSG_CHECKING([whether to build with lpsolve])
11317 if test "$enable_lpsolve" != "no"; then
11318     ENABLE_LPSOLVE=TRUE
11319     AC_MSG_RESULT([yes])
11320 else
11321     AC_MSG_RESULT([no])
11323 AC_SUBST(ENABLE_LPSOLVE)
11325 if test "$ENABLE_LPSOLVE" = TRUE; then
11326     AC_MSG_CHECKING([which lpsolve to use])
11327     if test "$with_system_lpsolve" = "yes"; then
11328         AC_MSG_RESULT([external])
11329         SYSTEM_LPSOLVE=TRUE
11330         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
11331            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
11332         save_LIBS=$LIBS
11333         # some systems need this. Like Ubuntu...
11334         AC_CHECK_LIB(m, floor)
11335         AC_CHECK_LIB(dl, dlopen)
11336         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
11337             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
11338         LIBS=$save_LIBS
11339     else
11340         AC_MSG_RESULT([internal])
11341         SYSTEM_LPSOLVE=
11342         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
11343     fi
11345 AC_SUBST(SYSTEM_LPSOLVE)
11347 dnl ===================================================================
11348 dnl Checking for libexttextcat
11349 dnl ===================================================================
11350 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
11351 if test "$with_system_libexttextcat" = "yes"; then
11352     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
11354 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
11356 dnl ===================================================================
11357 dnl Checking for libnumbertext
11358 dnl ===================================================================
11359 libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.6])
11360 if test "$with_system_libnumbertext" = "yes"; then
11361     SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
11362     SYSTEM_LIBNUMBERTEXT=YES
11363 else
11364     SYSTEM_LIBNUMBERTEXT=
11365     AC_LANG_PUSH([C++])
11366     save_CPPFLAGS=$CPPFLAGS
11367     CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
11368     AC_CHECK_HEADERS([codecvt regex])
11369     AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
11370             [ LIBNUMBERTEXT_CFLAGS=''
11371               AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
11372                            Enable libnumbertext fallback (missing number to number name conversion).])
11373             ])
11374     CPPFLAGS=$save_CPPFLAGS
11375     AC_LANG_POP([C++])
11377 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
11378 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
11379 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
11381 dnl ***************************************
11382 dnl testing libc version for Linux...
11383 dnl ***************************************
11384 if test "$_os" = "Linux"; then
11385     AC_MSG_CHECKING([whether the libc is recent enough])
11386     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
11387     #include <features.h>
11388     #if defined(__GNU_LIBRARY__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1))
11389     #error glibc >= 2.1 is required
11390     #endif
11391     ]])],, [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no, upgrade libc])])
11394 dnl =========================================
11395 dnl Check for uuidgen
11396 dnl =========================================
11397 if test "$_os" = "WINNT"; then
11398     # we must use the uuidgen from the Windows SDK, which will be in the LO_PATH, but isn't in
11399     # the PATH for AC_PATH_PROG. It is already tested above in the WINDOWS_SDK_HOME check.
11400     UUIDGEN=uuidgen.exe
11401     AC_SUBST(UUIDGEN)
11402 else
11403     AC_PATH_PROG([UUIDGEN], [uuidgen])
11404     if test -z "$UUIDGEN"; then
11405         AC_MSG_WARN([uuid is needed for building installation sets])
11406     fi
11409 dnl ***************************************
11410 dnl Checking for bison and flex
11411 dnl ***************************************
11412 AC_PATH_PROG(BISON, bison)
11413 if test -z "$BISON"; then
11414     AC_MSG_ERROR([no bison found in \$PATH, install it])
11415 else
11416     AC_MSG_CHECKING([the bison version])
11417     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
11418     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
11419     dnl Accept newer than 2.0; for --enable-compiler-plugins at least 2.3 is known to be bad and
11420     dnl cause
11421     dnl
11422     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]
11423     dnl   typedef union YYSTYPE
11424     dnl           ~~~~~~^~~~~~~
11425     dnl
11426     dnl while at least 3.4.1 is know to be good:
11427     if test "$COMPILER_PLUGINS" = TRUE; then
11428         if test "$_bison_longver" -lt 2004; then
11429             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.4+ for --enable-compiler-plugins)])
11430         fi
11431     else
11432         if test "$_bison_longver" -lt 2000; then
11433             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
11434         fi
11435     fi
11437 AC_SUBST([BISON])
11439 AC_PATH_PROG(FLEX, flex)
11440 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11441     FLEX=`cygpath -m $FLEX`
11443 if test -z "$FLEX"; then
11444     AC_MSG_ERROR([no flex found in \$PATH, install it])
11445 else
11446     AC_MSG_CHECKING([the flex version])
11447     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
11448     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
11449         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
11450     fi
11452 AC_SUBST([FLEX])
11454 AC_PATH_PROG(DIFF, diff)
11455 if test -z "$DIFF"; then
11456     AC_MSG_ERROR(["diff" not found in \$PATH, install it])
11458 AC_SUBST([DIFF])
11460 AC_PATH_PROG(UNIQ, uniq)
11461 if test -z "$UNIQ"; then
11462     AC_MSG_ERROR(["uniq" not found in \$PATH, install it])
11464 AC_SUBST([UNIQ])
11466 dnl ***************************************
11467 dnl Checking for patch
11468 dnl ***************************************
11469 AC_PATH_PROG(PATCH, patch)
11470 if test -z "$PATCH"; then
11471     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
11474 dnl On Solaris or macOS, check if --with-gnu-patch was used
11475 if test "$_os" = "SunOS" -o "$_os" = "Darwin"; then
11476     if test -z "$with_gnu_patch"; then
11477         GNUPATCH=$PATCH
11478     else
11479         if test -x "$with_gnu_patch"; then
11480             GNUPATCH=$with_gnu_patch
11481         else
11482             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
11483         fi
11484     fi
11486     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
11487     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
11488         AC_MSG_RESULT([yes])
11489     else
11490         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
11491     fi
11492 else
11493     GNUPATCH=$PATCH
11496 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11497     GNUPATCH=`cygpath -m $GNUPATCH`
11500 dnl We also need to check for --with-gnu-cp
11502 if test -z "$with_gnu_cp"; then
11503     # check the place where the good stuff is hidden on Solaris...
11504     if test -x /usr/gnu/bin/cp; then
11505         GNUCP=/usr/gnu/bin/cp
11506     else
11507         AC_PATH_PROGS(GNUCP, gnucp cp)
11508     fi
11509     if test -z $GNUCP; then
11510         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
11511     fi
11512 else
11513     if test -x "$with_gnu_cp"; then
11514         GNUCP=$with_gnu_cp
11515     else
11516         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
11517     fi
11520 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11521     GNUCP=`cygpath -m $GNUCP`
11524 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
11525 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
11526     AC_MSG_RESULT([yes])
11527 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
11528     AC_MSG_RESULT([yes])
11529 else
11530     case "$build_os" in
11531     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
11532         x_GNUCP=[\#]
11533         GNUCP=''
11534         AC_MSG_RESULT([no gnucp found - using the system's cp command])
11535         ;;
11536     *)
11537         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
11538         ;;
11539     esac
11542 AC_SUBST(GNUPATCH)
11543 AC_SUBST(GNUCP)
11544 AC_SUBST(x_GNUCP)
11546 dnl ***************************************
11547 dnl testing assembler path
11548 dnl ***************************************
11549 ML_EXE=""
11550 if test "$_os" = "WINNT"; then
11551     case "$WIN_HOST_ARCH" in
11552     x86) assembler=ml.exe ;;
11553     x64) assembler=ml64.exe ;;
11554     arm64) assembler=armasm64.exe ;;
11555     esac
11557     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
11558     if test -f "$MSVC_HOST_PATH/$assembler"; then
11559         ML_EXE=`win_short_path_for_make "$MSVC_HOST_PATH/$assembler"`
11560         AC_MSG_RESULT([$ML_EXE])
11561     else
11562         AC_MSG_ERROR([not found in $MSVC_HOST_PATH])
11563     fi
11566 AC_SUBST(ML_EXE)
11568 dnl ===================================================================
11569 dnl We need zip and unzip
11570 dnl ===================================================================
11571 AC_PATH_PROG(ZIP, zip)
11572 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
11573 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
11574     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],,)
11577 AC_PATH_PROG(UNZIP, unzip)
11578 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
11580 dnl ===================================================================
11581 dnl Zip must be a specific type for different build types.
11582 dnl ===================================================================
11583 if test $build_os = cygwin; then
11584     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
11585         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
11586     fi
11589 dnl ===================================================================
11590 dnl We need touch with -h option support.
11591 dnl ===================================================================
11592 AC_PATH_PROG(TOUCH, touch)
11593 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
11594 touch "$WARNINGS_FILE"
11595 if ! "$TOUCH" -h "$WARNINGS_FILE" 2>/dev/null > /dev/null; then
11596     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],,)
11599 dnl ===================================================================
11600 dnl Check for system epoxy
11601 dnl ===================================================================
11602 EPOXY_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/epoxy/include"
11603 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2])
11605 dnl ===================================================================
11606 dnl Set vcl option: coordinate device in double or sal_Int32
11607 dnl ===================================================================
11609 dnl disabled for now, we don't want subtle differences between OSs
11610 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
11611 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
11612 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
11613 dnl     AC_MSG_RESULT([double])
11614 dnl else
11615 dnl     AC_MSG_RESULT([sal_Int32])
11616 dnl fi
11618 dnl ===================================================================
11619 dnl Show which vclplugs will be built.
11620 dnl ===================================================================
11621 R=""
11623 libo_ENABLE_VCLPLUG([gen])
11624 libo_ENABLE_VCLPLUG([gtk3])
11625 libo_ENABLE_VCLPLUG([gtk3_kde5])
11626 libo_ENABLE_VCLPLUG([gtk4])
11627 libo_ENABLE_VCLPLUG([kf5])
11628 libo_ENABLE_VCLPLUG([qt5])
11629 libo_ENABLE_VCLPLUG([qt6])
11631 if test "$_os" = "WINNT"; then
11632     R="$R win"
11633 elif test "$_os" = "Darwin"; then
11634     R="$R osx"
11635 elif test "$_os" = "iOS"; then
11636     R="ios"
11637 elif test "$_os" = Android; then
11638     R="android"
11641 build_vcl_plugins="$R"
11642 if test -z "$build_vcl_plugins"; then
11643     build_vcl_plugins=" none"
11645 AC_MSG_NOTICE([VCLplugs to be built:${build_vcl_plugins}])
11646 VCL_PLUGIN_INFO=$R
11647 AC_SUBST([VCL_PLUGIN_INFO])
11649 if test "$DISABLE_DYNLOADING" = TRUE -a -z "$DISABLE_GUI" -a \( -z "$R" -o $(echo "$R" | wc -w) -ne 1 \); then
11650     AC_MSG_ERROR([Can't build --disable-dynamic-loading without --disable-gui and a single VCL plugin"])
11653 dnl ===================================================================
11654 dnl Check for GTK libraries
11655 dnl ===================================================================
11657 GTK3_CFLAGS=""
11658 GTK3_LIBS=""
11659 if test "$test_gtk3" = yes -a "x$enable_gtk3" = "xyes" -o "x$enable_gtk3_kde5" = "xyes"; then
11660     if test "$with_system_cairo" = no; then
11661         add_warning 'Non-system cairo combined with gtk3 is assumed to cause trouble; proceed at your own risk.'
11662     fi
11663     : ${with_system_cairo:=yes}
11664     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)
11665     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11666     GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
11667     FilterLibs "${GTK3_LIBS}"
11668     GTK3_LIBS="${filteredlibs}"
11670     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
11671     if test "$with_system_epoxy" != "yes"; then
11672         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
11673         AC_CHECK_HEADER(EGL/eglplatform.h, [],
11674                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
11675     fi
11677 AC_SUBST(GTK3_LIBS)
11678 AC_SUBST(GTK3_CFLAGS)
11680 GTK4_CFLAGS=""
11681 GTK4_LIBS=""
11682 if test "$test_gtk4" = yes -a "x$enable_gtk4" = "xyes"; then
11683     if test "$with_system_cairo" = no; then
11684         add_warning 'Non-system cairo combined with gtk4 is assumed to cause trouble; proceed at your own risk.'
11685     fi
11686     : ${with_system_cairo:=yes}
11687     PKG_CHECK_MODULES(GTK4, gtk4 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo atk)
11688     GTK4_CFLAGS=$(printf '%s' "$GTK4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11689     GTK4_CFLAGS="$GTK4_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
11690     FilterLibs "${GTK4_LIBS}"
11691     GTK4_LIBS="${filteredlibs}"
11693     dnl We require egl only for the gtk4 plugin. Otherwise we use glx.
11694     if test "$with_system_epoxy" != "yes"; then
11695         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
11696         AC_CHECK_HEADER(EGL/eglplatform.h, [],
11697                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
11698     fi
11700 AC_SUBST(GTK4_LIBS)
11701 AC_SUBST(GTK4_CFLAGS)
11703 if test "$enable_introspection" = yes; then
11704     if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
11705         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
11706     else
11707         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
11708     fi
11711 dnl ===================================================================
11712 dnl check for dbus support
11713 dnl ===================================================================
11714 ENABLE_DBUS=""
11715 DBUS_CFLAGS=""
11716 DBUS_LIBS=""
11717 DBUS_GLIB_CFLAGS=""
11718 DBUS_GLIB_LIBS=""
11719 DBUS_HAVE_GLIB=""
11721 if test "$enable_dbus" = "no"; then
11722     test_dbus=no
11725 AC_MSG_CHECKING([whether to enable DBUS support])
11726 if test "$test_dbus" = "yes"; then
11727     ENABLE_DBUS="TRUE"
11728     AC_MSG_RESULT([yes])
11729     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
11730     AC_DEFINE(ENABLE_DBUS)
11731     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11732     FilterLibs "${DBUS_LIBS}"
11733     DBUS_LIBS="${filteredlibs}"
11735     # Glib is needed for BluetoothServer
11736     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
11737     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
11738         [
11739             DBUS_HAVE_GLIB="TRUE"
11740             AC_DEFINE(DBUS_HAVE_GLIB,1)
11741         ],
11742         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
11743     )
11744 else
11745     AC_MSG_RESULT([no])
11748 AC_SUBST(ENABLE_DBUS)
11749 AC_SUBST(DBUS_CFLAGS)
11750 AC_SUBST(DBUS_LIBS)
11751 AC_SUBST(DBUS_GLIB_CFLAGS)
11752 AC_SUBST(DBUS_GLIB_LIBS)
11753 AC_SUBST(DBUS_HAVE_GLIB)
11755 AC_MSG_CHECKING([whether to enable Impress remote control])
11756 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
11757     AC_MSG_RESULT([yes])
11758     ENABLE_SDREMOTE=TRUE
11759     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
11761     if test $OS = MACOSX && test "$MACOSX_SDK_VERSION" -ge 101500; then
11762         # The Bluetooth code doesn't compile with macOS SDK 10.15
11763         if test "$enable_sdremote_bluetooth" = yes; then
11764             AC_MSG_ERROR([macOS SDK $macosx_sdk does not currently support --enable-sdremote-bluetooth])
11765         fi
11766         enable_sdremote_bluetooth=no
11767     fi
11768     # If not explicitly enabled or disabled, default
11769     if test -z "$enable_sdremote_bluetooth"; then
11770         case "$OS" in
11771         LINUX|MACOSX|WNT)
11772             # Default to yes for these
11773             enable_sdremote_bluetooth=yes
11774             ;;
11775         *)
11776             # otherwise no
11777             enable_sdremote_bluetooth=no
11778             ;;
11779         esac
11780     fi
11781     # $enable_sdremote_bluetooth is guaranteed non-empty now
11783     if test "$enable_sdremote_bluetooth" != "no"; then
11784         if test "$OS" = "LINUX"; then
11785             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
11786                 AC_MSG_RESULT([yes])
11787                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
11788                 dnl ===================================================================
11789                 dnl Check for system bluez
11790                 dnl ===================================================================
11791                 AC_MSG_CHECKING([which Bluetooth header to use])
11792                 if test "$with_system_bluez" = "yes"; then
11793                     AC_MSG_RESULT([external])
11794                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
11795                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
11796                     SYSTEM_BLUEZ=TRUE
11797                 else
11798                     AC_MSG_RESULT([internal])
11799                     SYSTEM_BLUEZ=
11800                 fi
11801             else
11802                 AC_MSG_RESULT([no, dbus disabled])
11803                 ENABLE_SDREMOTE_BLUETOOTH=
11804                 SYSTEM_BLUEZ=
11805             fi
11806         else
11807             AC_MSG_RESULT([yes])
11808             ENABLE_SDREMOTE_BLUETOOTH=TRUE
11809             SYSTEM_BLUEZ=
11810         fi
11811     else
11812         AC_MSG_RESULT([no])
11813         ENABLE_SDREMOTE_BLUETOOTH=
11814         SYSTEM_BLUEZ=
11815     fi
11816 else
11817     ENABLE_SDREMOTE=
11818     SYSTEM_BLUEZ=
11819     AC_MSG_RESULT([no])
11821 AC_SUBST(ENABLE_SDREMOTE)
11822 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
11823 AC_SUBST(SYSTEM_BLUEZ)
11825 dnl ===================================================================
11826 dnl Check whether to enable GIO support
11827 dnl ===================================================================
11828 if test "$ENABLE_GTK4" = "TRUE" -o "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
11829     AC_MSG_CHECKING([whether to enable GIO support])
11830     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
11831         dnl Need at least 2.26 for the dbus support.
11832         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
11833                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
11834         if test "$ENABLE_GIO" = "TRUE"; then
11835             AC_DEFINE(ENABLE_GIO)
11836             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11837             FilterLibs "${GIO_LIBS}"
11838             GIO_LIBS="${filteredlibs}"
11839         fi
11840     else
11841         AC_MSG_RESULT([no])
11842     fi
11844 AC_SUBST(ENABLE_GIO)
11845 AC_SUBST(GIO_CFLAGS)
11846 AC_SUBST(GIO_LIBS)
11849 dnl ===================================================================
11851 SPLIT_APP_MODULES=""
11852 if test "$enable_split_app_modules" = "yes"; then
11853     SPLIT_APP_MODULES="TRUE"
11855 AC_SUBST(SPLIT_APP_MODULES)
11857 SPLIT_OPT_FEATURES=""
11858 if test "$enable_split_opt_features" = "yes"; then
11859     SPLIT_OPT_FEATURES="TRUE"
11861 AC_SUBST(SPLIT_OPT_FEATURES)
11863 dnl ===================================================================
11864 dnl Check whether the GStreamer libraries are available.
11865 dnl ===================================================================
11867 ENABLE_GSTREAMER_1_0=""
11869 if test "$test_gstreamer_1_0" = yes; then
11871     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
11872     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
11873         ENABLE_GSTREAMER_1_0="TRUE"
11874         AC_MSG_RESULT([yes])
11875         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
11876         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11877         FilterLibs "${GSTREAMER_1_0_LIBS}"
11878         GSTREAMER_1_0_LIBS="${filteredlibs}"
11879         AC_DEFINE(ENABLE_GSTREAMER_1_0)
11880     else
11881         AC_MSG_RESULT([no])
11882     fi
11884 AC_SUBST(GSTREAMER_1_0_CFLAGS)
11885 AC_SUBST(GSTREAMER_1_0_LIBS)
11886 AC_SUBST(ENABLE_GSTREAMER_1_0)
11888 ENABLE_OPENGL_TRANSITIONS=
11889 ENABLE_OPENGL_CANVAS=
11890 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
11891    : # disable
11892 elif test "$_os" = "Darwin"; then
11893     # We use frameworks on macOS, no need for detail checks
11894     ENABLE_OPENGL_TRANSITIONS=TRUE
11895     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11896     ENABLE_OPENGL_CANVAS=TRUE
11897 elif test $_os = WINNT; then
11898     ENABLE_OPENGL_TRANSITIONS=TRUE
11899     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11900     ENABLE_OPENGL_CANVAS=TRUE
11901 else
11902     if test "$USING_X11" = TRUE; then
11903         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
11904         ENABLE_OPENGL_TRANSITIONS=TRUE
11905         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11906         ENABLE_OPENGL_CANVAS=TRUE
11907     fi
11910 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
11911 AC_SUBST(ENABLE_OPENGL_CANVAS)
11913 dnl =================================================
11914 dnl Check whether to build with OpenCL support.
11915 dnl =================================================
11917 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE" -a "$enable_opencl" = "yes"; then
11918     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
11919     # platform (optional at run-time, used through clew).
11920     BUILD_TYPE="$BUILD_TYPE OPENCL"
11921     AC_DEFINE(HAVE_FEATURE_OPENCL)
11924 dnl =================================================
11925 dnl Check whether to build with dconf support.
11926 dnl =================================================
11928 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
11929     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
11930         if test "$enable_dconf" = yes; then
11931             AC_MSG_ERROR([dconf not found])
11932         else
11933             enable_dconf=no
11934         fi])
11936 AC_MSG_CHECKING([whether to enable dconf])
11937 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
11938     DCONF_CFLAGS=
11939     DCONF_LIBS=
11940     ENABLE_DCONF=
11941     AC_MSG_RESULT([no])
11942 else
11943     ENABLE_DCONF=TRUE
11944     AC_DEFINE(ENABLE_DCONF)
11945     AC_MSG_RESULT([yes])
11947 AC_SUBST([DCONF_CFLAGS])
11948 AC_SUBST([DCONF_LIBS])
11949 AC_SUBST([ENABLE_DCONF])
11951 # pdf import?
11952 AC_MSG_CHECKING([whether to build the PDF import feature])
11953 ENABLE_PDFIMPORT=
11954 if test -z "$enable_pdfimport" -o "$enable_pdfimport" = yes; then
11955     AC_MSG_RESULT([yes])
11956     ENABLE_PDFIMPORT=TRUE
11957     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
11958 else
11959     AC_MSG_RESULT([no])
11962 # Pdfium?
11963 AC_MSG_CHECKING([whether to build PDFium])
11964 ENABLE_PDFIUM=
11965 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
11966     AC_MSG_RESULT([yes])
11967     ENABLE_PDFIUM=TRUE
11968     BUILD_TYPE="$BUILD_TYPE PDFIUM"
11969 else
11970     AC_MSG_RESULT([no])
11972 AC_SUBST(ENABLE_PDFIUM)
11974 if test "$ENABLE_PDFIUM" = "TRUE"; then
11975     AC_MSG_CHECKING([which OpenJPEG library to use])
11976     if test "$with_system_openjpeg" = "yes"; then
11977         SYSTEM_OPENJPEG2=TRUE
11978         AC_MSG_RESULT([external])
11979         PKG_CHECK_MODULES( OPENJPEG2, libopenjp2 )
11980         OPENJPEG2_CFLAGS=$(printf '%s' "$OPENJPEG2_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11981         FilterLibs "${OPENJPEG2_LIBS}"
11982         OPENJPEG2_LIBS="${filteredlibs}"
11983     else
11984         SYSTEM_OPENJPEG2=FALSE
11985         AC_MSG_RESULT([internal])
11986     fi
11988     AC_MSG_CHECKING([which Abseil library to use])
11989     if test "$with_system_abseil" = "yes"; then
11990         AC_MSG_RESULT([external])
11991         SYSTEM_ABSEIL=TRUE
11992         AC_LANG_PUSH([C++])
11993         AC_CHECK_HEADER(absl/types/bad_optional_access.h, [],
11994                         [AC_MSG_ERROR(abseil headers not found.)], [])
11995         AC_CHECK_LIB([absl_bad_optional_access], [main], [ABSEIL_LIBS=-labsl_bad_optional_access],
11996                      [AC_MSG_ERROR([libabsl_bad_optional_access library not found.])])
11997         AC_LANG_POP([C++])
11998         ABSEIL_CFLAGS=$(printf '%s' "$ABSEIL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11999         FilterLibs "${ABSEIL_LIBS}"
12000         ABSEIL_LIBS="${filteredlibs}"
12001     else
12002         AC_MSG_RESULT([internal])
12003     fi
12005 AC_SUBST(SYSTEM_OPENJPEG2)
12006 AC_SUBST(SYSTEM_ABSEIL)
12007 AC_SUBST(ABSEIL_CFLAGS)
12008 AC_SUBST(ABSEIL_LIBS)
12010 dnl ===================================================================
12011 dnl Check for poppler
12012 dnl ===================================================================
12013 ENABLE_POPPLER=
12014 AC_MSG_CHECKING([whether to build Poppler])
12015 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" -a $_os != Android \) -o "$enable_poppler" = yes; then
12016     AC_MSG_RESULT([yes])
12017     ENABLE_POPPLER=TRUE
12018     AC_DEFINE(HAVE_FEATURE_POPPLER)
12019 else
12020     AC_MSG_RESULT([no])
12022 AC_SUBST(ENABLE_POPPLER)
12024 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
12025     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
12028 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
12029     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
12032 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
12033     dnl ===================================================================
12034     dnl Check for system poppler
12035     dnl ===================================================================
12036     AC_MSG_CHECKING([which PDF import poppler to use])
12037     if test "$with_system_poppler" = "yes"; then
12038         AC_MSG_RESULT([external])
12039         SYSTEM_POPPLER=TRUE
12040         PKG_CHECK_MODULES(POPPLER,[poppler >= 0.14 poppler-cpp])
12041         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12042         FilterLibs "${POPPLER_LIBS}"
12043         POPPLER_LIBS="${filteredlibs}"
12044     else
12045         AC_MSG_RESULT([internal])
12046         SYSTEM_POPPLER=
12047         BUILD_TYPE="$BUILD_TYPE POPPLER"
12048     fi
12049     AC_DEFINE([ENABLE_PDFIMPORT],1)
12051 AC_SUBST(ENABLE_PDFIMPORT)
12052 AC_SUBST(SYSTEM_POPPLER)
12053 AC_SUBST(POPPLER_CFLAGS)
12054 AC_SUBST(POPPLER_LIBS)
12056 # Skia?
12057 ENABLE_SKIA=
12058 if test "$enable_skia" != "no" -a "$build_skia" = "yes" -a -z "$DISABLE_GUI"; then
12059     # Skia now requires at least freetype2 >= 2.8.1, which is less that what LO requires as system freetype.
12060     if test "$SYSTEM_FREETYPE" = TRUE; then
12061         PKG_CHECK_EXISTS(freetype2 >= 21.0.15, # 21.0.15 = 2.8.1
12062             [skia_freetype_ok=yes],
12063             [skia_freetype_ok=no])
12064     else # internal is ok
12065         skia_freetype_ok=yes
12066     fi
12067     AC_MSG_CHECKING([whether to build Skia])
12068     if test "$skia_freetype_ok" = "yes"; then
12069         if test "$enable_skia" = "debug"; then
12070             AC_MSG_RESULT([yes (debug)])
12071             ENABLE_SKIA_DEBUG=TRUE
12072         else
12073             AC_MSG_RESULT([yes])
12074             ENABLE_SKIA_DEBUG=
12075         fi
12076         ENABLE_SKIA=TRUE
12077         AC_DEFINE(HAVE_FEATURE_SKIA)
12078         BUILD_TYPE="$BUILD_TYPE SKIA"
12080         if test "$OS" = "MACOSX"; then
12081             AC_DEFINE(SK_SUPPORT_GPU,1)
12082             AC_DEFINE(SK_METAL,1)
12083             SKIA_GPU=METAL
12084             AC_SUBST(SKIA_GPU)
12085         else
12086             AC_DEFINE(SK_SUPPORT_GPU,1)
12087             AC_DEFINE(SK_VULKAN,1)
12088             SKIA_GPU=VULKAN
12089             AC_SUBST(SKIA_GPU)
12090         fi
12092         if test -n "$MAC_OS_X_VERSION_MIN_REQUIRED" && test "$MAC_OS_X_VERSION_MIN_REQUIRED" -lt "101200"; then
12093             SKIA_DISABLE_VMA_USE_STL_SHARED_MUTEX=1
12094             AC_SUBST(SKIA_DISABLE_VMA_USE_STL_SHARED_MUTEX)
12095         fi
12096     else
12097         AC_MSG_RESULT([no (freetype too old)])
12098         add_warning "freetype version is too old for Skia library, at least 2.8.1 required, Skia support disabled"
12099     fi
12101 else
12102     AC_MSG_CHECKING([whether to build Skia])
12103     AC_MSG_RESULT([no])
12105 AC_SUBST(ENABLE_SKIA)
12106 AC_SUBST(ENABLE_SKIA_DEBUG)
12108 LO_CLANG_CXXFLAGS_INTRINSICS_SSE2=
12109 LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3=
12110 LO_CLANG_CXXFLAGS_INTRINSICS_SSE41=
12111 LO_CLANG_CXXFLAGS_INTRINSICS_SSE42=
12112 LO_CLANG_CXXFLAGS_INTRINSICS_AVX=
12113 LO_CLANG_CXXFLAGS_INTRINSICS_AVX2=
12114 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512=
12115 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F=
12116 LO_CLANG_CXXFLAGS_INTRINSICS_F16C=
12117 LO_CLANG_CXXFLAGS_INTRINSICS_FMA=
12118 HAVE_LO_CLANG_DLLEXPORTINLINES=
12120 if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE; then
12121     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12122         AC_MSG_CHECKING([for Clang])
12123         AC_MSG_RESULT([$LO_CLANG_CC / $LO_CLANG_CXX])
12124     else
12125         if test "$_os" = "WINNT"; then
12126             AC_MSG_CHECKING([for clang-cl])
12127             if test -x "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"; then
12128                 LO_CLANG_CC=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"`
12129             elif test -n "$PROGRAMFILES" -a -x "$PROGRAMFILES/LLVM/bin/clang-cl.exe"; then
12130                 LO_CLANG_CC=`win_short_path_for_make "$PROGRAMFILES/LLVM/bin/clang-cl.exe"`
12131             elif test -x "c:/Program Files/LLVM/bin/clang-cl.exe"; then
12132                 LO_CLANG_CC=`win_short_path_for_make "c:/Program Files/LLVM/bin/clang-cl.exe"`
12133             fi
12134             if test -n "$LO_CLANG_CC"; then
12135                 dnl explicitly set -m32/-m64
12136                 LO_CLANG_CC="$LO_CLANG_CC -m$WIN_HOST_BITS"
12137                 LO_CLANG_CXX="$LO_CLANG_CC"
12138                 AC_MSG_RESULT([$LO_CLANG_CC])
12139             else
12140                 AC_MSG_RESULT([no])
12141             fi
12143             AC_MSG_CHECKING([the dependency generation prefix (clang.exe -showIncludes)])
12144             echo "#include <stdlib.h>" > conftest.c
12145             LO_CLANG_SHOWINCLUDES_PREFIX=`$LO_CLANG_CC $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
12146                 grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
12147             rm -f conftest.c conftest.obj
12148             if test -z "$LO_CLANG_SHOWINCLUDES_PREFIX"; then
12149                 AC_MSG_ERROR([cannot determine the -showIncludes prefix])
12150             else
12151                 AC_MSG_RESULT(["$LO_CLANG_SHOWINCLUDES_PREFIX"])
12152             fi
12153         else
12154             AC_CHECK_PROG(LO_CLANG_CC,clang,clang,[])
12155             AC_CHECK_PROG(LO_CLANG_CXX,clang++,clang++,[])
12156         fi
12157     fi
12158     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12159         clang2_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $LO_CLANG_CC -E - | tail -1 | sed 's/ //g'`
12160         clang2_ver=`echo "$clang2_version" | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
12161         if test "$clang2_ver" -lt 50002; then
12162             AC_MSG_WARN(["$clang2_version" is too old or unrecognized, must be at least Clang 5.0.2])
12163             LO_CLANG_CC=
12164             LO_CLANG_CXX=
12165         fi
12166     fi
12167     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX" -a "$_os" = "WINNT"; then
12168         save_CXX="$CXX"
12169         CXX="$LO_CLANG_CXX"
12170         AC_MSG_CHECKING([whether $CXX supports -Zc:dllexportInlines-])
12171         AC_LANG_PUSH([C++])
12172         save_CXXFLAGS=$CXXFLAGS
12173         CXXFLAGS="$CXXFLAGS -Werror -Zc:dllexportInlines-"
12174         AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
12175                 HAVE_LO_CLANG_DLLEXPORTINLINES=TRUE
12176                 AC_MSG_RESULT([yes])
12177             ], [AC_MSG_RESULT([no])])
12178         CXXFLAGS=$save_CXXFLAGS
12179         AC_LANG_POP([C++])
12180         CXX="$save_CXX"
12181         if test -z "$HAVE_LO_CLANG_DLLEXPORTINLINES"; then
12182             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.])
12183         fi
12184     fi
12185     if test -z "$LO_CLANG_CC" -o -z "$LO_CLANG_CXX"; then
12186         # Skia is the default on Windows and Mac, so hard-require Clang.
12187         # Elsewhere it's used just by the 'gen' VCL backend which is rarely used.
12188         if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
12189             AC_MSG_ERROR([Clang compiler not found. The Skia library needs to be built using Clang, or use --disable-skia.])
12190         else
12191             AC_MSG_WARN([Clang compiler not found.])
12192         fi
12193     else
12195         save_CXX="$CXX"
12196         CXX="$LO_CLANG_CXX"
12197         # copy&paste (and adjust) of intrinsics checks, since MSVC's -arch doesn't work well for Clang-cl
12198         flag_sse2=-msse2
12199         flag_ssse3=-mssse3
12200         flag_sse41=-msse4.1
12201         flag_sse42=-msse4.2
12202         flag_avx=-mavx
12203         flag_avx2=-mavx2
12204         flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
12205         flag_avx512f=-mavx512f
12206         flag_f16c=-mf16c
12207         flag_fma=-mfma
12209         AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
12210         AC_LANG_PUSH([C++])
12211         save_CXXFLAGS=$CXXFLAGS
12212         CXXFLAGS="$CXXFLAGS $flag_sse2"
12213         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12214             #include <emmintrin.h>
12215             int main () {
12216                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12217                 c = _mm_xor_si128 (a, b);
12218                 return 0;
12219             }
12220             ])],
12221             [can_compile_sse2=yes],
12222             [can_compile_sse2=no])
12223         AC_LANG_POP([C++])
12224         CXXFLAGS=$save_CXXFLAGS
12225         AC_MSG_RESULT([${can_compile_sse2}])
12226         if test "${can_compile_sse2}" = "yes" ; then
12227             LO_CLANG_CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
12228         fi
12230         AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
12231         AC_LANG_PUSH([C++])
12232         save_CXXFLAGS=$CXXFLAGS
12233         CXXFLAGS="$CXXFLAGS $flag_ssse3"
12234         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12235             #include <tmmintrin.h>
12236             int main () {
12237                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12238                 c = _mm_maddubs_epi16 (a, b);
12239                 return 0;
12240             }
12241             ])],
12242             [can_compile_ssse3=yes],
12243             [can_compile_ssse3=no])
12244         AC_LANG_POP([C++])
12245         CXXFLAGS=$save_CXXFLAGS
12246         AC_MSG_RESULT([${can_compile_ssse3}])
12247         if test "${can_compile_ssse3}" = "yes" ; then
12248             LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
12249         fi
12251         AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
12252         AC_LANG_PUSH([C++])
12253         save_CXXFLAGS=$CXXFLAGS
12254         CXXFLAGS="$CXXFLAGS $flag_sse41"
12255         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12256             #include <smmintrin.h>
12257             int main () {
12258                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12259                 c = _mm_cmpeq_epi64 (a, b);
12260                 return 0;
12261             }
12262             ])],
12263             [can_compile_sse41=yes],
12264             [can_compile_sse41=no])
12265         AC_LANG_POP([C++])
12266         CXXFLAGS=$save_CXXFLAGS
12267         AC_MSG_RESULT([${can_compile_sse41}])
12268         if test "${can_compile_sse41}" = "yes" ; then
12269             LO_CLANG_CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
12270         fi
12272         AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
12273         AC_LANG_PUSH([C++])
12274         save_CXXFLAGS=$CXXFLAGS
12275         CXXFLAGS="$CXXFLAGS $flag_sse42"
12276         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12277             #include <nmmintrin.h>
12278             int main () {
12279                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12280                 c = _mm_cmpgt_epi64 (a, b);
12281                 return 0;
12282             }
12283             ])],
12284             [can_compile_sse42=yes],
12285             [can_compile_sse42=no])
12286         AC_LANG_POP([C++])
12287         CXXFLAGS=$save_CXXFLAGS
12288         AC_MSG_RESULT([${can_compile_sse42}])
12289         if test "${can_compile_sse42}" = "yes" ; then
12290             LO_CLANG_CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
12291         fi
12293         AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
12294         AC_LANG_PUSH([C++])
12295         save_CXXFLAGS=$CXXFLAGS
12296         CXXFLAGS="$CXXFLAGS $flag_avx"
12297         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12298             #include <immintrin.h>
12299             int main () {
12300                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
12301                 c = _mm256_xor_ps(a, b);
12302                 return 0;
12303             }
12304             ])],
12305             [can_compile_avx=yes],
12306             [can_compile_avx=no])
12307         AC_LANG_POP([C++])
12308         CXXFLAGS=$save_CXXFLAGS
12309         AC_MSG_RESULT([${can_compile_avx}])
12310         if test "${can_compile_avx}" = "yes" ; then
12311             LO_CLANG_CXXFLAGS_INTRINSICS_AVX="$flag_avx"
12312         fi
12314         AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
12315         AC_LANG_PUSH([C++])
12316         save_CXXFLAGS=$CXXFLAGS
12317         CXXFLAGS="$CXXFLAGS $flag_avx2"
12318         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12319             #include <immintrin.h>
12320             int main () {
12321                 __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
12322                 c = _mm256_maddubs_epi16(a, b);
12323                 return 0;
12324             }
12325             ])],
12326             [can_compile_avx2=yes],
12327             [can_compile_avx2=no])
12328         AC_LANG_POP([C++])
12329         CXXFLAGS=$save_CXXFLAGS
12330         AC_MSG_RESULT([${can_compile_avx2}])
12331         if test "${can_compile_avx2}" = "yes" ; then
12332             LO_CLANG_CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
12333         fi
12335         AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
12336         AC_LANG_PUSH([C++])
12337         save_CXXFLAGS=$CXXFLAGS
12338         CXXFLAGS="$CXXFLAGS $flag_avx512"
12339         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12340             #include <immintrin.h>
12341             int main () {
12342                 __m512i a = _mm512_loadu_si512(0);
12343                 __m512d v1 = _mm512_load_pd(0);
12344                 // https://gcc.gnu.org/git/?p=gcc.git;a=commit;f=gcc/config/i386/avx512fintrin.h;h=23bce99cbe7016a04e14c2163ed3fe6a5a64f4e2
12345                 __m512d v2 = _mm512_abs_pd(v1);
12346                 return 0;
12347             }
12348             ])],
12349             [can_compile_avx512=yes],
12350             [can_compile_avx512=no])
12351         AC_LANG_POP([C++])
12352         CXXFLAGS=$save_CXXFLAGS
12353         AC_MSG_RESULT([${can_compile_avx512}])
12354         if test "${can_compile_avx512}" = "yes" ; then
12355             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
12356             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F="$flag_avx512f"
12357         fi
12359         AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
12360         AC_LANG_PUSH([C++])
12361         save_CXXFLAGS=$CXXFLAGS
12362         CXXFLAGS="$CXXFLAGS $flag_f16c"
12363         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12364             #include <immintrin.h>
12365             int main () {
12366                 __m128i a = _mm_set1_epi32 (0);
12367                 __m128 c;
12368                 c = _mm_cvtph_ps(a);
12369                 return 0;
12370             }
12371             ])],
12372             [can_compile_f16c=yes],
12373             [can_compile_f16c=no])
12374         AC_LANG_POP([C++])
12375         CXXFLAGS=$save_CXXFLAGS
12376         AC_MSG_RESULT([${can_compile_f16c}])
12377         if test "${can_compile_f16c}" = "yes" ; then
12378             LO_CLANG_CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
12379         fi
12381         AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
12382         AC_LANG_PUSH([C++])
12383         save_CXXFLAGS=$CXXFLAGS
12384         CXXFLAGS="$CXXFLAGS $flag_fma"
12385         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12386             #include <immintrin.h>
12387             int main () {
12388                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
12389                 d = _mm256_fmadd_ps(a, b, c);
12390                 return 0;
12391             }
12392             ])],
12393             [can_compile_fma=yes],
12394             [can_compile_fma=no])
12395         AC_LANG_POP([C++])
12396         CXXFLAGS=$save_CXXFLAGS
12397         AC_MSG_RESULT([${can_compile_fma}])
12398         if test "${can_compile_fma}" = "yes" ; then
12399             LO_CLANG_CXXFLAGS_INTRINSICS_FMA="$flag_fma"
12400         fi
12402         CXX="$save_CXX"
12403     fi
12406 # prefix LO_CLANG_CC/LO_CLANG_CXX with ccache if needed
12408 if test "$CCACHE" != "" -a -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12409     AC_MSG_CHECKING([whether $LO_CLANG_CC is already ccached])
12410     AC_LANG_PUSH([C])
12411     save_CC="$CC"
12412     CC="$LO_CLANG_CC"
12413     save_CFLAGS=$CFLAGS
12414     CFLAGS="$CFLAGS --ccache-skip -O2 -Werror"
12415     dnl an empty program will do, we're checking the compiler flags
12416     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12417                       [use_ccache=yes], [use_ccache=no])
12418     CFLAGS=$save_CFLAGS
12419     CC=$save_CC
12420     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12421         AC_MSG_RESULT([yes])
12422     else
12423         LO_CLANG_CC="$CCACHE $LO_CLANG_CC"
12424         AC_MSG_RESULT([no])
12425     fi
12426     AC_LANG_POP([C])
12428     AC_MSG_CHECKING([whether $LO_CLANG_CXX is already ccached])
12429     AC_LANG_PUSH([C++])
12430     save_CXX="$CXX"
12431     CXX="$LO_CLANG_CXX"
12432     save_CXXFLAGS=$CXXFLAGS
12433     CXXFLAGS="$CXXFLAGS --ccache-skip -O2 -Werror"
12434     dnl an empty program will do, we're checking the compiler flags
12435     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12436                       [use_ccache=yes], [use_ccache=no])
12437     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12438         AC_MSG_RESULT([yes])
12439     else
12440         LO_CLANG_CXX="$CCACHE $LO_CLANG_CXX"
12441         AC_MSG_RESULT([no])
12442     fi
12443     CXXFLAGS=$save_CXXFLAGS
12444     CXX=$save_CXX
12445     AC_LANG_POP([C++])
12448 AC_SUBST(LO_CLANG_CC)
12449 AC_SUBST(LO_CLANG_CXX)
12450 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE2)
12451 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3)
12452 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE41)
12453 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE42)
12454 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX)
12455 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX2)
12456 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512)
12457 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F)
12458 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_F16C)
12459 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_FMA)
12460 AC_SUBST(LO_CLANG_SHOWINCLUDES_PREFIX)
12461 AC_SUBST(CLANG_USE_LD)
12462 AC_SUBST([HAVE_LO_CLANG_DLLEXPORTINLINES])
12464 SYSTEM_GPGMEPP=
12466 AC_MSG_CHECKING([whether to enable gpgmepp])
12467 if test "$enable_gpgmepp" = no; then
12468     AC_MSG_RESULT([no])
12469 elif test "$enable_mpl_subset" = "yes"; then
12470     AC_MSG_RESULT([no (MPL only])
12471 elif test "$enable_fuzzers" = "yes"; then
12472     AC_MSG_RESULT([no (oss-fuzz)])
12473 elif test \( \( "$_os" = "Linux" -o "$_os" = "Darwin" \) -a "$ENABLE_NSS" = TRUE \) -o "$_os" = "WINNT" ; then
12474     AC_MSG_RESULT([yes])
12475     dnl ===================================================================
12476     dnl Check for system gpgme
12477     dnl ===================================================================
12478     AC_MSG_CHECKING([which gpgmepp to use])
12479     if test "$with_system_gpgmepp" = "yes"; then
12480         AC_MSG_RESULT([external])
12481         SYSTEM_GPGMEPP=TRUE
12483         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
12484         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
12485             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp >= 1.14 development package])], [])
12486         # progress_callback is the only func with plain C linkage
12487         # checking for it also filters out older, KDE-dependent libgpgmepp versions
12488         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
12489             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
12490         AC_CHECK_HEADER(gpgme.h, [],
12491             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
12492     else
12493         AC_MSG_RESULT([internal])
12494         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
12496         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
12497         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
12498         if test "$_os" != "WINNT"; then
12499             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
12500             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
12501         fi
12502     fi
12503     ENABLE_GPGMEPP=TRUE
12504     AC_DEFINE([HAVE_FEATURE_GPGME])
12505     AC_PATH_PROG(GPG, gpg)
12506     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
12507     # so let's exclude that manually for the moment
12508     if test -n "$GPG" -a "$_os" != "WINNT"; then
12509         # make sure we not only have a working gpgme, but a full working
12510         # gpg installation to run OpenPGP signature verification
12511         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
12512     fi
12513     if test "$_os" = "Linux"; then
12514       uid=`id -u`
12515       AC_MSG_CHECKING([for /run/user/$uid])
12516       if test -d /run/user/$uid; then
12517         AC_MSG_RESULT([yes])
12518         AC_PATH_PROG(GPGCONF, gpgconf)
12520         # Older versions of gpgconf are not working as expected, since
12521         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
12522         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
12523         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
12524         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
12525         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
12526         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
12527         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
12528           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
12529           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
12530           if $GPGCONF --dump-options > /dev/null ; then
12531             if $GPGCONF --dump-options | grep -q create-socketdir ; then
12532               AC_MSG_RESULT([yes])
12533               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
12534               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
12535             else
12536               AC_MSG_RESULT([no])
12537             fi
12538           else
12539             AC_MSG_RESULT([no. missing or broken gpgconf?])
12540           fi
12541         else
12542           AC_MSG_RESULT([no, $GPGCONF_VERSION])
12543         fi
12544       else
12545         AC_MSG_RESULT([no])
12546      fi
12547    fi
12548 else
12549     AC_MSG_RESULT([no (unsupported OS or missing NSS)])
12551 AC_SUBST(ENABLE_GPGMEPP)
12552 AC_SUBST(SYSTEM_GPGMEPP)
12553 AC_SUBST(GPG_ERROR_CFLAGS)
12554 AC_SUBST(GPG_ERROR_LIBS)
12555 AC_SUBST(LIBASSUAN_CFLAGS)
12556 AC_SUBST(LIBASSUAN_LIBS)
12557 AC_SUBST(GPGMEPP_CFLAGS)
12558 AC_SUBST(GPGMEPP_LIBS)
12560 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
12561 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
12562     AC_MSG_RESULT([yes])
12563     ENABLE_MEDIAWIKI=TRUE
12564     BUILD_TYPE="$BUILD_TYPE XSLTML"
12565     if test  "x$with_java" = "xno"; then
12566         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
12567     fi
12568 else
12569     AC_MSG_RESULT([no])
12570     ENABLE_MEDIAWIKI=
12571     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
12573 AC_SUBST(ENABLE_MEDIAWIKI)
12575 AC_MSG_CHECKING([whether to build the Report Builder])
12576 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12577     AC_MSG_RESULT([yes])
12578     ENABLE_REPORTBUILDER=TRUE
12579     AC_MSG_CHECKING([which jfreereport libs to use])
12580     if test "$with_system_jfreereport" = "yes"; then
12581         SYSTEM_JFREEREPORT=TRUE
12582         AC_MSG_RESULT([external])
12583         if test -z $SAC_JAR; then
12584             SAC_JAR=/usr/share/java/sac.jar
12585         fi
12586         if ! test -f $SAC_JAR; then
12587              AC_MSG_ERROR(sac.jar not found.)
12588         fi
12590         if test -z $LIBXML_JAR; then
12591             if test -f /usr/share/java/libxml-1.0.0.jar; then
12592                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
12593             elif test -f /usr/share/java/libxml.jar; then
12594                 LIBXML_JAR=/usr/share/java/libxml.jar
12595             else
12596                 AC_MSG_ERROR(libxml.jar replacement not found.)
12597             fi
12598         elif ! test -f $LIBXML_JAR; then
12599             AC_MSG_ERROR(libxml.jar not found.)
12600         fi
12602         if test -z $FLUTE_JAR; then
12603             if test -f /usr/share/java/flute-1.3.0.jar; then
12604                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
12605             elif test -f /usr/share/java/flute.jar; then
12606                 FLUTE_JAR=/usr/share/java/flute.jar
12607             else
12608                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
12609             fi
12610         elif ! test -f $FLUTE_JAR; then
12611             AC_MSG_ERROR(flute-1.3.0.jar not found.)
12612         fi
12614         if test -z $JFREEREPORT_JAR; then
12615             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
12616                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
12617             elif test -f /usr/share/java/flow-engine.jar; then
12618                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
12619             else
12620                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
12621             fi
12622         elif ! test -f  $JFREEREPORT_JAR; then
12623                 AC_MSG_ERROR(jfreereport.jar not found.)
12624         fi
12626         if test -z $LIBLAYOUT_JAR; then
12627             if test -f /usr/share/java/liblayout-0.2.9.jar; then
12628                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
12629             elif test -f /usr/share/java/liblayout.jar; then
12630                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
12631             else
12632                 AC_MSG_ERROR(liblayout.jar replacement not found.)
12633             fi
12634         elif ! test -f $LIBLAYOUT_JAR; then
12635                 AC_MSG_ERROR(liblayout.jar not found.)
12636         fi
12638         if test -z $LIBLOADER_JAR; then
12639             if test -f /usr/share/java/libloader-1.0.0.jar; then
12640                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
12641             elif test -f /usr/share/java/libloader.jar; then
12642                 LIBLOADER_JAR=/usr/share/java/libloader.jar
12643             else
12644                 AC_MSG_ERROR(libloader.jar replacement not found.)
12645             fi
12646         elif ! test -f  $LIBLOADER_JAR; then
12647             AC_MSG_ERROR(libloader.jar not found.)
12648         fi
12650         if test -z $LIBFORMULA_JAR; then
12651             if test -f /usr/share/java/libformula-0.2.0.jar; then
12652                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
12653             elif test -f /usr/share/java/libformula.jar; then
12654                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
12655             else
12656                 AC_MSG_ERROR(libformula.jar replacement not found.)
12657             fi
12658         elif ! test -f $LIBFORMULA_JAR; then
12659                 AC_MSG_ERROR(libformula.jar not found.)
12660         fi
12662         if test -z $LIBREPOSITORY_JAR; then
12663             if test -f /usr/share/java/librepository-1.0.0.jar; then
12664                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
12665             elif test -f /usr/share/java/librepository.jar; then
12666                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
12667             else
12668                 AC_MSG_ERROR(librepository.jar replacement not found.)
12669             fi
12670         elif ! test -f $LIBREPOSITORY_JAR; then
12671             AC_MSG_ERROR(librepository.jar not found.)
12672         fi
12674         if test -z $LIBFONTS_JAR; then
12675             if test -f /usr/share/java/libfonts-1.0.0.jar; then
12676                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
12677             elif test -f /usr/share/java/libfonts.jar; then
12678                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
12679             else
12680                 AC_MSG_ERROR(libfonts.jar replacement not found.)
12681             fi
12682         elif ! test -f $LIBFONTS_JAR; then
12683                 AC_MSG_ERROR(libfonts.jar not found.)
12684         fi
12686         if test -z $LIBSERIALIZER_JAR; then
12687             if test -f /usr/share/java/libserializer-1.0.0.jar; then
12688                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
12689             elif test -f /usr/share/java/libserializer.jar; then
12690                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
12691             else
12692                 AC_MSG_ERROR(libserializer.jar replacement not found.)
12693             fi
12694         elif ! test -f $LIBSERIALIZER_JAR; then
12695                 AC_MSG_ERROR(libserializer.jar not found.)
12696         fi
12698         if test -z $LIBBASE_JAR; then
12699             if test -f /usr/share/java/libbase-1.0.0.jar; then
12700                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
12701             elif test -f /usr/share/java/libbase.jar; then
12702                 LIBBASE_JAR=/usr/share/java/libbase.jar
12703             else
12704                 AC_MSG_ERROR(libbase.jar replacement not found.)
12705             fi
12706         elif ! test -f $LIBBASE_JAR; then
12707             AC_MSG_ERROR(libbase.jar not found.)
12708         fi
12710     else
12711         AC_MSG_RESULT([internal])
12712         SYSTEM_JFREEREPORT=
12713         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
12714         NEED_ANT=TRUE
12715     fi
12716 else
12717     AC_MSG_RESULT([no])
12718     ENABLE_REPORTBUILDER=
12719     SYSTEM_JFREEREPORT=
12721 AC_SUBST(ENABLE_REPORTBUILDER)
12722 AC_SUBST(SYSTEM_JFREEREPORT)
12723 AC_SUBST(SAC_JAR)
12724 AC_SUBST(LIBXML_JAR)
12725 AC_SUBST(FLUTE_JAR)
12726 AC_SUBST(JFREEREPORT_JAR)
12727 AC_SUBST(LIBBASE_JAR)
12728 AC_SUBST(LIBLAYOUT_JAR)
12729 AC_SUBST(LIBLOADER_JAR)
12730 AC_SUBST(LIBFORMULA_JAR)
12731 AC_SUBST(LIBREPOSITORY_JAR)
12732 AC_SUBST(LIBFONTS_JAR)
12733 AC_SUBST(LIBSERIALIZER_JAR)
12735 # scripting provider for BeanShell?
12736 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
12737 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
12738     AC_MSG_RESULT([yes])
12739     ENABLE_SCRIPTING_BEANSHELL=TRUE
12741     dnl ===================================================================
12742     dnl Check for system beanshell
12743     dnl ===================================================================
12744     AC_MSG_CHECKING([which beanshell to use])
12745     if test "$with_system_beanshell" = "yes"; then
12746         AC_MSG_RESULT([external])
12747         SYSTEM_BSH=TRUE
12748         if test -z $BSH_JAR; then
12749             BSH_JAR=/usr/share/java/bsh.jar
12750         fi
12751         if ! test -f $BSH_JAR; then
12752             AC_MSG_ERROR(bsh.jar not found.)
12753         fi
12754     else
12755         AC_MSG_RESULT([internal])
12756         SYSTEM_BSH=
12757         BUILD_TYPE="$BUILD_TYPE BSH"
12758     fi
12759 else
12760     AC_MSG_RESULT([no])
12761     ENABLE_SCRIPTING_BEANSHELL=
12762     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
12764 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
12765 AC_SUBST(SYSTEM_BSH)
12766 AC_SUBST(BSH_JAR)
12768 # scripting provider for JavaScript?
12769 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
12770 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
12771     AC_MSG_RESULT([yes])
12772     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
12774     dnl ===================================================================
12775     dnl Check for system rhino
12776     dnl ===================================================================
12777     AC_MSG_CHECKING([which rhino to use])
12778     if test "$with_system_rhino" = "yes"; then
12779         AC_MSG_RESULT([external])
12780         SYSTEM_RHINO=TRUE
12781         if test -z $RHINO_JAR; then
12782             RHINO_JAR=/usr/share/java/js.jar
12783         fi
12784         if ! test -f $RHINO_JAR; then
12785             AC_MSG_ERROR(js.jar not found.)
12786         fi
12787     else
12788         AC_MSG_RESULT([internal])
12789         SYSTEM_RHINO=
12790         BUILD_TYPE="$BUILD_TYPE RHINO"
12791         NEED_ANT=TRUE
12792     fi
12793 else
12794     AC_MSG_RESULT([no])
12795     ENABLE_SCRIPTING_JAVASCRIPT=
12796     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
12798 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
12799 AC_SUBST(SYSTEM_RHINO)
12800 AC_SUBST(RHINO_JAR)
12802 # This is only used in Qt5/Qt6/KF5 checks to determine if /usr/lib64
12803 # paths should be added to library search path. So lets put all 64-bit
12804 # platforms there.
12805 supports_multilib=
12806 case "$host_cpu" in
12807 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
12808     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
12809         supports_multilib="yes"
12810     fi
12811     ;;
12813     ;;
12814 esac
12816 dnl ===================================================================
12817 dnl QT5 Integration
12818 dnl ===================================================================
12820 QT5_CFLAGS=""
12821 QT5_LIBS=""
12822 QMAKE5="qmake"
12823 MOC5="moc"
12824 QT5_GOBJECT_CFLAGS=""
12825 QT5_GOBJECT_LIBS=""
12826 QT5_HAVE_GOBJECT=""
12827 QT5_PLATFORMS_SRCDIR=""
12828 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
12829         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
12830         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
12831 then
12832     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
12833     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
12835     if test -n "$supports_multilib"; then
12836         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
12837     fi
12839     qt5_test_include="QtWidgets/qapplication.h"
12840     if test "$_os" = "Emscripten"; then
12841         qt5_test_library="libQt5Widgets.a"
12842     else
12843         qt5_test_library="libQt5Widgets.so"
12844     fi
12846     dnl Check for qmake5
12847     if test -n "$QT5DIR"; then
12848         AC_PATH_PROG(QMAKE5, [qmake], no, [$QT5DIR/bin])
12849     else
12850         AC_PATH_PROGS(QMAKE5, [qmake-qt5 qmake], no)
12851     fi
12852     if test "$QMAKE5" = "no"; then
12853         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12854     else
12855         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
12856         if test -z "$qmake5_test_ver"; then
12857             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12858         fi
12859         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
12860         qt5_minimal_minor="6"
12861         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
12862             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
12863         else
12864             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
12865         fi
12866     fi
12868     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
12869     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
12870     qt5_platformsdir="`$QMAKE5 -query QT_INSTALL_PLUGINS`/platforms"
12871     QT5_PLATFORMS_SRCDIR="$qt5_platformsdir"
12873     AC_MSG_CHECKING([for Qt5 headers])
12874     qt5_incdir="no"
12875     for inc_dir in $qt5_incdirs; do
12876         if test -r "$inc_dir/$qt5_test_include"; then
12877             qt5_incdir="$inc_dir"
12878             break
12879         fi
12880     done
12881     AC_MSG_RESULT([$qt5_incdir])
12882     if test "x$qt5_incdir" = "xno"; then
12883         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12884     fi
12885     # check for scenario: qt5-qtbase-devel-*.86_64 installed but host is i686
12886     AC_LANG_PUSH([C++])
12887     save_CPPFLAGS=$CPPFLAGS
12888     CPPFLAGS="${CPPFLAGS} -I${qt5_incdir}"
12889     AC_CHECK_HEADER(QtCore/qconfig.h, [],
12890         [AC_MSG_ERROR(qconfig.h header not found.)], [])
12891     CPPFLAGS=$save_CPPFLAGS
12892     AC_LANG_POP([C++])
12894     AC_MSG_CHECKING([for Qt5 libraries])
12895     qt5_libdir="no"
12896     for lib_dir in $qt5_libdirs; do
12897         if test -r "$lib_dir/$qt5_test_library"; then
12898             qt5_libdir="$lib_dir"
12899             break
12900         fi
12901     done
12902     AC_MSG_RESULT([$qt5_libdir])
12903     if test "x$qt5_libdir" = "xno"; then
12904         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12905     fi
12907     if test "$_os" = "Emscripten"; then
12908         if test ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html ; then
12909             QT5_PLATFORMS_SRCDIR="${QT5_PLATFORMS_SRCDIR/plugins/src\/plugins}/wasm"
12910         fi
12911         if test ! -f "${qt5_platformsdir}"/libqwasm.a -o ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html; then
12912             AC_MSG_ERROR([No Qt5 WASM QPA plugin found in ${qt5_platformsdir} or ${QT5_PLATFORMS_SRCDIR}])
12913         fi
12914     fi
12916     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
12917     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12918     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
12919     if test "$_os" = "Emscripten"; then
12920         QT5_LIBS="$QT5_LIBS -lqtpcre2 -lQt5EventDispatcherSupport -lQt5FontDatabaseSupport -L${qt5_platformsdir} -lqwasm"
12921     fi
12923     if test "$USING_X11" = TRUE; then
12924         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
12925         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
12926             QT5_HAVE_XCB_ICCCM=1
12927             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
12928         ],[
12929             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)])
12930             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
12931         ])
12932         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
12933         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
12934         QT5_USING_X11=1
12935         AC_DEFINE(QT5_USING_X11)
12936     fi
12938     dnl Check for Meta Object Compiler
12940     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
12941     if test "$MOC5" = "no"; then
12942         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
12943 the root of your Qt installation by exporting QT5DIR before running "configure".])
12944     fi
12946     if test "$test_gstreamer_1_0" = yes; then
12947         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
12948                 QT5_HAVE_GOBJECT=1
12949                 AC_DEFINE(QT5_HAVE_GOBJECT)
12950             ],
12951             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
12952         )
12953     fi
12955 AC_SUBST(QT5_CFLAGS)
12956 AC_SUBST(QT5_LIBS)
12957 AC_SUBST(MOC5)
12958 AC_SUBST(QT5_GOBJECT_CFLAGS)
12959 AC_SUBST(QT5_GOBJECT_LIBS)
12960 AC_SUBST(QT5_HAVE_GOBJECT)
12961 AC_SUBST(QT5_PLATFORMS_SRCDIR)
12963 dnl ===================================================================
12964 dnl QT6 Integration
12965 dnl ===================================================================
12967 QT6_CFLAGS=""
12968 QT6_LIBS=""
12969 QMAKE6="qmake"
12970 MOC6="moc"
12971 QT6_PLATFORMS_SRCDIR=""
12972 if test \( "$test_qt6" = "yes" -a "$ENABLE_QT6" = "TRUE" \)
12973 then
12974     qt6_incdirs="$QT6INC /usr/include/qt6 /usr/include $x_includes"
12975     qt6_libdirs="$QT6LIB /usr/lib/qt6 /usr/lib $x_libraries"
12977     if test -n "$supports_multilib"; then
12978         qt6_libdirs="$qt6_libdirs /usr/lib64/qt6 /usr/lib64/qt /usr/lib64"
12979     fi
12981     qt6_test_include="QtWidgets/qapplication.h"
12982     if test "$_os" = "Emscripten"; then
12983         qt6_test_library="libQt6Widgets.a"
12984     else
12985         qt6_test_library="libQt6Widgets.so"
12986     fi
12988     dnl Check for qmake6
12989     if test -n "$QT6DIR"; then
12990         AC_PATH_PROG(QMAKE6, [qmake], no, [$QT6DIR/bin])
12991     else
12992         AC_PATH_PROGS(QMAKE6, [qmake-qt6 qmake], no)
12993     fi
12994     if test "$QMAKE6" = "no"; then
12995         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
12996     else
12997         qmake6_test_ver="`$QMAKE6 -v 2>&1 | $SED -n -e 's/^Using Qt version \(6\.[[0-9.]]\+\).*$/\1/p'`"
12998         if test -z "$qmake6_test_ver"; then
12999             AC_MSG_ERROR([Wrong qmake for Qt6 found. Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13000         fi
13001         AC_MSG_NOTICE([Detected Qt6 version: $qmake6_test_ver])
13002     fi
13004     qt6_incdirs="`$QMAKE6 -query QT_INSTALL_HEADERS` $qt6_incdirs"
13005     qt6_libdirs="`$QMAKE6 -query QT_INSTALL_LIBS` $qt6_libdirs"
13006     qt6_platformsdir="`$QMAKE6 -query QT_INSTALL_PLUGINS`/platforms"
13007     QT6_PLATFORMS_SRCDIR="$qt6_platformsdir"
13009     AC_MSG_CHECKING([for Qt6 headers])
13010     qt6_incdir="no"
13011     for inc_dir in $qt6_incdirs; do
13012         if test -r "$inc_dir/$qt6_test_include"; then
13013             qt6_incdir="$inc_dir"
13014             break
13015         fi
13016     done
13017     AC_MSG_RESULT([$qt6_incdir])
13018     if test "x$qt6_incdir" = "xno"; then
13019         AC_MSG_ERROR([Qt6 headers not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13020     fi
13021     # check for scenario: qt6-qtbase-devel-*.86_64 installed but host is i686
13022     AC_LANG_PUSH([C++])
13023     save_CPPFLAGS=$CPPFLAGS
13024     CPPFLAGS="${CPPFLAGS} -I${qt6_incdir}"
13025     AC_CHECK_HEADER(QtCore/qconfig.h, [],
13026         [AC_MSG_ERROR(qconfig.h header not found.)], [])
13027     CPPFLAGS=$save_CPPFLAGS
13028     AC_LANG_POP([C++])
13030     AC_MSG_CHECKING([for Qt6 libraries])
13031     qt6_libdir="no"
13032     for lib_dir in $qt6_libdirs; do
13033         if test -r "$lib_dir/$qt6_test_library"; then
13034             qt6_libdir="$lib_dir"
13035             break
13036         fi
13037     done
13038     AC_MSG_RESULT([$qt6_libdir])
13039     if test "x$qt6_libdir" = "xno"; then
13040         AC_MSG_ERROR([Qt6 libraries not found.  Please specify the root of your Qt6 installation by exporting QT6DIR before running "configure".])
13041     fi
13043     if test "$_os" = "Emscripten"; then
13044         if test ! -f "$QT6_PLATFORMS_SRCDIR"/wasm_shell.html ; then
13045             QT6_PLATFORMS_SRCDIR="${QT6_PLATFORMS_SRCDIR/plugins/src\/plugins}/wasm"
13046         fi
13047         if test ! -f "${qt6_platformsdir}"/libqwasm.a -o ! -f "$QT6_PLATFORMS_SRCDIR"/wasm_shell.html; then
13048             AC_MSG_ERROR([No Qt6 WASM QPA plugin found in ${qt6_platformsdir} or ${QT6_PLATFORMS_SRCDIR}])
13049         fi
13050     fi
13052     QT6_CFLAGS="-I$qt6_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
13053     QT6_CFLAGS=$(printf '%s' "$QT6_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13054     QT6_LIBS="-L$qt6_libdir -lQt6Core -lQt6Gui -lQt6Widgets -lQt6Network"
13055     if test "$_os" = "Emscripten"; then
13056         QT6_LIBS="$QT6_LIBS -lqtpcre2 -lQt6EventDispatcherSupport -lQt6FontDatabaseSupport -L${qt6_platformsdir} -lqwasm"
13057     fi
13059     if test "$USING_X11" = TRUE; then
13060         PKG_CHECK_MODULES(QT6_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for key modifier handling in X11.])])
13061         QT6_CFLAGS="$QT6_CFLAGS $QT6_XCB_CFLAGS"
13062         QT6_LIBS="$QT6_LIBS $QT6_XCB_LIBS"
13063         QT6_USING_X11=1
13064         AC_DEFINE(QT6_USING_X11)
13065     fi
13067     dnl Check for Meta Object Compiler
13069     AC_PATH_PROGS( MOC6, [moc-qt6 moc], no, [`dirname $qt6_libdir`/libexec:$QT6DIR/libexec:$PATH])
13070     if test "$MOC6" = "no"; then
13071         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
13072 the root of your Qt installation by exporting QT6DIR before running "configure".])
13073     fi
13075 AC_SUBST(QT6_CFLAGS)
13076 AC_SUBST(QT6_LIBS)
13077 AC_SUBST(MOC6)
13078 AC_SUBST(QT6_PLATFORMS_SRCDIR)
13080 dnl ===================================================================
13081 dnl KF5 Integration
13082 dnl ===================================================================
13084 KF5_CFLAGS=""
13085 KF5_LIBS=""
13086 KF5_CONFIG="kf5-config"
13087 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
13088         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
13089 then
13090     if test "$OS" = "HAIKU"; then
13091         haiku_arch="`echo $RTL_ARCH | tr X x`"
13092         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
13093         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
13094     fi
13096     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
13097     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
13098     if test -n "$supports_multilib"; then
13099         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
13100     fi
13102     kf5_test_include="KF5/KIOFileWidgets/KFileWidget"
13103     kf5_test_library="libKF5KIOFileWidgets.so"
13104     kf5_libdirs="$qt5_libdir $kf5_libdirs"
13106     dnl kf5 KDE4 support compatibility installed
13107     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
13108     if test "$KF5_CONFIG" != "no"; then
13109         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
13110         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
13111     fi
13113     dnl Check for KF5 headers
13114     AC_MSG_CHECKING([for KF5 headers])
13115     kf5_incdir="no"
13116     for kf5_check in $kf5_incdirs; do
13117         if test -r "$kf5_check/$kf5_test_include"; then
13118             kf5_incdir="$kf5_check/KF5"
13119             break
13120         fi
13121     done
13122     AC_MSG_RESULT([$kf5_incdir])
13123     if test "x$kf5_incdir" = "xno"; then
13124         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
13125     fi
13127     dnl Check for KF5 libraries
13128     AC_MSG_CHECKING([for KF5 libraries])
13129     kf5_libdir="no"
13130     for kf5_check in $kf5_libdirs; do
13131         if test -r "$kf5_check/$kf5_test_library"; then
13132             kf5_libdir="$kf5_check"
13133             break
13134         fi
13135     done
13137     AC_MSG_RESULT([$kf5_libdir])
13138     if test "x$kf5_libdir" = "xno"; then
13139         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
13140     fi
13142     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"
13143     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
13144     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13146     if test "$USING_X11" = TRUE; then
13147         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
13148     fi
13150     AC_LANG_PUSH([C++])
13151     save_CXXFLAGS=$CXXFLAGS
13152     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
13153     AC_MSG_CHECKING([whether KDE is >= 5.0])
13154        AC_RUN_IFELSE([AC_LANG_SOURCE([[
13155 #include <kcoreaddons_version.h>
13157 int main(int argc, char **argv) {
13158        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
13159        else return 1;
13161        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
13162     CXXFLAGS=$save_CXXFLAGS
13163     AC_LANG_POP([C++])
13165 AC_SUBST(KF5_CFLAGS)
13166 AC_SUBST(KF5_LIBS)
13168 dnl ===================================================================
13169 dnl Test whether to include Evolution 2 support
13170 dnl ===================================================================
13171 AC_MSG_CHECKING([whether to enable evolution 2 support])
13172 if test "$enable_evolution2" = yes; then
13173     AC_MSG_RESULT([yes])
13174     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
13175     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13176     FilterLibs "${GOBJECT_LIBS}"
13177     GOBJECT_LIBS="${filteredlibs}"
13178     ENABLE_EVOAB2="TRUE"
13179 else
13180     AC_MSG_RESULT([no])
13182 AC_SUBST(ENABLE_EVOAB2)
13183 AC_SUBST(GOBJECT_CFLAGS)
13184 AC_SUBST(GOBJECT_LIBS)
13186 dnl ===================================================================
13187 dnl Test which themes to include
13188 dnl ===================================================================
13189 AC_MSG_CHECKING([which themes to include])
13190 # if none given use default subset of available themes
13191 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
13192     with_theme="breeze breeze_dark breeze_dark_svg breeze_svg colibre colibre_svg elementary elementary_svg karasa_jaga karasa_jaga_svg sifr sifr_svg sifr_dark sifr_dark_svg sukapura sukapura_svg"
13195 WITH_THEMES=""
13196 if test "x$with_theme" != "xno"; then
13197     for theme in $with_theme; do
13198         case $theme in
13199         breeze|breeze_dark|breeze_dark_svg|breeze_svg|colibre|colibre_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg|sifr|sifr_svg|sifr_dark|sifr_dark_svg|sukapura|sukapura_svg) real_theme="$theme" ;;
13200         default) real_theme=colibre ;;
13201         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
13202         esac
13203         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
13204     done
13206 AC_MSG_RESULT([$WITH_THEMES])
13207 AC_SUBST([WITH_THEMES])
13208 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
13209 for theme in $with_theme; do
13210     case $theme in
13211     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
13212     *) ;;
13213     esac
13214 done
13216 ###############################################################################
13217 # Extensions checking
13218 ###############################################################################
13219 AC_MSG_CHECKING([for extensions integration])
13220 if test "x$enable_extension_integration" != "xno"; then
13221     WITH_EXTENSION_INTEGRATION=TRUE
13222     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
13223     AC_MSG_RESULT([yes, use integration])
13224 else
13225     WITH_EXTENSION_INTEGRATION=
13226     AC_MSG_RESULT([no, do not integrate])
13228 AC_SUBST(WITH_EXTENSION_INTEGRATION)
13230 dnl Should any extra extensions be included?
13231 dnl There are standalone tests for each of these below.
13232 WITH_EXTRA_EXTENSIONS=
13233 AC_SUBST([WITH_EXTRA_EXTENSIONS])
13235 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
13236 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
13237 if test "x$with_java" != "xno"; then
13238     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
13239     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
13242 AC_MSG_CHECKING([whether to build opens___.ttf])
13243 if test "$enable_build_opensymbol" = "yes"; then
13244     AC_MSG_RESULT([yes])
13245     AC_PATH_PROG(FONTFORGE, fontforge)
13246     if test -z "$FONTFORGE"; then
13247         AC_MSG_ERROR([fontforge not installed])
13248     fi
13249 else
13250     AC_MSG_RESULT([no])
13251     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
13253 AC_SUBST(FONTFORGE)
13255 dnl ===================================================================
13256 dnl Test whether to include fonts
13257 dnl ===================================================================
13258 AC_MSG_CHECKING([whether to include third-party fonts])
13259 if test "$with_fonts" != "no"; then
13260     AC_MSG_RESULT([yes])
13261     WITH_FONTS=TRUE
13262     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
13263     AC_DEFINE(HAVE_MORE_FONTS)
13264 else
13265     AC_MSG_RESULT([no])
13266     WITH_FONTS=
13267     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
13269 AC_SUBST(WITH_FONTS)
13272 dnl ===================================================================
13273 dnl Test whether to enable online update service
13274 dnl ===================================================================
13275 AC_MSG_CHECKING([whether to enable online update])
13276 ENABLE_ONLINE_UPDATE=
13277 ENABLE_ONLINE_UPDATE_MAR=
13278 UPDATE_CONFIG=
13279 if test "$enable_online_update" = ""; then
13280     AC_MSG_RESULT([no])
13281 else
13282     if test "$enable_online_update" = "mar"; then
13283         AC_MSG_RESULT([yes - MAR-based online update])
13284         ENABLE_ONLINE_UPDATE_MAR="TRUE"
13285         if test "$with_update_config" = ""; then
13286             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
13287         fi
13288         UPDATE_CONFIG="$with_update_config"
13289         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
13290     elif test "$enable_online_update" = "yes"; then
13291         AC_MSG_RESULT([yes])
13292         ENABLE_ONLINE_UPDATE="TRUE"
13293     else
13294         AC_MSG_RESULT([no])
13295     fi
13297 AC_SUBST(ENABLE_ONLINE_UPDATE)
13298 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
13299 AC_SUBST(UPDATE_CONFIG)
13302 PRIVACY_POLICY_URL="$with_privacy_policy_url"
13303 if test "$ENABLE_ONLINE_UPDATE" = TRUE -o "$ENABLE_BREAKPAD" = "TRUE"; then
13304     if test "x$with_privacy_policy_url" = "xundefined"; then
13305         AC_MSG_FAILURE([online update or breakpad/crashreporting are enabled, but no --with-privacy-policy-url=... was provided])
13306     fi
13308 AC_SUBST(PRIVACY_POLICY_URL)
13309 dnl ===================================================================
13310 dnl Test whether we need bzip2
13311 dnl ===================================================================
13312 SYSTEM_BZIP2=
13313 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
13314     AC_MSG_CHECKING([whether to use system bzip2])
13315     if test "$with_system_bzip2" = yes; then
13316         SYSTEM_BZIP2=TRUE
13317         AC_MSG_RESULT([yes])
13318         PKG_CHECK_MODULES(BZIP2, bzip2)
13319         FilterLibs "${BZIP2_LIBS}"
13320         BZIP2_LIBS="${filteredlibs}"
13321     else
13322         AC_MSG_RESULT([no])
13323         BUILD_TYPE="$BUILD_TYPE BZIP2"
13324     fi
13326 AC_SUBST(SYSTEM_BZIP2)
13327 AC_SUBST(BZIP2_CFLAGS)
13328 AC_SUBST(BZIP2_LIBS)
13330 dnl ===================================================================
13331 dnl Test whether to enable extension update
13332 dnl ===================================================================
13333 AC_MSG_CHECKING([whether to enable extension update])
13334 ENABLE_EXTENSION_UPDATE=
13335 if test "x$enable_extension_update" = "xno"; then
13336     AC_MSG_RESULT([no])
13337 else
13338     AC_MSG_RESULT([yes])
13339     ENABLE_EXTENSION_UPDATE="TRUE"
13340     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
13341     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
13343 AC_SUBST(ENABLE_EXTENSION_UPDATE)
13346 dnl ===================================================================
13347 dnl Test whether to create MSI with LIMITUI=1 (silent install)
13348 dnl ===================================================================
13349 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
13350 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
13351     AC_MSG_RESULT([no])
13352     ENABLE_SILENT_MSI=
13353 else
13354     AC_MSG_RESULT([yes])
13355     ENABLE_SILENT_MSI=TRUE
13356     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
13358 AC_SUBST(ENABLE_SILENT_MSI)
13360 AC_MSG_CHECKING([whether and how to use Xinerama])
13361 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
13362     if test "$x_libraries" = "default_x_libraries"; then
13363         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
13364         if test "x$XINERAMALIB" = x; then
13365            XINERAMALIB="/usr/lib"
13366         fi
13367     else
13368         XINERAMALIB="$x_libraries"
13369     fi
13370     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
13371         # we have both versions, let the user decide but use the dynamic one
13372         # per default
13373         USE_XINERAMA=TRUE
13374         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
13375             XINERAMA_LINK=dynamic
13376         else
13377             XINERAMA_LINK=static
13378         fi
13379     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
13380         # we have only the dynamic version
13381         USE_XINERAMA=TRUE
13382         XINERAMA_LINK=dynamic
13383     elif test -e "$XINERAMALIB/libXinerama.a"; then
13384         # static version
13385         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
13386             USE_XINERAMA=TRUE
13387             XINERAMA_LINK=static
13388         else
13389             USE_XINERAMA=
13390             XINERAMA_LINK=none
13391         fi
13392     else
13393         # no Xinerama
13394         USE_XINERAMA=
13395         XINERAMA_LINK=none
13396     fi
13397     if test "$USE_XINERAMA" = "TRUE"; then
13398         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
13399         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
13400             [AC_MSG_ERROR(Xinerama header not found.)], [])
13401         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
13402         if test "x$XEXTLIB" = x; then
13403            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
13404         fi
13405         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
13406         if test "$_os" = "FreeBSD"; then
13407             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
13408         fi
13409         if test "$_os" = "Linux"; then
13410             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
13411         fi
13412         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
13413             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
13414     else
13415         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
13416     fi
13417 else
13418     USE_XINERAMA=
13419     XINERAMA_LINK=none
13420     AC_MSG_RESULT([no])
13422 AC_SUBST(USE_XINERAMA)
13423 AC_SUBST(XINERAMA_LINK)
13425 dnl ===================================================================
13426 dnl Test whether to build cairo or rely on the system version
13427 dnl ===================================================================
13429 if test "$test_cairo" = "yes"; then
13430     AC_MSG_CHECKING([whether to use the system cairo])
13432     : ${with_system_cairo:=$with_system_libs}
13433     if test "$with_system_cairo" = "yes"; then
13434         SYSTEM_CAIRO=TRUE
13435         AC_MSG_RESULT([yes])
13437         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
13438         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13439         FilterLibs "${CAIRO_LIBS}"
13440         CAIRO_LIBS="${filteredlibs}"
13442         if test "$test_xrender" = "yes"; then
13443             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
13444             AC_LANG_PUSH([C])
13445             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
13446 #ifdef PictStandardA8
13447 #else
13448       return fail;
13449 #endif
13450 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
13452             AC_LANG_POP([C])
13453         fi
13454     else
13455         AC_MSG_RESULT([no])
13456         BUILD_TYPE="$BUILD_TYPE CAIRO"
13457     fi
13459     if test "$enable_cairo_canvas" != no; then
13460         AC_DEFINE(ENABLE_CAIRO_CANVAS)
13461         ENABLE_CAIRO_CANVAS=TRUE
13462     fi
13465 AC_SUBST(CAIRO_CFLAGS)
13466 AC_SUBST(CAIRO_LIBS)
13467 AC_SUBST(ENABLE_CAIRO_CANVAS)
13468 AC_SUBST(SYSTEM_CAIRO)
13470 dnl ===================================================================
13471 dnl Test whether to use avahi
13472 dnl ===================================================================
13473 if test "$_os" = "WINNT"; then
13474     # Windows uses bundled mDNSResponder
13475     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
13476 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
13477     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
13478                       [ENABLE_AVAHI="TRUE"])
13479     AC_DEFINE(HAVE_FEATURE_AVAHI)
13480     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13481     FilterLibs "${AVAHI_LIBS}"
13482     AVAHI_LIBS="${filteredlibs}"
13485 AC_SUBST(ENABLE_AVAHI)
13486 AC_SUBST(AVAHI_CFLAGS)
13487 AC_SUBST(AVAHI_LIBS)
13489 dnl ===================================================================
13490 dnl Test whether to use liblangtag
13491 dnl ===================================================================
13492 SYSTEM_LIBLANGTAG=
13493 AC_MSG_CHECKING([whether to use system liblangtag])
13494 if test "$with_system_liblangtag" = yes; then
13495     SYSTEM_LIBLANGTAG=TRUE
13496     AC_MSG_RESULT([yes])
13497     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
13498     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
13499     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
13500     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13501     FilterLibs "${LIBLANGTAG_LIBS}"
13502     LIBLANGTAG_LIBS="${filteredlibs}"
13503 else
13504     SYSTEM_LIBLANGTAG=
13505     AC_MSG_RESULT([no])
13506     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
13507     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
13508     if test "$COM" = "MSC"; then
13509         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
13510     else
13511         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
13512     fi
13514 AC_SUBST(SYSTEM_LIBLANGTAG)
13515 AC_SUBST(LIBLANGTAG_CFLAGS)
13516 AC_SUBST(LIBLANGTAG_LIBS)
13518 dnl ===================================================================
13519 dnl Test whether to build libpng or rely on the system version
13520 dnl ===================================================================
13522 LIBPNG_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/libpng"
13523 LIBPNG_LIBS_internal="-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"
13524 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng])
13526 dnl ===================================================================
13527 dnl Test whether to build libwebp or rely on the system version
13528 dnl ===================================================================
13530 libo_CHECK_SYSTEM_MODULE([libwebp],[LIBWEBP],[libwebp])
13532 dnl ===================================================================
13533 dnl Check for runtime JVM search path
13534 dnl ===================================================================
13535 if test "$ENABLE_JAVA" != ""; then
13536     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
13537     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
13538         AC_MSG_RESULT([yes])
13539         if ! test -d "$with_jvm_path"; then
13540             AC_MSG_ERROR(["$with_jvm_path" not a directory])
13541         fi
13542         if ! test -d "$with_jvm_path"jvm; then
13543             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
13544         fi
13545         JVM_ONE_PATH_CHECK="$with_jvm_path"
13546         AC_SUBST(JVM_ONE_PATH_CHECK)
13547     else
13548         AC_MSG_RESULT([no])
13549     fi
13552 dnl ===================================================================
13553 dnl Test for the presence of Ant and that it works
13554 dnl ===================================================================
13556 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE" -a "$cross_compiling" != "yes"; then
13557     ANT_HOME=; export ANT_HOME
13558     WITH_ANT_HOME=; export WITH_ANT_HOME
13559     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
13560         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
13561             if test "$_os" = "WINNT"; then
13562                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
13563             else
13564                 with_ant_home="$LODE_HOME/opt/ant"
13565             fi
13566         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
13567             with_ant_home="$LODE_HOME/opt/ant"
13568         fi
13569     fi
13570     if test -z "$with_ant_home"; then
13571         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
13572     else
13573         if test "$_os" = "WINNT"; then
13574             # AC_PATH_PROGS needs unix path
13575             with_ant_home=`cygpath -u "$with_ant_home"`
13576         fi
13577         AbsolutePath "$with_ant_home"
13578         with_ant_home=$absolute_path
13579         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
13580         WITH_ANT_HOME=$with_ant_home
13581         ANT_HOME=$with_ant_home
13582     fi
13584     if test -z "$ANT"; then
13585         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
13586     else
13587         # resolve relative or absolute symlink
13588         while test -h "$ANT"; do
13589             a_cwd=`pwd`
13590             a_basename=`basename "$ANT"`
13591             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
13592             cd "`dirname "$ANT"`"
13593             cd "`dirname "$a_script"`"
13594             ANT="`pwd`"/"`basename "$a_script"`"
13595             cd "$a_cwd"
13596         done
13598         AC_MSG_CHECKING([if $ANT works])
13599         mkdir -p conftest.dir
13600         a_cwd=$(pwd)
13601         cd conftest.dir
13602         cat > conftest.java << EOF
13603         public class conftest {
13604             int testmethod(int a, int b) {
13605                     return a + b;
13606             }
13607         }
13610         cat > conftest.xml << EOF
13611         <project name="conftest" default="conftest">
13612         <target name="conftest">
13613             <javac srcdir="." includes="conftest.java">
13614             </javac>
13615         </target>
13616         </project>
13619         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
13620         if test $? = 0 -a -f ./conftest.class; then
13621             AC_MSG_RESULT([Ant works])
13622             if test -z "$WITH_ANT_HOME"; then
13623                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
13624                 if test -z "$ANT_HOME"; then
13625                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
13626                 fi
13627             else
13628                 ANT_HOME="$WITH_ANT_HOME"
13629             fi
13630         else
13631             echo "configure: Ant test failed" >&5
13632             cat conftest.java >&5
13633             cat conftest.xml >&5
13634             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
13635         fi
13636         cd "$a_cwd"
13637         rm -fr conftest.dir
13638     fi
13639     if test -z "$ANT_HOME"; then
13640         ANT_HOME="NO_ANT_HOME"
13641     else
13642         PathFormat "$ANT_HOME"
13643         ANT_HOME="$formatted_path"
13644         PathFormat "$ANT"
13645         ANT="$formatted_path"
13646     fi
13648     dnl Checking for ant.jar
13649     if test "$ANT_HOME" != "NO_ANT_HOME"; then
13650         AC_MSG_CHECKING([Ant lib directory])
13651         if test -f $ANT_HOME/lib/ant.jar; then
13652             ANT_LIB="$ANT_HOME/lib"
13653         else
13654             if test -f $ANT_HOME/ant.jar; then
13655                 ANT_LIB="$ANT_HOME"
13656             else
13657                 if test -f /usr/share/java/ant.jar; then
13658                     ANT_LIB=/usr/share/java
13659                 else
13660                     if test -f /usr/share/ant-core/lib/ant.jar; then
13661                         ANT_LIB=/usr/share/ant-core/lib
13662                     else
13663                         if test -f $ANT_HOME/lib/ant/ant.jar; then
13664                             ANT_LIB="$ANT_HOME/lib/ant"
13665                         else
13666                             if test -f /usr/share/lib/ant/ant.jar; then
13667                                 ANT_LIB=/usr/share/lib/ant
13668                             else
13669                                 AC_MSG_ERROR([Ant libraries not found!])
13670                             fi
13671                         fi
13672                     fi
13673                 fi
13674             fi
13675         fi
13676         PathFormat "$ANT_LIB"
13677         ANT_LIB="$formatted_path"
13678         AC_MSG_RESULT([Ant lib directory found.])
13679     fi
13681     ant_minver=1.6.0
13682     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
13684     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
13685     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
13686     ant_version_major=`echo $ant_version | cut -d. -f1`
13687     ant_version_minor=`echo $ant_version | cut -d. -f2`
13688     echo "configure: ant_version $ant_version " >&5
13689     echo "configure: ant_version_major $ant_version_major " >&5
13690     echo "configure: ant_version_minor $ant_version_minor " >&5
13691     if test "$ant_version_major" -ge "2"; then
13692         AC_MSG_RESULT([yes, $ant_version])
13693     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
13694         AC_MSG_RESULT([yes, $ant_version])
13695     else
13696         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
13697     fi
13699     rm -f conftest* core core.* *.core
13701 AC_SUBST(ANT)
13702 AC_SUBST(ANT_HOME)
13703 AC_SUBST(ANT_LIB)
13705 OOO_JUNIT_JAR=
13706 HAMCREST_JAR=
13707 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no" -a "$cross_compiling" != "yes"; then
13708     AC_MSG_CHECKING([for JUnit 4])
13709     if test "$with_junit" = "yes"; then
13710         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
13711             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
13712         elif test -e /usr/share/java/junit4.jar; then
13713             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
13714         else
13715            if test -e /usr/share/lib/java/junit.jar; then
13716               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
13717            else
13718               OOO_JUNIT_JAR=/usr/share/java/junit.jar
13719            fi
13720         fi
13721     else
13722         OOO_JUNIT_JAR=$with_junit
13723     fi
13724     if test "$_os" = "WINNT"; then
13725         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
13726     fi
13727     printf 'import org.junit.Before;' > conftest.java
13728     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
13729         AC_MSG_RESULT([$OOO_JUNIT_JAR])
13730     else
13731         AC_MSG_ERROR(
13732 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
13733  specify its pathname via --with-junit=..., or disable it via --without-junit])
13734     fi
13735     rm -f conftest.class conftest.java
13736     if test $OOO_JUNIT_JAR != ""; then
13737         BUILD_TYPE="$BUILD_TYPE QADEVOOO"
13738     fi
13740     AC_MSG_CHECKING([for included Hamcrest])
13741     printf 'import org.hamcrest.BaseDescription;' > conftest.java
13742     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
13743         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
13744     else
13745         AC_MSG_RESULT([Not included])
13746         AC_MSG_CHECKING([for standalone hamcrest jar.])
13747         if test "$with_hamcrest" = "yes"; then
13748             if test -e /usr/share/lib/java/hamcrest.jar; then
13749                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
13750             elif test -e /usr/share/java/hamcrest/core.jar; then
13751                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
13752             elif test -e /usr/share/java/hamcrest/hamcrest.jar; then
13753                 HAMCREST_JAR=/usr/share/java/hamcrest/hamcrest.jar
13754             else
13755                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
13756             fi
13757         else
13758             HAMCREST_JAR=$with_hamcrest
13759         fi
13760         if test "$_os" = "WINNT"; then
13761             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
13762         fi
13763         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
13764             AC_MSG_RESULT([$HAMCREST_JAR])
13765         else
13766             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),
13767                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
13768         fi
13769     fi
13770     rm -f conftest.class conftest.java
13772 AC_SUBST(OOO_JUNIT_JAR)
13773 AC_SUBST(HAMCREST_JAR)
13776 AC_SUBST(SCPDEFS)
13779 # check for wget and curl
13781 WGET=
13782 CURL=
13784 if test "$enable_fetch_external" != "no"; then
13786 CURL=`which curl 2>/dev/null`
13788 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
13789     # wget new enough?
13790     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
13791     if test $? -eq 0; then
13792         WGET=$i
13793         break
13794     fi
13795 done
13797 if test -z "$WGET" -a -z "$CURL"; then
13798     AC_MSG_ERROR([neither wget nor curl found!])
13803 AC_SUBST(WGET)
13804 AC_SUBST(CURL)
13807 # check for sha256sum
13809 SHA256SUM=
13811 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
13812     eval "$i -a 256 --version" > /dev/null 2>&1
13813     ret=$?
13814     if test $ret -eq 0; then
13815         SHA256SUM="$i -a 256"
13816         break
13817     fi
13818 done
13820 if test -z "$SHA256SUM"; then
13821     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
13822         eval "$i --version" > /dev/null 2>&1
13823         ret=$?
13824         if test $ret -eq 0; then
13825             SHA256SUM=$i
13826             break
13827         fi
13828     done
13831 if test -z "$SHA256SUM"; then
13832     AC_MSG_ERROR([no sha256sum found!])
13835 AC_SUBST(SHA256SUM)
13837 dnl ===================================================================
13838 dnl Dealing with l10n options
13839 dnl ===================================================================
13840 AC_MSG_CHECKING([which languages to be built])
13841 # get list of all languages
13842 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
13843 # the sed command does the following:
13844 #   + if a line ends with a backslash, append the next line to it
13845 #   + adds " on the beginning of the value (after =)
13846 #   + adds " at the end of the value
13847 #   + removes en-US; we want to put it on the beginning
13848 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
13849 [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)]
13850 ALL_LANGS="en-US $completelangiso"
13851 # check the configured localizations
13852 WITH_LANG="$with_lang"
13854 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
13855 # (Norwegian is "nb" and "nn".)
13856 if test "$WITH_LANG" = "no"; then
13857     WITH_LANG=
13860 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
13861     AC_MSG_RESULT([en-US])
13862 else
13863     AC_MSG_RESULT([$WITH_LANG])
13864     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
13865     if test -z "$MSGFMT"; then
13866         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
13867             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
13868         elif test -x "/opt/lo/bin/msgfmt"; then
13869             MSGFMT="/opt/lo/bin/msgfmt"
13870         else
13871             AC_CHECK_PROGS(MSGFMT, [msgfmt])
13872             if test -z "$MSGFMT"; then
13873                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
13874             fi
13875         fi
13876     fi
13877     if test -z "$MSGUNIQ"; then
13878         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
13879             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
13880         elif test -x "/opt/lo/bin/msguniq"; then
13881             MSGUNIQ="/opt/lo/bin/msguniq"
13882         else
13883             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
13884             if test -z "$MSGUNIQ"; then
13885                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
13886             fi
13887         fi
13888     fi
13890 AC_SUBST(MSGFMT)
13891 AC_SUBST(MSGUNIQ)
13892 # check that the list is valid
13893 for lang in $WITH_LANG; do
13894     test "$lang" = "ALL" && continue
13895     # need to check for the exact string, so add space before and after the list of all languages
13896     for vl in $ALL_LANGS; do
13897         if test "$vl" = "$lang"; then
13898            break
13899         fi
13900     done
13901     if test "$vl" != "$lang"; then
13902         # if you're reading this - you prolly quoted your languages remove the quotes ...
13903         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
13904     fi
13905 done
13906 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
13907     echo $WITH_LANG | grep -q en-US
13908     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
13910 # list with substituted ALL
13911 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
13912 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
13913 test "$WITH_LANG" = "en-US" && WITH_LANG=
13914 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
13915     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
13916     ALL_LANGS=`echo $ALL_LANGS qtz`
13918 AC_SUBST(ALL_LANGS)
13919 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
13920 AC_SUBST(WITH_LANG)
13921 AC_SUBST(WITH_LANG_LIST)
13922 AC_SUBST(GIT_NEEDED_SUBMODULES)
13924 WITH_POOR_HELP_LOCALIZATIONS=
13925 if test -d "$SRC_ROOT/translations/source"; then
13926     for l in `ls -1 $SRC_ROOT/translations/source`; do
13927         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
13928             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
13929         fi
13930     done
13932 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
13934 if test -n "$with_locales" -a "$with_locales" != ALL; then
13935     WITH_LOCALES="$with_locales"
13937     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
13938     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
13939     # config_host/config_locales.h.in
13940     for locale in $WITH_LOCALES; do
13941         lang=${locale%_*}
13943         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
13945         case $lang in
13946         hi|mr*ne)
13947             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
13948             ;;
13949         bg|ru)
13950             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
13951             ;;
13952         esac
13953     done
13954 else
13955     AC_DEFINE(WITH_LOCALE_ALL)
13957 AC_SUBST(WITH_LOCALES)
13959 dnl git submodule update --reference
13960 dnl ===================================================================
13961 if test -n "${GIT_REFERENCE_SRC}"; then
13962     for repo in ${GIT_NEEDED_SUBMODULES}; do
13963         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
13964             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
13965         fi
13966     done
13968 AC_SUBST(GIT_REFERENCE_SRC)
13970 dnl git submodules linked dirs
13971 dnl ===================================================================
13972 if test -n "${GIT_LINK_SRC}"; then
13973     for repo in ${GIT_NEEDED_SUBMODULES}; do
13974         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
13975             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
13976         fi
13977     done
13979 AC_SUBST(GIT_LINK_SRC)
13981 dnl branding
13982 dnl ===================================================================
13983 AC_MSG_CHECKING([for alternative branding images directory])
13984 # initialize mapped arrays
13985 BRAND_INTRO_IMAGES="intro.png intro-highres.png"
13986 brand_files="$BRAND_INTRO_IMAGES logo.svg logo_inverted.svg logo-sc.svg logo-sc_inverted.svg about.svg"
13988 if test -z "$with_branding" -o "$with_branding" = "no"; then
13989     AC_MSG_RESULT([none])
13990     DEFAULT_BRAND_IMAGES="$brand_files"
13991 else
13992     if ! test -d $with_branding ; then
13993         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
13994     else
13995         AC_MSG_RESULT([$with_branding])
13996         CUSTOM_BRAND_DIR="$with_branding"
13997         for lfile in $brand_files
13998         do
13999             if ! test -f $with_branding/$lfile ; then
14000                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
14001                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
14002             else
14003                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
14004             fi
14005         done
14006         check_for_progress="yes"
14007     fi
14009 AC_SUBST([BRAND_INTRO_IMAGES])
14010 AC_SUBST([CUSTOM_BRAND_DIR])
14011 AC_SUBST([CUSTOM_BRAND_IMAGES])
14012 AC_SUBST([DEFAULT_BRAND_IMAGES])
14015 AC_MSG_CHECKING([for 'intro' progress settings])
14016 PROGRESSBARCOLOR=
14017 PROGRESSSIZE=
14018 PROGRESSPOSITION=
14019 PROGRESSFRAMECOLOR=
14020 PROGRESSTEXTCOLOR=
14021 PROGRESSTEXTBASELINE=
14023 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
14024     source "$with_branding/progress.conf"
14025     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
14026 else
14027     AC_MSG_RESULT([none])
14030 AC_SUBST(PROGRESSBARCOLOR)
14031 AC_SUBST(PROGRESSSIZE)
14032 AC_SUBST(PROGRESSPOSITION)
14033 AC_SUBST(PROGRESSFRAMECOLOR)
14034 AC_SUBST(PROGRESSTEXTCOLOR)
14035 AC_SUBST(PROGRESSTEXTBASELINE)
14038 dnl ===================================================================
14039 dnl Custom build version
14040 dnl ===================================================================
14041 AC_MSG_CHECKING([for extra build ID])
14042 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
14043     EXTRA_BUILDID="$with_extra_buildid"
14045 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
14046 if test -n "$EXTRA_BUILDID" ; then
14047     AC_MSG_RESULT([$EXTRA_BUILDID])
14048 else
14049     AC_MSG_RESULT([not set])
14051 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
14053 OOO_VENDOR=
14054 AC_MSG_CHECKING([for vendor])
14055 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
14056     OOO_VENDOR="$USERNAME"
14058     if test -z "$OOO_VENDOR"; then
14059         OOO_VENDOR="$USER"
14060     fi
14062     if test -z "$OOO_VENDOR"; then
14063         OOO_VENDOR="`id -u -n`"
14064     fi
14066     AC_MSG_RESULT([not set, using $OOO_VENDOR])
14067 else
14068     OOO_VENDOR="$with_vendor"
14069     AC_MSG_RESULT([$OOO_VENDOR])
14071 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
14072 AC_SUBST(OOO_VENDOR)
14074 if test "$_os" = "Android" ; then
14075     ANDROID_PACKAGE_NAME=
14076     AC_MSG_CHECKING([for Android package name])
14077     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
14078         if test -n "$ENABLE_DEBUG"; then
14079             # Default to the package name that makes ndk-gdb happy.
14080             ANDROID_PACKAGE_NAME="org.libreoffice"
14081         else
14082             ANDROID_PACKAGE_NAME="org.example.libreoffice"
14083         fi
14085         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
14086     else
14087         ANDROID_PACKAGE_NAME="$with_android_package_name"
14088         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
14089     fi
14090     AC_SUBST(ANDROID_PACKAGE_NAME)
14093 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
14094 if test "$with_compat_oowrappers" = "yes"; then
14095     WITH_COMPAT_OOWRAPPERS=TRUE
14096     AC_MSG_RESULT(yes)
14097 else
14098     WITH_COMPAT_OOWRAPPERS=
14099     AC_MSG_RESULT(no)
14101 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
14103 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
14104 AC_MSG_CHECKING([for install dirname])
14105 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
14106     INSTALLDIRNAME="$with_install_dirname"
14108 AC_MSG_RESULT([$INSTALLDIRNAME])
14109 AC_SUBST(INSTALLDIRNAME)
14111 AC_MSG_CHECKING([for prefix])
14112 test "x$prefix" = xNONE && prefix=$ac_default_prefix
14113 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
14114 PREFIXDIR="$prefix"
14115 AC_MSG_RESULT([$PREFIXDIR])
14116 AC_SUBST(PREFIXDIR)
14118 LIBDIR=[$(eval echo $(eval echo $libdir))]
14119 AC_SUBST(LIBDIR)
14121 DATADIR=[$(eval echo $(eval echo $datadir))]
14122 AC_SUBST(DATADIR)
14124 MANDIR=[$(eval echo $(eval echo $mandir))]
14125 AC_SUBST(MANDIR)
14127 DOCDIR=[$(eval echo $(eval echo $docdir))]
14128 AC_SUBST(DOCDIR)
14130 BINDIR=[$(eval echo $(eval echo $bindir))]
14131 AC_SUBST(BINDIR)
14133 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
14134 AC_SUBST(INSTALLDIR)
14136 TESTINSTALLDIR="${BUILDDIR}/test-install"
14137 AC_SUBST(TESTINSTALLDIR)
14140 # ===================================================================
14141 # OAuth2 id and secrets
14142 # ===================================================================
14144 AC_MSG_CHECKING([for Google Drive client id and secret])
14145 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
14146     AC_MSG_RESULT([not set])
14147     GDRIVE_CLIENT_ID="\"\""
14148     GDRIVE_CLIENT_SECRET="\"\""
14149 else
14150     AC_MSG_RESULT([set])
14151     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
14152     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
14154 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
14155 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
14157 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
14158 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
14159     AC_MSG_RESULT([not set])
14160     ALFRESCO_CLOUD_CLIENT_ID="\"\""
14161     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
14162 else
14163     AC_MSG_RESULT([set])
14164     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
14165     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
14167 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
14168 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
14170 AC_MSG_CHECKING([for OneDrive client id and secret])
14171 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
14172     AC_MSG_RESULT([not set])
14173     ONEDRIVE_CLIENT_ID="\"\""
14174     ONEDRIVE_CLIENT_SECRET="\"\""
14175 else
14176     AC_MSG_RESULT([set])
14177     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
14178     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
14180 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
14181 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
14184 dnl ===================================================================
14185 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
14186 dnl --enable-dependency-tracking configure option
14187 dnl ===================================================================
14188 AC_MSG_CHECKING([whether to enable dependency tracking])
14189 if test "$enable_dependency_tracking" = "no"; then
14190     nodep=TRUE
14191     AC_MSG_RESULT([no])
14192 else
14193     AC_MSG_RESULT([yes])
14195 AC_SUBST(nodep)
14197 dnl ===================================================================
14198 dnl Number of CPUs to use during the build
14199 dnl ===================================================================
14200 AC_MSG_CHECKING([for number of processors to use])
14201 # plain --with-parallelism is just the default
14202 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
14203     if test "$with_parallelism" = "no"; then
14204         PARALLELISM=0
14205     else
14206         PARALLELISM=$with_parallelism
14207     fi
14208 else
14209     if test "$enable_icecream" = "yes"; then
14210         PARALLELISM="40"
14211     else
14212         case `uname -s` in
14214         Darwin|FreeBSD|NetBSD|OpenBSD)
14215             PARALLELISM=`sysctl -n hw.ncpu`
14216             ;;
14218         Linux)
14219             PARALLELISM=`getconf _NPROCESSORS_ONLN`
14220         ;;
14221         # what else than above does profit here *and* has /proc?
14222         *)
14223             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
14224             ;;
14225         esac
14227         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
14228         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
14229     fi
14232 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
14233     if test -z "$with_parallelism"; then
14234             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
14235             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
14236             PARALLELISM="1"
14237     else
14238         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."
14239     fi
14242 if test $PARALLELISM -eq 0; then
14243     AC_MSG_RESULT([explicit make -j option needed])
14244 else
14245     AC_MSG_RESULT([$PARALLELISM])
14247 AC_SUBST(PARALLELISM)
14249 IWYU_PATH="$with_iwyu"
14250 AC_SUBST(IWYU_PATH)
14251 if test ! -z "$IWYU_PATH"; then
14252     if test ! -f "$IWYU_PATH"; then
14253         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
14254     fi
14258 # Set up ILIB for MSVC build
14260 ILIB1=
14261 if test "$build_os" = "cygwin"; then
14262     ILIB="."
14263     if test -n "$JAVA_HOME"; then
14264         ILIB="$ILIB;$JAVA_HOME/lib"
14265     fi
14266     ILIB1=-link
14267     ILIB="$ILIB;$COMPATH/lib/$WIN_HOST_ARCH"
14268     ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/$WIN_HOST_ARCH"
14269     ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
14270     ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
14271     if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
14272         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
14273         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
14274     fi
14275     PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/$WIN_HOST_ARCH"
14276     ucrtlibpath_formatted=$formatted_path
14277     ILIB="$ILIB;$ucrtlibpath_formatted"
14278     ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
14279     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
14280         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
14281     else
14282         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WIN_HOST_ARCH"
14283     fi
14285     if test "$cross_compiling" != "yes"; then
14286         ILIB_FOR_BUILD="$ILIB"
14287     fi
14289 AC_SUBST(ILIB)
14290 AC_SUBST(ILIB_FOR_BUILD)
14292 AC_MSG_CHECKING([whether $CXX_BASE supports a working C++20 consteval])
14293 dnl ...that does not suffer from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96994> "Missing code
14294 dnl from consteval constructor initializing const variable",
14295 dnl <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98752> "wrong 'error: â€˜this’ is not a constant
14296 dnl expression' with consteval constructor", <https://bugs.llvm.org/show_bug.cgi?id=50063> "code
14297 dnl using consteval: 'clang/lib/CodeGen/Address.h:38: llvm::Value*
14298 dnl clang::CodeGen::Address::getPointer() const: Assertion `isValid()' failed.'", or
14299 dnl <https://developercommunity.visualstudio.com/t/1581879> "Bogus error C7595 with consteval
14300 dnl constructor in ternary expression (/std:c++latest)":
14301 AC_LANG_PUSH([C++])
14302 save_CXX=$CXX
14303 if test "$COM" = MSC && test "$COM_IS_CLANG" != TRUE; then
14304     CXX="env LIB=$ILIB $CXX"
14306 save_CXXFLAGS=$CXXFLAGS
14307 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
14308 AC_RUN_IFELSE([AC_LANG_PROGRAM([
14309         struct S {
14310             consteval S() { i = 1; }
14311             int i = 0;
14312         };
14313         S const s;
14315         struct S1 { consteval S1(int) {} };
14316         struct S2 {
14317             S1 x;
14318             S2(): x(0) {}
14319         };
14321         struct S3 {
14322             consteval S3() {}
14323             union {
14324                 int a;
14325                 unsigned b = 0;
14326             };
14327         };
14328         void f() { S3(); }
14330         struct S4 { consteval S4() = default; };
14331         void f4(bool b) { b ? S4() : S4(); }
14332     ], [
14333         return (s.i == 1) ? 0 : 1;
14334     ])], [
14335         AC_DEFINE([HAVE_CPP_CONSTEVAL],[1])
14336         AC_MSG_RESULT([yes])
14337     ], [AC_MSG_RESULT([no])], [AC_MSG_RESULT([assumed no (cross compiling)])])
14338 CXX=$save_CXX
14339 CXXFLAGS=$save_CXXFLAGS
14340 AC_LANG_POP([C++])
14342 # ===================================================================
14343 # Creating bigger shared library to link against
14344 # ===================================================================
14345 AC_MSG_CHECKING([whether to create huge library])
14346 MERGELIBS=
14348 if test $_os = iOS -o $_os = Android; then
14349     # Never any point in mergelibs for these as we build just static
14350     # libraries anyway...
14351     enable_mergelibs=no
14354 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
14355     if test $_os != Linux -a $_os != WINNT; then
14356         add_warning "--enable-mergelibs is not tested for this platform"
14357     fi
14358     MERGELIBS="TRUE"
14359     AC_MSG_RESULT([yes])
14360     AC_DEFINE(ENABLE_MERGELIBS)
14361 else
14362     AC_MSG_RESULT([no])
14364 AC_SUBST([MERGELIBS])
14366 dnl ===================================================================
14367 dnl icerun is a wrapper that stops us spawning tens of processes
14368 dnl locally - for tools that can't be executed on the compile cluster
14369 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
14370 dnl ===================================================================
14371 AC_MSG_CHECKING([whether to use icerun wrapper])
14372 ICECREAM_RUN=
14373 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
14374     ICECREAM_RUN=icerun
14375     AC_MSG_RESULT([yes])
14376 else
14377     AC_MSG_RESULT([no])
14379 AC_SUBST(ICECREAM_RUN)
14381 dnl ===================================================================
14382 dnl Setup the ICECC_VERSION for the build the same way it was set for
14383 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
14384 dnl ===================================================================
14385 x_ICECC_VERSION=[\#]
14386 if test -n "$ICECC_VERSION" ; then
14387     x_ICECC_VERSION=
14389 AC_SUBST(x_ICECC_VERSION)
14390 AC_SUBST(ICECC_VERSION)
14392 dnl ===================================================================
14394 AC_MSG_CHECKING([MPL subset])
14395 MPL_SUBSET=
14397 if test "$enable_mpl_subset" = "yes"; then
14398     warn_report=false
14399     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
14400         warn_report=true
14401     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
14402         warn_report=true
14403     fi
14404     if test "$warn_report" = "true"; then
14405         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
14406     fi
14407     if test "x$enable_postgresql_sdbc" != "xno"; then
14408         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
14409     fi
14410     if test "$enable_lotuswordpro" = "yes"; then
14411         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
14412     fi
14413     if test -n "$ENABLE_POPPLER"; then
14414         if test "x$SYSTEM_POPPLER" = "x"; then
14415             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
14416         fi
14417     fi
14418     # cf. m4/libo_check_extension.m4
14419     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
14420         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
14421     fi
14422     for theme in $WITH_THEMES; do
14423         case $theme in
14424         breeze|breeze_dark|breeze_dark_svg|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #denylist of icon themes under GPL or LGPL
14425             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=colibre]) ;;
14426         *) : ;;
14427         esac
14428     done
14430     ENABLE_OPENGL_TRANSITIONS=
14432     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
14433         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
14434     fi
14436     MPL_SUBSET="TRUE"
14437     AC_DEFINE(MPL_HAVE_SUBSET)
14438     AC_MSG_RESULT([only])
14439 else
14440     AC_MSG_RESULT([no restrictions])
14442 AC_SUBST(MPL_SUBSET)
14444 dnl ===================================================================
14446 AC_MSG_CHECKING([formula logger])
14447 ENABLE_FORMULA_LOGGER=
14449 if test "x$enable_formula_logger" = "xyes"; then
14450     AC_MSG_RESULT([yes])
14451     AC_DEFINE(ENABLE_FORMULA_LOGGER)
14452     ENABLE_FORMULA_LOGGER=TRUE
14453 elif test -n "$ENABLE_DBGUTIL" ; then
14454     AC_MSG_RESULT([yes])
14455     AC_DEFINE(ENABLE_FORMULA_LOGGER)
14456     ENABLE_FORMULA_LOGGER=TRUE
14457 else
14458     AC_MSG_RESULT([no])
14461 AC_SUBST(ENABLE_FORMULA_LOGGER)
14463 dnl ===================================================================
14464 dnl Checking for active Antivirus software.
14465 dnl ===================================================================
14467 if test $_os = WINNT -a -f "$SRC_ROOT/antivirusDetection.vbs" ; then
14468     AC_MSG_CHECKING([for active Antivirus software])
14469     ANTIVIRUS_LIST=`cscript.exe //Nologo $SRC_ROOT/antivirusDetection.vbs`
14470     if [ [ "$ANTIVIRUS_LIST" != "NULL" ] ]; then
14471         if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then
14472             AC_MSG_RESULT([found])
14473             EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
14474             echo $EICAR_STRING > $SRC_ROOT/eicar
14475             EICAR_TEMP_FILE_CONTENTS=`cat $SRC_ROOT/eicar`
14476             rm $SRC_ROOT/eicar
14477             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
14478                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
14479             fi
14480             echo $EICAR_STRING > $BUILDDIR/eicar
14481             EICAR_TEMP_FILE_CONTENTS=`cat $BUILDDIR/eicar`
14482             rm $BUILDDIR/eicar
14483             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
14484                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
14485             fi
14486             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"
14487         else
14488             AC_MSG_RESULT([not found])
14489         fi
14490     else
14491         AC_MSG_RESULT([n/a])
14492     fi
14495 dnl ===================================================================
14496 dnl Setting up the environment.
14497 dnl ===================================================================
14498 AC_MSG_NOTICE([setting up the build environment variables...])
14500 AC_SUBST(COMPATH)
14502 if test "$build_os" = "cygwin"; then
14503     if test -d "$COMPATH/atlmfc/lib/spectre"; then
14504         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
14505         ATL_INCLUDE="$COMPATH/atlmfc/include"
14506     elif test -d "$COMPATH/atlmfc/lib"; then
14507         ATL_LIB="$COMPATH/atlmfc/lib"
14508         ATL_INCLUDE="$COMPATH/atlmfc/include"
14509     else
14510         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
14511         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
14512     fi
14513     ATL_LIB="$ATL_LIB/$WIN_HOST_ARCH"
14514     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
14515     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
14517     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
14518     PathFormat "/usr/bin/find.exe"
14519     FIND="$formatted_path"
14520     PathFormat "/usr/bin/sort.exe"
14521     SORT="$formatted_path"
14522     PathFormat "/usr/bin/grep.exe"
14523     WIN_GREP="$formatted_path"
14524     PathFormat "/usr/bin/ls.exe"
14525     WIN_LS="$formatted_path"
14526     PathFormat "/usr/bin/touch.exe"
14527     WIN_TOUCH="$formatted_path"
14528 else
14529     FIND=find
14530     SORT=sort
14533 AC_SUBST(ATL_INCLUDE)
14534 AC_SUBST(ATL_LIB)
14535 AC_SUBST(FIND)
14536 AC_SUBST(SORT)
14537 AC_SUBST(WIN_GREP)
14538 AC_SUBST(WIN_LS)
14539 AC_SUBST(WIN_TOUCH)
14541 AC_SUBST(BUILD_TYPE)
14543 AC_SUBST(SOLARINC)
14545 PathFormat "$PERL"
14546 PERL="$formatted_path"
14547 AC_SUBST(PERL)
14549 if test -n "$TMPDIR"; then
14550     TEMP_DIRECTORY="$TMPDIR"
14551 else
14552     TEMP_DIRECTORY="/tmp"
14554 if test "$build_os" = "cygwin"; then
14555     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
14557 AC_SUBST(TEMP_DIRECTORY)
14559 # setup the PATH for the environment
14560 if test -n "$LO_PATH_FOR_BUILD"; then
14561     LO_PATH="$LO_PATH_FOR_BUILD"
14562     case "$host_os" in
14563     cygwin*|wsl*)
14564         pathmunge "$MSVC_HOST_PATH" "before"
14565         ;;
14566     esac
14567 else
14568     LO_PATH="$PATH"
14570     case "$host_os" in
14572     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
14573         if test "$ENABLE_JAVA" != ""; then
14574             pathmunge "$JAVA_HOME/bin" "after"
14575         fi
14576         ;;
14578     cygwin*|wsl*)
14579         # Win32 make needs native paths
14580         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
14581             LO_PATH=`cygpath -p -m "$PATH"`
14582         fi
14583         if test "$WIN_BUILD_ARCH" = "x64"; then
14584             # needed for msi packaging
14585             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
14586         fi
14587         # .NET 4.6 and higher don't have bin directory
14588         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
14589             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
14590         fi
14591         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
14592         pathmunge "$CSC_PATH" "before"
14593         pathmunge "$MIDL_PATH" "before"
14594         pathmunge "$AL_PATH" "before"
14595         pathmunge "$MSVC_MULTI_PATH" "before"
14596         pathmunge "$MSVC_BUILD_PATH" "before"
14597         if test -n "$MSBUILD_PATH" ; then
14598             pathmunge "$MSBUILD_PATH" "before"
14599         fi
14600         pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/$WIN_BUILD_ARCH" "before"
14601         if test "$ENABLE_JAVA" != ""; then
14602             if test -d "$JAVA_HOME/jre/bin/client"; then
14603                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
14604             fi
14605             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
14606                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
14607             fi
14608             pathmunge "$JAVA_HOME/bin" "before"
14609         fi
14610         pathmunge "$MSVC_HOST_PATH" "before"
14611         ;;
14613     solaris*)
14614         pathmunge "/usr/css/bin" "before"
14615         if test "$ENABLE_JAVA" != ""; then
14616             pathmunge "$JAVA_HOME/bin" "after"
14617         fi
14618         ;;
14619     esac
14622 AC_SUBST(LO_PATH)
14624 # Allow to pass LO_ELFCHECK_ALLOWLIST from autogen.input to bin/check-elf-dynamic-objects:
14625 if test "$LO_ELFCHECK_ALLOWLIST" = x || test "${LO_ELFCHECK_ALLOWLIST-x}" != x; then
14626     x_LO_ELFCHECK_ALLOWLIST=
14627 else
14628     x_LO_ELFCHECK_ALLOWLIST=[\#]
14630 AC_SUBST(x_LO_ELFCHECK_ALLOWLIST)
14631 AC_SUBST(LO_ELFCHECK_ALLOWLIST)
14633 libo_FUZZ_SUMMARY
14635 # Generate a configuration sha256 we can use for deps
14636 if test -f config_host.mk; then
14637     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
14639 if test -f config_host_lang.mk; then
14640     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
14643 CFLAGS=$my_original_CFLAGS
14644 CXXFLAGS=$my_original_CXXFLAGS
14645 CPPFLAGS=$my_original_CPPFLAGS
14647 AC_CONFIG_LINKS([include:include])
14649 # Keep in sync with list of files far up, at AC_MSG_CHECKING([for
14650 # BUILD platform configuration] - otherwise breaks cross building
14651 AC_CONFIG_FILES([config_host.mk
14652                  config_host_lang.mk
14653                  Makefile
14654                  bin/bffvalidator.sh
14655                  bin/odfvalidator.sh
14656                  bin/officeotron.sh
14657                  hardened_runtime.xcent
14658                  instsetoo_native/util/openoffice.lst
14659                  sysui/desktop/macosx/Info.plist
14660                  vs-code.code-workspace.template:.vscode/vs-code-template.code-workspace.in])
14661 AC_CONFIG_HEADERS([config_host/config_buildid.h])
14662 AC_CONFIG_HEADERS([config_host/config_box2d.h])
14663 AC_CONFIG_HEADERS([config_host/config_clang.h])
14664 AC_CONFIG_HEADERS([config_host/config_crypto.h])
14665 AC_CONFIG_HEADERS([config_host/config_dconf.h])
14666 AC_CONFIG_HEADERS([config_host/config_eot.h])
14667 AC_CONFIG_HEADERS([config_host/config_extensions.h])
14668 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
14669 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
14670 AC_CONFIG_HEADERS([config_host/config_dbus.h])
14671 AC_CONFIG_HEADERS([config_host/config_features.h])
14672 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
14673 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
14674 AC_CONFIG_HEADERS([config_host/config_firebird.h])
14675 AC_CONFIG_HEADERS([config_host/config_folders.h])
14676 AC_CONFIG_HEADERS([config_host/config_fonts.h])
14677 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
14678 AC_CONFIG_HEADERS([config_host/config_gio.h])
14679 AC_CONFIG_HEADERS([config_host/config_global.h])
14680 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
14681 AC_CONFIG_HEADERS([config_host/config_java.h])
14682 AC_CONFIG_HEADERS([config_host/config_langs.h])
14683 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
14684 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
14685 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
14686 AC_CONFIG_HEADERS([config_host/config_locales.h])
14687 AC_CONFIG_HEADERS([config_host/config_mpl.h])
14688 AC_CONFIG_HEADERS([config_host/config_oox.h])
14689 AC_CONFIG_HEADERS([config_host/config_options.h])
14690 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
14691 AC_CONFIG_HEADERS([config_host/config_zxing.h])
14692 AC_CONFIG_HEADERS([config_host/config_skia.h])
14693 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
14694 AC_CONFIG_HEADERS([config_host/config_vendor.h])
14695 AC_CONFIG_HEADERS([config_host/config_vcl.h])
14696 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
14697 AC_CONFIG_HEADERS([config_host/config_version.h])
14698 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
14699 AC_CONFIG_HEADERS([config_host/config_poppler.h])
14700 AC_CONFIG_HEADERS([config_host/config_python.h])
14701 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
14702 AC_CONFIG_HEADERS([config_host/config_wasm_strip.h])
14703 AC_CONFIG_HEADERS([solenv/lockfile/autoconf.h])
14704 AC_OUTPUT
14706 if test "$CROSS_COMPILING" = TRUE; then
14707     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
14710 # touch the config timestamp file
14711 if test ! -f config_host.mk.stamp; then
14712     echo > config_host.mk.stamp
14713 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
14714     echo "Host Configuration unchanged - avoiding scp2 stamp update"
14715 else
14716     echo > config_host.mk.stamp
14719 # touch the config lang timestamp file
14720 if test ! -f config_host_lang.mk.stamp; then
14721     echo > config_host_lang.mk.stamp
14722 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
14723     echo "Language Configuration unchanged - avoiding scp2 stamp update"
14724 else
14725     echo > config_host_lang.mk.stamp
14729 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
14730         -a "$build_os" = "cygwin"; then
14732 cat << _EOS
14733 ****************************************************************************
14734 WARNING:
14735 Your make version is known to be horribly slow, and hard to debug
14736 problems with. To get a reasonably functional make please do:
14738 to install a pre-compiled binary make for Win32
14740  mkdir -p /opt/lo/bin
14741  cd /opt/lo/bin
14742  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
14743  cp make-4.2.1-msvc.exe make
14744  chmod +x make
14746 to install from source:
14747 place yourself in a working directory of you choice.
14749  git clone git://git.savannah.gnu.org/make.git
14751  [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"]
14752  set PATH=%PATH%;C:\Cygwin\bin
14753  [or Cygwin64, if that is what you have]
14754  cd path-to-make-repo-you-cloned-above
14755  build_w32.bat --without-guile
14757 should result in a WinRel/gnumake.exe.
14758 Copy it to the Cygwin /opt/lo/bin directory as make.exe
14760 Then re-run autogen.sh
14762 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
14763 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
14765 _EOS
14766 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
14767     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
14772 cat << _EOF
14773 ****************************************************************************
14775 To show information on various make targets and make flags, run:
14776 $GNUMAKE help
14778 To just build, run:
14779 $GNUMAKE
14781 _EOF
14783 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
14784     cat << _EOF
14785 After the build has finished successfully, you can immediately run what you built using the command:
14786 _EOF
14788     if test $_os = Darwin; then
14789         echo open instdir/$PRODUCTNAME_WITHOUT_SPACES.app
14790     else
14791         echo instdir/program/soffice
14792     fi
14793     cat << _EOF
14795 If you want to run the unit tests, run:
14796 $GNUMAKE check
14798 _EOF
14801 if test -s "$WARNINGS_FILE_FOR_BUILD"; then
14802     echo "BUILD / cross-toolset config, repeated ($WARNINGS_FILE_FOR_BUILD)"
14803     cat "$WARNINGS_FILE_FOR_BUILD"
14804     echo
14807 if test -s "$WARNINGS_FILE"; then
14808     echo "HOST config ($WARNINGS_FILE)"
14809     cat "$WARNINGS_FILE"
14812 # Remove unneeded emconfigure artifacts
14813 rm -f a.out a.wasm a.out.js a.out.wasm
14815 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: