put vcl::Region operator<< in the vcl namespace
[LibreOffice.git] / configure.ac
blob32267249702b4b6a56bde761a11a44dda5a76fa3
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.3.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 echo "********************************************************************"
252 echo "*"
253 echo "*   Running ${PACKAGE_NAME} build configuration."
254 echo "*"
255 echo "********************************************************************"
256 echo ""
258 dnl ===================================================================
259 dnl checks build and host OSes
260 dnl do this before argument processing to allow for platform dependent defaults
261 dnl ===================================================================
263 # Check for WSL (version 2, at least). But if --host is explicitly specified (to really do build for
264 # Linux on WSL) trust that.
265 if test -z "$host" -a -z "$build" -a "`wslsys -v 2>/dev/null`" != ""; then
266     ac_cv_host="x86_64-pc-wsl"
267     ac_cv_host_cpu="x86_64"
268     ac_cv_host_os="wsl"
269     ac_cv_build="$ac_cv_host"
270     ac_cv_build_cpu="$ac_cv_host_cpu"
271     ac_cv_build_os="$ac_cv_host_os"
273     # Emulation of Cygwin's cygpath command for WSL.
274     cygpath()
275     {
276         if test -n "$UNITTEST_WSL_CYGPATH"; then
277             echo -n cygpath "$@" "==> "
278         fi
280         # Cygwin's real cygpath has a plethora of options but we use only a few here.
281         local args="$@"
282         local opt
283         local opt_d opt_m opt_u opt_w opt_l opt_s opt_p
284         OPTIND=1
286         while getopts dmuwlsp opt; do
287             case "$opt" in
288                 \?)
289                     AC_MSG_ERROR([Unimplemented cygpath emulation option in invocation: cygpath $args])
290                     ;;
291                 ?)
292                     eval opt_$opt=yes
293                     ;;
294             esac
295         done
297         shift $((OPTIND-1))
299         if test $# -ne 1; then
300             AC_MSG_ERROR([Invalid cygpath emulation invocation: Pathname missing]);
301         fi
303         local input="$1"
305         local result
307         if test -n "$opt_d" -o -n "$opt_m" -o -n "$opt_w"; then
308             # Print Windows path, possibly in 8.3 form (-d) or with forward slashes (-m)
310             if test -n "$opt_u"; then
311                 AC_MSG_ERROR([Invalid cygpath invocation: Both Windows and Unix path output requested])
312             fi
314             case "$input" in
315                 /mnt/*)
316                     # A Windows file in WSL format
317                     input=$(wslpath -w "$input")
318                     ;;
319                 [[a-zA-Z]]:\\* | \\* | [[a-zA-Z]]:/* | /*)
320                     # Already in Windows format
321                     ;;
322                 /*)
323                     input=$(wslpath -w "$input")
324                     ;;
325                 *)
326                     AC_MSG_ERROR([Invalid cygpath invocation: Path '$input' is not absolute])
327                     ;;
328             esac
329             if test -n "$opt_d" -o -n "$opt_s"; then
330                 input=$($BUILDDIR/solenv/wsl/wsl-lo-helper.exe --8.3 "$input")
331             fi
332             if test -n "$opt_m"; then
333                 input="${input//\\//}"
334             fi
335             echo "$input"
336         else
337             # Print Unix path
339             case "$input" in
340                 [[a-zA-Z]]:\\* | \\* | [[a-zA-Z]]:/* | /*)
341                     wslpath -u "$input"
342                     ;;
343                 /)
344                     echo "$input"
345                     ;;
346                 *)
347                     AC_MSG_ERROR([Invalid cygpath invocation: Path '$input' is not absolute])
348                     ;;
349             esac
350         fi
351     }
353     if test -n "$UNITTEST_WSL_CYGPATH"; then
354         BUILDDIR=.
356         # Nothing special with these file names, just arbitrary ones picked to test with
357         cygpath -d /usr/lib64/ld-linux-x86-64.so.2
358         cygpath -w /usr/lib64/ld-linux-x86-64.so.2
359         cygpath -m /usr/lib64/ld-linux-x86-64.so.2
360         cygpath -m -s /usr/lib64/ld-linux-x86-64.so.2
361         # At least on my machine for instance this file does have an 8.3 name
362         cygpath -d /mnt/c/windows/WindowsUpdate.log
363         # But for instance this one doesn't
364         cygpath -w /mnt/c/windows/system32/AboutSettingsHandlers.dll
365         cygpath -ws /mnt/c/windows/WindowsUpdate.log
366         cygpath -m /mnt/c/windows/system32/AboutSettingsHandlers.dll
367         cygpath -ms /mnt/c/windows/WindowsUpdate.log
369         cygpath -u 'c:\windows\system32\AboutSettingsHandlers.dll'
370         cygpath -u 'c:/windows/system32/AboutSettingsHandlers.dll'
372         exit 0
373     fi
376 AC_CANONICAL_HOST
377 AC_CANONICAL_BUILD
379 if test -n "$UNITTEST_WSL_PATHFORMAT"; then
380     BUILDDIR=.
381     GREP=grep
383     # Use of PathFormat must be after AC_CANONICAL_BUILD above
384     PathFormat /
385     printf "$formatted_path , $formatted_path_unix\n"
387     PathFormat $PWD
388     printf "$formatted_path , $formatted_path_unix\n"
390     PathFormat "$PROGRAMFILESX86"
391     printf "$formatted_path , $formatted_path_unix\n"
393     exit 0
396 AC_MSG_CHECKING([for product name])
397 PRODUCTNAME="AC_PACKAGE_NAME"
398 if test -n "$with_product_name" -a "$with_product_name" != no; then
399     PRODUCTNAME="$with_product_name"
401 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
402     PRODUCTNAME="${PRODUCTNAME}Dev"
404 AC_MSG_RESULT([$PRODUCTNAME])
405 AC_SUBST(PRODUCTNAME)
406 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
407 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
409 dnl ===================================================================
410 dnl Our version is defined by the AC_INIT() at the top of this script.
411 dnl ===================================================================
413 AC_MSG_CHECKING([for package version])
414 if test -n "$with_package_version" -a "$with_package_version" != no; then
415     PACKAGE_VERSION="$with_package_version"
417 AC_MSG_RESULT([$PACKAGE_VERSION])
419 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
421 LIBO_VERSION_MAJOR=$1
422 LIBO_VERSION_MINOR=$2
423 LIBO_VERSION_MICRO=$3
424 LIBO_VERSION_PATCH=$4
426 LIBO_VERSION_SUFFIX=$5
428 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
429 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
430 # they get undoubled before actually passed to sed.
431 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
432 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
433 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
434 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
436 # The value for key CFBundleVersion in the Info.plist file must be a period-separated list of at most
437 # three non-negative integers. Please find more information about CFBundleVersion at
438 # https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleversion
440 # The value for key CFBundleShortVersionString in the Info.plist file must be a period-separated list
441 # of at most three non-negative integers. Please find more information about
442 # CFBundleShortVersionString at
443 # https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleshortversionstring
445 # But that is enforced only in the App Store, and we apparently want to break the rules otherwise.
447 if test "$enable_macosx_sandbox" = yes; then
448     MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
449     MACOSX_BUNDLE_VERSION=$MACOSX_BUNDLE_SHORTVERSION
450 else
451     MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.$LIBO_VERSION_MICRO.$LIBO_VERSION_PATCH
452     MACOSX_BUNDLE_VERSION=$MACOSX_BUNDLE_SHORTVERSION$LIBO_VERSION_SUFFIX
455 AC_SUBST(LIBO_VERSION_MAJOR)
456 AC_SUBST(LIBO_VERSION_MINOR)
457 AC_SUBST(LIBO_VERSION_MICRO)
458 AC_SUBST(LIBO_VERSION_PATCH)
459 AC_SUBST(LIBO_VERSION_SUFFIX)
460 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
461 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
462 AC_SUBST(MACOSX_BUNDLE_VERSION)
464 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
465 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
466 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
467 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
469 LIBO_THIS_YEAR=`date +%Y`
470 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
472 dnl ===================================================================
473 dnl Product version
474 dnl ===================================================================
475 AC_MSG_CHECKING([for product version])
476 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
477 AC_MSG_RESULT([$PRODUCTVERSION])
478 AC_SUBST(PRODUCTVERSION)
480 AC_PROG_EGREP
481 # AC_PROG_EGREP doesn't set GREP on all systems as well
482 AC_PATH_PROG(GREP, grep)
484 BUILDDIR=`pwd`
485 cd $srcdir
486 SRC_ROOT=`pwd`
487 cd $BUILDDIR
488 x_Cygwin=[\#]
490 dnl ======================================
491 dnl Required GObject introspection version
492 dnl ======================================
493 INTROSPECTION_REQUIRED_VERSION=1.32.0
495 dnl ===================================================================
496 dnl Search all the common names for GNU Make
497 dnl ===================================================================
498 AC_MSG_CHECKING([for GNU Make])
500 # try to use our own make if it is available and GNUMAKE was not already defined
501 if test -z "$GNUMAKE"; then
502     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
503         GNUMAKE="$LODE_HOME/opt/bin/make"
504     elif test -x "/opt/lo/bin/make"; then
505         GNUMAKE="/opt/lo/bin/make"
506     fi
509 GNUMAKE_WIN_NATIVE=
510 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
511     if test -n "$a"; then
512         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
513         if test $? -eq 0;  then
514             if test "$build_os" = "cygwin"; then
515                 if test -n "$($a -v | grep 'Built for Windows')" ; then
516                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
517                     GNUMAKE_WIN_NATIVE="TRUE"
518                 else
519                     GNUMAKE=`which $a`
520                 fi
521             else
522                 GNUMAKE=`which $a`
523             fi
524             break
525         fi
526     fi
527 done
528 AC_MSG_RESULT($GNUMAKE)
529 if test -z "$GNUMAKE"; then
530     AC_MSG_ERROR([not found. install GNU Make.])
531 else
532     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
533         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
534     fi
537 win_short_path_for_make()
539     local short_path="$1"
540     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
541         cygpath -sm "$short_path"
542     else
543         cygpath -u "$(cygpath -d "$short_path")"
544     fi
548 if test "$build_os" = "cygwin"; then
549     PathFormat "$SRC_ROOT"
550     SRC_ROOT="$formatted_path"
551     PathFormat "$BUILDDIR"
552     BUILDDIR="$formatted_path"
553     x_Cygwin=
554     AC_MSG_CHECKING(for explicit COMSPEC)
555     if test -z "$COMSPEC"; then
556         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
557     else
558         AC_MSG_RESULT([found: $COMSPEC])
559     fi
562 AC_SUBST(SRC_ROOT)
563 AC_SUBST(BUILDDIR)
564 AC_SUBST(x_Cygwin)
565 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
566 AC_DEFINE_UNQUOTED(SRC_ROOT,"$SRC_ROOT")
567 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
569 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
570     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
573 # need sed in os checks...
574 AC_PATH_PROGS(SED, sed)
575 if test -z "$SED"; then
576     AC_MSG_ERROR([install sed to run this script])
579 # Set the ENABLE_LTO variable
580 # ===================================================================
581 AC_MSG_CHECKING([whether to use link-time optimization])
582 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
583     ENABLE_LTO="TRUE"
584     AC_MSG_RESULT([yes])
585 else
586     ENABLE_LTO=""
587     AC_MSG_RESULT([no])
589 AC_SUBST(ENABLE_LTO)
591 AC_ARG_ENABLE(fuzz-options,
592     AS_HELP_STRING([--enable-fuzz-options],
593         [Randomly enable or disable each of those configurable options
594          that are supposed to be freely selectable without interdependencies,
595          or where bad interaction from interdependencies is automatically avoided.])
598 dnl ===================================================================
599 dnl When building for Android, --with-android-ndk,
600 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
601 dnl mandatory
602 dnl ===================================================================
604 AC_ARG_WITH(android-ndk,
605     AS_HELP_STRING([--with-android-ndk],
606         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
609 AC_ARG_WITH(android-ndk-toolchain-version,
610     AS_HELP_STRING([--with-android-ndk-toolchain-version],
611         [Specify which toolchain version to use, of those present in the
612         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
613         with_android_ndk_toolchain_version=clang5.0)
615 AC_ARG_WITH(android-sdk,
616     AS_HELP_STRING([--with-android-sdk],
617         [Specify location of the Android SDK. Mandatory when building for Android.]),
620 AC_ARG_WITH(android-api-level,
621     AS_HELP_STRING([--with-android-api-level],
622         [Specify the API level when building for Android. Defaults to 16 for ARM and x86 and to 21 for ARM64 and x86-64]),
625 ANDROID_NDK_HOME=
626 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
627     with_android_ndk="$SRC_ROOT/external/android-ndk"
629 if test -n "$with_android_ndk"; then
630     eval ANDROID_NDK_HOME=$with_android_ndk
632     # Set up a lot of pre-canned defaults
634     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
635         if test ! -f $ANDROID_NDK_HOME/source.properties; then
636             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
637         fi
638         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
639     else
640         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
641     fi
642     if test -z "$ANDROID_NDK_VERSION";  then
643         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
644     fi
645     case $ANDROID_NDK_VERSION in
646     r9*|r10*)
647         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
648         ;;
649     11.1.*|12.1.*|13.1.*|14.1.*)
650         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
651         ;;
652     16.*|17.*|18.*|19.*|20.*)
653         ;;
654     *)
655         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk.])
656         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk."
657         ;;
658     esac
660     ANDROID_API_LEVEL=16
661     if test -n "$with_android_api_level" ; then
662         ANDROID_API_LEVEL="$with_android_api_level"
663     fi
665     android_cpu=$host_cpu
666     if test $host_cpu = arm; then
667         android_platform_prefix=arm-linux-androideabi
668         android_gnu_prefix=$android_platform_prefix
669         LLVM_TRIPLE=armv7a-linux-androideabi
670         ANDROID_APP_ABI=armeabi-v7a
671         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
672     elif test $host_cpu = aarch64; then
673         android_platform_prefix=aarch64-linux-android
674         android_gnu_prefix=$android_platform_prefix
675         LLVM_TRIPLE=$android_platform_prefix
676         # minimum android version that supports aarch64
677         if test "$ANDROID_API_LEVEL" -lt "21" ; then
678             ANDROID_API_LEVEL=21
679         fi
680         ANDROID_APP_ABI=arm64-v8a
681     elif test $host_cpu = x86_64; then
682         android_platform_prefix=x86_64-linux-android
683         android_gnu_prefix=$android_platform_prefix
684         LLVM_TRIPLE=$android_platform_prefix
685         # minimum android version that supports x86_64
686         ANDROID_API_LEVEL=21
687         ANDROID_APP_ABI=x86_64
688     else
689         # host_cpu is something like "i386" or "i686" I guess, NDK uses
690         # "x86" in some contexts
691         android_cpu=x86
692         android_platform_prefix=$android_cpu
693         android_gnu_prefix=i686-linux-android
694         LLVM_TRIPLE=$android_gnu_prefix
695         ANDROID_APP_ABI=x86
696     fi
698     case "$with_android_ndk_toolchain_version" in
699     clang5.0)
700         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
701         ;;
702     *)
703         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
704     esac
706     AC_MSG_NOTICE([using the Android API level... $ANDROID_API_LEVEL])
708     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
709     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
710     # manage to link the (app-specific) single huge .so that is built for the app in
711     # android/source/ if there is debug information in a significant part of the object files.
712     # (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
713     # all objects have been built with debug information.)
714     case $build_os in
715     linux-gnu*)
716         android_HOST_TAG=linux-x86_64
717         ;;
718     darwin*)
719         android_HOST_TAG=darwin-x86_64
720         ;;
721     *)
722         AC_MSG_ERROR([We only support building for Android from Linux or macOS])
723         # ndk would also support windows and windows-x86_64
724         ;;
725     esac
726     android_TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$android_HOST_TAG
727     ANDROID_COMPILER_BIN=$android_TOOLCHAIN/bin
728     dnl TODO: NSS build uses it...
729     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION/prebuilt/$android_HOST_TAG
730     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
732     test -z "$AR" && AR=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ar
733     test -z "$NM" && NM=$ANDROID_COMPILER_BIN/$android_gnu_prefix-nm
734     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-objdump
735     test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ranlib
736     test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-strip
738     ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
739     ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
740     if test "$ENABLE_LTO" = TRUE; then
741         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
742         # $CC and $CXX when building external libraries
743         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
744     fi
746     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -stdlib=libc++"
748     if test -z "$CC"; then
749         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
750         CC_BASE="clang"
751     fi
752     if test -z "$CXX"; then
753         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
754         CXX_BASE="clang++"
755     fi
757 AC_SUBST(ANDROID_NDK_HOME)
758 AC_SUBST(ANDROID_APP_ABI)
759 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
761 dnl ===================================================================
762 dnl --with-android-sdk
763 dnl ===================================================================
764 ANDROID_SDK_HOME=
765 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
766     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
768 if test -n "$with_android_sdk"; then
769     eval ANDROID_SDK_HOME=$with_android_sdk
770     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
772 AC_SUBST(ANDROID_SDK_HOME)
774 AC_ARG_ENABLE([android-lok],
775     AS_HELP_STRING([--enable-android-lok],
776         [The Android app from the android/ subdir needs several tweaks all
777          over the place that break the LOK when used in the Online-based
778          Android app.  This switch indicates that the intent of this build is
779          actually the Online-based, non-modified LOK.])
781 ENABLE_ANDROID_LOK=
782 if test -n "$ANDROID_NDK_HOME" ; then
783     if test "$enable_android_lok" = yes; then
784         ENABLE_ANDROID_LOK=TRUE
785         AC_DEFINE(HAVE_FEATURE_ANDROID_LOK)
786         AC_MSG_NOTICE([building the Android version... for the Online-based Android app])
787     else
788         AC_MSG_NOTICE([building the Android version... for the app from the android/ subdir])
789     fi
791 AC_SUBST([ENABLE_ANDROID_LOK])
793 libo_FUZZ_ARG_ENABLE([android-editing],
794     AS_HELP_STRING([--enable-android-editing],
795         [Enable the experimental editing feature on Android.])
797 ENABLE_ANDROID_EDITING=
798 if test "$enable_android_editing" = yes; then
799     ENABLE_ANDROID_EDITING=TRUE
801 AC_SUBST([ENABLE_ANDROID_EDITING])
803 disable_database_connectivity_dependencies()
805     enable_evolution2=no
806     enable_firebird_sdbc=no
807     enable_mariadb_sdbc=no
808     enable_postgresql_sdbc=no
809     enable_report_builder=no
812 # ===================================================================
814 # Start initial platform setup
816 # The using_* variables reflect platform support and should not be
817 # changed after the "End initial platform setup" block.
818 # This is also true for most test_* variables.
819 # ===================================================================
820 build_crypto=yes
821 test_cmis=yes
822 test_gdb_index=no
823 test_openldap=yes
824 test_split_debug=no
825 test_webdav=yes
827 # There is currently just iOS not using salplug, so this explicitly enables it.
828 # must: using_freetype_fontconfig
829 #  may: using_headless_plugin defaults to $using_freetype_fontconfig
830 using_vclplug=yes
831 # must: using_x11
833 # Default values, as such probably valid just for Linux, set
834 # differently below just for Mac OSX, but at least better than
835 # hardcoding these as we used to do. Much of this is duplicated also
836 # in solenv for old build system and for gbuild, ideally we should
837 # perhaps define stuff like this only here in configure.ac?
839 LINKFLAGSSHL="-shared"
840 PICSWITCH="-fpic"
841 DLLPOST=".so"
843 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
845 INSTROOTBASESUFFIX=
846 INSTROOTCONTENTSUFFIX=
847 SDKDIRNAME=sdk
849 HOST_PLATFORM="$host"
851 host_cpu_for_clang="$host_cpu"
853 case "$host_os" in
855 solaris*)
856     using_freetype_fontconfig=yes
857     using_x11=yes
858     build_skia=yes
859     _os=SunOS
861     dnl ===========================================================
862     dnl Check whether we're using Solaris 10 - SPARC or Intel.
863     dnl ===========================================================
864     AC_MSG_CHECKING([the Solaris operating system release])
865     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
866     if test "$_os_release" -lt "10"; then
867         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
868     else
869         AC_MSG_RESULT([ok ($_os_release)])
870     fi
872     dnl Check whether we're using a SPARC or i386 processor
873     AC_MSG_CHECKING([the processor type])
874     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
875         AC_MSG_RESULT([ok ($host_cpu)])
876     else
877         AC_MSG_ERROR([only SPARC and i386 processors are supported])
878     fi
879     ;;
881 linux-gnu*|k*bsd*-gnu*)
882     using_freetype_fontconfig=yes
883     using_x11=yes
884     build_skia=yes
885     test_gdb_index=yes
886     test_split_debug=yes
887     if test "$enable_fuzzers" = yes; then
888         test_system_freetype=no
889     fi
890     _os=Linux
891     ;;
893 gnu)
894     using_freetype_fontconfig=yes
895     using_x11=no
896     _os=GNU
897      ;;
899 cygwin*|wsl*)
900     # When building on Windows normally with MSVC under Cygwin,
901     # configure thinks that the host platform (the platform the
902     # built code will run on) is Cygwin, even if it obviously is
903     # Windows, which in Autoconf terminology is called
904     # "mingw32". (Which is misleading as MinGW is the name of the
905     # tool-chain, not an operating system.)
907     # Somewhat confusing, yes. But this configure script doesn't
908     # look at $host etc that much, it mostly uses its own $_os
909     # variable, set here in this case statement.
911     using_freetype_fontconfig=no
912     using_x11=no
913     test_openldap=no
914     build_skia=yes
915     _os=WINNT
917     DLLPOST=".dll"
918     LINKFLAGSNOUNDEFS=
920     if test "$host_cpu" = "aarch64"; then
921         enable_gpgmepp=no
922         enable_coinmp=no
923         enable_firebird_sdbc=no
924     fi
925     ;;
927 darwin*|macos*) # macOS
928     using_freetype_fontconfig=no
929     using_x11=no
930     build_skia=yes
931     if test -n "$LODE_HOME" ; then
932         mac_sanitize_path
933         AC_MSG_NOTICE([sanitized the PATH to $PATH])
934     fi
935     _os=Darwin
936     INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
937     INSTROOTCONTENTSUFFIX=/Contents
938     SDKDIRNAME=${PRODUCTNAME_WITHOUT_SPACES}${PRODUCTVERSION}_SDK
939     # See comment above the case "$host_os"
940     LINKFLAGSSHL="-dynamiclib -single_module"
942     # -fPIC is default
943     PICSWITCH=""
945     DLLPOST=".dylib"
947     # -undefined error is the default
948     LINKFLAGSNOUNDEFS=""
949     case "$host_cpu" in
950     aarch64|arm64)
951         case "$host_os" in
952         macos*)
953             # HOST_PLATFORM is used for external projects and their configury occasionally doesn't like
954             # the "macos" part so be sure to use aarch64-apple-darwin for now.
955             HOST_PLATFORM=aarch64-apple-darwin
956             ;;
957         esac
959         # Apple's Clang uses "arm64"
960         host_cpu_for_clang=arm64
961     esac
964 ios*) # iOS
965     using_freetype_fontconfig=no
966     using_vclplug=no
967     using_x11=no
968     build_crypto=no
969     test_cmis=no
970     test_openldap=no
971     test_webdav=no
972     if test -n "$LODE_HOME" ; then
973         mac_sanitize_path
974         AC_MSG_NOTICE([sanitized the PATH to $PATH])
975     fi
976     enable_gpgmepp=no
977     _os=iOS
978     enable_mpl_subset=yes
979     enable_lotuswordpro=no
980     disable_database_connectivity_dependencies
981     enable_coinmp=no
982     enable_lpsolve=no
983     enable_extension_integration=no
984     enable_xmlhelp=no
985     with_ppds=no
986     if test "$enable_ios_simulator" = "yes"; then
987         host=x86_64-apple-darwin
988     fi
989     # See comment above the case "$host_os"
990     LINKFLAGSSHL="-dynamiclib -single_module"
992     # -fPIC is default
993     PICSWITCH=""
995     DLLPOST=".dylib"
997     # -undefined error is the default
998     LINKFLAGSNOUNDEFS=""
1000     # HOST_PLATFORM is used for external projects and their configury typically doesn't like the "ios"
1001     # part, so use aarch64-apple-darwin for now.
1002     HOST_PLATFORM=aarch64-apple-darwin
1004     # Apple's Clang uses "arm64"
1005     host_cpu_for_clang=arm64
1008 freebsd*)
1009     using_freetype_fontconfig=yes
1010     using_x11=yes
1011     build_skia=yes
1012     AC_MSG_CHECKING([the FreeBSD operating system release])
1013     if test -n "$with_os_version"; then
1014         OSVERSION="$with_os_version"
1015     else
1016         OSVERSION=`/sbin/sysctl -n kern.osreldate`
1017     fi
1018     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
1019     AC_MSG_CHECKING([which thread library to use])
1020     if test "$OSVERSION" -lt "500016"; then
1021         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1022         PTHREAD_LIBS="-pthread"
1023     elif test "$OSVERSION" -lt "502102"; then
1024         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1025         PTHREAD_LIBS="-lc_r"
1026     else
1027         PTHREAD_CFLAGS=""
1028         PTHREAD_LIBS="-pthread"
1029     fi
1030     AC_MSG_RESULT([$PTHREAD_LIBS])
1031     _os=FreeBSD
1032     ;;
1034 *netbsd*)
1035     using_freetype_fontconfig=yes
1036     using_x11=yes
1037     test_gtk3_kde5=no
1038     build_skia=yes
1039     PTHREAD_LIBS="-pthread -lpthread"
1040     _os=NetBSD
1041     ;;
1043 aix*)
1044     using_freetype_fontconfig=yes
1045     using_x11=yes
1046     test_randr=no
1047     test_gstreamer_1_0=no
1048     PTHREAD_LIBS=-pthread
1049     _os=AIX
1050     ;;
1052 openbsd*)
1053     using_freetype_fontconfig=yes
1054     using_x11=yes
1055     PTHREAD_CFLAGS="-D_THREAD_SAFE"
1056     PTHREAD_LIBS="-pthread"
1057     _os=OpenBSD
1058     ;;
1060 dragonfly*)
1061     using_freetype_fontconfig=yes
1062     using_x11=yes
1063     build_skia=yes
1064     PTHREAD_LIBS="-pthread"
1065     _os=DragonFly
1066     ;;
1068 linux-android*)
1069     using_freetype_fontconfig=yes
1070     using_headless_plugin=no
1071     using_x11=no
1072     build_crypto=no
1073     test_openldap=no
1074     test_system_freetype=no
1075     test_webdav=no
1076     disable_database_connectivity_dependencies
1077     enable_lotuswordpro=no
1078     enable_mpl_subset=yes
1079     enable_cairo_canvas=no
1080     enable_coinmp=yes
1081     enable_lpsolve=no
1082     enable_odk=no
1083     enable_python=no
1084     enable_xmlhelp=no
1085     _os=Android
1087     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
1088     ;;
1090 haiku*)
1091     using_freetype_fontconfig=yes
1092     using_x11=no
1093     test_gtk3_kde5=no
1094     test_kf5=yes
1095     enable_odk=no
1096     enable_coinmp=no
1097     enable_pdfium=no
1098     enable_sdremote=no
1099     enable_postgresql_sdbc=no
1100     enable_firebird_sdbc=no
1101     _os=Haiku
1102     ;;
1104 emscripten)
1105     using_freetype_fontconfig=yes
1106     using_x11=no
1107     test_openldap=no
1108     enable_compiler_plugins=no
1109     test_cmis=no
1110     test_webdav=no
1111     enable_database_connectivity=no
1112     enable_lpsolve=no
1113     enable_xmlhelp=no
1114     with_system_zlib=no
1115     with_theme="breeze"
1116     _os=Emscripten
1117     ;;
1120     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
1121     ;;
1122 esac
1124 AC_SUBST(HOST_PLATFORM)
1126 if test -z "$using_x11" -o -z "$using_freetype_fontconfig"; then
1127     AC_MSG_ERROR([You must set \$using_freetype_fontconfig and \$using_x11 for your platform])
1130 # Set defaults, if not set by platform
1131 test "${test_cups+set}" = set || test_cups="$using_x11"
1132 test "${test_dbus+set}" = set || test_dbus="$using_x11"
1133 test "${test_gstreamer_1_0+set}" = set || test_gstreamer_1_0="$using_x11"
1134 test "${test_gtk3+set}" = set || test_gtk3="$using_x11"
1135 test "${test_gtk4+set}" = set || test_gtk4="$using_x11"
1136 test "${test_kf5+set}" = set || test_kf5="$using_x11"
1137 # don't handle test_qt5, so it can disable test_kf5 later
1138 test "${test_randr+set}" = set || test_randr="$using_x11"
1139 test "${test_xrender+set}" = set || test_xrender="$using_x11"
1140 test "${using_headless_plugin+set}" = set || using_headless_plugin="$using_freetype_fontconfig"
1142 test "${test_gtk3_kde5+set}" != set -a "$test_kf5" = yes -a "$test_gtk3" = yes && test_gtk3_kde5="yes"
1143 test "${test_system_fontconfig+set}" != set -a "${test_system_freetype+set}" = set && test_system_fontconfig="$test_system_freetype"
1144 test "${test_system_freetype+set}" != set -a "${test_system_fontconfig+set}" = set && test_system_freetype="$test_system_fontconfig"
1146 # convenience / platform overriding "fixes"
1147 # Don't sort!
1148 test "$test_kf5" = yes -a "$test_qt5" = no && test_kf5=no
1149 test "$test_kf5" = yes && test_qt5=yes
1150 test "$test_gtk3" != yes -o "$test_kf5" != yes && test_gtk3_kde5=no
1151 test "$using_freetype_fontconfig" = no && using_headless_plugin=no
1152 test "$using_freetype_fontconfig" = yes && test_cairo=yes
1154 # Keep in sync with the above $using_x11 depending test default list
1155 disable_x11_tests()
1157     test_cups=no
1158     test_dbus=no
1159     test_gstreamer_1_0=no
1160     test_gtk3_kde5=no
1161     test_gtk3=no
1162     test_gtk4=no
1163     test_kf5=no
1164     test_qt5=no
1165     test_randr=no
1166     test_xrender=no
1169 test "$using_x11" = yes && USING_X11=TRUE
1171 if test "$using_freetype_fontconfig" = yes; then
1172     if test "$using_headless_plugin" = yes; then
1173         AC_DEFINE(ENABLE_HEADLESS)
1174         ENABLE_HEADLESS=TRUE
1175     fi
1178 AC_SUBST(ENABLE_HEADLESS)
1180 AC_MSG_NOTICE([VCL platform uses freetype+fontconfig: $using_freetype_fontconfig])
1181 AC_MSG_NOTICE([VCL platform uses headless plugin: $using_headless_plugin])
1182 AC_MSG_NOTICE([VCL platform uses vclplug: $using_vclplug])
1183 AC_MSG_NOTICE([VCL platform uses X11: $using_x11])
1185 # ===================================================================
1187 # End initial platform setup
1189 # ===================================================================
1191 if test "$_os" = "Android" ; then
1192     # Verify that the NDK and SDK options are proper
1193     if test -z "$with_android_ndk"; then
1194         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
1195     elif test ! -f "$ANDROID_NDK_HOME/meta/abis.json"; then
1196         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
1197     fi
1199     if test -z "$ANDROID_SDK_HOME"; then
1200         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
1201     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
1202         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
1203     fi
1205     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
1206     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
1207         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
1208                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
1209                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
1210         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
1211         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
1212         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
1213     fi
1214     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
1215         AC_MSG_WARN([android support repository not found - install with
1216                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
1217                      to allow the build to download the specified version of the android support libraries])
1218         add_warning "android support repository not found - install with"
1219         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
1220         add_warning "to allow the build to download the specified version of the android support libraries"
1221     fi
1224 if test "$_os" = "AIX"; then
1225     AC_PATH_PROG(GAWK, gawk)
1226     if test -z "$GAWK"; then
1227         AC_MSG_ERROR([gawk not found in \$PATH])
1228     fi
1231 AC_SUBST(SDKDIRNAME)
1233 AC_SUBST(PTHREAD_CFLAGS)
1234 AC_SUBST(PTHREAD_LIBS)
1236 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
1237 # By default use the ones specified by our build system,
1238 # but explicit override is possible.
1239 AC_MSG_CHECKING(for explicit AFLAGS)
1240 if test -n "$AFLAGS"; then
1241     AC_MSG_RESULT([$AFLAGS])
1242     x_AFLAGS=
1243 else
1244     AC_MSG_RESULT(no)
1245     x_AFLAGS=[\#]
1247 AC_MSG_CHECKING(for explicit CFLAGS)
1248 if test -n "$CFLAGS"; then
1249     AC_MSG_RESULT([$CFLAGS])
1250     x_CFLAGS=
1251 else
1252     AC_MSG_RESULT(no)
1253     x_CFLAGS=[\#]
1255 AC_MSG_CHECKING(for explicit CXXFLAGS)
1256 if test -n "$CXXFLAGS"; then
1257     AC_MSG_RESULT([$CXXFLAGS])
1258     x_CXXFLAGS=
1259 else
1260     AC_MSG_RESULT(no)
1261     x_CXXFLAGS=[\#]
1263 AC_MSG_CHECKING(for explicit OBJCFLAGS)
1264 if test -n "$OBJCFLAGS"; then
1265     AC_MSG_RESULT([$OBJCFLAGS])
1266     x_OBJCFLAGS=
1267 else
1268     AC_MSG_RESULT(no)
1269     x_OBJCFLAGS=[\#]
1271 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
1272 if test -n "$OBJCXXFLAGS"; then
1273     AC_MSG_RESULT([$OBJCXXFLAGS])
1274     x_OBJCXXFLAGS=
1275 else
1276     AC_MSG_RESULT(no)
1277     x_OBJCXXFLAGS=[\#]
1279 AC_MSG_CHECKING(for explicit LDFLAGS)
1280 if test -n "$LDFLAGS"; then
1281     AC_MSG_RESULT([$LDFLAGS])
1282     x_LDFLAGS=
1283 else
1284     AC_MSG_RESULT(no)
1285     x_LDFLAGS=[\#]
1287 AC_SUBST(AFLAGS)
1288 AC_SUBST(CFLAGS)
1289 AC_SUBST(CXXFLAGS)
1290 AC_SUBST(OBJCFLAGS)
1291 AC_SUBST(OBJCXXFLAGS)
1292 AC_SUBST(LDFLAGS)
1293 AC_SUBST(x_AFLAGS)
1294 AC_SUBST(x_CFLAGS)
1295 AC_SUBST(x_CXXFLAGS)
1296 AC_SUBST(x_OBJCFLAGS)
1297 AC_SUBST(x_OBJCXXFLAGS)
1298 AC_SUBST(x_LDFLAGS)
1300 dnl These are potentially set for MSVC, in the code checking for UCRT below:
1301 my_original_CFLAGS=$CFLAGS
1302 my_original_CXXFLAGS=$CXXFLAGS
1303 my_original_CPPFLAGS=$CPPFLAGS
1305 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
1306 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
1307 dnl AC_PROG_CC internally.
1308 if test "$_os" != "WINNT"; then
1309     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
1310     save_CFLAGS=$CFLAGS
1311     AC_PROG_CC
1312     CFLAGS=$save_CFLAGS
1313     if test -z "$CC_BASE"; then
1314         CC_BASE=`first_arg_basename "$CC"`
1315     fi
1318 if test "$_os" != "WINNT"; then
1319     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
1320 else
1321     ENDIANNESS=little
1323 AC_SUBST(ENDIANNESS)
1325 if test $_os != "WINNT"; then
1326     save_LIBS="$LIBS"
1327     AC_SEARCH_LIBS([dlsym], [dl],
1328         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
1329         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
1330     LIBS="$save_LIBS"
1332 AC_SUBST(DLOPEN_LIBS)
1334 dnl ===================================================================
1335 dnl Sanity checks for Emscripten SDK setup
1336 dnl ===================================================================
1338 if test "$_os" = "Emscripten"; then
1339     EMSCRIPTEN_ERROR=0
1340     if ! which emconfigure >/dev/null 2>&1; then
1341         AC_MSG_WARN([emconfigure must be in your \$PATH])
1342         EMSCRIPTEN_ERROR=1
1343     fi
1344     if test -z "$EMMAKEN_JUST_CONFIGURE"; then
1345         AC_MSG_WARN(["\$EMMAKEN_JUST_CONFIGURE wasn't set by emconfigure. Prefix configure or use autogen.sh])
1346         EMSCRIPTEN_ERROR=1
1347     fi
1348     if test $EMSCRIPTEN_ERROR -ne 0; then
1349         AC_MSG_ERROR(["Please fix your EMSDK setup to build with Emscripten!"])
1350     fi
1353 ###############################################################################
1354 # Extensions switches --enable/--disable
1355 ###############################################################################
1356 # By default these should be enabled unless having extra dependencies.
1357 # If there is extra dependency over configure options then the enable should
1358 # be automagic based on whether the requiring feature is enabled or not.
1359 # All this options change anything only with --enable-extension-integration.
1361 # The name of this option and its help string makes it sound as if
1362 # extensions are built anyway, just not integrated in the installer,
1363 # if you use --disable-extension-integration. Is that really the
1364 # case?
1366 AC_ARG_ENABLE(ios-simulator,
1367     AS_HELP_STRING([--enable-ios-simulator],
1368         [build for iOS simulator])
1371 libo_FUZZ_ARG_ENABLE(extension-integration,
1372     AS_HELP_STRING([--disable-extension-integration],
1373         [Disable integration of the built extensions in the installer of the
1374          product. Use this switch to disable the integration.])
1377 AC_ARG_ENABLE(avmedia,
1378     AS_HELP_STRING([--disable-avmedia],
1379         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
1382 AC_ARG_ENABLE(database-connectivity,
1383     AS_HELP_STRING([--disable-database-connectivity],
1384         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1387 # This doesn't mean not building (or "integrating") extensions
1388 # (although it probably should; i.e. it should imply
1389 # --disable-extension-integration I guess), it means not supporting
1390 # any extension mechanism at all
1391 libo_FUZZ_ARG_ENABLE(extensions,
1392     AS_HELP_STRING([--disable-extensions],
1393         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1396 AC_ARG_ENABLE(scripting,
1397     AS_HELP_STRING([--disable-scripting],
1398         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1401 # This is mainly for Android and iOS, but could potentially be used in some
1402 # special case otherwise, too, so factored out as a separate setting
1404 AC_ARG_ENABLE(dynamic-loading,
1405     AS_HELP_STRING([--disable-dynamic-loading],
1406         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1409 libo_FUZZ_ARG_ENABLE(report-builder,
1410     AS_HELP_STRING([--disable-report-builder],
1411         [Disable the Report Builder.])
1414 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1415     AS_HELP_STRING([--enable-ext-wiki-publisher],
1416         [Enable the Wiki Publisher extension.])
1419 libo_FUZZ_ARG_ENABLE(lpsolve,
1420     AS_HELP_STRING([--disable-lpsolve],
1421         [Disable compilation of the lp solve solver ])
1423 libo_FUZZ_ARG_ENABLE(coinmp,
1424     AS_HELP_STRING([--disable-coinmp],
1425         [Disable compilation of the CoinMP solver ])
1428 libo_FUZZ_ARG_ENABLE(pdfimport,
1429     AS_HELP_STRING([--disable-pdfimport],
1430         [Disable building the PDF import feature.])
1433 libo_FUZZ_ARG_ENABLE(pdfium,
1434     AS_HELP_STRING([--disable-pdfium],
1435         [Disable building PDFium. Results in unsecure PDF signature verification.])
1438 libo_FUZZ_ARG_ENABLE(skia,
1439     AS_HELP_STRING([--disable-skia],
1440         [Disable building Skia. Use --enable-skia=debug to build without optimizations.])
1443 ###############################################################################
1445 dnl ---------- *** ----------
1447 libo_FUZZ_ARG_ENABLE(mergelibs,
1448     AS_HELP_STRING([--enable-mergelibs],
1449         [Merge several of the smaller libraries into one big, "merged", one.])
1452 libo_FUZZ_ARG_ENABLE(breakpad,
1453     AS_HELP_STRING([--enable-breakpad],
1454         [Enables breakpad for crash reporting.])
1457 libo_FUZZ_ARG_ENABLE(crashdump,
1458     AS_HELP_STRING([--disable-crashdump],
1459         [Disable dump.ini and dump-file, when --enable-breakpad])
1462 AC_ARG_ENABLE(fetch-external,
1463     AS_HELP_STRING([--disable-fetch-external],
1464         [Disables fetching external tarballs from web sources.])
1467 AC_ARG_ENABLE(fuzzers,
1468     AS_HELP_STRING([--enable-fuzzers],
1469         [Enables building libfuzzer targets for fuzz testing.])
1472 libo_FUZZ_ARG_ENABLE(pch,
1473     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1474         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1475          Using 'system' will include only external headers, 'base' will add also headers
1476          from base modules, 'normal' will also add all headers except from the module built,
1477          'full' will use all suitable headers even from a module itself.])
1480 libo_FUZZ_ARG_ENABLE(epm,
1481     AS_HELP_STRING([--enable-epm],
1482         [LibreOffice includes self-packaging code, that requires epm, however epm is
1483          useless for large scale package building.])
1486 libo_FUZZ_ARG_ENABLE(odk,
1487     AS_HELP_STRING([--enable-odk],
1488         [Enable building the Office Development Kit, the part that extensions need to build against])
1491 AC_ARG_ENABLE(mpl-subset,
1492     AS_HELP_STRING([--enable-mpl-subset],
1493         [Don't compile any pieces which are not MPL or more liberally licensed])
1496 libo_FUZZ_ARG_ENABLE(evolution2,
1497     AS_HELP_STRING([--enable-evolution2],
1498         [Allows the built-in evolution 2 addressbook connectivity build to be
1499          enabled.])
1502 AC_ARG_ENABLE(avahi,
1503     AS_HELP_STRING([--enable-avahi],
1504         [Determines whether to use Avahi to advertise Impress to remote controls.])
1507 libo_FUZZ_ARG_ENABLE(werror,
1508     AS_HELP_STRING([--enable-werror],
1509         [Turn warnings to errors. (Has no effect in modules where the treating
1510          of warnings as errors is disabled explicitly.)]),
1513 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1514     AS_HELP_STRING([--enable-assert-always-abort],
1515         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1518 libo_FUZZ_ARG_ENABLE(dbgutil,
1519     AS_HELP_STRING([--enable-dbgutil],
1520         [Provide debugging support from --enable-debug and include additional debugging
1521          utilities such as object counting or more expensive checks.
1522          This is the recommended option for developers.
1523          Note that this makes the build ABI incompatible, it is not possible to mix object
1524          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1526 libo_FUZZ_ARG_ENABLE(debug,
1527     AS_HELP_STRING([--enable-debug],
1528         [Include debugging information, disable compiler optimization and inlining plus
1529          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1531 libo_FUZZ_ARG_ENABLE(split-debug,
1532     AS_HELP_STRING([--disable-split-debug],
1533         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1534          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1536 libo_FUZZ_ARG_ENABLE(gdb-index,
1537     AS_HELP_STRING([--disable-gdb-index],
1538         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1539          The feature requires the gold or lld linker.]))
1541 libo_FUZZ_ARG_ENABLE(sal-log,
1542     AS_HELP_STRING([--enable-sal-log],
1543         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1545 libo_FUZZ_ARG_ENABLE(symbols,
1546     AS_HELP_STRING([--enable-symbols],
1547         [Generate debug information.
1548          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1549          otherwise. It is possible to explicitly specify gbuild build targets
1550          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1551          everything in the directory; there is no ordering, more specific overrides
1552          more general, and disabling takes precedence).
1553          Example: --enable-symbols="all -sw/ -Library_sc".]))
1555 libo_FUZZ_ARG_ENABLE(optimized,
1556     AS_HELP_STRING([--enable-optimized=<yes/no/debug>],
1557         [Whether to compile with optimization flags.
1558          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1559          otherwise. Using 'debug' will try to use only optimizations that should
1560          not interfere with debugging. For Emscripten we default to optimized (-O1)
1561          debug build, as otherwise binaries become too large.]))
1563 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1564     AS_HELP_STRING([--disable-runtime-optimizations],
1565         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1566          JVM JIT) that are known to interact badly with certain dynamic analysis
1567          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1568          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1569          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1571 AC_ARG_WITH(valgrind,
1572     AS_HELP_STRING([--with-valgrind],
1573         [Make availability of Valgrind headers a hard requirement.]))
1575 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1576     AS_HELP_STRING([--enable-compiler-plugins],
1577         [Enable compiler plugins that will perform additional checks during
1578          building. Enabled automatically by --enable-dbgutil.
1579          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1580 COMPILER_PLUGINS_DEBUG=
1581 if test "$enable_compiler_plugins" = debug; then
1582     enable_compiler_plugins=yes
1583     COMPILER_PLUGINS_DEBUG=TRUE
1586 libo_FUZZ_ARG_ENABLE(compiler-plugins-analyzer-pch,
1587     AS_HELP_STRING([--disable-compiler-plugins-analyzer-pch],
1588         [Disable use of precompiled headers when running the Clang compiler plugin analyzer.  Not
1589          relevant in the --disable-compiler-plugins case.]))
1591 libo_FUZZ_ARG_ENABLE(ooenv,
1592     AS_HELP_STRING([--enable-ooenv],
1593         [Enable ooenv for the instdir installation.]))
1595 AC_ARG_ENABLE(lto,
1596     AS_HELP_STRING([--enable-lto],
1597         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1598          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1599          linker. For MSVC, this option is broken at the moment. This is experimental work
1600          in progress that shouldn't be used unless you are working on it.)]))
1602 AC_ARG_ENABLE(python,
1603     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1604         [Enables or disables Python support at run-time.
1605          Also specifies what Python to use at build-time.
1606          'fully-internal' even forces the internal version for uses of Python
1607          during the build.
1608          On macOS the only choices are
1609          'internal' (default) or 'fully-internal'. Otherwise the default is 'auto'.
1610          ]))
1612 libo_FUZZ_ARG_ENABLE(gtk3,
1613     AS_HELP_STRING([--disable-gtk3],
1614         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1615 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1617 AC_ARG_ENABLE(gtk4,
1618     AS_HELP_STRING([--enable-gtk4],
1619         [Determines whether to use Gtk+ 4.0 vclplug on platforms where Gtk+ 4.0 is available.]))
1621 AC_ARG_ENABLE(introspection,
1622     AS_HELP_STRING([--enable-introspection],
1623         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1624          Linux distributions.)]))
1626 AC_ARG_ENABLE(split-app-modules,
1627     AS_HELP_STRING([--enable-split-app-modules],
1628         [Split file lists for app modules, e.g. base, calc.
1629          Has effect only with make distro-pack-install]),
1632 AC_ARG_ENABLE(split-opt-features,
1633     AS_HELP_STRING([--enable-split-opt-features],
1634         [Split file lists for some optional features, e.g. pyuno, testtool.
1635          Has effect only with make distro-pack-install]),
1638 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1639     AS_HELP_STRING([--disable-cairo-canvas],
1640         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1643 libo_FUZZ_ARG_ENABLE(dbus,
1644     AS_HELP_STRING([--disable-dbus],
1645         [Determines whether to enable features that depend on dbus.
1646          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1647 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1649 libo_FUZZ_ARG_ENABLE(sdremote,
1650     AS_HELP_STRING([--disable-sdremote],
1651         [Determines whether to enable Impress remote control (i.e. the server component).]),
1652 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1654 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1655     AS_HELP_STRING([--disable-sdremote-bluetooth],
1656         [Determines whether to build sdremote with bluetooth support.
1657          Requires dbus on Linux.]))
1659 libo_FUZZ_ARG_ENABLE(gio,
1660     AS_HELP_STRING([--disable-gio],
1661         [Determines whether to use the GIO support.]),
1662 ,test "${enable_gio+set}" = set || enable_gio=yes)
1664 AC_ARG_ENABLE(qt5,
1665     AS_HELP_STRING([--enable-qt5],
1666         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1667          available.]),
1670 AC_ARG_ENABLE(kf5,
1671     AS_HELP_STRING([--enable-kf5],
1672         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1673          KF5 are available.]),
1676 AC_ARG_ENABLE(gtk3_kde5,
1677     AS_HELP_STRING([--enable-gtk3-kde5],
1678         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1679          platforms where Gtk3, Qt5 and Plasma is available.]),
1682 AC_ARG_ENABLE(gui,
1683     AS_HELP_STRING([--disable-gui],
1684         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1685 ,enable_gui=yes)
1687 libo_FUZZ_ARG_ENABLE(randr,
1688     AS_HELP_STRING([--disable-randr],
1689         [Disable RandR support in the vcl project.]),
1690 ,test "${enable_randr+set}" = set || enable_randr=yes)
1692 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1693     AS_HELP_STRING([--disable-gstreamer-1-0],
1694         [Disable building with the gstreamer 1.0 avmedia backend.]),
1695 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1697 libo_FUZZ_ARG_ENABLE([eot],
1698     [AS_HELP_STRING([--enable-eot],
1699         [Enable support for Embedded OpenType fonts.])],
1700 ,test "${enable_eot+set}" = set || enable_eot=no)
1702 libo_FUZZ_ARG_ENABLE(cve-tests,
1703     AS_HELP_STRING([--disable-cve-tests],
1704         [Prevent CVE tests to be executed]),
1707 libo_FUZZ_ARG_ENABLE(chart-tests,
1708     AS_HELP_STRING([--enable-chart-tests],
1709         [Executes chart XShape tests. In a perfect world these tests would be
1710          stable and everyone could run them, in reality it is best to run them
1711          only on a few machines that are known to work and maintained by people
1712          who can judge if a test failure is a regression or not.]),
1715 AC_ARG_ENABLE(build-opensymbol,
1716     AS_HELP_STRING([--enable-build-opensymbol],
1717         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1718          fontforge installed.]),
1721 AC_ARG_ENABLE(dependency-tracking,
1722     AS_HELP_STRING([--enable-dependency-tracking],
1723         [Do not reject slow dependency extractors.])[
1724   --disable-dependency-tracking
1725                           Disables generation of dependency information.
1726                           Speed up one-time builds.],
1729 AC_ARG_ENABLE(icecream,
1730     AS_HELP_STRING([--enable-icecream],
1731         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1732          It defaults to /opt/icecream for the location of the icecream gcc/g++
1733          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1736 AC_ARG_ENABLE(ld,
1737     AS_HELP_STRING([--enable-ld=<linker>],
1738         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1739          By default tries to use the best linker possible, use --disable-ld to use the default linker.
1740          If <linker> contains any ':', the part before the first ':' is used as the value of
1741          -fuse-ld, while the part after the first ':' is used as the value of --ld-path (which is
1742          needed for Clang 12).]),
1745 libo_FUZZ_ARG_ENABLE(cups,
1746     AS_HELP_STRING([--disable-cups],
1747         [Do not build cups support.])
1750 AC_ARG_ENABLE(ccache,
1751     AS_HELP_STRING([--disable-ccache],
1752         [Do not try to use ccache automatically.
1753          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1754          CC/CXX are not yet set, and --enable-icecream is not given, we
1755          attempt to use ccache. --disable-ccache disables ccache completely.
1756          Additionally ccache's depend mode is enabled if possible,
1757          use --enable-ccache=nodepend to enable ccache without depend mode.
1761 libo_FUZZ_ARG_ENABLE(online-update,
1762     AS_HELP_STRING([--enable-online-update],
1763         [Enable the online update service that will check for new versions of
1764          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1765          If the value is "mar", the experimental Mozilla-like update will be
1766          enabled instead of the traditional update mechanism.]),
1769 AC_ARG_WITH(update-config,
1770     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1771                    [Path to the update config ini file]))
1773 libo_FUZZ_ARG_ENABLE(extension-update,
1774     AS_HELP_STRING([--disable-extension-update],
1775         [Disable possibility to update installed extensions.]),
1778 libo_FUZZ_ARG_ENABLE(release-build,
1779     AS_HELP_STRING([--enable-release-build],
1780         [Enable release build. Note that the "release build" choice is orthogonal to
1781          whether symbols are present, debug info is generated, or optimization
1782          is done.
1783          See http://wiki.documentfoundation.org/Development/DevBuild]),
1786 AC_ARG_ENABLE(windows-build-signing,
1787     AS_HELP_STRING([--enable-windows-build-signing],
1788         [Enable signing of windows binaries (*.exe, *.dll)]),
1791 AC_ARG_ENABLE(silent-msi,
1792     AS_HELP_STRING([--enable-silent-msi],
1793         [Enable MSI with LIMITUI=1 (silent install).]),
1796 AC_ARG_ENABLE(macosx-code-signing,
1797     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1798         [Sign executables, dylibs, frameworks and the app bundle. If you
1799          don't provide an identity the first suitable certificate
1800          in your keychain is used.]),
1803 AC_ARG_ENABLE(macosx-package-signing,
1804     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1805         [Create a .pkg suitable for uploading to the Mac App Store and sign
1806          it. If you don't provide an identity the first suitable certificate
1807          in your keychain is used.]),
1810 AC_ARG_ENABLE(macosx-sandbox,
1811     AS_HELP_STRING([--enable-macosx-sandbox],
1812         [Make the app bundle run in a sandbox. Requires code signing.
1813          Is required by apps distributed in the Mac App Store, and implies
1814          adherence to App Store rules.]),
1817 AC_ARG_WITH(macosx-bundle-identifier,
1818     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1819         [Define the macOS bundle identifier. Default is the somewhat weird
1820          org.libreoffice.script ("script", huh?).]),
1821 ,with_macosx_bundle_identifier=org.libreoffice.script)
1823 AC_ARG_WITH(product-name,
1824     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1825         [Define the product name. Default is AC_PACKAGE_NAME.]),
1826 ,with_product_name=$PRODUCTNAME)
1828 libo_FUZZ_ARG_ENABLE(community-flavor,
1829     AS_HELP_STRING([--disable-community-flavor],
1830         [Disable the Community branding.]),
1833 AC_ARG_WITH(package-version,
1834     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1835         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1838 libo_FUZZ_ARG_ENABLE(readonly-installset,
1839     AS_HELP_STRING([--enable-readonly-installset],
1840         [Prevents any attempts by LibreOffice to write into its installation. That means
1841          at least that no "system-wide" extensions can be added. Partly experimental work in
1842          progress, probably not fully implemented. Always enabled for macOS.]),
1845 libo_FUZZ_ARG_ENABLE(mariadb-sdbc,
1846     AS_HELP_STRING([--disable-mariadb-sdbc],
1847         [Disable the build of the MariaDB/MySQL-SDBC driver.])
1850 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1851     AS_HELP_STRING([--disable-postgresql-sdbc],
1852         [Disable the build of the PostgreSQL-SDBC driver.])
1855 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1856     AS_HELP_STRING([--disable-lotuswordpro],
1857         [Disable the build of the Lotus Word Pro filter.]),
1858 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1860 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1861     AS_HELP_STRING([--disable-firebird-sdbc],
1862         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1863 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1865 AC_ARG_ENABLE(bogus-pkg-config,
1866     AS_HELP_STRING([--enable-bogus-pkg-config],
1867         [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.]),
1870 AC_ARG_ENABLE(openssl,
1871     AS_HELP_STRING([--disable-openssl],
1872         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1873          components will either use GNUTLS or NSS. Work in progress,
1874          use only if you are hacking on it.]),
1875 ,enable_openssl=yes)
1877 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1878     AS_HELP_STRING([--enable-cipher-openssl-backend],
1879         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1880          Requires --enable-openssl.]))
1882 AC_ARG_ENABLE(nss,
1883     AS_HELP_STRING([--disable-nss],
1884         [Disable using NSS. If disabled,
1885          components will either use GNUTLS or openssl. Work in progress,
1886          use only if you are hacking on it.]),
1887 ,enable_nss=yes)
1889 AC_ARG_ENABLE(library-bin-tar,
1890     AS_HELP_STRING([--enable-library-bin-tar],
1891         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1892         Some libraries can save their build result in a tarball
1893         stored in TARFILE_LOCATION. That binary tarball is
1894         uniquely identified by the source tarball,
1895         the content of the config_host.mk file and the content
1896         of the top-level directory in core for that library
1897         If this option is enabled, then if such a tarfile exist, it will be untarred
1898         instead of the source tarfile, and the build step will be skipped for that
1899         library.
1900         If a proper tarfile does not exist, then the normal source-based
1901         build is done for that library and a proper binary tarfile is created
1902         for the next time.]),
1905 AC_ARG_ENABLE(dconf,
1906     AS_HELP_STRING([--disable-dconf],
1907         [Disable the dconf configuration backend (enabled by default where
1908          available).]))
1910 libo_FUZZ_ARG_ENABLE(formula-logger,
1911     AS_HELP_STRING(
1912         [--enable-formula-logger],
1913         [Enable formula logger for logging formula calculation flow in Calc.]
1914     )
1917 AC_ARG_ENABLE(ldap,
1918     AS_HELP_STRING([--disable-ldap],
1919         [Disable LDAP support.]),
1920 ,enable_ldap=yes)
1922 AC_ARG_ENABLE(opencl,
1923     AS_HELP_STRING([--disable-opencl],
1924         [Disable OpenCL support.]),
1925 ,enable_opencl=yes)
1927 libo_FUZZ_ARG_ENABLE(librelogo,
1928     AS_HELP_STRING([--disable-librelogo],
1929         [Do not build LibreLogo.]),
1930 ,enable_librelogo=yes)
1932 AC_ARG_ENABLE(cmis,
1933     AS_HELP_STRING([--disable-cmis],
1934         [Disable CMIS support.]),
1935 ,enable_cmis=yes)
1937 AC_ARG_ENABLE(curl,
1938     AS_HELP_STRING([--disable-curl],
1939         [Disable CURL support.]),
1940 ,enable_curl=yes)
1942 AC_ARG_ENABLE(wasm-strip,
1943     AS_HELP_STRING([--enable-wasm-strip],
1944         [Strip the static build like for WASM/emscripten platform.]),
1945 ,enable_wasm_strip=yes)
1947 AC_ARG_ENABLE(xmlhelp,
1948     AS_HELP_STRING([--disable-xmlhelp],
1949         [Disable XML help support]),
1950 ,enable_xmlhelp=yes)
1953 dnl ===================================================================
1954 dnl Optional Packages (--with/without-)
1955 dnl ===================================================================
1957 AC_ARG_WITH(gcc-home,
1958     AS_HELP_STRING([--with-gcc-home],
1959         [Specify the location of gcc/g++ manually. This can be used in conjunction
1960          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1961          non-default path.]),
1964 AC_ARG_WITH(gnu-patch,
1965     AS_HELP_STRING([--with-gnu-patch],
1966         [Specify location of GNU patch on Solaris or FreeBSD.]),
1969 AC_ARG_WITH(build-platform-configure-options,
1970     AS_HELP_STRING([--with-build-platform-configure-options],
1971         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1974 AC_ARG_WITH(gnu-cp,
1975     AS_HELP_STRING([--with-gnu-cp],
1976         [Specify location of GNU cp on Solaris or FreeBSD.]),
1979 AC_ARG_WITH(external-tar,
1980     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1981         [Specify an absolute path of where to find (and store) tarfiles.]),
1982     TARFILE_LOCATION=$withval ,
1985 AC_ARG_WITH(referenced-git,
1986     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1987         [Specify another checkout directory to reference. This makes use of
1988                  git submodule update --reference, and saves a lot of diskspace
1989                  when having multiple trees side-by-side.]),
1990     GIT_REFERENCE_SRC=$withval ,
1993 AC_ARG_WITH(linked-git,
1994     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1995         [Specify a directory where the repositories of submodules are located.
1996          This uses a method similar to git-new-workdir to get submodules.]),
1997     GIT_LINK_SRC=$withval ,
2000 AC_ARG_WITH(galleries,
2001     AS_HELP_STRING([--with-galleries],
2002         [Specify how galleries should be built. It is possible either to
2003          build these internally from source ("build"),
2004          or to disable them ("no")]),
2007 AC_ARG_WITH(theme,
2008     AS_HELP_STRING([--with-theme="theme1 theme2..."],
2009         [Choose which themes to include. By default those themes with an '*' are included.
2010          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg, *colibre, *colibre_svg, *elementary,
2011          *elementary_svg, *karasa_jaga, *karasa_jaga_svg, *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg, *sukapura, *sukapura_svg.]),
2014 libo_FUZZ_ARG_WITH(helppack-integration,
2015     AS_HELP_STRING([--without-helppack-integration],
2016         [It will not integrate the helppacks to the installer
2017          of the product. Please use this switch to use the online help
2018          or separate help packages.]),
2021 libo_FUZZ_ARG_WITH(fonts,
2022     AS_HELP_STRING([--without-fonts],
2023         [LibreOffice includes some third-party fonts to provide a reliable basis for
2024          help content, templates, samples, etc. When these fonts are already
2025          known to be available on the system then you should use this option.]),
2028 AC_ARG_WITH(epm,
2029     AS_HELP_STRING([--with-epm],
2030         [Decides which epm to use. Default is to use the one from the system if
2031          one is built. When either this is not there or you say =internal epm
2032          will be built.]),
2035 AC_ARG_WITH(package-format,
2036     AS_HELP_STRING([--with-package-format],
2037         [Specify package format(s) for LibreOffice installation sets. The
2038          implicit --without-package-format leads to no installation sets being
2039          generated. Possible values: aix, archive, bsd, deb, dmg,
2040          installed, msi, pkg, and rpm.
2041          Example: --with-package-format='deb rpm']),
2044 AC_ARG_WITH(tls,
2045     AS_HELP_STRING([--with-tls],
2046         [Decides which TLS/SSL and cryptographic implementations to use for
2047          LibreOffice's code. Notice that this doesn't apply for depending
2048          libraries like "neon", for example. Default is to use NSS
2049          although OpenSSL is also possible. Notice that selecting NSS restricts
2050          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
2051          restrict by now the usage of NSS in LO's code. Possible values:
2052          openssl, nss. Example: --with-tls="nss"]),
2055 AC_ARG_WITH(system-libs,
2056     AS_HELP_STRING([--with-system-libs],
2057         [Use libraries already on system -- enables all --with-system-* flags.]),
2060 AC_ARG_WITH(system-bzip2,
2061     AS_HELP_STRING([--with-system-bzip2],
2062         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
2063     [with_system_bzip2="$with_system_libs"])
2065 AC_ARG_WITH(system-headers,
2066     AS_HELP_STRING([--with-system-headers],
2067         [Use headers already on system -- enables all --with-system-* flags for
2068          external packages whose headers are the only entities used i.e.
2069          boost/odbc/sane-header(s).]),,
2070     [with_system_headers="$with_system_libs"])
2072 AC_ARG_WITH(system-jars,
2073     AS_HELP_STRING([--without-system-jars],
2074         [When building with --with-system-libs, also the needed jars are expected
2075          on the system. Use this to disable that]),,
2076     [with_system_jars="$with_system_libs"])
2078 AC_ARG_WITH(system-cairo,
2079     AS_HELP_STRING([--with-system-cairo],
2080         [Use cairo libraries already on system.  Happens automatically for
2081          (implicit) --enable-gtk3.]))
2083 AC_ARG_WITH(system-epoxy,
2084     AS_HELP_STRING([--with-system-epoxy],
2085         [Use epoxy libraries already on system.  Happens automatically for
2086          (implicit) --enable-gtk3.]),,
2087        [with_system_epoxy="$with_system_libs"])
2089 AC_ARG_WITH(myspell-dicts,
2090     AS_HELP_STRING([--with-myspell-dicts],
2091         [Adds myspell dictionaries to the LibreOffice installation set]),
2094 AC_ARG_WITH(system-dicts,
2095     AS_HELP_STRING([--without-system-dicts],
2096         [Do not use dictionaries from system paths.]),
2099 AC_ARG_WITH(external-dict-dir,
2100     AS_HELP_STRING([--with-external-dict-dir],
2101         [Specify external dictionary dir.]),
2104 AC_ARG_WITH(external-hyph-dir,
2105     AS_HELP_STRING([--with-external-hyph-dir],
2106         [Specify external hyphenation pattern dir.]),
2109 AC_ARG_WITH(external-thes-dir,
2110     AS_HELP_STRING([--with-external-thes-dir],
2111         [Specify external thesaurus dir.]),
2114 AC_ARG_WITH(system-zlib,
2115     AS_HELP_STRING([--with-system-zlib],
2116         [Use zlib already on system.]),,
2117     [with_system_zlib=auto])
2119 AC_ARG_WITH(system-jpeg,
2120     AS_HELP_STRING([--with-system-jpeg],
2121         [Use jpeg already on system.]),,
2122     [with_system_jpeg="$with_system_libs"])
2124 AC_ARG_WITH(system-clucene,
2125     AS_HELP_STRING([--with-system-clucene],
2126         [Use clucene already on system.]),,
2127     [with_system_clucene="$with_system_libs"])
2129 AC_ARG_WITH(system-expat,
2130     AS_HELP_STRING([--with-system-expat],
2131         [Use expat already on system.]),,
2132     [with_system_expat="$with_system_libs"])
2134 AC_ARG_WITH(system-libxml,
2135     AS_HELP_STRING([--with-system-libxml],
2136         [Use libxml/libxslt already on system.]),,
2137     [with_system_libxml=auto])
2139 AC_ARG_WITH(system-icu,
2140     AS_HELP_STRING([--with-system-icu],
2141         [Use icu already on system.]),,
2142     [with_system_icu="$with_system_libs"])
2144 AC_ARG_WITH(system-ucpp,
2145     AS_HELP_STRING([--with-system-ucpp],
2146         [Use ucpp already on system.]),,
2147     [])
2149 AC_ARG_WITH(system-openldap,
2150     AS_HELP_STRING([--with-system-openldap],
2151         [Use the OpenLDAP LDAP SDK already on system.]),,
2152     [with_system_openldap="$with_system_libs"])
2154 libo_FUZZ_ARG_ENABLE(poppler,
2155     AS_HELP_STRING([--disable-poppler],
2156         [Disable building Poppler.])
2159 AC_ARG_WITH(system-poppler,
2160     AS_HELP_STRING([--with-system-poppler],
2161         [Use system poppler (only needed for PDF import).]),,
2162     [with_system_poppler="$with_system_libs"])
2164 libo_FUZZ_ARG_ENABLE(gpgmepp,
2165     AS_HELP_STRING([--disable-gpgmepp],
2166         [Disable building gpgmepp. Do not use in normal cases unless you want to fix potential problems it causes.])
2169 AC_ARG_WITH(system-gpgmepp,
2170     AS_HELP_STRING([--with-system-gpgmepp],
2171         [Use gpgmepp already on system]),,
2172     [with_system_gpgmepp="$with_system_libs"])
2174 AC_ARG_WITH(system-mariadb,
2175     AS_HELP_STRING([--with-system-mariadb],
2176         [Use MariaDB/MySQL libraries already on system.]),,
2177     [with_system_mariadb="$with_system_libs"])
2179 AC_ARG_ENABLE(bundle-mariadb,
2180     AS_HELP_STRING([--enable-bundle-mariadb],
2181         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
2184 AC_ARG_WITH(system-postgresql,
2185     AS_HELP_STRING([--with-system-postgresql],
2186         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
2187          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
2188     [with_system_postgresql="$with_system_libs"])
2190 AC_ARG_WITH(libpq-path,
2191     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
2192         [Use this PostgreSQL C interface (libpq) installation for building
2193          the PostgreSQL-SDBC extension.]),
2196 AC_ARG_WITH(system-firebird,
2197     AS_HELP_STRING([--with-system-firebird],
2198         [Use Firebird libraries already on system, for building the Firebird-SDBC
2199          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
2200     [with_system_firebird="$with_system_libs"])
2202 AC_ARG_WITH(system-libtommath,
2203             AS_HELP_STRING([--with-system-libtommath],
2204                            [Use libtommath already on system]),,
2205             [with_system_libtommath="$with_system_libs"])
2207 AC_ARG_WITH(system-hsqldb,
2208     AS_HELP_STRING([--with-system-hsqldb],
2209         [Use hsqldb already on system.]))
2211 AC_ARG_WITH(hsqldb-jar,
2212     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
2213         [Specify path to jarfile manually.]),
2214     HSQLDB_JAR=$withval)
2216 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
2217     AS_HELP_STRING([--disable-scripting-beanshell],
2218         [Disable support for scripts in BeanShell.]),
2222 AC_ARG_WITH(system-beanshell,
2223     AS_HELP_STRING([--with-system-beanshell],
2224         [Use beanshell already on system.]),,
2225     [with_system_beanshell="$with_system_jars"])
2227 AC_ARG_WITH(beanshell-jar,
2228     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
2229         [Specify path to jarfile manually.]),
2230     BSH_JAR=$withval)
2232 libo_FUZZ_ARG_ENABLE(scripting-javascript,
2233     AS_HELP_STRING([--disable-scripting-javascript],
2234         [Disable support for scripts in JavaScript.]),
2238 AC_ARG_WITH(system-rhino,
2239     AS_HELP_STRING([--with-system-rhino],
2240         [Use rhino already on system.]),,)
2241 #    [with_system_rhino="$with_system_jars"])
2242 # Above is not used as we have different debug interface
2243 # patched into internal rhino. This code needs to be fixed
2244 # before we can enable it by default.
2246 AC_ARG_WITH(rhino-jar,
2247     AS_HELP_STRING([--with-rhino-jar=JARFILE],
2248         [Specify path to jarfile manually.]),
2249     RHINO_JAR=$withval)
2251 AC_ARG_WITH(system-jfreereport,
2252     AS_HELP_STRING([--with-system-jfreereport],
2253         [Use JFreeReport already on system.]),,
2254     [with_system_jfreereport="$with_system_jars"])
2256 AC_ARG_WITH(sac-jar,
2257     AS_HELP_STRING([--with-sac-jar=JARFILE],
2258         [Specify path to jarfile manually.]),
2259     SAC_JAR=$withval)
2261 AC_ARG_WITH(libxml-jar,
2262     AS_HELP_STRING([--with-libxml-jar=JARFILE],
2263         [Specify path to jarfile manually.]),
2264     LIBXML_JAR=$withval)
2266 AC_ARG_WITH(flute-jar,
2267     AS_HELP_STRING([--with-flute-jar=JARFILE],
2268         [Specify path to jarfile manually.]),
2269     FLUTE_JAR=$withval)
2271 AC_ARG_WITH(jfreereport-jar,
2272     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
2273         [Specify path to jarfile manually.]),
2274     JFREEREPORT_JAR=$withval)
2276 AC_ARG_WITH(liblayout-jar,
2277     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
2278         [Specify path to jarfile manually.]),
2279     LIBLAYOUT_JAR=$withval)
2281 AC_ARG_WITH(libloader-jar,
2282     AS_HELP_STRING([--with-libloader-jar=JARFILE],
2283         [Specify path to jarfile manually.]),
2284     LIBLOADER_JAR=$withval)
2286 AC_ARG_WITH(libformula-jar,
2287     AS_HELP_STRING([--with-libformula-jar=JARFILE],
2288         [Specify path to jarfile manually.]),
2289     LIBFORMULA_JAR=$withval)
2291 AC_ARG_WITH(librepository-jar,
2292     AS_HELP_STRING([--with-librepository-jar=JARFILE],
2293         [Specify path to jarfile manually.]),
2294     LIBREPOSITORY_JAR=$withval)
2296 AC_ARG_WITH(libfonts-jar,
2297     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
2298         [Specify path to jarfile manually.]),
2299     LIBFONTS_JAR=$withval)
2301 AC_ARG_WITH(libserializer-jar,
2302     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
2303         [Specify path to jarfile manually.]),
2304     LIBSERIALIZER_JAR=$withval)
2306 AC_ARG_WITH(libbase-jar,
2307     AS_HELP_STRING([--with-libbase-jar=JARFILE],
2308         [Specify path to jarfile manually.]),
2309     LIBBASE_JAR=$withval)
2311 AC_ARG_WITH(system-odbc,
2312     AS_HELP_STRING([--with-system-odbc],
2313         [Use the odbc headers already on system.]),,
2314     [with_system_odbc="auto"])
2316 AC_ARG_WITH(system-sane,
2317     AS_HELP_STRING([--with-system-sane],
2318         [Use sane.h already on system.]),,
2319     [with_system_sane="$with_system_headers"])
2321 AC_ARG_WITH(system-bluez,
2322     AS_HELP_STRING([--with-system-bluez],
2323         [Use bluetooth.h already on system.]),,
2324     [with_system_bluez="$with_system_headers"])
2326 AC_ARG_WITH(system-curl,
2327     AS_HELP_STRING([--with-system-curl],
2328         [Use curl already on system.]),,
2329     [with_system_curl=auto])
2331 AC_ARG_WITH(system-boost,
2332     AS_HELP_STRING([--with-system-boost],
2333         [Use boost already on system.]),,
2334     [with_system_boost="$with_system_headers"])
2336 AC_ARG_WITH(system-cuckoo,
2337     AS_HELP_STRING([--with-system-cuckoo],
2338         [Use libcuckoo already on system.]),,
2339     [with_system_cuckoo="$with_system_headers"])
2341 AC_ARG_WITH(system-glm,
2342     AS_HELP_STRING([--with-system-glm],
2343         [Use glm already on system.]),,
2344     [with_system_glm="$with_system_headers"])
2346 AC_ARG_WITH(system-hunspell,
2347     AS_HELP_STRING([--with-system-hunspell],
2348         [Use libhunspell already on system.]),,
2349     [with_system_hunspell="$with_system_libs"])
2351 libo_FUZZ_ARG_ENABLE(zxing,
2352     AS_HELP_STRING([--disable-zxing],
2353        [Disable use of zxing external library.]))
2355 AC_ARG_WITH(system-zxing,
2356     AS_HELP_STRING([--with-system-zxing],
2357         [Use libzxing already on system.]),,
2358     [with_system_zxing="$with_system_libs"])
2360 AC_ARG_WITH(system-box2d,
2361     AS_HELP_STRING([--with-system-box2d],
2362         [Use box2d already on system.]),,
2363     [with_system_box2d="$with_system_libs"])
2365 AC_ARG_WITH(system-mythes,
2366     AS_HELP_STRING([--with-system-mythes],
2367         [Use mythes already on system.]),,
2368     [with_system_mythes="$with_system_libs"])
2370 AC_ARG_WITH(system-altlinuxhyph,
2371     AS_HELP_STRING([--with-system-altlinuxhyph],
2372         [Use ALTLinuxhyph already on system.]),,
2373     [with_system_altlinuxhyph="$with_system_libs"])
2375 AC_ARG_WITH(system-lpsolve,
2376     AS_HELP_STRING([--with-system-lpsolve],
2377         [Use lpsolve already on system.]),,
2378     [with_system_lpsolve="$with_system_libs"])
2380 AC_ARG_WITH(system-coinmp,
2381     AS_HELP_STRING([--with-system-coinmp],
2382         [Use CoinMP already on system.]),,
2383     [with_system_coinmp="$with_system_libs"])
2385 AC_ARG_WITH(system-liblangtag,
2386     AS_HELP_STRING([--with-system-liblangtag],
2387         [Use liblangtag library already on system.]),,
2388     [with_system_liblangtag="$with_system_libs"])
2390 AC_ARG_WITH(webdav,
2391     AS_HELP_STRING([--with-webdav],
2392         [Specify which library to use for webdav implementation.
2393          Possible values: "neon", "serf", "no". The default value is "neon".
2394          Example: --with-webdav="serf"]))
2396 AC_ARG_WITH(linker-hash-style,
2397     AS_HELP_STRING([--with-linker-hash-style],
2398         [Use linker with --hash-style=<style> when linking shared objects.
2399          Possible values: "sysv", "gnu", "both". The default value is "gnu"
2400          if supported on the build system, and "sysv" otherwise.]))
2402 AC_ARG_WITH(jdk-home,
2403     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
2404         [If you have installed JDK 9 or later on your system please supply the
2405          path here. Note that this is not the location of the java command but the
2406          location of the entire distribution. In case of cross-compiling, this
2407          is the JDK of the host os. Use --with-build-platform-configure-options
2408          to point to a different build platform JDK.]),
2411 AC_ARG_WITH(help,
2412     AS_HELP_STRING([--with-help],
2413         [Enable the build of help. There is a special parameter "common" that
2414          can be used to bundle only the common part, .e.g help-specific icons.
2415          This is useful when you build the helpcontent separately.])
2416     [
2417                           Usage:     --with-help    build the old local help
2418                                  --without-help     no local help (default)
2419                                  --with-help=html   build the new HTML local help
2420                                  --with-help=online build the new HTML online help
2421     ],
2424 AC_ARG_WITH(omindex,
2425    AS_HELP_STRING([--with-omindex],
2426         [Enable the support of xapian-omega index for online help.])
2427    [
2428                          Usage: --with-omindex=server prepare the pages for omindex
2429                                 but let xapian-omega be built in server.
2430                                 --with-omindex=noxap do not prepare online pages
2431                                 for xapian-omega
2432   ],
2435 libo_FUZZ_ARG_WITH(java,
2436     AS_HELP_STRING([--with-java=<java command>],
2437         [Specify the name of the Java interpreter command. Typically "java"
2438          which is the default.
2440          To build without support for Java components, applets, accessibility
2441          or the XML filters written in Java, use --without-java or --with-java=no.]),
2442     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2443     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2446 AC_ARG_WITH(jvm-path,
2447     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2448         [Use a specific JVM search path at runtime.
2449          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2452 AC_ARG_WITH(ant-home,
2453     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2454         [If you have installed Apache Ant on your system, please supply the path here.
2455          Note that this is not the location of the Ant binary but the location
2456          of the entire distribution.]),
2459 AC_ARG_WITH(symbol-config,
2460     AS_HELP_STRING([--with-symbol-config],
2461         [Configuration for the crashreport symbol upload]),
2462         [],
2463         [with_symbol_config=no])
2465 AC_ARG_WITH(export-validation,
2466     AS_HELP_STRING([--without-export-validation],
2467         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2468 ,with_export_validation=auto)
2470 AC_ARG_WITH(bffvalidator,
2471     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2472         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2473          Requires installed Microsoft Office Binary File Format Validator.
2474          Note: export-validation (--with-export-validation) is required to be turned on.
2475          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2476 ,with_bffvalidator=no)
2478 libo_FUZZ_ARG_WITH(junit,
2479     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2480         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2481          --without-junit disables those tests. Not relevant in the --without-java case.]),
2482 ,with_junit=yes)
2484 AC_ARG_WITH(hamcrest,
2485     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2486         [Specifies the hamcrest jar file to use for JUnit-based tests.
2487          --without-junit disables those tests. Not relevant in the --without-java case.]),
2488 ,with_hamcrest=yes)
2490 AC_ARG_WITH(perl-home,
2491     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2492         [If you have installed Perl 5 Distribution, on your system, please
2493          supply the path here. Note that this is not the location of the Perl
2494          binary but the location of the entire distribution.]),
2497 libo_FUZZ_ARG_WITH(doxygen,
2498     AS_HELP_STRING(
2499         [--with-doxygen=<absolute path to doxygen executable>],
2500         [Specifies the doxygen executable to use when generating ODK C/C++
2501          documentation. --without-doxygen disables generation of ODK C/C++
2502          documentation. Not relevant in the --disable-odk case.]),
2503 ,with_doxygen=yes)
2505 AC_ARG_WITH(visual-studio,
2506     AS_HELP_STRING([--with-visual-studio=<2019>],
2507         [Specify which Visual Studio version to use in case several are
2508          installed. Currently only 2019 (default) is supported.]),
2511 AC_ARG_WITH(windows-sdk,
2512     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10.0>],
2513         [Specify which Windows SDK, or "Windows Kit", version to use
2514          in case the one that came with the selected Visual Studio
2515          is not what you want for some reason. Note that not all compiler/SDK
2516          combinations are supported. The intent is that this option should not
2517          be needed.]),
2520 AC_ARG_WITH(lang,
2521     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2522         [Use this option to build LibreOffice with additional UI language support.
2523          English (US) is always included by default.
2524          Separate multiple languages with space.
2525          For all languages, use --with-lang=ALL.]),
2528 AC_ARG_WITH(locales,
2529     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2530         [Use this option to limit the locale information built in.
2531          Separate multiple locales with space.
2532          Very experimental and might well break stuff.
2533          Just a desperate measure to shrink code and data size.
2534          By default all the locales available is included.
2535          This option is completely unrelated to --with-lang.])
2536     [
2537                           Affects also our character encoding conversion
2538                           tables for encodings mainly targeted for a
2539                           particular locale, like EUC-CN and EUC-TW for
2540                           zh, ISO-2022-JP for ja.
2542                           Affects also our add-on break iterator data for
2543                           some languages.
2545                           For the default, all locales, don't use this switch at all.
2546                           Specifying just the language part of a locale means all matching
2547                           locales will be included.
2548     ],
2551 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2552 libo_FUZZ_ARG_WITH(krb5,
2553     AS_HELP_STRING([--with-krb5],
2554         [Enable MIT Kerberos 5 support in modules that support it.
2555          By default automatically enabled on platforms
2556          where a good system Kerberos 5 is available.]),
2559 libo_FUZZ_ARG_WITH(gssapi,
2560     AS_HELP_STRING([--with-gssapi],
2561         [Enable GSSAPI support in modules that support it.
2562          By default automatically enabled on platforms
2563          where a good system GSSAPI is available.]),
2566 AC_ARG_WITH(iwyu,
2567     AS_HELP_STRING([--with-iwyu],
2568         [Use given IWYU binary path to check unneeded includes instead of building.
2569          Use only if you are hacking on it.]),
2572 libo_FUZZ_ARG_WITH(lxml,
2573     AS_HELP_STRING([--without-lxml],
2574         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2575          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2576          report widget classes and ids.]),
2579 libo_FUZZ_ARG_WITH(latest-c++,
2580     AS_HELP_STRING([--with-latest-c++],
2581         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2582          published standard.]),,
2583         [with_latest_c__=no])
2585 dnl ===================================================================
2586 dnl Branding
2587 dnl ===================================================================
2589 AC_ARG_WITH(branding,
2590     AS_HELP_STRING([--with-branding=/path/to/images],
2591         [Use given path to retrieve branding images set.])
2592     [
2593                           Search for intro.png about.svg and logo.svg.
2594                           If any is missing, default ones will be used instead.
2596                           Search also progress.conf for progress
2597                           settings on intro screen :
2599                           PROGRESSBARCOLOR="255,255,255" Set color of
2600                           progress bar. Comma separated RGB decimal values.
2601                           PROGRESSSIZE="407,6" Set size of progress bar.
2602                           Comma separated decimal values (width, height).
2603                           PROGRESSPOSITION="61,317" Set position of progress
2604                           bar from left,top. Comma separated decimal values.
2605                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2606                           bar frame. Comma separated RGB decimal values.
2607                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2608                           bar text. Comma separated RGB decimal values.
2609                           PROGRESSTEXTBASELINE="287" Set vertical position of
2610                           progress bar text from top. Decimal value.
2612                           Default values will be used if not found.
2613     ],
2617 AC_ARG_WITH(extra-buildid,
2618     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2619         [Show addition build identification in about dialog.]),
2623 AC_ARG_WITH(vendor,
2624     AS_HELP_STRING([--with-vendor="John the Builder"],
2625         [Set vendor of the build.]),
2628 AC_ARG_WITH(privacy-policy-url,
2629     AS_HELP_STRING([--with-privacy-policy-url="https://yourdomain/privacy-policy"],
2630         [The URL to your privacy policy (needed when
2631          enabling online-update or crashreporting via breakpad)]),
2632         [if test "x$with_privacy_policy_url" = "xyes"; then
2633             AC_MSG_FAILURE([you need to specify an argument when using --with-privacy-policy-url])
2634          elif test "x$with_privacy_policy_url" = "xno"; then
2635             with_privacy_policy_url="undefined"
2636          fi]
2637 ,[with_privacy_policy_url="undefined"])
2639 AC_ARG_WITH(android-package-name,
2640     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2641         [Set Android package name of the build.]),
2644 AC_ARG_WITH(compat-oowrappers,
2645     AS_HELP_STRING([--with-compat-oowrappers],
2646         [Install oo* wrappers in parallel with
2647          lo* ones to keep backward compatibility.
2648          Has effect only with make distro-pack-install]),
2651 AC_ARG_WITH(os-version,
2652     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2653         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2656 AC_ARG_WITH(idlc-cpp,
2657     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2658         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2661 AC_ARG_WITH(parallelism,
2662     AS_HELP_STRING([--with-parallelism],
2663         [Number of jobs to run simultaneously during build. Parallel builds can
2664         save a lot of time on multi-cpu machines. Defaults to the number of
2665         CPUs on the machine, unless you configure --enable-icecream - then to
2666         40.]),
2669 AC_ARG_WITH(all-tarballs,
2670     AS_HELP_STRING([--with-all-tarballs],
2671         [Download all external tarballs unconditionally]))
2673 AC_ARG_WITH(gdrive-client-id,
2674     AS_HELP_STRING([--with-gdrive-client-id],
2675         [Provides the client id of the application for OAuth2 authentication
2676         on Google Drive. If either this or --with-gdrive-client-secret is
2677         empty, the feature will be disabled]),
2680 AC_ARG_WITH(gdrive-client-secret,
2681     AS_HELP_STRING([--with-gdrive-client-secret],
2682         [Provides the client secret of the application for OAuth2
2683         authentication on Google Drive. If either this or
2684         --with-gdrive-client-id is empty, the feature will be disabled]),
2687 AC_ARG_WITH(alfresco-cloud-client-id,
2688     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2689         [Provides the client id of the application for OAuth2 authentication
2690         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2691         empty, the feature will be disabled]),
2694 AC_ARG_WITH(alfresco-cloud-client-secret,
2695     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2696         [Provides the client secret of the application for OAuth2
2697         authentication on Alfresco Cloud. If either this or
2698         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2701 AC_ARG_WITH(onedrive-client-id,
2702     AS_HELP_STRING([--with-onedrive-client-id],
2703         [Provides the client id of the application for OAuth2 authentication
2704         on OneDrive. If either this or --with-onedrive-client-secret is
2705         empty, the feature will be disabled]),
2708 AC_ARG_WITH(onedrive-client-secret,
2709     AS_HELP_STRING([--with-onedrive-client-secret],
2710         [Provides the client secret of the application for OAuth2
2711         authentication on OneDrive. If either this or
2712         --with-onedrive-client-id is empty, the feature will be disabled]),
2714 dnl ===================================================================
2715 dnl Do we want to use pre-build binary tarball for recompile
2716 dnl ===================================================================
2718 if test "$enable_library_bin_tar" = "yes" ; then
2719     USE_LIBRARY_BIN_TAR=TRUE
2720 else
2721     USE_LIBRARY_BIN_TAR=
2723 AC_SUBST(USE_LIBRARY_BIN_TAR)
2725 dnl ===================================================================
2726 dnl Test whether build target is Release Build
2727 dnl ===================================================================
2728 AC_MSG_CHECKING([whether build target is Release Build])
2729 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2730     AC_MSG_RESULT([no])
2731     ENABLE_RELEASE_BUILD=
2732     GET_TASK_ALLOW_ENTITLEMENT='
2733         <!-- We want to be able to debug a hardened process when not building for release -->
2734         <key>com.apple.security.get-task-allow</key>
2735         <true/>'
2736 else
2737     AC_MSG_RESULT([yes])
2738     ENABLE_RELEASE_BUILD=TRUE
2739     GET_TASK_ALLOW_ENTITLEMENT=''
2741 AC_SUBST(ENABLE_RELEASE_BUILD)
2742 AC_SUBST(GET_TASK_ALLOW_ENTITLEMENT)
2744 AC_MSG_CHECKING([whether to build a Community flavor])
2745 if test -z "$enable_community_flavor" -o "$enable_community_flavor" = "yes"; then
2746     AC_DEFINE(HAVE_FEATURE_COMMUNITY_FLAVOR)
2747     AC_MSG_RESULT([yes])
2748 else
2749     AC_MSG_RESULT([no])
2752 dnl ===================================================================
2753 dnl Test whether to sign Windows Build
2754 dnl ===================================================================
2755 AC_MSG_CHECKING([whether to sign windows build])
2756 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2757     AC_MSG_RESULT([yes])
2758     WINDOWS_BUILD_SIGNING="TRUE"
2759 else
2760     AC_MSG_RESULT([no])
2761     WINDOWS_BUILD_SIGNING="FALSE"
2763 AC_SUBST(WINDOWS_BUILD_SIGNING)
2765 dnl ===================================================================
2766 dnl MacOSX build and runtime environment options
2767 dnl ===================================================================
2769 AC_ARG_WITH(macosx-sdk,
2770     AS_HELP_STRING([--with-macosx-sdk=<version>],
2771         [Prefer a specific SDK for building.])
2772     [
2773                           If the requested SDK is not available, a search for the oldest one will be done.
2774                           With current Xcode versions, only the latest SDK is included, so this option is
2775                           not terribly useful. It works fine to build with a new SDK and run the result
2776                           on an older OS.
2778                           e. g.: --with-macosx-sdk=10.10
2780                           there are 3 options to control the MacOSX build:
2781                           --with-macosx-sdk (referred as 'sdk' below)
2782                           --with-macosx-version-min-required (referred as 'min' below)
2783                           --with-macosx-version-max-allowed (referred as 'max' below)
2785                           the connection between these value and the default they take is as follow:
2786                           ( ? means not specified on the command line, s means the SDK version found,
2787                           constraint: 8 <= x <= y <= z)
2789                           ==========================================
2790                            command line      || config result
2791                           ==========================================
2792                           min  | max  | sdk  || min   | max  | sdk  |
2793                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2794                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2795                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2796                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2797                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2798                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2799                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2800                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2803                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2804                           for a detailed technical explanation of these variables
2806                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2807     ],
2810 AC_ARG_WITH(macosx-version-min-required,
2811     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2812         [set the minimum OS version needed to run the built LibreOffice])
2813     [
2814                           e. g.: --with-macosx-version-min-required=10.10
2815                           see --with-macosx-sdk for more info
2816     ],
2819 AC_ARG_WITH(macosx-version-max-allowed,
2820     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2821         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2822     [
2823                           e. g.: --with-macosx-version-max-allowed=10.10
2824                           see --with-macosx-sdk for more info
2825     ],
2829 dnl ===================================================================
2830 dnl options for stuff used during cross-compilation build
2831 dnl Not quite superseded by --with-build-platform-configure-options.
2832 dnl TODO: check, if the "force" option is still needed anywhere.
2833 dnl ===================================================================
2835 AC_ARG_WITH(system-icu-for-build,
2836     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2837         [Use icu already on system for build tools (cross-compilation only).]))
2840 dnl ===================================================================
2841 dnl Check for incompatible options set by fuzzing, and reset those
2842 dnl automatically to working combinations
2843 dnl ===================================================================
2845 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2846         "$enable_dbus" != "$enable_avahi"; then
2847     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2848     enable_avahi=$enable_dbus
2851 add_lopath_after ()
2853     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2854         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2855     fi
2858 add_lopath_before ()
2860     local IFS=${P_SEP}
2861     local path_cleanup
2862     local dir
2863     for dir in $LO_PATH ; do
2864         if test "$dir" != "$1" ; then
2865             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2866         fi
2867     done
2868     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2871 dnl ===================================================================
2872 dnl check for required programs (grep, awk, sed, bash)
2873 dnl ===================================================================
2875 pathmunge ()
2877     local new_path
2878     if test -n "$1"; then
2879         if test "$build_os" = "cygwin"; then
2880             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2881                 PathFormat "$1"
2882                 new_path=`cygpath -sm "$formatted_path"`
2883             else
2884                 PathFormat "$1"
2885                 new_path=`cygpath -u "$formatted_path"`
2886             fi
2887         else
2888             new_path="$1"
2889         fi
2890         if test "$2" = "after"; then
2891             add_lopath_after "$new_path"
2892         else
2893             add_lopath_before "$new_path"
2894         fi
2895     fi
2898 AC_PROG_AWK
2899 AC_PATH_PROG( AWK, $AWK)
2900 if test -z "$AWK"; then
2901     AC_MSG_ERROR([install awk to run this script])
2904 AC_PATH_PROG(BASH, bash)
2905 if test -z "$BASH"; then
2906     AC_MSG_ERROR([bash not found in \$PATH])
2908 AC_SUBST(BASH)
2910 AC_MSG_CHECKING([for GNU or BSD tar])
2911 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2912     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2913     if test $? -eq 0;  then
2914         GNUTAR=$a
2915         break
2916     fi
2917 done
2918 AC_MSG_RESULT($GNUTAR)
2919 if test -z "$GNUTAR"; then
2920     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2922 AC_SUBST(GNUTAR)
2924 AC_MSG_CHECKING([for tar's option to strip components])
2925 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2926 if test $? -eq 0; then
2927     STRIP_COMPONENTS="--strip-components"
2928 else
2929     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2930     if test $? -eq 0; then
2931         STRIP_COMPONENTS="--strip-path"
2932     else
2933         STRIP_COMPONENTS="unsupported"
2934     fi
2936 AC_MSG_RESULT($STRIP_COMPONENTS)
2937 if test x$STRIP_COMPONENTS = xunsupported; then
2938     AC_MSG_ERROR([you need a tar that is able to strip components.])
2940 AC_SUBST(STRIP_COMPONENTS)
2942 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2943 dnl desktop OSes from "mobile" ones.
2945 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2946 dnl In other words, that when building for an OS that is not a
2947 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2949 dnl Note the direction of the implication; there is no assumption that
2950 dnl cross-compiling would imply a non-desktop OS.
2952 if test $_os != iOS -a $_os != Android -a $_os != Emscripten -a "$enable_fuzzers" != "yes"; then
2953     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2954     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2955     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2958 # Whether to build "avmedia" functionality or not.
2960 if test -z "$enable_avmedia"; then
2961     enable_avmedia=yes
2964 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2965 if test "$enable_avmedia" = yes; then
2966     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2967 else
2968     USE_AVMEDIA_DUMMY='TRUE'
2970 AC_SUBST(USE_AVMEDIA_DUMMY)
2972 # Decide whether to build database connectivity stuff (including Base) or not.
2973 if test "$enable_database_connectivity" != no; then
2974     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2975     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2976 else
2977     if test "$_os" = iOS; then
2978         AC_MSG_ERROR([Presumly can't disable DB connectivity on iOS.])
2979     fi
2980     disable_database_connectivity_dependencies
2983 if test -z "$enable_extensions"; then
2984     # For iOS and Android Viewer, disable extensions unless specifically overridden with --enable-extensions.
2985     if test $_os != iOS && test $_os != Android -o "$ENABLE_ANDROID_LOK" = TRUE ; then
2986         enable_extensions=yes
2987     fi
2990 if test "$enable_extensions" = yes; then
2991     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2992     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2993 else
2994     enable_extension_integration=no
2995     enable_extension_update=no
2998 if test -z "$enable_scripting"; then
2999     # Disable scripting for iOS unless specifically overridden
3000     # with --enable-scripting.
3001     if test $_os != iOS -o $_os = Emscripten; then
3002         enable_scripting=yes
3003     fi
3006 DISABLE_SCRIPTING=''
3007 if test "$enable_scripting" = yes; then
3008     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
3009     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
3010 else
3011     DISABLE_SCRIPTING='TRUE'
3012     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
3015 if test $_os = iOS -o $_os = Android -o $_os = Emscripten; then
3016     # Disable dynamic_loading always for iOS and Android
3017     enable_dynamic_loading=no
3018 elif test -z "$enable_dynamic_loading"; then
3019     # Otherwise enable it unless specifically disabled
3020     enable_dynamic_loading=yes
3023 DISABLE_DYNLOADING=''
3024 if test "$enable_dynamic_loading" = yes; then
3025     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
3026 else
3027     DISABLE_DYNLOADING='TRUE'
3029 AC_SUBST(DISABLE_DYNLOADING)
3031 # remember SYSBASE value
3032 AC_SUBST(SYSBASE)
3034 dnl ===================================================================
3035 dnl  Sort out various gallery compilation options
3036 dnl ===================================================================
3037 WITH_GALLERY_BUILD=TRUE
3038 AC_MSG_CHECKING([how to build and package galleries])
3039 if test -n "${with_galleries}"; then
3040     if test "$with_galleries" = "build"; then
3041         if test "$enable_database_connectivity" = no; then
3042             AC_MSG_ERROR([DB connectivity is needed for gengal / svx])
3043         fi
3044         AC_MSG_RESULT([build from source images internally])
3045     elif test "$with_galleries" = "no"; then
3046         WITH_GALLERY_BUILD=
3047         AC_MSG_RESULT([disable non-internal gallery build])
3048     else
3049         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
3050     fi
3051 else
3052     if test $_os != iOS -a $_os != Android; then
3053         AC_MSG_RESULT([internal src images for desktop])
3054     else
3055         WITH_GALLERY_BUILD=
3056         AC_MSG_RESULT([disable src image build])
3057     fi
3059 AC_SUBST(WITH_GALLERY_BUILD)
3061 dnl ===================================================================
3062 dnl  Checks if ccache is available
3063 dnl ===================================================================
3064 CCACHE_DEPEND_MODE=
3065 if test "$enable_ccache" = "no"; then
3066     CCACHE=""
3067 elif test "$_os" = "WINNT"; then
3068     # on windows/VC build do not use ccache - but perhaps sccache is around?
3069     case "%$CC%$CXX%" in
3070     # If $CC and/or $CXX already contain "sccache" (possibly suffixed with some version number etc),
3071     # assume that's good then
3072     *%sccache[[-_' ']]*|*/sccache[[-_' ']]*)
3073         AC_MSG_NOTICE([sccache seems to be included in a pre-defined CC and/or CXX])
3074         CCACHE_DEPEND_MODE=1
3075         ;;
3076     *)
3077         # for sharing code below, reuse CCACHE env var
3078         AC_PATH_PROG([CCACHE],[sccache],[not found])
3079         if test "$CCACHE" = "not found"; then
3080             CCACHE=""
3081         else
3082             CCACHE=`win_short_path_for_make "$CCACHE"`
3083             CCACHE_DEPEND_MODE=1
3084         fi
3085         ;;
3086     esac
3087 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
3088     case "%$CC%$CXX%" in
3089     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
3090     # assume that's good then
3091     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
3092         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
3093         CCACHE_DEPEND_MODE=1
3094         ;;
3095     *)
3096         AC_PATH_PROG([CCACHE],[ccache],[not found])
3097         if test "$CCACHE" = "not found"; then
3098             CCACHE=""
3099         else
3100             CCACHE_DEPEND_MODE=1
3101             # Need to check for ccache version: otherwise prevents
3102             # caching of the results (like "-x objective-c++" for Mac)
3103             if test $_os = Darwin -o $_os = iOS; then
3104                 # Check ccache version
3105                 AC_MSG_CHECKING([whether version of ccache is suitable])
3106                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
3107                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3108                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
3109                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
3110                 else
3111                     AC_MSG_RESULT([no, $CCACHE_VERSION])
3112                     CCACHE=""
3113                     CCACHE_DEPEND_MODE=
3114                 fi
3115             fi
3116         fi
3117         ;;
3118     esac
3119 else
3120     CCACHE=""
3122 if test "$enable_ccache" = "nodepend"; then
3123     CCACHE_DEPEND_MODE=""
3125 AC_SUBST(CCACHE_DEPEND_MODE)
3127 # skip on windows - sccache defaults are good enough
3128 if test "$CCACHE" != "" -a "$_os" != "WINNT"; then
3129     # e.g. (/home/rene/.config/ccache/ccache.conf) max_size = 20.0G
3130     # -p works with both 4.2 and 4.4
3131     ccache_size_msg=$([ccache -p | $AWK /max_size/'{ print $4 }' | sed -e 's/\.[0-9]*//'])
3132     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
3133     if test "$ccache_size" = ""; then
3134         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
3135         if test "$ccache_size" = ""; then
3136             ccache_size=0
3137         fi
3138         # we could not determine the size or it was less than 1GB -> disable auto-ccache
3139         if test $ccache_size -lt 1024; then
3140             CCACHE=""
3141             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
3142             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
3143         else
3144             # warn that ccache may be too small for debug build
3145             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3146             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3147         fi
3148     else
3149         if test $ccache_size -lt 5; then
3150             #warn that ccache may be too small for debug build
3151             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3152             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3153         fi
3154     fi
3157 dnl ===================================================================
3158 dnl  Checks for C compiler,
3159 dnl  The check for the C++ compiler is later on.
3160 dnl ===================================================================
3161 if test "$_os" != "WINNT"; then
3162     GCC_HOME_SET="true"
3163     AC_MSG_CHECKING([gcc home])
3164     if test -z "$with_gcc_home"; then
3165         if test "$enable_icecream" = "yes"; then
3166             if test -d "/usr/lib/icecc/bin"; then
3167                 GCC_HOME="/usr/lib/icecc/"
3168             elif test -d "/usr/libexec/icecc/bin"; then
3169                 GCC_HOME="/usr/libexec/icecc/"
3170             elif test -d "/opt/icecream/bin"; then
3171                 GCC_HOME="/opt/icecream/"
3172             else
3173                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
3175             fi
3176         else
3177             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
3178             GCC_HOME_SET="false"
3179         fi
3180     else
3181         GCC_HOME="$with_gcc_home"
3182     fi
3183     AC_MSG_RESULT($GCC_HOME)
3184     AC_SUBST(GCC_HOME)
3186     if test "$GCC_HOME_SET" = "true"; then
3187         if test -z "$CC"; then
3188             CC="$GCC_HOME/bin/gcc"
3189             CC_BASE="gcc"
3190         fi
3191         if test -z "$CXX"; then
3192             CXX="$GCC_HOME/bin/g++"
3193             CXX_BASE="g++"
3194         fi
3195     fi
3198 COMPATH=`dirname "$CC"`
3199 if test "$COMPATH" = "."; then
3200     AC_PATH_PROGS(COMPATH, $CC)
3201     dnl double square bracket to get single because of M4 quote...
3202     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
3204 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
3206 dnl ===================================================================
3207 dnl Java support
3208 dnl ===================================================================
3209 AC_MSG_CHECKING([whether to build with Java support])
3210 if test "$with_java" != "no"; then
3211     if test "$DISABLE_SCRIPTING" = TRUE; then
3212         AC_MSG_RESULT([no, overridden by --disable-scripting])
3213         ENABLE_JAVA=""
3214         with_java=no
3215     else
3216         AC_MSG_RESULT([yes])
3217         ENABLE_JAVA="TRUE"
3218         AC_DEFINE(HAVE_FEATURE_JAVA)
3219     fi
3220 else
3221     AC_MSG_RESULT([no])
3222     ENABLE_JAVA=""
3225 AC_SUBST(ENABLE_JAVA)
3227 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
3229 dnl ENABLE_JAVA="" indicate no Java support at all
3231 dnl ===================================================================
3232 dnl Check macOS SDK and compiler
3233 dnl ===================================================================
3235 if test $_os = Darwin; then
3237     # If no --with-macosx-sdk option is given, look for one
3239     # The intent is that for "most" Mac-based developers, a suitable
3240     # SDK will be found automatically without any configure options.
3242     # For developers with a current Xcode, the lowest-numbered SDK
3243     # higher than or equal to the minimum required should be found.
3245     AC_MSG_CHECKING([what macOS SDK to use])
3246     for _macosx_sdk in ${with_macosx_sdk-11.3 11.1 11.0 10.15 10.14 10.13}; do
3247         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
3248         if test -d "$MACOSX_SDK_PATH"; then
3249             with_macosx_sdk="${_macosx_sdk}"
3250             break
3251         else
3252             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
3253             if test -d "$MACOSX_SDK_PATH"; then
3254                 with_macosx_sdk="${_macosx_sdk}"
3255                 break
3256             fi
3257         fi
3258     done
3259     if test ! -d "$MACOSX_SDK_PATH"; then
3260         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
3261     fi
3263     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
3265     case $with_macosx_sdk in
3266     10.13)
3267         MACOSX_SDK_VERSION=101300
3268         ;;
3269     10.14)
3270         MACOSX_SDK_VERSION=101400
3271         ;;
3272     10.15)
3273         MACOSX_SDK_VERSION=101500
3274         ;;
3275     11.0)
3276         MACOSX_SDK_VERSION=110000
3277         ;;
3278     11.1)
3279         MACOSX_SDK_VERSION=110100
3280         ;;
3281     11.3)
3282         MACOSX_SDK_VERSION=110300
3283         ;;
3284     *)
3285         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.13--11.3])
3286         ;;
3287     esac
3289     if test "$host_cpu" = arm64 -a $MACOSX_SDK_VERSION -lt 110000; then
3290         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value for Apple Silicon])
3291     fi
3293     if test "$with_macosx_version_min_required" = "" ; then
3294         if test "$host_cpu" = x86_64; then
3295             with_macosx_version_min_required="10.10";
3296         else
3297             with_macosx_version_min_required="11.0";
3298         fi
3299     fi
3301     if test "$with_macosx_version_max_allowed" = "" ; then
3302         with_macosx_version_max_allowed="$with_macosx_sdk"
3303     fi
3305     # export this so that "xcrun" invocations later return matching values
3306     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
3307     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
3308     export DEVELOPER_DIR
3309     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
3310     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
3312     AC_MSG_CHECKING([whether Xcode is new enough])
3313     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
3314     my_xcode_ver2=${my_xcode_ver1#Xcode }
3315     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
3316     if test "$my_xcode_ver3" -ge 1103; then
3317         AC_MSG_RESULT([yes ($my_xcode_ver2)])
3318     else
3319         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 11.3])
3320     fi
3322     case "$with_macosx_version_min_required" in
3323     10.10)
3324         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
3325         ;;
3326     10.11)
3327         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
3328         ;;
3329     10.12)
3330         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
3331         ;;
3332     10.13)
3333         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
3334         ;;
3335     10.14)
3336         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
3337         ;;
3338     10.15)
3339         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
3340         ;;
3341     10.16)
3342         MAC_OS_X_VERSION_MIN_REQUIRED="101600"
3343         ;;
3344     11.0)
3345         MAC_OS_X_VERSION_MIN_REQUIRED="110000"
3346         ;;
3347     11.1)
3348         MAC_OS_X_VERSION_MIN_REQUIRED="110100"
3349         ;;
3350     11.3)
3351         MAC_OS_X_VERSION_MIN_REQUIRED="110300"
3352         ;;
3353     *)
3354         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--11.3])
3355         ;;
3356     esac
3358     LIBTOOL=/usr/bin/libtool
3359     INSTALL_NAME_TOOL=install_name_tool
3360     if test -z "$save_CC"; then
3361         stdlib=-stdlib=libc++
3363         AC_MSG_CHECKING([what C compiler to use])
3364         CC="`xcrun -find clang`"
3365         CC_BASE=`first_arg_basename "$CC"`
3366         if test "$host_cpu" = x86_64; then
3367             CC+=" -target x86_64-apple-macos"
3368         else
3369             CC+=" -target arm64-apple-macos"
3370         fi
3371         CC+=" -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3372         AC_MSG_RESULT([$CC])
3374         AC_MSG_CHECKING([what C++ compiler to use])
3375         CXX="`xcrun -find clang++`"
3376         CXX_BASE=`first_arg_basename "$CXX"`
3377         if test "$host_cpu" = x86_64; then
3378             CXX+=" -target x86_64-apple-macos"
3379         else
3380             CXX+=" -target arm64-apple-macos"
3381         fi
3382         CXX+=" $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3383         AC_MSG_RESULT([$CXX])
3385         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3386         AR=`xcrun -find ar`
3387         NM=`xcrun -find nm`
3388         STRIP=`xcrun -find strip`
3389         LIBTOOL=`xcrun -find libtool`
3390         RANLIB=`xcrun -find ranlib`
3391     fi
3393     case "$with_macosx_version_max_allowed" in
3394     10.10)
3395         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
3396         ;;
3397     10.11)
3398         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
3399         ;;
3400     10.12)
3401         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
3402         ;;
3403     10.13)
3404         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
3405         ;;
3406     10.14)
3407         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
3408         ;;
3409     10.15)
3410         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
3411         ;;
3412     11.0)
3413         MAC_OS_X_VERSION_MAX_ALLOWED="110000"
3414         ;;
3415     11.1)
3416         MAC_OS_X_VERSION_MAX_ALLOWED="110100"
3417         ;;
3418     11.3)
3419         MAC_OS_X_VERSION_MAX_ALLOWED="110300"
3420         ;;
3421     *)
3422         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--11.3])
3423         ;;
3424     esac
3426     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
3427     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
3428         AC_MSG_ERROR([the version minimum required, $MAC_OS_X_VERSION_MIN_REQUIRED, must be <= the version maximum allowed, $MAC_OS_X_VERSION_MAX_ALLOWED])
3429     else
3430         AC_MSG_RESULT([ok])
3431     fi
3433     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
3434     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
3435         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
3436     else
3437         AC_MSG_RESULT([ok])
3438     fi
3439     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
3440     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
3442     AC_MSG_CHECKING([whether to do code signing])
3444     if test "$enable_macosx_code_signing" = yes; then
3445         # By default use the first suitable certificate (?).
3447         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
3448         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
3449         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
3450         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
3451         # "Developer ID Application" one.
3453         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
3454         if test -n "$identity"; then
3455             MACOSX_CODESIGNING_IDENTITY=$identity
3456             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3457             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3458         else
3459             AC_MSG_ERROR([cannot determine identity to use])
3460         fi
3461     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
3462         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
3463         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3464         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3465     else
3466         AC_MSG_RESULT([no])
3467     fi
3469     AC_MSG_CHECKING([whether to create a Mac App Store package])
3471     if test -z "$enable_macosx_package_signing" || test "$enable_macosx_package_signing" == no; then
3472         AC_MSG_RESULT([no])
3473     elif test -z "$MACOSX_CODESIGNING_IDENTITY"; then
3474         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3475     elif test "$enable_macosx_package_signing" = yes; then
3476         # By default use the first suitable certificate.
3477         # It should be a "3rd Party Mac Developer Installer" one
3479         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
3480         if test -n "$identity"; then
3481             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3482             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3483             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3484         else
3485             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3486         fi
3487     else
3488         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
3489         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3490         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3491     fi
3493     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3494         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3495     fi
3497     AC_MSG_CHECKING([whether to sandbox the application])
3499     if test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3500         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3501     elif test "$enable_macosx_sandbox" = yes; then
3502         ENABLE_MACOSX_SANDBOX=TRUE
3503         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3504         AC_MSG_RESULT([yes])
3505     else
3506         AC_MSG_RESULT([no])
3507     fi
3509     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3510     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3511     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3513 AC_SUBST(MACOSX_SDK_PATH)
3514 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3515 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3516 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3517 AC_SUBST(INSTALL_NAME_TOOL)
3518 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3519 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3520 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3521 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3522 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3524 dnl ===================================================================
3525 dnl Check iOS SDK and compiler
3526 dnl ===================================================================
3528 if test $_os = iOS; then
3529     AC_MSG_CHECKING([what iOS SDK to use])
3530     current_sdk_ver=15.0
3531     older_sdk_vers="14.5"
3532     if test "$enable_ios_simulator" = "yes"; then
3533         platform=iPhoneSimulator
3534         versionmin=-mios-simulator-version-min=13.7
3535     else
3536         platform=iPhoneOS
3537         versionmin=-miphoneos-version-min=13.7
3538     fi
3539     xcode_developer=`xcode-select -print-path`
3541     for sdkver in $current_sdk_ver $older_sdk_vers; do
3542         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3543         if test -d $t; then
3544             sysroot=$t
3545             break
3546         fi
3547     done
3549     if test -z "$sysroot"; then
3550         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3551     fi
3553     AC_MSG_RESULT($sysroot)
3555     stdlib="-stdlib=libc++"
3557     AC_MSG_CHECKING([what C compiler to use])
3558     CC="`xcrun -find clang`"
3559     CC_BASE=`first_arg_basename "$CC"`
3560     CC+=" -arch $host_cpu_for_clang -isysroot $sysroot $versionmin"
3561     AC_MSG_RESULT([$CC])
3563     AC_MSG_CHECKING([what C++ compiler to use])
3564     CXX="`xcrun -find clang++`"
3565     CXX_BASE=`first_arg_basename "$CXX"`
3566     CXX+=" -arch $host_cpu_for_clang $stdlib -isysroot $sysroot $versionmin"
3567     AC_MSG_RESULT([$CXX])
3569     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3570     AR=`xcrun -find ar`
3571     NM=`xcrun -find nm`
3572     STRIP=`xcrun -find strip`
3573     LIBTOOL=`xcrun -find libtool`
3574     RANLIB=`xcrun -find ranlib`
3577 AC_MSG_CHECKING([whether to treat the installation as read-only])
3579 if test $_os = Darwin; then
3580     enable_readonly_installset=yes
3581 elif test "$enable_extensions" != yes; then
3582     enable_readonly_installset=yes
3584 if test "$enable_readonly_installset" = yes; then
3585     AC_MSG_RESULT([yes])
3586     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3587 else
3588     AC_MSG_RESULT([no])
3591 dnl ===================================================================
3592 dnl Structure of install set
3593 dnl ===================================================================
3595 if test $_os = Darwin; then
3596     LIBO_BIN_FOLDER=MacOS
3597     LIBO_ETC_FOLDER=Resources
3598     LIBO_LIBEXEC_FOLDER=MacOS
3599     LIBO_LIB_FOLDER=Frameworks
3600     LIBO_LIB_PYUNO_FOLDER=Resources
3601     LIBO_SHARE_FOLDER=Resources
3602     LIBO_SHARE_HELP_FOLDER=Resources/help
3603     LIBO_SHARE_JAVA_FOLDER=Resources/java
3604     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3605     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3606     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3607     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3608     LIBO_URE_BIN_FOLDER=MacOS
3609     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3610     LIBO_URE_LIB_FOLDER=Frameworks
3611     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3612     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3613 elif test $_os = WINNT; then
3614     LIBO_BIN_FOLDER=program
3615     LIBO_ETC_FOLDER=program
3616     LIBO_LIBEXEC_FOLDER=program
3617     LIBO_LIB_FOLDER=program
3618     LIBO_LIB_PYUNO_FOLDER=program
3619     LIBO_SHARE_FOLDER=share
3620     LIBO_SHARE_HELP_FOLDER=help
3621     LIBO_SHARE_JAVA_FOLDER=program/classes
3622     LIBO_SHARE_PRESETS_FOLDER=presets
3623     LIBO_SHARE_READMES_FOLDER=readmes
3624     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3625     LIBO_SHARE_SHELL_FOLDER=program/shell
3626     LIBO_URE_BIN_FOLDER=program
3627     LIBO_URE_ETC_FOLDER=program
3628     LIBO_URE_LIB_FOLDER=program
3629     LIBO_URE_MISC_FOLDER=program
3630     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3631 else
3632     LIBO_BIN_FOLDER=program
3633     LIBO_ETC_FOLDER=program
3634     LIBO_LIBEXEC_FOLDER=program
3635     LIBO_LIB_FOLDER=program
3636     LIBO_LIB_PYUNO_FOLDER=program
3637     LIBO_SHARE_FOLDER=share
3638     LIBO_SHARE_HELP_FOLDER=help
3639     LIBO_SHARE_JAVA_FOLDER=program/classes
3640     LIBO_SHARE_PRESETS_FOLDER=presets
3641     LIBO_SHARE_READMES_FOLDER=readmes
3642     if test "$enable_fuzzers" != yes; then
3643         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3644     else
3645         LIBO_SHARE_RESOURCE_FOLDER=resource
3646     fi
3647     LIBO_SHARE_SHELL_FOLDER=program/shell
3648     LIBO_URE_BIN_FOLDER=program
3649     LIBO_URE_ETC_FOLDER=program
3650     LIBO_URE_LIB_FOLDER=program
3651     LIBO_URE_MISC_FOLDER=program
3652     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3654 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3655 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3656 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3657 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3658 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3659 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3660 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3661 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3662 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3663 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3664 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3665 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3666 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3667 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3668 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3669 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3671 # Not all of them needed in config_host.mk, add more if need arises
3672 AC_SUBST(LIBO_BIN_FOLDER)
3673 AC_SUBST(LIBO_ETC_FOLDER)
3674 AC_SUBST(LIBO_LIB_FOLDER)
3675 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3676 AC_SUBST(LIBO_SHARE_FOLDER)
3677 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3678 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3679 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3680 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3681 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3682 AC_SUBST(LIBO_URE_BIN_FOLDER)
3683 AC_SUBST(LIBO_URE_ETC_FOLDER)
3684 AC_SUBST(LIBO_URE_LIB_FOLDER)
3685 AC_SUBST(LIBO_URE_MISC_FOLDER)
3686 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3688 dnl ===================================================================
3689 dnl Windows specific tests and stuff
3690 dnl ===================================================================
3692 reg_get_value()
3694     # Return value: $regvalue
3695     unset regvalue
3697     if test "$build_os" = "wsl"; then
3698         regvalue=$($BUILDDIR/solenv/wsl/wsl-lo-helper.exe --read-registry $1 "$2" 2>/dev/null)
3699         return
3700     fi
3702     local _regentry="/proc/registry${1}/${2}"
3703     if test -f "$_regentry"; then
3704         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3705         # Registry keys read via /proc/registry* are always \0 terminated!
3706         local _regvalue=$(tr -d '\0' < "$_regentry")
3707         if test $? -eq 0; then
3708             regvalue=$_regvalue
3709         fi
3710     fi
3713 # Get a value from the 32-bit side of the Registry
3714 reg_get_value_32()
3716     reg_get_value "32" "$1"
3719 # Get a value from the 64-bit side of the Registry
3720 reg_get_value_64()
3722     reg_get_value "64" "$1"
3725 case "$host_os" in
3726 cygwin*|wsl*)
3727     COM=MSC
3728     OS=WNT
3729     RTL_OS=Windows
3730     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3731         P_SEP=";"
3732     else
3733         P_SEP=:
3734     fi
3735     case "$host_cpu" in
3736     x86_64)
3737         CPUNAME=X86_64
3738         RTL_ARCH=X86_64
3739         PLATFORMID=windows_x86_64
3740         WINDOWS_X64=1
3741         SCPDEFS="$SCPDEFS -DWINDOWS_X64"
3742         WIN_HOST_ARCH="x64"
3743         WIN_MULTI_ARCH="x86"
3744         WIN_HOST_BITS=64
3745         ;;
3746     i*86)
3747         CPUNAME=INTEL
3748         RTL_ARCH=x86
3749         PLATFORMID=windows_x86
3750         WIN_HOST_ARCH="x86"
3751         WIN_HOST_BITS=32
3752         WIN_OTHER_ARCH="x64"
3753         ;;
3754     aarch64)
3755         CPUNAME=AARCH64
3756         RTL_ARCH=AARCH64
3757         PLATFORMID=windows_aarch64
3758         WINDOWS_X64=1
3759         SCPDEFS="$SCPDEFS -DWINDOWS_AARCH64"
3760         WIN_HOST_ARCH="arm64"
3761         WIN_HOST_BITS=64
3762         with_ucrt_dir=no
3763         ;;
3764     *)
3765         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3766         ;;
3767     esac
3769     case "$build_cpu" in
3770     x86_64) WIN_BUILD_ARCH="x64" ;;
3771     i*86) WIN_BUILD_ARCH="x86" ;;
3772     aarch64) WIN_BUILD_ARCH="arm64" ;;
3773     *)
3774         AC_MSG_ERROR([Unsupported build_cpu $build_cpu for host_os $host_os])
3775         ;;
3776     esac
3778     SCPDEFS="$SCPDEFS -D_MSC_VER"
3779     ;;
3780 esac
3782 # multi-arch is an arch, which can execute on the host (x86 on x64), while
3783 # other-arch won't, but wouldn't break the build (x64 on x86).
3784 if test -n "$WIN_MULTI_ARCH" -a -n "$WIN_OTHER_ARCH"; then
3785     AC_MSG_ERROR([Broken configure.ac file: can't have set \$WIN_MULTI_ARCH and $WIN_OTHER_ARCH])
3789 if test "$_os" = "iOS" -o "$build_cpu" != "$host_cpu"; then
3790     # To allow building Windows multi-arch releases without cross-tooling
3791     if test -z "$WIN_MULTI_ARCH" -a -z "$WIN_OTHER_ARCH"; then
3792         cross_compiling="yes"
3793     fi
3796 ENABLE_WASM_STRIP=''
3797 if test "$cross_compiling" = "yes"; then
3798     export CROSS_COMPILING=TRUE
3799     if test "$enable_dynamic_loading" != yes -a "$enable_wasm_strip" = yes; then
3800         ENABLE_WASM_STRIP=TRUE
3801     fi
3802 else
3803     CROSS_COMPILING=
3804     BUILD_TYPE="$BUILD_TYPE NATIVE"
3806 AC_SUBST(CROSS_COMPILING)
3807 AC_SUBST(ENABLE_WASM_STRIP)
3809 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3810 # NOTE: must _not_ be used for bundled external libraries!
3811 ISYSTEM=
3812 if test "$GCC" = "yes"; then
3813     AC_MSG_CHECKING( for -isystem )
3814     save_CFLAGS=$CFLAGS
3815     CFLAGS="$CFLAGS -Werror"
3816     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3817     CFLAGS=$save_CFLAGS
3818     if test -n "$ISYSTEM"; then
3819         AC_MSG_RESULT(yes)
3820     else
3821         AC_MSG_RESULT(no)
3822     fi
3824 if test -z "$ISYSTEM"; then
3825     # fall back to using -I
3826     ISYSTEM=-I
3828 AC_SUBST(ISYSTEM)
3830 dnl ===================================================================
3831 dnl  Check which Visual Studio compiler is used
3832 dnl ===================================================================
3834 map_vs_year_to_version()
3836     # Return value: $vsversion
3838     unset vsversion
3840     case $1 in
3841     2019)
3842         vsversion=16;;
3843     2022)
3844         vsversion=17;;
3845     *)
3846         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3847     esac
3850 vs_versions_to_check()
3852     # Args: $1 (optional) : versions to check, in the order of preference
3853     # Return value: $vsversions
3855     unset vsversions
3857     if test -n "$1"; then
3858         map_vs_year_to_version "$1"
3859         vsversions=$vsversion
3860     else
3861         # We accept only 2019
3862         vsversions="16"
3863     fi
3866 win_get_env_from_vsvars32bat()
3868     local WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3869     # Also seems to be located in another directory under the same name: vsvars32.bat
3870     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3871     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3872     # use 'echo.%ENV%' syntax (instead of 'echo %ENV%') to avoid outputting "ECHO is off." in case when ENV is empty or a space
3873     printf '@setlocal\r\n@echo.%%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3874     local result
3875     if test "$build_os" = "wsl"; then
3876         result=$(cd /mnt/c && cmd.exe /c $(wslpath -w $WRAPPERBATCHFILEPATH) | tr -d '\r')
3877     else
3878         chmod +x $WRAPPERBATCHFILEPATH
3879         result=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3880     fi
3881     rm -f $WRAPPERBATCHFILEPATH
3882     printf '%s' "$result"
3885 find_ucrt()
3887     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3888     if test -n "$regvalue"; then
3889         PathFormat "$regvalue"
3890         UCRTSDKDIR=$formatted_path_unix
3891         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3892         UCRTVERSION=$regvalue
3893         # Rest if not exist
3894         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3895           UCRTSDKDIR=
3896         fi
3897     fi
3898     if test -z "$UCRTSDKDIR"; then
3899         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3900         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3901         if test -f "$ide_env_file"; then
3902             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3903             UCRTSDKDIR=$formatted_path
3904             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3905             dnl Hack needed at least by tml:
3906             if test "$UCRTVERSION" = 10.0.15063.0 \
3907                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3908                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3909             then
3910                 UCRTVERSION=10.0.14393.0
3911             fi
3912         else
3913           AC_MSG_ERROR([No UCRT found])
3914         fi
3915     fi
3918 find_msvc()
3920     # Find Visual C++ 2019
3921     # Args: $1 (optional) : The VS version year
3922     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3924     unset vctest vcnum vcnumwithdot vcbuildnumber
3926     vs_versions_to_check "$1"
3927     if test "$build_os" = wsl; then
3928         vswhere="$PROGRAMFILESX86"
3929     else
3930         vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3931     fi
3932     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3933     PathFormat "$vswhere"
3934     vswhere=$formatted_path_unix
3935     for ver in $vsversions; do
3936         vswhereoutput=`$vswhere -prerelease -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3937         # Fall back to all MS products (this includes VC++ Build Tools)
3938         if ! test -n "$vswhereoutput"; then
3939             AC_MSG_CHECKING([VC++ Build Tools and similar])
3940             vswhereoutput=`$vswhere -products \* -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3941         fi
3942         if test -n "$vswhereoutput"; then
3943             PathFormat "$vswhereoutput"
3944             vctest=$formatted_path_unix
3945             break
3946         fi
3947     done
3949     if test -n "$vctest"; then
3950         vcnumwithdot="$ver.0"
3951         case "$vcnumwithdot" in
3952         16.0)
3953             vcyear=2019
3954             vcnum=160
3955             ;;
3956         17.0)
3957             vcyear=2022
3958             vcnum=170
3959             ;;
3960         esac
3961         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3963     fi
3966 test_cl_exe()
3968     AC_MSG_CHECKING([$1 compiler])
3970     CL_EXE_PATH="$2/cl.exe"
3972     if test ! -f "$CL_EXE_PATH"; then
3973         if test "$1" = "multi-arch"; then
3974             AC_MSG_WARN([no compiler (cl.exe) in $2])
3975             return 1
3976         else
3977             AC_MSG_ERROR([no compiler (cl.exe) in $2])
3978         fi
3979     fi
3981     dnl ===========================================================
3982     dnl  Check for the corresponding mspdb*.dll
3983     dnl ===========================================================
3985     # MSVC 15.0 has libraries from 14.0?
3986     mspdbnum="140"
3988     if test ! -e "$2/mspdb${mspdbnum}.dll"; then
3989         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $2, Visual Studio installation broken?])
3990     fi
3992     # The compiles has to find its shared libraries
3993     OLD_PATH="$PATH"
3994     TEMP_PATH=`cygpath -d "$2"`
3995     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3997     if ! "$CL_EXE_PATH" -? </dev/null >/dev/null 2>&1; then
3998         AC_MSG_ERROR([no compiler (cl.exe) in $2])
3999     fi
4001     PATH="$OLD_PATH"
4003     AC_MSG_RESULT([$CL_EXE_PATH])
4006 SOLARINC=
4007 MSBUILD_PATH=
4008 DEVENV=
4009 if test "$_os" = "WINNT"; then
4010     AC_MSG_CHECKING([Visual C++])
4011     find_msvc "$with_visual_studio"
4012     if test -z "$vctest"; then
4013         if test -n "$with_visual_studio"; then
4014             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
4015         else
4016             AC_MSG_ERROR([no Visual Studio 2019 installation found])
4017         fi
4018     fi
4019     AC_MSG_RESULT([])
4021     VC_PRODUCT_DIR="$vctest/VC"
4022     COMPATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber"
4024     # $WIN_OTHER_ARCH is a hack to test the x64 compiler on x86, even if it's not multi-arch
4025     if test -n "$WIN_MULTI_ARCH" -o -n "$WIN_OTHER_ARCH"; then
4026         MSVC_MULTI_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/${WIN_MULTI_ARCH}${WIN_OTHER_ARCH}"
4027         test_cl_exe "multi-arch" "$MSVC_MULTI_PATH"
4028         if test $? -ne 0; then
4029             WIN_MULTI_ARCH=""
4030             WIN_OTHER_ARCH=""
4031         fi
4032     fi
4034     if test "$WIN_BUILD_ARCH" = "$WIN_HOST_ARCH"; then
4035         MSVC_BUILD_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_BUILD_ARCH"
4036         test_cl_exe "build" "$MSVC_BUILD_PATH"
4037     fi
4039     if test "$WIN_BUILD_ARCH" != "$WIN_HOST_ARCH"; then
4040         MSVC_HOST_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_HOST_ARCH"
4041         test_cl_exe "host" "$MSVC_HOST_PATH"
4042     else
4043         MSVC_HOST_PATH="$MSVC_BUILD_PATH"
4044     fi
4046     AC_MSG_CHECKING([for short pathname of VC product directory])
4047     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
4048     AC_MSG_RESULT([$VC_PRODUCT_DIR])
4050     UCRTSDKDIR=
4051     UCRTVERSION=
4053     AC_MSG_CHECKING([for UCRT location])
4054     find_ucrt
4055     # find_ucrt errors out if it doesn't find it
4056     AC_MSG_RESULT([$UCRTSDKDIR ($UCRTVERSION)])
4057     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
4058     ucrtincpath_formatted=$formatted_path
4059     # SOLARINC is used for external modules and must be set too.
4060     # And no, it's not sufficient to set SOLARINC only, as configure
4061     # itself doesn't honour it.
4062     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
4063     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
4064     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
4065     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
4067     AC_SUBST(UCRTSDKDIR)
4068     AC_SUBST(UCRTVERSION)
4070     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
4071     # Find the proper version of MSBuild.exe to use based on the VS version
4072     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
4073     if test -z "$regvalue" ; then
4074         if test "$WIN_BUILD_ARCH" != "x64"; then
4075             regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
4076         else
4077             regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
4078         fi
4079     fi
4080     if test -d "$regvalue" ; then
4081         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
4082         AC_MSG_RESULT([$regvalue])
4083     else
4084         AC_MSG_ERROR([MSBuild.exe location not found])
4085     fi
4087     # Find the version of devenv.exe
4088     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
4089     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
4090     DEVENV_unix=$(cygpath -u "$DEVENV")
4091     if test ! -e "$DEVENV_unix"; then
4092         AC_MSG_WARN([No devenv.exe found - this is expected for VC++ Build Tools])
4093     fi
4095     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
4096     dnl needed when building CLR code:
4097     if test -z "$MSVC_CXX"; then
4098         # This gives us a posix path with 8.3 filename restrictions
4099         MSVC_CXX=`win_short_path_for_make "$MSVC_HOST_PATH/cl.exe"`
4100     fi
4102     if test -z "$CC"; then
4103         CC=$MSVC_CXX
4104         CC_BASE=`first_arg_basename "$CC"`
4105     fi
4106     if test -z "$CXX"; then
4107         CXX=$MSVC_CXX
4108         CXX_BASE=`first_arg_basename "$CXX"`
4109     fi
4111     if test -n "$CC"; then
4112         # Remove /cl.exe from CC case insensitive
4113         AC_MSG_NOTICE([found Visual C++ $vcyear])
4115         main_include_dir=`cygpath -d -m "$COMPATH/Include"`
4116         CPPFLAGS="$CPPFLAGS -I$main_include_dir"
4118         PathFormat "$COMPATH"
4119         COMPATH=`win_short_path_for_make "$formatted_path"`
4121         VCVER=$vcnum
4123         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
4124         # are always "better", we list them in reverse chronological order.
4126         case "$vcnum" in
4127         160 | 170)
4128             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
4129             ;;
4130         esac
4132         # The expectation is that --with-windows-sdk should not need to be used
4133         if test -n "$with_windows_sdk"; then
4134             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
4135             *" "$with_windows_sdk" "*)
4136                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
4137                 ;;
4138             *)
4139                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $vcyear])
4140                 ;;
4141             esac
4142         fi
4144         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
4145         ac_objext=obj
4146         ac_exeext=exe
4148     else
4149         AC_MSG_ERROR([Visual C++ not found after all, huh])
4150     fi
4152     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.5])
4153     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4154         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
4155         // between Visual Studio versions and _MSC_VER:
4156         #if _MSC_VER < 1925
4157         #error
4158         #endif
4159     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
4161     # Check for 64-bit (cross-)compiler to use to build the 64-bit
4162     # version of the Explorer extension (and maybe other small
4163     # bits, too) needed when installing a 32-bit LibreOffice on a
4164     # 64-bit OS. The 64-bit Explorer extension is a feature that
4165     # has been present since long in OOo. Don't confuse it with
4166     # building LibreOffice itself as 64-bit code.
4168     BUILD_X64=
4169     CXX_X64_BINARY=
4171     if test "$WIN_HOST_ARCH" = "x86" -a -n "$WIN_OTHER_ARCH"; then
4172         AC_MSG_CHECKING([for the libraries to build the 64-bit Explorer extensions])
4173         if test -f "$COMPATH/atlmfc/lib/x64/atls.lib" -o \
4174              -f "$COMPATH/atlmfc/lib/spectre/x64/atls.lib"
4175         then
4176             BUILD_X64=TRUE
4177             CXX_X64_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4178             AC_MSG_RESULT([found])
4179         else
4180             AC_MSG_RESULT([not found])
4181             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
4182         fi
4183     elif test "$WIN_HOST_ARCH" = "x64"; then
4184         CXX_X64_BINARY=$CXX
4185     fi
4186     AC_SUBST(BUILD_X64)
4188     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
4189     AC_SUBST(CXX_X64_BINARY)
4191     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
4192     # needed to support TWAIN scan on both 32- and 64-bit systems
4194     case "$WIN_HOST_ARCH" in
4195     x64)
4196         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
4197         if test -n "$CXX_X86_BINARY"; then
4198             BUILD_X86=TRUE
4199             AC_MSG_RESULT([preset])
4200         elif test -n "$WIN_MULTI_ARCH"; then
4201             BUILD_X86=TRUE
4202             CXX_X86_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4203             CXX_X86_BINARY+=" /arch:SSE"
4204             AC_MSG_RESULT([found])
4205         else
4206             AC_MSG_RESULT([not found])
4207             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
4208         fi
4209         ;;
4210     x86)
4211         BUILD_X86=TRUE
4212         CXX_X86_BINARY=$MSVC_CXX
4213         ;;
4214     esac
4215     AC_SUBST(BUILD_X86)
4216     AC_SUBST(CXX_X86_BINARY)
4218 AC_SUBST(VCVER)
4219 AC_SUBST(DEVENV)
4220 AC_SUBST(MSVC_CXX)
4222 COM_IS_CLANG=
4223 AC_MSG_CHECKING([whether the compiler is actually Clang])
4224 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4225     #ifndef __clang__
4226     you lose
4227     #endif
4228     int foo=42;
4229     ]])],
4230     [AC_MSG_RESULT([yes])
4231      COM_IS_CLANG=TRUE],
4232     [AC_MSG_RESULT([no])])
4233 AC_SUBST(COM_IS_CLANG)
4235 CC_PLAIN=$CC
4236 CLANGVER=
4237 if test "$COM_IS_CLANG" = TRUE; then
4238     AC_MSG_CHECKING([whether Clang is new enough])
4239     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4240         #if !defined __apple_build_version__
4241         #error
4242         #endif
4243         ]])],
4244         [my_apple_clang=yes],[my_apple_clang=])
4245     if test "$my_apple_clang" = yes; then
4246         AC_MSG_RESULT([assumed yes (Apple Clang)])
4247     elif test "$_os" = Emscripten; then
4248         AC_MSG_RESULT([assumed yes (Emscripten Clang)])
4249     else
4250         if test "$_os" = WINNT; then
4251             dnl In which case, assume clang-cl:
4252             my_args="/EP /TC"
4253             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
4254             dnl clang-cl:
4255             CC_PLAIN=
4256             for i in $CC; do
4257                 case $i in
4258                 -FIIntrin.h)
4259                     ;;
4260                 *)
4261                     CC_PLAIN="$CC_PLAIN $i"
4262                     ;;
4263                 esac
4264             done
4265         else
4266             my_args="-E -P"
4267         fi
4268         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
4269         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
4270         CLANGVER=`echo $clang_version \
4271             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
4272         if test "$CLANGVER" -ge 50002; then
4273             AC_MSG_RESULT([yes ($clang_version)])
4274         else
4275             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
4276         fi
4277         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
4278         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
4279     fi
4282 SHOWINCLUDES_PREFIX=
4283 if test "$_os" = WINNT; then
4284     dnl We need to guess the prefix of the -showIncludes output, it can be
4285     dnl localized
4286     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
4287     echo "#include <stdlib.h>" > conftest.c
4288     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
4289         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
4290     rm -f conftest.c conftest.obj
4291     if test -z "$SHOWINCLUDES_PREFIX"; then
4292         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
4293     else
4294         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
4295     fi
4297 AC_SUBST(SHOWINCLUDES_PREFIX)
4300 # prefix C with ccache if needed
4302 UNCACHED_CC="$CC"
4303 if test "$CCACHE" != ""; then
4304     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
4306     AC_LANG_PUSH([C])
4307     save_CFLAGS=$CFLAGS
4308     CFLAGS="$CFLAGS --ccache-skip -O2"
4309     dnl an empty program will do, we're checking the compiler flags
4310     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
4311                       [use_ccache=yes], [use_ccache=no])
4312     CFLAGS=$save_CFLAGS
4313     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
4314         AC_MSG_RESULT([yes])
4315     else
4316         CC="$CCACHE $CC"
4317         CC_BASE="ccache $CC_BASE"
4318         AC_MSG_RESULT([no])
4319     fi
4320     AC_LANG_POP([C])
4323 # ===================================================================
4324 # check various GCC options that Clang does not support now but maybe
4325 # will somewhen in the future, check them even for GCC, so that the
4326 # flags are set
4327 # ===================================================================
4329 HAVE_GCC_GGDB2=
4330 if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4331     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
4332     save_CFLAGS=$CFLAGS
4333     CFLAGS="$CFLAGS -Werror -ggdb2"
4334     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
4335     CFLAGS=$save_CFLAGS
4336     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
4337         AC_MSG_RESULT([yes])
4338     else
4339         AC_MSG_RESULT([no])
4340     fi
4342     if test "$host_cpu" = "m68k"; then
4343         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
4344         save_CFLAGS=$CFLAGS
4345         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
4346         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
4347         CFLAGS=$save_CFLAGS
4348         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
4349             AC_MSG_RESULT([yes])
4350         else
4351             AC_MSG_ERROR([no])
4352         fi
4353     fi
4355 AC_SUBST(HAVE_GCC_GGDB2)
4357 dnl ===================================================================
4358 dnl  Test the gcc version
4359 dnl ===================================================================
4360 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
4361     AC_MSG_CHECKING([the GCC version])
4362     _gcc_version=`$CC -dumpversion`
4363     gcc_full_version=$(printf '%s' "$_gcc_version" | \
4364         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
4365     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
4367     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
4369     if test "$gcc_full_version" -lt 70000; then
4370         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
4371     fi
4372 else
4373     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
4374     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
4375     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
4376     # (which reports itself as GCC 4.2.1).
4377     GCC_VERSION=
4379 AC_SUBST(GCC_VERSION)
4381 dnl Set the ENABLE_DBGUTIL variable
4382 dnl ===================================================================
4383 AC_MSG_CHECKING([whether to build with additional debug utilities])
4384 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
4385     ENABLE_DBGUTIL="TRUE"
4386     # this is an extra var so it can have different default on different MSVC
4387     # versions (in case there are version specific problems with it)
4388     MSVC_USE_DEBUG_RUNTIME="TRUE"
4390     AC_MSG_RESULT([yes])
4391     # cppunit and graphite expose STL in public headers
4392     if test "$with_system_cppunit" = "yes"; then
4393         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
4394     else
4395         with_system_cppunit=no
4396     fi
4397     if test "$with_system_graphite" = "yes"; then
4398         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
4399     else
4400         with_system_graphite=no
4401     fi
4402     if test "$with_system_orcus" = "yes"; then
4403         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
4404     else
4405         with_system_orcus=no
4406     fi
4407     if test "$with_system_libcmis" = "yes"; then
4408         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
4409     else
4410         with_system_libcmis=no
4411     fi
4412     if test "$with_system_hunspell" = "yes"; then
4413         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
4414     else
4415         with_system_hunspell=no
4416     fi
4417     if test "$with_system_gpgmepp" = "yes"; then
4418         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
4419     else
4420         with_system_gpgmepp=no
4421     fi
4422     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
4423     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
4424     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
4425     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
4426     # of those two is using the system variant:
4427     if test "$with_system_libnumbertext" = "yes"; then
4428         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
4429     else
4430         with_system_libnumbertext=no
4431     fi
4432     if test "$with_system_libwps" = "yes"; then
4433         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
4434     else
4435         with_system_libwps=no
4436     fi
4437 else
4438     ENABLE_DBGUTIL=""
4439     MSVC_USE_DEBUG_RUNTIME=""
4440     AC_MSG_RESULT([no])
4442 AC_SUBST(ENABLE_DBGUTIL)
4443 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
4445 dnl Set the ENABLE_DEBUG variable.
4446 dnl ===================================================================
4447 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
4448     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
4450 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
4451     if test -z "$libo_fuzzed_enable_debug"; then
4452         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
4453     else
4454         AC_MSG_NOTICE([Resetting --enable-debug=yes])
4455         enable_debug=yes
4456     fi
4459 AC_MSG_CHECKING([whether to do a debug build])
4460 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
4461     ENABLE_DEBUG="TRUE"
4462     if test -n "$ENABLE_DBGUTIL" ; then
4463         AC_MSG_RESULT([yes (dbgutil)])
4464     else
4465         AC_MSG_RESULT([yes])
4466     fi
4467 else
4468     ENABLE_DEBUG=""
4469     AC_MSG_RESULT([no])
4471 AC_SUBST(ENABLE_DEBUG)
4473 dnl ===================================================================
4474 dnl Select the linker to use (gold/lld/ld.bfd).
4475 dnl This is done only after compiler checks (need to know if Clang is
4476 dnl used, for different defaults) and after checking if a debug build
4477 dnl is wanted (non-debug builds get the default linker if not explicitly
4478 dnl specified otherwise).
4479 dnl All checks for linker features/options should come after this.
4480 dnl ===================================================================
4481 check_use_ld()
4483     use_ld=-fuse-ld=${1%%:*}
4484     use_ld_path=${1#*:}
4485     if test "$use_ld_path" != "$1"; then
4486         use_ld="$use_ld --ld-path=$use_ld_path"
4487     fi
4488     use_ld_fail_if_error=$2
4489     use_ld_ok=
4490     AC_MSG_CHECKING([for $use_ld linker support])
4491     use_ld_ldflags_save="$LDFLAGS"
4492     LDFLAGS="$LDFLAGS $use_ld"
4493     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4494 #include <stdio.h>
4495         ],[
4496 printf ("hello world\n");
4497         ])], USE_LD=$use_ld, [])
4498     if test -n "$USE_LD"; then
4499         AC_MSG_RESULT( yes )
4500         use_ld_ok=yes
4501     else
4502         if test -n "$use_ld_fail_if_error"; then
4503             AC_MSG_ERROR( no )
4504         else
4505             AC_MSG_RESULT( no )
4506         fi
4507     fi
4508     if test -n "$use_ld_ok"; then
4509         dnl keep the value of LDFLAGS
4510         return 0
4511     fi
4512     LDFLAGS="$use_ld_ldflags_save"
4513     return 1
4515 USE_LD=
4516 if test "$enable_ld" != "no"; then
4517     if test "$GCC" = "yes"; then
4518         if test -n "$enable_ld"; then
4519             check_use_ld "$enable_ld" fail_if_error
4520         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4521             dnl non-debug builds default to the default linker
4522             true
4523         elif test -n "$COM_IS_CLANG"; then
4524             check_use_ld lld
4525             if test $? -ne 0; then
4526                 check_use_ld gold
4527             fi
4528         else
4529             # For gcc first try gold, new versions also support lld.
4530             check_use_ld gold
4531             if test $? -ne 0; then
4532                 check_use_ld lld
4533             fi
4534         fi
4535         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4536         rm conftest.out
4537         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4538         if test -z "$ld_used"; then
4539             ld_used="unknown"
4540         fi
4541         AC_MSG_CHECKING([for linker that is used])
4542         AC_MSG_RESULT([$ld_used])
4543         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4544             if echo "$ld_used" | grep -q "^GNU ld"; then
4545                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4546                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4547             fi
4548         fi
4549     else
4550         if test "$enable_ld" = "yes"; then
4551             AC_MSG_ERROR([--enable-ld not supported])
4552         fi
4553     fi
4555 AC_SUBST(USE_LD)
4557 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4558 if test "$GCC" = "yes" -a "$_os" != Emscripten ; then
4559     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4560     bsymbolic_functions_ldflags_save=$LDFLAGS
4561     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4562     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4563 #include <stdio.h>
4564         ],[
4565 printf ("hello world\n");
4566         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4567     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4568         AC_MSG_RESULT( found )
4569     else
4570         AC_MSG_RESULT( not found )
4571     fi
4572     LDFLAGS=$bsymbolic_functions_ldflags_save
4574 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4576 LD_GC_SECTIONS=
4577 if test "$GCC" = "yes"; then
4578     for flag in "--gc-sections" "-dead_strip"; do
4579         AC_MSG_CHECKING([for $flag linker support])
4580         ldflags_save=$LDFLAGS
4581         LDFLAGS="$LDFLAGS -Wl,$flag"
4582         AC_LINK_IFELSE([AC_LANG_PROGRAM([
4583 #include <stdio.h>
4584             ],[
4585 printf ("hello world\n");
4586             ])],[
4587             LD_GC_SECTIONS="-Wl,$flag"
4588             AC_MSG_RESULT( found )
4589             ], [
4590             AC_MSG_RESULT( not found )
4591             ])
4592         LDFLAGS=$ldflags_save
4593         if test -n "$LD_GC_SECTIONS"; then
4594             break
4595         fi
4596     done
4598 AC_SUBST(LD_GC_SECTIONS)
4600 HAVE_GSPLIT_DWARF=
4601 if test "$enable_split_debug" != no; then
4602     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4603     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4604         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4605         save_CFLAGS=$CFLAGS
4606         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4607         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4608         CFLAGS=$save_CFLAGS
4609         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4610             AC_MSG_RESULT([yes])
4611         else
4612             if test "$enable_split_debug" = yes; then
4613                 AC_MSG_ERROR([no])
4614             else
4615                 AC_MSG_RESULT([no])
4616             fi
4617         fi
4618     fi
4619     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4620         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4621         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4622     fi
4624 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4626 HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=
4627 AC_MSG_CHECKING([whether $CC_BASE supports -Xclang -debug-info-kind=constructor])
4628 save_CFLAGS=$CFLAGS
4629 CFLAGS="$CFLAGS -Werror -Xclang -debug-info-kind=constructor"
4630 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=TRUE ],[])
4631 CFLAGS=$save_CFLAGS
4632 if test "$HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR" = "TRUE"; then
4633     AC_MSG_RESULT([yes])
4634 else
4635     AC_MSG_RESULT([no])
4637 AC_SUBST(HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR)
4639 ENABLE_GDB_INDEX=
4640 if test "$enable_gdb_index" != "no"; then
4641     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4642     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4643         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4644         save_CFLAGS=$CFLAGS
4645         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4646         have_ggnu_pubnames=
4647         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4648         if test "$have_ggnu_pubnames" != "TRUE"; then
4649             if test "$enable_gdb_index" = "yes"; then
4650                 AC_MSG_ERROR([no, --enable-gdb-index not supported])
4651             else
4652                 AC_MSG_RESULT( no )
4653             fi
4654         else
4655             AC_MSG_RESULT( yes )
4656             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4657             ldflags_save=$LDFLAGS
4658             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4659             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4660 #include <stdio.h>
4661                 ],[
4662 printf ("hello world\n");
4663                 ])], ENABLE_GDB_INDEX=TRUE, [])
4664             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4665                 AC_MSG_RESULT( yes )
4666             else
4667                 if test "$enable_gdb_index" = "yes"; then
4668                     AC_MSG_ERROR( no )
4669                 else
4670                     AC_MSG_RESULT( no )
4671                 fi
4672             fi
4673             LDFLAGS=$ldflags_save
4674         fi
4675         CFLAGS=$save_CFLAGS
4676         fi
4677     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4678         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4679         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4680     fi
4682 AC_SUBST(ENABLE_GDB_INDEX)
4684 if test -z "$enable_sal_log" && test "$ENABLE_DEBUG" = TRUE; then
4685     enable_sal_log=yes
4687 if test "$enable_sal_log" = yes; then
4688     ENABLE_SAL_LOG=TRUE
4690 AC_SUBST(ENABLE_SAL_LOG)
4692 dnl Check for enable symbols option
4693 dnl ===================================================================
4694 AC_MSG_CHECKING([whether to generate debug information])
4695 if test -z "$enable_symbols"; then
4696     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4697         enable_symbols=yes
4698     else
4699         enable_symbols=no
4700     fi
4702 if test "$enable_symbols" = yes; then
4703     ENABLE_SYMBOLS_FOR=all
4704     AC_MSG_RESULT([yes])
4705 elif test "$enable_symbols" = no; then
4706     ENABLE_SYMBOLS_FOR=
4707     AC_MSG_RESULT([no])
4708 else
4709     # Selective debuginfo.
4710     ENABLE_SYMBOLS_FOR="$enable_symbols"
4711     AC_MSG_RESULT([for "$enable_symbols"])
4713 AC_SUBST(ENABLE_SYMBOLS_FOR)
4715 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4716     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4717     AC_MSG_CHECKING([whether enough memory is available for linking])
4718     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4719     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4720     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4721         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4722     else
4723         AC_MSG_RESULT([yes])
4724     fi
4727 ENABLE_OPTIMIZED=
4728 ENABLE_OPTIMIZED_DEBUG=
4729 AC_MSG_CHECKING([whether to compile with optimization flags])
4730 if test -z "$enable_optimized"; then
4731     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4732         enable_optimized=no
4733     else
4734         enable_optimized=yes
4735     fi
4737 if test "$enable_optimized" = yes; then
4738     ENABLE_OPTIMIZED=TRUE
4739     AC_MSG_RESULT([yes])
4740 elif test "$enable_optimized" = debug; then
4741     ENABLE_OPTIMIZED_DEBUG=TRUE
4742     AC_MSG_RESULT([yes (debug)])
4743     HAVE_GCC_OG=
4744     if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4745         AC_MSG_CHECKING([whether $CC_BASE supports -Og])
4746         save_CFLAGS=$CFLAGS
4747         CFLAGS="$CFLAGS -Werror -Og"
4748         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[])
4749         CFLAGS=$save_CFLAGS
4750         if test "$HAVE_GCC_OG" = "TRUE"; then
4751             AC_MSG_RESULT([yes])
4752         else
4753             AC_MSG_RESULT([no])
4754         fi
4755     fi
4756     if test -z "$HAVE_GCC_OG" -a "$_os" != "Emscripten"; then
4757         AC_MSG_ERROR([The compiler does not support optimizations suitable for debugging.])
4758     fi
4759 else
4760     AC_MSG_RESULT([no])
4762 AC_SUBST(ENABLE_OPTIMIZED)
4763 AC_SUBST(ENABLE_OPTIMIZED_DEBUG)
4766 # determine CPUNAME, OS, ...
4768 case "$host_os" in
4770 aix*)
4771     COM=GCC
4772     CPUNAME=POWERPC
4773     OS=AIX
4774     RTL_OS=AIX
4775     RTL_ARCH=PowerPC
4776     PLATFORMID=aix_powerpc
4777     P_SEP=:
4778     ;;
4780 cygwin*|wsl*)
4781     # Already handled
4782     ;;
4784 darwin*|macos*)
4785     COM=GCC
4786     OS=MACOSX
4787     RTL_OS=MacOSX
4788     P_SEP=:
4790     case "$host_cpu" in
4791     aarch64|arm64)
4792         if test "$enable_ios_simulator" = "yes"; then
4793             OS=iOS
4794         else
4795             CPUNAME=AARCH64
4796             RTL_ARCH=AARCH64
4797             PLATFORMID=macosx_aarch64
4798         fi
4799         ;;
4800     x86_64)
4801         if test "$enable_ios_simulator" = "yes"; then
4802             OS=iOS
4803         fi
4804         CPUNAME=X86_64
4805         RTL_ARCH=X86_64
4806         PLATFORMID=macosx_x86_64
4807         ;;
4808     *)
4809         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4810         ;;
4811     esac
4812     ;;
4814 ios*)
4815     COM=GCC
4816     OS=iOS
4817     RTL_OS=iOS
4818     P_SEP=:
4820     case "$host_cpu" in
4821     aarch64|arm64)
4822         if test "$enable_ios_simulator" = "yes"; then
4823             AC_MSG_ERROR([iOS simulator is only available in macOS not iOS])
4824         fi
4825         ;;
4826     *)
4827         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4828         ;;
4829     esac
4830     CPUNAME=AARCH64
4831     RTL_ARCH=AARCH64
4832     PLATFORMID=ios_arm64
4833     ;;
4835 dragonfly*)
4836     COM=GCC
4837     OS=DRAGONFLY
4838     RTL_OS=DragonFly
4839     P_SEP=:
4841     case "$host_cpu" in
4842     i*86)
4843         CPUNAME=INTEL
4844         RTL_ARCH=x86
4845         PLATFORMID=dragonfly_x86
4846         ;;
4847     x86_64)
4848         CPUNAME=X86_64
4849         RTL_ARCH=X86_64
4850         PLATFORMID=dragonfly_x86_64
4851         ;;
4852     *)
4853         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4854         ;;
4855     esac
4856     ;;
4858 freebsd*)
4859     COM=GCC
4860     RTL_OS=FreeBSD
4861     OS=FREEBSD
4862     P_SEP=:
4864     case "$host_cpu" in
4865     aarch64)
4866         CPUNAME=AARCH64
4867         PLATFORMID=freebsd_aarch64
4868         RTL_ARCH=AARCH64
4869         ;;
4870     i*86)
4871         CPUNAME=INTEL
4872         RTL_ARCH=x86
4873         PLATFORMID=freebsd_x86
4874         ;;
4875     x86_64|amd64)
4876         CPUNAME=X86_64
4877         RTL_ARCH=X86_64
4878         PLATFORMID=freebsd_x86_64
4879         ;;
4880     powerpc64)
4881         CPUNAME=POWERPC64
4882         RTL_ARCH=PowerPC_64
4883         PLATFORMID=freebsd_powerpc64
4884         ;;
4885     powerpc|powerpcspe)
4886         CPUNAME=POWERPC
4887         RTL_ARCH=PowerPC
4888         PLATFORMID=freebsd_powerpc
4889         ;;
4890     *)
4891         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4892         ;;
4893     esac
4894     ;;
4896 haiku*)
4897     COM=GCC
4898     GUIBASE=haiku
4899     RTL_OS=Haiku
4900     OS=HAIKU
4901     P_SEP=:
4903     case "$host_cpu" in
4904     i*86)
4905         CPUNAME=INTEL
4906         RTL_ARCH=x86
4907         PLATFORMID=haiku_x86
4908         ;;
4909     x86_64|amd64)
4910         CPUNAME=X86_64
4911         RTL_ARCH=X86_64
4912         PLATFORMID=haiku_x86_64
4913         ;;
4914     *)
4915         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4916         ;;
4917     esac
4918     ;;
4920 kfreebsd*)
4921     COM=GCC
4922     OS=LINUX
4923     RTL_OS=kFreeBSD
4924     P_SEP=:
4926     case "$host_cpu" in
4928     i*86)
4929         CPUNAME=INTEL
4930         RTL_ARCH=x86
4931         PLATFORMID=kfreebsd_x86
4932         ;;
4933     x86_64)
4934         CPUNAME=X86_64
4935         RTL_ARCH=X86_64
4936         PLATFORMID=kfreebsd_x86_64
4937         ;;
4938     *)
4939         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4940         ;;
4941     esac
4942     ;;
4944 linux-gnu*)
4945     COM=GCC
4946     OS=LINUX
4947     RTL_OS=Linux
4948     P_SEP=:
4950     case "$host_cpu" in
4952     aarch64)
4953         CPUNAME=AARCH64
4954         PLATFORMID=linux_aarch64
4955         RTL_ARCH=AARCH64
4956         EPM_FLAGS="-a arm64"
4957         ;;
4958     alpha)
4959         CPUNAME=AXP
4960         RTL_ARCH=ALPHA
4961         PLATFORMID=linux_alpha
4962         ;;
4963     arm*)
4964         CPUNAME=ARM
4965         EPM_FLAGS="-a arm"
4966         RTL_ARCH=ARM_EABI
4967         PLATFORMID=linux_arm_eabi
4968         case "$host_cpu" in
4969         arm*-linux)
4970             RTL_ARCH=ARM_OABI
4971             PLATFORMID=linux_arm_oabi
4972             ;;
4973         esac
4974         ;;
4975     hppa)
4976         CPUNAME=HPPA
4977         RTL_ARCH=HPPA
4978         EPM_FLAGS="-a hppa"
4979         PLATFORMID=linux_hppa
4980         ;;
4981     i*86)
4982         CPUNAME=INTEL
4983         RTL_ARCH=x86
4984         PLATFORMID=linux_x86
4985         ;;
4986     ia64)
4987         CPUNAME=IA64
4988         RTL_ARCH=IA64
4989         PLATFORMID=linux_ia64
4990         ;;
4991     mips)
4992         CPUNAME=GODSON
4993         RTL_ARCH=MIPS_EB
4994         EPM_FLAGS="-a mips"
4995         PLATFORMID=linux_mips_eb
4996         ;;
4997     mips64)
4998         CPUNAME=GODSON64
4999         RTL_ARCH=MIPS64_EB
5000         EPM_FLAGS="-a mips64"
5001         PLATFORMID=linux_mips64_eb
5002         ;;
5003     mips64el)
5004         CPUNAME=GODSON64
5005         RTL_ARCH=MIPS64_EL
5006         EPM_FLAGS="-a mips64el"
5007         PLATFORMID=linux_mips64_el
5008         ;;
5009     mipsel)
5010         CPUNAME=GODSON
5011         RTL_ARCH=MIPS_EL
5012         EPM_FLAGS="-a mipsel"
5013         PLATFORMID=linux_mips_el
5014         ;;
5015     m68k)
5016         CPUNAME=M68K
5017         RTL_ARCH=M68K
5018         PLATFORMID=linux_m68k
5019         ;;
5020     powerpc)
5021         CPUNAME=POWERPC
5022         RTL_ARCH=PowerPC
5023         PLATFORMID=linux_powerpc
5024         ;;
5025     powerpc64)
5026         CPUNAME=POWERPC64
5027         RTL_ARCH=PowerPC_64
5028         PLATFORMID=linux_powerpc64
5029         ;;
5030     powerpc64le)
5031         CPUNAME=POWERPC64
5032         RTL_ARCH=PowerPC_64_LE
5033         PLATFORMID=linux_powerpc64_le
5034         ;;
5035     sparc)
5036         CPUNAME=SPARC
5037         RTL_ARCH=SPARC
5038         PLATFORMID=linux_sparc
5039         ;;
5040     sparc64)
5041         CPUNAME=SPARC64
5042         RTL_ARCH=SPARC64
5043         PLATFORMID=linux_sparc64
5044         ;;
5045     s390)
5046         CPUNAME=S390
5047         RTL_ARCH=S390
5048         PLATFORMID=linux_s390
5049         ;;
5050     s390x)
5051         CPUNAME=S390X
5052         RTL_ARCH=S390x
5053         PLATFORMID=linux_s390x
5054         ;;
5055     x86_64)
5056         CPUNAME=X86_64
5057         RTL_ARCH=X86_64
5058         PLATFORMID=linux_x86_64
5059         ;;
5060     *)
5061         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5062         ;;
5063     esac
5064     ;;
5066 linux-android*)
5067     COM=GCC
5068     OS=ANDROID
5069     RTL_OS=Android
5070     P_SEP=:
5072     case "$host_cpu" in
5074     arm|armel)
5075         CPUNAME=ARM
5076         RTL_ARCH=ARM_EABI
5077         PLATFORMID=android_arm_eabi
5078         ;;
5079     aarch64)
5080         CPUNAME=AARCH64
5081         RTL_ARCH=AARCH64
5082         PLATFORMID=android_aarch64
5083         ;;
5084     i*86)
5085         CPUNAME=INTEL
5086         RTL_ARCH=x86
5087         PLATFORMID=android_x86
5088         ;;
5089     x86_64)
5090         CPUNAME=X86_64
5091         RTL_ARCH=X86_64
5092         PLATFORMID=android_x86_64
5093         ;;
5094     *)
5095         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5096         ;;
5097     esac
5098     ;;
5100 *netbsd*)
5101     COM=GCC
5102     OS=NETBSD
5103     RTL_OS=NetBSD
5104     P_SEP=:
5106     case "$host_cpu" in
5107     i*86)
5108         CPUNAME=INTEL
5109         RTL_ARCH=x86
5110         PLATFORMID=netbsd_x86
5111         ;;
5112     powerpc)
5113         CPUNAME=POWERPC
5114         RTL_ARCH=PowerPC
5115         PLATFORMID=netbsd_powerpc
5116         ;;
5117     sparc)
5118         CPUNAME=SPARC
5119         RTL_ARCH=SPARC
5120         PLATFORMID=netbsd_sparc
5121         ;;
5122     x86_64)
5123         CPUNAME=X86_64
5124         RTL_ARCH=X86_64
5125         PLATFORMID=netbsd_x86_64
5126         ;;
5127     *)
5128         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5129         ;;
5130     esac
5131     ;;
5133 openbsd*)
5134     COM=GCC
5135     OS=OPENBSD
5136     RTL_OS=OpenBSD
5137     P_SEP=:
5139     case "$host_cpu" in
5140     i*86)
5141         CPUNAME=INTEL
5142         RTL_ARCH=x86
5143         PLATFORMID=openbsd_x86
5144         ;;
5145     x86_64)
5146         CPUNAME=X86_64
5147         RTL_ARCH=X86_64
5148         PLATFORMID=openbsd_x86_64
5149         ;;
5150     *)
5151         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5152         ;;
5153     esac
5154     SOLARINC="$SOLARINC -I/usr/local/include"
5155     ;;
5157 solaris*)
5158     COM=GCC
5159     OS=SOLARIS
5160     RTL_OS=Solaris
5161     P_SEP=:
5163     case "$host_cpu" in
5164     i*86)
5165         CPUNAME=INTEL
5166         RTL_ARCH=x86
5167         PLATFORMID=solaris_x86
5168         ;;
5169     sparc)
5170         CPUNAME=SPARC
5171         RTL_ARCH=SPARC
5172         PLATFORMID=solaris_sparc
5173         ;;
5174     sparc64)
5175         CPUNAME=SPARC64
5176         RTL_ARCH=SPARC64
5177         PLATFORMID=solaris_sparc64
5178         ;;
5179     *)
5180         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5181         ;;
5182     esac
5183     SOLARINC="$SOLARINC -I/usr/local/include"
5184     ;;
5186 emscripten*)
5187     COM=GCC
5188     OS=EMSCRIPTEN
5189     RTL_OS=Emscripten
5190     P_SEP=:
5192     case "$host_cpu" in
5193     wasm32|wasm64)
5194         ;;
5195     *)
5196         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5197         ;;
5198     esac
5199     CPUNAME=INTEL
5200     RTL_ARCH=x86
5201     PLATFORMID=linux_x86
5202     ;;
5205     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
5206     ;;
5207 esac
5209 if test "$with_x" = "no"; then
5210     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
5213 DISABLE_GUI=""
5214 if test "$enable_gui" = "no"; then
5215     if test "$using_x11" != yes; then
5216         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
5217     fi
5218     USING_X11=
5219     DISABLE_GUI=TRUE
5220 else
5221     AC_DEFINE(HAVE_FEATURE_UI)
5223 AC_SUBST(DISABLE_GUI)
5225 if test "$using_x11" = yes; then
5226     if test "$USING_X11" = TRUE; then
5227         AC_DEFINE(USING_X11)
5228     else
5229         disable_x11_tests
5230     fi
5231 else
5232     if test "$USING_X11" = TRUE; then
5233         AC_MSG_ERROR([Platform doesn't support X11 (\$using_x11), but \$USING_X11 is set!])
5234     fi
5237 WORKDIR="${BUILDDIR}/workdir"
5238 INSTDIR="${BUILDDIR}/instdir"
5239 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
5240 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
5241 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
5242 AC_SUBST(COM)
5243 AC_SUBST(CPUNAME)
5244 AC_SUBST(RTL_OS)
5245 AC_SUBST(RTL_ARCH)
5246 AC_SUBST(EPM_FLAGS)
5247 AC_SUBST(USING_X11)
5248 AC_SUBST([INSTDIR])
5249 AC_SUBST([INSTROOT])
5250 AC_SUBST([INSTROOTBASE])
5251 AC_SUBST(OS)
5252 AC_SUBST(P_SEP)
5253 AC_SUBST(WORKDIR)
5254 AC_SUBST(PLATFORMID)
5255 AC_SUBST(WINDOWS_X64)
5256 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
5258 if test "$OS" = WNT -a "$COM" = MSC; then
5259     case "$CPUNAME" in
5260     INTEL) CPPU_ENV=msci ;;
5261     X86_64) CPPU_ENV=mscx ;;
5262     AARCH64) CPPU_ENV=msca ;;
5263     *)
5264         AC_MSG_ERROR([Unknown \$CPUNAME '$CPUNAME' for $OS / $COM"])
5265         ;;
5266     esac
5267 else
5268     CPPU_ENV=gcc3
5270 AC_SUBST(CPPU_ENV)
5272 dnl ===================================================================
5273 dnl Test which package format to use
5274 dnl ===================================================================
5275 AC_MSG_CHECKING([which package format to use])
5276 if test -n "$with_package_format" -a "$with_package_format" != no; then
5277     for i in $with_package_format; do
5278         case "$i" in
5279         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
5280             ;;
5281         *)
5282             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
5283 aix - AIX software distribution
5284 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
5285 deb - Debian software distribution
5286 pkg - Solaris software distribution
5287 rpm - RedHat software distribution
5289 LibreOffice additionally supports:
5290 archive - .tar.gz or .zip
5291 dmg - macOS .dmg
5292 installed - installation tree
5293 msi - Windows .msi
5294         ])
5295             ;;
5296         esac
5297     done
5298     # fakeroot is needed to ensure correct file ownerships/permissions
5299     # inside deb packages and tar archives created on Linux and Solaris.
5300     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
5301         AC_PATH_PROG(FAKEROOT, fakeroot, no)
5302         if test "$FAKEROOT" = "no"; then
5303             AC_MSG_ERROR(
5304                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
5305         fi
5306     fi
5307     PKGFORMAT="$with_package_format"
5308     AC_MSG_RESULT([$PKGFORMAT])
5309 else
5310     PKGFORMAT=
5311     AC_MSG_RESULT([none])
5313 AC_SUBST(PKGFORMAT)
5315 dnl ===================================================================
5316 dnl handle help related options
5318 dnl If you change help related options, please update README.help
5319 dnl ===================================================================
5321 ENABLE_HTMLHELP=
5322 HELP_OMINDEX_PAGE=
5323 HELP_ONLINE=
5324 WITH_HELPPACKS=
5326 AC_MSG_CHECKING([which help to build])
5327 if test -n "$with_help" -a "$with_help" != "no"; then
5328     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5329     BUILD_TYPE="$BUILD_TYPE HELP"
5330     case "$with_help" in
5331     "html")
5332         ENABLE_HTMLHELP=TRUE
5333         WITH_HELPPACKS=TRUE
5334         SCPDEFS="$SCPDEFS -DWITH_HELPPACKS"
5335         AC_MSG_RESULT([HTML (local)])
5336         ;;
5337     "online")
5338         ENABLE_HTMLHELP=TRUE
5339         HELP_ONLINE=TRUE
5340         AC_MSG_RESULT([HTML (online)])
5341         ;;
5342     yes)
5343         WITH_HELPPACKS=TRUE
5344         SCPDEFS="$SCPDEFS -DWITH_HELPPACKS"
5345         AC_MSG_RESULT([XML (local)])
5346         ;;
5347     *)
5348         AC_MSG_ERROR([Unknown --with-help=$with_help])
5349         ;;
5350     esac
5351 else
5352     AC_MSG_RESULT([no])
5355 AC_MSG_CHECKING([if we need to build the help index tooling])
5356 if test "$with_help" = yes -o "$enable_extension_integration" != no; then
5357     BUILD_TYPE="$BUILD_TYPE HELPTOOLS"
5358     AC_MSG_RESULT([yes])
5359 else
5360     AC_MSG_RESULT([no])
5363 AC_MSG_CHECKING([whether to enable xapian-omega support for online help])
5364 if test -n "$with_omindex" -a "$with_omindex" != "no"; then
5365     if test "$HELP_ONLINE" != TRUE; then
5366         AC_MSG_ERROR([Can't build xapian-omega index without --help=online])
5367     fi
5368     case "$with_omindex" in
5369     "server")
5370         HELP_OMINDEX_PAGE=TRUE
5371         AC_MSG_RESULT([SERVER])
5372         ;;
5373     "noxap")
5374         AC_MSG_RESULT([NOXAP])
5375         ;;
5376     *)
5377         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5378         ;;
5379     esac
5380 else
5381     AC_MSG_RESULT([no])
5384 AC_MSG_CHECKING([whether to include the XML-help support])
5385 if test "$enable_xmlhelp" = yes; then
5386     BUILD_TYPE="$BUILD_TYPE XMLHELP"
5387     AC_DEFINE(HAVE_FEATURE_XMLHELP)
5388     AC_MSG_RESULT([yes])
5389 else
5390     if test "$with_help" = yes; then
5391         add_warning "Building the XML help, but LO with disabled xmlhelp support. Generated help can't be accessed from this LO build!"
5392     fi
5393     AC_MSG_RESULT([no])
5396 dnl Test whether to integrate helppacks into the product's installer
5397 AC_MSG_CHECKING([for helppack integration])
5398 if test -z "$WITH_HELPPACKS" -o "$with_helppack_integration" = no; then
5399     AC_MSG_RESULT([no integration])
5400 else
5401     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
5402     AC_MSG_RESULT([integration])
5405 AC_SUBST([ENABLE_HTMLHELP])
5406 AC_SUBST([HELP_OMINDEX_PAGE])
5407 AC_SUBST([HELP_ONLINE])
5408 # WITH_HELPPACKS is used only in configure
5410 dnl ===================================================================
5411 dnl Set up a different compiler to produce tools to run on the build
5412 dnl machine when doing cross-compilation
5413 dnl ===================================================================
5415 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
5416 m4_pattern_allow([PKG_CONFIG_LIBDIR])
5417 if test "$cross_compiling" = "yes"; then
5418     AC_MSG_CHECKING([for BUILD platform configuration])
5419     echo
5420     rm -rf CONF-FOR-BUILD config_build.mk
5421     mkdir CONF-FOR-BUILD
5422     # Here must be listed all files needed when running the configure script. In particular, also
5423     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
5424     # keep them in the same order as there.
5425     (cd $SRC_ROOT && tar cf - \
5426         config.guess \
5427         bin/get_config_variables \
5428         solenv/bin/getcompver.awk \
5429         solenv/inc/langlist.mk \
5430         download.lst \
5431         config_host.mk.in \
5432         config_host_lang.mk.in \
5433         Makefile.in \
5434         bin/bffvalidator.sh.in \
5435         bin/odfvalidator.sh.in \
5436         bin/officeotron.sh.in \
5437         hardened_runtime.xcent.in \
5438         instsetoo_native/util/openoffice.lst.in \
5439         config_host/*.in \
5440         sysui/desktop/macosx/Info.plist.in \
5441         .vscode/vs-code-template.code-workspace.in \
5442         ) \
5443     | (cd CONF-FOR-BUILD && tar xf -)
5444     cp configure CONF-FOR-BUILD
5445     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
5446     (
5447     unset COM USING_X11 OS CPUNAME
5448     unset CC CXX SYSBASE CFLAGS
5449     unset AR LD NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
5450     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
5451     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
5452     unset PKG_CONFIG_LIBDIR PKG_CONFIG_PATH
5453     if test -n "$CC_FOR_BUILD"; then
5454         export CC="$CC_FOR_BUILD"
5455         CC_BASE=`first_arg_basename "$CC"`
5456     fi
5457     if test -n "$CXX_FOR_BUILD"; then
5458         export CXX="$CXX_FOR_BUILD"
5459         CXX_BASE=`first_arg_basename "$CXX"`
5460     fi
5461     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
5462     cd CONF-FOR-BUILD
5464     # Handle host configuration, which affects the cross-toolset too
5465     sub_conf_opts=""
5466     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
5467     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
5468     test "$with_junit" = "no" && sub_conf_opts="$sub_conf_opts --without-junit"
5469     if test -n "$ENABLE_JAVA"; then
5470         case "$_os" in
5471         iOS) sub_conf_opts="$sub_conf_opts --without-java" ;; # force it off, like it used to be
5472         Android)
5473             # Hack for Android - the build doesn't need a host JDK, so just forward to build for convenience
5474             test -n "$with_jdk_home" && sub_conf_opts="$sub_conf_opts --with-jdk-home=$with_jdk_home"
5475             ;;
5476         *)
5477             if test -z "$with_jdk_home"; then
5478                 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.])
5479             fi
5480             ;;
5481         esac
5482     else
5483         sub_conf_opts="$sub_conf_opts --without-java"
5484     fi
5485     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
5486     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
5487     test "$with_galleries" = "no" -o -z "$WITH_GALLERY_BUILD" && sub_conf_opts="$sub_conf_opts --with-galleries=no --disable-database-connectivity"
5488     test -n "$with_help" -a "$with_help" != "no" && sub_conf_opts="$sub_conf_opts --with-help=$with_help"
5489     test "$enable_extensions" = yes || sub_conf_opts="$sub_conf_opts --disable-extensions"
5490     test "$enable_wasm_strip" = "yes" && sub_conf_opts="$sub_conf_opts --enable-wasm-strip"
5491     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
5493     # Don't bother having configure look for stuff not needed for the build platform anyway
5494     ./configure \
5495         --build="$build_alias" \
5496         --disable-cairo-canvas \
5497         --disable-cups \
5498         --disable-firebird-sdbc \
5499         --disable-gpgmepp \
5500         --disable-gstreamer-1-0 \
5501         --disable-gtk3 \
5502         --disable-gtk4 \
5503         --disable-mariadb-sdbc \
5504         --disable-nss \
5505         --disable-online-update \
5506         --disable-opencl \
5507         --disable-pdfimport \
5508         --disable-postgresql-sdbc \
5509         --disable-skia \
5510         --enable-icecream="$enable_icecream" \
5511         --without-doxygen \
5512         --without-webdav \
5513         --with-parallelism="$with_parallelism" \
5514         --with-theme="$with_theme" \
5515         --with-tls=openssl \
5516         $sub_conf_opts \
5517         --srcdir=$srcdir \
5518         2>&1 | sed -e 's/^/    /'
5519     if test [${PIPESTATUS[0]}] -ne 0; then
5520         AC_MSG_ERROR([Running the configure script for BUILD side failed, see CONF-FOR-BUILD/config.log])
5521     fi
5523     # filter permitted build targets
5524     PERMITTED_BUILD_TARGETS="
5525         AVMEDIA
5526         BOOST
5527         CAIRO
5528         CLUCENE
5529         CURL
5530         DBCONNECTIVITY
5531         DESKTOP
5532         DYNLOADING
5533         EPOXY
5534         EXPAT
5535         GLM
5536         GRAPHITE
5537         HARFBUZZ
5538         HELPTOOLS
5539         ICU
5540         LCMS2
5541         LIBJPEG_TURBO
5542         LIBLANGTAG
5543         LibO
5544         LIBFFI
5545         LIBPN
5546         LIBXML2
5547         LIBXSLT
5548         MDDS
5549         NATIVE
5550         OPENSSL
5551         ORCUS
5552         PYTHON
5553         SCRIPTING
5554         ZLIB
5556     # converts BUILD_TYPE and PERMITTED_BUILD_TARGETS into non-whitespace,
5557     # newlined lists, to use grep as a filter
5558     PERMITTED_BUILD_TARGETS=$(echo "$PERMITTED_BUILD_TARGETS" | sed -e '/^ *$/d' -e 's/ *//')
5559     BUILD_TARGETS="$(sed -n -e '/^export BUILD_TYPE=/ s/.*=//p' config_host.mk | tr ' ' '\n')"
5560     BUILD_TARGETS="$(echo "$BUILD_TARGETS" | grep -F "$PERMITTED_BUILD_TARGETS" | tr '\n' ' ')"
5561     sed -i -e "s/ BUILD_TYPE=.*$/ BUILD_TYPE=$BUILD_TARGETS/" config_host.mk
5563     cp config_host.mk ../config_build.mk
5564     cp config_host_lang.mk ../config_build_lang.mk
5565     mv config.log ../config.Build.log
5566     mkdir -p ../config_build
5567     mv config_host/*.h ../config_build
5568     test -f "$WARNINGS_FILE" && mv "$WARNINGS_FILE" "../$WARNINGS_FILE_FOR_BUILD"
5570     # all these will get a _FOR_BUILD postfix
5571     DIRECT_FOR_BUILD_SETTINGS="
5572         CC
5573         CPPU_ENV
5574         CXX
5575         ILIB
5576         JAVA_HOME
5577         JAVAIFLAGS
5578         JDK
5579         LIBO_BIN_FOLDER
5580         LIBO_LIB_FOLDER
5581         LIBO_URE_LIB_FOLDER
5582         LIBO_URE_MISC_FOLDER
5583         OS
5584         SDKDIRNAME
5585         SYSTEM_LIBXML
5586         SYSTEM_LIBXSLT
5588     # these overwrite host config with build config
5589     OVERWRITING_SETTINGS="
5590         ANT
5591         ANT_HOME
5592         ANT_LIB
5593         HSQLDB_USE_JDBC_4_1
5594         JAVA_CLASSPATH_NOT_SET
5595         JAVA_SOURCE_VER
5596         JAVA_TARGET_VER
5597         JAVACFLAGS
5598         JAVACOMPILER
5599         JAVADOC
5600         JAVADOCISGJDOC
5602     # these need some special handling
5603     EXTRA_HANDLED_SETTINGS="
5604         INSTDIR
5605         INSTROOT
5606         PATH
5607         WORKDIR
5609     OLD_PATH=$PATH
5610     . ./bin/get_config_variables $DIRECT_FOR_BUILD_SETTINGS $OVERWRITING_SETTINGS $EXTRA_HANDLED_SETTINGS
5611     BUILD_PATH=$PATH
5612     PATH=$OLD_PATH
5614     line=`echo "LO_PATH_FOR_BUILD='${BUILD_PATH}'" | sed -e 's,/CONF-FOR-BUILD,,g'`
5615     echo "$line" >>build-config
5617     for V in $DIRECT_FOR_BUILD_SETTINGS; do
5618         VV='$'$V
5619         VV=`eval "echo $VV"`
5620         if test -n "$VV"; then
5621             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
5622             echo "$line" >>build-config
5623         fi
5624     done
5626     for V in $OVERWRITING_SETTINGS; do
5627         VV='$'$V
5628         VV=`eval "echo $VV"`
5629         if test -n "$VV"; then
5630             line=${V}='${'${V}:-$VV'}'
5631             echo "$line" >>build-config
5632         fi
5633     done
5635     for V in INSTDIR INSTROOT WORKDIR; do
5636         VV='$'$V
5637         VV=`eval "echo $VV"`
5638         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
5639         if test -n "$VV"; then
5640             line="${V}_FOR_BUILD='$VV'"
5641             echo "$line" >>build-config
5642         fi
5643     done
5645     )
5646     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([setup/configure for BUILD side failed, see CONF-FOR-BUILD/config.log])
5647     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])
5648     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
5649              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
5651     eval `cat CONF-FOR-BUILD/build-config`
5653     AC_MSG_RESULT([checking for BUILD platform configuration... done])
5655     rm -rf CONF-FOR-BUILD
5656 else
5657     OS_FOR_BUILD="$OS"
5658     CC_FOR_BUILD="$CC"
5659     CPPU_ENV_FOR_BUILD="$CPPU_ENV"
5660     CXX_FOR_BUILD="$CXX"
5661     INSTDIR_FOR_BUILD="$INSTDIR"
5662     INSTROOT_FOR_BUILD="$INSTROOT"
5663     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
5664     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
5665     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
5666     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
5667     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
5668     WORKDIR_FOR_BUILD="$WORKDIR"
5670 AC_SUBST(OS_FOR_BUILD)
5671 AC_SUBST(INSTDIR_FOR_BUILD)
5672 AC_SUBST(INSTROOT_FOR_BUILD)
5673 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
5674 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
5675 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
5676 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
5677 AC_SUBST(SDKDIRNAME_FOR_BUILD)
5678 AC_SUBST(WORKDIR_FOR_BUILD)
5679 AC_SUBST(CC_FOR_BUILD)
5680 AC_SUBST(CXX_FOR_BUILD)
5681 AC_SUBST(CPPU_ENV_FOR_BUILD)
5683 dnl ===================================================================
5684 dnl Check for syslog header
5685 dnl ===================================================================
5686 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
5688 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
5689 dnl ===================================================================
5690 AC_MSG_CHECKING([whether to turn warnings to errors])
5691 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
5692     ENABLE_WERROR="TRUE"
5693     PYTHONWARNINGS="error"
5694     AC_MSG_RESULT([yes])
5695 else
5696     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
5697         ENABLE_WERROR="TRUE"
5698         PYTHONWARNINGS="error"
5699         AC_MSG_RESULT([yes])
5700     else
5701         AC_MSG_RESULT([no])
5702     fi
5704 AC_SUBST(ENABLE_WERROR)
5705 AC_SUBST(PYTHONWARNINGS)
5707 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
5708 dnl ===================================================================
5709 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
5710 if test -z "$enable_assert_always_abort"; then
5711    if test "$ENABLE_DEBUG" = TRUE; then
5712        enable_assert_always_abort=yes
5713    else
5714        enable_assert_always_abort=no
5715    fi
5717 if test "$enable_assert_always_abort" = "yes"; then
5718     ASSERT_ALWAYS_ABORT="TRUE"
5719     AC_MSG_RESULT([yes])
5720 else
5721     ASSERT_ALWAYS_ABORT="FALSE"
5722     AC_MSG_RESULT([no])
5724 AC_SUBST(ASSERT_ALWAYS_ABORT)
5726 # Determine whether to use ooenv for the instdir installation
5727 # ===================================================================
5728 if test $_os != "WINNT" -a $_os != "Darwin"; then
5729     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
5730     if test -z "$enable_ooenv"; then
5731         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5732             enable_ooenv=yes
5733         else
5734             enable_ooenv=no
5735         fi
5736     fi
5737     if test "$enable_ooenv" = "no"; then
5738         AC_MSG_RESULT([no])
5739     else
5740         ENABLE_OOENV="TRUE"
5741         AC_MSG_RESULT([yes])
5742     fi
5744 AC_SUBST(ENABLE_OOENV)
5746 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
5747     if test "$enable_qt5" = "no"; then
5748         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
5749     else
5750         enable_qt5=yes
5751     fi
5754 dnl ===================================================================
5755 dnl check for cups support
5756 dnl ===================================================================
5758 AC_MSG_CHECKING([whether to enable CUPS support])
5759 if test "$test_cups" = yes -a "$enable_cups" != no; then
5760     ENABLE_CUPS=TRUE
5761     AC_MSG_RESULT([yes])
5763     AC_MSG_CHECKING([whether cups support is present])
5764     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
5765     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
5766     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
5767         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
5768     fi
5769 else
5770     AC_MSG_RESULT([no])
5773 AC_SUBST(ENABLE_CUPS)
5775 # fontconfig checks
5776 if test "$using_freetype_fontconfig" = yes; then
5777     AC_MSG_CHECKING([which fontconfig to use])
5779 if test "$using_freetype_fontconfig" = yes -a "$test_system_fontconfig" != no; then
5780     AC_MSG_RESULT([external])
5781     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
5782     SYSTEM_FONTCONFIG=TRUE
5783     FilterLibs "${FONTCONFIG_LIBS}"
5784     FONTCONFIG_LIBS="${filteredlibs}"
5785 elif test "$using_freetype_fontconfig" = yes; then
5786     AC_MSG_RESULT([internal])
5787     BUILD_TYPE="$BUILD_TYPE FONTCONFIG"
5789 AC_SUBST(FONTCONFIG_CFLAGS)
5790 AC_SUBST(FONTCONFIG_LIBS)
5791 AC_SUBST([SYSTEM_FONTCONFIG])
5793 dnl whether to find & fetch external tarballs?
5794 dnl ===================================================================
5795 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
5796    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5797        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
5798    else
5799        TARFILE_LOCATION="$LODE_HOME/ext_tar"
5800    fi
5802 if test -z "$TARFILE_LOCATION"; then
5803     if test -d "$SRC_ROOT/src" ; then
5804         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
5805         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
5806     fi
5807     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
5808 else
5809     AbsolutePath "$TARFILE_LOCATION"
5810     PathFormat "${absolute_path}"
5811     TARFILE_LOCATION="${formatted_path}"
5813 AC_SUBST(TARFILE_LOCATION)
5815 AC_MSG_CHECKING([whether we want to fetch tarballs])
5816 if test "$enable_fetch_external" != "no"; then
5817     if test "$with_all_tarballs" = "yes"; then
5818         AC_MSG_RESULT([yes, all of them])
5819         DO_FETCH_TARBALLS="ALL"
5820     else
5821         AC_MSG_RESULT([yes, if we use them])
5822         DO_FETCH_TARBALLS="TRUE"
5823     fi
5824 else
5825     AC_MSG_RESULT([no])
5826     DO_FETCH_TARBALLS=
5828 AC_SUBST(DO_FETCH_TARBALLS)
5830 dnl Test whether to include MySpell dictionaries
5831 dnl ===================================================================
5832 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5833 if test "$with_myspell_dicts" = "yes"; then
5834     AC_MSG_RESULT([yes])
5835     WITH_MYSPELL_DICTS=TRUE
5836     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5837     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5838 else
5839     AC_MSG_RESULT([no])
5840     WITH_MYSPELL_DICTS=
5842 AC_SUBST(WITH_MYSPELL_DICTS)
5844 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5845 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5846     if test "$with_system_dicts" = yes; then
5847         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5848     fi
5849     with_system_dicts=no
5852 AC_MSG_CHECKING([whether to use dicts from external paths])
5853 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5854     AC_MSG_RESULT([yes])
5855     SYSTEM_DICTS=TRUE
5856     AC_MSG_CHECKING([for spelling dictionary directory])
5857     if test -n "$with_external_dict_dir"; then
5858         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5859     else
5860         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5861         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5862             DICT_SYSTEM_DIR=file:///usr/share/myspell
5863         fi
5864     fi
5865     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5866     AC_MSG_CHECKING([for hyphenation patterns directory])
5867     if test -n "$with_external_hyph_dir"; then
5868         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5869     else
5870         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5871     fi
5872     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5873     AC_MSG_CHECKING([for thesaurus directory])
5874     if test -n "$with_external_thes_dir"; then
5875         THES_SYSTEM_DIR=file://$with_external_thes_dir
5876     else
5877         THES_SYSTEM_DIR=file:///usr/share/mythes
5878     fi
5879     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5880 else
5881     AC_MSG_RESULT([no])
5882     SYSTEM_DICTS=
5884 AC_SUBST(SYSTEM_DICTS)
5885 AC_SUBST(DICT_SYSTEM_DIR)
5886 AC_SUBST(HYPH_SYSTEM_DIR)
5887 AC_SUBST(THES_SYSTEM_DIR)
5889 dnl ===================================================================
5890 dnl Precompiled headers.
5891 ENABLE_PCH=""
5892 AC_MSG_CHECKING([whether to enable pch feature])
5893 if test -z "$enable_pch"; then
5894     if test "$_os" = "WINNT"; then
5895         # Enabled by default on Windows.
5896         enable_pch=yes
5897     else
5898         enable_pch=no
5899     fi
5901 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5902     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5904 if test "$enable_pch" = "system"; then
5905     ENABLE_PCH="1"
5906     AC_MSG_RESULT([yes (system headers)])
5907 elif test "$enable_pch" = "base"; then
5908     ENABLE_PCH="2"
5909     AC_MSG_RESULT([yes (system and base headers)])
5910 elif test "$enable_pch" = "normal"; then
5911     ENABLE_PCH="3"
5912     AC_MSG_RESULT([yes (normal)])
5913 elif test "$enable_pch" = "full"; then
5914     ENABLE_PCH="4"
5915     AC_MSG_RESULT([yes (full)])
5916 elif test "$enable_pch" = "yes"; then
5917     # Pick a suitable default.
5918     if test "$GCC" = "yes"; then
5919         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5920         # while making the PCHs larger and rebuilds more likely.
5921         ENABLE_PCH="2"
5922         AC_MSG_RESULT([yes (system and base headers)])
5923     else
5924         # With MSVC the highest level makes a significant difference,
5925         # and it was the default when there used to be no PCH levels.
5926         ENABLE_PCH="4"
5927         AC_MSG_RESULT([yes (full)])
5928     fi
5929 elif test "$enable_pch" = "no"; then
5930     AC_MSG_RESULT([no])
5931 else
5932     AC_MSG_ERROR([Unknown value for --enable-pch])
5934 AC_SUBST(ENABLE_PCH)
5935 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5936 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5937     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5938     if test "$CCACHE_BIN" != "not found"; then
5939         AC_MSG_CHECKING([ccache version])
5940         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5941         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5942         AC_MSG_RESULT([$CCACHE_VERSION])
5943         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5944         if test "$CCACHE_NUMVER" -gt "030701"; then
5945             AC_MSG_RESULT([yes])
5946         else
5947             AC_MSG_RESULT([no (not newer than 3.7.1)])
5948             CCACHE_DEPEND_MODE=
5949         fi
5950     fi
5953 PCH_INSTANTIATE_TEMPLATES=
5954 if test -n "$ENABLE_PCH"; then
5955     AC_MSG_CHECKING([whether $CC supports -fpch-instantiate-templates])
5956     save_CFLAGS=$CFLAGS
5957     CFLAGS="$CFLAGS -Werror -fpch-instantiate-templates"
5958     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_INSTANTIATE_TEMPLATES="-fpch-instantiate-templates" ],[])
5959     CFLAGS=$save_CFLAGS
5960     if test -n "$PCH_INSTANTIATE_TEMPLATES"; then
5961         AC_MSG_RESULT(yes)
5962     else
5963         AC_MSG_RESULT(no)
5964     fi
5966 AC_SUBST(PCH_INSTANTIATE_TEMPLATES)
5968 BUILDING_PCH_WITH_OBJ=
5969 if test -n "$ENABLE_PCH"; then
5970     AC_MSG_CHECKING([whether $CC supports -Xclang -building-pch-with-obj])
5971     save_CFLAGS=$CFLAGS
5972     CFLAGS="$CFLAGS -Werror -Xclang -building-pch-with-obj"
5973     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ BUILDING_PCH_WITH_OBJ="-Xclang -building-pch-with-obj" ],[])
5974     CFLAGS=$save_CFLAGS
5975     if test -n "$BUILDING_PCH_WITH_OBJ"; then
5976         AC_MSG_RESULT(yes)
5977     else
5978         AC_MSG_RESULT(no)
5979     fi
5981 AC_SUBST(BUILDING_PCH_WITH_OBJ)
5983 PCH_CODEGEN=
5984 PCH_NO_CODEGEN=
5985 if test -n "$BUILDING_PCH_WITH_OBJ"; then
5986     AC_MSG_CHECKING([whether $CC supports -fpch-codegen])
5987     save_CFLAGS=$CFLAGS
5988     CFLAGS="$CFLAGS -Werror -fpch-codegen"
5989     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
5990         [
5991         PCH_CODEGEN="-fpch-codegen"
5992         PCH_NO_CODEGEN="-fno-pch-codegen"
5993         ],[])
5994     CFLAGS=$save_CFLAGS
5995     if test -n "$PCH_CODEGEN"; then
5996         AC_MSG_RESULT(yes)
5997     else
5998         AC_MSG_RESULT(no)
5999     fi
6001 AC_SUBST(PCH_CODEGEN)
6002 AC_SUBST(PCH_NO_CODEGEN)
6003 PCH_DEBUGINFO=
6004 if test -n "$BUILDING_PCH_WITH_OBJ"; then
6005     AC_MSG_CHECKING([whether $CC supports -fpch-debuginfo])
6006     save_CFLAGS=$CFLAGS
6007     CFLAGS="$CFLAGS -Werror -fpch-debuginfo"
6008     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_DEBUGINFO="-fpch-debuginfo" ],[])
6009     CFLAGS=$save_CFLAGS
6010     if test -n "$PCH_DEBUGINFO"; then
6011         AC_MSG_RESULT(yes)
6012     else
6013         AC_MSG_RESULT(no)
6014     fi
6016 AC_SUBST(PCH_DEBUGINFO)
6018 TAB=`printf '\t'`
6020 AC_MSG_CHECKING([the GNU Make version])
6021 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
6022 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6023 if test "$_make_longver" -ge "038200"; then
6024     AC_MSG_RESULT([$GNUMAKE $_make_version])
6026 elif test "$_make_longver" -ge "038100"; then
6027     if test "$build_os" = "cygwin"; then
6028         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
6029     fi
6030     AC_MSG_RESULT([$GNUMAKE $_make_version])
6032     dnl ===================================================================
6033     dnl Search all the common names for sha1sum
6034     dnl ===================================================================
6035     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
6036     if test -z "$SHA1SUM"; then
6037         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
6038     elif test "$SHA1SUM" = "openssl"; then
6039         SHA1SUM="openssl sha1"
6040     fi
6041     AC_MSG_CHECKING([for GNU Make bug 20033])
6042     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
6043     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
6044 A := \$(wildcard *.a)
6046 .PHONY: all
6047 all: \$(A:.a=.b)
6048 <TAB>@echo survived bug20033.
6050 .PHONY: setup
6051 setup:
6052 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
6054 define d1
6055 @echo lala \$(1)
6056 @sleep 1
6057 endef
6059 define d2
6060 @echo tyty \$(1)
6061 @sleep 1
6062 endef
6064 %.b : %.a
6065 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
6066 <TAB>\$(call d1,\$(CHECKSUM)),\
6067 <TAB>\$(call d2,\$(CHECKSUM)))
6069     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
6070         no_parallelism_make="YES"
6071         AC_MSG_RESULT([yes, disable parallelism])
6072     else
6073         AC_MSG_RESULT([no, keep parallelism enabled])
6074     fi
6075     rm -rf $TESTGMAKEBUG20033
6076 else
6077     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
6080 # find if gnumake support file function
6081 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
6082 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
6083 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6084     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
6086 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
6087 \$(file >test.txt,Success )
6089 .PHONY: all
6090 all:
6091 <TAB>@cat test.txt
6094 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
6095 if test -f $TESTGMAKEFILEFUNC/test.txt; then
6096     HAVE_GNUMAKE_FILE_FUNC=TRUE
6097     AC_MSG_RESULT([yes])
6098 else
6099     AC_MSG_RESULT([no])
6101 rm -rf $TESTGMAKEFILEFUNC
6102 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
6104 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
6105 STALE_MAKE=
6106 if test "$_make_ver_check" = ""; then
6107    STALE_MAKE=TRUE
6110 HAVE_LD_HASH_STYLE=FALSE
6111 WITH_LINKER_HASH_STYLE=
6112 AC_MSG_CHECKING([for --hash-style gcc linker support])
6113 if test "$GCC" = "yes"; then
6114     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
6115         hash_styles="gnu sysv"
6116     elif test "$with_linker_hash_style" = "no"; then
6117         hash_styles=
6118     else
6119         hash_styles="$with_linker_hash_style"
6120     fi
6122     for hash_style in $hash_styles; do
6123         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
6124         hash_style_ldflags_save=$LDFLAGS
6125         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
6127         AC_RUN_IFELSE([AC_LANG_PROGRAM(
6128             [
6129 #include <stdio.h>
6130             ],[
6131 printf ("");
6132             ])],
6133             [
6134                   HAVE_LD_HASH_STYLE=TRUE
6135                   WITH_LINKER_HASH_STYLE=$hash_style
6136             ],
6137             [HAVE_LD_HASH_STYLE=FALSE],
6138             [HAVE_LD_HASH_STYLE=FALSE])
6139         LDFLAGS=$hash_style_ldflags_save
6140     done
6142     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
6143         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
6144     else
6145         AC_MSG_RESULT( no )
6146     fi
6147     LDFLAGS=$hash_style_ldflags_save
6148 else
6149     AC_MSG_RESULT( no )
6151 AC_SUBST(HAVE_LD_HASH_STYLE)
6152 AC_SUBST(WITH_LINKER_HASH_STYLE)
6154 dnl ===================================================================
6155 dnl Check whether there's a Perl version available.
6156 dnl ===================================================================
6157 if test -z "$with_perl_home"; then
6158     AC_PATH_PROG(PERL, perl)
6159 else
6160     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
6161     _perl_path="$with_perl_home/bin/perl"
6162     if test -x "$_perl_path"; then
6163         PERL=$_perl_path
6164     else
6165         AC_MSG_ERROR([$_perl_path not found])
6166     fi
6169 dnl ===================================================================
6170 dnl Testing for Perl version 5 or greater.
6171 dnl $] is the Perl version variable, it is returned as an integer
6172 dnl ===================================================================
6173 if test "$PERL"; then
6174     AC_MSG_CHECKING([the Perl version])
6175     ${PERL} -e "exit($]);"
6176     _perl_version=$?
6177     if test "$_perl_version" -lt 5; then
6178         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
6179     fi
6180     AC_MSG_RESULT([Perl $_perl_version])
6181 else
6182     AC_MSG_ERROR([Perl not found, install Perl 5])
6185 dnl ===================================================================
6186 dnl Testing for required Perl modules
6187 dnl ===================================================================
6189 AC_MSG_CHECKING([for required Perl modules])
6190 perl_use_string="use Cwd ; use Digest::MD5"
6191 if test "$_os" = "WINNT"; then
6192     if test -n "$PKGFORMAT"; then
6193         for i in $PKGFORMAT; do
6194             case "$i" in
6195             msi)
6196                 # for getting fonts versions to use in MSI
6197                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
6198                 ;;
6199             esac
6200         done
6201     fi
6203 if test "$with_system_hsqldb" = "yes"; then
6204     perl_use_string="$perl_use_string ; use Archive::Zip"
6206 if test "$enable_openssl" = "yes" -a "$with_system_openssl" != "yes"; then
6207     # OpenSSL needs that to build
6208     perl_use_string="$perl_use_string ; use FindBin"
6210 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
6211     AC_MSG_RESULT([all modules found])
6212 else
6213     AC_MSG_RESULT([failed to find some modules])
6214     # Find out which modules are missing.
6215     for i in $perl_use_string; do
6216         if test "$i" != "use" -a "$i" != ";"; then
6217             if ! $PERL -e "use $i;">/dev/null 2>&1; then
6218                 missing_perl_modules="$missing_perl_modules $i"
6219             fi
6220         fi
6221     done
6222     AC_MSG_ERROR([
6223     The missing Perl modules are: $missing_perl_modules
6224     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
6227 dnl ===================================================================
6228 dnl Check for pkg-config
6229 dnl ===================================================================
6230 if test "$_os" != "WINNT"; then
6231     PKG_PROG_PKG_CONFIG
6234 if test "$_os" != "WINNT"; then
6236     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
6237     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
6238     # explicitly. Or put /path/to/compiler in PATH yourself.
6240     # Use wrappers for LTO
6241     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
6242         AC_CHECK_TOOL(AR,gcc-ar)
6243         AC_CHECK_TOOL(NM,gcc-nm)
6244         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
6245     else
6246         AC_CHECK_TOOL(AR,ar)
6247         AC_CHECK_TOOL(NM,nm)
6248         AC_CHECK_TOOL(RANLIB,ranlib)
6249     fi
6250     AC_CHECK_TOOL(OBJDUMP,objdump)
6251     AC_CHECK_TOOL(READELF,readelf)
6252     AC_CHECK_TOOL(STRIP,strip)
6253     if test "$_os" = "WINNT"; then
6254         AC_CHECK_TOOL(DLLTOOL,dlltool)
6255         AC_CHECK_TOOL(WINDRES,windres)
6256     fi
6258 AC_SUBST(AR)
6259 AC_SUBST(DLLTOOL)
6260 AC_SUBST(LD)
6261 AC_SUBST(NM)
6262 AC_SUBST(OBJDUMP)
6263 AC_SUBST(PKG_CONFIG)
6264 AC_SUBST(PKG_CONFIG_PATH)
6265 AC_SUBST(PKG_CONFIG_LIBDIR)
6266 AC_SUBST(RANLIB)
6267 AC_SUBST(READELF)
6268 AC_SUBST(STRIP)
6269 AC_SUBST(WINDRES)
6271 dnl ===================================================================
6272 dnl pkg-config checks on macOS
6273 dnl ===================================================================
6275 if test $_os = Darwin; then
6276     AC_MSG_CHECKING([for bogus pkg-config])
6277     if test -n "$PKG_CONFIG"; then
6278         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
6279             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
6280         else
6281             if test "$enable_bogus_pkg_config" = "yes"; then
6282                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
6283             else
6284                 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.])
6285             fi
6286         fi
6287     else
6288         AC_MSG_RESULT([no, good])
6289     fi
6292 find_csc()
6294     # Return value: $csctest
6296     unset csctest
6298     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
6299     if test -n "$regvalue"; then
6300         csctest=$regvalue
6301         return
6302     fi
6305 find_al()
6307     # Return value: $altest
6309     unset altest
6311     # We need this check to detect 4.6.1 or above.
6312     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
6313         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
6314         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
6315             altest=$regvalue
6316             return
6317         fi
6318     done
6320     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
6321         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
6322         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
6323             altest=$regvalue
6324             return
6325         fi
6326     done
6329 find_dotnetsdk46()
6331     unset frametest
6333     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
6334         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
6335         if test -n "$regvalue"; then
6336             frametest=$regvalue
6337             return
6338         fi
6339     done
6342 find_winsdk_version()
6344     # Args: $1 : SDK version as in "8.0", "8.1A" etc
6345     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
6347     unset winsdktest winsdkbinsubdir winsdklibsubdir
6349     case "$1" in
6350     8.0|8.0A)
6351         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
6352         if test -n "$regvalue"; then
6353             winsdktest=$regvalue
6354             winsdklibsubdir=win8
6355             return
6356         fi
6357         ;;
6358     8.1|8.1A)
6359         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
6360         if test -n "$regvalue"; then
6361             winsdktest=$regvalue
6362             winsdklibsubdir=winv6.3
6363             return
6364         fi
6365         ;;
6366     10.0)
6367         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
6368         if test -n "$regvalue"; then
6369             winsdktest=$regvalue
6370             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
6371             if test -n "$regvalue"; then
6372                 winsdkbinsubdir="$regvalue".0
6373                 winsdklibsubdir=$winsdkbinsubdir
6374                 local tmppath="$winsdktest\\Include\\$winsdklibsubdir"
6375                 local tmppath_unix=$(cygpath -u "$tmppath")
6376                 # test exist the SDK path
6377                 if test -d "$tmppath_unix"; then
6378                    # when path is convertible to a short path then path is okay
6379                    cygpath -d "$tmppath" >/dev/null 2>&1
6380                    if test $? -ne 0; then
6381                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
6382                    fi
6383                 else
6384                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
6385                 fi
6386             fi
6387             return
6388         fi
6389         ;;
6390     esac
6393 find_winsdk()
6395     # Return value: From find_winsdk_version
6397     unset winsdktest
6399     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
6400         find_winsdk_version $ver
6401         if test -n "$winsdktest"; then
6402             return
6403         fi
6404     done
6407 find_msms()
6409     # Return value: $msmdir
6411     AC_MSG_CHECKING([for MSVC merge modules directory])
6412     local my_msm_files
6413     local my_msm_dir
6415     dnl Order my_msm_files in increasing order. Then check the directories returned
6416     dnl by ls in an inner loop; assuming they are also ordered in increasing order,
6417     dnl the result will be the highest MSM version found in the highest directory.
6419     case "$VCVER" in
6420         160 | 170)
6421         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
6422         ;;
6423     esac
6424     for f in $my_msm_files; do
6425         echo "$as_me:$LINENO: searching for $f" >&5
6426     done
6428     msmdir=
6429     case "$VCVER" in
6430     160 | 170)
6431         for f in ${my_msm_files}; do
6432             for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6433                 my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
6434                 echo "$as_me:$LINENO: looking for $my_msm_dir${f}])" >&5
6435                 if test -e "$my_msm_dir${f}"; then
6436                     msmdir=$my_msm_dir
6437                 fi
6438             done
6439         done
6440         ;;
6441     esac
6443     if test -n "$msmdir"; then
6444         msmdir=`cygpath -m "$msmdir"`
6445         AC_MSG_RESULT([$msmdir])
6446     else
6447         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
6448             AC_MSG_FAILURE([not found])
6449         else
6450             AC_MSG_WARN([not found (check config.log)])
6451             add_warning "MSM none of ${my_msm_files} found"
6452         fi
6453     fi
6456 find_msvc_x64_dlls()
6458     # Return value: $msvcdllpath, $msvcdlls
6460     AC_MSG_CHECKING([for MSVC x64 DLL path])
6462     dnl Order crtver in increasing order. Then check the directories returned by
6463     dnl ls in an inner loop; assuming they are also ordered in increasing order,
6464     dnl the result will be the highest CRT version found in the highest directory.
6466     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
6467     case "$VCVER" in
6468     160 | 170)
6469         for crtver in 141 142; do
6470             for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6471                 echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT" >&5
6472                 if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT"; then
6473                     msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC$crtver.CRT"
6474                 fi
6475             done
6476         done
6477         ;;
6478     esac
6479     AC_MSG_RESULT([$msvcdllpath])
6480     AC_MSG_CHECKING([for MSVC x64 DLLs])
6481     msvcdlls="msvcp140.dll vcruntime140.dll"
6482     for dll in $msvcdlls; do
6483         if ! test -f "$msvcdllpath/$dll"; then
6484             AC_MSG_FAILURE([missing $dll])
6485         fi
6486     done
6487     AC_MSG_RESULT([found all ($msvcdlls)])
6490 dnl =========================================
6491 dnl Check for the Windows  SDK.
6492 dnl =========================================
6493 if test "$_os" = "WINNT"; then
6494     AC_MSG_CHECKING([for Windows SDK])
6495     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6496         find_winsdk
6497         WINDOWS_SDK_HOME=$winsdktest
6499         # normalize if found
6500         if test -n "$WINDOWS_SDK_HOME"; then
6501             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
6502             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
6503         fi
6505         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
6506     fi
6508     if test -n "$WINDOWS_SDK_HOME"; then
6509         # Remove a possible trailing backslash
6510         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
6512         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
6513              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
6514              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
6515             have_windows_sdk_headers=yes
6516         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
6517              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
6518              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
6519             have_windows_sdk_headers=yes
6520         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
6521              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
6522              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
6523             have_windows_sdk_headers=yes
6524         else
6525             have_windows_sdk_headers=no
6526         fi
6528         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
6529             have_windows_sdk_libs=yes
6530         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/user32.lib"; then
6531             have_windows_sdk_libs=yes
6532         else
6533             have_windows_sdk_libs=no
6534         fi
6536         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
6537             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
6538 the  Windows SDK are installed.])
6539         fi
6540     fi
6542     if test -z "$WINDOWS_SDK_HOME"; then
6543         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
6544     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
6545         WINDOWS_SDK_VERSION=80
6546         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
6547     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
6548         WINDOWS_SDK_VERSION=81
6549         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
6550     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
6551         WINDOWS_SDK_VERSION=10
6552         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
6553     else
6554         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
6555     fi
6556     PathFormat "$WINDOWS_SDK_HOME"
6557     WINDOWS_SDK_HOME="$formatted_path"
6558     WINDOWS_SDK_HOME_unix="$formatted_path_unix"
6559     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6560         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
6561         if test -d "$WINDOWS_SDK_HOME/include/um"; then
6562             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
6563         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
6564             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
6565         fi
6566     fi
6568     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
6569     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
6570     dnl but not in v8.0), so allow this to be overridden with a
6571     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
6572     dnl and configuration error if no WiLangId.vbs is found would arguably be
6573     dnl better, but I do not know under which conditions exactly it is needed by
6574     dnl msiglobal.pm:
6575     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
6576         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
6577         WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6578         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6579             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WIN_BUILD_ARCH}/WiLangId.vbs"
6580             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6581         fi
6582         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6583             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WIN_BUILD_ARCH/WiLangId.vbs
6584             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6585         fi
6586         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6587             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WIN_BUILD_ARCH/WiLangId.vbs")
6588             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6589         fi
6590     fi
6591     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
6592         if test -n "$with_package_format" -a "$with_package_format" != no; then
6593             for i in "$with_package_format"; do
6594                 if test "$i" = "msi"; then
6595                     if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6596                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
6597                     fi
6598                 fi
6599             done
6600         fi
6601     fi
6603 AC_SUBST(WINDOWS_SDK_HOME)
6604 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
6605 AC_SUBST(WINDOWS_SDK_VERSION)
6606 AC_SUBST(WINDOWS_SDK_WILANGID)
6608 if test "$build_os" = "cygwin"; then
6609     dnl Check midl.exe; this being the first check for a tool in the SDK bin
6610     dnl dir, it also determines that dir's path w/o an arch segment if any,
6611     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
6612     AC_MSG_CHECKING([for midl.exe])
6614     find_winsdk
6615     if test -n "$winsdkbinsubdir" \
6616         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/midl.exe"
6617     then
6618         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH
6619         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
6620     elif test -f "$winsdktest/Bin/$WIN_BUILD_ARCH/midl.exe"; then
6621         MIDL_PATH=$winsdktest/Bin/$WIN_BUILD_ARCH
6622         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
6623     elif test -f "$winsdktest/Bin/midl.exe"; then
6624         MIDL_PATH=$winsdktest/Bin
6625         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
6626     fi
6627     if test ! -f "$MIDL_PATH/midl.exe"; then
6628         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WIN_BUILD_ARCH, Windows SDK installation broken?])
6629     else
6630         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
6631     fi
6633     # Convert to posix path with 8.3 filename restrictions ( No spaces )
6634     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
6636     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
6637          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
6638          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
6639          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
6640     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
6641          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
6642          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6643          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
6644     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
6645          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
6646          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6647          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
6648     else
6649         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
6650     fi
6652     dnl Check csc.exe
6653     AC_MSG_CHECKING([for csc.exe])
6654     find_csc
6655     if test -f "$csctest/csc.exe"; then
6656         CSC_PATH="$csctest"
6657     fi
6658     if test ! -f "$CSC_PATH/csc.exe"; then
6659         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
6660     else
6661         AC_MSG_RESULT([$CSC_PATH/csc.exe])
6662     fi
6664     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
6666     dnl Check al.exe
6667     AC_MSG_CHECKING([for al.exe])
6668     find_winsdk
6669     if test -n "$winsdkbinsubdir" \
6670         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/al.exe"
6671     then
6672         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH"
6673     elif test -f "$winsdktest/Bin/$WIN_BUILD_ARCH/al.exe"; then
6674         AL_PATH="$winsdktest/Bin/$WIN_BUILD_ARCH"
6675     elif test -f "$winsdktest/Bin/al.exe"; then
6676         AL_PATH="$winsdktest/Bin"
6677     fi
6679     if test -z "$AL_PATH"; then
6680         find_al
6681         if test -f "$altest/bin/al.exe"; then
6682             AL_PATH="$altest/bin"
6683         elif test -f "$altest/al.exe"; then
6684             AL_PATH="$altest"
6685         fi
6686     fi
6687     if test ! -f "$AL_PATH/al.exe"; then
6688         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
6689     else
6690         AC_MSG_RESULT([$AL_PATH/al.exe])
6691     fi
6693     AL_PATH=`win_short_path_for_make "$AL_PATH"`
6695     dnl Check mscoree.lib / .NET Framework dir
6696     AC_MSG_CHECKING(.NET Framework)
6697     find_dotnetsdk46
6698     PathFormat "$frametest"
6699     frametest="$formatted_path"
6700     if test -f "$frametest/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6701         DOTNET_FRAMEWORK_HOME="$frametest"
6702     else
6703         find_winsdk
6704         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6705             DOTNET_FRAMEWORK_HOME="$winsdktest"
6706         fi
6707     fi
6708     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
6709         AC_MSG_ERROR([mscoree.lib not found])
6710     fi
6711     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
6713     PathFormat "$MIDL_PATH"
6714     MIDL_PATH="$formatted_path"
6716     PathFormat "$AL_PATH"
6717     AL_PATH="$formatted_path"
6719     PathFormat "$DOTNET_FRAMEWORK_HOME"
6720     DOTNET_FRAMEWORK_HOME="$formatted_path"
6722     PathFormat "$CSC_PATH"
6723     CSC_PATH="$formatted_path"
6726 dnl ===================================================================
6727 dnl Testing for C++ compiler and version...
6728 dnl ===================================================================
6730 if test "$_os" != "WINNT"; then
6731     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
6732     save_CXXFLAGS=$CXXFLAGS
6733     AC_PROG_CXX
6734     CXXFLAGS=$save_CXXFLAGS
6735     if test -z "$CXX_BASE"; then
6736         CXX_BASE=`first_arg_basename "$CXX"`
6737     fi
6740 dnl check for GNU C++ compiler version
6741 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
6742     AC_MSG_CHECKING([the GNU C++ compiler version])
6744     _gpp_version=`$CXX -dumpversion`
6745     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
6747     if test "$_gpp_majmin" -lt "700"; then
6748         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
6749     else
6750         AC_MSG_RESULT([ok (g++ $_gpp_version)])
6751     fi
6753     dnl see https://code.google.com/p/android/issues/detail?id=41770
6754         glibcxx_threads=no
6755         AC_LANG_PUSH([C++])
6756         AC_REQUIRE_CPP
6757         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
6758         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
6759             #include <bits/c++config.h>]],[[
6760             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
6761             && !defined(_GLIBCXX__PTHREADS) \
6762             && !defined(_GLIBCXX_HAS_GTHREADS)
6763             choke me
6764             #endif
6765         ]])],[AC_MSG_RESULT([yes])
6766         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
6767         AC_LANG_POP([C++])
6768         if test $glibcxx_threads = yes; then
6769             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
6770         fi
6772 AC_SUBST(BOOST_CXXFLAGS)
6775 # prefx CXX with ccache if needed
6777 UNCACHED_CXX="$CXX"
6778 if test "$CCACHE" != ""; then
6779     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
6780     AC_LANG_PUSH([C++])
6781     save_CXXFLAGS=$CXXFLAGS
6782     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
6783     dnl an empty program will do, we're checking the compiler flags
6784     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
6785                       [use_ccache=yes], [use_ccache=no])
6786     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
6787         AC_MSG_RESULT([yes])
6788     else
6789         CXX="$CCACHE $CXX"
6790         CXX_BASE="ccache $CXX_BASE"
6791         AC_MSG_RESULT([no])
6792     fi
6793     CXXFLAGS=$save_CXXFLAGS
6794     AC_LANG_POP([C++])
6797 dnl ===================================================================
6798 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
6799 dnl ===================================================================
6801 if test "$_os" != "WINNT"; then
6802     AC_PROG_CXXCPP
6804     dnl Check whether there's a C pre-processor.
6805     AC_PROG_CPP
6809 dnl ===================================================================
6810 dnl Find integral type sizes and alignments
6811 dnl ===================================================================
6813 if test "$_os" != "WINNT"; then
6815     AC_CHECK_SIZEOF(long)
6816     AC_CHECK_SIZEOF(short)
6817     AC_CHECK_SIZEOF(int)
6818     AC_CHECK_SIZEOF(long long)
6819     AC_CHECK_SIZEOF(double)
6820     AC_CHECK_SIZEOF(void*)
6822     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
6823     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
6824     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
6825     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
6826     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6828     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6829     m4_pattern_allow([AC_CHECK_ALIGNOF])
6830     m4_ifdef([AC_CHECK_ALIGNOF],
6831         [
6832             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6833             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6834             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6835             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6836         ],
6837         [
6838             case "$_os-$host_cpu" in
6839             Linux-i686)
6840                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6841                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6842                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6843                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6844                 ;;
6845             Linux-x86_64)
6846                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6847                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6848                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6849                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6850                 ;;
6851             *)
6852                 if test -z "$ac_cv_alignof_short" -o \
6853                         -z "$ac_cv_alignof_int" -o \
6854                         -z "$ac_cv_alignof_long" -o \
6855                         -z "$ac_cv_alignof_double"; then
6856                    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.])
6857                 fi
6858                 ;;
6859             esac
6860         ])
6862     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6863     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6864     if test $ac_cv_sizeof_long -eq 8; then
6865         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6866     elif test $ac_cv_sizeof_double -eq 8; then
6867         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6868     else
6869         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6870     fi
6872     dnl Check for large file support
6873     AC_SYS_LARGEFILE
6874     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6875         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6876     fi
6877     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6878         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6879     fi
6880 else
6881     # Hardcode for MSVC
6882     SAL_TYPES_SIZEOFSHORT=2
6883     SAL_TYPES_SIZEOFINT=4
6884     SAL_TYPES_SIZEOFLONG=4
6885     SAL_TYPES_SIZEOFLONGLONG=8
6886     if test $WIN_HOST_BITS -eq 32; then
6887         SAL_TYPES_SIZEOFPOINTER=4
6888     else
6889         SAL_TYPES_SIZEOFPOINTER=8
6890     fi
6891     SAL_TYPES_ALIGNMENT2=2
6892     SAL_TYPES_ALIGNMENT4=4
6893     SAL_TYPES_ALIGNMENT8=8
6894     LFS_CFLAGS=''
6896 AC_SUBST(LFS_CFLAGS)
6898 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6899 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6900 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6901 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6902 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6903 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6904 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6905 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6907 dnl ===================================================================
6908 dnl Check whether to enable runtime optimizations
6909 dnl ===================================================================
6910 ENABLE_RUNTIME_OPTIMIZATIONS=
6911 AC_MSG_CHECKING([whether to enable runtime optimizations])
6912 if test -z "$enable_runtime_optimizations"; then
6913     for i in $CC; do
6914         case $i in
6915         -fsanitize=*)
6916             enable_runtime_optimizations=no
6917             break
6918             ;;
6919         esac
6920     done
6922 if test "$enable_runtime_optimizations" != no; then
6923     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6924     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6925     AC_MSG_RESULT([yes])
6926 else
6927     AC_MSG_RESULT([no])
6929 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6931 dnl ===================================================================
6932 dnl Check if valgrind headers are available
6933 dnl ===================================================================
6934 ENABLE_VALGRIND=
6935 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6936     prev_cppflags=$CPPFLAGS
6937     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6938     # or where does it come from?
6939     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6940     AC_CHECK_HEADER([valgrind/valgrind.h],
6941         [ENABLE_VALGRIND=TRUE])
6942     CPPFLAGS=$prev_cppflags
6944 AC_SUBST([ENABLE_VALGRIND])
6945 if test -z "$ENABLE_VALGRIND"; then
6946     if test "$with_valgrind" = yes; then
6947         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6948     fi
6949     VALGRIND_CFLAGS=
6951 AC_SUBST([VALGRIND_CFLAGS])
6954 dnl ===================================================================
6955 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6956 dnl ===================================================================
6958 # We need at least the sys/sdt.h include header.
6959 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6960 if test "$SDT_H_FOUND" = "TRUE"; then
6961     # Found sys/sdt.h header, now make sure the c++ compiler works.
6962     # Old g++ versions had problems with probes in constructors/destructors.
6963     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6964     AC_LANG_PUSH([C++])
6965     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6966     #include <sys/sdt.h>
6967     class ProbeClass
6968     {
6969     private:
6970       int& ref;
6971       const char *name;
6973     public:
6974       ProbeClass(int& v, const char *n) : ref(v), name(n)
6975       {
6976         DTRACE_PROBE2(_test_, cons, name, ref);
6977       }
6979       void method(int min)
6980       {
6981         DTRACE_PROBE3(_test_, meth, name, ref, min);
6982         ref -= min;
6983       }
6985       ~ProbeClass()
6986       {
6987         DTRACE_PROBE2(_test_, dest, name, ref);
6988       }
6989     };
6990     ]],[[
6991     int i = 64;
6992     DTRACE_PROBE1(_test_, call, i);
6993     ProbeClass inst = ProbeClass(i, "call");
6994     inst.method(24);
6995     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6996           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6997     AC_LANG_POP([C++])
6999 AC_CONFIG_HEADERS([config_host/config_probes.h])
7001 dnl ===================================================================
7002 dnl GCC features
7003 dnl ===================================================================
7004 HAVE_GCC_STACK_CLASH_PROTECTION=
7005 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7006     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
7007     save_CFLAGS=$CFLAGS
7008     CFLAGS="$CFLAGS -Werror -fstack-clash-protection"
7009     AC_LINK_IFELSE(
7010         [AC_LANG_PROGRAM(, [[return 0;]])],
7011         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
7012         [AC_MSG_RESULT([no])])
7013     CFLAGS=$save_CFLAGS
7015     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
7016     save_CFLAGS=$CFLAGS
7017     CFLAGS="$CFLAGS -Werror -mno-avx"
7018     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
7019     CFLAGS=$save_CFLAGS
7020     if test "$HAVE_GCC_AVX" = "TRUE"; then
7021         AC_MSG_RESULT([yes])
7022     else
7023         AC_MSG_RESULT([no])
7024     fi
7026     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
7027     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
7028     int v = 0;
7029     if (__sync_add_and_fetch(&v, 1) != 1 ||
7030         __sync_sub_and_fetch(&v, 1) != 0)
7031         return 1;
7032     __sync_synchronize();
7033     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
7034         v != 1)
7035         return 1;
7036     return 0;
7037 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
7038     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
7039         AC_MSG_RESULT([yes])
7040         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
7041     else
7042         AC_MSG_RESULT([no])
7043     fi
7045     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
7046     AC_LANG_PUSH([C++])
7047     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7048             #include <cstddef>
7049             #include <cxxabi.h>
7050             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
7051         ])], [
7052             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
7053             AC_MSG_RESULT([yes])
7054         ], [AC_MSG_RESULT([no])])
7055     AC_LANG_POP([C++])
7057     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
7058     AC_LANG_PUSH([C++])
7059     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7060             #include <cstddef>
7061             #include <cxxabi.h>
7062             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
7063         ])], [
7064             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
7065             AC_MSG_RESULT([yes])
7066         ], [AC_MSG_RESULT([no])])
7067     AC_LANG_POP([C++])
7069     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
7070     AC_LANG_PUSH([C++])
7071     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7072             #include <cxxabi.h>
7073             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
7074         ])], [
7075             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
7076             AC_MSG_RESULT([yes])
7077         ], [AC_MSG_RESULT([no])])
7078     AC_LANG_POP([C++])
7080     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
7081     AC_LANG_PUSH([C++])
7082     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7083             #include <cstddef>
7084             #include <cxxabi.h>
7085             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
7086         ])], [
7087             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
7088             AC_MSG_RESULT([yes])
7089         ], [AC_MSG_RESULT([no])])
7090     AC_LANG_POP([C++])
7092     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exception in cxxabi.h])
7093     AC_LANG_PUSH([C++])
7094     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7095             #include <cstddef>
7096             #include <cxxabi.h>
7097             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exception); }
7098         ])], [
7099             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTION],[1])
7100             AC_MSG_RESULT([yes])
7101         ], [AC_MSG_RESULT([no])])
7102     AC_LANG_POP([C++])
7104     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
7105     AC_LANG_PUSH([C++])
7106     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7107             #include <cxxabi.h>
7108             void * f() { return __cxxabiv1::__cxa_get_globals(); }
7109         ])], [
7110             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
7111             AC_MSG_RESULT([yes])
7112         ], [AC_MSG_RESULT([no])])
7113     AC_LANG_POP([C++])
7115     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
7116     AC_LANG_PUSH([C++])
7117     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7118             #include <cxxabi.h>
7119             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
7120         ])], [
7121             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
7122             AC_MSG_RESULT([yes])
7123         ], [AC_MSG_RESULT([no])])
7124     AC_LANG_POP([C++])
7126     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
7127     AC_LANG_PUSH([C++])
7128     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7129             #include <cxxabi.h>
7130             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
7131         ])], [
7132             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
7133             AC_MSG_RESULT([yes])
7134         ], [AC_MSG_RESULT([no])])
7135     AC_LANG_POP([C++])
7137     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
7138     AC_LANG_PUSH([C++])
7139     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7140             #include <cstddef>
7141             #include <cxxabi.h>
7142             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
7143         ])], [
7144             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
7145             AC_MSG_RESULT([yes])
7146         ], [AC_MSG_RESULT([no])])
7147     AC_LANG_POP([C++])
7149     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
7150     AC_LANG_PUSH([C++])
7151     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7152             #include <cstddef>
7153             #include <cxxabi.h>
7154             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
7155         ])], [
7156             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
7157             AC_MSG_RESULT([yes])
7158         ], [AC_MSG_RESULT([no])])
7159     AC_LANG_POP([C++])
7162 AC_SUBST(HAVE_GCC_AVX)
7163 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
7164 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
7166 dnl ===================================================================
7167 dnl Identify the C++ library
7168 dnl ===================================================================
7170 AC_MSG_CHECKING([what the C++ library is])
7171 AC_LANG_PUSH([C++])
7172 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7173 #include <utility>
7174 #ifndef __GLIBCXX__
7175 foo bar
7176 #endif
7177 ]])],
7178     [CPP_LIBRARY=GLIBCXX
7179      cpp_library_name="GNU libstdc++"
7180     ],
7181     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7182 #include <utility>
7183 #ifndef _LIBCPP_VERSION
7184 foo bar
7185 #endif
7186 ]])],
7187     [CPP_LIBRARY=LIBCPP
7188      cpp_library_name="LLVM libc++"
7189      AC_DEFINE([HAVE_LIBCXX])
7190     ],
7191     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7192 #include <utility>
7193 #ifndef _MSC_VER
7194 foo bar
7195 #endif
7196 ]])],
7197     [CPP_LIBRARY=MSVCRT
7198      cpp_library_name="Microsoft"
7199     ],
7200     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
7201 AC_MSG_RESULT([$cpp_library_name])
7202 AC_LANG_POP([C++])
7204 dnl ===================================================================
7205 dnl Check for gperf
7206 dnl ===================================================================
7207 AC_PATH_PROG(GPERF, gperf)
7208 if test -z "$GPERF"; then
7209     AC_MSG_ERROR([gperf not found but needed. Install it.])
7211 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7212     GPERF=`cygpath -m $GPERF`
7214 AC_MSG_CHECKING([whether gperf is new enough])
7215 my_gperf_ver1=$($GPERF --version | head -n 1)
7216 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
7217 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
7218 if test "$my_gperf_ver3" -ge 301; then
7219     AC_MSG_RESULT([yes ($my_gperf_ver2)])
7220 else
7221     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
7223 AC_SUBST(GPERF)
7225 dnl ===================================================================
7226 dnl Check for system libcmis
7227 dnl ===================================================================
7228 # libcmis requires curl and we can't build curl for iOS
7229 if test "$test_cmis" = "yes" -a "$enable_cmis" = "yes"; then
7230     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
7231     ENABLE_LIBCMIS=TRUE
7232 else
7233     ENABLE_LIBCMIS=
7235 AC_SUBST(ENABLE_LIBCMIS)
7237 dnl ===================================================================
7238 dnl C++11
7239 dnl ===================================================================
7241 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
7242 CXXFLAGS_CXX11=
7243 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
7244     if test "$with_latest_c__" = yes; then
7245         CXXFLAGS_CXX11=-std:c++latest
7246     else
7247         CXXFLAGS_CXX11=-std:c++17
7248     fi
7249     CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -permissive- -Zc:__cplusplus"
7250 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7251     my_flags='-std=c++17 -std=c++1z'
7252     if test "$with_latest_c__" = yes; then
7253         my_flags="-std=c++23 -std=c++2b -std=c++20 -std=c++2a $my_flags"
7254     fi
7255     for flag in $my_flags; do
7256         if test "$COM" = MSC; then
7257             flag="-Xclang $flag"
7258         fi
7259         save_CXXFLAGS=$CXXFLAGS
7260         CXXFLAGS="$CXXFLAGS $flag -Werror"
7261         if test "$SYSTEM_LIBCMIS" = TRUE; then
7262             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
7263         fi
7264         AC_LANG_PUSH([C++])
7265         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7266             #include <algorithm>
7267             #include <functional>
7268             #include <vector>
7270             #if defined SYSTEM_LIBCMIS
7271             // See ucb/source/ucp/cmis/auth_provider.hxx:
7272             #if !defined __clang__
7273             #pragma GCC diagnostic push
7274             #pragma GCC diagnostic ignored "-Wdeprecated"
7275             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
7276             #endif
7277             #include <libcmis/libcmis.hxx>
7278             #if !defined __clang__
7279             #pragma GCC diagnostic pop
7280             #endif
7281             #endif
7283             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
7284                 std::sort(v.begin(), v.end(), fn);
7285             }
7286             ]])],[CXXFLAGS_CXX11=$flag])
7287         AC_LANG_POP([C++])
7288         CXXFLAGS=$save_CXXFLAGS
7289         if test -n "$CXXFLAGS_CXX11"; then
7290             break
7291         fi
7292     done
7294 if test -n "$CXXFLAGS_CXX11"; then
7295     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
7296 else
7297     AC_MSG_ERROR(no)
7299 AC_SUBST(CXXFLAGS_CXX11)
7301 if test "$GCC" = "yes"; then
7302     save_CXXFLAGS=$CXXFLAGS
7303     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7304     CHECK_L_ATOMIC
7305     CXXFLAGS=$save_CXXFLAGS
7306     AC_SUBST(ATOMIC_LIB)
7309 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
7310 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
7311 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
7312 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
7313 dnl again towards 4.7.2:
7314 if test $CPP_LIBRARY = GLIBCXX; then
7315     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
7316     AC_LANG_PUSH([C++])
7317     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7318 #include <list>
7319 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
7320     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
7321     //   GCC 4.7.0: 20120322
7322     //   GCC 4.7.1: 20120614
7323     // and using a range check is not possible as the mapping between
7324     // __GLIBCXX__ values and GCC versions is not monotonic
7325 /* ok */
7326 #else
7327 abi broken
7328 #endif
7329         ]])], [AC_MSG_RESULT(no, ok)],
7330         [AC_MSG_ERROR(yes)])
7331     AC_LANG_POP([C++])
7334 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
7335 save_CXXFLAGS=$CXXFLAGS
7336 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7337 AC_LANG_PUSH([C++])
7339 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7340 #include <stddef.h>
7342 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
7344 namespace
7346         struct b
7347         {
7348                 int i;
7349                 int j;
7350         };
7352 ]], [[
7353 struct a
7355         int i;
7356         int j;
7358 a thinga[]={{0,0}, {1,1}};
7359 b thingb[]={{0,0}, {1,1}};
7360 size_t i = sizeof(sal_n_array_size(thinga));
7361 size_t j = sizeof(sal_n_array_size(thingb));
7362 return !(i != 0 && j != 0);
7364     ], [ AC_MSG_RESULT(yes) ],
7365     [ AC_MSG_ERROR(no)])
7366 AC_LANG_POP([C++])
7367 CXXFLAGS=$save_CXXFLAGS
7369 HAVE_GCC_FNO_SIZED_DEALLOCATION=
7370 if test "$GCC" = yes; then
7371     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
7372     AC_LANG_PUSH([C++])
7373     save_CXXFLAGS=$CXXFLAGS
7374     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
7375     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
7376     CXXFLAGS=$save_CXXFLAGS
7377     AC_LANG_POP([C++])
7378     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
7379         AC_MSG_RESULT([yes])
7380     else
7381         AC_MSG_RESULT([no])
7382     fi
7384 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
7386 AC_MSG_CHECKING([whether $CXX_BASE supports a working C++20 consteval])
7387 dnl ...that does not suffer from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96994> "Missing code
7388 dnl from consteval constructor initializing const variable",
7389 dnl <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98752> "wrong 'error: â€˜this’ is not a constant
7390 dnl expression' with consteval constructor", or <https://bugs.llvm.org/show_bug.cgi?id=50063> "code
7391 dnl using consteval: 'clang/lib/CodeGen/Address.h:38: llvm::Value*
7392 dnl clang::CodeGen::Address::getPointer() const: Assertion `isValid()' failed.'":
7393 AC_LANG_PUSH([C++])
7394 save_CXXFLAGS=$CXXFLAGS
7395 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7396 AC_RUN_IFELSE([AC_LANG_PROGRAM([
7397         struct S {
7398             consteval S() { i = 1; }
7399             int i = 0;
7400         };
7401         S const s;
7403         struct S1 { consteval S1(int) {} };
7404         struct S2 {
7405             S1 x;
7406             S2(): x(0) {}
7407         };
7409         struct S3 {
7410             consteval S3() {}
7411             union {
7412                 int a;
7413                 unsigned b = 0;
7414             };
7415         };
7416         void f() { S3(); }
7417     ], [
7418         return (s.i == 1) ? 0 : 1;
7419     ])], [
7420         AC_DEFINE([HAVE_CPP_CONSTEVAL],[1])
7421         AC_MSG_RESULT([yes])
7422     ], [AC_MSG_RESULT([no])], [AC_MSG_RESULT([assumed no (cross compiling)])])
7423 CXXFLAGS=$save_CXXFLAGS
7424 AC_LANG_POP([C++])
7426 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
7427 AC_LANG_PUSH([C++])
7428 save_CXXFLAGS=$CXXFLAGS
7429 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7430 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7431         #include <algorithm>
7432         #include <initializer_list>
7433         #include <vector>
7434         template<typename T> class S {
7435         private:
7436             std::vector<T> v_;
7437         public:
7438             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
7439         };
7440         constinit S<int> s{3, 2, 1};
7441     ])], [
7442         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
7443         AC_MSG_RESULT([yes])
7444     ], [AC_MSG_RESULT([no])])
7445 CXXFLAGS=$save_CXXFLAGS
7446 AC_LANG_POP([C++])
7448 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
7449 AC_LANG_PUSH([C++])
7450 save_CXXFLAGS=$CXXFLAGS
7451 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7452 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7453         #include <span>
7454         #include <type_traits>
7455         // Don't check size_type directly, as it was called index_type before P1872R0:
7456         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
7457     ])], [
7458         AC_DEFINE([HAVE_CPP_SPAN],[1])
7459         AC_MSG_RESULT([yes])
7460     ], [AC_MSG_RESULT([no])])
7461 CXXFLAGS=$save_CXXFLAGS
7462 AC_LANG_POP([C++])
7464 AC_MSG_CHECKING([whether $CXX_BASE implements C++ DR P1155R3])
7465 AC_LANG_PUSH([C++])
7466 save_CXXFLAGS=$CXXFLAGS
7467 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7468 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7469         struct S1 { S1(S1 &&); };
7470         struct S2: S1 {};
7471         S1 f(S2 s) { return s; }
7472     ])], [
7473         AC_DEFINE([HAVE_P1155R3],[1])
7474         AC_MSG_RESULT([yes])
7475     ], [AC_MSG_RESULT([no])])
7476 CXXFLAGS=$save_CXXFLAGS
7477 AC_LANG_POP([C++])
7479 dnl Supported since GCC 9 and Clang 10 (which each also started to support -Wdeprecated-copy, but
7480 dnl which is included in -Wextra anyway):
7481 HAVE_WDEPRECATED_COPY_DTOR=
7482 if test "$GCC" = yes; then
7483     AC_MSG_CHECKING([whether $CXX_BASE supports -Wdeprecated-copy-dtor])
7484     AC_LANG_PUSH([C++])
7485     save_CXXFLAGS=$CXXFLAGS
7486     CXXFLAGS="$CXXFLAGS -Werror -Wdeprecated-copy-dtor"
7487     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
7488             HAVE_WDEPRECATED_COPY_DTOR=TRUE
7489             AC_MSG_RESULT([yes])
7490         ], [AC_MSG_RESULT([no])])
7491     CXXFLAGS=$save_CXXFLAGS
7492     AC_LANG_POP([C++])
7494 AC_SUBST([HAVE_WDEPRECATED_COPY_DTOR])
7496 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
7497 dnl uninitialized warning for code like
7499 dnl   OString f();
7500 dnl   boost::optional<OString> * g(bool b) {
7501 dnl       boost::optional<OString> o;
7502 dnl       if (b) o = f();
7503 dnl       return new boost::optional<OString>(o);
7504 dnl   }
7506 dnl (as is e.g. present, in a slightly more elaborate form, in
7507 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
7508 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
7509 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
7510 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7511     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
7512     AC_LANG_PUSH([C++])
7513     save_CXXFLAGS=$CXXFLAGS
7514     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
7515     if test "$ENABLE_OPTIMIZED" = TRUE; then
7516         CXXFLAGS="$CXXFLAGS -O2"
7517     else
7518         CXXFLAGS="$CXXFLAGS -O0"
7519     fi
7520     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7521             #include <new>
7522             void f1(int);
7523             struct S1 {
7524                 ~S1() { f1(n); }
7525                 int n = 0;
7526             };
7527             struct S2 {
7528                 S2() {}
7529                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
7530                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
7531                 void set(S1 s) {
7532                     new (stg) S1(s);
7533                     init = true;
7534                 }
7535                 bool init = false;
7536                 char stg[sizeof (S1)];
7537             } ;
7538             S1 f2();
7539             S2 * f3(bool b) {
7540                 S2 o;
7541                 if (b) o.set(f2());
7542                 return new S2(o);
7543             }
7544         ]])], [AC_MSG_RESULT([no])], [
7545             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
7546             AC_MSG_RESULT([yes])
7547         ])
7548     CXXFLAGS=$save_CXXFLAGS
7549     AC_LANG_POP([C++])
7551 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
7553 dnl Check for <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c5> "[8/9/10/11 Regression]
7554 dnl -Wstringop-overflow false positive due to using MEM_REF type of &MEM" (fixed in GCC 11), which
7555 dnl hits us e.g. with GCC 10 and --enable-optimized at
7557 dnl   In file included from include/rtl/string.hxx:49,
7558 dnl                    from include/rtl/ustring.hxx:43,
7559 dnl                    from include/osl/file.hxx:35,
7560 dnl                    from include/codemaker/global.hxx:28,
7561 dnl                    from include/codemaker/options.hxx:23,
7562 dnl                    from codemaker/source/commoncpp/commoncpp.cxx:24:
7563 dnl   In function â€˜char* rtl::addDataHelper(char*, const char*, std::size_t)’,
7564 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,
7565 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,
7566 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,
7567 dnl       inlined from â€˜rtl::OString codemaker::cpp::scopedCppName(const rtl::OString&, bool)’ at codemaker/source/commoncpp/commoncpp.cxx:53:55:
7568 dnl   include/rtl/stringconcat.hxx:78:15: error: writing 2 bytes into a region of size 1 [-Werror=stringop-overflow=]
7569 dnl      78 |         memcpy( buffer, data, length );
7570 dnl         |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
7571 HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=
7572 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7573     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=stringop-overflow=])
7574     AC_LANG_PUSH([C++])
7575     save_CXXFLAGS=$CXXFLAGS
7576     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wstringop-overflow"
7577     if test "$ENABLE_OPTIMIZED" = TRUE; then
7578         CXXFLAGS="$CXXFLAGS -O2"
7579     else
7580         CXXFLAGS="$CXXFLAGS -O0"
7581     fi
7582     dnl Test code taken from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c0>:
7583     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7584             void fill(char const * begin, char const * end, char c);
7585             struct q {
7586                 char ids[4];
7587                 char username[6];
7588             };
7589             void test(q & c) {
7590                 fill(c.ids, c.ids + sizeof(c.ids), '\0');
7591                 __builtin_strncpy(c.username, "root", sizeof(c.username));
7592             }
7593         ]])], [AC_MSG_RESULT([no])], [
7594             HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=TRUE
7595             AC_MSG_RESULT([yes])
7596         ])
7597     CXXFLAGS=$save_CXXFLAGS
7598     AC_LANG_POP([C++])
7600 AC_SUBST([HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW])
7602 HAVE_DLLEXPORTINLINES=
7603 if test "$_os" = "WINNT"; then
7604     AC_MSG_CHECKING([whether $CXX_BASE supports -Zc:dllexportInlines-])
7605     AC_LANG_PUSH([C++])
7606     save_CXXFLAGS=$CXXFLAGS
7607     CXXFLAGS="$CXXFLAGS -Werror -Zc:dllexportInlines-"
7608     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
7609             HAVE_DLLEXPORTINLINES=TRUE
7610             AC_MSG_RESULT([yes])
7611         ], [AC_MSG_RESULT([no])])
7612     CXXFLAGS=$save_CXXFLAGS
7613     AC_LANG_POP([C++])
7615 AC_SUBST([HAVE_DLLEXPORTINLINES])
7617 dnl ===================================================================
7618 dnl CPU Intrinsics support - SSE, AVX
7619 dnl ===================================================================
7621 CXXFLAGS_INTRINSICS_SSE2=
7622 CXXFLAGS_INTRINSICS_SSSE3=
7623 CXXFLAGS_INTRINSICS_SSE41=
7624 CXXFLAGS_INTRINSICS_SSE42=
7625 CXXFLAGS_INTRINSICS_AVX=
7626 CXXFLAGS_INTRINSICS_AVX2=
7627 CXXFLAGS_INTRINSICS_AVX512=
7628 CXXFLAGS_INTRINSICS_AVX512F=
7629 CXXFLAGS_INTRINSICS_F16C=
7630 CXXFLAGS_INTRINSICS_FMA=
7632 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7633     # GCC, Clang or Clang-cl (clang-cl + MSVC's -arch options don't work well together)
7634     flag_sse2=-msse2
7635     flag_ssse3=-mssse3
7636     flag_sse41=-msse4.1
7637     flag_sse42=-msse4.2
7638     flag_avx=-mavx
7639     flag_avx2=-mavx2
7640     flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
7641     flag_avx512f=-mavx512f
7642     flag_f16c=-mf16c
7643     flag_fma=-mfma
7644 else
7645     # https://docs.microsoft.com/en-us/cpp/build/reference/arch-x86
7646     # MSVC seems to differentiate only between SSE and SSE2, where in fact
7647     # SSE2 seems to be SSE2+.
7648     # Even if -arch:SSE2 is the default, set it explicitly, so that the variable
7649     # is not empty (and can be tested in gbuild).
7650     flag_sse2=-arch:SSE2
7651     flag_ssse3=-arch:SSE2
7652     flag_sse41=-arch:SSE2
7653     flag_sse42=-arch:SSE2
7654     flag_avx=-arch:AVX
7655     flag_avx2=-arch:AVX2
7656     flag_avx512=-arch:AVX512
7657     flag_avx512f=-arch:AVX512
7658     # These are part of -arch:AVX2
7659     flag_f16c=-arch:AVX2
7660     flag_fma=-arch:AVX2
7663 AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
7664 AC_LANG_PUSH([C++])
7665 save_CXXFLAGS=$CXXFLAGS
7666 CXXFLAGS="$CXXFLAGS $flag_sse2"
7667 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7668     #include <emmintrin.h>
7669     int main () {
7670         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7671         c = _mm_xor_si128 (a, b);
7672         return 0;
7673     }
7674     ])],
7675     [can_compile_sse2=yes],
7676     [can_compile_sse2=no])
7677 AC_LANG_POP([C++])
7678 CXXFLAGS=$save_CXXFLAGS
7679 AC_MSG_RESULT([${can_compile_sse2}])
7680 if test "${can_compile_sse2}" = "yes" ; then
7681     CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
7684 AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
7685 AC_LANG_PUSH([C++])
7686 save_CXXFLAGS=$CXXFLAGS
7687 CXXFLAGS="$CXXFLAGS $flag_ssse3"
7688 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7689     #include <tmmintrin.h>
7690     int main () {
7691         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7692         c = _mm_maddubs_epi16 (a, b);
7693         return 0;
7694     }
7695     ])],
7696     [can_compile_ssse3=yes],
7697     [can_compile_ssse3=no])
7698 AC_LANG_POP([C++])
7699 CXXFLAGS=$save_CXXFLAGS
7700 AC_MSG_RESULT([${can_compile_ssse3}])
7701 if test "${can_compile_ssse3}" = "yes" ; then
7702     CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
7705 AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
7706 AC_LANG_PUSH([C++])
7707 save_CXXFLAGS=$CXXFLAGS
7708 CXXFLAGS="$CXXFLAGS $flag_sse41"
7709 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7710     #include <smmintrin.h>
7711     int main () {
7712         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7713         c = _mm_cmpeq_epi64 (a, b);
7714         return 0;
7715     }
7716     ])],
7717     [can_compile_sse41=yes],
7718     [can_compile_sse41=no])
7719 AC_LANG_POP([C++])
7720 CXXFLAGS=$save_CXXFLAGS
7721 AC_MSG_RESULT([${can_compile_sse41}])
7722 if test "${can_compile_sse41}" = "yes" ; then
7723     CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
7726 AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
7727 AC_LANG_PUSH([C++])
7728 save_CXXFLAGS=$CXXFLAGS
7729 CXXFLAGS="$CXXFLAGS $flag_sse42"
7730 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7731     #include <nmmintrin.h>
7732     int main () {
7733         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7734         c = _mm_cmpgt_epi64 (a, b);
7735         return 0;
7736     }
7737     ])],
7738     [can_compile_sse42=yes],
7739     [can_compile_sse42=no])
7740 AC_LANG_POP([C++])
7741 CXXFLAGS=$save_CXXFLAGS
7742 AC_MSG_RESULT([${can_compile_sse42}])
7743 if test "${can_compile_sse42}" = "yes" ; then
7744     CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
7747 AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
7748 AC_LANG_PUSH([C++])
7749 save_CXXFLAGS=$CXXFLAGS
7750 CXXFLAGS="$CXXFLAGS $flag_avx"
7751 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7752     #include <immintrin.h>
7753     int main () {
7754         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
7755         c = _mm256_xor_ps(a, b);
7756         return 0;
7757     }
7758     ])],
7759     [can_compile_avx=yes],
7760     [can_compile_avx=no])
7761 AC_LANG_POP([C++])
7762 CXXFLAGS=$save_CXXFLAGS
7763 AC_MSG_RESULT([${can_compile_avx}])
7764 if test "${can_compile_avx}" = "yes" ; then
7765     CXXFLAGS_INTRINSICS_AVX="$flag_avx"
7768 AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
7769 AC_LANG_PUSH([C++])
7770 save_CXXFLAGS=$CXXFLAGS
7771 CXXFLAGS="$CXXFLAGS $flag_avx2"
7772 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7773     #include <immintrin.h>
7774     int main () {
7775         __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
7776         c = _mm256_maddubs_epi16(a, b);
7777         return 0;
7778     }
7779     ])],
7780     [can_compile_avx2=yes],
7781     [can_compile_avx2=no])
7782 AC_LANG_POP([C++])
7783 CXXFLAGS=$save_CXXFLAGS
7784 AC_MSG_RESULT([${can_compile_avx2}])
7785 if test "${can_compile_avx2}" = "yes" ; then
7786     CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
7789 AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
7790 AC_LANG_PUSH([C++])
7791 save_CXXFLAGS=$CXXFLAGS
7792 CXXFLAGS="$CXXFLAGS $flag_avx512"
7793 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7794     #include <immintrin.h>
7795     int main () {
7796         __m512i a = _mm512_loadu_si512(0);
7797         return 0;
7798     }
7799     ])],
7800     [can_compile_avx512=yes],
7801     [can_compile_avx512=no])
7802 AC_LANG_POP([C++])
7803 CXXFLAGS=$save_CXXFLAGS
7804 AC_MSG_RESULT([${can_compile_avx512}])
7805 if test "${can_compile_avx512}" = "yes" ; then
7806     CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
7807     CXXFLAGS_INTRINSICS_AVX512F="$flag_avx512f"
7810 AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
7811 AC_LANG_PUSH([C++])
7812 save_CXXFLAGS=$CXXFLAGS
7813 CXXFLAGS="$CXXFLAGS $flag_f16c"
7814 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7815     #include <immintrin.h>
7816     int main () {
7817         __m128i a = _mm_set1_epi32 (0);
7818         __m128 c;
7819         c = _mm_cvtph_ps(a);
7820         return 0;
7821     }
7822     ])],
7823     [can_compile_f16c=yes],
7824     [can_compile_f16c=no])
7825 AC_LANG_POP([C++])
7826 CXXFLAGS=$save_CXXFLAGS
7827 AC_MSG_RESULT([${can_compile_f16c}])
7828 if test "${can_compile_f16c}" = "yes" ; then
7829     CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
7832 AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
7833 AC_LANG_PUSH([C++])
7834 save_CXXFLAGS=$CXXFLAGS
7835 CXXFLAGS="$CXXFLAGS $flag_fma"
7836 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7837     #include <immintrin.h>
7838     int main () {
7839         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
7840         d = _mm256_fmadd_ps(a, b, c);
7841         return 0;
7842     }
7843     ])],
7844     [can_compile_fma=yes],
7845     [can_compile_fma=no])
7846 AC_LANG_POP([C++])
7847 CXXFLAGS=$save_CXXFLAGS
7848 AC_MSG_RESULT([${can_compile_fma}])
7849 if test "${can_compile_fma}" = "yes" ; then
7850     CXXFLAGS_INTRINSICS_FMA="$flag_fma"
7853 AC_SUBST([CXXFLAGS_INTRINSICS_SSE2])
7854 AC_SUBST([CXXFLAGS_INTRINSICS_SSSE3])
7855 AC_SUBST([CXXFLAGS_INTRINSICS_SSE41])
7856 AC_SUBST([CXXFLAGS_INTRINSICS_SSE42])
7857 AC_SUBST([CXXFLAGS_INTRINSICS_AVX])
7858 AC_SUBST([CXXFLAGS_INTRINSICS_AVX2])
7859 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512])
7860 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512F])
7861 AC_SUBST([CXXFLAGS_INTRINSICS_F16C])
7862 AC_SUBST([CXXFLAGS_INTRINSICS_FMA])
7864 dnl ===================================================================
7865 dnl system stl sanity tests
7866 dnl ===================================================================
7867 if test "$_os" != "WINNT"; then
7869     AC_LANG_PUSH([C++])
7871     save_CPPFLAGS="$CPPFLAGS"
7872     if test -n "$MACOSX_SDK_PATH"; then
7873         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
7874     fi
7876     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
7877     # only.
7878     if test "$CPP_LIBRARY" = GLIBCXX; then
7879         dnl gcc#19664, gcc#22482, rhbz#162935
7880         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
7881         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
7882         AC_MSG_RESULT([$stlvisok])
7883         if test "$stlvisok" = "no"; then
7884             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
7885         fi
7886     fi
7888     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
7889     # when we don't make any dynamic libraries?
7890     if test "$DISABLE_DYNLOADING" = ""; then
7891         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
7892         cat > conftestlib1.cc <<_ACEOF
7893 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7894 struct S2: S1<int> { virtual ~S2(); };
7895 S2::~S2() {}
7896 _ACEOF
7897         cat > conftestlib2.cc <<_ACEOF
7898 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7899 struct S2: S1<int> { virtual ~S2(); };
7900 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
7901 _ACEOF
7902         gccvisinlineshiddenok=yes
7903         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
7904             gccvisinlineshiddenok=no
7905         else
7906             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
7907             dnl known to not work with -z defs (unsetting which makes the test
7908             dnl moot, though):
7909             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
7910             if test "$COM_IS_CLANG" = TRUE; then
7911                 for i in $CXX $CXXFLAGS; do
7912                     case $i in
7913                     -fsanitize=*)
7914                         my_linkflagsnoundefs=
7915                         break
7916                         ;;
7917                     esac
7918                 done
7919             fi
7920             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
7921                 gccvisinlineshiddenok=no
7922             fi
7923         fi
7925         rm -fr libconftest*
7926         AC_MSG_RESULT([$gccvisinlineshiddenok])
7927         if test "$gccvisinlineshiddenok" = "no"; then
7928             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
7929         fi
7930     fi
7932    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
7933     cat >visibility.cxx <<_ACEOF
7934 #pragma GCC visibility push(hidden)
7935 struct __attribute__ ((visibility ("default"))) TestStruct {
7936   static void Init();
7938 __attribute__ ((visibility ("default"))) void TestFunc() {
7939   TestStruct::Init();
7941 _ACEOF
7942     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
7943         gccvisbroken=yes
7944     else
7945         case "$host_cpu" in
7946         i?86|x86_64)
7947             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
7948                 gccvisbroken=no
7949             else
7950                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
7951                     gccvisbroken=no
7952                 else
7953                     gccvisbroken=yes
7954                 fi
7955             fi
7956             ;;
7957         *)
7958             gccvisbroken=no
7959             ;;
7960         esac
7961     fi
7962     rm -f visibility.s visibility.cxx
7964     AC_MSG_RESULT([$gccvisbroken])
7965     if test "$gccvisbroken" = "yes"; then
7966         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
7967     fi
7969     CPPFLAGS="$save_CPPFLAGS"
7971     AC_LANG_POP([C++])
7974 dnl ===================================================================
7975 dnl  Clang++ tests
7976 dnl ===================================================================
7978 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
7979 if test "$GCC" = "yes"; then
7980     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
7981     AC_LANG_PUSH([C++])
7982     save_CXXFLAGS=$CXXFLAGS
7983     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
7984     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
7985     CXXFLAGS=$save_CXXFLAGS
7986     AC_LANG_POP([C++])
7987     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
7988         AC_MSG_RESULT([yes])
7989     else
7990         AC_MSG_RESULT([no])
7991     fi
7993 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
7995 dnl ===================================================================
7996 dnl Compiler plugins
7997 dnl ===================================================================
7999 COMPILER_PLUGINS=
8000 # currently only Clang
8002 if test "$COM_IS_CLANG" != "TRUE"; then
8003     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
8004         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
8005         enable_compiler_plugins=no
8006     fi
8009 COMPILER_PLUGINS_COM_IS_CLANG=
8010 if test "$COM_IS_CLANG" = "TRUE"; then
8011     if test -n "$enable_compiler_plugins"; then
8012         compiler_plugins="$enable_compiler_plugins"
8013     elif test -n "$ENABLE_DBGUTIL"; then
8014         compiler_plugins=test
8015     else
8016         compiler_plugins=no
8017     fi
8018     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
8019         if test "$CLANGVER" -lt 50002; then
8020             if test "$compiler_plugins" = yes; then
8021                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
8022             else
8023                 compiler_plugins=no
8024             fi
8025         fi
8026     fi
8027     if test "$compiler_plugins" != "no"; then
8028         dnl The prefix where Clang resides, override to where Clang resides if
8029         dnl using a source build:
8030         if test -z "$CLANGDIR"; then
8031             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $(printf '%s\n' $CXX | grep clang | head -n 1)))))
8032         fi
8033         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
8034         if test -z "$COMPILER_PLUGINS_CXX"; then
8035             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
8036         fi
8037         clangbindir=$CLANGDIR/bin
8038         if test "$build_os" = "cygwin"; then
8039             clangbindir=$(cygpath -u "$clangbindir")
8040         fi
8041         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
8042         if test -n "$LLVM_CONFIG"; then
8043             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
8044             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
8045             if test -z "$CLANGLIBDIR"; then
8046                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
8047             fi
8048             # Try if clang is built from source (in which case its includes are not together with llvm includes).
8049             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
8050             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
8051             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
8052                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
8053             fi
8054             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
8055             clangobjdir=$($LLVM_CONFIG --obj-root)
8056             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
8057                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
8058             fi
8059         fi
8060         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
8061         AC_LANG_PUSH([C++])
8062         save_CXX=$CXX
8063         save_CXXCPP=$CXXCPP
8064         save_CPPFLAGS=$CPPFLAGS
8065         save_CXXFLAGS=$CXXFLAGS
8066         save_LDFLAGS=$LDFLAGS
8067         save_LIBS=$LIBS
8068         CXX=$COMPILER_PLUGINS_CXX
8069         CXXCPP="$COMPILER_PLUGINS_CXX -E"
8070         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
8071         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
8072         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
8073             [COMPILER_PLUGINS=TRUE],
8074             [
8075             if test "$compiler_plugins" = "yes"; then
8076                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
8077             else
8078                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
8079                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
8080             fi
8081             ])
8082         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
8083         dnl comment in compilerplugins/Makefile-clang.mk:
8084         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
8085             LDFLAGS=""
8086             AC_MSG_CHECKING([for clang libraries to use])
8087             if test -z "$CLANGTOOLLIBS"; then
8088                 LIBS="-lclangTooling -lclangFrontend -lclangDriver -lclangParse -lclangSema -lclangEdit \
8089  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
8090                 AC_LINK_IFELSE([
8091                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8092                         [[ clang::FullSourceLoc().dump(); ]])
8093                 ],[CLANGTOOLLIBS="$LIBS"],[])
8094             fi
8095             if test -z "$CLANGTOOLLIBS"; then
8096                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
8097                 AC_LINK_IFELSE([
8098                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8099                         [[ clang::FullSourceLoc().dump(); ]])
8100                 ],[CLANGTOOLLIBS="$LIBS"],[])
8101             fi
8102             AC_MSG_RESULT([$CLANGTOOLLIBS])
8103             if test -z "$CLANGTOOLLIBS"; then
8104                 if test "$compiler_plugins" = "yes"; then
8105                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
8106                 else
8107                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
8108                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
8109                 fi
8110                 COMPILER_PLUGINS=
8111             fi
8112             if test -n "$COMPILER_PLUGINS"; then
8113                 if test -z "$CLANGSYSINCLUDE"; then
8114                     if test -n "$LLVM_CONFIG"; then
8115                         # Path to the clang system headers (no idea if there's a better way to get it).
8116                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/git\|svn//')/include
8117                     fi
8118                 fi
8119             fi
8120         fi
8121         CXX=$save_CXX
8122         CXXCPP=$save_CXXCPP
8123         CPPFLAGS=$save_CPPFLAGS
8124         CXXFLAGS=$save_CXXFLAGS
8125         LDFLAGS=$save_LDFLAGS
8126         LIBS="$save_LIBS"
8127         AC_LANG_POP([C++])
8129         AC_MSG_CHECKING([whether the compiler for building compilerplugins is actually Clang])
8130         AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
8131             #ifndef __clang__
8132             you lose
8133             #endif
8134             int foo=42;
8135             ]])],
8136             [AC_MSG_RESULT([yes])
8137              COMPILER_PLUGINS_COM_IS_CLANG=TRUE],
8138             [AC_MSG_RESULT([no])])
8139         AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8140     fi
8141 else
8142     if test "$enable_compiler_plugins" = "yes"; then
8143         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
8144     fi
8146 COMPILER_PLUGINS_ANALYZER_PCH=
8147 if test "$enable_compiler_plugins_analyzer_pch" != no; then
8148     COMPILER_PLUGINS_ANALYZER_PCH=TRUE
8150 AC_SUBST(COMPILER_PLUGINS)
8151 AC_SUBST(COMPILER_PLUGINS_ANALYZER_PCH)
8152 AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8153 AC_SUBST(COMPILER_PLUGINS_CXX)
8154 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
8155 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
8156 AC_SUBST(COMPILER_PLUGINS_DEBUG)
8157 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
8158 AC_SUBST(CLANGDIR)
8159 AC_SUBST(CLANGLIBDIR)
8160 AC_SUBST(CLANGTOOLLIBS)
8161 AC_SUBST(CLANGSYSINCLUDE)
8163 # Plugin to help linker.
8164 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
8165 # This makes --enable-lto build with clang work.
8166 AC_SUBST(LD_PLUGIN)
8168 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
8169 AC_SUBST(HAVE_POSIX_FALLOCATE)
8171 JITC_PROCESSOR_TYPE=""
8172 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
8173     # IBMs JDK needs this...
8174     JITC_PROCESSOR_TYPE=6
8175     export JITC_PROCESSOR_TYPE
8177 AC_SUBST([JITC_PROCESSOR_TYPE])
8179 # Misc Windows Stuff
8180 AC_ARG_WITH(ucrt-dir,
8181     AS_HELP_STRING([--with-ucrt-dir],
8182         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
8183         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
8184         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
8185             Windows6.1-KB2999226-x64.msu
8186             Windows6.1-KB2999226-x86.msu
8187             Windows8.1-KB2999226-x64.msu
8188             Windows8.1-KB2999226-x86.msu
8189             Windows8-RT-KB2999226-x64.msu
8190             Windows8-RT-KB2999226-x86.msu
8191         A zip archive including those files is available from Microsoft site:
8192         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
8195 UCRT_REDISTDIR="$with_ucrt_dir"
8196 if test $_os = "WINNT"; then
8197     find_msvc_x64_dlls
8198     for i in $PKGFORMAT; do
8199         if test "$i" = msi; then
8200             find_msms
8201             break
8202         fi
8203     done
8204     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
8205     MSVC_DLLS="$msvcdlls"
8206     test -n "$msmdir" && MSM_PATH=`win_short_path_for_make "$msmdir"`
8207     # MSVC 15.3 changed it to VC141
8208     if echo "$msvcdllpath" | grep -q "VC142.CRT$"; then
8209         SCPDEFS="$SCPDEFS -DWITH_VC142_REDIST"
8210     elif echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
8211         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
8212     else
8213         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
8214     fi
8216     if test "$UCRT_REDISTDIR" = "no"; then
8217         dnl explicitly disabled
8218         UCRT_REDISTDIR=""
8219     else
8220         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
8221                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
8222                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
8223                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
8224                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
8225                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
8226             UCRT_REDISTDIR=""
8227             if test -n "$PKGFORMAT"; then
8228                for i in $PKGFORMAT; do
8229                    case "$i" in
8230                    msi)
8231                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
8232                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
8233                        ;;
8234                    esac
8235                done
8236             fi
8237         fi
8238     fi
8241 AC_SUBST(UCRT_REDISTDIR)
8242 AC_SUBST(MSVC_DLL_PATH)
8243 AC_SUBST(MSVC_DLLS)
8244 AC_SUBST(MSM_PATH)
8247 dnl ===================================================================
8248 dnl Checks for Java
8249 dnl ===================================================================
8250 if test "$ENABLE_JAVA" != ""; then
8252     # Windows-specific tests
8253     if test "$build_os" = "cygwin"; then
8254         if test -z "$with_jdk_home"; then
8255             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
8256             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
8257             reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
8258             if test -n "$regvalue"; then
8259                 ver=$regvalue
8260                 reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
8261                 with_jdk_home=$regvalue
8262             fi
8263             howfound="found automatically"
8264         else
8265             with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
8266             howfound="you passed"
8267         fi
8269         if ! test -f "$with_jdk_home/lib/jvm.lib" -a -f "$with_jdk_home/bin/java.exe"; then
8270             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])
8271         fi
8272     fi
8274     # 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.
8275     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
8276     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
8277         with_jdk_home=`/usr/libexec/java_home`
8278     fi
8280     JAVA_HOME=; export JAVA_HOME
8281     if test -z "$with_jdk_home"; then
8282         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
8283     else
8284         _java_path="$with_jdk_home/bin/$with_java"
8285         dnl Check if there is a Java interpreter at all.
8286         if test -x "$_java_path"; then
8287             JAVAINTERPRETER=$_java_path
8288         else
8289             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
8290         fi
8291     fi
8293     dnl Check that the JDK found is correct architecture (at least 2 reasons to
8294     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
8295     dnl loaded by java to run JunitTests:
8296     if test "$build_os" = "cygwin" -a "$cross_compiling" != "yes"; then
8297         shortjdkhome=`cygpath -d "$with_jdk_home"`
8298         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
8299             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
8300             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8301         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
8302             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8303             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8304         fi
8306         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
8307             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
8308         fi
8309         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
8310     elif test "$cross_compiling" != "yes"; then
8311         case $CPUNAME in
8312             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
8313                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
8314                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
8315                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8316                 fi
8317                 ;;
8318             *) # assumption: everything else 32-bit
8319                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
8320                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8321                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8322                 fi
8323                 ;;
8324         esac
8325     fi
8328 dnl ===================================================================
8329 dnl Checks for JDK.
8330 dnl ===================================================================
8332 # Whether all the complexity here actually is needed any more or not, no idea.
8334 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8335     _gij_longver=0
8336     AC_MSG_CHECKING([the installed JDK])
8337     if test -n "$JAVAINTERPRETER"; then
8338         dnl java -version sends output to stderr!
8339         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
8340             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8341         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
8342             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8343         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
8344             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8345         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
8346             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8347         else
8348             JDK=sun
8350             dnl Sun JDK specific tests
8351             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
8352             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
8354             if test "$_jdk_ver" -lt 10900; then
8355                 AC_MSG_ERROR([JDK is too old, you need at least 9 ($_jdk_ver < 10900)])
8356             fi
8357             if test "$_jdk_ver" -gt 10900; then
8358                 JAVA_CLASSPATH_NOT_SET=TRUE
8359             fi
8361             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
8362             if test "$_os" = "WINNT"; then
8363                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
8364             fi
8365             AC_MSG_RESULT([found $JAVA_HOME (JDK $_jdk)])
8367             # set to limit VM usage for JunitTests
8368             JAVAIFLAGS=-Xmx64M
8369             # set to limit VM usage for javac
8370             JAVACFLAGS=-J-Xmx128M
8371         fi
8372     else
8373         AC_MSG_ERROR([Java not found. You need at least JDK 9])
8374     fi
8375 else
8376     if test -z "$ENABLE_JAVA"; then
8377         dnl Java disabled
8378         JAVA_HOME=
8379         export JAVA_HOME
8380     elif test "$cross_compiling" = "yes"; then
8381         # Just assume compatibility of build and host JDK
8382         JDK=$JDK_FOR_BUILD
8383         JAVAIFLAGS=$JAVAIFLAGS_FOR_BUILD
8384     fi
8387 dnl ===================================================================
8388 dnl Checks for javac
8389 dnl ===================================================================
8390 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8391     javacompiler="javac"
8392     : ${JAVA_SOURCE_VER=8}
8393     : ${JAVA_TARGET_VER=8}
8394     if test -z "$with_jdk_home"; then
8395         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
8396     else
8397         _javac_path="$with_jdk_home/bin/$javacompiler"
8398         dnl Check if there is a Java compiler at all.
8399         if test -x "$_javac_path"; then
8400             JAVACOMPILER=$_javac_path
8401         fi
8402     fi
8403     if test -z "$JAVACOMPILER"; then
8404         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
8405     fi
8406     if test "$build_os" = "cygwin"; then
8407         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
8408             JAVACOMPILER="${JAVACOMPILER}.exe"
8409         fi
8410         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
8411     fi
8414 dnl ===================================================================
8415 dnl Checks for javadoc
8416 dnl ===================================================================
8417 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8418     if test -z "$with_jdk_home"; then
8419         AC_PATH_PROG(JAVADOC, javadoc)
8420     else
8421         _javadoc_path="$with_jdk_home/bin/javadoc"
8422         dnl Check if there is a javadoc at all.
8423         if test -x "$_javadoc_path"; then
8424             JAVADOC=$_javadoc_path
8425         else
8426             AC_PATH_PROG(JAVADOC, javadoc)
8427         fi
8428     fi
8429     if test -z "$JAVADOC"; then
8430         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
8431     fi
8432     if test "$build_os" = "cygwin"; then
8433         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
8434             JAVADOC="${JAVADOC}.exe"
8435         fi
8436         JAVADOC=`win_short_path_for_make "$JAVADOC"`
8437     fi
8439     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
8440     JAVADOCISGJDOC="yes"
8441     fi
8443 AC_SUBST(JAVADOC)
8444 AC_SUBST(JAVADOCISGJDOC)
8446 if test "$ENABLE_JAVA" != "" -a \( "$cross_compiling" != "yes" -o -n "$with_jdk_home" \); then
8447     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
8448     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
8449         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
8450            # try to recover first by looking whether we have an alternative
8451            # system as in Debian or newer SuSEs where following /usr/bin/javac
8452            # over /etc/alternatives/javac leads to the right bindir where we
8453            # just need to strip a bit away to get a valid JAVA_HOME
8454            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
8455         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
8456             # maybe only one level of symlink (e.g. on Mac)
8457             JAVA_HOME=$(readlink $JAVACOMPILER)
8458             if test "$(dirname $JAVA_HOME)" = "."; then
8459                 # we've got no path to trim back
8460                 JAVA_HOME=""
8461             fi
8462         else
8463             # else warn
8464             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
8465             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
8466             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
8467             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
8468         fi
8469         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
8470         if test "$JAVA_HOME" != "/usr"; then
8471             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8472                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
8473                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
8474                 dnl Tiger already returns a JDK path...
8475                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
8476             else
8477                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
8478                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
8479                 dnl that checks which version to run
8480                 if test -f "$JAVA_HOME"; then
8481                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
8482                 fi
8483             fi
8484         fi
8485     fi
8486     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
8488     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
8489     if test -z "$JAVA_HOME"; then
8490         if test "x$with_jdk_home" = "x"; then
8491             cat > findhome.java <<_ACEOF
8492 [import java.io.File;
8494 class findhome
8496     public static void main(String args[])
8497     {
8498         String jrelocation = System.getProperty("java.home");
8499         File jre = new File(jrelocation);
8500         System.out.println(jre.getParent());
8501     }
8503 _ACEOF
8504             AC_MSG_CHECKING([if javac works])
8505             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
8506             AC_TRY_EVAL(javac_cmd)
8507             if test $? = 0 -a -f ./findhome.class; then
8508                 AC_MSG_RESULT([javac works])
8509             else
8510                 echo "configure: javac test failed" >&5
8511                 cat findhome.java >&5
8512                 AC_MSG_ERROR([javac does not work - java projects will not build!])
8513             fi
8514             AC_MSG_CHECKING([if gij knows its java.home])
8515             JAVA_HOME=`$JAVAINTERPRETER findhome`
8516             if test $? = 0 -a "$JAVA_HOME" != ""; then
8517                 AC_MSG_RESULT([$JAVA_HOME])
8518             else
8519                 echo "configure: java test failed" >&5
8520                 cat findhome.java >&5
8521                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
8522             fi
8523             # clean-up after ourselves
8524             rm -f ./findhome.java ./findhome.class
8525         else
8526             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
8527         fi
8528     fi
8530     # now check if $JAVA_HOME is really valid
8531     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8532         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
8533             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
8534             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
8535             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
8536             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
8537             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
8538             add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
8539         fi
8540     fi
8541     PathFormat "$JAVA_HOME"
8542     JAVA_HOME="$formatted_path"
8545 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
8546     "$_os" != Darwin
8547 then
8548     AC_MSG_CHECKING([for JAWT lib])
8549     if test "$_os" = WINNT; then
8550         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
8551         JAWTLIB=jawt.lib
8552     else
8553         case "$host_cpu" in
8554         arm*)
8555             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
8556             JAVA_ARCH=$my_java_arch
8557             ;;
8558         i*86)
8559             my_java_arch=i386
8560             ;;
8561         m68k)
8562             my_java_arch=m68k
8563             ;;
8564         powerpc)
8565             my_java_arch=ppc
8566             ;;
8567         powerpc64)
8568             my_java_arch=ppc64
8569             ;;
8570         powerpc64le)
8571             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
8572             JAVA_ARCH=$my_java_arch
8573             ;;
8574         sparc64)
8575             my_java_arch=sparcv9
8576             ;;
8577         x86_64)
8578             my_java_arch=amd64
8579             ;;
8580         *)
8581             my_java_arch=$host_cpu
8582             ;;
8583         esac
8584         # This is where JDK9 puts the library
8585         if test -e "$JAVA_HOME/lib/libjawt.so"; then
8586             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
8587         else
8588             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
8589         fi
8590         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
8591     fi
8592     AC_MSG_RESULT([$JAWTLIB])
8594 AC_SUBST(JAWTLIB)
8596 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
8597     case "$host_os" in
8599     aix*)
8600         JAVAINC="-I$JAVA_HOME/include"
8601         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
8602         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8603         ;;
8605     cygwin*|wsl*)
8606         JAVAINC="-I$JAVA_HOME/include/win32"
8607         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
8608         ;;
8610     darwin*|macos*)
8611         if test -d "$JAVA_HOME/include/darwin"; then
8612             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
8613         else
8614             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
8615         fi
8616         ;;
8618     dragonfly*)
8619         JAVAINC="-I$JAVA_HOME/include"
8620         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8621         ;;
8623     freebsd*)
8624         JAVAINC="-I$JAVA_HOME/include"
8625         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
8626         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
8627         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8628         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8629         ;;
8631     k*bsd*-gnu*)
8632         JAVAINC="-I$JAVA_HOME/include"
8633         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8634         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8635         ;;
8637     linux-gnu*)
8638         JAVAINC="-I$JAVA_HOME/include"
8639         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8640         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8641         ;;
8643     *netbsd*)
8644         JAVAINC="-I$JAVA_HOME/include"
8645         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
8646         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8647        ;;
8649     openbsd*)
8650         JAVAINC="-I$JAVA_HOME/include"
8651         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
8652         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8653         ;;
8655     solaris*)
8656         JAVAINC="-I$JAVA_HOME/include"
8657         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
8658         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8659         ;;
8660     esac
8662 SOLARINC="$SOLARINC $JAVAINC"
8664 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8665     JAVA_HOME_FOR_BUILD=$JAVA_HOME
8666     JAVAIFLAGS_FOR_BUILD=$JAVAIFLAGS
8667     JDK_FOR_BUILD=$JDK
8670 AC_SUBST(JAVACFLAGS)
8671 AC_SUBST(JAVACOMPILER)
8672 AC_SUBST(JAVAINTERPRETER)
8673 AC_SUBST(JAVAIFLAGS)
8674 AC_SUBST(JAVAIFLAGS_FOR_BUILD)
8675 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
8676 AC_SUBST(JAVA_HOME)
8677 AC_SUBST(JAVA_HOME_FOR_BUILD)
8678 AC_SUBST(JDK)
8679 AC_SUBST(JDK_FOR_BUILD)
8680 AC_SUBST(JAVA_SOURCE_VER)
8681 AC_SUBST(JAVA_TARGET_VER)
8684 dnl ===================================================================
8685 dnl Export file validation
8686 dnl ===================================================================
8687 AC_MSG_CHECKING([whether to enable export file validation])
8688 if test "$with_export_validation" != "no"; then
8689     if test -z "$ENABLE_JAVA"; then
8690         if test "$with_export_validation" = "yes"; then
8691             AC_MSG_ERROR([requested, but Java is disabled])
8692         else
8693             AC_MSG_RESULT([no, as Java is disabled])
8694         fi
8695     elif ! test -d "${SRC_ROOT}/schema"; then
8696         if test "$with_export_validation" = "yes"; then
8697             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
8698         else
8699             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
8700         fi
8701     else
8702         AC_MSG_RESULT([yes])
8703         AC_DEFINE(HAVE_EXPORT_VALIDATION)
8705         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
8706         if test -z "$ODFVALIDATOR"; then
8707             # remember to download the ODF toolkit with validator later
8708             AC_MSG_NOTICE([no odfvalidator found, will download it])
8709             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
8710             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
8712             # and fetch name of odfvalidator jar name from download.lst
8713             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
8714             AC_SUBST(ODFVALIDATOR_JAR)
8716             if test -z "$ODFVALIDATOR_JAR"; then
8717                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
8718             fi
8719         fi
8720         if test "$build_os" = "cygwin"; then
8721             # In case of Cygwin it will be executed from Windows,
8722             # so we need to run bash and absolute path to validator
8723             # so instead of "odfvalidator" it will be
8724             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
8725             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
8726         else
8727             ODFVALIDATOR="sh $ODFVALIDATOR"
8728         fi
8729         AC_SUBST(ODFVALIDATOR)
8732         AC_PATH_PROGS(OFFICEOTRON, officeotron)
8733         if test -z "$OFFICEOTRON"; then
8734             # remember to download the officeotron with validator later
8735             AC_MSG_NOTICE([no officeotron found, will download it])
8736             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
8737             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
8739             # and fetch name of officeotron jar name from download.lst
8740             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
8741             AC_SUBST(OFFICEOTRON_JAR)
8743             if test -z "$OFFICEOTRON_JAR"; then
8744                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
8745             fi
8746         else
8747             # check version of existing officeotron
8748             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
8749             if test 0"$OFFICEOTRON_VER" -lt 704; then
8750                 AC_MSG_ERROR([officeotron too old])
8751             fi
8752         fi
8753         if test "$build_os" = "cygwin"; then
8754             # In case of Cygwin it will be executed from Windows,
8755             # so we need to run bash and absolute path to validator
8756             # so instead of "odfvalidator" it will be
8757             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
8758             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
8759         else
8760             OFFICEOTRON="sh $OFFICEOTRON"
8761         fi
8762     fi
8763     AC_SUBST(OFFICEOTRON)
8764 else
8765     AC_MSG_RESULT([no])
8768 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
8769 if test "$with_bffvalidator" != "no"; then
8770     AC_DEFINE(HAVE_BFFVALIDATOR)
8772     if test "$with_export_validation" = "no"; then
8773         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
8774     fi
8776     if test "$with_bffvalidator" = "yes"; then
8777         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
8778     else
8779         BFFVALIDATOR="$with_bffvalidator"
8780     fi
8782     if test "$build_os" = "cygwin"; then
8783         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
8784             AC_MSG_RESULT($BFFVALIDATOR)
8785         else
8786             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8787         fi
8788     elif test -n "$BFFVALIDATOR"; then
8789         # We are not in Cygwin but need to run Windows binary with wine
8790         AC_PATH_PROGS(WINE, wine)
8792         # so swap in a shell wrapper that converts paths transparently
8793         BFFVALIDATOR_EXE="$BFFVALIDATOR"
8794         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
8795         AC_SUBST(BFFVALIDATOR_EXE)
8796         AC_MSG_RESULT($BFFVALIDATOR)
8797     else
8798         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8799     fi
8800     AC_SUBST(BFFVALIDATOR)
8801 else
8802     AC_MSG_RESULT([no])
8805 dnl ===================================================================
8806 dnl Check for C preprocessor to use
8807 dnl ===================================================================
8808 AC_MSG_CHECKING([which C preprocessor to use in idlc])
8809 SYSTEM_UCPP_IS_GCC=
8810 if test -n "$with_idlc_cpp"; then
8811     AC_MSG_RESULT([$with_idlc_cpp])
8812     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
8813     AC_MSG_CHECKING([if $with_idlc_cpp is GCC CPP])
8814     # ucpp will accept -v (to output version), warn about the others as unknown
8815     # and return 1 (due to -v)
8816     # gcc will accept -v (as verbose), --version (to output version) and -nostdinc
8817     # and return 0 (due to --version ) if all options are supported
8818     $SYSTEM_UCPP -v --version -nostdinc >/dev/null 2>/dev/null
8819     if test $? -eq 0;  then
8820         SYSTEM_UCPP_IS_GCC=TRUE
8821         AC_MSG_RESULT([yes])
8822     else
8823         AC_MSG_RESULT([no])
8824     fi
8825 else
8826     AC_MSG_RESULT([ucpp])
8827     AC_MSG_CHECKING([which ucpp to use])
8828     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
8829         AC_MSG_RESULT([external])
8830         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
8831     else
8832         AC_MSG_RESULT([internal])
8833         BUILD_TYPE="$BUILD_TYPE UCPP"
8834     fi
8836 AC_SUBST(SYSTEM_UCPP)
8837 AC_SUBST(SYSTEM_UCPP_IS_GCC)
8839 dnl ===================================================================
8840 dnl Check for epm (not needed for Windows)
8841 dnl ===================================================================
8842 AC_MSG_CHECKING([whether to enable EPM for packing])
8843 if test "$enable_epm" = "yes"; then
8844     AC_MSG_RESULT([yes])
8845     if test "$_os" != "WINNT"; then
8846         if test $_os = Darwin; then
8847             EPM=internal
8848         elif test -n "$with_epm"; then
8849             EPM=$with_epm
8850         else
8851             AC_PATH_PROG(EPM, epm, no)
8852         fi
8853         if test "$EPM" = "no" -o "$EPM" = "internal"; then
8854             AC_MSG_NOTICE([EPM will be built.])
8855             BUILD_TYPE="$BUILD_TYPE EPM"
8856             EPM=${WORKDIR}/UnpackedTarball/epm/epm
8857         else
8858             # Gentoo has some epm which is something different...
8859             AC_MSG_CHECKING([whether the found epm is the right epm])
8860             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
8861                 AC_MSG_RESULT([yes])
8862             else
8863                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8864             fi
8865             AC_MSG_CHECKING([epm version])
8866             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
8867             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
8868                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
8869                 AC_MSG_RESULT([OK, >= 3.7])
8870             else
8871                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
8872                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8873             fi
8874         fi
8875     fi
8877     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
8878         AC_MSG_CHECKING([for rpm])
8879         for a in "$RPM" rpmbuild rpm; do
8880             $a --usage >/dev/null 2> /dev/null
8881             if test $? -eq 0; then
8882                 RPM=$a
8883                 break
8884             else
8885                 $a --version >/dev/null 2> /dev/null
8886                 if test $? -eq 0; then
8887                     RPM=$a
8888                     break
8889                 fi
8890             fi
8891         done
8892         if test -z "$RPM"; then
8893             AC_MSG_ERROR([not found])
8894         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
8895             RPM_PATH=`which $RPM`
8896             AC_MSG_RESULT([$RPM_PATH])
8897             SCPDEFS="$SCPDEFS -DWITH_RPM"
8898         else
8899             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
8900         fi
8901     fi
8902     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
8903         AC_PATH_PROG(DPKG, dpkg, no)
8904         if test "$DPKG" = "no"; then
8905             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
8906         fi
8907     fi
8908     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
8909        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8910         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
8911             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
8912                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
8913                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
8914                     AC_MSG_RESULT([yes])
8915                 else
8916                     AC_MSG_RESULT([no])
8917                     if echo "$PKGFORMAT" | $GREP -q rpm; then
8918                         _pt="rpm"
8919                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
8920                         add_warning "the rpms will need to be installed with --nodeps"
8921                     else
8922                         _pt="pkg"
8923                     fi
8924                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
8925                     add_warning "the ${_pt}s will not be relocatable"
8926                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
8927                                  relocation will work, you need to patch your epm with the
8928                                  patch in epm/epm-3.7.patch or build with
8929                                  --with-epm=internal which will build a suitable epm])
8930                 fi
8931             fi
8932         fi
8933     fi
8934     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8935         AC_PATH_PROG(PKGMK, pkgmk, no)
8936         if test "$PKGMK" = "no"; then
8937             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
8938         fi
8939     fi
8940     AC_SUBST(RPM)
8941     AC_SUBST(DPKG)
8942     AC_SUBST(PKGMK)
8943 else
8944     for i in $PKGFORMAT; do
8945         case "$i" in
8946         aix | bsd | deb | pkg | rpm | native | portable)
8947             AC_MSG_ERROR(
8948                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
8949             ;;
8950         esac
8951     done
8952     AC_MSG_RESULT([no])
8953     EPM=NO
8955 AC_SUBST(EPM)
8957 ENABLE_LWP=
8958 if test "$enable_lotuswordpro" = "yes"; then
8959     ENABLE_LWP="TRUE"
8961 AC_SUBST(ENABLE_LWP)
8963 dnl ===================================================================
8964 dnl Check for building ODK
8965 dnl ===================================================================
8966 if test "$enable_odk" != yes; then
8967     unset DOXYGEN
8968 else
8969     if test "$with_doxygen" = no; then
8970         AC_MSG_CHECKING([for doxygen])
8971         unset DOXYGEN
8972         AC_MSG_RESULT([no])
8973     else
8974         if test "$with_doxygen" = yes; then
8975             AC_PATH_PROG([DOXYGEN], [doxygen])
8976             if test -z "$DOXYGEN"; then
8977                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
8978             fi
8979             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
8980                 if ! dot -V 2>/dev/null; then
8981                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
8982                 fi
8983             fi
8984         else
8985             AC_MSG_CHECKING([for doxygen])
8986             DOXYGEN=$with_doxygen
8987             AC_MSG_RESULT([$DOXYGEN])
8988         fi
8989         if test -n "$DOXYGEN"; then
8990             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
8991             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
8992             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
8993                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
8994             fi
8995         fi
8996     fi
8998 AC_SUBST([DOXYGEN])
9000 AC_MSG_CHECKING([whether to build the ODK])
9001 if test "$enable_odk" = yes; then
9002     AC_MSG_RESULT([yes])
9003     BUILD_TYPE="$BUILD_TYPE ODK"
9004 else
9005     AC_MSG_RESULT([no])
9008 dnl ===================================================================
9009 dnl Check for system zlib
9010 dnl ===================================================================
9011 if test "$with_system_zlib" = "auto"; then
9012     case "$_os" in
9013     WINNT)
9014         with_system_zlib="$with_system_libs"
9015         ;;
9016     *)
9017         if test "$enable_fuzzers" != "yes"; then
9018             with_system_zlib=yes
9019         else
9020             with_system_zlib=no
9021         fi
9022         ;;
9023     esac
9026 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
9027 dnl and has no pkg-config for it at least on some tinderboxes,
9028 dnl so leaving that out for now
9029 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
9030 AC_MSG_CHECKING([which zlib to use])
9031 if test "$with_system_zlib" = "yes"; then
9032     AC_MSG_RESULT([external])
9033     SYSTEM_ZLIB=TRUE
9034     AC_CHECK_HEADER(zlib.h, [],
9035         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
9036     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
9037         [AC_MSG_ERROR(zlib not found or functional)], [])
9038 else
9039     AC_MSG_RESULT([internal])
9040     SYSTEM_ZLIB=
9041     BUILD_TYPE="$BUILD_TYPE ZLIB"
9042     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
9043     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
9045 AC_SUBST(ZLIB_CFLAGS)
9046 AC_SUBST(ZLIB_LIBS)
9047 AC_SUBST(SYSTEM_ZLIB)
9049 dnl ===================================================================
9050 dnl Check for system jpeg
9051 dnl ===================================================================
9052 AC_MSG_CHECKING([which libjpeg to use])
9053 if test "$with_system_jpeg" = "yes"; then
9054     AC_MSG_RESULT([external])
9055     SYSTEM_LIBJPEG=TRUE
9056     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
9057         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
9058     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
9059         [AC_MSG_ERROR(jpeg library not found or functional)], [])
9060 else
9061     SYSTEM_LIBJPEG=
9062     AC_MSG_RESULT([internal, libjpeg-turbo])
9063     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
9064     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
9065     if test "$COM" = "MSC"; then
9066         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
9067     else
9068         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
9069     fi
9071     case "$host_cpu" in
9072     x86_64 | amd64 | i*86 | x86 | ia32)
9073         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
9074         if test -z "$NASM" -a "$build_os" = "cygwin"; then
9075             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
9076                 NASM="$LODE_HOME/opt/bin/nasm"
9077             elif test -x "/opt/lo/bin/nasm"; then
9078                 NASM="/opt/lo/bin/nasm"
9079             fi
9080         fi
9082         if test -n "$NASM"; then
9083             AC_MSG_CHECKING([for object file format of host system])
9084             case "$host_os" in
9085               cygwin* | mingw* | pw32* | wsl*)
9086                 case "$host_cpu" in
9087                   x86_64)
9088                     objfmt='Win64-COFF'
9089                     ;;
9090                   *)
9091                     objfmt='Win32-COFF'
9092                     ;;
9093                 esac
9094               ;;
9095               msdosdjgpp* | go32*)
9096                 objfmt='COFF'
9097               ;;
9098               os2-emx*) # not tested
9099                 objfmt='MSOMF' # obj
9100               ;;
9101               linux*coff* | linux*oldld*)
9102                 objfmt='COFF' # ???
9103               ;;
9104               linux*aout*)
9105                 objfmt='a.out'
9106               ;;
9107               linux*)
9108                 case "$host_cpu" in
9109                   x86_64)
9110                     objfmt='ELF64'
9111                     ;;
9112                   *)
9113                     objfmt='ELF'
9114                     ;;
9115                 esac
9116               ;;
9117               kfreebsd* | freebsd* | netbsd* | openbsd*)
9118                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
9119                   objfmt='BSD-a.out'
9120                 else
9121                   case "$host_cpu" in
9122                     x86_64 | amd64)
9123                       objfmt='ELF64'
9124                       ;;
9125                     *)
9126                       objfmt='ELF'
9127                       ;;
9128                   esac
9129                 fi
9130               ;;
9131               solaris* | sunos* | sysv* | sco*)
9132                 case "$host_cpu" in
9133                   x86_64)
9134                     objfmt='ELF64'
9135                     ;;
9136                   *)
9137                     objfmt='ELF'
9138                     ;;
9139                 esac
9140               ;;
9141               darwin* | rhapsody* | nextstep* | openstep* | macos*)
9142                 case "$host_cpu" in
9143                   x86_64)
9144                     objfmt='Mach-O64'
9145                     ;;
9146                   *)
9147                     objfmt='Mach-O'
9148                     ;;
9149                 esac
9150               ;;
9151               *)
9152                 objfmt='ELF ?'
9153               ;;
9154             esac
9156             AC_MSG_RESULT([$objfmt])
9157             if test "$objfmt" = 'ELF ?'; then
9158               objfmt='ELF'
9159               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
9160             fi
9162             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
9163             case "$objfmt" in
9164               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
9165               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
9166               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
9167               COFF)       NAFLAGS='-fcoff -DCOFF';;
9168               a.out)      NAFLAGS='-faout -DAOUT';;
9169               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
9170               ELF)        NAFLAGS='-felf -DELF';;
9171               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
9172               RDF)        NAFLAGS='-frdf -DRDF';;
9173               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
9174               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
9175             esac
9176             AC_MSG_RESULT([$NAFLAGS])
9178             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
9179             cat > conftest.asm << EOF
9180             [%line __oline__ "configure"
9181                     section .text
9182                     global  _main,main
9183             _main:
9184             main:   xor     eax,eax
9185                     ret
9186             ]
9188             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
9189             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
9190               AC_MSG_RESULT(yes)
9191             else
9192               echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
9193               cat conftest.asm >&AS_MESSAGE_LOG_FD
9194               rm -rf conftest*
9195               AC_MSG_RESULT(no)
9196               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
9197               NASM=""
9198             fi
9200         fi
9202         if test -z "$NASM"; then
9203 cat << _EOS
9204 ****************************************************************************
9205 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
9206 To get one please:
9208 _EOS
9209             if test "$build_os" = "cygwin"; then
9210 cat << _EOS
9211 install a pre-compiled binary for Win32
9213 mkdir -p /opt/lo/bin
9214 cd /opt/lo/bin
9215 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
9216 chmod +x nasm
9218 or get and install one from http://www.nasm.us/
9220 Then re-run autogen.sh
9222 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
9223 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
9225 _EOS
9226             else
9227 cat << _EOS
9228 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
9230 _EOS
9231             fi
9232             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
9233             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
9234         fi
9235       ;;
9236     esac
9239 AC_SUBST(NASM)
9240 AC_SUBST(LIBJPEG_CFLAGS)
9241 AC_SUBST(LIBJPEG_LIBS)
9242 AC_SUBST(SYSTEM_LIBJPEG)
9244 dnl ===================================================================
9245 dnl Check for system clucene
9246 dnl ===================================================================
9247 dnl we should rather be using
9248 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
9249 dnl but the contribs-lib check seems tricky
9250 if test "$enable_xmlhelp" = yes -o "$enable_extension_integration" = yes; then
9251 AC_MSG_CHECKING([which clucene to use])
9252 if test "$with_system_clucene" = "yes"; then
9253     AC_MSG_RESULT([external])
9254     SYSTEM_CLUCENE=TRUE
9255     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
9256     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
9257     FilterLibs "${CLUCENE_LIBS}"
9258     CLUCENE_LIBS="${filteredlibs}"
9259     AC_LANG_PUSH([C++])
9260     save_CXXFLAGS=$CXXFLAGS
9261     save_CPPFLAGS=$CPPFLAGS
9262     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
9263     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
9264     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
9265     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
9266     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
9267                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
9268     CXXFLAGS=$save_CXXFLAGS
9269     CPPFLAGS=$save_CPPFLAGS
9270     AC_LANG_POP([C++])
9272     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
9273 else
9274     AC_MSG_RESULT([internal])
9275     SYSTEM_CLUCENE=
9276     BUILD_TYPE="$BUILD_TYPE CLUCENE"
9279 AC_SUBST(SYSTEM_CLUCENE)
9280 AC_SUBST(CLUCENE_CFLAGS)
9281 AC_SUBST(CLUCENE_LIBS)
9283 dnl ===================================================================
9284 dnl Check for system expat
9285 dnl ===================================================================
9286 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
9288 dnl ===================================================================
9289 dnl Check for system xmlsec
9290 dnl ===================================================================
9291 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
9293 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
9294 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
9295     ENABLE_EOT="TRUE"
9296     AC_DEFINE([ENABLE_EOT])
9297     AC_MSG_RESULT([yes])
9299     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
9300 else
9301     ENABLE_EOT=
9302     AC_MSG_RESULT([no])
9304 AC_SUBST([ENABLE_EOT])
9306 dnl ===================================================================
9307 dnl Check for DLP libs
9308 dnl ===================================================================
9309 AS_IF([test "$COM" = "MSC"],
9310       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
9311       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
9313 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
9315 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
9317 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
9319 AS_IF([test "$COM" = "MSC"],
9320       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
9321       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
9323 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
9325 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
9327 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
9328 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.12])
9330 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
9332 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
9334 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
9336 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
9337 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.20])
9339 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
9340 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.10])
9342 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
9344 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
9345 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
9347 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
9349 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
9351 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
9353 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
9355 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
9356 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.7])
9358 dnl ===================================================================
9359 dnl Check for system lcms2
9360 dnl ===================================================================
9361 if test "$with_system_lcms2" != "yes"; then
9362     SYSTEM_LCMS2=
9364 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
9365 if test "$GCC" = "yes"; then
9366     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
9368 if test "$COM" = "MSC"; then # override the above
9369     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
9372 dnl ===================================================================
9373 dnl Check for system cppunit
9374 dnl ===================================================================
9375 if test "$_os" != "Android" ; then
9376     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
9379 dnl ===================================================================
9380 dnl Check whether freetype is available
9381 dnl ===================================================================
9382 if test "$using_freetype_fontconfig" = yes; then
9383     AC_MSG_CHECKING([which freetype to use])
9385 if test "$using_freetype_fontconfig" = yes -a "$test_system_freetype" != no; then
9386     AC_MSG_RESULT([external])
9387     # FreeType has 3 different kinds of versions
9388     # * release, like 2.4.10
9389     # * libtool, like 13.0.7 (this what pkg-config returns)
9390     # * soname
9391     # FreeType's docs/VERSION.DLL provides a table mapping between the three
9392     #
9393     # 9.9.3 is 2.2.0
9394     # When the minimal version is at least 2.8.1, remove Skia's check down below.
9395     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
9396     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9397     FilterLibs "${FREETYPE_LIBS}"
9398     FREETYPE_LIBS="${filteredlibs}"
9399     SYSTEM_FREETYPE=TRUE
9400 elif test "$using_freetype_fontconfig" = yes; then
9401     AC_MSG_RESULT([internal])
9402     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
9403     if test "x$ac_config_site_64bit_host" = xYES; then
9404         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
9405     else
9406         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
9407     fi
9408     BUILD_TYPE="$BUILD_TYPE FREETYPE"
9410 AC_SUBST(FREETYPE_CFLAGS)
9411 AC_SUBST(FREETYPE_LIBS)
9412 AC_SUBST([SYSTEM_FREETYPE])
9414 # ===================================================================
9415 # Check for system libxslt
9416 # to prevent incompatibilities between internal libxml2 and external libxslt,
9417 # or vice versa, use with_system_libxml here
9418 # ===================================================================
9419 if test "$with_system_libxml" = "auto"; then
9420     case "$_os" in
9421     WINNT|iOS|Android)
9422         with_system_libxml="$with_system_libs"
9423         ;;
9424     Emscripten)
9425         with_system_libxml=no
9426         ;;
9427     *)
9428         if test "$enable_fuzzers" != "yes"; then
9429             with_system_libxml=yes
9430         else
9431             with_system_libxml=no
9432         fi
9433         ;;
9434     esac
9437 AC_MSG_CHECKING([which libxslt to use])
9438 if test "$with_system_libxml" = "yes"; then
9439     AC_MSG_RESULT([external])
9440     SYSTEM_LIBXSLT=TRUE
9441     if test "$_os" = "Darwin"; then
9442         dnl make sure to use SDK path
9443         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9444         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
9445         dnl omit -L/usr/lib
9446         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
9447         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
9448     else
9449         PKG_CHECK_MODULES(LIBXSLT, libxslt)
9450         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9451         FilterLibs "${LIBXSLT_LIBS}"
9452         LIBXSLT_LIBS="${filteredlibs}"
9453         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
9454         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9455         FilterLibs "${LIBEXSLT_LIBS}"
9456         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
9457     fi
9459     dnl Check for xsltproc
9460     AC_PATH_PROG(XSLTPROC, xsltproc, no)
9461     if test "$XSLTPROC" = "no"; then
9462         AC_MSG_ERROR([xsltproc is required])
9463     fi
9464 else
9465     AC_MSG_RESULT([internal])
9466     SYSTEM_LIBXSLT=
9467     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
9469 AC_SUBST(SYSTEM_LIBXSLT)
9470 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
9471     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
9473 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
9475 AC_SUBST(LIBEXSLT_CFLAGS)
9476 AC_SUBST(LIBEXSLT_LIBS)
9477 AC_SUBST(LIBXSLT_CFLAGS)
9478 AC_SUBST(LIBXSLT_LIBS)
9479 AC_SUBST(XSLTPROC)
9481 # ===================================================================
9482 # Check for system libxml
9483 # ===================================================================
9484 AC_MSG_CHECKING([which libxml to use])
9485 if test "$with_system_libxml" = "yes"; then
9486     AC_MSG_RESULT([external])
9487     SYSTEM_LIBXML=TRUE
9488     if test "$_os" = "Darwin"; then
9489         dnl make sure to use SDK path
9490         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9491         dnl omit -L/usr/lib
9492         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
9493     elif test $_os = iOS; then
9494         dnl make sure to use SDK path
9495         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
9496         LIBXML_CFLAGS="-I$usr/include/libxml2"
9497         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
9498     else
9499         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
9500         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9501         FilterLibs "${LIBXML_LIBS}"
9502         LIBXML_LIBS="${filteredlibs}"
9503     fi
9505     dnl Check for xmllint
9506     AC_PATH_PROG(XMLLINT, xmllint, no)
9507     if test "$XMLLINT" = "no"; then
9508         AC_MSG_ERROR([xmllint is required])
9509     fi
9510 else
9511     AC_MSG_RESULT([internal])
9512     SYSTEM_LIBXML=
9513     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
9514     if test "$COM" = "MSC"; then
9515         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9516     fi
9517     if test "$COM" = "MSC"; then
9518         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
9519     else
9520         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
9521         if test "$_os" = Android; then
9522             LIBXML_LIBS="$LIBXML_LIBS -lm"
9523         fi
9524     fi
9525     BUILD_TYPE="$BUILD_TYPE LIBXML2"
9527 AC_SUBST(SYSTEM_LIBXML)
9528 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
9529     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
9531 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
9532 AC_SUBST(LIBXML_CFLAGS)
9533 AC_SUBST(LIBXML_LIBS)
9534 AC_SUBST(XMLLINT)
9536 # =====================================================================
9537 # Checking for a Python interpreter with version >= 3.3.
9538 # Optionally user can pass an option to configure, i. e.
9539 # ./configure PYTHON=/usr/bin/python
9540 # =====================================================================
9541 if test $_os = Darwin -a "$enable_python" != no -a "$enable_python" != fully-internal -a "$enable_python" != internal -a "$enable_python" != system; then
9542     # Only allowed choices for macOS are 'no', 'internal' (default), and 'fully-internal'
9543     # unless PYTHON is defined as above which allows 'system'
9544     enable_python=internal
9546 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
9547     if test -n "$PYTHON"; then
9548         PYTHON_FOR_BUILD=$PYTHON
9549     else
9550         # This allows a lack of system python with no error, we use internal one in that case.
9551         AM_PATH_PYTHON([3.3],, [:])
9552         # Clean PYTHON_VERSION checked below if cross-compiling
9553         PYTHON_VERSION=""
9554         if test "$PYTHON" != ":"; then
9555             PYTHON_FOR_BUILD=$PYTHON
9556         fi
9557     fi
9559 AC_SUBST(PYTHON_FOR_BUILD)
9561 # Checks for Python to use for Pyuno
9562 AC_MSG_CHECKING([which Python to use for Pyuno])
9563 case "$enable_python" in
9564 no|disable)
9565     if test -z $PYTHON_FOR_BUILD; then
9566         # Python is required to build LibreOffice. In theory we could separate the build-time Python
9567         # requirement from the choice whether to include Python stuff in the installer, but why
9568         # bother?
9569         if test "$cross_compiling" = yes; then
9570             enable_python=system
9571         else
9572             AC_MSG_ERROR([Python is required at build time.])
9573         fi
9574     fi
9575     enable_python=no
9576     AC_MSG_RESULT([none])
9577     ;;
9578 ""|yes|auto)
9579     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
9580         AC_MSG_RESULT([no, overridden by --disable-scripting])
9581         enable_python=no
9582     elif test $build_os = cygwin; then
9583         dnl When building on Windows we don't attempt to use any installed
9584         dnl "system"  Python.
9585         AC_MSG_RESULT([fully internal])
9586         enable_python=internal
9587     elif test "$cross_compiling" = yes; then
9588         AC_MSG_RESULT([system])
9589         enable_python=system
9590     else
9591         # Unset variables set by the above AM_PATH_PYTHON so that
9592         # we actually do check anew.
9593         AC_MSG_RESULT([])
9594         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
9595         AM_PATH_PYTHON([3.3],, [:])
9596         AC_MSG_CHECKING([which Python to use for Pyuno])
9597         if test "$PYTHON" = ":"; then
9598             if test -z "$PYTHON_FOR_BUILD"; then
9599                 AC_MSG_RESULT([fully internal])
9600             else
9601                 AC_MSG_RESULT([internal])
9602             fi
9603             enable_python=internal
9604         else
9605             AC_MSG_RESULT([system])
9606             enable_python=system
9607         fi
9608     fi
9609     ;;
9610 internal)
9611     AC_MSG_RESULT([internal])
9612     ;;
9613 fully-internal)
9614     AC_MSG_RESULT([fully internal])
9615     enable_python=internal
9616     ;;
9617 system)
9618     AC_MSG_RESULT([system])
9619     if test "$_os" = Darwin -a -z "$PYTHON"; then
9620         AC_MSG_ERROR([--enable-python=system doesn't work on macOS because the version provided is obsolete])
9621     fi
9622     ;;
9624     AC_MSG_ERROR([Incorrect --enable-python option])
9625     ;;
9626 esac
9628 if test $enable_python != no; then
9629     BUILD_TYPE="$BUILD_TYPE PYUNO"
9632 if test $enable_python = system; then
9633     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
9634         # Fallback: Accept these in the environment, or as set above
9635         # for MacOSX.
9636         :
9637     elif test "$cross_compiling" != yes; then
9638         # Unset variables set by the above AM_PATH_PYTHON so that
9639         # we actually do check anew.
9640         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
9641         # This causes an error if no python command is found
9642         AM_PATH_PYTHON([3.3])
9643         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
9644         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
9645         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
9646         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
9647         if test -z "$PKG_CONFIG"; then
9648             PYTHON_CFLAGS="-I$python_include"
9649             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
9650         elif $PKG_CONFIG --exists python-$python_version-embed; then
9651             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
9652             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
9653         elif $PKG_CONFIG --exists python-$python_version; then
9654             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
9655             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
9656         else
9657             PYTHON_CFLAGS="-I$python_include"
9658             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
9659         fi
9660         FilterLibs "${PYTHON_LIBS}"
9661         PYTHON_LIBS="${filteredlibs}"
9662     else
9663         dnl How to find out the cross-compilation Python installation path?
9664         AC_MSG_CHECKING([for python version])
9665         AS_IF([test -n "$PYTHON_VERSION"],
9666               [AC_MSG_RESULT([$PYTHON_VERSION])],
9667               [AC_MSG_RESULT([not found])
9668                AC_MSG_ERROR([no usable python found])])
9669         test -n "$PYTHON_CFLAGS" && break
9670     fi
9672     dnl Check if the headers really work
9673     save_CPPFLAGS="$CPPFLAGS"
9674     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
9675     AC_CHECK_HEADER(Python.h)
9676     CPPFLAGS="$save_CPPFLAGS"
9678     # let the PYTHON_FOR_BUILD match the same python installation that
9679     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
9680     # better for PythonTests.
9681     PYTHON_FOR_BUILD=$PYTHON
9684 if test "$with_lxml" != no; then
9685     if test -z "$PYTHON_FOR_BUILD"; then
9686         case $build_os in
9687             cygwin)
9688                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
9689                 ;;
9690             *)
9691                 if test "$cross_compiling" != yes ; then
9692                     BUILD_TYPE="$BUILD_TYPE LXML"
9693                 fi
9694                 ;;
9695         esac
9696     else
9697         AC_MSG_CHECKING([for python lxml])
9698         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
9699             AC_MSG_RESULT([yes])
9700         else
9701             case $build_os in
9702                 cygwin)
9703                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
9704                     ;;
9705                 *)
9706                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
9707                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
9708                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
9709                         else
9710                             BUILD_TYPE="$BUILD_TYPE LXML"
9711                             AC_MSG_RESULT([no, using internal lxml])
9712                         fi
9713                     else
9714                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
9715                     fi
9716                     ;;
9717             esac
9718         fi
9719     fi
9722 dnl By now enable_python should be "system", "internal" or "no"
9723 case $enable_python in
9724 system)
9725     SYSTEM_PYTHON=TRUE
9727     if test "x$ac_cv_header_Python_h" != "xyes"; then
9728        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
9729     fi
9731     AC_LANG_PUSH(C)
9732     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
9733     AC_MSG_CHECKING([for correct python library version])
9734        AC_RUN_IFELSE([AC_LANG_SOURCE([[
9735 #include <Python.h>
9737 int main(int argc, char **argv) {
9738    if ((PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
9739    else return 1;
9741        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3])],[AC_MSG_RESULT([skipped; cross-compiling])])
9742     AC_LANG_POP(C)
9744     dnl FIXME Check if the Python library can be linked with, too?
9745     ;;
9747 internal)
9748     SYSTEM_PYTHON=
9749     PYTHON_VERSION_MAJOR=3
9750     PYTHON_VERSION_MINOR=8
9751     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.10
9752     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
9753         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
9754     fi
9755     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
9756     BUILD_TYPE="$BUILD_TYPE PYTHON"
9757     if test "$OS" = LINUX -o "$OS" = WNT ; then
9758         BUILD_TYPE="$BUILD_TYPE LIBFFI"
9759     fi
9760     # Embedded Python dies without Home set
9761     if test "$HOME" = ""; then
9762         export HOME=""
9763     fi
9764     ;;
9766     DISABLE_PYTHON=TRUE
9767     SYSTEM_PYTHON=
9768     ;;
9770     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
9771     ;;
9772 esac
9774 AC_SUBST(DISABLE_PYTHON)
9775 AC_SUBST(SYSTEM_PYTHON)
9776 AC_SUBST(PYTHON_CFLAGS)
9777 AC_SUBST(PYTHON_LIBS)
9778 AC_SUBST(PYTHON_VERSION)
9779 AC_SUBST(PYTHON_VERSION_MAJOR)
9780 AC_SUBST(PYTHON_VERSION_MINOR)
9782 AC_MSG_CHECKING([whether to build LibreLogo])
9783 case "$enable_python" in
9784 no|disable)
9785     AC_MSG_RESULT([no; Python disabled])
9786     ;;
9788     if test "${enable_librelogo}" = "no"; then
9789         AC_MSG_RESULT([no])
9790     else
9791         AC_MSG_RESULT([yes])
9792         BUILD_TYPE="${BUILD_TYPE} LIBRELOGO"
9793         AC_DEFINE([ENABLE_LIBRELOGO],1)
9794     fi
9795     ;;
9796 esac
9797 AC_SUBST(ENABLE_LIBRELOGO)
9799 ENABLE_MARIADBC=
9800 MARIADBC_MAJOR=1
9801 MARIADBC_MINOR=0
9802 MARIADBC_MICRO=2
9803 AC_MSG_CHECKING([whether to build the MariaDB/MySQL SDBC driver])
9804 if test "x$enable_mariadb_sdbc" != "xno" -a "$enable_mpl_subset" != "yes"; then
9805     ENABLE_MARIADBC=TRUE
9806     AC_MSG_RESULT([yes])
9807     BUILD_TYPE="$BUILD_TYPE MARIADBC"
9808 else
9809     AC_MSG_RESULT([no])
9811 AC_SUBST(ENABLE_MARIADBC)
9812 AC_SUBST(MARIADBC_MAJOR)
9813 AC_SUBST(MARIADBC_MINOR)
9814 AC_SUBST(MARIADBC_MICRO)
9816 if test "$ENABLE_MARIADBC" = "TRUE"; then
9817     dnl ===================================================================
9818     dnl Check for system MariaDB
9819     dnl ===================================================================
9820     AC_MSG_CHECKING([which MariaDB to use])
9821     if test "$with_system_mariadb" = "yes"; then
9822         AC_MSG_RESULT([external])
9823         SYSTEM_MARIADB_CONNECTOR_C=TRUE
9824         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
9825         if test -z "$MARIADBCONFIG"; then
9826             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
9827             if test -z "$MARIADBCONFIG"; then
9828                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
9829                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
9830             fi
9831         fi
9832         AC_MSG_CHECKING([MariaDB version])
9833         MARIADB_VERSION=`$MARIADBCONFIG --version`
9834         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
9835         if test "$MARIADB_MAJOR" -ge "5"; then
9836             AC_MSG_RESULT([OK])
9837         else
9838             AC_MSG_ERROR([too old, use 5.0.x or later])
9839         fi
9840         AC_MSG_CHECKING([for MariaDB Client library])
9841         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
9842         if test "$COM_IS_CLANG" = TRUE; then
9843             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
9844         fi
9845         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
9846         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
9847         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
9848         dnl linux32:
9849         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
9850             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
9851             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
9852                 | sed -e 's|/lib64/|/lib/|')
9853         fi
9854         FilterLibs "${MARIADB_LIBS}"
9855         MARIADB_LIBS="${filteredlibs}"
9856         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
9857         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
9858         if test "$enable_bundle_mariadb" = "yes"; then
9859             AC_MSG_RESULT([yes])
9860             BUNDLE_MARIADB_CONNECTOR_C=TRUE
9861             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
9863 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
9865 /g' | grep -E '(mysqlclient|mariadb)')
9866             if test "$_os" = "Darwin"; then
9867                 LIBMARIADB=${LIBMARIADB}.dylib
9868             elif test "$_os" = "WINNT"; then
9869                 LIBMARIADB=${LIBMARIADB}.dll
9870             else
9871                 LIBMARIADB=${LIBMARIADB}.so
9872             fi
9873             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
9874             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
9875             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
9876                 AC_MSG_RESULT([found.])
9877                 PathFormat "$LIBMARIADB_PATH"
9878                 LIBMARIADB_PATH="$formatted_path"
9879             else
9880                 AC_MSG_ERROR([not found.])
9881             fi
9882         else
9883             AC_MSG_RESULT([no])
9884             BUNDLE_MARIADB_CONNECTOR_C=
9885         fi
9886     else
9887         AC_MSG_RESULT([internal])
9888         SYSTEM_MARIADB_CONNECTOR_C=
9889         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
9890         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
9891         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
9892     fi
9894     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
9895     AC_SUBST(MARIADB_CFLAGS)
9896     AC_SUBST(MARIADB_LIBS)
9897     AC_SUBST(LIBMARIADB)
9898     AC_SUBST(LIBMARIADB_PATH)
9899     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
9902 dnl ===================================================================
9903 dnl Check for system hsqldb
9904 dnl ===================================================================
9905 if test "$with_java" != "no" -a "$cross_compiling" != "yes"; then
9906     HSQLDB_USE_JDBC_4_1=
9907     AC_MSG_CHECKING([which hsqldb to use])
9908     if test "$with_system_hsqldb" = "yes"; then
9909         AC_MSG_RESULT([external])
9910         SYSTEM_HSQLDB=TRUE
9911         if test -z $HSQLDB_JAR; then
9912             HSQLDB_JAR=/usr/share/java/hsqldb.jar
9913         fi
9914         if ! test -f $HSQLDB_JAR; then
9915                AC_MSG_ERROR(hsqldb.jar not found.)
9916         fi
9917         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
9918         export HSQLDB_JAR
9919         if $PERL -e \
9920            'use Archive::Zip;
9921             my $file = "$ENV{'HSQLDB_JAR'}";
9922             my $zip = Archive::Zip->new( $file );
9923             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
9924             if ( $mf =~ m/Specification-Version: 1.8.*/ )
9925             {
9926                 push @l, split(/\n/, $mf);
9927                 foreach my $line (@l)
9928                 {
9929                     if ($line =~ m/Specification-Version:/)
9930                     {
9931                         ($t, $version) = split (/:/,$line);
9932                         $version =~ s/^\s//;
9933                         ($a, $b, $c, $d) = split (/\./,$version);
9934                         if ($c == "0" && $d > "8")
9935                         {
9936                             exit 0;
9937                         }
9938                         else
9939                         {
9940                             exit 1;
9941                         }
9942                     }
9943                 }
9944             }
9945             else
9946             {
9947                 exit 1;
9948             }'; then
9949             AC_MSG_RESULT([yes])
9950         else
9951             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
9952         fi
9953     else
9954         AC_MSG_RESULT([internal])
9955         SYSTEM_HSQLDB=
9956         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9957         NEED_ANT=TRUE
9958         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
9959         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
9960         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
9961             AC_MSG_RESULT([yes])
9962             HSQLDB_USE_JDBC_4_1=TRUE
9963         else
9964             AC_MSG_RESULT([no])
9965         fi
9966     fi
9967 else
9968     if test "$with_java" != "no" -a -z "$HSQLDB_JAR"; then
9969         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9970     fi
9972 AC_SUBST(SYSTEM_HSQLDB)
9973 AC_SUBST(HSQLDB_JAR)
9974 AC_SUBST([HSQLDB_USE_JDBC_4_1])
9976 dnl ===================================================================
9977 dnl Check for PostgreSQL stuff
9978 dnl ===================================================================
9979 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
9980 if test "x$enable_postgresql_sdbc" != "xno"; then
9981     AC_MSG_RESULT([yes])
9982     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
9984     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
9985         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
9986     fi
9987     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
9988         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
9989     fi
9991     postgres_interface=""
9992     if test "$with_system_postgresql" = "yes"; then
9993         postgres_interface="external PostgreSQL"
9994         SYSTEM_POSTGRESQL=TRUE
9995         if test "$_os" = Darwin; then
9996             supp_path=''
9997             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
9998                 pg_supp_path="$P_SEP$d$pg_supp_path"
9999             done
10000         fi
10001         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
10002         if test -n "$PGCONFIG"; then
10003             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
10004             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
10005         else
10006             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
10007               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
10008               POSTGRESQL_LIB=$POSTGRESQL_LIBS
10009             ],[
10010               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
10011             ])
10012         fi
10013         FilterLibs "${POSTGRESQL_LIB}"
10014         POSTGRESQL_LIB="${filteredlibs}"
10015     else
10016         # if/when anything else than PostgreSQL uses Kerberos,
10017         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
10018         WITH_KRB5=
10019         WITH_GSSAPI=
10020         case "$_os" in
10021         Darwin)
10022             # macOS has system MIT Kerberos 5 since 10.4
10023             if test "$with_krb5" != "no"; then
10024                 WITH_KRB5=TRUE
10025                 save_LIBS=$LIBS
10026                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
10027                 # that the libraries where these functions are located on macOS will change, is it?
10028                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10029                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10030                 KRB5_LIBS=$LIBS
10031                 LIBS=$save_LIBS
10032                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10033                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10034                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10035                 LIBS=$save_LIBS
10036             fi
10037             if test "$with_gssapi" != "no"; then
10038                 WITH_GSSAPI=TRUE
10039                 save_LIBS=$LIBS
10040                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10041                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10042                 GSSAPI_LIBS=$LIBS
10043                 LIBS=$save_LIBS
10044             fi
10045             ;;
10046         WINNT)
10047             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
10048                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
10049             fi
10050             ;;
10051         Linux|GNU|*BSD|DragonFly)
10052             if test "$with_krb5" != "no"; then
10053                 WITH_KRB5=TRUE
10054                 save_LIBS=$LIBS
10055                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10056                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10057                 KRB5_LIBS=$LIBS
10058                 LIBS=$save_LIBS
10059                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10060                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10061                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10062                 LIBS=$save_LIBS
10063             fi
10064             if test "$with_gssapi" != "no"; then
10065                 WITH_GSSAPI=TRUE
10066                 save_LIBS=$LIBS
10067                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10068                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10069                 GSSAPI_LIBS=$LIBS
10070                 LIBS=$save_LIBS
10071             fi
10072             ;;
10073         *)
10074             if test "$with_krb5" = "yes"; then
10075                 WITH_KRB5=TRUE
10076                 save_LIBS=$LIBS
10077                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10078                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10079                 KRB5_LIBS=$LIBS
10080                 LIBS=$save_LIBS
10081                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10082                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10083                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10084                 LIBS=$save_LIBS
10085             fi
10086             if test "$with_gssapi" = "yes"; then
10087                 WITH_GSSAPI=TRUE
10088                 save_LIBS=$LIBS
10089                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10090                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10091                 LIBS=$save_LIBS
10092                 GSSAPI_LIBS=$LIBS
10093             fi
10094         esac
10096         if test -n "$with_libpq_path"; then
10097             SYSTEM_POSTGRESQL=TRUE
10098             postgres_interface="external libpq"
10099             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
10100             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
10101         else
10102             SYSTEM_POSTGRESQL=
10103             postgres_interface="internal"
10104             POSTGRESQL_LIB=""
10105             POSTGRESQL_INC="%OVERRIDE_ME%"
10106             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
10107         fi
10108     fi
10110     AC_MSG_CHECKING([PostgreSQL C interface])
10111     AC_MSG_RESULT([$postgres_interface])
10113     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
10114         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
10115         save_CFLAGS=$CFLAGS
10116         save_CPPFLAGS=$CPPFLAGS
10117         save_LIBS=$LIBS
10118         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
10119         LIBS="${LIBS} ${POSTGRESQL_LIB}"
10120         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
10121         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
10122             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
10123         CFLAGS=$save_CFLAGS
10124         CPPFLAGS=$save_CPPFLAGS
10125         LIBS=$save_LIBS
10126     fi
10127     BUILD_POSTGRESQL_SDBC=TRUE
10128 else
10129     AC_MSG_RESULT([no])
10131 AC_SUBST(WITH_KRB5)
10132 AC_SUBST(WITH_GSSAPI)
10133 AC_SUBST(GSSAPI_LIBS)
10134 AC_SUBST(KRB5_LIBS)
10135 AC_SUBST(BUILD_POSTGRESQL_SDBC)
10136 AC_SUBST(SYSTEM_POSTGRESQL)
10137 AC_SUBST(POSTGRESQL_INC)
10138 AC_SUBST(POSTGRESQL_LIB)
10140 dnl ===================================================================
10141 dnl Check for Firebird stuff
10142 dnl ===================================================================
10143 ENABLE_FIREBIRD_SDBC=
10144 if test "$enable_firebird_sdbc" = "yes" ; then
10145     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
10147     dnl ===================================================================
10148     dnl Check for system Firebird
10149     dnl ===================================================================
10150     AC_MSG_CHECKING([which Firebird to use])
10151     if test "$with_system_firebird" = "yes"; then
10152         AC_MSG_RESULT([external])
10153         SYSTEM_FIREBIRD=TRUE
10154         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
10155         if test -z "$FIREBIRDCONFIG"; then
10156             AC_MSG_NOTICE([No fb_config -- using pkg-config])
10157             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
10158                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
10159             ])
10160             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
10161         else
10162             AC_MSG_NOTICE([fb_config found])
10163             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
10164             AC_MSG_CHECKING([for Firebird Client library])
10165             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
10166             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
10167             FilterLibs "${FIREBIRD_LIBS}"
10168             FIREBIRD_LIBS="${filteredlibs}"
10169         fi
10170         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
10171         AC_MSG_CHECKING([Firebird version])
10172         if test -n "${FIREBIRD_VERSION}"; then
10173             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
10174             if test "$FIREBIRD_MAJOR" -ge "3"; then
10175                 AC_MSG_RESULT([OK])
10176             else
10177                 AC_MSG_ERROR([Ensure firebird >= 3 is installed])
10178             fi
10179         else
10180             save_CFLAGS="${CFLAGS}"
10181             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
10182             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
10183 #if defined(FB_API_VER) && FB_API_VER == 30
10184 int fb_api_is_30(void) { return 0; }
10185 #else
10186 #error "Wrong Firebird API version"
10187 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
10188             CFLAGS="$save_CFLAGS"
10189         fi
10190         ENABLE_FIREBIRD_SDBC=TRUE
10191         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10192     elif test "$enable_database_connectivity" = no; then
10193         AC_MSG_RESULT([none])
10194     elif test "$cross_compiling" = "yes"; then
10195         AC_MSG_RESULT([none])
10196     else
10197         dnl Embedded Firebird has version 3.0
10198         dnl We need libatomic_ops for any non X86/X64 system
10199         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
10200             dnl ===================================================================
10201             dnl Check for system libatomic_ops
10202             dnl ===================================================================
10203             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[LIBATOMIC_OPS],[atomic_ops >= 0.7.2])
10204             if test "$with_system_libatomic_ops" = "yes"; then
10205                 SYSTEM_LIBATOMIC_OPS=TRUE
10206                 AC_CHECK_HEADERS(atomic_ops.h, [],
10207                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
10208             else
10209                 SYSTEM_LIBATOMIC_OPS=
10210                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
10211                 LIBATOMIC_OPS_LIBS="-latomic_ops"
10212                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
10213             fi
10214         fi
10216         AC_MSG_RESULT([internal])
10217         SYSTEM_FIREBIRD=
10218         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
10219         FIREBIRD_LIBS="-lfbclient"
10221         if test "$with_system_libtommath" = "yes"; then
10222             SYSTEM_LIBTOMMATH=TRUE
10223             dnl check for tommath presence
10224             save_LIBS=$LIBS
10225             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
10226             AC_CHECK_LIB(tommath, mp_init, LIBTOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
10227             LIBS=$save_LIBS
10228         else
10229             SYSTEM_LIBTOMMATH=
10230             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
10231             LIBTOMMATH_LIBS="-ltommath"
10232             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
10233         fi
10235         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
10236         ENABLE_FIREBIRD_SDBC=TRUE
10237         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10238     fi
10240 AC_SUBST(ENABLE_FIREBIRD_SDBC)
10241 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
10242 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
10243 AC_SUBST(LIBATOMIC_OPS_LIBS)
10244 AC_SUBST(SYSTEM_FIREBIRD)
10245 AC_SUBST(FIREBIRD_CFLAGS)
10246 AC_SUBST(FIREBIRD_LIBS)
10247 AC_SUBST(SYSTEM_LIBTOMMATH)
10248 AC_SUBST(LIBTOMMATH_CFLAGS)
10249 AC_SUBST(LIBTOMMATH_LIBS)
10251 dnl ===================================================================
10252 dnl Check for system curl
10253 dnl ===================================================================
10254 AC_MSG_CHECKING([which libcurl to use])
10255 if test "$with_system_curl" = "auto"; then
10256     with_system_curl="$with_system_libs"
10259 if test "$enable_curl" = "yes" -a "$with_system_curl" = "yes"; then
10260     AC_MSG_RESULT([external])
10261     SYSTEM_CURL=TRUE
10263     # First try PKGCONFIG and then fall back
10264     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
10266     if test -n "$CURL_PKG_ERRORS"; then
10267         AC_PATH_PROG(CURLCONFIG, curl-config)
10268         if test -z "$CURLCONFIG"; then
10269             AC_MSG_ERROR([curl development files not found])
10270         fi
10271         CURL_LIBS=`$CURLCONFIG --libs`
10272         FilterLibs "${CURL_LIBS}"
10273         CURL_LIBS="${filteredlibs}"
10274         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
10275         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
10277         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
10278         case $curl_version in
10279         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
10280         dnl so they need to be doubled to end up in the configure script
10281         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
10282             AC_MSG_RESULT([yes])
10283             ;;
10284         *)
10285             AC_MSG_ERROR([no, you have $curl_version])
10286             ;;
10287         esac
10288     fi
10290     ENABLE_CURL=TRUE
10291 elif test "$enable_curl" = "no"; then
10292     AC_MSG_RESULT([none])
10293 else
10294     AC_MSG_RESULT([internal])
10295     SYSTEM_CURL=
10296     BUILD_TYPE="$BUILD_TYPE CURL"
10297     ENABLE_CURL=TRUE
10299 AC_SUBST(SYSTEM_CURL)
10300 AC_SUBST(CURL_CFLAGS)
10301 AC_SUBST(CURL_LIBS)
10302 AC_SUBST(ENABLE_CURL)
10304 dnl ===================================================================
10305 dnl Check for system boost
10306 dnl ===================================================================
10307 AC_MSG_CHECKING([which boost to use])
10308 if test "$with_system_boost" = "yes"; then
10309     AC_MSG_RESULT([external])
10310     SYSTEM_BOOST=TRUE
10311     AX_BOOST_BASE([1.66],,[AC_MSG_ERROR([no suitable Boost found])])
10312     AX_BOOST_DATE_TIME
10313     AX_BOOST_FILESYSTEM
10314     AX_BOOST_IOSTREAMS
10315     AX_BOOST_LOCALE
10316     AC_LANG_PUSH([C++])
10317     save_CXXFLAGS=$CXXFLAGS
10318     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
10319     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
10320        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
10321     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
10322        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
10323     CXXFLAGS=$save_CXXFLAGS
10324     AC_LANG_POP([C++])
10325     # this is in m4/ax_boost_base.m4
10326     FilterLibs "${BOOST_LDFLAGS}"
10327     BOOST_LDFLAGS="${filteredlibs}"
10328 else
10329     AC_MSG_RESULT([internal])
10330     BUILD_TYPE="$BUILD_TYPE BOOST"
10331     SYSTEM_BOOST=
10332     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
10333         # use warning-suppressing wrapper headers
10334         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
10335     else
10336         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
10337     fi
10339 AC_SUBST(SYSTEM_BOOST)
10341 dnl ===================================================================
10342 dnl Check for system mdds
10343 dnl ===================================================================
10344 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
10346 dnl ===================================================================
10347 dnl Check for system cuckoo
10348 dnl ===================================================================
10349 AC_MSG_CHECKING([which cuckoo to use])
10350 if test "$with_system_cuckoo" = "yes"; then
10351     AC_MSG_RESULT([external])
10352     SYSTEM_CUCKOO=TRUE
10353     AC_LANG_PUSH([C++])
10354     AC_CHECK_HEADER([libcuckoo/cuckoohash_map.hh], [],
10355        [AC_MSG_ERROR([libcuckoo/cuckoohash_map.hh not found. install cuckoo])], [])
10356     AC_LANG_POP([C++])
10357 else
10358     AC_MSG_RESULT([internal])
10359     BUILD_TYPE="$BUILD_TYPE CUCKOO"
10360     SYSTEM_CUCKOO=
10361     CUCKOO_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/cuckoo"
10363 AC_SUBST([CUCKOO_CFLAGS])
10364 AC_SUBST([SYSTEM_CUCKOO])
10366 dnl ===================================================================
10367 dnl Check for system glm
10368 dnl ===================================================================
10369 AC_MSG_CHECKING([which glm to use])
10370 if test "$with_system_glm" = "yes"; then
10371     AC_MSG_RESULT([external])
10372     SYSTEM_GLM=TRUE
10373     AC_LANG_PUSH([C++])
10374     AC_CHECK_HEADER([glm/glm.hpp], [],
10375        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
10376     AC_LANG_POP([C++])
10377 else
10378     AC_MSG_RESULT([internal])
10379     BUILD_TYPE="$BUILD_TYPE GLM"
10380     SYSTEM_GLM=
10381     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
10383 AC_SUBST([GLM_CFLAGS])
10384 AC_SUBST([SYSTEM_GLM])
10386 dnl ===================================================================
10387 dnl Check for system odbc
10388 dnl ===================================================================
10389 AC_MSG_CHECKING([which odbc headers to use])
10390 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
10391     AC_MSG_RESULT([external])
10392     SYSTEM_ODBC_HEADERS=TRUE
10394     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
10395         save_CPPFLAGS=$CPPFLAGS
10396         find_winsdk
10397         PathFormat "$winsdktest"
10398         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"
10399         AC_CHECK_HEADER(sqlext.h, [],
10400             [AC_MSG_ERROR(odbc not found. install odbc)],
10401             [#include <windows.h>])
10402         CPPFLAGS=$save_CPPFLAGS
10403     else
10404         AC_CHECK_HEADER(sqlext.h, [],
10405             [AC_MSG_ERROR(odbc not found. install odbc)],[])
10406     fi
10407 elif test "$enable_database_connectivity" = no; then
10408     AC_MSG_RESULT([none])
10409 else
10410     AC_MSG_RESULT([internal])
10411     SYSTEM_ODBC_HEADERS=
10413 AC_SUBST(SYSTEM_ODBC_HEADERS)
10415 dnl ===================================================================
10416 dnl Check for system NSS
10417 dnl ===================================================================
10418 if test "$enable_fuzzers" != "yes" -a "$enable_nss" = "yes"; then
10419     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
10420     AC_DEFINE(HAVE_FEATURE_NSS)
10421     ENABLE_NSS=TRUE
10422 elif test $_os != iOS ; then
10423     with_tls=openssl
10425 AC_SUBST(ENABLE_NSS)
10427 dnl ===================================================================
10428 dnl Enable LDAP support
10429 dnl ===================================================================
10431 if test "$test_openldap" = yes; then
10432     AC_MSG_CHECKING([whether to enable LDAP support])
10433     if test "$enable_ldap" = yes -a \( "$ENABLE_NSS" = TRUE -o "$with_system_openldap" = yes \); then
10434         AC_MSG_RESULT([yes])
10435         ENABLE_LDAP=TRUE
10436     else
10437         if test "$enable_ldap" != "yes"; then
10438             AC_MSG_RESULT([no])
10439         else
10440             AC_MSG_RESULT([no (needs NSS or system openldap)])
10441         fi
10442     fi
10444 dnl ===================================================================
10445 dnl Check for system openldap
10446 dnl ===================================================================
10448     if test "$ENABLE_LDAP" = TRUE; then
10449         AC_MSG_CHECKING([which openldap library to use])
10450         if test "$with_system_openldap" = yes; then
10451             AC_MSG_RESULT([external])
10452             SYSTEM_OPENLDAP=TRUE
10453             AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
10454             AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10455             AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10456         else
10457             AC_MSG_RESULT([internal])
10458             BUILD_TYPE="$BUILD_TYPE OPENLDAP"
10459         fi
10460     fi
10463 AC_SUBST(ENABLE_LDAP)
10464 AC_SUBST(SYSTEM_OPENLDAP)
10466 dnl ===================================================================
10467 dnl Check for TLS/SSL and cryptographic implementation to use
10468 dnl ===================================================================
10469 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
10470 if test -n "$with_tls"; then
10471     case $with_tls in
10472     openssl)
10473         AC_DEFINE(USE_TLS_OPENSSL)
10474         TLS=OPENSSL
10475         AC_MSG_RESULT([$TLS])
10477         if test "$enable_openssl" != "yes"; then
10478             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
10479         fi
10481         # warn that OpenSSL has been selected but not all TLS code has this option
10482         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
10483         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
10484         ;;
10485     nss)
10486         AC_DEFINE(USE_TLS_NSS)
10487         TLS=NSS
10488         AC_MSG_RESULT([$TLS])
10489         ;;
10490     no)
10491         AC_MSG_RESULT([none])
10492         AC_MSG_WARN([Skipping TLS/SSL])
10493         ;;
10494     *)
10495         AC_MSG_RESULT([])
10496         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
10497 openssl - OpenSSL
10498 nss - Mozilla's Network Security Services (NSS)
10499     ])
10500         ;;
10501     esac
10502 else
10503     # default to using NSS, it results in smaller oox lib
10504     AC_DEFINE(USE_TLS_NSS)
10505     TLS=NSS
10506     AC_MSG_RESULT([$TLS])
10508 AC_SUBST(TLS)
10510 dnl ===================================================================
10511 dnl Check for system sane
10512 dnl ===================================================================
10513 AC_MSG_CHECKING([which sane header to use])
10514 if test "$with_system_sane" = "yes"; then
10515     AC_MSG_RESULT([external])
10516     AC_CHECK_HEADER(sane/sane.h, [],
10517       [AC_MSG_ERROR(sane not found. install sane)], [])
10518 else
10519     AC_MSG_RESULT([internal])
10520     BUILD_TYPE="$BUILD_TYPE SANE"
10523 dnl ===================================================================
10524 dnl Check for system icu
10525 dnl ===================================================================
10526 SYSTEM_GENBRK=
10527 SYSTEM_GENCCODE=
10528 SYSTEM_GENCMN=
10530 ICU_MAJOR=69
10531 ICU_MINOR=1
10532 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
10533 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
10534 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
10535 AC_MSG_CHECKING([which icu to use])
10536 if test "$with_system_icu" = "yes"; then
10537     AC_MSG_RESULT([external])
10538     SYSTEM_ICU=TRUE
10539     AC_LANG_PUSH([C++])
10540     AC_MSG_CHECKING([for unicode/rbbi.h])
10541     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
10542     AC_LANG_POP([C++])
10544     if test "$cross_compiling" != "yes"; then
10545         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
10546         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
10547         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
10548         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
10549     fi
10551     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
10552         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
10553         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
10554         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
10555         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
10556         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
10557             AC_MSG_RESULT([yes])
10558         else
10559             AC_MSG_RESULT([no])
10560             if test "$with_system_icu_for_build" != "force"; then
10561                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
10562 You can use --with-system-icu-for-build=force to use it anyway.])
10563             fi
10564         fi
10565     fi
10567     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
10568         # using the system icu tools can lead to version confusion, use the
10569         # ones from the build environment when cross-compiling
10570         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
10571         if test -z "$SYSTEM_GENBRK"; then
10572             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
10573         fi
10574         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
10575         if test -z "$SYSTEM_GENCCODE"; then
10576             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
10577         fi
10578         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
10579         if test -z "$SYSTEM_GENCMN"; then
10580             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
10581         fi
10582         if test "$ICU_MAJOR" -ge "49"; then
10583             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
10584             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
10585             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
10586         else
10587             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
10588             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
10589             ICU_RECLASSIFIED_HEBREW_LETTER=
10590         fi
10591     fi
10593     if test "$cross_compiling" = "yes"; then
10594         if test "$ICU_MAJOR" -ge "50"; then
10595             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
10596             ICU_MINOR=""
10597         fi
10598     fi
10599 else
10600     AC_MSG_RESULT([internal])
10601     SYSTEM_ICU=
10602     BUILD_TYPE="$BUILD_TYPE ICU"
10603     # surprisingly set these only for "internal" (to be used by various other
10604     # external libs): the system icu-config is quite unhelpful and spits out
10605     # dozens of weird flags and also default path -I/usr/include
10606     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
10607     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
10609 if test "$ICU_MAJOR" -ge "59"; then
10610     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
10611     # with -std=c++11 but not all external libraries can be built with that,
10612     # for those use a bit-compatible typedef uint16_t UChar; see
10613     # icu/source/common/unicode/umachine.h
10614     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
10615 else
10616     ICU_UCHAR_TYPE=""
10618 AC_SUBST(SYSTEM_ICU)
10619 AC_SUBST(SYSTEM_GENBRK)
10620 AC_SUBST(SYSTEM_GENCCODE)
10621 AC_SUBST(SYSTEM_GENCMN)
10622 AC_SUBST(ICU_MAJOR)
10623 AC_SUBST(ICU_MINOR)
10624 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
10625 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
10626 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
10627 AC_SUBST(ICU_CFLAGS)
10628 AC_SUBST(ICU_LIBS)
10629 AC_SUBST(ICU_UCHAR_TYPE)
10631 dnl ==================================================================
10632 dnl Breakpad
10633 dnl ==================================================================
10634 DEFAULT_CRASHDUMP_VALUE="true"
10635 AC_MSG_CHECKING([whether to enable breakpad])
10636 if test "$enable_breakpad" != yes; then
10637     AC_MSG_RESULT([no])
10638 else
10639     AC_MSG_RESULT([yes])
10640     ENABLE_BREAKPAD="TRUE"
10641     AC_DEFINE(ENABLE_BREAKPAD)
10642     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
10643     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
10645     AC_MSG_CHECKING([for disable crash dump])
10646     if test "$enable_crashdump" = no; then
10647         DEFAULT_CRASHDUMP_VALUE="false"
10648         AC_MSG_RESULT([yes])
10649     else
10650        AC_MSG_RESULT([no])
10651     fi
10653     AC_MSG_CHECKING([for crashreport config])
10654     if test "$with_symbol_config" = "no"; then
10655         BREAKPAD_SYMBOL_CONFIG="invalid"
10656         AC_MSG_RESULT([no])
10657     else
10658         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
10659         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
10660         AC_MSG_RESULT([yes])
10661     fi
10662     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
10664 AC_SUBST(ENABLE_BREAKPAD)
10665 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
10667 dnl ==================================================================
10668 dnl libfuzzer
10669 dnl ==================================================================
10670 AC_MSG_CHECKING([whether to enable fuzzers])
10671 if test "$enable_fuzzers" != yes; then
10672     AC_MSG_RESULT([no])
10673 else
10674     if test -z $LIB_FUZZING_ENGINE; then
10675       AC_MSG_ERROR(['LIB_FUZZING_ENGINE' must be set when using --enable-fuzzers. Examples include '-fsanitize=fuzzer'.])
10676     fi
10677     AC_MSG_RESULT([yes])
10678     ENABLE_FUZZERS="TRUE"
10679     AC_DEFINE([ENABLE_FUZZERS],1)
10680     BUILD_TYPE="$BUILD_TYPE FUZZERS"
10682 AC_SUBST(LIB_FUZZING_ENGINE)
10683 AC_SUBST(ENABLE_FUZZERS)
10685 dnl ===================================================================
10686 dnl Orcus
10687 dnl ===================================================================
10688 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.16 >= 0.16.0])
10689 if test "$with_system_orcus" != "yes"; then
10690     if test "$SYSTEM_BOOST" = "TRUE"; then
10691         # ===========================================================
10692         # Determine if we are going to need to link with Boost.System
10693         # ===========================================================
10694         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
10695         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
10696         dnl in documentation has no effect.
10697         AC_MSG_CHECKING([if we need to link with Boost.System])
10698         AC_LANG_PUSH([C++])
10699         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
10700                 @%:@include <boost/version.hpp>
10701             ]],[[
10702                 #if BOOST_VERSION >= 105000
10703                 #   error yes, we need to link with Boost.System
10704                 #endif
10705             ]])],[
10706                 AC_MSG_RESULT([no])
10707             ],[
10708                 AC_MSG_RESULT([yes])
10709                 AX_BOOST_SYSTEM
10710         ])
10711         AC_LANG_POP([C++])
10712     fi
10714 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
10715 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
10716 AC_SUBST([BOOST_SYSTEM_LIB])
10717 AC_SUBST(SYSTEM_LIBORCUS)
10719 dnl ===================================================================
10720 dnl HarfBuzz
10721 dnl ===================================================================
10722 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
10723                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
10724                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
10726 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
10727                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
10728                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
10730 if test "$COM" = "MSC"; then # override the above
10731     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
10732     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
10735 if test "$with_system_harfbuzz" = "yes"; then
10736     if test "$with_system_graphite" = "no"; then
10737         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
10738     fi
10739     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
10740     save_LIBS="$LIBS"
10741     save_CFLAGS="$CFLAGS"
10742     LIBS="$LIBS $HARFBUZZ_LIBS"
10743     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
10744     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
10745     LIBS="$save_LIBS"
10746     CFLAGS="$save_CFLAGS"
10747 else
10748     if test "$with_system_graphite" = "yes"; then
10749         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
10750     fi
10753 if test "$USING_X11" = TRUE; then
10754     AC_PATH_X
10755     AC_PATH_XTRA
10756     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
10758     if test -z "$x_includes"; then
10759         x_includes="default_x_includes"
10760     fi
10761     if test -z "$x_libraries"; then
10762         x_libraries="default_x_libraries"
10763     fi
10764     CFLAGS="$CFLAGS $X_CFLAGS"
10765     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
10766     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
10767 else
10768     x_includes="no_x_includes"
10769     x_libraries="no_x_libraries"
10772 if test "$USING_X11" = TRUE; then
10773     dnl ===================================================================
10774     dnl Check for extension headers
10775     dnl ===================================================================
10776     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
10777      [#include <X11/extensions/shape.h>])
10779     # vcl needs ICE and SM
10780     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
10781     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
10782         [AC_MSG_ERROR(ICE library not found)])
10783     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
10784     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
10785         [AC_MSG_ERROR(SM library not found)])
10788 if test "$USING_X11" = TRUE -a "$ENABLE_JAVA" != ""; then
10789     # bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c needs Xt
10790     AC_CHECK_HEADERS(X11/Intrinsic.h,[],[AC_MSG_ERROR([libXt headers not found])])
10793 dnl ===================================================================
10794 dnl Check for system Xrender
10795 dnl ===================================================================
10796 AC_MSG_CHECKING([whether to use Xrender])
10797 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
10798     AC_MSG_RESULT([yes])
10799     PKG_CHECK_MODULES(XRENDER, xrender)
10800     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10801     FilterLibs "${XRENDER_LIBS}"
10802     XRENDER_LIBS="${filteredlibs}"
10803     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
10804       [AC_MSG_ERROR(libXrender not found or functional)], [])
10805     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
10806       [AC_MSG_ERROR(Xrender not found. install X)], [])
10807 else
10808     AC_MSG_RESULT([no])
10810 AC_SUBST(XRENDER_CFLAGS)
10811 AC_SUBST(XRENDER_LIBS)
10813 dnl ===================================================================
10814 dnl Check for XRandr
10815 dnl ===================================================================
10816 AC_MSG_CHECKING([whether to enable RandR support])
10817 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
10818     AC_MSG_RESULT([yes])
10819     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
10820     if test "$ENABLE_RANDR" != "TRUE"; then
10821         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
10822                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
10823         XRANDR_CFLAGS=" "
10824         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
10825           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
10826         XRANDR_LIBS="-lXrandr "
10827         ENABLE_RANDR="TRUE"
10828     fi
10829     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10830     FilterLibs "${XRANDR_LIBS}"
10831     XRANDR_LIBS="${filteredlibs}"
10832 else
10833     ENABLE_RANDR=""
10834     AC_MSG_RESULT([no])
10836 AC_SUBST(XRANDR_CFLAGS)
10837 AC_SUBST(XRANDR_LIBS)
10838 AC_SUBST(ENABLE_RANDR)
10840 if test "$test_webdav" = yes; then
10841     if test -z "$with_webdav"; then
10842         WITH_WEBDAV=neon
10843         if test "$enable_mpl_subset" = yes; then
10844             WITH_WEBDAV=serf
10845         fi
10846     else
10847         WITH_WEBDAV="$with_webdav"
10848     fi
10851 AC_MSG_CHECKING([for webdav library])
10852 case "$WITH_WEBDAV" in
10853 serf)
10854     AC_MSG_RESULT([serf])
10855     # Check for system apr-util
10856     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
10857                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
10858                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
10859     if test "$COM" = "MSC"; then
10860         APR_LIB_DIR="LibR"
10861         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
10862         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
10863     fi
10865     # Check for system serf
10866     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.3.9])
10867     ;;
10868 neon)
10869     AC_MSG_RESULT([neon])
10870     # Check for system neon
10871     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.31.2])
10872     if test "$with_system_neon" = "yes"; then
10873         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
10874     else
10875         NEON_VERSION=0312
10876     fi
10877     AC_SUBST(NEON_VERSION)
10878     ;;
10880     AC_MSG_RESULT([none, disabled])
10881     WITH_WEBDAV=""
10882     ;;
10883 esac
10884 AC_SUBST(WITH_WEBDAV)
10886 dnl ===================================================================
10887 dnl Check for disabling cve_tests
10888 dnl ===================================================================
10889 AC_MSG_CHECKING([whether to execute CVE tests])
10890 # If not explicitly enabled or disabled, default
10891 if test -z "$enable_cve_tests"; then
10892     case "$OS" in
10893     WNT)
10894         # Default cves off for Windows with its wild and wonderful
10895         # variety of AV software kicking in and panicking
10896         enable_cve_tests=no
10897         ;;
10898     *)
10899         # otherwise yes
10900         enable_cve_tests=yes
10901         ;;
10902     esac
10904 if test "$enable_cve_tests" = "no"; then
10905     AC_MSG_RESULT([no])
10906     DISABLE_CVE_TESTS=TRUE
10907     AC_SUBST(DISABLE_CVE_TESTS)
10908 else
10909     AC_MSG_RESULT([yes])
10912 dnl ===================================================================
10913 dnl Check for enabling chart XShape tests
10914 dnl ===================================================================
10915 AC_MSG_CHECKING([whether to execute chart XShape tests])
10916 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
10917     AC_MSG_RESULT([yes])
10918     ENABLE_CHART_TESTS=TRUE
10919     AC_SUBST(ENABLE_CHART_TESTS)
10920 else
10921     AC_MSG_RESULT([no])
10924 dnl ===================================================================
10925 dnl Check for system openssl
10926 dnl ===================================================================
10927 ENABLE_OPENSSL=
10928 AC_MSG_CHECKING([whether to disable OpenSSL usage])
10929 if test "$enable_openssl" = "yes"; then
10930     AC_MSG_RESULT([no])
10931     ENABLE_OPENSSL=TRUE
10932     if test "$_os" = Darwin ; then
10933         # OpenSSL is deprecated when building for 10.7 or later.
10934         #
10935         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
10936         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
10938         with_system_openssl=no
10939         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10940     elif test "$_os" = "FreeBSD" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
10941             && test "$with_system_openssl" != "no"; then
10942         with_system_openssl=yes
10943         SYSTEM_OPENSSL=TRUE
10944         OPENSSL_CFLAGS=
10945         OPENSSL_LIBS="-lssl -lcrypto"
10946     else
10947         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10948     fi
10949     if test "$with_system_openssl" = "yes"; then
10950         AC_MSG_CHECKING([whether openssl supports SHA512])
10951         AC_LANG_PUSH([C])
10952         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
10953             SHA512_CTX context;
10954 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
10955         AC_LANG_POP(C)
10956     fi
10957 else
10958     AC_MSG_RESULT([yes])
10960     # warn that although OpenSSL is disabled, system libraries may depend on it
10961     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
10962     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
10965 AC_SUBST([ENABLE_OPENSSL])
10967 if test "$enable_cipher_openssl_backend" = yes && test "$ENABLE_OPENSSL" != TRUE; then
10968     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
10969         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
10970         enable_cipher_openssl_backend=no
10971     else
10972         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
10973     fi
10975 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
10976 ENABLE_CIPHER_OPENSSL_BACKEND=
10977 if test "$enable_cipher_openssl_backend" = yes; then
10978     AC_MSG_RESULT([yes])
10979     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
10980 else
10981     AC_MSG_RESULT([no])
10983 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
10985 dnl ===================================================================
10986 dnl Select the crypto backends used by LO
10987 dnl ===================================================================
10989 if test "$build_crypto" = yes; then
10990     if test "$OS" = WNT; then
10991         BUILD_TYPE="$BUILD_TYPE CRYPTO_MSCAPI"
10992         AC_DEFINE([USE_CRYPTO_MSCAPI])
10993     elif test "$ENABLE_NSS" = TRUE; then
10994         BUILD_TYPE="$BUILD_TYPE CRYPTO_NSS"
10995         AC_DEFINE([USE_CRYPTO_NSS])
10996     fi
10999 dnl ===================================================================
11000 dnl Check for building gnutls
11001 dnl ===================================================================
11002 AC_MSG_CHECKING([whether to use gnutls])
11003 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
11004     AC_MSG_RESULT([yes])
11005     AM_PATH_LIBGCRYPT()
11006     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
11007         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
11008                       available in the system to use as replacement.]]))
11009     FilterLibs "${LIBGCRYPT_LIBS}"
11010     LIBGCRYPT_LIBS="${filteredlibs}"
11011 else
11012     AC_MSG_RESULT([no])
11015 AC_SUBST([LIBGCRYPT_CFLAGS])
11016 AC_SUBST([LIBGCRYPT_LIBS])
11018 dnl ===================================================================
11019 dnl Check for system redland
11020 dnl ===================================================================
11021 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
11022 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
11023 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
11024 if test "$with_system_redland" = "yes"; then
11025     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
11026             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
11027 else
11028     RAPTOR_MAJOR="0"
11029     RASQAL_MAJOR="3"
11030     REDLAND_MAJOR="0"
11032 AC_SUBST(RAPTOR_MAJOR)
11033 AC_SUBST(RASQAL_MAJOR)
11034 AC_SUBST(REDLAND_MAJOR)
11036 dnl ===================================================================
11037 dnl Check for system hunspell
11038 dnl ===================================================================
11039 AC_MSG_CHECKING([which libhunspell to use])
11040 if test "$with_system_hunspell" = "yes"; then
11041     AC_MSG_RESULT([external])
11042     SYSTEM_HUNSPELL=TRUE
11043     AC_LANG_PUSH([C++])
11044     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
11045     if test "$HUNSPELL_PC" != "TRUE"; then
11046         AC_CHECK_HEADER(hunspell.hxx, [],
11047             [
11048             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
11049             [AC_MSG_ERROR(hunspell headers not found.)], [])
11050             ], [])
11051         AC_CHECK_LIB([hunspell], [main], [:],
11052            [ AC_MSG_ERROR(hunspell library not found.) ], [])
11053         HUNSPELL_LIBS=-lhunspell
11054     fi
11055     AC_LANG_POP([C++])
11056     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11057     FilterLibs "${HUNSPELL_LIBS}"
11058     HUNSPELL_LIBS="${filteredlibs}"
11059 else
11060     AC_MSG_RESULT([internal])
11061     SYSTEM_HUNSPELL=
11062     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
11063     if test "$COM" = "MSC"; then
11064         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
11065     else
11066         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
11067     fi
11068     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
11070 AC_SUBST(SYSTEM_HUNSPELL)
11071 AC_SUBST(HUNSPELL_CFLAGS)
11072 AC_SUBST(HUNSPELL_LIBS)
11074 dnl ===================================================================
11075 dnl Check for system zxing
11076 dnl ===================================================================
11077 AC_MSG_CHECKING([whether to use zxing])
11078 if test "$enable_zxing" = "no"; then
11079     AC_MSG_RESULT([no])
11080     ENABLE_ZXING=
11081     SYSTEM_ZXING=
11082 else
11083     AC_MSG_RESULT([yes])
11084     ENABLE_ZXING=TRUE
11085     AC_MSG_CHECKING([which libzxing to use])
11086     if test "$with_system_zxing" = "yes"; then
11087         AC_MSG_RESULT([external])
11088         SYSTEM_ZXING=TRUE
11089         AC_LANG_PUSH([C++])
11090         AC_CHECK_HEADER(ZXing/MultiFormatWriter.h, [],
11091             [AC_MSG_ERROR(zxing headers not found.)], [#include <stdexcept>])
11092         ZXING_CFLAGS=-I/usr/include/ZXing
11093         AC_CHECK_LIB([ZXing], [main], [ZXING_LIBS=-lZXing],
11094             [ AC_CHECK_LIB([ZXingCore], [main], [ZXING_LIBS=-lZXingCore],
11095             [ AC_MSG_ERROR(zxing C++ library not found.) ])], [])
11096         AC_LANG_POP([C++])
11097         ZXING_CFLAGS=$(printf '%s' "$ZXING_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11098         FilterLibs "${ZXING_LIBS}"
11099         ZXING_LIBS="${filteredlibs}"
11100     else
11101         AC_MSG_RESULT([internal])
11102         SYSTEM_ZXING=
11103         BUILD_TYPE="$BUILD_TYPE ZXING"
11104     fi
11105     if test "$ENABLE_ZXING" = TRUE; then
11106         AC_DEFINE(ENABLE_ZXING)
11107     fi
11109 AC_SUBST(SYSTEM_ZXING)
11110 AC_SUBST(ENABLE_ZXING)
11111 AC_SUBST(ZXING_CFLAGS)
11112 AC_SUBST(ZXING_LIBS)
11114 dnl ===================================================================
11115 dnl Check for system box2d
11116 dnl ===================================================================
11117 AC_MSG_CHECKING([which box2d to use])
11118 if test "$with_system_box2d" = "yes"; then
11119     AC_MSG_RESULT([external])
11120     SYSTEM_BOX2D=TRUE
11121     AC_LANG_PUSH([C++])
11122     AC_CHECK_HEADER(box2d/box2d.h, [BOX2D_H_FOUND='TRUE'],
11123         [BOX2D_H_FOUND='FALSE'])
11124     if test "$BOX2D_H_FOUND" = "TRUE"; then # 2.4.0+
11125         _BOX2D_LIB=box2d
11126         AC_DEFINE(BOX2D_HEADER,<box2d/box2d.h>)
11127     else
11128         # fail this. there's no other alternative to check when we are here.
11129         AC_CHECK_HEADER([Box2D/Box2D.h], [],
11130             [AC_MSG_ERROR(box2d headers not found.)])
11131         _BOX2D_LIB=Box2D
11132         AC_DEFINE(BOX2D_HEADER,<Box2D/Box2D.h>)
11133     fi
11134     AC_CHECK_LIB([$_BOX2D_LIB], [main], [:],
11135         [ AC_MSG_ERROR(box2d library not found.) ], [])
11136     BOX2D_LIBS=-l$_BOX2D_LIB
11137     AC_LANG_POP([C++])
11138     BOX2D_CFLAGS=$(printf '%s' "$BOX2D_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11139     FilterLibs "${BOX2D_LIBS}"
11140     BOX2D_LIBS="${filteredlibs}"
11141 else
11142     AC_MSG_RESULT([internal])
11143     SYSTEM_BOX2D=
11144     BUILD_TYPE="$BUILD_TYPE BOX2D"
11146 AC_SUBST(SYSTEM_BOX2D)
11147 AC_SUBST(BOX2D_CFLAGS)
11148 AC_SUBST(BOX2D_LIBS)
11150 dnl ===================================================================
11151 dnl Checking for altlinuxhyph
11152 dnl ===================================================================
11153 AC_MSG_CHECKING([which altlinuxhyph to use])
11154 if test "$with_system_altlinuxhyph" = "yes"; then
11155     AC_MSG_RESULT([external])
11156     SYSTEM_HYPH=TRUE
11157     AC_CHECK_HEADER(hyphen.h, [],
11158        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
11159     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
11160        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
11161        [#include <hyphen.h>])
11162     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
11163         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11164     if test -z "$HYPHEN_LIB"; then
11165         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
11166            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11167     fi
11168     if test -z "$HYPHEN_LIB"; then
11169         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
11170            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11171     fi
11172 else
11173     AC_MSG_RESULT([internal])
11174     SYSTEM_HYPH=
11175     BUILD_TYPE="$BUILD_TYPE HYPHEN"
11176     if test "$COM" = "MSC"; then
11177         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
11178     else
11179         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
11180     fi
11182 AC_SUBST(SYSTEM_HYPH)
11183 AC_SUBST(HYPHEN_LIB)
11185 dnl ===================================================================
11186 dnl Checking for mythes
11187 dnl ===================================================================
11188 AC_MSG_CHECKING([which mythes to use])
11189 if test "$with_system_mythes" = "yes"; then
11190     AC_MSG_RESULT([external])
11191     SYSTEM_MYTHES=TRUE
11192     AC_LANG_PUSH([C++])
11193     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
11194     if test "$MYTHES_PKGCONFIG" = "no"; then
11195         AC_CHECK_HEADER(mythes.hxx, [],
11196             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
11197         AC_CHECK_LIB([mythes-1.2], [main], [:],
11198             [ MYTHES_FOUND=no], [])
11199     if test "$MYTHES_FOUND" = "no"; then
11200         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
11201                 [ MYTHES_FOUND=no], [])
11202     fi
11203     if test "$MYTHES_FOUND" = "no"; then
11204         AC_MSG_ERROR([mythes library not found!.])
11205     fi
11206     fi
11207     AC_LANG_POP([C++])
11208     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11209     FilterLibs "${MYTHES_LIBS}"
11210     MYTHES_LIBS="${filteredlibs}"
11211 else
11212     AC_MSG_RESULT([internal])
11213     SYSTEM_MYTHES=
11214     BUILD_TYPE="$BUILD_TYPE MYTHES"
11215     if test "$COM" = "MSC"; then
11216         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
11217     else
11218         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
11219     fi
11221 AC_SUBST(SYSTEM_MYTHES)
11222 AC_SUBST(MYTHES_CFLAGS)
11223 AC_SUBST(MYTHES_LIBS)
11225 dnl ===================================================================
11226 dnl How should we build the linear programming solver ?
11227 dnl ===================================================================
11229 ENABLE_COINMP=
11230 AC_MSG_CHECKING([whether to build with CoinMP])
11231 if test "$enable_coinmp" != "no"; then
11232     ENABLE_COINMP=TRUE
11233     AC_MSG_RESULT([yes])
11234     if test "$with_system_coinmp" = "yes"; then
11235         SYSTEM_COINMP=TRUE
11236         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
11237         FilterLibs "${COINMP_LIBS}"
11238         COINMP_LIBS="${filteredlibs}"
11239     else
11240         BUILD_TYPE="$BUILD_TYPE COINMP"
11241     fi
11242 else
11243     AC_MSG_RESULT([no])
11245 AC_SUBST(ENABLE_COINMP)
11246 AC_SUBST(SYSTEM_COINMP)
11247 AC_SUBST(COINMP_CFLAGS)
11248 AC_SUBST(COINMP_LIBS)
11250 ENABLE_LPSOLVE=
11251 AC_MSG_CHECKING([whether to build with lpsolve])
11252 if test "$enable_lpsolve" != "no"; then
11253     ENABLE_LPSOLVE=TRUE
11254     AC_MSG_RESULT([yes])
11255 else
11256     AC_MSG_RESULT([no])
11258 AC_SUBST(ENABLE_LPSOLVE)
11260 if test "$ENABLE_LPSOLVE" = TRUE; then
11261     AC_MSG_CHECKING([which lpsolve to use])
11262     if test "$with_system_lpsolve" = "yes"; then
11263         AC_MSG_RESULT([external])
11264         SYSTEM_LPSOLVE=TRUE
11265         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
11266            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
11267         save_LIBS=$LIBS
11268         # some systems need this. Like Ubuntu...
11269         AC_CHECK_LIB(m, floor)
11270         AC_CHECK_LIB(dl, dlopen)
11271         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
11272             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
11273         LIBS=$save_LIBS
11274     else
11275         AC_MSG_RESULT([internal])
11276         SYSTEM_LPSOLVE=
11277         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
11278     fi
11280 AC_SUBST(SYSTEM_LPSOLVE)
11282 dnl ===================================================================
11283 dnl Checking for libexttextcat
11284 dnl ===================================================================
11285 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
11286 if test "$with_system_libexttextcat" = "yes"; then
11287     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
11289 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
11291 dnl ===================================================================
11292 dnl Checking for libnumbertext
11293 dnl ===================================================================
11294 libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.6])
11295 if test "$with_system_libnumbertext" = "yes"; then
11296     SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
11297     SYSTEM_LIBNUMBERTEXT=YES
11298 else
11299     SYSTEM_LIBNUMBERTEXT=
11300     AC_LANG_PUSH([C++])
11301     save_CPPFLAGS=$CPPFLAGS
11302     CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
11303     AC_CHECK_HEADERS([codecvt regex])
11304     AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
11305             [ LIBNUMBERTEXT_CFLAGS=''
11306               AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
11307                            Enable libnumbertext fallback (missing number to number name conversion).])
11308             ])
11309     CPPFLAGS=$save_CPPFLAGS
11310     AC_LANG_POP([C++])
11312 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
11313 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
11314 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
11316 dnl ***************************************
11317 dnl testing libc version for Linux...
11318 dnl ***************************************
11319 if test "$_os" = "Linux"; then
11320     AC_MSG_CHECKING([whether libc is >= 2.1.1])
11321     exec 6>/dev/null # no output
11322     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
11323     exec 6>&1 # output on again
11324     if test "$HAVE_LIBC"; then
11325         AC_MSG_RESULT([yes])
11326     else
11327         AC_MSG_ERROR([no, upgrade libc])
11328     fi
11331 dnl =========================================
11332 dnl Check for uuidgen
11333 dnl =========================================
11334 if test "$_os" = "WINNT"; then
11335     # we must use the uuidgen from the Windows SDK, which will be in the LO_PATH, but isn't in
11336     # the PATH for AC_PATH_PROG. It is already tested above in the WINDOWS_SDK_HOME check.
11337     UUIDGEN=uuidgen.exe
11338     AC_SUBST(UUIDGEN)
11339 else
11340     AC_PATH_PROG([UUIDGEN], [uuidgen])
11341     if test -z "$UUIDGEN"; then
11342         AC_MSG_WARN([uuid is needed for building installation sets])
11343     fi
11346 dnl ***************************************
11347 dnl Checking for bison and flex
11348 dnl ***************************************
11349 AC_PATH_PROG(BISON, bison)
11350 if test -z "$BISON"; then
11351     AC_MSG_ERROR([no bison found in \$PATH, install it])
11352 else
11353     AC_MSG_CHECKING([the bison version])
11354     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
11355     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
11356     dnl Accept newer than 2.0; for --enable-compiler-plugins at least 2.3 is known to be bad and
11357     dnl cause
11358     dnl
11359     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]
11360     dnl   typedef union YYSTYPE
11361     dnl           ~~~~~~^~~~~~~
11362     dnl
11363     dnl while at least 3.4.1 is know to be good:
11364     if test "$COMPILER_PLUGINS" = TRUE; then
11365         if test "$_bison_longver" -lt 2004; then
11366             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.4+ for --enable-compiler-plugins)])
11367         fi
11368     else
11369         if test "$_bison_longver" -lt 2000; then
11370             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
11371         fi
11372     fi
11374 AC_SUBST([BISON])
11376 AC_PATH_PROG(FLEX, flex)
11377 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11378     FLEX=`cygpath -m $FLEX`
11380 if test -z "$FLEX"; then
11381     AC_MSG_ERROR([no flex found in \$PATH, install it])
11382 else
11383     AC_MSG_CHECKING([the flex version])
11384     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
11385     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
11386         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
11387     fi
11389 AC_SUBST([FLEX])
11390 dnl ***************************************
11391 dnl Checking for patch
11392 dnl ***************************************
11393 AC_PATH_PROG(PATCH, patch)
11394 if test -z "$PATCH"; then
11395     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
11398 dnl On Solaris or macOS, check if --with-gnu-patch was used
11399 if test "$_os" = "SunOS" -o "$_os" = "Darwin"; then
11400     if test -z "$with_gnu_patch"; then
11401         GNUPATCH=$PATCH
11402     else
11403         if test -x "$with_gnu_patch"; then
11404             GNUPATCH=$with_gnu_patch
11405         else
11406             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
11407         fi
11408     fi
11410     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
11411     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
11412         AC_MSG_RESULT([yes])
11413     else
11414         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
11415     fi
11416 else
11417     GNUPATCH=$PATCH
11420 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11421     GNUPATCH=`cygpath -m $GNUPATCH`
11424 dnl We also need to check for --with-gnu-cp
11426 if test -z "$with_gnu_cp"; then
11427     # check the place where the good stuff is hidden on Solaris...
11428     if test -x /usr/gnu/bin/cp; then
11429         GNUCP=/usr/gnu/bin/cp
11430     else
11431         AC_PATH_PROGS(GNUCP, gnucp cp)
11432     fi
11433     if test -z $GNUCP; then
11434         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
11435     fi
11436 else
11437     if test -x "$with_gnu_cp"; then
11438         GNUCP=$with_gnu_cp
11439     else
11440         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
11441     fi
11444 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11445     GNUCP=`cygpath -m $GNUCP`
11448 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
11449 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
11450     AC_MSG_RESULT([yes])
11451 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
11452     AC_MSG_RESULT([yes])
11453 else
11454     case "$build_os" in
11455     darwin*|macos*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
11456         x_GNUCP=[\#]
11457         GNUCP=''
11458         AC_MSG_RESULT([no gnucp found - using the system's cp command])
11459         ;;
11460     *)
11461         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
11462         ;;
11463     esac
11466 AC_SUBST(GNUPATCH)
11467 AC_SUBST(GNUCP)
11468 AC_SUBST(x_GNUCP)
11470 dnl ***************************************
11471 dnl testing assembler path
11472 dnl ***************************************
11473 ML_EXE=""
11474 if test "$_os" = "WINNT"; then
11475     case "$WIN_HOST_ARCH" in
11476     x86) assembler=ml.exe ;;
11477     x64) assembler=ml64.exe ;;
11478     arm64) assembler=armasm64.exe ;;
11479     esac
11481     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
11482     if test -f "$MSVC_HOST_PATH/$assembler"; then
11483         ML_EXE=`win_short_path_for_make "$MSVC_HOST_PATH/$assembler"`
11484         AC_MSG_RESULT([$ML_EXE])
11485     else
11486         AC_MSG_ERROR([not found in $MSVC_HOST_PATH])
11487     fi
11490 AC_SUBST(ML_EXE)
11492 dnl ===================================================================
11493 dnl We need zip and unzip
11494 dnl ===================================================================
11495 AC_PATH_PROG(ZIP, zip)
11496 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
11497 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
11498     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],,)
11501 AC_PATH_PROG(UNZIP, unzip)
11502 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
11504 dnl ===================================================================
11505 dnl Zip must be a specific type for different build types.
11506 dnl ===================================================================
11507 if test $build_os = cygwin; then
11508     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
11509         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
11510     fi
11513 dnl ===================================================================
11514 dnl We need touch with -h option support.
11515 dnl ===================================================================
11516 AC_PATH_PROG(TOUCH, touch)
11517 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
11518 touch "$WARNINGS_FILE"
11519 if ! "$TOUCH" -h "$WARNINGS_FILE" 2>/dev/null > /dev/null; then
11520     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],,)
11523 dnl ===================================================================
11524 dnl Check for system epoxy
11525 dnl ===================================================================
11526 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
11528 dnl ===================================================================
11529 dnl Set vcl option: coordinate device in double or sal_Int32
11530 dnl ===================================================================
11532 dnl disabled for now, we don't want subtle differences between OSs
11533 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
11534 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
11535 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
11536 dnl     AC_MSG_RESULT([double])
11537 dnl else
11538 dnl     AC_MSG_RESULT([sal_Int32])
11539 dnl fi
11541 dnl ===================================================================
11542 dnl Show which vclplugs will be built.
11543 dnl ===================================================================
11544 R=""
11545 if test "$USING_X11" != TRUE; then
11546     enable_gtk3=no
11549 ENABLE_GTK3=""
11550 if test "x$enable_gtk3" = "xyes"; then
11551     ENABLE_GTK3="TRUE"
11552     AC_DEFINE(ENABLE_GTK3)
11553     R="$R gtk3"
11555 AC_SUBST(ENABLE_GTK3)
11557 ENABLE_GTK3_KDE5=""
11558 if test "x$enable_gtk3_kde5" = "xyes"; then
11559     ENABLE_GTK3_KDE5="TRUE"
11560     AC_DEFINE(ENABLE_GTK3_KDE5)
11561     R="$R gtk3_kde5"
11563 AC_SUBST(ENABLE_GTK3_KDE5)
11565 ENABLE_GTK4=""
11566 if test "x$enable_gtk4" = "xyes"; then
11567     ENABLE_GTK4="TRUE"
11568     AC_DEFINE(ENABLE_GTK4)
11569     R="$R gtk4"
11571 AC_SUBST(ENABLE_GTK4)
11573 ENABLE_QT5=""
11574 if test "x$enable_qt5" = "xyes"; then
11575     ENABLE_QT5="TRUE"
11576     AC_DEFINE(ENABLE_QT5)
11577     R="$R qt5"
11579 AC_SUBST(ENABLE_QT5)
11581 ENABLE_KF5=""
11582 if test "x$enable_kf5" = "xyes"; then
11583     ENABLE_KF5="TRUE"
11584     AC_DEFINE(ENABLE_KF5)
11585     R="$R kf5"
11587 AC_SUBST(ENABLE_KF5)
11589 if test "x$USING_X11" = "xyes"; then
11590     R="$R gen"
11593 if test "$_os" = "WINNT"; then
11594     R="$R win"
11595 elif test "$_os" = "Darwin"; then
11596     R="$R osx"
11597 elif test "$_os" = "iOS"; then
11598     R="ios"
11599 elif test "$_os" = Android; then
11600     R="android"
11603 build_vcl_plugins="$R"
11604 if test -z "$build_vcl_plugins"; then
11605     build_vcl_plugins=" none"
11607 AC_MSG_NOTICE([VCLplugs to be built:${build_vcl_plugins}])
11608 VCL_PLUGIN_INFO=$R
11609 AC_SUBST([VCL_PLUGIN_INFO])
11611 dnl ===================================================================
11612 dnl Check for GTK libraries
11613 dnl ===================================================================
11615 GTK3_CFLAGS=""
11616 GTK3_LIBS=""
11617 if test "$test_gtk3" = yes -a "x$enable_gtk3" = "xyes" -o "x$enable_gtk3_kde5" = "xyes"; then
11618     if test "$with_system_cairo" = no; then
11619         add_warning 'Non-system cairo combined with gtk3 is assumed to cause trouble; proceed at your own risk.'
11620     fi
11621     : ${with_system_cairo:=yes}
11622     PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.20 gtk+-unix-print-3.0 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo)
11623     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11624     GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
11625     FilterLibs "${GTK3_LIBS}"
11626     GTK3_LIBS="${filteredlibs}"
11628     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
11629     if test "$with_system_epoxy" != "yes"; then
11630         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
11631         AC_CHECK_HEADER(EGL/eglplatform.h, [],
11632                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
11633     fi
11635 AC_SUBST(GTK3_LIBS)
11636 AC_SUBST(GTK3_CFLAGS)
11638 GTK4_CFLAGS=""
11639 GTK4_LIBS=""
11640 if test "$test_gtk4" = yes -a "x$enable_gtk4" = "xyes"; then
11641     if test "$with_system_cairo" = no; then
11642         add_warning 'Non-system cairo combined with gtk4 is assumed to cause trouble; proceed at your own risk.'
11643     fi
11644     : ${with_system_cairo:=yes}
11645     PKG_CHECK_MODULES(GTK4, gtk4 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo atk)
11646     GTK4_CFLAGS=$(printf '%s' "$GTK4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11647     GTK4_CFLAGS="$GTK4_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
11648     FilterLibs "${GTK4_LIBS}"
11649     GTK4_LIBS="${filteredlibs}"
11651     dnl We require egl only for the gtk4 plugin. Otherwise we use glx.
11652     if test "$with_system_epoxy" != "yes"; then
11653         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
11654         AC_CHECK_HEADER(EGL/eglplatform.h, [],
11655                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
11656     fi
11658 AC_SUBST(GTK4_LIBS)
11659 AC_SUBST(GTK4_CFLAGS)
11661 if test "$enable_introspection" = yes; then
11662     if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
11663         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
11664     else
11665         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
11666     fi
11669 dnl ===================================================================
11670 dnl check for dbus support
11671 dnl ===================================================================
11672 ENABLE_DBUS=""
11673 DBUS_CFLAGS=""
11674 DBUS_LIBS=""
11675 DBUS_GLIB_CFLAGS=""
11676 DBUS_GLIB_LIBS=""
11677 DBUS_HAVE_GLIB=""
11679 if test "$enable_dbus" = "no"; then
11680     test_dbus=no
11683 AC_MSG_CHECKING([whether to enable DBUS support])
11684 if test "$test_dbus" = "yes"; then
11685     ENABLE_DBUS="TRUE"
11686     AC_MSG_RESULT([yes])
11687     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
11688     AC_DEFINE(ENABLE_DBUS)
11689     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11690     FilterLibs "${DBUS_LIBS}"
11691     DBUS_LIBS="${filteredlibs}"
11693     # Glib is needed for BluetoothServer
11694     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
11695     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
11696         [
11697             DBUS_HAVE_GLIB="TRUE"
11698             AC_DEFINE(DBUS_HAVE_GLIB,1)
11699         ],
11700         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
11701     )
11702 else
11703     AC_MSG_RESULT([no])
11706 AC_SUBST(ENABLE_DBUS)
11707 AC_SUBST(DBUS_CFLAGS)
11708 AC_SUBST(DBUS_LIBS)
11709 AC_SUBST(DBUS_GLIB_CFLAGS)
11710 AC_SUBST(DBUS_GLIB_LIBS)
11711 AC_SUBST(DBUS_HAVE_GLIB)
11713 AC_MSG_CHECKING([whether to enable Impress remote control])
11714 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
11715     AC_MSG_RESULT([yes])
11716     ENABLE_SDREMOTE=TRUE
11717     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
11719     if test $OS = MACOSX && test "$MACOSX_SDK_VERSION" -ge 101500; then
11720         # The Bluetooth code doesn't compile with macOS SDK 10.15
11721         if test "$enable_sdremote_bluetooth" = yes; then
11722             AC_MSG_ERROR([macOS SDK $with_macosx_sdk does not currently support --enable-sdremote-bluetooth])
11723         fi
11724         enable_sdremote_bluetooth=no
11725     fi
11726     # If not explicitly enabled or disabled, default
11727     if test -z "$enable_sdremote_bluetooth"; then
11728         case "$OS" in
11729         LINUX|MACOSX|WNT)
11730             # Default to yes for these
11731             enable_sdremote_bluetooth=yes
11732             ;;
11733         *)
11734             # otherwise no
11735             enable_sdremote_bluetooth=no
11736             ;;
11737         esac
11738     fi
11739     # $enable_sdremote_bluetooth is guaranteed non-empty now
11741     if test "$enable_sdremote_bluetooth" != "no"; then
11742         if test "$OS" = "LINUX"; then
11743             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
11744                 AC_MSG_RESULT([yes])
11745                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
11746                 dnl ===================================================================
11747                 dnl Check for system bluez
11748                 dnl ===================================================================
11749                 AC_MSG_CHECKING([which Bluetooth header to use])
11750                 if test "$with_system_bluez" = "yes"; then
11751                     AC_MSG_RESULT([external])
11752                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
11753                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
11754                     SYSTEM_BLUEZ=TRUE
11755                 else
11756                     AC_MSG_RESULT([internal])
11757                     SYSTEM_BLUEZ=
11758                 fi
11759             else
11760                 AC_MSG_RESULT([no, dbus disabled])
11761                 ENABLE_SDREMOTE_BLUETOOTH=
11762                 SYSTEM_BLUEZ=
11763             fi
11764         else
11765             AC_MSG_RESULT([yes])
11766             ENABLE_SDREMOTE_BLUETOOTH=TRUE
11767             SYSTEM_BLUEZ=
11768         fi
11769     else
11770         AC_MSG_RESULT([no])
11771         ENABLE_SDREMOTE_BLUETOOTH=
11772         SYSTEM_BLUEZ=
11773     fi
11774 else
11775     ENABLE_SDREMOTE=
11776     SYSTEM_BLUEZ=
11777     AC_MSG_RESULT([no])
11779 AC_SUBST(ENABLE_SDREMOTE)
11780 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
11781 AC_SUBST(SYSTEM_BLUEZ)
11783 dnl ===================================================================
11784 dnl Check whether to enable GIO support
11785 dnl ===================================================================
11786 if test "$ENABLE_GTK4" = "TRUE" -o "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
11787     AC_MSG_CHECKING([whether to enable GIO support])
11788     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
11789         dnl Need at least 2.26 for the dbus support.
11790         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
11791                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
11792         if test "$ENABLE_GIO" = "TRUE"; then
11793             AC_DEFINE(ENABLE_GIO)
11794             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11795             FilterLibs "${GIO_LIBS}"
11796             GIO_LIBS="${filteredlibs}"
11797         fi
11798     else
11799         AC_MSG_RESULT([no])
11800     fi
11802 AC_SUBST(ENABLE_GIO)
11803 AC_SUBST(GIO_CFLAGS)
11804 AC_SUBST(GIO_LIBS)
11807 dnl ===================================================================
11809 SPLIT_APP_MODULES=""
11810 if test "$enable_split_app_modules" = "yes"; then
11811     SPLIT_APP_MODULES="TRUE"
11813 AC_SUBST(SPLIT_APP_MODULES)
11815 SPLIT_OPT_FEATURES=""
11816 if test "$enable_split_opt_features" = "yes"; then
11817     SPLIT_OPT_FEATURES="TRUE"
11819 AC_SUBST(SPLIT_OPT_FEATURES)
11821 dnl ===================================================================
11822 dnl Check whether the GStreamer libraries are available.
11823 dnl ===================================================================
11825 ENABLE_GSTREAMER_1_0=""
11827 if test "$test_gstreamer_1_0" = yes; then
11829     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
11830     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
11831         ENABLE_GSTREAMER_1_0="TRUE"
11832         AC_MSG_RESULT([yes])
11833         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
11834         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11835         FilterLibs "${GSTREAMER_1_0_LIBS}"
11836         GSTREAMER_1_0_LIBS="${filteredlibs}"
11837         AC_DEFINE(ENABLE_GSTREAMER_1_0)
11838     else
11839         AC_MSG_RESULT([no])
11840     fi
11842 AC_SUBST(GSTREAMER_1_0_CFLAGS)
11843 AC_SUBST(GSTREAMER_1_0_LIBS)
11844 AC_SUBST(ENABLE_GSTREAMER_1_0)
11846 ENABLE_OPENGL_TRANSITIONS=
11847 ENABLE_OPENGL_CANVAS=
11848 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
11849    : # disable
11850 elif test "$_os" = "Darwin"; then
11851     # We use frameworks on macOS, no need for detail checks
11852     ENABLE_OPENGL_TRANSITIONS=TRUE
11853     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11854     ENABLE_OPENGL_CANVAS=TRUE
11855 elif test $_os = WINNT; then
11856     ENABLE_OPENGL_TRANSITIONS=TRUE
11857     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11858     ENABLE_OPENGL_CANVAS=TRUE
11859 else
11860     if test "$USING_X11" = TRUE; then
11861         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
11862         ENABLE_OPENGL_TRANSITIONS=TRUE
11863         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11864         ENABLE_OPENGL_CANVAS=TRUE
11865     fi
11868 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
11869 AC_SUBST(ENABLE_OPENGL_CANVAS)
11871 dnl =================================================
11872 dnl Check whether to build with OpenCL support.
11873 dnl =================================================
11875 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE" -a "$enable_opencl" = "yes"; then
11876     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
11877     # platform (optional at run-time, used through clew).
11878     BUILD_TYPE="$BUILD_TYPE OPENCL"
11879     AC_DEFINE(HAVE_FEATURE_OPENCL)
11882 dnl =================================================
11883 dnl Check whether to build with dconf support.
11884 dnl =================================================
11886 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
11887     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
11888         if test "$enable_dconf" = yes; then
11889             AC_MSG_ERROR([dconf not found])
11890         else
11891             enable_dconf=no
11892         fi])
11894 AC_MSG_CHECKING([whether to enable dconf])
11895 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
11896     DCONF_CFLAGS=
11897     DCONF_LIBS=
11898     ENABLE_DCONF=
11899     AC_MSG_RESULT([no])
11900 else
11901     ENABLE_DCONF=TRUE
11902     AC_DEFINE(ENABLE_DCONF)
11903     AC_MSG_RESULT([yes])
11905 AC_SUBST([DCONF_CFLAGS])
11906 AC_SUBST([DCONF_LIBS])
11907 AC_SUBST([ENABLE_DCONF])
11909 # pdf import?
11910 AC_MSG_CHECKING([whether to build the PDF import feature])
11911 ENABLE_PDFIMPORT=
11912 if test -z "$enable_pdfimport" -o "$enable_pdfimport" = yes; then
11913     AC_MSG_RESULT([yes])
11914     ENABLE_PDFIMPORT=TRUE
11915     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
11916 else
11917     AC_MSG_RESULT([no])
11920 # Pdfium?
11921 AC_MSG_CHECKING([whether to build PDFium])
11922 ENABLE_PDFIUM=
11923 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
11924     AC_MSG_RESULT([yes])
11925     ENABLE_PDFIUM=TRUE
11926     BUILD_TYPE="$BUILD_TYPE PDFIUM"
11927 else
11928     AC_MSG_RESULT([no])
11930 AC_SUBST(ENABLE_PDFIUM)
11932 dnl ===================================================================
11933 dnl Check for poppler
11934 dnl ===================================================================
11935 ENABLE_POPPLER=
11936 AC_MSG_CHECKING([whether to build Poppler])
11937 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" -a $_os != Android \) -o "$enable_poppler" = yes; then
11938     AC_MSG_RESULT([yes])
11939     ENABLE_POPPLER=TRUE
11940     AC_DEFINE(HAVE_FEATURE_POPPLER)
11941 else
11942     AC_MSG_RESULT([no])
11944 AC_SUBST(ENABLE_POPPLER)
11946 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
11947     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
11950 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
11951     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
11954 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
11955     dnl ===================================================================
11956     dnl Check for system poppler
11957     dnl ===================================================================
11958     AC_MSG_CHECKING([which PDF import poppler to use])
11959     if test "$with_system_poppler" = "yes"; then
11960         AC_MSG_RESULT([external])
11961         SYSTEM_POPPLER=TRUE
11962         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
11963         AC_LANG_PUSH([C++])
11964         save_CXXFLAGS=$CXXFLAGS
11965         save_CPPFLAGS=$CPPFLAGS
11966         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
11967         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
11968         AC_CHECK_HEADER([cpp/poppler-version.h],
11969             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
11970             [])
11971         CXXFLAGS=$save_CXXFLAGS
11972         CPPFLAGS=$save_CPPFLAGS
11973         AC_LANG_POP([C++])
11974         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11976         FilterLibs "${POPPLER_LIBS}"
11977         POPPLER_LIBS="${filteredlibs}"
11978     else
11979         AC_MSG_RESULT([internal])
11980         SYSTEM_POPPLER=
11981         BUILD_TYPE="$BUILD_TYPE POPPLER"
11982         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
11983     fi
11984     AC_DEFINE([ENABLE_PDFIMPORT],1)
11986 AC_SUBST(ENABLE_PDFIMPORT)
11987 AC_SUBST(SYSTEM_POPPLER)
11988 AC_SUBST(POPPLER_CFLAGS)
11989 AC_SUBST(POPPLER_LIBS)
11991 # Skia?
11992 ENABLE_SKIA=
11993 if test "$enable_skia" != "no" -a "$build_skia" = "yes" -a -z "$DISABLE_GUI"; then
11994     # Skia now requires at least freetype2 >= 2.8.1, which is less that what LO requires as system freetype.
11995     if test "$SYSTEM_FREETYPE" = TRUE; then
11996         PKG_CHECK_EXISTS(freetype2 >= 21.0.15, # 21.0.15 = 2.8.1
11997             [skia_freetype_ok=yes],
11998             [skia_freetype_ok=no])
11999     else # internal is ok
12000         skia_freetype_ok=yes
12001     fi
12002     AC_MSG_CHECKING([whether to build Skia])
12003     if test "$skia_freetype_ok" = "yes"; then
12004         if test "$enable_skia" = "debug"; then
12005             AC_MSG_RESULT([yes (debug)])
12006             ENABLE_SKIA_DEBUG=TRUE
12007         else
12008             AC_MSG_RESULT([yes])
12009             ENABLE_SKIA_DEBUG=
12010         fi
12011         ENABLE_SKIA=TRUE
12012         AC_DEFINE(HAVE_FEATURE_SKIA)
12013         BUILD_TYPE="$BUILD_TYPE SKIA"
12015         if test "$OS" = "MACOSX"; then
12016             AC_DEFINE(SK_SUPPORT_GPU,1)
12017             AC_DEFINE(SK_METAL,1)
12018             SKIA_GPU=METAL
12019             AC_SUBST(SKIA_GPU)
12020         else
12021             AC_DEFINE(SK_SUPPORT_GPU,1)
12022             AC_DEFINE(SK_VULKAN,1)
12023             SKIA_GPU=VULKAN
12024             AC_SUBST(SKIA_GPU)
12025         fi
12027         if test -n "$MAC_OS_X_VERSION_MIN_REQUIRED" && test "$MAC_OS_X_VERSION_MIN_REQUIRED" -lt "101200"; then
12028             SKIA_DISABLE_VMA_USE_STL_SHARED_MUTEX=1
12029             AC_SUBST(SKIA_DISABLE_VMA_USE_STL_SHARED_MUTEX)
12030         fi
12031     else
12032         AC_MSG_RESULT([no (freetype too old)])
12033         add_warning "freetype version is too old for Skia library, at least 2.8.1 required, Skia support disabled"
12034     fi
12036 else
12037     AC_MSG_CHECKING([whether to build Skia])
12038     AC_MSG_RESULT([no])
12040 AC_SUBST(ENABLE_SKIA)
12041 AC_SUBST(ENABLE_SKIA_DEBUG)
12043 LO_CLANG_CXXFLAGS_INTRINSICS_SSE2=
12044 LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3=
12045 LO_CLANG_CXXFLAGS_INTRINSICS_SSE41=
12046 LO_CLANG_CXXFLAGS_INTRINSICS_SSE42=
12047 LO_CLANG_CXXFLAGS_INTRINSICS_AVX=
12048 LO_CLANG_CXXFLAGS_INTRINSICS_AVX2=
12049 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512=
12050 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F=
12051 LO_CLANG_CXXFLAGS_INTRINSICS_F16C=
12052 LO_CLANG_CXXFLAGS_INTRINSICS_FMA=
12053 HAVE_LO_CLANG_DLLEXPORTINLINES=
12055 if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE; then
12056     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12057         AC_MSG_CHECKING([for Clang])
12058         AC_MSG_RESULT([$LO_CLANG_CC / $LO_CLANG_CXX])
12059     else
12060         if test "$_os" = "WINNT"; then
12061             AC_MSG_CHECKING([for clang-cl])
12062             if test -x "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"; then
12063                 LO_CLANG_CC=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"`
12064                 dnl explicitly set -m32/-m64
12065                 LO_CLANG_CC="$LO_CLANG_CC -m$WIN_HOST_BITS"
12066                 LO_CLANG_CXX="$LO_CLANG_CC"
12067                 AC_MSG_RESULT([$LO_CLANG_CC])
12068             else
12069                 AC_MSG_RESULT([no])
12070             fi
12071         else
12072             AC_CHECK_PROG(LO_CLANG_CC,clang,clang,[])
12073             AC_CHECK_PROG(LO_CLANG_CXX,clang++,clang++,[])
12074         fi
12075     fi
12076     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12077         clang2_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $LO_CLANG_CC -E - | tail -1 | sed 's/ //g'`
12078         clang2_ver=`echo "$clang2_version" | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
12079         if test "$clang2_ver" -lt 50002; then
12080             AC_MSG_WARN(["$clang2_version" is too old or unrecognized, must be at least Clang 5.0.2])
12081             LO_CLANG_CC=
12082             LO_CLANG_CXX=
12083         fi
12084     fi
12085     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX" -a "$_os" = "WINNT"; then
12086         save_CXX="$CXX"
12087         CXX="$LO_CLANG_CXX"
12088         AC_MSG_CHECKING([whether $CXX supports -Zc:dllexportInlines-])
12089         AC_LANG_PUSH([C++])
12090         save_CXXFLAGS=$CXXFLAGS
12091         CXXFLAGS="$CXXFLAGS -Werror -Zc:dllexportInlines-"
12092         AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
12093                 HAVE_LO_CLANG_DLLEXPORTINLINES=TRUE
12094                 AC_MSG_RESULT([yes])
12095             ], [AC_MSG_RESULT([no])])
12096         CXXFLAGS=$save_CXXFLAGS
12097         AC_LANG_POP([C++])
12098         CXX="$save_CXX"
12099         if test -z "$HAVE_LO_CLANG_DLLEXPORTINLINES"; then
12100             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.])
12101         fi
12102     fi
12103     if test -z "$LO_CLANG_CC" -o -z "$LO_CLANG_CXX"; then
12104         # Skia is the default on Windows, so hard-require Clang.
12105         # Elsewhere it's used just by the 'gen' VCL backend which is rarely used.
12106         if test "$_os" = "WINNT"; then
12107             AC_MSG_ERROR([Clang compiler not found. The Skia library needs to be built using Clang.])
12108         else
12109             AC_MSG_WARN([Clang compiler not found.])
12110         fi
12111     else
12113         save_CXX="$CXX"
12114         CXX="$LO_CLANG_CXX"
12115         # copy&paste (and adjust) of intrinsics checks, since MSVC's -arch doesn't work well for Clang-cl
12116         flag_sse2=-msse2
12117         flag_ssse3=-mssse3
12118         flag_sse41=-msse4.1
12119         flag_sse42=-msse4.2
12120         flag_avx=-mavx
12121         flag_avx2=-mavx2
12122         flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
12123         flag_avx512f=-mavx512f
12124         flag_f16c=-mf16c
12125         flag_fma=-mfma
12127         AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
12128         AC_LANG_PUSH([C++])
12129         save_CXXFLAGS=$CXXFLAGS
12130         CXXFLAGS="$CXXFLAGS $flag_sse2"
12131         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12132             #include <emmintrin.h>
12133             int main () {
12134                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12135                 c = _mm_xor_si128 (a, b);
12136                 return 0;
12137             }
12138             ])],
12139             [can_compile_sse2=yes],
12140             [can_compile_sse2=no])
12141         AC_LANG_POP([C++])
12142         CXXFLAGS=$save_CXXFLAGS
12143         AC_MSG_RESULT([${can_compile_sse2}])
12144         if test "${can_compile_sse2}" = "yes" ; then
12145             LO_CLANG_CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
12146         fi
12148         AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
12149         AC_LANG_PUSH([C++])
12150         save_CXXFLAGS=$CXXFLAGS
12151         CXXFLAGS="$CXXFLAGS $flag_ssse3"
12152         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12153             #include <tmmintrin.h>
12154             int main () {
12155                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12156                 c = _mm_maddubs_epi16 (a, b);
12157                 return 0;
12158             }
12159             ])],
12160             [can_compile_ssse3=yes],
12161             [can_compile_ssse3=no])
12162         AC_LANG_POP([C++])
12163         CXXFLAGS=$save_CXXFLAGS
12164         AC_MSG_RESULT([${can_compile_ssse3}])
12165         if test "${can_compile_ssse3}" = "yes" ; then
12166             LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
12167         fi
12169         AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
12170         AC_LANG_PUSH([C++])
12171         save_CXXFLAGS=$CXXFLAGS
12172         CXXFLAGS="$CXXFLAGS $flag_sse41"
12173         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12174             #include <smmintrin.h>
12175             int main () {
12176                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12177                 c = _mm_cmpeq_epi64 (a, b);
12178                 return 0;
12179             }
12180             ])],
12181             [can_compile_sse41=yes],
12182             [can_compile_sse41=no])
12183         AC_LANG_POP([C++])
12184         CXXFLAGS=$save_CXXFLAGS
12185         AC_MSG_RESULT([${can_compile_sse41}])
12186         if test "${can_compile_sse41}" = "yes" ; then
12187             LO_CLANG_CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
12188         fi
12190         AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
12191         AC_LANG_PUSH([C++])
12192         save_CXXFLAGS=$CXXFLAGS
12193         CXXFLAGS="$CXXFLAGS $flag_sse42"
12194         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12195             #include <nmmintrin.h>
12196             int main () {
12197                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12198                 c = _mm_cmpgt_epi64 (a, b);
12199                 return 0;
12200             }
12201             ])],
12202             [can_compile_sse42=yes],
12203             [can_compile_sse42=no])
12204         AC_LANG_POP([C++])
12205         CXXFLAGS=$save_CXXFLAGS
12206         AC_MSG_RESULT([${can_compile_sse42}])
12207         if test "${can_compile_sse42}" = "yes" ; then
12208             LO_CLANG_CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
12209         fi
12211         AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
12212         AC_LANG_PUSH([C++])
12213         save_CXXFLAGS=$CXXFLAGS
12214         CXXFLAGS="$CXXFLAGS $flag_avx"
12215         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12216             #include <immintrin.h>
12217             int main () {
12218                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
12219                 c = _mm256_xor_ps(a, b);
12220                 return 0;
12221             }
12222             ])],
12223             [can_compile_avx=yes],
12224             [can_compile_avx=no])
12225         AC_LANG_POP([C++])
12226         CXXFLAGS=$save_CXXFLAGS
12227         AC_MSG_RESULT([${can_compile_avx}])
12228         if test "${can_compile_avx}" = "yes" ; then
12229             LO_CLANG_CXXFLAGS_INTRINSICS_AVX="$flag_avx"
12230         fi
12232         AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
12233         AC_LANG_PUSH([C++])
12234         save_CXXFLAGS=$CXXFLAGS
12235         CXXFLAGS="$CXXFLAGS $flag_avx2"
12236         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12237             #include <immintrin.h>
12238             int main () {
12239                 __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
12240                 c = _mm256_maddubs_epi16(a, b);
12241                 return 0;
12242             }
12243             ])],
12244             [can_compile_avx2=yes],
12245             [can_compile_avx2=no])
12246         AC_LANG_POP([C++])
12247         CXXFLAGS=$save_CXXFLAGS
12248         AC_MSG_RESULT([${can_compile_avx2}])
12249         if test "${can_compile_avx2}" = "yes" ; then
12250             LO_CLANG_CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
12251         fi
12253         AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
12254         AC_LANG_PUSH([C++])
12255         save_CXXFLAGS=$CXXFLAGS
12256         CXXFLAGS="$CXXFLAGS $flag_avx512"
12257         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12258             #include <immintrin.h>
12259             int main () {
12260                 __m512i a = _mm512_loadu_si512(0);
12261                 return 0;
12262             }
12263             ])],
12264             [can_compile_avx512=yes],
12265             [can_compile_avx512=no])
12266         AC_LANG_POP([C++])
12267         CXXFLAGS=$save_CXXFLAGS
12268         AC_MSG_RESULT([${can_compile_avx512}])
12269         if test "${can_compile_avx512}" = "yes" ; then
12270             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
12271             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F="$flag_avx512f"
12272         fi
12274         AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
12275         AC_LANG_PUSH([C++])
12276         save_CXXFLAGS=$CXXFLAGS
12277         CXXFLAGS="$CXXFLAGS $flag_f16c"
12278         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12279             #include <immintrin.h>
12280             int main () {
12281                 __m128i a = _mm_set1_epi32 (0);
12282                 __m128 c;
12283                 c = _mm_cvtph_ps(a);
12284                 return 0;
12285             }
12286             ])],
12287             [can_compile_f16c=yes],
12288             [can_compile_f16c=no])
12289         AC_LANG_POP([C++])
12290         CXXFLAGS=$save_CXXFLAGS
12291         AC_MSG_RESULT([${can_compile_f16c}])
12292         if test "${can_compile_f16c}" = "yes" ; then
12293             LO_CLANG_CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
12294         fi
12296         AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
12297         AC_LANG_PUSH([C++])
12298         save_CXXFLAGS=$CXXFLAGS
12299         CXXFLAGS="$CXXFLAGS $flag_fma"
12300         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12301             #include <immintrin.h>
12302             int main () {
12303                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
12304                 d = _mm256_fmadd_ps(a, b, c);
12305                 return 0;
12306             }
12307             ])],
12308             [can_compile_fma=yes],
12309             [can_compile_fma=no])
12310         AC_LANG_POP([C++])
12311         CXXFLAGS=$save_CXXFLAGS
12312         AC_MSG_RESULT([${can_compile_fma}])
12313         if test "${can_compile_fma}" = "yes" ; then
12314             LO_CLANG_CXXFLAGS_INTRINSICS_FMA="$flag_fma"
12315         fi
12317         CXX="$save_CXX"
12318     fi
12321 # prefix LO_CLANG_CC/LO_CLANG_CXX with ccache if needed
12323 UNCACHED_CLANG_CC="$LO_CLANG_CC"
12324 UNCACHED_CLANG_CXX="$LO_CLANG_CXX"
12325 if test "$CCACHE" != "" -a -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12326     AC_MSG_CHECKING([whether $LO_CLANG_CC is already ccached])
12327     AC_LANG_PUSH([C])
12328     save_CC="$CC"
12329     CC="$LO_CLANG_CC"
12330     save_CFLAGS=$CFLAGS
12331     CFLAGS="$CFLAGS --ccache-skip -O2"
12332     dnl an empty program will do, we're checking the compiler flags
12333     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12334                       [use_ccache=yes], [use_ccache=no])
12335     CFLAGS=$save_CFLAGS
12336     CC=$save_CC
12337     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12338         AC_MSG_RESULT([yes])
12339     else
12340         LO_CLANG_CC="$CCACHE $LO_CLANG_CC"
12341         AC_MSG_RESULT([no])
12342     fi
12343     AC_LANG_POP([C])
12345     AC_MSG_CHECKING([whether $LO_CLANG_CXX is already ccached])
12346     AC_LANG_PUSH([C++])
12347     save_CXX="$CXX"
12348     CXX="$LO_CLANG_CXX"
12349     save_CXXFLAGS=$CXXFLAGS
12350     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
12351     dnl an empty program will do, we're checking the compiler flags
12352     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12353                       [use_ccache=yes], [use_ccache=no])
12354     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12355         AC_MSG_RESULT([yes])
12356     else
12357         LO_CLANG_CXX="$CCACHE $LO_CLANG_CXX"
12358         AC_MSG_RESULT([no])
12359     fi
12360     CXXFLAGS=$save_CXXFLAGS
12361     CXX=$save_CXX
12362     AC_LANG_POP([C++])
12365 AC_SUBST(UNCACHED_CC)
12366 AC_SUBST(UNCACHED_CXX)
12367 AC_SUBST(LO_CLANG_CC)
12368 AC_SUBST(LO_CLANG_CXX)
12369 AC_SUBST(UNCACHED_CLANG_CC)
12370 AC_SUBST(UNCACHED_CLANG_CXX)
12371 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE2)
12372 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3)
12373 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE41)
12374 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE42)
12375 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX)
12376 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX2)
12377 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512)
12378 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512F)
12379 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_F16C)
12380 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_FMA)
12381 AC_SUBST(CLANG_USE_LD)
12382 AC_SUBST([HAVE_LO_CLANG_DLLEXPORTINLINES])
12384 SYSTEM_GPGMEPP=
12386 if test "$enable_gpgmepp" = no; then
12387     AC_MSG_CHECKING([whether to enable gpgmepp])
12388     AC_MSG_RESULT([no])
12389 elif test "$enable_mpl_subset" = "yes"; then
12390     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
12391     AC_MSG_RESULT([yes])
12392 elif test "$enable_fuzzers" = "yes"; then
12393     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
12394     AC_MSG_RESULT([yes])
12395 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
12396     dnl ===================================================================
12397     dnl Check for system gpgme
12398     dnl ===================================================================
12399     AC_MSG_CHECKING([which gpgmepp to use])
12400     if test "$with_system_gpgmepp" = "yes"; then
12401         AC_MSG_RESULT([external])
12402         SYSTEM_GPGMEPP=TRUE
12404         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
12405         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
12406             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
12407         # progress_callback is the only func with plain C linkage
12408         # checking for it also filters out older, KDE-dependent libgpgmepp versions
12409         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
12410             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
12411         AC_CHECK_HEADER(gpgme.h, [],
12412             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
12413     else
12414         AC_MSG_RESULT([internal])
12415         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
12416         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
12418         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
12419         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
12420         if test "$_os" != "WINNT"; then
12421             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
12422             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
12423         fi
12424     fi
12425     ENABLE_GPGMEPP=TRUE
12426     AC_DEFINE([HAVE_FEATURE_GPGME])
12427     AC_PATH_PROG(GPG, gpg)
12428     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
12429     # so let's exclude that manually for the moment
12430     if test -n "$GPG" -a "$_os" != "WINNT"; then
12431         # make sure we not only have a working gpgme, but a full working
12432         # gpg installation to run OpenPGP signature verification
12433         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
12434     fi
12435     if test "$_os" = "Linux"; then
12436       uid=`id -u`
12437       AC_MSG_CHECKING([for /run/user/$uid])
12438       if test -d /run/user/$uid; then
12439         AC_MSG_RESULT([yes])
12440         AC_PATH_PROG(GPGCONF, gpgconf)
12442         # Older versions of gpgconf are not working as expected, since
12443         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
12444         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
12445         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
12446         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
12447         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
12448         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
12449         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
12450           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
12451           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
12452           if $GPGCONF --dump-options > /dev/null ; then
12453             if $GPGCONF --dump-options | grep -q create-socketdir ; then
12454               AC_MSG_RESULT([yes])
12455               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
12456               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
12457             else
12458               AC_MSG_RESULT([no])
12459             fi
12460           else
12461             AC_MSG_RESULT([no. missing or broken gpgconf?])
12462           fi
12463         else
12464           AC_MSG_RESULT([no, $GPGCONF_VERSION])
12465         fi
12466       else
12467         AC_MSG_RESULT([no])
12468      fi
12469    fi
12471 AC_SUBST(ENABLE_GPGMEPP)
12472 AC_SUBST(SYSTEM_GPGMEPP)
12473 AC_SUBST(GPG_ERROR_CFLAGS)
12474 AC_SUBST(GPG_ERROR_LIBS)
12475 AC_SUBST(LIBASSUAN_CFLAGS)
12476 AC_SUBST(LIBASSUAN_LIBS)
12477 AC_SUBST(GPGMEPP_CFLAGS)
12478 AC_SUBST(GPGMEPP_LIBS)
12480 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
12481 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
12482     AC_MSG_RESULT([yes])
12483     ENABLE_MEDIAWIKI=TRUE
12484     BUILD_TYPE="$BUILD_TYPE XSLTML"
12485     if test  "x$with_java" = "xno"; then
12486         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
12487     fi
12488 else
12489     AC_MSG_RESULT([no])
12490     ENABLE_MEDIAWIKI=
12491     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
12493 AC_SUBST(ENABLE_MEDIAWIKI)
12495 AC_MSG_CHECKING([whether to build the Report Builder])
12496 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12497     AC_MSG_RESULT([yes])
12498     ENABLE_REPORTBUILDER=TRUE
12499     AC_MSG_CHECKING([which jfreereport libs to use])
12500     if test "$with_system_jfreereport" = "yes"; then
12501         SYSTEM_JFREEREPORT=TRUE
12502         AC_MSG_RESULT([external])
12503         if test -z $SAC_JAR; then
12504             SAC_JAR=/usr/share/java/sac.jar
12505         fi
12506         if ! test -f $SAC_JAR; then
12507              AC_MSG_ERROR(sac.jar not found.)
12508         fi
12510         if test -z $LIBXML_JAR; then
12511             if test -f /usr/share/java/libxml-1.0.0.jar; then
12512                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
12513             elif test -f /usr/share/java/libxml.jar; then
12514                 LIBXML_JAR=/usr/share/java/libxml.jar
12515             else
12516                 AC_MSG_ERROR(libxml.jar replacement not found.)
12517             fi
12518         elif ! test -f $LIBXML_JAR; then
12519             AC_MSG_ERROR(libxml.jar not found.)
12520         fi
12522         if test -z $FLUTE_JAR; then
12523             if test -f /usr/share/java/flute-1.3.0.jar; then
12524                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
12525             elif test -f /usr/share/java/flute.jar; then
12526                 FLUTE_JAR=/usr/share/java/flute.jar
12527             else
12528                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
12529             fi
12530         elif ! test -f $FLUTE_JAR; then
12531             AC_MSG_ERROR(flute-1.3.0.jar not found.)
12532         fi
12534         if test -z $JFREEREPORT_JAR; then
12535             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
12536                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
12537             elif test -f /usr/share/java/flow-engine.jar; then
12538                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
12539             else
12540                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
12541             fi
12542         elif ! test -f  $JFREEREPORT_JAR; then
12543                 AC_MSG_ERROR(jfreereport.jar not found.)
12544         fi
12546         if test -z $LIBLAYOUT_JAR; then
12547             if test -f /usr/share/java/liblayout-0.2.9.jar; then
12548                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
12549             elif test -f /usr/share/java/liblayout.jar; then
12550                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
12551             else
12552                 AC_MSG_ERROR(liblayout.jar replacement not found.)
12553             fi
12554         elif ! test -f $LIBLAYOUT_JAR; then
12555                 AC_MSG_ERROR(liblayout.jar not found.)
12556         fi
12558         if test -z $LIBLOADER_JAR; then
12559             if test -f /usr/share/java/libloader-1.0.0.jar; then
12560                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
12561             elif test -f /usr/share/java/libloader.jar; then
12562                 LIBLOADER_JAR=/usr/share/java/libloader.jar
12563             else
12564                 AC_MSG_ERROR(libloader.jar replacement not found.)
12565             fi
12566         elif ! test -f  $LIBLOADER_JAR; then
12567             AC_MSG_ERROR(libloader.jar not found.)
12568         fi
12570         if test -z $LIBFORMULA_JAR; then
12571             if test -f /usr/share/java/libformula-0.2.0.jar; then
12572                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
12573             elif test -f /usr/share/java/libformula.jar; then
12574                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
12575             else
12576                 AC_MSG_ERROR(libformula.jar replacement not found.)
12577             fi
12578         elif ! test -f $LIBFORMULA_JAR; then
12579                 AC_MSG_ERROR(libformula.jar not found.)
12580         fi
12582         if test -z $LIBREPOSITORY_JAR; then
12583             if test -f /usr/share/java/librepository-1.0.0.jar; then
12584                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
12585             elif test -f /usr/share/java/librepository.jar; then
12586                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
12587             else
12588                 AC_MSG_ERROR(librepository.jar replacement not found.)
12589             fi
12590         elif ! test -f $LIBREPOSITORY_JAR; then
12591             AC_MSG_ERROR(librepository.jar not found.)
12592         fi
12594         if test -z $LIBFONTS_JAR; then
12595             if test -f /usr/share/java/libfonts-1.0.0.jar; then
12596                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
12597             elif test -f /usr/share/java/libfonts.jar; then
12598                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
12599             else
12600                 AC_MSG_ERROR(libfonts.jar replacement not found.)
12601             fi
12602         elif ! test -f $LIBFONTS_JAR; then
12603                 AC_MSG_ERROR(libfonts.jar not found.)
12604         fi
12606         if test -z $LIBSERIALIZER_JAR; then
12607             if test -f /usr/share/java/libserializer-1.0.0.jar; then
12608                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
12609             elif test -f /usr/share/java/libserializer.jar; then
12610                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
12611             else
12612                 AC_MSG_ERROR(libserializer.jar replacement not found.)
12613             fi
12614         elif ! test -f $LIBSERIALIZER_JAR; then
12615                 AC_MSG_ERROR(libserializer.jar not found.)
12616         fi
12618         if test -z $LIBBASE_JAR; then
12619             if test -f /usr/share/java/libbase-1.0.0.jar; then
12620                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
12621             elif test -f /usr/share/java/libbase.jar; then
12622                 LIBBASE_JAR=/usr/share/java/libbase.jar
12623             else
12624                 AC_MSG_ERROR(libbase.jar replacement not found.)
12625             fi
12626         elif ! test -f $LIBBASE_JAR; then
12627             AC_MSG_ERROR(libbase.jar not found.)
12628         fi
12630     else
12631         AC_MSG_RESULT([internal])
12632         SYSTEM_JFREEREPORT=
12633         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
12634         NEED_ANT=TRUE
12635     fi
12636 else
12637     AC_MSG_RESULT([no])
12638     ENABLE_REPORTBUILDER=
12639     SYSTEM_JFREEREPORT=
12641 AC_SUBST(ENABLE_REPORTBUILDER)
12642 AC_SUBST(SYSTEM_JFREEREPORT)
12643 AC_SUBST(SAC_JAR)
12644 AC_SUBST(LIBXML_JAR)
12645 AC_SUBST(FLUTE_JAR)
12646 AC_SUBST(JFREEREPORT_JAR)
12647 AC_SUBST(LIBBASE_JAR)
12648 AC_SUBST(LIBLAYOUT_JAR)
12649 AC_SUBST(LIBLOADER_JAR)
12650 AC_SUBST(LIBFORMULA_JAR)
12651 AC_SUBST(LIBREPOSITORY_JAR)
12652 AC_SUBST(LIBFONTS_JAR)
12653 AC_SUBST(LIBSERIALIZER_JAR)
12655 # scripting provider for BeanShell?
12656 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
12657 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
12658     AC_MSG_RESULT([yes])
12659     ENABLE_SCRIPTING_BEANSHELL=TRUE
12661     dnl ===================================================================
12662     dnl Check for system beanshell
12663     dnl ===================================================================
12664     AC_MSG_CHECKING([which beanshell to use])
12665     if test "$with_system_beanshell" = "yes"; then
12666         AC_MSG_RESULT([external])
12667         SYSTEM_BSH=TRUE
12668         if test -z $BSH_JAR; then
12669             BSH_JAR=/usr/share/java/bsh.jar
12670         fi
12671         if ! test -f $BSH_JAR; then
12672             AC_MSG_ERROR(bsh.jar not found.)
12673         fi
12674     else
12675         AC_MSG_RESULT([internal])
12676         SYSTEM_BSH=
12677         BUILD_TYPE="$BUILD_TYPE BSH"
12678     fi
12679 else
12680     AC_MSG_RESULT([no])
12681     ENABLE_SCRIPTING_BEANSHELL=
12682     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
12684 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
12685 AC_SUBST(SYSTEM_BSH)
12686 AC_SUBST(BSH_JAR)
12688 # scripting provider for JavaScript?
12689 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
12690 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
12691     AC_MSG_RESULT([yes])
12692     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
12694     dnl ===================================================================
12695     dnl Check for system rhino
12696     dnl ===================================================================
12697     AC_MSG_CHECKING([which rhino to use])
12698     if test "$with_system_rhino" = "yes"; then
12699         AC_MSG_RESULT([external])
12700         SYSTEM_RHINO=TRUE
12701         if test -z $RHINO_JAR; then
12702             RHINO_JAR=/usr/share/java/js.jar
12703         fi
12704         if ! test -f $RHINO_JAR; then
12705             AC_MSG_ERROR(js.jar not found.)
12706         fi
12707     else
12708         AC_MSG_RESULT([internal])
12709         SYSTEM_RHINO=
12710         BUILD_TYPE="$BUILD_TYPE RHINO"
12711         NEED_ANT=TRUE
12712     fi
12713 else
12714     AC_MSG_RESULT([no])
12715     ENABLE_SCRIPTING_JAVASCRIPT=
12716     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
12718 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
12719 AC_SUBST(SYSTEM_RHINO)
12720 AC_SUBST(RHINO_JAR)
12722 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
12723 # paths should be added to library search path. So lets put all 64-bit
12724 # platforms there.
12725 supports_multilib=
12726 case "$host_cpu" in
12727 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
12728     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
12729         supports_multilib="yes"
12730     fi
12731     ;;
12733     ;;
12734 esac
12736 dnl ===================================================================
12737 dnl QT5 Integration
12738 dnl ===================================================================
12740 QT5_CFLAGS=""
12741 QT5_LIBS=""
12742 QMAKE5="qmake"
12743 MOC5="moc"
12744 QT5_GOBJECT_CFLAGS=""
12745 QT5_GOBJECT_LIBS=""
12746 QT5_HAVE_GOBJECT=""
12747 QT5_PLATFORMS_SRCDIR=""
12748 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
12749         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
12750         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
12751 then
12752     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
12753     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
12755     if test -n "$supports_multilib"; then
12756         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
12757     fi
12759     qt5_test_include="QtWidgets/qapplication.h"
12760     if test "$_os" = "Emscripten"; then
12761         qt5_test_library="libQt5Widgets.a"
12762     else
12763         qt5_test_library="libQt5Widgets.so"
12764     fi
12766     dnl Check for qmake5
12767     if test -n "$QT5DIR"; then
12768         AC_PATH_PROG(QMAKE5, [qmake], no, [$QT5DIR/bin])
12769     else
12770         AC_PATH_PROGS(QMAKE5, [qmake-qt5 qmake], no)
12771     fi
12772     if test "$QMAKE5" = "no"; then
12773         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12774     else
12775         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
12776         if test -z "$qmake5_test_ver"; then
12777             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12778         fi
12779         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
12780         qt5_minimal_minor="6"
12781         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
12782             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
12783         else
12784             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
12785         fi
12786     fi
12788     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
12789     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
12790     qt5_platformsdir="`$QMAKE5 -query QT_INSTALL_PLUGINS`/platforms"
12791     QT5_PLATFORMS_SRCDIR="$qt5_platformsdir"
12793     AC_MSG_CHECKING([for Qt5 headers])
12794     qt5_incdir="no"
12795     for inc_dir in $qt5_incdirs; do
12796         if test -r "$inc_dir/$qt5_test_include"; then
12797             qt5_incdir="$inc_dir"
12798             break
12799         fi
12800     done
12801     AC_MSG_RESULT([$qt5_incdir])
12802     if test "x$qt5_incdir" = "xno"; then
12803         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12804     fi
12805     # check for scenario: qt5-qtbase-devel-*.86_64 installed but host is i686
12806     AC_LANG_PUSH([C++])
12807     save_CPPFLAGS=$CPPFLAGS
12808     CPPFLAGS="${CPPFLAGS} -I${qt5_incdir}"
12809     AC_CHECK_HEADER(QtCore/qconfig.h, [],
12810         [AC_MSG_ERROR(qconfig.h header not found.)], [])
12811     CPPFLAGS=$save_CPPFLAGS
12812     AC_LANG_POP([C++])
12814     AC_MSG_CHECKING([for Qt5 libraries])
12815     qt5_libdir="no"
12816     for lib_dir in $qt5_libdirs; do
12817         if test -r "$lib_dir/$qt5_test_library"; then
12818             qt5_libdir="$lib_dir"
12819             break
12820         fi
12821     done
12822     AC_MSG_RESULT([$qt5_libdir])
12823     if test "x$qt5_libdir" = "xno"; then
12824         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12825     fi
12827     if test "$_os" = "Emscripten"; then
12828         if test ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html ; then
12829             QT5_PLATFORMS_SRCDIR="${QT5_PLATFORMS_SRCDIR/plugins/src\/plugins}/wasm"
12830         fi
12831         if test ! -f "${qt5_platformsdir}"/libqwasm.a -o ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html; then
12832             AC_MSG_ERROR([No Qt5 WASM QPA plugin found in ${qt5_platformsdir} or ${QT5_PLATFORMS_SRCDIR}])
12833         fi
12834     fi
12836     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
12837     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12838     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
12839     if test "$_os" = "Emscripten"; then
12840         QT5_LIBS="$QT5_LIBS -lqtpcre2 -lQt5EventDispatcherSupport -lQt5FontDatabaseSupport -L${qt5_platformsdir} -lqwasm"
12841     fi
12843     if test "$USING_X11" = TRUE; then
12844         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
12845         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
12846             QT5_HAVE_XCB_ICCCM=1
12847             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
12848         ],[
12849             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)])
12850             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
12851         ])
12852         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
12853         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
12854         QT5_USING_X11=1
12855         AC_DEFINE(QT5_USING_X11)
12856     fi
12858     dnl Check for Meta Object Compiler
12860     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
12861     if test "$MOC5" = "no"; then
12862         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
12863 the root of your Qt installation by exporting QT5DIR before running "configure".])
12864     fi
12866     if test "$test_gstreamer_1_0" = yes; then
12867         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
12868                 QT5_HAVE_GOBJECT=1
12869                 AC_DEFINE(QT5_HAVE_GOBJECT)
12870             ],
12871             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
12872         )
12873     fi
12875 AC_SUBST(QT5_CFLAGS)
12876 AC_SUBST(QT5_LIBS)
12877 AC_SUBST(MOC5)
12878 AC_SUBST(QT5_GOBJECT_CFLAGS)
12879 AC_SUBST(QT5_GOBJECT_LIBS)
12880 AC_SUBST(QT5_HAVE_GOBJECT)
12881 AC_SUBST(QT5_PLATFORMS_SRCDIR)
12883 dnl ===================================================================
12884 dnl KF5 Integration
12885 dnl ===================================================================
12887 KF5_CFLAGS=""
12888 KF5_LIBS=""
12889 KF5_CONFIG="kf5-config"
12890 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
12891         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
12892 then
12893     if test "$OS" = "HAIKU"; then
12894         haiku_arch="`echo $RTL_ARCH | tr X x`"
12895         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
12896         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
12897     fi
12899     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
12900     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
12901     if test -n "$supports_multilib"; then
12902         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
12903     fi
12905     kf5_test_include="KF5/kcoreaddons_version.h"
12906     kf5_test_library="libKF5CoreAddons.so"
12907     kf5_libdirs="$qt5_libdir $kf5_libdirs"
12909     dnl kf5 KDE4 support compatibility installed
12910     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
12911     if test "$KF5_CONFIG" != "no"; then
12912         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
12913         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
12914     fi
12916     dnl Check for KF5 headers
12917     AC_MSG_CHECKING([for KF5 headers])
12918     kf5_incdir="no"
12919     for kf5_check in $kf5_incdirs; do
12920         if test -r "$kf5_check/$kf5_test_include"; then
12921             kf5_incdir="$kf5_check/KF5"
12922             break
12923         fi
12924     done
12925     AC_MSG_RESULT([$kf5_incdir])
12926     if test "x$kf5_incdir" = "xno"; then
12927         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
12928     fi
12930     dnl Check for KF5 libraries
12931     AC_MSG_CHECKING([for KF5 libraries])
12932     kf5_libdir="no"
12933     for kf5_check in $kf5_libdirs; do
12934         if test -r "$kf5_check/$kf5_test_library"; then
12935             kf5_libdir="$kf5_check"
12936             break
12937         fi
12938     done
12940     AC_MSG_RESULT([$kf5_libdir])
12941     if test "x$kf5_libdir" = "xno"; then
12942         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
12943     fi
12945     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"
12946     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
12947     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12949     if test "$USING_X11" = TRUE; then
12950         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
12951     fi
12953     AC_LANG_PUSH([C++])
12954     save_CXXFLAGS=$CXXFLAGS
12955     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
12956     AC_MSG_CHECKING([whether KDE is >= 5.0])
12957        AC_RUN_IFELSE([AC_LANG_SOURCE([[
12958 #include <kcoreaddons_version.h>
12960 int main(int argc, char **argv) {
12961        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
12962        else return 1;
12964        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
12965     CXXFLAGS=$save_CXXFLAGS
12966     AC_LANG_POP([C++])
12968 AC_SUBST(KF5_CFLAGS)
12969 AC_SUBST(KF5_LIBS)
12971 dnl ===================================================================
12972 dnl Test whether to include Evolution 2 support
12973 dnl ===================================================================
12974 AC_MSG_CHECKING([whether to enable evolution 2 support])
12975 if test "$enable_evolution2" = yes; then
12976     AC_MSG_RESULT([yes])
12977     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
12978     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12979     FilterLibs "${GOBJECT_LIBS}"
12980     GOBJECT_LIBS="${filteredlibs}"
12981     ENABLE_EVOAB2="TRUE"
12982 else
12983     AC_MSG_RESULT([no])
12985 AC_SUBST(ENABLE_EVOAB2)
12986 AC_SUBST(GOBJECT_CFLAGS)
12987 AC_SUBST(GOBJECT_LIBS)
12989 dnl ===================================================================
12990 dnl Test which themes to include
12991 dnl ===================================================================
12992 AC_MSG_CHECKING([which themes to include])
12993 # if none given use default subset of available themes
12994 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
12995     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"
12998 WITH_THEMES=""
12999 if test "x$with_theme" != "xno"; then
13000     for theme in $with_theme; do
13001         case $theme in
13002         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" ;;
13003         default) real_theme=colibre ;;
13004         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
13005         esac
13006         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
13007     done
13009 AC_MSG_RESULT([$WITH_THEMES])
13010 AC_SUBST([WITH_THEMES])
13011 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
13012 for theme in $with_theme; do
13013     case $theme in
13014     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
13015     *) ;;
13016     esac
13017 done
13019 ###############################################################################
13020 # Extensions checking
13021 ###############################################################################
13022 AC_MSG_CHECKING([for extensions integration])
13023 if test "x$enable_extension_integration" != "xno"; then
13024     WITH_EXTENSION_INTEGRATION=TRUE
13025     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
13026     AC_MSG_RESULT([yes, use integration])
13027 else
13028     WITH_EXTENSION_INTEGRATION=
13029     AC_MSG_RESULT([no, do not integrate])
13031 AC_SUBST(WITH_EXTENSION_INTEGRATION)
13033 dnl Should any extra extensions be included?
13034 dnl There are standalone tests for each of these below.
13035 WITH_EXTRA_EXTENSIONS=
13036 AC_SUBST([WITH_EXTRA_EXTENSIONS])
13038 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
13039 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
13040 if test "x$with_java" != "xno"; then
13041     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
13042     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
13045 AC_MSG_CHECKING([whether to build opens___.ttf])
13046 if test "$enable_build_opensymbol" = "yes"; then
13047     AC_MSG_RESULT([yes])
13048     AC_PATH_PROG(FONTFORGE, fontforge)
13049     if test -z "$FONTFORGE"; then
13050         AC_MSG_ERROR([fontforge not installed])
13051     fi
13052 else
13053     AC_MSG_RESULT([no])
13054     OPENSYMBOL_TTF=f543e6e2d7275557a839a164941c0a86e5f2c3f2a0042bfc434c88c6dde9e140-opens___.ttf
13055     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
13057 AC_SUBST(OPENSYMBOL_TTF)
13058 AC_SUBST(FONTFORGE)
13060 dnl ===================================================================
13061 dnl Test whether to include fonts
13062 dnl ===================================================================
13063 AC_MSG_CHECKING([whether to include third-party fonts])
13064 if test "$with_fonts" != "no"; then
13065     AC_MSG_RESULT([yes])
13066     WITH_FONTS=TRUE
13067     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
13068     AC_DEFINE(HAVE_MORE_FONTS)
13069 else
13070     AC_MSG_RESULT([no])
13071     WITH_FONTS=
13072     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
13074 AC_SUBST(WITH_FONTS)
13077 dnl ===================================================================
13078 dnl Test whether to enable online update service
13079 dnl ===================================================================
13080 AC_MSG_CHECKING([whether to enable online update])
13081 ENABLE_ONLINE_UPDATE=
13082 ENABLE_ONLINE_UPDATE_MAR=
13083 UPDATE_CONFIG=
13084 if test "$enable_online_update" = ""; then
13085     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
13086         AC_MSG_RESULT([yes])
13087         ENABLE_ONLINE_UPDATE="TRUE"
13088     else
13089         AC_MSG_RESULT([no])
13090     fi
13091 else
13092     if test "$enable_online_update" = "mar"; then
13093         AC_MSG_RESULT([yes - MAR-based online update])
13094         ENABLE_ONLINE_UPDATE_MAR="TRUE"
13095         if test "$with_update_config" = ""; then
13096             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
13097         fi
13098         UPDATE_CONFIG="$with_update_config"
13099         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
13100     elif test "$enable_online_update" = "yes"; then
13101         AC_MSG_RESULT([yes])
13102         ENABLE_ONLINE_UPDATE="TRUE"
13103     else
13104         AC_MSG_RESULT([no])
13105     fi
13107 AC_SUBST(ENABLE_ONLINE_UPDATE)
13108 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
13109 AC_SUBST(UPDATE_CONFIG)
13112 PRIVACY_POLICY_URL="$with_privacy_policy_url"
13113 if test "$ENABLE_ONLINE_UPDATE" = TRUE -o "$ENABLE_BREAKPAD" = "TRUE"; then
13114     if test "x$with_privacy_policy_url" = "xundefined"; then
13115         AC_MSG_FAILURE([online update or breakpad/crashreporting are enabled, but no --with-privacy-policy-url=... was provided])
13116     fi
13118 AC_SUBST(PRIVACY_POLICY_URL)
13119 dnl ===================================================================
13120 dnl Test whether we need bzip2
13121 dnl ===================================================================
13122 SYSTEM_BZIP2=
13123 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
13124     AC_MSG_CHECKING([whether to use system bzip2])
13125     if test "$with_system_bzip2" = yes; then
13126         SYSTEM_BZIP2=TRUE
13127         AC_MSG_RESULT([yes])
13128         PKG_CHECK_MODULES(BZIP2, bzip2)
13129         FilterLibs "${BZIP2_LIBS}"
13130         BZIP2_LIBS="${filteredlibs}"
13131     else
13132         AC_MSG_RESULT([no])
13133         BUILD_TYPE="$BUILD_TYPE BZIP2"
13134     fi
13136 AC_SUBST(SYSTEM_BZIP2)
13137 AC_SUBST(BZIP2_CFLAGS)
13138 AC_SUBST(BZIP2_LIBS)
13140 dnl ===================================================================
13141 dnl Test whether to enable extension update
13142 dnl ===================================================================
13143 AC_MSG_CHECKING([whether to enable extension update])
13144 ENABLE_EXTENSION_UPDATE=
13145 if test "x$enable_extension_update" = "xno"; then
13146     AC_MSG_RESULT([no])
13147 else
13148     AC_MSG_RESULT([yes])
13149     ENABLE_EXTENSION_UPDATE="TRUE"
13150     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
13151     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
13153 AC_SUBST(ENABLE_EXTENSION_UPDATE)
13156 dnl ===================================================================
13157 dnl Test whether to create MSI with LIMITUI=1 (silent install)
13158 dnl ===================================================================
13159 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
13160 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
13161     AC_MSG_RESULT([no])
13162     ENABLE_SILENT_MSI=
13163 else
13164     AC_MSG_RESULT([yes])
13165     ENABLE_SILENT_MSI=TRUE
13166     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
13168 AC_SUBST(ENABLE_SILENT_MSI)
13170 AC_MSG_CHECKING([whether and how to use Xinerama])
13171 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
13172     if test "$x_libraries" = "default_x_libraries"; then
13173         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
13174         if test "x$XINERAMALIB" = x; then
13175            XINERAMALIB="/usr/lib"
13176         fi
13177     else
13178         XINERAMALIB="$x_libraries"
13179     fi
13180     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
13181         # we have both versions, let the user decide but use the dynamic one
13182         # per default
13183         USE_XINERAMA=TRUE
13184         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
13185             XINERAMA_LINK=dynamic
13186         else
13187             XINERAMA_LINK=static
13188         fi
13189     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
13190         # we have only the dynamic version
13191         USE_XINERAMA=TRUE
13192         XINERAMA_LINK=dynamic
13193     elif test -e "$XINERAMALIB/libXinerama.a"; then
13194         # static version
13195         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
13196             USE_XINERAMA=TRUE
13197             XINERAMA_LINK=static
13198         else
13199             USE_XINERAMA=
13200             XINERAMA_LINK=none
13201         fi
13202     else
13203         # no Xinerama
13204         USE_XINERAMA=
13205         XINERAMA_LINK=none
13206     fi
13207     if test "$USE_XINERAMA" = "TRUE"; then
13208         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
13209         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
13210             [AC_MSG_ERROR(Xinerama header not found.)], [])
13211         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
13212         if test "x$XEXTLIB" = x; then
13213            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
13214         fi
13215         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
13216         if test "$_os" = "FreeBSD"; then
13217             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
13218         fi
13219         if test "$_os" = "Linux"; then
13220             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
13221         fi
13222         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
13223             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
13224     else
13225         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
13226     fi
13227 else
13228     USE_XINERAMA=
13229     XINERAMA_LINK=none
13230     AC_MSG_RESULT([no])
13232 AC_SUBST(USE_XINERAMA)
13233 AC_SUBST(XINERAMA_LINK)
13235 dnl ===================================================================
13236 dnl Test whether to build cairo or rely on the system version
13237 dnl ===================================================================
13239 if test "$test_cairo" = "yes"; then
13240     AC_MSG_CHECKING([whether to use the system cairo])
13242     : ${with_system_cairo:=$with_system_libs}
13243     if test "$with_system_cairo" = "yes"; then
13244         SYSTEM_CAIRO=TRUE
13245         AC_MSG_RESULT([yes])
13247         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
13248         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13249         FilterLibs "${CAIRO_LIBS}"
13250         CAIRO_LIBS="${filteredlibs}"
13252         if test "$test_xrender" = "yes"; then
13253             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
13254             AC_LANG_PUSH([C])
13255             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
13256 #ifdef PictStandardA8
13257 #else
13258       return fail;
13259 #endif
13260 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
13262             AC_LANG_POP([C])
13263         fi
13264     else
13265         AC_MSG_RESULT([no])
13266         BUILD_TYPE="$BUILD_TYPE CAIRO"
13267     fi
13269     if test "$enable_cairo_canvas" != no; then
13270         AC_DEFINE(ENABLE_CAIRO_CANVAS)
13271         ENABLE_CAIRO_CANVAS=TRUE
13272     fi
13275 AC_SUBST(CAIRO_CFLAGS)
13276 AC_SUBST(CAIRO_LIBS)
13277 AC_SUBST(ENABLE_CAIRO_CANVAS)
13278 AC_SUBST(SYSTEM_CAIRO)
13280 dnl ===================================================================
13281 dnl Test whether to use avahi
13282 dnl ===================================================================
13283 if test "$_os" = "WINNT"; then
13284     # Windows uses bundled mDNSResponder
13285     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
13286 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
13287     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
13288                       [ENABLE_AVAHI="TRUE"])
13289     AC_DEFINE(HAVE_FEATURE_AVAHI)
13290     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13291     FilterLibs "${AVAHI_LIBS}"
13292     AVAHI_LIBS="${filteredlibs}"
13295 AC_SUBST(ENABLE_AVAHI)
13296 AC_SUBST(AVAHI_CFLAGS)
13297 AC_SUBST(AVAHI_LIBS)
13299 dnl ===================================================================
13300 dnl Test whether to use liblangtag
13301 dnl ===================================================================
13302 SYSTEM_LIBLANGTAG=
13303 AC_MSG_CHECKING([whether to use system liblangtag])
13304 if test "$with_system_liblangtag" = yes; then
13305     SYSTEM_LIBLANGTAG=TRUE
13306     AC_MSG_RESULT([yes])
13307     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
13308     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
13309     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
13310     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13311     FilterLibs "${LIBLANGTAG_LIBS}"
13312     LIBLANGTAG_LIBS="${filteredlibs}"
13313 else
13314     SYSTEM_LIBLANGTAG=
13315     AC_MSG_RESULT([no])
13316     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
13317     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
13318     if test "$COM" = "MSC"; then
13319         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
13320     else
13321         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
13322     fi
13324 AC_SUBST(SYSTEM_LIBLANGTAG)
13325 AC_SUBST(LIBLANGTAG_CFLAGS)
13326 AC_SUBST(LIBLANGTAG_LIBS)
13328 dnl ===================================================================
13329 dnl Test whether to build libpng or rely on the system version
13330 dnl ===================================================================
13332 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
13334 dnl ===================================================================
13335 dnl Check for runtime JVM search path
13336 dnl ===================================================================
13337 if test "$ENABLE_JAVA" != ""; then
13338     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
13339     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
13340         AC_MSG_RESULT([yes])
13341         if ! test -d "$with_jvm_path"; then
13342             AC_MSG_ERROR(["$with_jvm_path" not a directory])
13343         fi
13344         if ! test -d "$with_jvm_path"jvm; then
13345             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
13346         fi
13347         JVM_ONE_PATH_CHECK="$with_jvm_path"
13348         AC_SUBST(JVM_ONE_PATH_CHECK)
13349     else
13350         AC_MSG_RESULT([no])
13351     fi
13354 dnl ===================================================================
13355 dnl Test for the presence of Ant and that it works
13356 dnl ===================================================================
13358 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE" -a "$cross_compiling" != "yes"; then
13359     ANT_HOME=; export ANT_HOME
13360     WITH_ANT_HOME=; export WITH_ANT_HOME
13361     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
13362         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
13363             if test "$_os" = "WINNT"; then
13364                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
13365             else
13366                 with_ant_home="$LODE_HOME/opt/ant"
13367             fi
13368         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
13369             with_ant_home="$LODE_HOME/opt/ant"
13370         fi
13371     fi
13372     if test -z "$with_ant_home"; then
13373         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
13374     else
13375         if test "$_os" = "WINNT"; then
13376             # AC_PATH_PROGS needs unix path
13377             with_ant_home=`cygpath -u "$with_ant_home"`
13378         fi
13379         AbsolutePath "$with_ant_home"
13380         with_ant_home=$absolute_path
13381         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
13382         WITH_ANT_HOME=$with_ant_home
13383         ANT_HOME=$with_ant_home
13384     fi
13386     if test -z "$ANT"; then
13387         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
13388     else
13389         # resolve relative or absolute symlink
13390         while test -h "$ANT"; do
13391             a_cwd=`pwd`
13392             a_basename=`basename "$ANT"`
13393             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
13394             cd "`dirname "$ANT"`"
13395             cd "`dirname "$a_script"`"
13396             ANT="`pwd`"/"`basename "$a_script"`"
13397             cd "$a_cwd"
13398         done
13400         AC_MSG_CHECKING([if $ANT works])
13401         mkdir -p conftest.dir
13402         a_cwd=$(pwd)
13403         cd conftest.dir
13404         cat > conftest.java << EOF
13405         public class conftest {
13406             int testmethod(int a, int b) {
13407                     return a + b;
13408             }
13409         }
13412         cat > conftest.xml << EOF
13413         <project name="conftest" default="conftest">
13414         <target name="conftest">
13415             <javac srcdir="." includes="conftest.java">
13416             </javac>
13417         </target>
13418         </project>
13421         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
13422         if test $? = 0 -a -f ./conftest.class; then
13423             AC_MSG_RESULT([Ant works])
13424             if test -z "$WITH_ANT_HOME"; then
13425                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
13426                 if test -z "$ANT_HOME"; then
13427                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
13428                 fi
13429             else
13430                 ANT_HOME="$WITH_ANT_HOME"
13431             fi
13432         else
13433             echo "configure: Ant test failed" >&5
13434             cat conftest.java >&5
13435             cat conftest.xml >&5
13436             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
13437         fi
13438         cd "$a_cwd"
13439         rm -fr conftest.dir
13440     fi
13441     if test -z "$ANT_HOME"; then
13442         ANT_HOME="NO_ANT_HOME"
13443     else
13444         PathFormat "$ANT_HOME"
13445         ANT_HOME="$formatted_path"
13446         PathFormat "$ANT"
13447         ANT="$formatted_path"
13448     fi
13450     dnl Checking for ant.jar
13451     if test "$ANT_HOME" != "NO_ANT_HOME"; then
13452         AC_MSG_CHECKING([Ant lib directory])
13453         if test -f $ANT_HOME/lib/ant.jar; then
13454             ANT_LIB="$ANT_HOME/lib"
13455         else
13456             if test -f $ANT_HOME/ant.jar; then
13457                 ANT_LIB="$ANT_HOME"
13458             else
13459                 if test -f /usr/share/java/ant.jar; then
13460                     ANT_LIB=/usr/share/java
13461                 else
13462                     if test -f /usr/share/ant-core/lib/ant.jar; then
13463                         ANT_LIB=/usr/share/ant-core/lib
13464                     else
13465                         if test -f $ANT_HOME/lib/ant/ant.jar; then
13466                             ANT_LIB="$ANT_HOME/lib/ant"
13467                         else
13468                             if test -f /usr/share/lib/ant/ant.jar; then
13469                                 ANT_LIB=/usr/share/lib/ant
13470                             else
13471                                 AC_MSG_ERROR([Ant libraries not found!])
13472                             fi
13473                         fi
13474                     fi
13475                 fi
13476             fi
13477         fi
13478         PathFormat "$ANT_LIB"
13479         ANT_LIB="$formatted_path"
13480         AC_MSG_RESULT([Ant lib directory found.])
13481     fi
13483     ant_minver=1.6.0
13484     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
13486     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
13487     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
13488     ant_version_major=`echo $ant_version | cut -d. -f1`
13489     ant_version_minor=`echo $ant_version | cut -d. -f2`
13490     echo "configure: ant_version $ant_version " >&5
13491     echo "configure: ant_version_major $ant_version_major " >&5
13492     echo "configure: ant_version_minor $ant_version_minor " >&5
13493     if test "$ant_version_major" -ge "2"; then
13494         AC_MSG_RESULT([yes, $ant_version])
13495     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
13496         AC_MSG_RESULT([yes, $ant_version])
13497     else
13498         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
13499     fi
13501     rm -f conftest* core core.* *.core
13503 AC_SUBST(ANT)
13504 AC_SUBST(ANT_HOME)
13505 AC_SUBST(ANT_LIB)
13507 OOO_JUNIT_JAR=
13508 HAMCREST_JAR=
13509 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no" -a "$cross_compiling" != "yes"; then
13510     AC_MSG_CHECKING([for JUnit 4])
13511     if test "$with_junit" = "yes"; then
13512         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
13513             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
13514         elif test -e /usr/share/java/junit4.jar; then
13515             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
13516         else
13517            if test -e /usr/share/lib/java/junit.jar; then
13518               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
13519            else
13520               OOO_JUNIT_JAR=/usr/share/java/junit.jar
13521            fi
13522         fi
13523     else
13524         OOO_JUNIT_JAR=$with_junit
13525     fi
13526     if test "$_os" = "WINNT"; then
13527         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
13528     fi
13529     printf 'import org.junit.Before;' > conftest.java
13530     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
13531         AC_MSG_RESULT([$OOO_JUNIT_JAR])
13532     else
13533         AC_MSG_ERROR(
13534 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
13535  specify its pathname via --with-junit=..., or disable it via --without-junit])
13536     fi
13537     rm -f conftest.class conftest.java
13538     if test $OOO_JUNIT_JAR != ""; then
13539         BUILD_TYPE="$BUILD_TYPE QADEVOOO"
13540     fi
13542     AC_MSG_CHECKING([for included Hamcrest])
13543     printf 'import org.hamcrest.BaseDescription;' > conftest.java
13544     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
13545         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
13546     else
13547         AC_MSG_RESULT([Not included])
13548         AC_MSG_CHECKING([for standalone hamcrest jar.])
13549         if test "$with_hamcrest" = "yes"; then
13550             if test -e /usr/share/lib/java/hamcrest.jar; then
13551                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
13552             elif test -e /usr/share/java/hamcrest/core.jar; then
13553                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
13554             elif test -e /usr/share/java/hamcrest/hamcrest.jar; then
13555                 HAMCREST_JAR=/usr/share/java/hamcrest/hamcrest.jar
13556             else
13557                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
13558             fi
13559         else
13560             HAMCREST_JAR=$with_hamcrest
13561         fi
13562         if test "$_os" = "WINNT"; then
13563             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
13564         fi
13565         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
13566             AC_MSG_RESULT([$HAMCREST_JAR])
13567         else
13568             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),
13569                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
13570         fi
13571     fi
13572     rm -f conftest.class conftest.java
13574 AC_SUBST(OOO_JUNIT_JAR)
13575 AC_SUBST(HAMCREST_JAR)
13578 AC_SUBST(SCPDEFS)
13581 # check for wget and curl
13583 WGET=
13584 CURL=
13586 if test "$enable_fetch_external" != "no"; then
13588 CURL=`which curl 2>/dev/null`
13590 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
13591     # wget new enough?
13592     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
13593     if test $? -eq 0; then
13594         WGET=$i
13595         break
13596     fi
13597 done
13599 if test -z "$WGET" -a -z "$CURL"; then
13600     AC_MSG_ERROR([neither wget nor curl found!])
13605 AC_SUBST(WGET)
13606 AC_SUBST(CURL)
13609 # check for sha256sum
13611 SHA256SUM=
13613 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
13614     eval "$i -a 256 --version" > /dev/null 2>&1
13615     ret=$?
13616     if test $ret -eq 0; then
13617         SHA256SUM="$i -a 256"
13618         break
13619     fi
13620 done
13622 if test -z "$SHA256SUM"; then
13623     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
13624         eval "$i --version" > /dev/null 2>&1
13625         ret=$?
13626         if test $ret -eq 0; then
13627             SHA256SUM=$i
13628             break
13629         fi
13630     done
13633 if test -z "$SHA256SUM"; then
13634     AC_MSG_ERROR([no sha256sum found!])
13637 AC_SUBST(SHA256SUM)
13639 dnl ===================================================================
13640 dnl Dealing with l10n options
13641 dnl ===================================================================
13642 AC_MSG_CHECKING([which languages to be built])
13643 # get list of all languages
13644 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
13645 # the sed command does the following:
13646 #   + if a line ends with a backslash, append the next line to it
13647 #   + adds " on the beginning of the value (after =)
13648 #   + adds " at the end of the value
13649 #   + removes en-US; we want to put it on the beginning
13650 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
13651 [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)]
13652 ALL_LANGS="en-US $completelangiso"
13653 # check the configured localizations
13654 WITH_LANG="$with_lang"
13656 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
13657 # (Norwegian is "nb" and "nn".)
13658 if test "$WITH_LANG" = "no"; then
13659     WITH_LANG=
13662 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
13663     AC_MSG_RESULT([en-US])
13664 else
13665     AC_MSG_RESULT([$WITH_LANG])
13666     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
13667     if test -z "$MSGFMT"; then
13668         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
13669             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
13670         elif test -x "/opt/lo/bin/msgfmt"; then
13671             MSGFMT="/opt/lo/bin/msgfmt"
13672         else
13673             AC_CHECK_PROGS(MSGFMT, [msgfmt])
13674             if test -z "$MSGFMT"; then
13675                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
13676             fi
13677         fi
13678     fi
13679     if test -z "$MSGUNIQ"; then
13680         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
13681             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
13682         elif test -x "/opt/lo/bin/msguniq"; then
13683             MSGUNIQ="/opt/lo/bin/msguniq"
13684         else
13685             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
13686             if test -z "$MSGUNIQ"; then
13687                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
13688             fi
13689         fi
13690     fi
13692 AC_SUBST(MSGFMT)
13693 AC_SUBST(MSGUNIQ)
13694 # check that the list is valid
13695 for lang in $WITH_LANG; do
13696     test "$lang" = "ALL" && continue
13697     # need to check for the exact string, so add space before and after the list of all languages
13698     for vl in $ALL_LANGS; do
13699         if test "$vl" = "$lang"; then
13700            break
13701         fi
13702     done
13703     if test "$vl" != "$lang"; then
13704         # if you're reading this - you prolly quoted your languages remove the quotes ...
13705         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
13706     fi
13707 done
13708 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
13709     echo $WITH_LANG | grep -q en-US
13710     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
13712 # list with substituted ALL
13713 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
13714 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
13715 test "$WITH_LANG" = "en-US" && WITH_LANG=
13716 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
13717     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
13718     ALL_LANGS=`echo $ALL_LANGS qtz`
13720 AC_SUBST(ALL_LANGS)
13721 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
13722 AC_SUBST(WITH_LANG)
13723 AC_SUBST(WITH_LANG_LIST)
13724 AC_SUBST(GIT_NEEDED_SUBMODULES)
13726 WITH_POOR_HELP_LOCALIZATIONS=
13727 if test -d "$SRC_ROOT/translations/source"; then
13728     for l in `ls -1 $SRC_ROOT/translations/source`; do
13729         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
13730             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
13731         fi
13732     done
13734 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
13736 if test -n "$with_locales"; then
13737     WITH_LOCALES="$with_locales"
13739     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
13740     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
13741     # config_host/config_locales.h.in
13742     for locale in $WITH_LOCALES; do
13743         lang=${locale%_*}
13745         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
13747         case $lang in
13748         hi|mr*ne)
13749             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
13750             ;;
13751         bg|ru)
13752             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
13753             ;;
13754         esac
13755     done
13756 else
13757     AC_DEFINE(WITH_LOCALE_ALL)
13759 AC_SUBST(WITH_LOCALES)
13761 dnl git submodule update --reference
13762 dnl ===================================================================
13763 if test -n "${GIT_REFERENCE_SRC}"; then
13764     for repo in ${GIT_NEEDED_SUBMODULES}; do
13765         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
13766             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
13767         fi
13768     done
13770 AC_SUBST(GIT_REFERENCE_SRC)
13772 dnl git submodules linked dirs
13773 dnl ===================================================================
13774 if test -n "${GIT_LINK_SRC}"; then
13775     for repo in ${GIT_NEEDED_SUBMODULES}; do
13776         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
13777             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
13778         fi
13779     done
13781 AC_SUBST(GIT_LINK_SRC)
13783 dnl branding
13784 dnl ===================================================================
13785 AC_MSG_CHECKING([for alternative branding images directory])
13786 # initialize mapped arrays
13787 BRAND_INTRO_IMAGES="intro.png intro-highres.png"
13788 brand_files="$BRAND_INTRO_IMAGES logo.svg logo_inverted.svg logo-sc.svg logo-sc_inverted.svg about.svg"
13790 if test -z "$with_branding" -o "$with_branding" = "no"; then
13791     AC_MSG_RESULT([none])
13792     DEFAULT_BRAND_IMAGES="$brand_files"
13793 else
13794     if ! test -d $with_branding ; then
13795         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
13796     else
13797         AC_MSG_RESULT([$with_branding])
13798         CUSTOM_BRAND_DIR="$with_branding"
13799         for lfile in $brand_files
13800         do
13801             if ! test -f $with_branding/$lfile ; then
13802                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
13803                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
13804             else
13805                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
13806             fi
13807         done
13808         check_for_progress="yes"
13809     fi
13811 AC_SUBST([BRAND_INTRO_IMAGES])
13812 AC_SUBST([CUSTOM_BRAND_DIR])
13813 AC_SUBST([CUSTOM_BRAND_IMAGES])
13814 AC_SUBST([DEFAULT_BRAND_IMAGES])
13817 AC_MSG_CHECKING([for 'intro' progress settings])
13818 PROGRESSBARCOLOR=
13819 PROGRESSSIZE=
13820 PROGRESSPOSITION=
13821 PROGRESSFRAMECOLOR=
13822 PROGRESSTEXTCOLOR=
13823 PROGRESSTEXTBASELINE=
13825 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
13826     source "$with_branding/progress.conf"
13827     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
13828 else
13829     AC_MSG_RESULT([none])
13832 AC_SUBST(PROGRESSBARCOLOR)
13833 AC_SUBST(PROGRESSSIZE)
13834 AC_SUBST(PROGRESSPOSITION)
13835 AC_SUBST(PROGRESSFRAMECOLOR)
13836 AC_SUBST(PROGRESSTEXTCOLOR)
13837 AC_SUBST(PROGRESSTEXTBASELINE)
13840 dnl ===================================================================
13841 dnl Custom build version
13842 dnl ===================================================================
13843 AC_MSG_CHECKING([for extra build ID])
13844 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
13845     EXTRA_BUILDID="$with_extra_buildid"
13847 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
13848 if test -n "$EXTRA_BUILDID" ; then
13849     AC_MSG_RESULT([$EXTRA_BUILDID])
13850 else
13851     AC_MSG_RESULT([not set])
13853 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
13855 OOO_VENDOR=
13856 AC_MSG_CHECKING([for vendor])
13857 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
13858     OOO_VENDOR="$USERNAME"
13860     if test -z "$OOO_VENDOR"; then
13861         OOO_VENDOR="$USER"
13862     fi
13864     if test -z "$OOO_VENDOR"; then
13865         OOO_VENDOR="`id -u -n`"
13866     fi
13868     AC_MSG_RESULT([not set, using $OOO_VENDOR])
13869 else
13870     OOO_VENDOR="$with_vendor"
13871     AC_MSG_RESULT([$OOO_VENDOR])
13873 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
13874 AC_SUBST(OOO_VENDOR)
13876 if test "$_os" = "Android" ; then
13877     ANDROID_PACKAGE_NAME=
13878     AC_MSG_CHECKING([for Android package name])
13879     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
13880         if test -n "$ENABLE_DEBUG"; then
13881             # Default to the package name that makes ndk-gdb happy.
13882             ANDROID_PACKAGE_NAME="org.libreoffice"
13883         else
13884             ANDROID_PACKAGE_NAME="org.example.libreoffice"
13885         fi
13887         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
13888     else
13889         ANDROID_PACKAGE_NAME="$with_android_package_name"
13890         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
13891     fi
13892     AC_SUBST(ANDROID_PACKAGE_NAME)
13895 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
13896 if test "$with_compat_oowrappers" = "yes"; then
13897     WITH_COMPAT_OOWRAPPERS=TRUE
13898     AC_MSG_RESULT(yes)
13899 else
13900     WITH_COMPAT_OOWRAPPERS=
13901     AC_MSG_RESULT(no)
13903 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
13905 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
13906 AC_MSG_CHECKING([for install dirname])
13907 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
13908     INSTALLDIRNAME="$with_install_dirname"
13910 AC_MSG_RESULT([$INSTALLDIRNAME])
13911 AC_SUBST(INSTALLDIRNAME)
13913 AC_MSG_CHECKING([for prefix])
13914 test "x$prefix" = xNONE && prefix=$ac_default_prefix
13915 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
13916 PREFIXDIR="$prefix"
13917 AC_MSG_RESULT([$PREFIXDIR])
13918 AC_SUBST(PREFIXDIR)
13920 LIBDIR=[$(eval echo $(eval echo $libdir))]
13921 AC_SUBST(LIBDIR)
13923 DATADIR=[$(eval echo $(eval echo $datadir))]
13924 AC_SUBST(DATADIR)
13926 MANDIR=[$(eval echo $(eval echo $mandir))]
13927 AC_SUBST(MANDIR)
13929 DOCDIR=[$(eval echo $(eval echo $docdir))]
13930 AC_SUBST(DOCDIR)
13932 BINDIR=[$(eval echo $(eval echo $bindir))]
13933 AC_SUBST(BINDIR)
13935 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
13936 AC_SUBST(INSTALLDIR)
13938 TESTINSTALLDIR="${BUILDDIR}/test-install"
13939 AC_SUBST(TESTINSTALLDIR)
13942 # ===================================================================
13943 # OAuth2 id and secrets
13944 # ===================================================================
13946 AC_MSG_CHECKING([for Google Drive client id and secret])
13947 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
13948     AC_MSG_RESULT([not set])
13949     GDRIVE_CLIENT_ID="\"\""
13950     GDRIVE_CLIENT_SECRET="\"\""
13951 else
13952     AC_MSG_RESULT([set])
13953     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
13954     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
13956 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
13957 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
13959 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
13960 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
13961     AC_MSG_RESULT([not set])
13962     ALFRESCO_CLOUD_CLIENT_ID="\"\""
13963     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
13964 else
13965     AC_MSG_RESULT([set])
13966     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
13967     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
13969 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
13970 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
13972 AC_MSG_CHECKING([for OneDrive client id and secret])
13973 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
13974     AC_MSG_RESULT([not set])
13975     ONEDRIVE_CLIENT_ID="\"\""
13976     ONEDRIVE_CLIENT_SECRET="\"\""
13977 else
13978     AC_MSG_RESULT([set])
13979     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
13980     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
13982 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
13983 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
13986 dnl ===================================================================
13987 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
13988 dnl --enable-dependency-tracking configure option
13989 dnl ===================================================================
13990 AC_MSG_CHECKING([whether to enable dependency tracking])
13991 if test "$enable_dependency_tracking" = "no"; then
13992     nodep=TRUE
13993     AC_MSG_RESULT([no])
13994 else
13995     AC_MSG_RESULT([yes])
13997 AC_SUBST(nodep)
13999 dnl ===================================================================
14000 dnl Number of CPUs to use during the build
14001 dnl ===================================================================
14002 AC_MSG_CHECKING([for number of processors to use])
14003 # plain --with-parallelism is just the default
14004 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
14005     if test "$with_parallelism" = "no"; then
14006         PARALLELISM=0
14007     else
14008         PARALLELISM=$with_parallelism
14009     fi
14010 else
14011     if test "$enable_icecream" = "yes"; then
14012         PARALLELISM="40"
14013     else
14014         case `uname -s` in
14016         Darwin|FreeBSD|NetBSD|OpenBSD)
14017             PARALLELISM=`sysctl -n hw.ncpu`
14018             ;;
14020         Linux)
14021             PARALLELISM=`getconf _NPROCESSORS_ONLN`
14022         ;;
14023         # what else than above does profit here *and* has /proc?
14024         *)
14025             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
14026             ;;
14027         esac
14029         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
14030         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
14031     fi
14034 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
14035     if test -z "$with_parallelism"; then
14036             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
14037             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
14038             PARALLELISM="1"
14039     else
14040         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."
14041     fi
14044 if test $PARALLELISM -eq 0; then
14045     AC_MSG_RESULT([explicit make -j option needed])
14046 else
14047     AC_MSG_RESULT([$PARALLELISM])
14049 AC_SUBST(PARALLELISM)
14051 IWYU_PATH="$with_iwyu"
14052 AC_SUBST(IWYU_PATH)
14053 if test ! -z "$IWYU_PATH"; then
14054     if test ! -f "$IWYU_PATH"; then
14055         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
14056     fi
14060 # Set up ILIB for MSVC build
14062 ILIB1=
14063 if test "$build_os" = "cygwin"; then
14064     ILIB="."
14065     if test -n "$JAVA_HOME"; then
14066         ILIB="$ILIB;$JAVA_HOME/lib"
14067     fi
14068     ILIB1=-link
14069     ILIB="$ILIB;$COMPATH/lib/$WIN_HOST_ARCH"
14070     ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/$WIN_HOST_ARCH"
14071     ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
14072     ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
14073     if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
14074         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
14075         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
14076     fi
14077     PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/$WIN_HOST_ARCH"
14078     ucrtlibpath_formatted=$formatted_path
14079     ILIB="$ILIB;$ucrtlibpath_formatted"
14080     ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
14081     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
14082         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
14083     else
14084         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WIN_HOST_ARCH"
14085     fi
14087     if test "$cross_compiling" != "yes"; then
14088         ILIB_FOR_BUILD="$ILIB"
14089     fi
14091 AC_SUBST(ILIB)
14092 AC_SUBST(ILIB_FOR_BUILD)
14094 # ===================================================================
14095 # Creating bigger shared library to link against
14096 # ===================================================================
14097 AC_MSG_CHECKING([whether to create huge library])
14098 MERGELIBS=
14100 if test $_os = iOS -o $_os = Android; then
14101     # Never any point in mergelibs for these as we build just static
14102     # libraries anyway...
14103     enable_mergelibs=no
14106 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
14107     if test $_os != Linux -a $_os != WINNT; then
14108         add_warning "--enable-mergelibs is not tested for this platform"
14109     fi
14110     MERGELIBS="TRUE"
14111     AC_MSG_RESULT([yes])
14112     AC_DEFINE(ENABLE_MERGELIBS)
14113 else
14114     AC_MSG_RESULT([no])
14116 AC_SUBST([MERGELIBS])
14118 dnl ===================================================================
14119 dnl icerun is a wrapper that stops us spawning tens of processes
14120 dnl locally - for tools that can't be executed on the compile cluster
14121 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
14122 dnl ===================================================================
14123 AC_MSG_CHECKING([whether to use icerun wrapper])
14124 ICECREAM_RUN=
14125 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
14126     ICECREAM_RUN=icerun
14127     AC_MSG_RESULT([yes])
14128 else
14129     AC_MSG_RESULT([no])
14131 AC_SUBST(ICECREAM_RUN)
14133 dnl ===================================================================
14134 dnl Setup the ICECC_VERSION for the build the same way it was set for
14135 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
14136 dnl ===================================================================
14137 x_ICECC_VERSION=[\#]
14138 if test -n "$ICECC_VERSION" ; then
14139     x_ICECC_VERSION=
14141 AC_SUBST(x_ICECC_VERSION)
14142 AC_SUBST(ICECC_VERSION)
14144 dnl ===================================================================
14146 AC_MSG_CHECKING([MPL subset])
14147 MPL_SUBSET=
14149 if test "$enable_mpl_subset" = "yes"; then
14150     warn_report=false
14151     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
14152         warn_report=true
14153     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
14154         warn_report=true
14155     fi
14156     if test "$warn_report" = "true"; then
14157         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
14158     fi
14159     if test "x$enable_postgresql_sdbc" != "xno"; then
14160         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
14161     fi
14162     if test "$enable_lotuswordpro" = "yes"; then
14163         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
14164     fi
14165     if test "$WITH_WEBDAV" = "neon"; then
14166         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
14167     fi
14168     if test -n "$ENABLE_POPPLER"; then
14169         if test "x$SYSTEM_POPPLER" = "x"; then
14170             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
14171         fi
14172     fi
14173     # cf. m4/libo_check_extension.m4
14174     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
14175         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
14176     fi
14177     for theme in $WITH_THEMES; do
14178         case $theme in
14179         breeze|breeze_dark|breeze_dark_svg|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #denylist of icon themes under GPL or LGPL
14180             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=colibre]) ;;
14181         *) : ;;
14182         esac
14183     done
14185     ENABLE_OPENGL_TRANSITIONS=
14187     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
14188         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
14189     fi
14191     MPL_SUBSET="TRUE"
14192     AC_DEFINE(MPL_HAVE_SUBSET)
14193     AC_MSG_RESULT([only])
14194 else
14195     AC_MSG_RESULT([no restrictions])
14197 AC_SUBST(MPL_SUBSET)
14199 dnl ===================================================================
14201 AC_MSG_CHECKING([formula logger])
14202 ENABLE_FORMULA_LOGGER=
14204 if test "x$enable_formula_logger" = "xyes"; then
14205     AC_MSG_RESULT([yes])
14206     AC_DEFINE(ENABLE_FORMULA_LOGGER)
14207     ENABLE_FORMULA_LOGGER=TRUE
14208 elif test -n "$ENABLE_DBGUTIL" ; then
14209     AC_MSG_RESULT([yes])
14210     AC_DEFINE(ENABLE_FORMULA_LOGGER)
14211     ENABLE_FORMULA_LOGGER=TRUE
14212 else
14213     AC_MSG_RESULT([no])
14216 AC_SUBST(ENABLE_FORMULA_LOGGER)
14218 dnl ===================================================================
14219 dnl Checking for active Antivirus software.
14220 dnl ===================================================================
14222 if test $_os = WINNT -a -f "$SRC_ROOT/antivirusDetection.vbs" ; then
14223     AC_MSG_CHECKING([for active Antivirus software])
14224     ANTIVIRUS_LIST=`cscript.exe //Nologo $SRC_ROOT/antivirusDetection.vbs`
14225     if [ [ "$ANTIVIRUS_LIST" != "NULL" ] ]; then
14226         if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then
14227             AC_MSG_RESULT([found])
14228             EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
14229             echo $EICAR_STRING > $SRC_ROOT/eicar
14230             EICAR_TEMP_FILE_CONTENTS=`cat $SRC_ROOT/eicar`
14231             rm $SRC_ROOT/eicar
14232             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
14233                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
14234             fi
14235             echo $EICAR_STRING > $BUILDDIR/eicar
14236             EICAR_TEMP_FILE_CONTENTS=`cat $BUILDDIR/eicar`
14237             rm $BUILDDIR/eicar
14238             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
14239                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
14240             fi
14241             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"
14242         else
14243             AC_MSG_RESULT([not found])
14244         fi
14245     else
14246         AC_MSG_RESULT([n/a])
14247     fi
14250 dnl ===================================================================
14251 dnl Setting up the environment.
14252 dnl ===================================================================
14253 AC_MSG_NOTICE([setting up the build environment variables...])
14255 AC_SUBST(COMPATH)
14257 if test "$build_os" = "cygwin"; then
14258     if test -d "$COMPATH/atlmfc/lib/spectre"; then
14259         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
14260         ATL_INCLUDE="$COMPATH/atlmfc/include"
14261     elif test -d "$COMPATH/atlmfc/lib"; then
14262         ATL_LIB="$COMPATH/atlmfc/lib"
14263         ATL_INCLUDE="$COMPATH/atlmfc/include"
14264     else
14265         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
14266         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
14267     fi
14268     ATL_LIB="$ATL_LIB/$WIN_HOST_ARCH"
14269     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
14270     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
14272     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
14273     PathFormat "/usr/bin/find.exe"
14274     FIND="$formatted_path"
14275     PathFormat "/usr/bin/sort.exe"
14276     SORT="$formatted_path"
14277     PathFormat "/usr/bin/grep.exe"
14278     WIN_GREP="$formatted_path"
14279     PathFormat "/usr/bin/ls.exe"
14280     WIN_LS="$formatted_path"
14281     PathFormat "/usr/bin/touch.exe"
14282     WIN_TOUCH="$formatted_path"
14283 else
14284     FIND=find
14285     SORT=sort
14288 AC_SUBST(ATL_INCLUDE)
14289 AC_SUBST(ATL_LIB)
14290 AC_SUBST(FIND)
14291 AC_SUBST(SORT)
14292 AC_SUBST(WIN_GREP)
14293 AC_SUBST(WIN_LS)
14294 AC_SUBST(WIN_TOUCH)
14296 AC_SUBST(BUILD_TYPE)
14298 AC_SUBST(SOLARINC)
14300 PathFormat "$PERL"
14301 PERL="$formatted_path"
14302 AC_SUBST(PERL)
14304 if test -n "$TMPDIR"; then
14305     TEMP_DIRECTORY="$TMPDIR"
14306 else
14307     TEMP_DIRECTORY="/tmp"
14309 if test "$build_os" = "cygwin"; then
14310     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
14312 AC_SUBST(TEMP_DIRECTORY)
14314 # setup the PATH for the environment
14315 if test -n "$LO_PATH_FOR_BUILD"; then
14316     LO_PATH="$LO_PATH_FOR_BUILD"
14317     case "$host_os" in
14318     cygwin*|wsl*)
14319         pathmunge "$MSVC_HOST_PATH" "before"
14320         ;;
14321     esac
14322 else
14323     LO_PATH="$PATH"
14325     case "$host_os" in
14327     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
14328         if test "$ENABLE_JAVA" != ""; then
14329             pathmunge "$JAVA_HOME/bin" "after"
14330         fi
14331         ;;
14333     cygwin*|wsl*)
14334         # Win32 make needs native paths
14335         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
14336             LO_PATH=`cygpath -p -m "$PATH"`
14337         fi
14338         if test "$WIN_BUILD_ARCH" = "x64"; then
14339             # needed for msi packaging
14340             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
14341         fi
14342         # .NET 4.6 and higher don't have bin directory
14343         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
14344             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
14345         fi
14346         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
14347         pathmunge "$CSC_PATH" "before"
14348         pathmunge "$MIDL_PATH" "before"
14349         pathmunge "$AL_PATH" "before"
14350         pathmunge "$MSVC_MULTI_PATH" "before"
14351         pathmunge "$MSVC_BUILD_PATH" "before"
14352         if test -n "$MSBUILD_PATH" ; then
14353             pathmunge "$MSBUILD_PATH" "before"
14354         fi
14355         pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/$WIN_BUILD_ARCH" "before"
14356         if test "$ENABLE_JAVA" != ""; then
14357             if test -d "$JAVA_HOME/jre/bin/client"; then
14358                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
14359             fi
14360             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
14361                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
14362             fi
14363             pathmunge "$JAVA_HOME/bin" "before"
14364         fi
14365         pathmunge "$MSVC_HOST_PATH" "before"
14366         ;;
14368     solaris*)
14369         pathmunge "/usr/css/bin" "before"
14370         if test "$ENABLE_JAVA" != ""; then
14371             pathmunge "$JAVA_HOME/bin" "after"
14372         fi
14373         ;;
14374     esac
14377 AC_SUBST(LO_PATH)
14379 # Allow to pass LO_ELFCHECK_ALLOWLIST from autogen.input to bin/check-elf-dynamic-objects:
14380 if test "$LO_ELFCHECK_ALLOWLIST" = x || test "${LO_ELFCHECK_ALLOWLIST-x}" != x; then
14381     x_LO_ELFCHECK_ALLOWLIST=
14382 else
14383     x_LO_ELFCHECK_ALLOWLIST=[\#]
14385 AC_SUBST(x_LO_ELFCHECK_ALLOWLIST)
14386 AC_SUBST(LO_ELFCHECK_ALLOWLIST)
14388 libo_FUZZ_SUMMARY
14390 # Generate a configuration sha256 we can use for deps
14391 if test -f config_host.mk; then
14392     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
14394 if test -f config_host_lang.mk; then
14395     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
14398 CFLAGS=$my_original_CFLAGS
14399 CXXFLAGS=$my_original_CXXFLAGS
14400 CPPFLAGS=$my_original_CPPFLAGS
14402 AC_CONFIG_LINKS([include:include])
14404 # Keep in sync with list of files far up, at AC_MSG_CHECKING([for
14405 # BUILD platform configuration] - otherwise breaks cross building
14406 AC_CONFIG_FILES([config_host.mk
14407                  config_host_lang.mk
14408                  Makefile
14409                  bin/bffvalidator.sh
14410                  bin/odfvalidator.sh
14411                  bin/officeotron.sh
14412                  hardened_runtime.xcent
14413                  instsetoo_native/util/openoffice.lst
14414                  sysui/desktop/macosx/Info.plist
14415                  vs-code-template.code-workspace:.vscode/vs-code-template.code-workspace.in])
14416 AC_CONFIG_HEADERS([config_host/config_buildid.h])
14417 AC_CONFIG_HEADERS([config_host/config_box2d.h])
14418 AC_CONFIG_HEADERS([config_host/config_clang.h])
14419 AC_CONFIG_HEADERS([config_host/config_crypto.h])
14420 AC_CONFIG_HEADERS([config_host/config_dconf.h])
14421 AC_CONFIG_HEADERS([config_host/config_eot.h])
14422 AC_CONFIG_HEADERS([config_host/config_extensions.h])
14423 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
14424 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
14425 AC_CONFIG_HEADERS([config_host/config_dbus.h])
14426 AC_CONFIG_HEADERS([config_host/config_features.h])
14427 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
14428 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
14429 AC_CONFIG_HEADERS([config_host/config_firebird.h])
14430 AC_CONFIG_HEADERS([config_host/config_folders.h])
14431 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
14432 AC_CONFIG_HEADERS([config_host/config_gio.h])
14433 AC_CONFIG_HEADERS([config_host/config_global.h])
14434 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
14435 AC_CONFIG_HEADERS([config_host/config_java.h])
14436 AC_CONFIG_HEADERS([config_host/config_langs.h])
14437 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
14438 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
14439 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
14440 AC_CONFIG_HEADERS([config_host/config_locales.h])
14441 AC_CONFIG_HEADERS([config_host/config_mpl.h])
14442 AC_CONFIG_HEADERS([config_host/config_oox.h])
14443 AC_CONFIG_HEADERS([config_host/config_options.h])
14444 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
14445 AC_CONFIG_HEADERS([config_host/config_zxing.h])
14446 AC_CONFIG_HEADERS([config_host/config_skia.h])
14447 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
14448 AC_CONFIG_HEADERS([config_host/config_vendor.h])
14449 AC_CONFIG_HEADERS([config_host/config_vcl.h])
14450 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
14451 AC_CONFIG_HEADERS([config_host/config_version.h])
14452 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
14453 AC_CONFIG_HEADERS([config_host/config_poppler.h])
14454 AC_CONFIG_HEADERS([config_host/config_python.h])
14455 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
14456 AC_OUTPUT
14458 if test "$CROSS_COMPILING" = TRUE; then
14459     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
14462 # touch the config timestamp file
14463 if test ! -f config_host.mk.stamp; then
14464     echo > config_host.mk.stamp
14465 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
14466     echo "Host Configuration unchanged - avoiding scp2 stamp update"
14467 else
14468     echo > config_host.mk.stamp
14471 # touch the config lang timestamp file
14472 if test ! -f config_host_lang.mk.stamp; then
14473     echo > config_host_lang.mk.stamp
14474 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
14475     echo "Language Configuration unchanged - avoiding scp2 stamp update"
14476 else
14477     echo > config_host_lang.mk.stamp
14481 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
14482         -a "$build_os" = "cygwin"; then
14484 cat << _EOS
14485 ****************************************************************************
14486 WARNING:
14487 Your make version is known to be horribly slow, and hard to debug
14488 problems with. To get a reasonably functional make please do:
14490 to install a pre-compiled binary make for Win32
14492  mkdir -p /opt/lo/bin
14493  cd /opt/lo/bin
14494  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
14495  cp make-4.2.1-msvc.exe make
14496  chmod +x make
14498 to install from source:
14499 place yourself in a working directory of you choice.
14501  git clone git://git.savannah.gnu.org/make.git
14503  [go to Start menu, open "Visual Studio 2019", click "x86 Native Tools Command Prompt" or "x64 Native Tools Command Prompt"]
14504  set PATH=%PATH%;C:\Cygwin\bin
14505  [or Cygwin64, if that is what you have]
14506  cd path-to-make-repo-you-cloned-above
14507  build_w32.bat --without-guile
14509 should result in a WinRel/gnumake.exe.
14510 Copy it to the Cygwin /opt/lo/bin directory as make.exe
14512 Then re-run autogen.sh
14514 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
14515 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
14517 _EOS
14518 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
14519     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
14524 cat << _EOF
14525 ****************************************************************************
14527 To build, run:
14528 $GNUMAKE
14530 To view some help, run:
14531 $GNUMAKE help
14533 _EOF
14535 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
14536     cat << _EOF
14537 After the build has finished successfully, you can immediately run what you built using the command:
14538 _EOF
14540     if test $_os = Darwin; then
14541         echo open instdir/$PRODUCTNAME_WITHOUT_SPACES.app
14542     else
14543         echo instdir/program/soffice
14544     fi
14545     cat << _EOF
14547 If you want to run the smoketest, run:
14548 $GNUMAKE check
14550 _EOF
14553 if test -s "$WARNINGS_FILE_FOR_BUILD"; then
14554     echo "BUILD / cross-toolset config, repeated ($WARNINGS_FILE_FOR_BUILD)"
14555     cat "$WARNINGS_FILE_FOR_BUILD"
14556     echo
14559 if test -s "$WARNINGS_FILE"; then
14560     echo "HOST config ($WARNINGS_FILE)"
14561     cat "$WARNINGS_FILE"
14564 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: