bump product version to 7.2.5.1
[LibreOffice.git] / configure.ac
blob1739115ca9dc769b5320e7856e9bbbd89c6604b6
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.2.5.1],[],[],[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_curl=yes
823 test_gdb_index=no
824 test_openldap=yes
825 test_split_debug=no
826 test_webdav=yes
828 # There is currently just iOS not using salplug, so this explicitly enables it.
829 # must: using_freetype_fontconfig
830 #  may: using_headless_plugin defaults to $using_freetype_fontconfig
831 using_vclplug=yes
832 # must: using_x11
834 # Default values, as such probably valid just for Linux, set
835 # differently below just for Mac OSX, but at least better than
836 # hardcoding these as we used to do. Much of this is duplicated also
837 # in solenv for old build system and for gbuild, ideally we should
838 # perhaps define stuff like this only here in configure.ac?
840 LINKFLAGSSHL="-shared"
841 PICSWITCH="-fpic"
842 DLLPOST=".so"
844 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
846 INSTROOTBASESUFFIX=
847 INSTROOTCONTENTSUFFIX=
848 SDKDIRNAME=sdk
850 HOST_PLATFORM="$host"
852 host_cpu_for_clang="$host_cpu"
854 case "$host_os" in
856 solaris*)
857     using_freetype_fontconfig=yes
858     using_x11=yes
859     build_skia=yes
860     _os=SunOS
862     dnl ===========================================================
863     dnl Check whether we're using Solaris 10 - SPARC or Intel.
864     dnl ===========================================================
865     AC_MSG_CHECKING([the Solaris operating system release])
866     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
867     if test "$_os_release" -lt "10"; then
868         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
869     else
870         AC_MSG_RESULT([ok ($_os_release)])
871     fi
873     dnl Check whether we're using a SPARC or i386 processor
874     AC_MSG_CHECKING([the processor type])
875     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
876         AC_MSG_RESULT([ok ($host_cpu)])
877     else
878         AC_MSG_ERROR([only SPARC and i386 processors are supported])
879     fi
880     ;;
882 linux-gnu*|k*bsd*-gnu*)
883     using_freetype_fontconfig=yes
884     using_x11=yes
885     build_skia=yes
886     test_gdb_index=yes
887     test_split_debug=yes
888     if test "$enable_fuzzers" = yes; then
889         test_system_freetype=no
890     fi
891     _os=Linux
892     ;;
894 gnu)
895     using_freetype_fontconfig=yes
896     using_x11=no
897     _os=GNU
898      ;;
900 cygwin*|wsl*)
901     # When building on Windows normally with MSVC under Cygwin,
902     # configure thinks that the host platform (the platform the
903     # built code will run on) is Cygwin, even if it obviously is
904     # Windows, which in Autoconf terminology is called
905     # "mingw32". (Which is misleading as MinGW is the name of the
906     # tool-chain, not an operating system.)
908     # Somewhat confusing, yes. But this configure script doesn't
909     # look at $host etc that much, it mostly uses its own $_os
910     # variable, set here in this case statement.
912     using_freetype_fontconfig=no
913     using_x11=no
914     test_openldap=no
915     build_skia=yes
916     _os=WINNT
918     DLLPOST=".dll"
919     LINKFLAGSNOUNDEFS=
921     if test "$host_cpu" = "aarch64"; then
922         enable_gpgmepp=no
923         enable_coinmp=no
924         enable_firebird_sdbc=no
925     fi
926     ;;
928 darwin*|macos*) # macOS
929     using_freetype_fontconfig=no
930     using_x11=no
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     with_ppds=no
985     if test "$enable_ios_simulator" = "yes"; then
986         host=x86_64-apple-darwin
987     fi
988     # See comment above the case "$host_os"
989     LINKFLAGSSHL="-dynamiclib -single_module"
991     # -fPIC is default
992     PICSWITCH=""
994     DLLPOST=".dylib"
996     # -undefined error is the default
997     LINKFLAGSNOUNDEFS=""
999     # HOST_PLATFORM is used for external projects and their configury typically doesn't like the "ios"
1000     # part, so use aarch64-apple-darwin for now.
1001     HOST_PLATFORM=aarch64-apple-darwin
1003     # Apple's Clang uses "arm64"
1004     host_cpu_for_clang=arm64
1007 freebsd*)
1008     using_freetype_fontconfig=yes
1009     using_x11=yes
1010     build_skia=yes
1011     AC_MSG_CHECKING([the FreeBSD operating system release])
1012     if test -n "$with_os_version"; then
1013         OSVERSION="$with_os_version"
1014     else
1015         OSVERSION=`/sbin/sysctl -n kern.osreldate`
1016     fi
1017     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
1018     AC_MSG_CHECKING([which thread library to use])
1019     if test "$OSVERSION" -lt "500016"; then
1020         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1021         PTHREAD_LIBS="-pthread"
1022     elif test "$OSVERSION" -lt "502102"; then
1023         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1024         PTHREAD_LIBS="-lc_r"
1025     else
1026         PTHREAD_CFLAGS=""
1027         PTHREAD_LIBS="-pthread"
1028     fi
1029     AC_MSG_RESULT([$PTHREAD_LIBS])
1030     _os=FreeBSD
1031     ;;
1033 *netbsd*)
1034     using_freetype_fontconfig=yes
1035     using_x11=yes
1036     test_gtk3_kde5=no
1037     build_skia=yes
1038     PTHREAD_LIBS="-pthread -lpthread"
1039     _os=NetBSD
1040     ;;
1042 aix*)
1043     using_freetype_fontconfig=yes
1044     using_x11=yes
1045     test_randr=no
1046     test_gstreamer_1_0=no
1047     PTHREAD_LIBS=-pthread
1048     _os=AIX
1049     ;;
1051 openbsd*)
1052     using_freetype_fontconfig=yes
1053     using_x11=yes
1054     PTHREAD_CFLAGS="-D_THREAD_SAFE"
1055     PTHREAD_LIBS="-pthread"
1056     _os=OpenBSD
1057     ;;
1059 dragonfly*)
1060     using_freetype_fontconfig=yes
1061     using_x11=yes
1062     build_skia=yes
1063     PTHREAD_LIBS="-pthread"
1064     _os=DragonFly
1065     ;;
1067 linux-android*)
1068     using_freetype_fontconfig=yes
1069     using_headless_plugin=no
1070     using_x11=no
1071     build_crypto=no
1072     test_openldap=no
1073     test_system_freetype=no
1074     test_webdav=no
1075     disable_database_connectivity_dependencies
1076     enable_lotuswordpro=no
1077     enable_mpl_subset=yes
1078     enable_cairo_canvas=no
1079     enable_coinmp=yes
1080     enable_lpsolve=no
1081     enable_odk=no
1082     enable_python=no
1083     _os=Android
1085     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
1086     ;;
1088 haiku*)
1089     using_freetype_fontconfig=yes
1090     using_x11=no
1091     test_gtk3_kde5=no
1092     test_kf5=yes
1093     enable_odk=no
1094     enable_coinmp=no
1095     enable_pdfium=no
1096     enable_sdremote=no
1097     enable_postgresql_sdbc=no
1098     enable_firebird_sdbc=no
1099     _os=Haiku
1100     ;;
1102 emscripten)
1103     using_freetype_fontconfig=yes
1104     using_x11=no
1105     test_openldap=no
1106     enable_compiler_plugins=no
1107     test_cmis=no
1108     test_webdav=no
1109     enable_database_connectivity=no
1110     enable_lpsolve=no
1111     with_system_zlib=no
1112     with_theme="breeze"
1113     _os=Emscripten
1114     ;;
1117     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
1118     ;;
1119 esac
1121 AC_SUBST(HOST_PLATFORM)
1123 if test -z "$using_x11" -o -z "$using_freetype_fontconfig"; then
1124     AC_MSG_ERROR([You must set \$using_freetype_fontconfig and \$using_x11 for your platform])
1127 # Set defaults, if not set by platform
1128 test "${test_cups+set}" = set || test_cups="$using_x11"
1129 test "${test_dbus+set}" = set || test_dbus="$using_x11"
1130 test "${test_gstreamer_1_0+set}" = set || test_gstreamer_1_0="$using_x11"
1131 test "${test_gtk3+set}" = set || test_gtk3="$using_x11"
1132 test "${test_gtk4+set}" = set || test_gtk4="$using_x11"
1133 test "${test_kf5+set}" = set || test_kf5="$using_x11"
1134 # don't handle test_qt5, so it can disable test_kf5 later
1135 test "${test_randr+set}" = set || test_randr="$using_x11"
1136 test "${test_xrender+set}" = set || test_xrender="$using_x11"
1137 test "${using_headless_plugin+set}" = set || using_headless_plugin="$using_freetype_fontconfig"
1139 test "${test_gtk3_kde5+set}" != set -a "$test_kf5" = yes -a "$test_gtk3" = yes && test_gtk3_kde5="yes"
1140 test "${test_system_fontconfig+set}" != set -a "${test_system_freetype+set}" = set && test_system_fontconfig="$test_system_freetype"
1141 test "${test_system_freetype+set}" != set -a "${test_system_fontconfig+set}" = set && test_system_freetype="$test_system_fontconfig"
1143 # convenience / platform overriding "fixes"
1144 # Don't sort!
1145 test "$test_kf5" = yes -a "$test_qt5" = no && test_kf5=no
1146 test "$test_kf5" = yes && test_qt5=yes
1147 test "$test_gtk3" != yes -o "$test_kf5" != yes && test_gtk3_kde5=no
1148 test "$using_freetype_fontconfig" = no && using_headless_plugin=no
1149 test "$using_freetype_fontconfig" = yes && test_cairo=yes
1151 # Keep in sync with the above $using_x11 depending test default list
1152 disable_x11_tests()
1154     test_cups=no
1155     test_dbus=no
1156     test_gstreamer_1_0=no
1157     test_gtk3_kde5=no
1158     test_gtk3=no
1159     test_gtk4=no
1160     test_kf5=no
1161     test_qt5=no
1162     test_randr=no
1163     test_xrender=no
1166 test "$using_x11" = yes && USING_X11=TRUE
1168 if test "$using_freetype_fontconfig" = yes; then
1169     if test "$using_headless_plugin" = yes; then
1170         AC_DEFINE(ENABLE_HEADLESS)
1171         ENABLE_HEADLESS=TRUE
1172     fi
1175 AC_SUBST(ENABLE_HEADLESS)
1177 AC_MSG_NOTICE([VCL platform uses freetype+fontconfig: $using_freetype_fontconfig])
1178 AC_MSG_NOTICE([VCL platform uses headless plugin: $using_headless_plugin])
1179 AC_MSG_NOTICE([VCL platform uses vclplug: $using_vclplug])
1180 AC_MSG_NOTICE([VCL platform uses X11: $using_x11])
1182 # ===================================================================
1184 # End initial platform setup
1186 # ===================================================================
1188 if test "$_os" = "Android" ; then
1189     # Verify that the NDK and SDK options are proper
1190     if test -z "$with_android_ndk"; then
1191         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
1192     elif test ! -f "$ANDROID_NDK_HOME/meta/abis.json"; then
1193         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
1194     fi
1196     if test -z "$ANDROID_SDK_HOME"; then
1197         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
1198     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
1199         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
1200     fi
1202     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
1203     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
1204         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
1205                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
1206                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
1207         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
1208         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
1209         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
1210     fi
1211     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
1212         AC_MSG_WARN([android support repository not found - install with
1213                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
1214                      to allow the build to download the specified version of the android support libraries])
1215         add_warning "android support repository not found - install with"
1216         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
1217         add_warning "to allow the build to download the specified version of the android support libraries"
1218     fi
1221 if test "$_os" = "AIX"; then
1222     AC_PATH_PROG(GAWK, gawk)
1223     if test -z "$GAWK"; then
1224         AC_MSG_ERROR([gawk not found in \$PATH])
1225     fi
1228 AC_SUBST(SDKDIRNAME)
1230 AC_SUBST(PTHREAD_CFLAGS)
1231 AC_SUBST(PTHREAD_LIBS)
1233 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
1234 # By default use the ones specified by our build system,
1235 # but explicit override is possible.
1236 AC_MSG_CHECKING(for explicit AFLAGS)
1237 if test -n "$AFLAGS"; then
1238     AC_MSG_RESULT([$AFLAGS])
1239     x_AFLAGS=
1240 else
1241     AC_MSG_RESULT(no)
1242     x_AFLAGS=[\#]
1244 AC_MSG_CHECKING(for explicit CFLAGS)
1245 if test -n "$CFLAGS"; then
1246     AC_MSG_RESULT([$CFLAGS])
1247     x_CFLAGS=
1248 else
1249     AC_MSG_RESULT(no)
1250     x_CFLAGS=[\#]
1252 AC_MSG_CHECKING(for explicit CXXFLAGS)
1253 if test -n "$CXXFLAGS"; then
1254     AC_MSG_RESULT([$CXXFLAGS])
1255     x_CXXFLAGS=
1256 else
1257     AC_MSG_RESULT(no)
1258     x_CXXFLAGS=[\#]
1260 AC_MSG_CHECKING(for explicit OBJCFLAGS)
1261 if test -n "$OBJCFLAGS"; then
1262     AC_MSG_RESULT([$OBJCFLAGS])
1263     x_OBJCFLAGS=
1264 else
1265     AC_MSG_RESULT(no)
1266     x_OBJCFLAGS=[\#]
1268 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
1269 if test -n "$OBJCXXFLAGS"; then
1270     AC_MSG_RESULT([$OBJCXXFLAGS])
1271     x_OBJCXXFLAGS=
1272 else
1273     AC_MSG_RESULT(no)
1274     x_OBJCXXFLAGS=[\#]
1276 AC_MSG_CHECKING(for explicit LDFLAGS)
1277 if test -n "$LDFLAGS"; then
1278     AC_MSG_RESULT([$LDFLAGS])
1279     x_LDFLAGS=
1280 else
1281     AC_MSG_RESULT(no)
1282     x_LDFLAGS=[\#]
1284 AC_SUBST(AFLAGS)
1285 AC_SUBST(CFLAGS)
1286 AC_SUBST(CXXFLAGS)
1287 AC_SUBST(OBJCFLAGS)
1288 AC_SUBST(OBJCXXFLAGS)
1289 AC_SUBST(LDFLAGS)
1290 AC_SUBST(x_AFLAGS)
1291 AC_SUBST(x_CFLAGS)
1292 AC_SUBST(x_CXXFLAGS)
1293 AC_SUBST(x_OBJCFLAGS)
1294 AC_SUBST(x_OBJCXXFLAGS)
1295 AC_SUBST(x_LDFLAGS)
1297 dnl These are potentially set for MSVC, in the code checking for UCRT below:
1298 my_original_CFLAGS=$CFLAGS
1299 my_original_CXXFLAGS=$CXXFLAGS
1300 my_original_CPPFLAGS=$CPPFLAGS
1302 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
1303 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
1304 dnl AC_PROG_CC internally.
1305 if test "$_os" != "WINNT"; then
1306     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
1307     save_CFLAGS=$CFLAGS
1308     AC_PROG_CC
1309     CFLAGS=$save_CFLAGS
1310     if test -z "$CC_BASE"; then
1311         CC_BASE=`first_arg_basename "$CC"`
1312     fi
1315 if test "$_os" != "WINNT"; then
1316     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
1317 else
1318     ENDIANNESS=little
1320 AC_SUBST(ENDIANNESS)
1322 if test $_os != "WINNT"; then
1323     save_LIBS="$LIBS"
1324     AC_SEARCH_LIBS([dlsym], [dl],
1325         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
1326         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
1327     LIBS="$save_LIBS"
1329 AC_SUBST(DLOPEN_LIBS)
1331 dnl ===================================================================
1332 dnl Sanity checks for Emscripten SDK setup
1333 dnl ===================================================================
1335 if test "$_os" = "Emscripten"; then
1336     EMSCRIPTEN_ERROR=0
1337     if ! which emconfigure >/dev/null 2>&1; then
1338         AC_MSG_WARN([emconfigure must be in your \$PATH])
1339         EMSCRIPTEN_ERROR=1
1340     fi
1341     if test -z "$EMMAKEN_JUST_CONFIGURE"; then
1342         AC_MSG_WARN(["\$EMMAKEN_JUST_CONFIGURE wasn't set by emconfigure. Prefix configure or use autogen.sh])
1343         EMSCRIPTEN_ERROR=1
1344     fi
1345     if test $EMSCRIPTEN_ERROR -ne 0; then
1346         AC_MSG_ERROR(["Please fix your EMSDK setup to build with Emscripten!"])
1347     fi
1350 ###############################################################################
1351 # Extensions switches --enable/--disable
1352 ###############################################################################
1353 # By default these should be enabled unless having extra dependencies.
1354 # If there is extra dependency over configure options then the enable should
1355 # be automagic based on whether the requiring feature is enabled or not.
1356 # All this options change anything only with --enable-extension-integration.
1358 # The name of this option and its help string makes it sound as if
1359 # extensions are built anyway, just not integrated in the installer,
1360 # if you use --disable-extension-integration. Is that really the
1361 # case?
1363 AC_ARG_ENABLE(ios-simulator,
1364     AS_HELP_STRING([--enable-ios-simulator],
1365         [build for iOS simulator])
1368 libo_FUZZ_ARG_ENABLE(extension-integration,
1369     AS_HELP_STRING([--disable-extension-integration],
1370         [Disable integration of the built extensions in the installer of the
1371          product. Use this switch to disable the integration.])
1374 AC_ARG_ENABLE(avmedia,
1375     AS_HELP_STRING([--disable-avmedia],
1376         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
1379 AC_ARG_ENABLE(database-connectivity,
1380     AS_HELP_STRING([--disable-database-connectivity],
1381         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1384 # This doesn't mean not building (or "integrating") extensions
1385 # (although it probably should; i.e. it should imply
1386 # --disable-extension-integration I guess), it means not supporting
1387 # any extension mechanism at all
1388 libo_FUZZ_ARG_ENABLE(extensions,
1389     AS_HELP_STRING([--disable-extensions],
1390         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1393 AC_ARG_ENABLE(scripting,
1394     AS_HELP_STRING([--disable-scripting],
1395         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1398 # This is mainly for Android and iOS, but could potentially be used in some
1399 # special case otherwise, too, so factored out as a separate setting
1401 AC_ARG_ENABLE(dynamic-loading,
1402     AS_HELP_STRING([--disable-dynamic-loading],
1403         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1406 libo_FUZZ_ARG_ENABLE(report-builder,
1407     AS_HELP_STRING([--disable-report-builder],
1408         [Disable the Report Builder.])
1411 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1412     AS_HELP_STRING([--enable-ext-wiki-publisher],
1413         [Enable the Wiki Publisher extension.])
1416 libo_FUZZ_ARG_ENABLE(lpsolve,
1417     AS_HELP_STRING([--disable-lpsolve],
1418         [Disable compilation of the lp solve solver ])
1420 libo_FUZZ_ARG_ENABLE(coinmp,
1421     AS_HELP_STRING([--disable-coinmp],
1422         [Disable compilation of the CoinMP solver ])
1425 libo_FUZZ_ARG_ENABLE(pdfimport,
1426     AS_HELP_STRING([--disable-pdfimport],
1427         [Disable building the PDF import feature.])
1430 libo_FUZZ_ARG_ENABLE(pdfium,
1431     AS_HELP_STRING([--disable-pdfium],
1432         [Disable building PDFium. Results in unsecure PDF signature verification.])
1435 libo_FUZZ_ARG_ENABLE(skia,
1436     AS_HELP_STRING([--disable-skia],
1437         [Disable building Skia. Use --enable-skia=debug to build without optimizations.])
1440 ###############################################################################
1442 dnl ---------- *** ----------
1444 libo_FUZZ_ARG_ENABLE(mergelibs,
1445     AS_HELP_STRING([--enable-mergelibs],
1446         [Merge several of the smaller libraries into one big, "merged", one.])
1449 libo_FUZZ_ARG_ENABLE(breakpad,
1450     AS_HELP_STRING([--enable-breakpad],
1451         [Enables breakpad for crash reporting.])
1454 libo_FUZZ_ARG_ENABLE(crashdump,
1455     AS_HELP_STRING([--disable-crashdump],
1456         [Disable dump.ini and dump-file, when --enable-breakpad])
1459 AC_ARG_ENABLE(fetch-external,
1460     AS_HELP_STRING([--disable-fetch-external],
1461         [Disables fetching external tarballs from web sources.])
1464 AC_ARG_ENABLE(fuzzers,
1465     AS_HELP_STRING([--enable-fuzzers],
1466         [Enables building libfuzzer targets for fuzz testing.])
1469 libo_FUZZ_ARG_ENABLE(pch,
1470     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1471         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1472          Using 'system' will include only external headers, 'base' will add also headers
1473          from base modules, 'normal' will also add all headers except from the module built,
1474          'full' will use all suitable headers even from a module itself.])
1477 libo_FUZZ_ARG_ENABLE(epm,
1478     AS_HELP_STRING([--enable-epm],
1479         [LibreOffice includes self-packaging code, that requires epm, however epm is
1480          useless for large scale package building.])
1483 libo_FUZZ_ARG_ENABLE(odk,
1484     AS_HELP_STRING([--enable-odk],
1485         [Enable building the Office Development Kit, the part that extensions need to build against])
1488 AC_ARG_ENABLE(mpl-subset,
1489     AS_HELP_STRING([--enable-mpl-subset],
1490         [Don't compile any pieces which are not MPL or more liberally licensed])
1493 libo_FUZZ_ARG_ENABLE(evolution2,
1494     AS_HELP_STRING([--enable-evolution2],
1495         [Allows the built-in evolution 2 addressbook connectivity build to be
1496          enabled.])
1499 AC_ARG_ENABLE(avahi,
1500     AS_HELP_STRING([--enable-avahi],
1501         [Determines whether to use Avahi to advertise Impress to remote controls.])
1504 libo_FUZZ_ARG_ENABLE(werror,
1505     AS_HELP_STRING([--enable-werror],
1506         [Turn warnings to errors. (Has no effect in modules where the treating
1507          of warnings as errors is disabled explicitly.)]),
1510 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1511     AS_HELP_STRING([--enable-assert-always-abort],
1512         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1515 libo_FUZZ_ARG_ENABLE(dbgutil,
1516     AS_HELP_STRING([--enable-dbgutil],
1517         [Provide debugging support from --enable-debug and include additional debugging
1518          utilities such as object counting or more expensive checks.
1519          This is the recommended option for developers.
1520          Note that this makes the build ABI incompatible, it is not possible to mix object
1521          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1523 libo_FUZZ_ARG_ENABLE(debug,
1524     AS_HELP_STRING([--enable-debug],
1525         [Include debugging information, disable compiler optimization and inlining plus
1526          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1528 libo_FUZZ_ARG_ENABLE(split-debug,
1529     AS_HELP_STRING([--disable-split-debug],
1530         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1531          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1533 libo_FUZZ_ARG_ENABLE(gdb-index,
1534     AS_HELP_STRING([--disable-gdb-index],
1535         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1536          The feature requires the gold or lld linker.]))
1538 libo_FUZZ_ARG_ENABLE(sal-log,
1539     AS_HELP_STRING([--enable-sal-log],
1540         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1542 libo_FUZZ_ARG_ENABLE(symbols,
1543     AS_HELP_STRING([--enable-symbols],
1544         [Generate debug information.
1545          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1546          otherwise. It is possible to explicitly specify gbuild build targets
1547          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1548          everything in the directory; there is no ordering, more specific overrides
1549          more general, and disabling takes precedence).
1550          Example: --enable-symbols="all -sw/ -Library_sc".]))
1552 libo_FUZZ_ARG_ENABLE(optimized,
1553     AS_HELP_STRING([--enable-optimized=<yes/no/debug>],
1554         [Whether to compile with optimization flags.
1555          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1556          otherwise. Using 'debug' will try to use only optimizations that should
1557          not interfere with debugging. For Emscripten we default to optimized (-O1)
1558          debug build, as otherwise binaries become too large.]))
1560 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1561     AS_HELP_STRING([--disable-runtime-optimizations],
1562         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1563          JVM JIT) that are known to interact badly with certain dynamic analysis
1564          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1565          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1566          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1568 AC_ARG_WITH(valgrind,
1569     AS_HELP_STRING([--with-valgrind],
1570         [Make availability of Valgrind headers a hard requirement.]))
1572 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1573     AS_HELP_STRING([--enable-compiler-plugins],
1574         [Enable compiler plugins that will perform additional checks during
1575          building. Enabled automatically by --enable-dbgutil.
1576          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1577 COMPILER_PLUGINS_DEBUG=
1578 if test "$enable_compiler_plugins" = debug; then
1579     enable_compiler_plugins=yes
1580     COMPILER_PLUGINS_DEBUG=TRUE
1583 libo_FUZZ_ARG_ENABLE(compiler-plugins-analyzer-pch,
1584     AS_HELP_STRING([--disable-compiler-plugins-analyzer-pch],
1585         [Disable use of precompiled headers when running the Clang compiler plugin analyzer.  Not
1586          relevant in the --disable-compiler-plugins case.]))
1588 libo_FUZZ_ARG_ENABLE(ooenv,
1589     AS_HELP_STRING([--enable-ooenv],
1590         [Enable ooenv for the instdir installation.]))
1592 AC_ARG_ENABLE(lto,
1593     AS_HELP_STRING([--enable-lto],
1594         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1595          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1596          linker. For MSVC, this option is broken at the moment. This is experimental work
1597          in progress that shouldn't be used unless you are working on it.)]))
1599 AC_ARG_ENABLE(python,
1600     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1601         [Enables or disables Python support at run-time.
1602          Also specifies what Python to use at build-time.
1603          'fully-internal' even forces the internal version for uses of Python
1604          during the build.
1605          On macOS the only choices are
1606          'internal' (default) or 'fully-internal'. Otherwise the default is 'auto'.
1607          ]))
1609 libo_FUZZ_ARG_ENABLE(gtk3,
1610     AS_HELP_STRING([--disable-gtk3],
1611         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1612 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1614 AC_ARG_ENABLE(gtk4,
1615     AS_HELP_STRING([--enable-gtk4],
1616         [Determines whether to use Gtk+ 4.0 vclplug on platforms where Gtk+ 4.0 is available.]))
1618 AC_ARG_ENABLE(introspection,
1619     AS_HELP_STRING([--enable-introspection],
1620         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1621          Linux distributions.)]))
1623 AC_ARG_ENABLE(split-app-modules,
1624     AS_HELP_STRING([--enable-split-app-modules],
1625         [Split file lists for app modules, e.g. base, calc.
1626          Has effect only with make distro-pack-install]),
1629 AC_ARG_ENABLE(split-opt-features,
1630     AS_HELP_STRING([--enable-split-opt-features],
1631         [Split file lists for some optional features, e.g. pyuno, testtool.
1632          Has effect only with make distro-pack-install]),
1635 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1636     AS_HELP_STRING([--disable-cairo-canvas],
1637         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1640 libo_FUZZ_ARG_ENABLE(dbus,
1641     AS_HELP_STRING([--disable-dbus],
1642         [Determines whether to enable features that depend on dbus.
1643          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1644 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1646 libo_FUZZ_ARG_ENABLE(sdremote,
1647     AS_HELP_STRING([--disable-sdremote],
1648         [Determines whether to enable Impress remote control (i.e. the server component).]),
1649 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1651 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1652     AS_HELP_STRING([--disable-sdremote-bluetooth],
1653         [Determines whether to build sdremote with bluetooth support.
1654          Requires dbus on Linux.]))
1656 libo_FUZZ_ARG_ENABLE(gio,
1657     AS_HELP_STRING([--disable-gio],
1658         [Determines whether to use the GIO support.]),
1659 ,test "${enable_gio+set}" = set || enable_gio=yes)
1661 AC_ARG_ENABLE(qt5,
1662     AS_HELP_STRING([--enable-qt5],
1663         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1664          available.]),
1667 AC_ARG_ENABLE(kf5,
1668     AS_HELP_STRING([--enable-kf5],
1669         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1670          KF5 are available.]),
1673 AC_ARG_ENABLE(gtk3_kde5,
1674     AS_HELP_STRING([--enable-gtk3-kde5],
1675         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1676          platforms where Gtk3, Qt5 and Plasma is available.]),
1679 AC_ARG_ENABLE(gui,
1680     AS_HELP_STRING([--disable-gui],
1681         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1682 ,enable_gui=yes)
1684 libo_FUZZ_ARG_ENABLE(randr,
1685     AS_HELP_STRING([--disable-randr],
1686         [Disable RandR support in the vcl project.]),
1687 ,test "${enable_randr+set}" = set || enable_randr=yes)
1689 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1690     AS_HELP_STRING([--disable-gstreamer-1-0],
1691         [Disable building with the gstreamer 1.0 avmedia backend.]),
1692 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1694 libo_FUZZ_ARG_ENABLE([eot],
1695     [AS_HELP_STRING([--enable-eot],
1696         [Enable support for Embedded OpenType fonts.])],
1697 ,test "${enable_eot+set}" = set || enable_eot=no)
1699 libo_FUZZ_ARG_ENABLE(cve-tests,
1700     AS_HELP_STRING([--disable-cve-tests],
1701         [Prevent CVE tests to be executed]),
1704 libo_FUZZ_ARG_ENABLE(chart-tests,
1705     AS_HELP_STRING([--enable-chart-tests],
1706         [Executes chart XShape tests. In a perfect world these tests would be
1707          stable and everyone could run them, in reality it is best to run them
1708          only on a few machines that are known to work and maintained by people
1709          who can judge if a test failure is a regression or not.]),
1712 AC_ARG_ENABLE(build-opensymbol,
1713     AS_HELP_STRING([--enable-build-opensymbol],
1714         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1715          fontforge installed.]),
1718 AC_ARG_ENABLE(dependency-tracking,
1719     AS_HELP_STRING([--enable-dependency-tracking],
1720         [Do not reject slow dependency extractors.])[
1721   --disable-dependency-tracking
1722                           Disables generation of dependency information.
1723                           Speed up one-time builds.],
1726 AC_ARG_ENABLE(icecream,
1727     AS_HELP_STRING([--enable-icecream],
1728         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1729          It defaults to /opt/icecream for the location of the icecream gcc/g++
1730          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1733 AC_ARG_ENABLE(ld,
1734     AS_HELP_STRING([--enable-ld=<linker>],
1735         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1736          By default tries to use the best linker possible, use --disable-ld to use the default linker.
1737          If <linker> contains any ':', the part before the first ':' is used as the value of
1738          -fuse-ld, while the part after the first ':' is used as the value of --ld-path (which is
1739          needed for Clang 12).]),
1742 libo_FUZZ_ARG_ENABLE(cups,
1743     AS_HELP_STRING([--disable-cups],
1744         [Do not build cups support.])
1747 AC_ARG_ENABLE(ccache,
1748     AS_HELP_STRING([--disable-ccache],
1749         [Do not try to use ccache automatically.
1750          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1751          CC/CXX are not yet set, and --enable-icecream is not given, we
1752          attempt to use ccache. --disable-ccache disables ccache completely.
1753          Additionally ccache's depend mode is enabled if possible,
1754          use --enable-ccache=nodepend to enable ccache without depend mode.
1758 libo_FUZZ_ARG_ENABLE(online-update,
1759     AS_HELP_STRING([--enable-online-update],
1760         [Enable the online update service that will check for new versions of
1761          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1762          If the value is "mar", the experimental Mozilla-like update will be
1763          enabled instead of the traditional update mechanism.]),
1766 AC_ARG_WITH(update-config,
1767     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1768                    [Path to the update config ini file]))
1770 libo_FUZZ_ARG_ENABLE(extension-update,
1771     AS_HELP_STRING([--disable-extension-update],
1772         [Disable possibility to update installed extensions.]),
1775 libo_FUZZ_ARG_ENABLE(release-build,
1776     AS_HELP_STRING([--enable-release-build],
1777         [Enable release build. Note that the "release build" choice is orthogonal to
1778          whether symbols are present, debug info is generated, or optimization
1779          is done.
1780          See http://wiki.documentfoundation.org/Development/DevBuild]),
1783 AC_ARG_ENABLE(windows-build-signing,
1784     AS_HELP_STRING([--enable-windows-build-signing],
1785         [Enable signing of windows binaries (*.exe, *.dll)]),
1788 AC_ARG_ENABLE(silent-msi,
1789     AS_HELP_STRING([--enable-silent-msi],
1790         [Enable MSI with LIMITUI=1 (silent install).]),
1793 AC_ARG_ENABLE(macosx-code-signing,
1794     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1795         [Sign executables, dylibs, frameworks and the app bundle. If you
1796          don't provide an identity the first suitable certificate
1797          in your keychain is used.]),
1800 AC_ARG_ENABLE(macosx-package-signing,
1801     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1802         [Create a .pkg suitable for uploading to the Mac App Store and sign
1803          it. If you don't provide an identity the first suitable certificate
1804          in your keychain is used.]),
1807 AC_ARG_ENABLE(macosx-sandbox,
1808     AS_HELP_STRING([--enable-macosx-sandbox],
1809         [Make the app bundle run in a sandbox. Requires code signing.
1810          Is required by apps distributed in the Mac App Store, and implies
1811          adherence to App Store rules.]),
1814 AC_ARG_WITH(macosx-bundle-identifier,
1815     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1816         [Define the macOS bundle identifier. Default is the somewhat weird
1817          org.libreoffice.script ("script", huh?).]),
1818 ,with_macosx_bundle_identifier=org.libreoffice.script)
1820 AC_ARG_WITH(product-name,
1821     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1822         [Define the product name. Default is AC_PACKAGE_NAME.]),
1823 ,with_product_name=$PRODUCTNAME)
1825 libo_FUZZ_ARG_ENABLE(community-flavor,
1826     AS_HELP_STRING([--disable-community-flavor],
1827         [Disable the Community branding.]),
1830 AC_ARG_WITH(package-version,
1831     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1832         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1835 libo_FUZZ_ARG_ENABLE(readonly-installset,
1836     AS_HELP_STRING([--enable-readonly-installset],
1837         [Prevents any attempts by LibreOffice to write into its installation. That means
1838          at least that no "system-wide" extensions can be added. Partly experimental work in
1839          progress, probably not fully implemented. Always enabled for macOS.]),
1842 libo_FUZZ_ARG_ENABLE(mariadb-sdbc,
1843     AS_HELP_STRING([--disable-mariadb-sdbc],
1844         [Disable the build of the MariaDB/MySQL-SDBC driver.])
1847 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1848     AS_HELP_STRING([--disable-postgresql-sdbc],
1849         [Disable the build of the PostgreSQL-SDBC driver.])
1852 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1853     AS_HELP_STRING([--disable-lotuswordpro],
1854         [Disable the build of the Lotus Word Pro filter.]),
1855 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1857 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1858     AS_HELP_STRING([--disable-firebird-sdbc],
1859         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1860 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1862 AC_ARG_ENABLE(bogus-pkg-config,
1863     AS_HELP_STRING([--enable-bogus-pkg-config],
1864         [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.]),
1867 AC_ARG_ENABLE(openssl,
1868     AS_HELP_STRING([--disable-openssl],
1869         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1870          components will either use GNUTLS or NSS. Work in progress,
1871          use only if you are hacking on it.]),
1872 ,enable_openssl=yes)
1874 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1875     AS_HELP_STRING([--enable-cipher-openssl-backend],
1876         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1877          Requires --enable-openssl.]))
1879 AC_ARG_ENABLE(nss,
1880     AS_HELP_STRING([--disable-nss],
1881         [Disable using NSS. If disabled,
1882          components will either use GNUTLS or openssl. Work in progress,
1883          use only if you are hacking on it.]),
1884 ,enable_nss=yes)
1886 AC_ARG_ENABLE(library-bin-tar,
1887     AS_HELP_STRING([--enable-library-bin-tar],
1888         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1889         Some libraries can save their build result in a tarball
1890         stored in TARFILE_LOCATION. That binary tarball is
1891         uniquely identified by the source tarball,
1892         the content of the config_host.mk file and the content
1893         of the top-level directory in core for that library
1894         If this option is enabled, then if such a tarfile exist, it will be untarred
1895         instead of the source tarfile, and the build step will be skipped for that
1896         library.
1897         If a proper tarfile does not exist, then the normal source-based
1898         build is done for that library and a proper binary tarfile is created
1899         for the next time.]),
1902 AC_ARG_ENABLE(dconf,
1903     AS_HELP_STRING([--disable-dconf],
1904         [Disable the dconf configuration backend (enabled by default where
1905          available).]))
1907 libo_FUZZ_ARG_ENABLE(formula-logger,
1908     AS_HELP_STRING(
1909         [--enable-formula-logger],
1910         [Enable formula logger for logging formula calculation flow in Calc.]
1911     )
1914 AC_ARG_ENABLE(ldap,
1915     AS_HELP_STRING([--disable-ldap],
1916         [Disable LDAP support.]),
1917 ,enable_ldap=yes)
1919 AC_ARG_ENABLE(opencl,
1920     AS_HELP_STRING([--disable-opencl],
1921         [Disable OpenCL support.]),
1922 ,enable_opencl=yes)
1924 libo_FUZZ_ARG_ENABLE(librelogo,
1925     AS_HELP_STRING([--disable-librelogo],
1926         [Do not build LibreLogo.]),
1927 ,enable_librelogo=yes)
1929 AC_ARG_ENABLE(cmis,
1930     AS_HELP_STRING([--disable-cmis],
1931         [Disable CMIS support.]),
1932 ,enable_cmis=yes)
1934 AC_ARG_ENABLE(curl,
1935     AS_HELP_STRING([--disable-curl],
1936         [Disable CURL support.]),
1937 ,enable_curl=yes)
1939 AC_ARG_ENABLE(wasm-strip,
1940     AS_HELP_STRING([--enable-wasm-strip],
1941         [Strip the static build like for WASM/emscripten platform.]),
1942 ,enable_wasm_strip=yes)
1945 dnl ===================================================================
1946 dnl Optional Packages (--with/without-)
1947 dnl ===================================================================
1949 AC_ARG_WITH(gcc-home,
1950     AS_HELP_STRING([--with-gcc-home],
1951         [Specify the location of gcc/g++ manually. This can be used in conjunction
1952          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1953          non-default path.]),
1956 AC_ARG_WITH(gnu-patch,
1957     AS_HELP_STRING([--with-gnu-patch],
1958         [Specify location of GNU patch on Solaris or FreeBSD.]),
1961 AC_ARG_WITH(build-platform-configure-options,
1962     AS_HELP_STRING([--with-build-platform-configure-options],
1963         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1966 AC_ARG_WITH(gnu-cp,
1967     AS_HELP_STRING([--with-gnu-cp],
1968         [Specify location of GNU cp on Solaris or FreeBSD.]),
1971 AC_ARG_WITH(external-tar,
1972     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1973         [Specify an absolute path of where to find (and store) tarfiles.]),
1974     TARFILE_LOCATION=$withval ,
1977 AC_ARG_WITH(referenced-git,
1978     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1979         [Specify another checkout directory to reference. This makes use of
1980                  git submodule update --reference, and saves a lot of diskspace
1981                  when having multiple trees side-by-side.]),
1982     GIT_REFERENCE_SRC=$withval ,
1985 AC_ARG_WITH(linked-git,
1986     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1987         [Specify a directory where the repositories of submodules are located.
1988          This uses a method similar to git-new-workdir to get submodules.]),
1989     GIT_LINK_SRC=$withval ,
1992 AC_ARG_WITH(galleries,
1993     AS_HELP_STRING([--with-galleries],
1994         [Specify how galleries should be built. It is possible either to
1995          build these internally from source ("build"),
1996          or to disable them ("no")]),
1999 AC_ARG_WITH(theme,
2000     AS_HELP_STRING([--with-theme="theme1 theme2..."],
2001         [Choose which themes to include. By default those themes with an '*' are included.
2002          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg, *colibre, *colibre_svg, *elementary,
2003          *elementary_svg, *karasa_jaga, *karasa_jaga_svg, *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg, *sukapura, *sukapura_svg.]),
2006 libo_FUZZ_ARG_WITH(helppack-integration,
2007     AS_HELP_STRING([--without-helppack-integration],
2008         [It will not integrate the helppacks to the installer
2009          of the product. Please use this switch to use the online help
2010          or separate help packages.]),
2013 libo_FUZZ_ARG_WITH(fonts,
2014     AS_HELP_STRING([--without-fonts],
2015         [LibreOffice includes some third-party fonts to provide a reliable basis for
2016          help content, templates, samples, etc. When these fonts are already
2017          known to be available on the system then you should use this option.]),
2020 AC_ARG_WITH(epm,
2021     AS_HELP_STRING([--with-epm],
2022         [Decides which epm to use. Default is to use the one from the system if
2023          one is built. When either this is not there or you say =internal epm
2024          will be built.]),
2027 AC_ARG_WITH(package-format,
2028     AS_HELP_STRING([--with-package-format],
2029         [Specify package format(s) for LibreOffice installation sets. The
2030          implicit --without-package-format leads to no installation sets being
2031          generated. Possible values: aix, archive, bsd, deb, dmg,
2032          installed, msi, pkg, and rpm.
2033          Example: --with-package-format='deb rpm']),
2036 AC_ARG_WITH(tls,
2037     AS_HELP_STRING([--with-tls],
2038         [Decides which TLS/SSL and cryptographic implementations to use for
2039          LibreOffice's code. Notice that this doesn't apply for depending
2040          libraries like "neon", for example. Default is to use NSS
2041          although OpenSSL is also possible. Notice that selecting NSS restricts
2042          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
2043          restrict by now the usage of NSS in LO's code. Possible values:
2044          openssl, nss. Example: --with-tls="nss"]),
2047 AC_ARG_WITH(system-libs,
2048     AS_HELP_STRING([--with-system-libs],
2049         [Use libraries already on system -- enables all --with-system-* flags.]),
2052 AC_ARG_WITH(system-bzip2,
2053     AS_HELP_STRING([--with-system-bzip2],
2054         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
2055     [with_system_bzip2="$with_system_libs"])
2057 AC_ARG_WITH(system-headers,
2058     AS_HELP_STRING([--with-system-headers],
2059         [Use headers already on system -- enables all --with-system-* flags for
2060          external packages whose headers are the only entities used i.e.
2061          boost/odbc/sane-header(s).]),,
2062     [with_system_headers="$with_system_libs"])
2064 AC_ARG_WITH(system-jars,
2065     AS_HELP_STRING([--without-system-jars],
2066         [When building with --with-system-libs, also the needed jars are expected
2067          on the system. Use this to disable that]),,
2068     [with_system_jars="$with_system_libs"])
2070 AC_ARG_WITH(system-cairo,
2071     AS_HELP_STRING([--with-system-cairo],
2072         [Use cairo libraries already on system.  Happens automatically for
2073          (implicit) --enable-gtk3.]))
2075 AC_ARG_WITH(system-epoxy,
2076     AS_HELP_STRING([--with-system-epoxy],
2077         [Use epoxy libraries already on system.  Happens automatically for
2078          (implicit) --enable-gtk3.]),,
2079        [with_system_epoxy="$with_system_libs"])
2081 AC_ARG_WITH(myspell-dicts,
2082     AS_HELP_STRING([--with-myspell-dicts],
2083         [Adds myspell dictionaries to the LibreOffice installation set]),
2086 AC_ARG_WITH(system-dicts,
2087     AS_HELP_STRING([--without-system-dicts],
2088         [Do not use dictionaries from system paths.]),
2091 AC_ARG_WITH(external-dict-dir,
2092     AS_HELP_STRING([--with-external-dict-dir],
2093         [Specify external dictionary dir.]),
2096 AC_ARG_WITH(external-hyph-dir,
2097     AS_HELP_STRING([--with-external-hyph-dir],
2098         [Specify external hyphenation pattern dir.]),
2101 AC_ARG_WITH(external-thes-dir,
2102     AS_HELP_STRING([--with-external-thes-dir],
2103         [Specify external thesaurus dir.]),
2106 AC_ARG_WITH(system-zlib,
2107     AS_HELP_STRING([--with-system-zlib],
2108         [Use zlib already on system.]),,
2109     [with_system_zlib=auto])
2111 AC_ARG_WITH(system-jpeg,
2112     AS_HELP_STRING([--with-system-jpeg],
2113         [Use jpeg already on system.]),,
2114     [with_system_jpeg="$with_system_libs"])
2116 AC_ARG_WITH(system-clucene,
2117     AS_HELP_STRING([--with-system-clucene],
2118         [Use clucene already on system.]),,
2119     [with_system_clucene="$with_system_libs"])
2121 AC_ARG_WITH(system-expat,
2122     AS_HELP_STRING([--with-system-expat],
2123         [Use expat already on system.]),,
2124     [with_system_expat="$with_system_libs"])
2126 AC_ARG_WITH(system-libxml,
2127     AS_HELP_STRING([--with-system-libxml],
2128         [Use libxml/libxslt already on system.]),,
2129     [with_system_libxml=auto])
2131 AC_ARG_WITH(system-icu,
2132     AS_HELP_STRING([--with-system-icu],
2133         [Use icu already on system.]),,
2134     [with_system_icu="$with_system_libs"])
2136 AC_ARG_WITH(system-ucpp,
2137     AS_HELP_STRING([--with-system-ucpp],
2138         [Use ucpp already on system.]),,
2139     [])
2141 AC_ARG_WITH(system-openldap,
2142     AS_HELP_STRING([--with-system-openldap],
2143         [Use the OpenLDAP LDAP SDK already on system.]),,
2144     [with_system_openldap="$with_system_libs"])
2146 libo_FUZZ_ARG_ENABLE(poppler,
2147     AS_HELP_STRING([--disable-poppler],
2148         [Disable building Poppler.])
2151 AC_ARG_WITH(system-poppler,
2152     AS_HELP_STRING([--with-system-poppler],
2153         [Use system poppler (only needed for PDF import).]),,
2154     [with_system_poppler="$with_system_libs"])
2156 libo_FUZZ_ARG_ENABLE(gpgmepp,
2157     AS_HELP_STRING([--disable-gpgmepp],
2158         [Disable building gpgmepp. Do not use in normal cases unless you want to fix potential problems it causes.])
2161 AC_ARG_WITH(system-gpgmepp,
2162     AS_HELP_STRING([--with-system-gpgmepp],
2163         [Use gpgmepp already on system]),,
2164     [with_system_gpgmepp="$with_system_libs"])
2166 AC_ARG_WITH(system-mariadb,
2167     AS_HELP_STRING([--with-system-mariadb],
2168         [Use MariaDB/MySQL libraries already on system.]),,
2169     [with_system_mariadb="$with_system_libs"])
2171 AC_ARG_ENABLE(bundle-mariadb,
2172     AS_HELP_STRING([--enable-bundle-mariadb],
2173         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
2176 AC_ARG_WITH(system-postgresql,
2177     AS_HELP_STRING([--with-system-postgresql],
2178         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
2179          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
2180     [with_system_postgresql="$with_system_libs"])
2182 AC_ARG_WITH(libpq-path,
2183     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
2184         [Use this PostgreSQL C interface (libpq) installation for building
2185          the PostgreSQL-SDBC extension.]),
2188 AC_ARG_WITH(system-firebird,
2189     AS_HELP_STRING([--with-system-firebird],
2190         [Use Firebird libraries already on system, for building the Firebird-SDBC
2191          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
2192     [with_system_firebird="$with_system_libs"])
2194 AC_ARG_WITH(system-libtommath,
2195             AS_HELP_STRING([--with-system-libtommath],
2196                            [Use libtommath already on system]),,
2197             [with_system_libtommath="$with_system_libs"])
2199 AC_ARG_WITH(system-hsqldb,
2200     AS_HELP_STRING([--with-system-hsqldb],
2201         [Use hsqldb already on system.]))
2203 AC_ARG_WITH(hsqldb-jar,
2204     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
2205         [Specify path to jarfile manually.]),
2206     HSQLDB_JAR=$withval)
2208 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
2209     AS_HELP_STRING([--disable-scripting-beanshell],
2210         [Disable support for scripts in BeanShell.]),
2214 AC_ARG_WITH(system-beanshell,
2215     AS_HELP_STRING([--with-system-beanshell],
2216         [Use beanshell already on system.]),,
2217     [with_system_beanshell="$with_system_jars"])
2219 AC_ARG_WITH(beanshell-jar,
2220     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
2221         [Specify path to jarfile manually.]),
2222     BSH_JAR=$withval)
2224 libo_FUZZ_ARG_ENABLE(scripting-javascript,
2225     AS_HELP_STRING([--disable-scripting-javascript],
2226         [Disable support for scripts in JavaScript.]),
2230 AC_ARG_WITH(system-rhino,
2231     AS_HELP_STRING([--with-system-rhino],
2232         [Use rhino already on system.]),,)
2233 #    [with_system_rhino="$with_system_jars"])
2234 # Above is not used as we have different debug interface
2235 # patched into internal rhino. This code needs to be fixed
2236 # before we can enable it by default.
2238 AC_ARG_WITH(rhino-jar,
2239     AS_HELP_STRING([--with-rhino-jar=JARFILE],
2240         [Specify path to jarfile manually.]),
2241     RHINO_JAR=$withval)
2243 AC_ARG_WITH(system-jfreereport,
2244     AS_HELP_STRING([--with-system-jfreereport],
2245         [Use JFreeReport already on system.]),,
2246     [with_system_jfreereport="$with_system_jars"])
2248 AC_ARG_WITH(sac-jar,
2249     AS_HELP_STRING([--with-sac-jar=JARFILE],
2250         [Specify path to jarfile manually.]),
2251     SAC_JAR=$withval)
2253 AC_ARG_WITH(libxml-jar,
2254     AS_HELP_STRING([--with-libxml-jar=JARFILE],
2255         [Specify path to jarfile manually.]),
2256     LIBXML_JAR=$withval)
2258 AC_ARG_WITH(flute-jar,
2259     AS_HELP_STRING([--with-flute-jar=JARFILE],
2260         [Specify path to jarfile manually.]),
2261     FLUTE_JAR=$withval)
2263 AC_ARG_WITH(jfreereport-jar,
2264     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
2265         [Specify path to jarfile manually.]),
2266     JFREEREPORT_JAR=$withval)
2268 AC_ARG_WITH(liblayout-jar,
2269     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
2270         [Specify path to jarfile manually.]),
2271     LIBLAYOUT_JAR=$withval)
2273 AC_ARG_WITH(libloader-jar,
2274     AS_HELP_STRING([--with-libloader-jar=JARFILE],
2275         [Specify path to jarfile manually.]),
2276     LIBLOADER_JAR=$withval)
2278 AC_ARG_WITH(libformula-jar,
2279     AS_HELP_STRING([--with-libformula-jar=JARFILE],
2280         [Specify path to jarfile manually.]),
2281     LIBFORMULA_JAR=$withval)
2283 AC_ARG_WITH(librepository-jar,
2284     AS_HELP_STRING([--with-librepository-jar=JARFILE],
2285         [Specify path to jarfile manually.]),
2286     LIBREPOSITORY_JAR=$withval)
2288 AC_ARG_WITH(libfonts-jar,
2289     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
2290         [Specify path to jarfile manually.]),
2291     LIBFONTS_JAR=$withval)
2293 AC_ARG_WITH(libserializer-jar,
2294     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
2295         [Specify path to jarfile manually.]),
2296     LIBSERIALIZER_JAR=$withval)
2298 AC_ARG_WITH(libbase-jar,
2299     AS_HELP_STRING([--with-libbase-jar=JARFILE],
2300         [Specify path to jarfile manually.]),
2301     LIBBASE_JAR=$withval)
2303 AC_ARG_WITH(system-odbc,
2304     AS_HELP_STRING([--with-system-odbc],
2305         [Use the odbc headers already on system.]),,
2306     [with_system_odbc="auto"])
2308 AC_ARG_WITH(system-sane,
2309     AS_HELP_STRING([--with-system-sane],
2310         [Use sane.h already on system.]),,
2311     [with_system_sane="$with_system_headers"])
2313 AC_ARG_WITH(system-bluez,
2314     AS_HELP_STRING([--with-system-bluez],
2315         [Use bluetooth.h already on system.]),,
2316     [with_system_bluez="$with_system_headers"])
2318 AC_ARG_WITH(system-curl,
2319     AS_HELP_STRING([--with-system-curl],
2320         [Use curl already on system.]),,
2321     [with_system_curl=auto])
2323 AC_ARG_WITH(system-boost,
2324     AS_HELP_STRING([--with-system-boost],
2325         [Use boost already on system.]),,
2326     [with_system_boost="$with_system_headers"])
2328 AC_ARG_WITH(system-glm,
2329     AS_HELP_STRING([--with-system-glm],
2330         [Use glm already on system.]),,
2331     [with_system_glm="$with_system_headers"])
2333 AC_ARG_WITH(system-hunspell,
2334     AS_HELP_STRING([--with-system-hunspell],
2335         [Use libhunspell already on system.]),,
2336     [with_system_hunspell="$with_system_libs"])
2338 libo_FUZZ_ARG_ENABLE(zxing,
2339     AS_HELP_STRING([--disable-zxing],
2340        [Disable use of zxing external library.]))
2342 AC_ARG_WITH(system-zxing,
2343     AS_HELP_STRING([--with-system-zxing],
2344         [Use libzxing already on system.]),,
2345     [with_system_zxing="$with_system_libs"])
2347 AC_ARG_WITH(system-box2d,
2348     AS_HELP_STRING([--with-system-box2d],
2349         [Use box2d already on system.]),,
2350     [with_system_box2d="$with_system_libs"])
2352 AC_ARG_WITH(system-mythes,
2353     AS_HELP_STRING([--with-system-mythes],
2354         [Use mythes already on system.]),,
2355     [with_system_mythes="$with_system_libs"])
2357 AC_ARG_WITH(system-altlinuxhyph,
2358     AS_HELP_STRING([--with-system-altlinuxhyph],
2359         [Use ALTLinuxhyph already on system.]),,
2360     [with_system_altlinuxhyph="$with_system_libs"])
2362 AC_ARG_WITH(system-lpsolve,
2363     AS_HELP_STRING([--with-system-lpsolve],
2364         [Use lpsolve already on system.]),,
2365     [with_system_lpsolve="$with_system_libs"])
2367 AC_ARG_WITH(system-coinmp,
2368     AS_HELP_STRING([--with-system-coinmp],
2369         [Use CoinMP already on system.]),,
2370     [with_system_coinmp="$with_system_libs"])
2372 AC_ARG_WITH(system-liblangtag,
2373     AS_HELP_STRING([--with-system-liblangtag],
2374         [Use liblangtag library already on system.]),,
2375     [with_system_liblangtag="$with_system_libs"])
2377 AC_ARG_WITH(webdav,
2378     AS_HELP_STRING([--with-webdav],
2379         [Specify which library to use for webdav implementation.
2380          Possible values: "neon", "serf", "no". The default value is "neon".
2381          Example: --with-webdav="serf"]))
2383 AC_ARG_WITH(linker-hash-style,
2384     AS_HELP_STRING([--with-linker-hash-style],
2385         [Use linker with --hash-style=<style> when linking shared objects.
2386          Possible values: "sysv", "gnu", "both". The default value is "gnu"
2387          if supported on the build system, and "sysv" otherwise.]))
2389 AC_ARG_WITH(jdk-home,
2390     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
2391         [If you have installed JDK 9 or later on your system please supply the
2392          path here. Note that this is not the location of the java command but the
2393          location of the entire distribution. In case of cross-compiling, this
2394          is the JDK of the host os. Use --with-build-platform-configure-options
2395          to point to a different build platform JDK.]),
2398 AC_ARG_WITH(help,
2399     AS_HELP_STRING([--with-help],
2400         [Enable the build of help. There is a special parameter "common" that
2401          can be used to bundle only the common part, .e.g help-specific icons.
2402          This is useful when you build the helpcontent separately.])
2403     [
2404                           Usage:     --with-help    build the old local help
2405                                  --without-help     no local help (default)
2406                                  --with-help=html   build the new HTML local help
2407                                  --with-help=online build the new HTML online help
2408     ],
2411 AC_ARG_WITH(omindex,
2412    AS_HELP_STRING([--with-omindex],
2413         [Enable the support of xapian-omega index for online help.])
2414    [
2415                          Usage: --with-omindex=server prepare the pages for omindex
2416                                 but let xapian-omega be built in server.
2417                                 --with-omindex=noxap do not prepare online pages
2418                                 for xapian-omega
2419   ],
2422 libo_FUZZ_ARG_WITH(java,
2423     AS_HELP_STRING([--with-java=<java command>],
2424         [Specify the name of the Java interpreter command. Typically "java"
2425          which is the default.
2427          To build without support for Java components, applets, accessibility
2428          or the XML filters written in Java, use --without-java or --with-java=no.]),
2429     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2430     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2433 AC_ARG_WITH(jvm-path,
2434     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2435         [Use a specific JVM search path at runtime.
2436          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2439 AC_ARG_WITH(ant-home,
2440     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2441         [If you have installed Apache Ant on your system, please supply the path here.
2442          Note that this is not the location of the Ant binary but the location
2443          of the entire distribution.]),
2446 AC_ARG_WITH(symbol-config,
2447     AS_HELP_STRING([--with-symbol-config],
2448         [Configuration for the crashreport symbol upload]),
2449         [],
2450         [with_symbol_config=no])
2452 AC_ARG_WITH(export-validation,
2453     AS_HELP_STRING([--without-export-validation],
2454         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2455 ,with_export_validation=auto)
2457 AC_ARG_WITH(bffvalidator,
2458     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2459         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2460          Requires installed Microsoft Office Binary File Format Validator.
2461          Note: export-validation (--with-export-validation) is required to be turned on.
2462          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2463 ,with_bffvalidator=no)
2465 libo_FUZZ_ARG_WITH(junit,
2466     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2467         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2468          --without-junit disables those tests. Not relevant in the --without-java case.]),
2469 ,with_junit=yes)
2471 AC_ARG_WITH(hamcrest,
2472     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2473         [Specifies the hamcrest jar file to use for JUnit-based tests.
2474          --without-junit disables those tests. Not relevant in the --without-java case.]),
2475 ,with_hamcrest=yes)
2477 AC_ARG_WITH(perl-home,
2478     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2479         [If you have installed Perl 5 Distribution, on your system, please
2480          supply the path here. Note that this is not the location of the Perl
2481          binary but the location of the entire distribution.]),
2484 libo_FUZZ_ARG_WITH(doxygen,
2485     AS_HELP_STRING(
2486         [--with-doxygen=<absolute path to doxygen executable>],
2487         [Specifies the doxygen executable to use when generating ODK C/C++
2488          documentation. --without-doxygen disables generation of ODK C/C++
2489          documentation. Not relevant in the --disable-odk case.]),
2490 ,with_doxygen=yes)
2492 AC_ARG_WITH(visual-studio,
2493     AS_HELP_STRING([--with-visual-studio=<2019>],
2494         [Specify which Visual Studio version to use in case several are
2495          installed. Currently only 2019 (default) is supported.]),
2498 AC_ARG_WITH(windows-sdk,
2499     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10.0>],
2500         [Specify which Windows SDK, or "Windows Kit", version to use
2501          in case the one that came with the selected Visual Studio
2502          is not what you want for some reason. Note that not all compiler/SDK
2503          combinations are supported. The intent is that this option should not
2504          be needed.]),
2507 AC_ARG_WITH(lang,
2508     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2509         [Use this option to build LibreOffice with additional UI language support.
2510          English (US) is always included by default.
2511          Separate multiple languages with space.
2512          For all languages, use --with-lang=ALL.]),
2515 AC_ARG_WITH(locales,
2516     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2517         [Use this option to limit the locale information built in.
2518          Separate multiple locales with space.
2519          Very experimental and might well break stuff.
2520          Just a desperate measure to shrink code and data size.
2521          By default all the locales available is included.
2522          This option is completely unrelated to --with-lang.])
2523     [
2524                           Affects also our character encoding conversion
2525                           tables for encodings mainly targeted for a
2526                           particular locale, like EUC-CN and EUC-TW for
2527                           zh, ISO-2022-JP for ja.
2529                           Affects also our add-on break iterator data for
2530                           some languages.
2532                           For the default, all locales, don't use this switch at all.
2533                           Specifying just the language part of a locale means all matching
2534                           locales will be included.
2535     ],
2538 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2539 libo_FUZZ_ARG_WITH(krb5,
2540     AS_HELP_STRING([--with-krb5],
2541         [Enable MIT Kerberos 5 support in modules that support it.
2542          By default automatically enabled on platforms
2543          where a good system Kerberos 5 is available.]),
2546 libo_FUZZ_ARG_WITH(gssapi,
2547     AS_HELP_STRING([--with-gssapi],
2548         [Enable GSSAPI support in modules that support it.
2549          By default automatically enabled on platforms
2550          where a good system GSSAPI is available.]),
2553 AC_ARG_WITH(iwyu,
2554     AS_HELP_STRING([--with-iwyu],
2555         [Use given IWYU binary path to check unneeded includes instead of building.
2556          Use only if you are hacking on it.]),
2559 libo_FUZZ_ARG_WITH(lxml,
2560     AS_HELP_STRING([--without-lxml],
2561         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2562          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2563          report widget classes and ids.]),
2566 libo_FUZZ_ARG_WITH(latest-c++,
2567     AS_HELP_STRING([--with-latest-c++],
2568         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2569          published standard.]),,
2570         [with_latest_c__=no])
2572 dnl ===================================================================
2573 dnl Branding
2574 dnl ===================================================================
2576 AC_ARG_WITH(branding,
2577     AS_HELP_STRING([--with-branding=/path/to/images],
2578         [Use given path to retrieve branding images set.])
2579     [
2580                           Search for intro.png about.svg and logo.svg.
2581                           If any is missing, default ones will be used instead.
2583                           Search also progress.conf for progress
2584                           settings on intro screen :
2586                           PROGRESSBARCOLOR="255,255,255" Set color of
2587                           progress bar. Comma separated RGB decimal values.
2588                           PROGRESSSIZE="407,6" Set size of progress bar.
2589                           Comma separated decimal values (width, height).
2590                           PROGRESSPOSITION="61,317" Set position of progress
2591                           bar from left,top. Comma separated decimal values.
2592                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2593                           bar frame. Comma separated RGB decimal values.
2594                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2595                           bar text. Comma separated RGB decimal values.
2596                           PROGRESSTEXTBASELINE="287" Set vertical position of
2597                           progress bar text from top. Decimal value.
2599                           Default values will be used if not found.
2600     ],
2604 AC_ARG_WITH(extra-buildid,
2605     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2606         [Show addition build identification in about dialog.]),
2610 AC_ARG_WITH(vendor,
2611     AS_HELP_STRING([--with-vendor="John the Builder"],
2612         [Set vendor of the build.]),
2615 AC_ARG_WITH(privacy-policy-url,
2616     AS_HELP_STRING([--with-privacy-policy-url="https://yourdomain/privacy-policy"],
2617         [The URL to your privacy policy (needed when
2618          enabling online-update or crashreporting via breakpad)]),
2619         [if test "x$with_privacy_policy_url" = "xyes"; then
2620             AC_MSG_FAILURE([you need to specify an argument when using --with-privacy-policy-url])
2621          elif test "x$with_privacy_policy_url" = "xno"; then
2622             with_privacy_policy_url="undefined"
2623          fi]
2624 ,[with_privacy_policy_url="undefined"])
2626 AC_ARG_WITH(android-package-name,
2627     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2628         [Set Android package name of the build.]),
2631 AC_ARG_WITH(compat-oowrappers,
2632     AS_HELP_STRING([--with-compat-oowrappers],
2633         [Install oo* wrappers in parallel with
2634          lo* ones to keep backward compatibility.
2635          Has effect only with make distro-pack-install]),
2638 AC_ARG_WITH(os-version,
2639     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2640         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2643 AC_ARG_WITH(idlc-cpp,
2644     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2645         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2648 AC_ARG_WITH(parallelism,
2649     AS_HELP_STRING([--with-parallelism],
2650         [Number of jobs to run simultaneously during build. Parallel builds can
2651         save a lot of time on multi-cpu machines. Defaults to the number of
2652         CPUs on the machine, unless you configure --enable-icecream - then to
2653         40.]),
2656 AC_ARG_WITH(all-tarballs,
2657     AS_HELP_STRING([--with-all-tarballs],
2658         [Download all external tarballs unconditionally]))
2660 AC_ARG_WITH(gdrive-client-id,
2661     AS_HELP_STRING([--with-gdrive-client-id],
2662         [Provides the client id of the application for OAuth2 authentication
2663         on Google Drive. If either this or --with-gdrive-client-secret is
2664         empty, the feature will be disabled]),
2667 AC_ARG_WITH(gdrive-client-secret,
2668     AS_HELP_STRING([--with-gdrive-client-secret],
2669         [Provides the client secret of the application for OAuth2
2670         authentication on Google Drive. If either this or
2671         --with-gdrive-client-id is empty, the feature will be disabled]),
2674 AC_ARG_WITH(alfresco-cloud-client-id,
2675     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2676         [Provides the client id of the application for OAuth2 authentication
2677         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2678         empty, the feature will be disabled]),
2681 AC_ARG_WITH(alfresco-cloud-client-secret,
2682     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2683         [Provides the client secret of the application for OAuth2
2684         authentication on Alfresco Cloud. If either this or
2685         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2688 AC_ARG_WITH(onedrive-client-id,
2689     AS_HELP_STRING([--with-onedrive-client-id],
2690         [Provides the client id of the application for OAuth2 authentication
2691         on OneDrive. If either this or --with-onedrive-client-secret is
2692         empty, the feature will be disabled]),
2695 AC_ARG_WITH(onedrive-client-secret,
2696     AS_HELP_STRING([--with-onedrive-client-secret],
2697         [Provides the client secret of the application for OAuth2
2698         authentication on OneDrive. If either this or
2699         --with-onedrive-client-id is empty, the feature will be disabled]),
2701 dnl ===================================================================
2702 dnl Do we want to use pre-build binary tarball for recompile
2703 dnl ===================================================================
2705 if test "$enable_library_bin_tar" = "yes" ; then
2706     USE_LIBRARY_BIN_TAR=TRUE
2707 else
2708     USE_LIBRARY_BIN_TAR=
2710 AC_SUBST(USE_LIBRARY_BIN_TAR)
2712 dnl ===================================================================
2713 dnl Test whether build target is Release Build
2714 dnl ===================================================================
2715 AC_MSG_CHECKING([whether build target is Release Build])
2716 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2717     AC_MSG_RESULT([no])
2718     ENABLE_RELEASE_BUILD=
2719     GET_TASK_ALLOW_ENTITLEMENT='
2720         <!-- We want to be able to debug a hardened process when not building for release -->
2721         <key>com.apple.security.get-task-allow</key>
2722         <true/>'
2723 else
2724     AC_MSG_RESULT([yes])
2725     ENABLE_RELEASE_BUILD=TRUE
2726     GET_TASK_ALLOW_ENTITLEMENT=''
2728 AC_SUBST(ENABLE_RELEASE_BUILD)
2729 AC_SUBST(GET_TASK_ALLOW_ENTITLEMENT)
2731 AC_MSG_CHECKING([whether to build a Community flavor])
2732 if test -z "$enable_community_flavor" -o "$enable_community_flavor" = "yes"; then
2733     AC_DEFINE(HAVE_FEATURE_COMMUNITY_FLAVOR)
2734     AC_MSG_RESULT([yes])
2735 else
2736     AC_MSG_RESULT([no])
2739 dnl ===================================================================
2740 dnl Test whether to sign Windows Build
2741 dnl ===================================================================
2742 AC_MSG_CHECKING([whether to sign windows build])
2743 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2744     AC_MSG_RESULT([yes])
2745     WINDOWS_BUILD_SIGNING="TRUE"
2746 else
2747     AC_MSG_RESULT([no])
2748     WINDOWS_BUILD_SIGNING="FALSE"
2750 AC_SUBST(WINDOWS_BUILD_SIGNING)
2752 dnl ===================================================================
2753 dnl MacOSX build and runtime environment options
2754 dnl ===================================================================
2756 AC_ARG_WITH(macosx-sdk,
2757     AS_HELP_STRING([--with-macosx-sdk=<version>],
2758         [Prefer a specific SDK for building.])
2759     [
2760                           If the requested SDK is not available, a search for the oldest one will be done.
2761                           With current Xcode versions, only the latest SDK is included, so this option is
2762                           not terribly useful. It works fine to build with a new SDK and run the result
2763                           on an older OS.
2765                           e. g.: --with-macosx-sdk=10.10
2767                           there are 3 options to control the MacOSX build:
2768                           --with-macosx-sdk (referred as 'sdk' below)
2769                           --with-macosx-version-min-required (referred as 'min' below)
2770                           --with-macosx-version-max-allowed (referred as 'max' below)
2772                           the connection between these value and the default they take is as follow:
2773                           ( ? means not specified on the command line, s means the SDK version found,
2774                           constraint: 8 <= x <= y <= z)
2776                           ==========================================
2777                            command line      || config result
2778                           ==========================================
2779                           min  | max  | sdk  || min   | max  | sdk  |
2780                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2781                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2782                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2783                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2784                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2785                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2786                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2787                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2790                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2791                           for a detailed technical explanation of these variables
2793                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2794     ],
2797 AC_ARG_WITH(macosx-version-min-required,
2798     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2799         [set the minimum OS version needed to run the built LibreOffice])
2800     [
2801                           e. g.: --with-macosx-version-min-required=10.10
2802                           see --with-macosx-sdk for more info
2803     ],
2806 AC_ARG_WITH(macosx-version-max-allowed,
2807     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2808         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2809     [
2810                           e. g.: --with-macosx-version-max-allowed=10.10
2811                           see --with-macosx-sdk for more info
2812     ],
2816 dnl ===================================================================
2817 dnl options for stuff used during cross-compilation build
2818 dnl Not quite superseded by --with-build-platform-configure-options.
2819 dnl TODO: check, if the "force" option is still needed anywhere.
2820 dnl ===================================================================
2822 AC_ARG_WITH(system-icu-for-build,
2823     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2824         [Use icu already on system for build tools (cross-compilation only).]))
2827 dnl ===================================================================
2828 dnl Check for incompatible options set by fuzzing, and reset those
2829 dnl automatically to working combinations
2830 dnl ===================================================================
2832 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2833         "$enable_dbus" != "$enable_avahi"; then
2834     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2835     enable_avahi=$enable_dbus
2838 add_lopath_after ()
2840     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2841         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2842     fi
2845 add_lopath_before ()
2847     local IFS=${P_SEP}
2848     local path_cleanup
2849     local dir
2850     for dir in $LO_PATH ; do
2851         if test "$dir" != "$1" ; then
2852             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2853         fi
2854     done
2855     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2858 dnl ===================================================================
2859 dnl check for required programs (grep, awk, sed, bash)
2860 dnl ===================================================================
2862 pathmunge ()
2864     local new_path
2865     if test -n "$1"; then
2866         if test "$build_os" = "cygwin"; then
2867             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2868                 PathFormat "$1"
2869                 new_path=`cygpath -sm "$formatted_path"`
2870             else
2871                 PathFormat "$1"
2872                 new_path=`cygpath -u "$formatted_path"`
2873             fi
2874         else
2875             new_path="$1"
2876         fi
2877         if test "$2" = "after"; then
2878             add_lopath_after "$new_path"
2879         else
2880             add_lopath_before "$new_path"
2881         fi
2882     fi
2885 AC_PROG_AWK
2886 AC_PATH_PROG( AWK, $AWK)
2887 if test -z "$AWK"; then
2888     AC_MSG_ERROR([install awk to run this script])
2891 AC_PATH_PROG(BASH, bash)
2892 if test -z "$BASH"; then
2893     AC_MSG_ERROR([bash not found in \$PATH])
2895 AC_SUBST(BASH)
2897 AC_MSG_CHECKING([for GNU or BSD tar])
2898 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2899     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2900     if test $? -eq 0;  then
2901         GNUTAR=$a
2902         break
2903     fi
2904 done
2905 AC_MSG_RESULT($GNUTAR)
2906 if test -z "$GNUTAR"; then
2907     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2909 AC_SUBST(GNUTAR)
2911 AC_MSG_CHECKING([for tar's option to strip components])
2912 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2913 if test $? -eq 0; then
2914     STRIP_COMPONENTS="--strip-components"
2915 else
2916     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2917     if test $? -eq 0; then
2918         STRIP_COMPONENTS="--strip-path"
2919     else
2920         STRIP_COMPONENTS="unsupported"
2921     fi
2923 AC_MSG_RESULT($STRIP_COMPONENTS)
2924 if test x$STRIP_COMPONENTS = xunsupported; then
2925     AC_MSG_ERROR([you need a tar that is able to strip components.])
2927 AC_SUBST(STRIP_COMPONENTS)
2929 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2930 dnl desktop OSes from "mobile" ones.
2932 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2933 dnl In other words, that when building for an OS that is not a
2934 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2936 dnl Note the direction of the implication; there is no assumption that
2937 dnl cross-compiling would imply a non-desktop OS.
2939 if test $_os != iOS -a $_os != Android -a $_os != Emscripten -a "$enable_fuzzers" != "yes"; then
2940     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2941     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2942     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2945 # Whether to build "avmedia" functionality or not.
2947 if test -z "$enable_avmedia"; then
2948     enable_avmedia=yes
2951 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2952 if test "$enable_avmedia" = yes; then
2953     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2954 else
2955     USE_AVMEDIA_DUMMY='TRUE'
2957 AC_SUBST(USE_AVMEDIA_DUMMY)
2959 # Decide whether to build database connectivity stuff (including Base) or not.
2960 if test "$enable_database_connectivity" != no; then
2961     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2962     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2963 else
2964     if test "$_os" = iOS; then
2965         AC_MSG_ERROR([Presumly can't disable DB connectivity on iOS.])
2966     fi
2967     disable_database_connectivity_dependencies
2970 if test -z "$enable_extensions"; then
2971     # For iOS and Android Viewer, disable extensions unless specifically overridden with --enable-extensions.
2972     if test $_os != iOS && test $_os != Android -o "$ENABLE_ANDROID_LOK" = TRUE ; then
2973         enable_extensions=yes
2974     fi
2977 if test "$enable_extensions" = yes; then
2978     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2979     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2982 if test -z "$enable_scripting"; then
2983     # Disable scripting for iOS unless specifically overridden
2984     # with --enable-scripting.
2985     if test $_os != iOS -o $_os = Emscripten; then
2986         enable_scripting=yes
2987     fi
2990 DISABLE_SCRIPTING=''
2991 if test "$enable_scripting" = yes; then
2992     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2993     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2994 else
2995     DISABLE_SCRIPTING='TRUE'
2996     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2999 if test $_os = iOS -o $_os = Android -o $_os = Emscripten; then
3000     # Disable dynamic_loading always for iOS and Android
3001     enable_dynamic_loading=no
3002 elif test -z "$enable_dynamic_loading"; then
3003     # Otherwise enable it unless specifically disabled
3004     enable_dynamic_loading=yes
3007 DISABLE_DYNLOADING=''
3008 if test "$enable_dynamic_loading" = yes; then
3009     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
3010 else
3011     DISABLE_DYNLOADING='TRUE'
3013 AC_SUBST(DISABLE_DYNLOADING)
3015 # remember SYSBASE value
3016 AC_SUBST(SYSBASE)
3018 dnl ===================================================================
3019 dnl  Sort out various gallery compilation options
3020 dnl ===================================================================
3021 WITH_GALLERY_BUILD=TRUE
3022 AC_MSG_CHECKING([how to build and package galleries])
3023 if test -n "${with_galleries}"; then
3024     if test "$with_galleries" = "build"; then
3025         if test "$enable_database_connectivity" = no; then
3026             AC_MSG_ERROR([DB connectivity is needed for gengal / svx])
3027         fi
3028         AC_MSG_RESULT([build from source images internally])
3029     elif test "$with_galleries" = "no"; then
3030         WITH_GALLERY_BUILD=
3031         AC_MSG_RESULT([disable non-internal gallery build])
3032     else
3033         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
3034     fi
3035 else
3036     if test $_os != iOS -a $_os != Android; then
3037         AC_MSG_RESULT([internal src images for desktop])
3038     else
3039         WITH_GALLERY_BUILD=
3040         AC_MSG_RESULT([disable src image build])
3041     fi
3043 AC_SUBST(WITH_GALLERY_BUILD)
3045 dnl ===================================================================
3046 dnl  Checks if ccache is available
3047 dnl ===================================================================
3048 CCACHE_DEPEND_MODE=
3049 if test "$enable_ccache" = "no"; then
3050     CCACHE=""
3051 elif test "$_os" = "WINNT"; then
3052     # on windows/VC build do not use ccache - but perhaps sccache is around?
3053     case "%$CC%$CXX%" in
3054     # If $CC and/or $CXX already contain "sccache" (possibly suffixed with some version number etc),
3055     # assume that's good then
3056     *%sccache[[-_' ']]*|*/sccache[[-_' ']]*)
3057         AC_MSG_NOTICE([sccache seems to be included in a pre-defined CC and/or CXX])
3058         CCACHE_DEPEND_MODE=1
3059         ;;
3060     *)
3061         # for sharing code below, reuse CCACHE env var
3062         AC_PATH_PROG([CCACHE],[sccache],[not found])
3063         if test "$CCACHE" = "not found"; then
3064             CCACHE=""
3065         else
3066             CCACHE=`win_short_path_for_make "$CCACHE"`
3067             CCACHE_DEPEND_MODE=1
3068         fi
3069         ;;
3070     esac
3071 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
3072     case "%$CC%$CXX%" in
3073     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
3074     # assume that's good then
3075     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
3076         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
3077         CCACHE_DEPEND_MODE=1
3078         ;;
3079     *)
3080         AC_PATH_PROG([CCACHE],[ccache],[not found])
3081         if test "$CCACHE" = "not found"; then
3082             CCACHE=""
3083         else
3084             CCACHE_DEPEND_MODE=1
3085             # Need to check for ccache version: otherwise prevents
3086             # caching of the results (like "-x objective-c++" for Mac)
3087             if test $_os = Darwin -o $_os = iOS; then
3088                 # Check ccache version
3089                 AC_MSG_CHECKING([whether version of ccache is suitable])
3090                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
3091                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3092                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
3093                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
3094                 else
3095                     AC_MSG_RESULT([no, $CCACHE_VERSION])
3096                     CCACHE=""
3097                     CCACHE_DEPEND_MODE=
3098                 fi
3099             fi
3100         fi
3101         ;;
3102     esac
3103 else
3104     CCACHE=""
3106 if test "$enable_ccache" = "nodepend"; then
3107     CCACHE_DEPEND_MODE=""
3109 AC_SUBST(CCACHE_DEPEND_MODE)
3111 # skip on windows - sccache defaults are good enough
3112 if test "$CCACHE" != "" -a "$_os" != "WINNT"; then
3113     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
3114     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
3115     if test "$ccache_size" = ""; then
3116         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
3117         if test "$ccache_size" = ""; then
3118             ccache_size=0
3119         fi
3120         # we could not determine the size or it was less than 1GB -> disable auto-ccache
3121         if test $ccache_size -lt 1024; then
3122             CCACHE=""
3123             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
3124             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
3125         else
3126             # warn that ccache may be too small for debug build
3127             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3128             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3129         fi
3130     else
3131         if test $ccache_size -lt 5; then
3132             #warn that ccache may be too small for debug build
3133             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3134             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3135         fi
3136     fi
3139 dnl ===================================================================
3140 dnl  Checks for C compiler,
3141 dnl  The check for the C++ compiler is later on.
3142 dnl ===================================================================
3143 if test "$_os" != "WINNT"; then
3144     GCC_HOME_SET="true"
3145     AC_MSG_CHECKING([gcc home])
3146     if test -z "$with_gcc_home"; then
3147         if test "$enable_icecream" = "yes"; then
3148             if test -d "/usr/lib/icecc/bin"; then
3149                 GCC_HOME="/usr/lib/icecc/"
3150             elif test -d "/usr/libexec/icecc/bin"; then
3151                 GCC_HOME="/usr/libexec/icecc/"
3152             elif test -d "/opt/icecream/bin"; then
3153                 GCC_HOME="/opt/icecream/"
3154             else
3155                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
3157             fi
3158         else
3159             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
3160             GCC_HOME_SET="false"
3161         fi
3162     else
3163         GCC_HOME="$with_gcc_home"
3164     fi
3165     AC_MSG_RESULT($GCC_HOME)
3166     AC_SUBST(GCC_HOME)
3168     if test "$GCC_HOME_SET" = "true"; then
3169         if test -z "$CC"; then
3170             CC="$GCC_HOME/bin/gcc"
3171             CC_BASE="gcc"
3172         fi
3173         if test -z "$CXX"; then
3174             CXX="$GCC_HOME/bin/g++"
3175             CXX_BASE="g++"
3176         fi
3177     fi
3180 COMPATH=`dirname "$CC"`
3181 if test "$COMPATH" = "."; then
3182     AC_PATH_PROGS(COMPATH, $CC)
3183     dnl double square bracket to get single because of M4 quote...
3184     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
3186 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
3188 dnl ===================================================================
3189 dnl Java support
3190 dnl ===================================================================
3191 AC_MSG_CHECKING([whether to build with Java support])
3192 if test "$with_java" != "no"; then
3193     if test "$DISABLE_SCRIPTING" = TRUE; then
3194         AC_MSG_RESULT([no, overridden by --disable-scripting])
3195         ENABLE_JAVA=""
3196         with_java=no
3197     else
3198         AC_MSG_RESULT([yes])
3199         ENABLE_JAVA="TRUE"
3200         AC_DEFINE(HAVE_FEATURE_JAVA)
3201     fi
3202 else
3203     AC_MSG_RESULT([no])
3204     ENABLE_JAVA=""
3207 AC_SUBST(ENABLE_JAVA)
3209 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
3211 dnl ENABLE_JAVA="" indicate no Java support at all
3213 dnl ===================================================================
3214 dnl Check macOS SDK and compiler
3215 dnl ===================================================================
3217 if test $_os = Darwin; then
3219     # If no --with-macosx-sdk option is given, look for one
3221     # The intent is that for "most" Mac-based developers, a suitable
3222     # SDK will be found automatically without any configure options.
3224     # For developers with a current Xcode, the lowest-numbered SDK
3225     # higher than or equal to the minimum required should be found.
3227     AC_MSG_CHECKING([what macOS SDK to use])
3228     for _macosx_sdk in ${with_macosx_sdk-12.0 11.3 11.1 11.0 10.15 10.14 10.13}; do
3229         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
3230         if test -d "$MACOSX_SDK_PATH"; then
3231             with_macosx_sdk="${_macosx_sdk}"
3232             break
3233         else
3234             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
3235             if test -d "$MACOSX_SDK_PATH"; then
3236                 with_macosx_sdk="${_macosx_sdk}"
3237                 break
3238             fi
3239         fi
3240     done
3241     if test ! -d "$MACOSX_SDK_PATH"; then
3242         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
3243     fi
3245     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
3247     case $with_macosx_sdk in
3248     10.13)
3249         MACOSX_SDK_VERSION=101300
3250         ;;
3251     10.14)
3252         MACOSX_SDK_VERSION=101400
3253         ;;
3254     10.15)
3255         MACOSX_SDK_VERSION=101500
3256         ;;
3257     11.0)
3258         MACOSX_SDK_VERSION=110000
3259         ;;
3260     11.1)
3261         MACOSX_SDK_VERSION=110100
3262         ;;
3263     11.3)
3264         MACOSX_SDK_VERSION=110300
3265         ;;
3266     12.0)
3267         MACOSX_SDK_VERSION=120000
3268         ;;
3269     *)
3270         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.13--12.0])
3271         ;;
3272     esac
3274     if test "$host_cpu" = arm64 -a $MACOSX_SDK_VERSION -lt 110000; then
3275         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value for Apple Silicon])
3276     fi
3278     if test "$with_macosx_version_min_required" = "" ; then
3279         if test "$host_cpu" = x86_64; then
3280             with_macosx_version_min_required="10.10";
3281         else
3282             with_macosx_version_min_required="11.0";
3283         fi
3284     fi
3286     if test "$with_macosx_version_max_allowed" = "" ; then
3287         with_macosx_version_max_allowed="$with_macosx_sdk"
3288     fi
3290     # export this so that "xcrun" invocations later return matching values
3291     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
3292     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
3293     export DEVELOPER_DIR
3294     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
3295     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
3297     AC_MSG_CHECKING([whether Xcode is new enough])
3298     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
3299     my_xcode_ver2=${my_xcode_ver1#Xcode }
3300     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
3301     if test "$my_xcode_ver3" -ge 1103; then
3302         AC_MSG_RESULT([yes ($my_xcode_ver2)])
3303     else
3304         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 11.3])
3305     fi
3307     case "$with_macosx_version_min_required" in
3308     10.10)
3309         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
3310         ;;
3311     10.11)
3312         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
3313         ;;
3314     10.12)
3315         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
3316         ;;
3317     10.13)
3318         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
3319         ;;
3320     10.14)
3321         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
3322         ;;
3323     10.15)
3324         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
3325         ;;
3326     10.16)
3327         MAC_OS_X_VERSION_MIN_REQUIRED="101600"
3328         ;;
3329     11.0)
3330         MAC_OS_X_VERSION_MIN_REQUIRED="110000"
3331         ;;
3332     11.1)
3333         MAC_OS_X_VERSION_MIN_REQUIRED="110100"
3334         ;;
3335     11.3)
3336         MAC_OS_X_VERSION_MIN_REQUIRED="110300"
3337         ;;
3338     12.0)
3339         MAC_OS_X_VERSION_MIN_REQUIRED="120000"
3340         ;;
3341     *)
3342         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--12.0])
3343         ;;
3344     esac
3346     LIBTOOL=/usr/bin/libtool
3347     INSTALL_NAME_TOOL=install_name_tool
3348     if test -z "$save_CC"; then
3349         stdlib=-stdlib=libc++
3351         AC_MSG_CHECKING([what C compiler to use])
3352         CC="`xcrun -find clang`"
3353         CC_BASE=`first_arg_basename "$CC"`
3354         if test "$host_cpu" = x86_64; then
3355             CC+=" -target x86_64-apple-macos"
3356         else
3357             CC+=" -target arm64-apple-macos"
3358         fi
3359         CC+=" -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3360         AC_MSG_RESULT([$CC])
3362         AC_MSG_CHECKING([what C++ compiler to use])
3363         CXX="`xcrun -find clang++`"
3364         CXX_BASE=`first_arg_basename "$CXX"`
3365         if test "$host_cpu" = x86_64; then
3366             CXX+=" -target x86_64-apple-macos"
3367         else
3368             CXX+=" -target arm64-apple-macos"
3369         fi
3370         CXX+=" $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3371         AC_MSG_RESULT([$CXX])
3373         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3374         AR=`xcrun -find ar`
3375         NM=`xcrun -find nm`
3376         STRIP=`xcrun -find strip`
3377         LIBTOOL=`xcrun -find libtool`
3378         RANLIB=`xcrun -find ranlib`
3379     fi
3381     case "$with_macosx_version_max_allowed" in
3382     10.10)
3383         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
3384         ;;
3385     10.11)
3386         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
3387         ;;
3388     10.12)
3389         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
3390         ;;
3391     10.13)
3392         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
3393         ;;
3394     10.14)
3395         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
3396         ;;
3397     10.15)
3398         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
3399         ;;
3400     11.0)
3401         MAC_OS_X_VERSION_MAX_ALLOWED="110000"
3402         ;;
3403     11.1)
3404         MAC_OS_X_VERSION_MAX_ALLOWED="110100"
3405         ;;
3406     11.3)
3407         MAC_OS_X_VERSION_MAX_ALLOWED="110300"
3408         ;;
3409     12.0)
3410         MAC_OS_X_VERSION_MAX_ALLOWED="120000"
3411         ;;
3412     *)
3413         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--12.0])
3414         ;;
3415     esac
3417     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
3418     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
3419         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])
3420     else
3421         AC_MSG_RESULT([ok])
3422     fi
3424     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
3425     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
3426         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
3427     else
3428         AC_MSG_RESULT([ok])
3429     fi
3430     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
3431     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
3433     AC_MSG_CHECKING([whether to do code signing])
3435     if test "$enable_macosx_code_signing" = yes; then
3436         # By default use the first suitable certificate (?).
3438         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
3439         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
3440         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
3441         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
3442         # "Developer ID Application" one.
3444         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
3445         if test -n "$identity"; then
3446             MACOSX_CODESIGNING_IDENTITY=$identity
3447             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3448             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3449         else
3450             AC_MSG_ERROR([cannot determine identity to use])
3451         fi
3452     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
3453         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
3454         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3455         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3456     else
3457         AC_MSG_RESULT([no])
3458     fi
3460     AC_MSG_CHECKING([whether to create a Mac App Store package])
3462     if test -z "$enable_macosx_package_signing" || test "$enable_macosx_package_signing" == no; then
3463         AC_MSG_RESULT([no])
3464     elif test -z "$MACOSX_CODESIGNING_IDENTITY"; then
3465         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3466     elif test "$enable_macosx_package_signing" = yes; then
3467         # By default use the first suitable certificate.
3468         # It should be a "3rd Party Mac Developer Installer" one
3470         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
3471         if test -n "$identity"; then
3472             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3473             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3474             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3475         else
3476             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3477         fi
3478     else
3479         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
3480         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3481         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3482     fi
3484     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3485         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3486     fi
3488     AC_MSG_CHECKING([whether to sandbox the application])
3490     if test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3491         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3492     elif test "$enable_macosx_sandbox" = yes; then
3493         ENABLE_MACOSX_SANDBOX=TRUE
3494         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3495         AC_MSG_RESULT([yes])
3496     else
3497         AC_MSG_RESULT([no])
3498     fi
3500     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3501     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3502     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3504 AC_SUBST(MACOSX_SDK_PATH)
3505 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3506 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3507 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3508 AC_SUBST(INSTALL_NAME_TOOL)
3509 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3510 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3511 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3512 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3513 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3515 dnl ===================================================================
3516 dnl Check iOS SDK and compiler
3517 dnl ===================================================================
3519 if test $_os = iOS; then
3520     AC_MSG_CHECKING([what iOS SDK to use])
3521     current_sdk_ver=14.5
3522     older_sdk_vers="14.4 14.3 14.2 14.1 14.0 13.7"
3523     if test "$enable_ios_simulator" = "yes"; then
3524         platform=iPhoneSimulator
3525         versionmin=-mios-simulator-version-min=12.2
3526     else
3527         platform=iPhoneOS
3528         versionmin=-miphoneos-version-min=12.2
3529     fi
3530     xcode_developer=`xcode-select -print-path`
3532     for sdkver in $current_sdk_ver $older_sdk_vers; do
3533         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3534         if test -d $t; then
3535             sysroot=$t
3536             break
3537         fi
3538     done
3540     if test -z "$sysroot"; then
3541         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3542     fi
3544     AC_MSG_RESULT($sysroot)
3546     stdlib="-stdlib=libc++"
3548     AC_MSG_CHECKING([what C compiler to use])
3549     CC="`xcrun -find clang`"
3550     CC_BASE=`first_arg_basename "$CC"`
3551     CC+=" -arch $host_cpu_for_clang -isysroot $sysroot $versionmin"
3552     AC_MSG_RESULT([$CC])
3554     AC_MSG_CHECKING([what C++ compiler to use])
3555     CXX="`xcrun -find clang++`"
3556     CXX_BASE=`first_arg_basename "$CXX"`
3557     CXX+=" -arch $host_cpu_for_clang $stdlib -isysroot $sysroot $versionmin"
3558     AC_MSG_RESULT([$CXX])
3560     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3561     AR=`xcrun -find ar`
3562     NM=`xcrun -find nm`
3563     STRIP=`xcrun -find strip`
3564     LIBTOOL=`xcrun -find libtool`
3565     RANLIB=`xcrun -find ranlib`
3568 AC_MSG_CHECKING([whether to treat the installation as read-only])
3570 if test $_os = Darwin; then
3571     enable_readonly_installset=yes
3572 elif test "$enable_extensions" != yes; then
3573     enable_readonly_installset=yes
3575 if test "$enable_readonly_installset" = yes; then
3576     AC_MSG_RESULT([yes])
3577     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3578 else
3579     AC_MSG_RESULT([no])
3582 dnl ===================================================================
3583 dnl Structure of install set
3584 dnl ===================================================================
3586 if test $_os = Darwin; then
3587     LIBO_BIN_FOLDER=MacOS
3588     LIBO_ETC_FOLDER=Resources
3589     LIBO_LIBEXEC_FOLDER=MacOS
3590     LIBO_LIB_FOLDER=Frameworks
3591     LIBO_LIB_PYUNO_FOLDER=Resources
3592     LIBO_SHARE_FOLDER=Resources
3593     LIBO_SHARE_HELP_FOLDER=Resources/help
3594     LIBO_SHARE_JAVA_FOLDER=Resources/java
3595     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3596     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3597     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3598     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3599     LIBO_URE_BIN_FOLDER=MacOS
3600     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3601     LIBO_URE_LIB_FOLDER=Frameworks
3602     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3603     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3604 elif test $_os = WINNT; then
3605     LIBO_BIN_FOLDER=program
3606     LIBO_ETC_FOLDER=program
3607     LIBO_LIBEXEC_FOLDER=program
3608     LIBO_LIB_FOLDER=program
3609     LIBO_LIB_PYUNO_FOLDER=program
3610     LIBO_SHARE_FOLDER=share
3611     LIBO_SHARE_HELP_FOLDER=help
3612     LIBO_SHARE_JAVA_FOLDER=program/classes
3613     LIBO_SHARE_PRESETS_FOLDER=presets
3614     LIBO_SHARE_READMES_FOLDER=readmes
3615     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3616     LIBO_SHARE_SHELL_FOLDER=program/shell
3617     LIBO_URE_BIN_FOLDER=program
3618     LIBO_URE_ETC_FOLDER=program
3619     LIBO_URE_LIB_FOLDER=program
3620     LIBO_URE_MISC_FOLDER=program
3621     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3622 else
3623     LIBO_BIN_FOLDER=program
3624     LIBO_ETC_FOLDER=program
3625     LIBO_LIBEXEC_FOLDER=program
3626     LIBO_LIB_FOLDER=program
3627     LIBO_LIB_PYUNO_FOLDER=program
3628     LIBO_SHARE_FOLDER=share
3629     LIBO_SHARE_HELP_FOLDER=help
3630     LIBO_SHARE_JAVA_FOLDER=program/classes
3631     LIBO_SHARE_PRESETS_FOLDER=presets
3632     LIBO_SHARE_READMES_FOLDER=readmes
3633     if test "$enable_fuzzers" != yes; then
3634         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3635     else
3636         LIBO_SHARE_RESOURCE_FOLDER=resource
3637     fi
3638     LIBO_SHARE_SHELL_FOLDER=program/shell
3639     LIBO_URE_BIN_FOLDER=program
3640     LIBO_URE_ETC_FOLDER=program
3641     LIBO_URE_LIB_FOLDER=program
3642     LIBO_URE_MISC_FOLDER=program
3643     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3645 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3646 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3647 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3648 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3649 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3650 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3651 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3652 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3653 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3654 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3655 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3656 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3657 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3658 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3659 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3660 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3662 # Not all of them needed in config_host.mk, add more if need arises
3663 AC_SUBST(LIBO_BIN_FOLDER)
3664 AC_SUBST(LIBO_ETC_FOLDER)
3665 AC_SUBST(LIBO_LIB_FOLDER)
3666 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3667 AC_SUBST(LIBO_SHARE_FOLDER)
3668 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3669 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3670 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3671 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3672 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3673 AC_SUBST(LIBO_URE_BIN_FOLDER)
3674 AC_SUBST(LIBO_URE_ETC_FOLDER)
3675 AC_SUBST(LIBO_URE_LIB_FOLDER)
3676 AC_SUBST(LIBO_URE_MISC_FOLDER)
3677 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3679 dnl ===================================================================
3680 dnl Windows specific tests and stuff
3681 dnl ===================================================================
3683 reg_get_value()
3685     # Return value: $regvalue
3686     unset regvalue
3688     if test "$build_os" = "wsl"; then
3689         regvalue=$($BUILDDIR/solenv/wsl/wsl-lo-helper.exe --read-registry $1 "$2" 2>/dev/null)
3690         return
3691     fi
3693     local _regentry="/proc/registry${1}/${2}"
3694     if test -f "$_regentry"; then
3695         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3696         # Registry keys read via /proc/registry* are always \0 terminated!
3697         local _regvalue=$(tr -d '\0' < "$_regentry")
3698         if test $? -eq 0; then
3699             regvalue=$_regvalue
3700         fi
3701     fi
3704 # Get a value from the 32-bit side of the Registry
3705 reg_get_value_32()
3707     reg_get_value "32" "$1"
3710 # Get a value from the 64-bit side of the Registry
3711 reg_get_value_64()
3713     reg_get_value "64" "$1"
3716 case "$host_os" in
3717 cygwin*|wsl*)
3718     COM=MSC
3719     OS=WNT
3720     RTL_OS=Windows
3721     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3722         P_SEP=";"
3723     else
3724         P_SEP=:
3725     fi
3726     case "$host_cpu" in
3727     x86_64)
3728         CPUNAME=X86_64
3729         RTL_ARCH=X86_64
3730         PLATFORMID=windows_x86_64
3731         WINDOWS_X64=1
3732         SCPDEFS="$SCPDEFS -DWINDOWS_X64"
3733         WIN_HOST_ARCH="x64"
3734         WIN_MULTI_ARCH="x86"
3735         WIN_HOST_BITS=64
3736         ;;
3737     i*86)
3738         CPUNAME=INTEL
3739         RTL_ARCH=x86
3740         PLATFORMID=windows_x86
3741         WIN_HOST_ARCH="x86"
3742         WIN_HOST_BITS=32
3743         WIN_OTHER_ARCH="x64"
3744         ;;
3745     aarch64)
3746         CPUNAME=AARCH64
3747         RTL_ARCH=AARCH64
3748         PLATFORMID=windows_aarch64
3749         WINDOWS_X64=1
3750         SCPDEFS="$SCPDEFS -DWINDOWS_AARCH64"
3751         WIN_HOST_ARCH="arm64"
3752         WIN_HOST_BITS=64
3753         with_ucrt_dir=no
3754         ;;
3755     *)
3756         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3757         ;;
3758     esac
3760     case "$build_cpu" in
3761     x86_64) WIN_BUILD_ARCH="x64" ;;
3762     i*86) WIN_BUILD_ARCH="x86" ;;
3763     aarch64) WIN_BUILD_ARCH="arm64" ;;
3764     *)
3765         AC_MSG_ERROR([Unsupported build_cpu $build_cpu for host_os $host_os])
3766         ;;
3767     esac
3769     SCPDEFS="$SCPDEFS -D_MSC_VER"
3770     ;;
3771 esac
3773 # multi-arch is an arch, which can execute on the host (x86 on x64), while
3774 # other-arch won't, but wouldn't break the build (x64 on x86).
3775 if test -n "$WIN_MULTI_ARCH" -a -n "$WIN_OTHER_ARCH"; then
3776     AC_MSG_ERROR([Broken configure.ac file: can't have set \$WIN_MULTI_ARCH and $WIN_OTHER_ARCH])
3780 if test "$_os" = "iOS" -o "$build_cpu" != "$host_cpu"; then
3781     # To allow building Windows multi-arch releases without cross-tooling
3782     if test -z "$WIN_MULTI_ARCH" -a -z "$WIN_OTHER_ARCH"; then
3783         cross_compiling="yes"
3784     fi
3787 ENABLE_WASM_STRIP=''
3788 if test "$cross_compiling" = "yes"; then
3789     export CROSS_COMPILING=TRUE
3790     if test "$enable_dynamic_loading" != yes -a "$enable_wasm_strip" = yes; then
3791         ENABLE_WASM_STRIP=TRUE
3792     fi
3793 else
3794     CROSS_COMPILING=
3795     BUILD_TYPE="$BUILD_TYPE NATIVE"
3797 AC_SUBST(CROSS_COMPILING)
3798 AC_SUBST(ENABLE_WASM_STRIP)
3800 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3801 # NOTE: must _not_ be used for bundled external libraries!
3802 ISYSTEM=
3803 if test "$GCC" = "yes"; then
3804     AC_MSG_CHECKING( for -isystem )
3805     save_CFLAGS=$CFLAGS
3806     CFLAGS="$CFLAGS -Werror"
3807     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3808     CFLAGS=$save_CFLAGS
3809     if test -n "$ISYSTEM"; then
3810         AC_MSG_RESULT(yes)
3811     else
3812         AC_MSG_RESULT(no)
3813     fi
3815 if test -z "$ISYSTEM"; then
3816     # fall back to using -I
3817     ISYSTEM=-I
3819 AC_SUBST(ISYSTEM)
3821 dnl ===================================================================
3822 dnl  Check which Visual Studio compiler is used
3823 dnl ===================================================================
3825 map_vs_year_to_version()
3827     # Return value: $vsversion
3829     unset vsversion
3831     case $1 in
3832     2019)
3833         vsversion=16;;
3834     *)
3835         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3836     esac
3839 vs_versions_to_check()
3841     # Args: $1 (optional) : versions to check, in the order of preference
3842     # Return value: $vsversions
3844     unset vsversions
3846     if test -n "$1"; then
3847         map_vs_year_to_version "$1"
3848         vsversions=$vsversion
3849     else
3850         # We accept only 2019
3851         vsversions="16"
3852     fi
3855 win_get_env_from_vsvars32bat()
3857     local WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3858     # Also seems to be located in another directory under the same name: vsvars32.bat
3859     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3860     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3861     # use 'echo.%ENV%' syntax (instead of 'echo %ENV%') to avoid outputting "ECHO is off." in case when ENV is empty or a space
3862     printf '@setlocal\r\n@echo.%%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3863     local result
3864     if test "$build_os" = "wsl"; then
3865         result=$(cd /mnt/c && cmd.exe /c $(wslpath -w $WRAPPERBATCHFILEPATH) | tr -d '\r')
3866     else
3867         chmod +x $WRAPPERBATCHFILEPATH
3868         result=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3869     fi
3870     rm -f $WRAPPERBATCHFILEPATH
3871     printf '%s' "$result"
3874 find_ucrt()
3876     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3877     if test -n "$regvalue"; then
3878         PathFormat "$regvalue"
3879         UCRTSDKDIR=$formatted_path_unix
3880         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3881         UCRTVERSION=$regvalue
3882         # Rest if not exist
3883         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3884           UCRTSDKDIR=
3885         fi
3886     fi
3887     if test -z "$UCRTSDKDIR"; then
3888         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3889         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3890         if test -f "$ide_env_file"; then
3891             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3892             UCRTSDKDIR=$formatted_path
3893             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3894             dnl Hack needed at least by tml:
3895             if test "$UCRTVERSION" = 10.0.15063.0 \
3896                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3897                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3898             then
3899                 UCRTVERSION=10.0.14393.0
3900             fi
3901         else
3902           AC_MSG_ERROR([No UCRT found])
3903         fi
3904     fi
3907 find_msvc()
3909     # Find Visual C++ 2019
3910     # Args: $1 (optional) : The VS version year
3911     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3913     unset vctest vcnum vcnumwithdot vcbuildnumber
3915     vs_versions_to_check "$1"
3916     if test "$build_os" = wsl; then
3917         vswhere="$PROGRAMFILESX86"
3918     else
3919         vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3920     fi
3921     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3922     PathFormat "$vswhere"
3923     vswhere=$formatted_path_unix
3924     for ver in $vsversions; do
3925         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3926         # Fall back to all MS products (this includes VC++ Build Tools)
3927         if ! test -n "$vswhereoutput"; then
3928             AC_MSG_CHECKING([VC++ Build Tools and similar])
3929             vswhereoutput=`$vswhere -products \* -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3930         fi
3931         if test -n "$vswhereoutput"; then
3932             PathFormat "$vswhereoutput"
3933             vctest=$formatted_path_unix
3934             break
3935         fi
3936     done
3938     if test -n "$vctest"; then
3939         vcnumwithdot="$ver.0"
3940         case "$vcnumwithdot" in
3941         16.0)
3942             vcyear=2019
3943             vcnum=160
3944             ;;
3945         esac
3946         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3948     fi
3951 test_cl_exe()
3953     AC_MSG_CHECKING([$1 compiler])
3955     CL_EXE_PATH="$2/cl.exe"
3957     if test ! -f "$CL_EXE_PATH"; then
3958         if test "$1" = "multi-arch"; then
3959             AC_MSG_WARN([no compiler (cl.exe) in $2])
3960             return 1
3961         else
3962             AC_MSG_ERROR([no compiler (cl.exe) in $2])
3963         fi
3964     fi
3966     dnl ===========================================================
3967     dnl  Check for the corresponding mspdb*.dll
3968     dnl ===========================================================
3970     # MSVC 15.0 has libraries from 14.0?
3971     mspdbnum="140"
3973     if test ! -e "$2/mspdb${mspdbnum}.dll"; then
3974         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $2, Visual Studio installation broken?])
3975     fi
3977     # The compiles has to find its shared libraries
3978     OLD_PATH="$PATH"
3979     TEMP_PATH=`cygpath -d "$2"`
3980     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3982     if ! "$CL_EXE_PATH" -? </dev/null >/dev/null 2>&1; then
3983         AC_MSG_ERROR([no compiler (cl.exe) in $2])
3984     fi
3986     PATH="$OLD_PATH"
3988     AC_MSG_RESULT([$CL_EXE_PATH])
3991 SOLARINC=
3992 MSBUILD_PATH=
3993 DEVENV=
3994 if test "$_os" = "WINNT"; then
3995     AC_MSG_CHECKING([Visual C++])
3996     find_msvc "$with_visual_studio"
3997     if test -z "$vctest"; then
3998         if test -n "$with_visual_studio"; then
3999             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
4000         else
4001             AC_MSG_ERROR([no Visual Studio 2019 installation found])
4002         fi
4003     fi
4004     AC_MSG_RESULT([])
4006     VC_PRODUCT_DIR="$vctest/VC"
4007     COMPATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber"
4009     # $WIN_OTHER_ARCH is a hack to test the x64 compiler on x86, even if it's not multi-arch
4010     if test -n "$WIN_MULTI_ARCH" -o -n "$WIN_OTHER_ARCH"; then
4011         MSVC_MULTI_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/${WIN_MULTI_ARCH}${WIN_OTHER_ARCH}"
4012         test_cl_exe "multi-arch" "$MSVC_MULTI_PATH"
4013         if test $? -ne 0; then
4014             WIN_MULTI_ARCH=""
4015             WIN_OTHER_ARCH=""
4016         fi
4017     fi
4019     if test "$WIN_BUILD_ARCH" = "$WIN_HOST_ARCH"; then
4020         MSVC_BUILD_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_BUILD_ARCH"
4021         test_cl_exe "build" "$MSVC_BUILD_PATH"
4022     fi
4024     if test "$WIN_BUILD_ARCH" != "$WIN_HOST_ARCH"; then
4025         MSVC_HOST_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_HOST_ARCH"
4026         test_cl_exe "host" "$MSVC_HOST_PATH"
4027     else
4028         MSVC_HOST_PATH="$MSVC_BUILD_PATH"
4029     fi
4031     AC_MSG_CHECKING([for short pathname of VC product directory])
4032     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
4033     AC_MSG_RESULT([$VC_PRODUCT_DIR])
4035     UCRTSDKDIR=
4036     UCRTVERSION=
4038     AC_MSG_CHECKING([for UCRT location])
4039     find_ucrt
4040     # find_ucrt errors out if it doesn't find it
4041     AC_MSG_RESULT([$UCRTSDKDIR ($UCRTVERSION)])
4042     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
4043     ucrtincpath_formatted=$formatted_path
4044     # SOLARINC is used for external modules and must be set too.
4045     # And no, it's not sufficient to set SOLARINC only, as configure
4046     # itself doesn't honour it.
4047     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
4048     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
4049     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
4050     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
4052     AC_SUBST(UCRTSDKDIR)
4053     AC_SUBST(UCRTVERSION)
4055     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
4056     # Find the proper version of MSBuild.exe to use based on the VS version
4057     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
4058     if test -n "$regvalue" ; then
4059         AC_MSG_RESULT([found: $regvalue])
4060         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
4061     else
4062         if test "$vcnumwithdot" = "16.0"; then
4063             if test "$WIN_BUILD_ARCH" != "x64"; then
4064                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
4065             else
4066                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
4067             fi
4068         else
4069             if test "$WIN_BUILD_ARCH" != "x64"; then
4070                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
4071             else
4072                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
4073             fi
4074         fi
4075         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
4076         AC_MSG_RESULT([$regvalue])
4077     fi
4079     # Find the version of devenv.exe
4080     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
4081     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
4082     DEVENV_unix=$(cygpath -u "$DEVENV")
4083     if test ! -e "$DEVENV_unix"; then
4084         AC_MSG_WARN([No devenv.exe found - this is expected for VC++ Build Tools])
4085     fi
4087     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
4088     dnl needed when building CLR code:
4089     if test -z "$MSVC_CXX"; then
4090         # This gives us a posix path with 8.3 filename restrictions
4091         MSVC_CXX=`win_short_path_for_make "$MSVC_HOST_PATH/cl.exe"`
4092     fi
4094     if test -z "$CC"; then
4095         CC=$MSVC_CXX
4096         CC_BASE=`first_arg_basename "$CC"`
4097     fi
4098     if test -z "$CXX"; then
4099         CXX=$MSVC_CXX
4100         CXX_BASE=`first_arg_basename "$CXX"`
4101     fi
4103     if test -n "$CC"; then
4104         # Remove /cl.exe from CC case insensitive
4105         AC_MSG_NOTICE([found Visual C++ $vcyear])
4107         main_include_dir=`cygpath -d -m "$COMPATH/Include"`
4108         CPPFLAGS="$CPPFLAGS -I$main_include_dir"
4110         PathFormat "$COMPATH"
4111         COMPATH=`win_short_path_for_make "$formatted_path"`
4113         VCVER=$vcnum
4115         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
4116         # are always "better", we list them in reverse chronological order.
4118         case "$vcnum" in
4119         160)
4120             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
4121             ;;
4122         esac
4124         # The expectation is that --with-windows-sdk should not need to be used
4125         if test -n "$with_windows_sdk"; then
4126             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
4127             *" "$with_windows_sdk" "*)
4128                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
4129                 ;;
4130             *)
4131                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $vcyear])
4132                 ;;
4133             esac
4134         fi
4136         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
4137         ac_objext=obj
4138         ac_exeext=exe
4140     else
4141         AC_MSG_ERROR([Visual C++ not found after all, huh])
4142     fi
4144     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.5])
4145     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4146         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
4147         // between Visual Studio versions and _MSC_VER:
4148         #if _MSC_VER < 1925
4149         #error
4150         #endif
4151     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
4153     # Check for 64-bit (cross-)compiler to use to build the 64-bit
4154     # version of the Explorer extension (and maybe other small
4155     # bits, too) needed when installing a 32-bit LibreOffice on a
4156     # 64-bit OS. The 64-bit Explorer extension is a feature that
4157     # has been present since long in OOo. Don't confuse it with
4158     # building LibreOffice itself as 64-bit code.
4160     BUILD_X64=
4161     CXX_X64_BINARY=
4163     if test "$WIN_HOST_ARCH" = "x86" -a -n "$WIN_OTHER_ARCH"; then
4164         AC_MSG_CHECKING([for the libraries to build the 64-bit Explorer extensions])
4165         if test -f "$COMPATH/atlmfc/lib/x64/atls.lib" -o \
4166              -f "$COMPATH/atlmfc/lib/spectre/x64/atls.lib"
4167         then
4168             BUILD_X64=TRUE
4169             CXX_X64_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4170             AC_MSG_RESULT([found])
4171         else
4172             AC_MSG_RESULT([not found])
4173             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
4174         fi
4175     elif test "$WIN_HOST_ARCH" = "x64"; then
4176         CXX_X64_BINARY=$CXX
4177     fi
4178     AC_SUBST(BUILD_X64)
4180     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
4181     AC_SUBST(CXX_X64_BINARY)
4183     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
4184     # needed to support TWAIN scan on both 32- and 64-bit systems
4186     case "$WIN_HOST_ARCH" in
4187     x64)
4188         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
4189         if test -n "$CXX_X86_BINARY"; then
4190             BUILD_X86=TRUE
4191             AC_MSG_RESULT([preset])
4192         elif test -n "$WIN_MULTI_ARCH"; then
4193             BUILD_X86=TRUE
4194             CXX_X86_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4195             CXX_X86_BINARY+=" /arch:SSE"
4196             AC_MSG_RESULT([found])
4197         else
4198             AC_MSG_RESULT([not found])
4199             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
4200         fi
4201         ;;
4202     x86)
4203         BUILD_X86=TRUE
4204         CXX_X86_BINARY=$MSVC_CXX
4205         ;;
4206     esac
4207     AC_SUBST(BUILD_X86)
4208     AC_SUBST(CXX_X86_BINARY)
4210 AC_SUBST(VCVER)
4211 AC_SUBST(DEVENV)
4212 AC_SUBST(MSVC_CXX)
4214 COM_IS_CLANG=
4215 AC_MSG_CHECKING([whether the compiler is actually Clang])
4216 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4217     #ifndef __clang__
4218     you lose
4219     #endif
4220     int foo=42;
4221     ]])],
4222     [AC_MSG_RESULT([yes])
4223      COM_IS_CLANG=TRUE],
4224     [AC_MSG_RESULT([no])])
4225 AC_SUBST(COM_IS_CLANG)
4227 CC_PLAIN=$CC
4228 CLANGVER=
4229 if test "$COM_IS_CLANG" = TRUE; then
4230     AC_MSG_CHECKING([whether Clang is new enough])
4231     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4232         #if !defined __apple_build_version__
4233         #error
4234         #endif
4235         ]])],
4236         [my_apple_clang=yes],[my_apple_clang=])
4237     if test "$my_apple_clang" = yes; then
4238         AC_MSG_RESULT([assumed yes (Apple Clang)])
4239     elif test "$_os" = Emscripten; then
4240         AC_MSG_RESULT([assumed yes (Emscripten Clang)])
4241     else
4242         if test "$_os" = WINNT; then
4243             dnl In which case, assume clang-cl:
4244             my_args="/EP /TC"
4245             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
4246             dnl clang-cl:
4247             CC_PLAIN=
4248             for i in $CC; do
4249                 case $i in
4250                 -FIIntrin.h)
4251                     ;;
4252                 *)
4253                     CC_PLAIN="$CC_PLAIN $i"
4254                     ;;
4255                 esac
4256             done
4257         else
4258             my_args="-E -P"
4259         fi
4260         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
4261         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
4262         CLANGVER=`echo $clang_version \
4263             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
4264         if test "$CLANGVER" -ge 50002; then
4265             AC_MSG_RESULT([yes ($clang_version)])
4266         else
4267             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
4268         fi
4269         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
4270         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
4271     fi
4274 SHOWINCLUDES_PREFIX=
4275 if test "$_os" = WINNT; then
4276     dnl We need to guess the prefix of the -showIncludes output, it can be
4277     dnl localized
4278     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
4279     echo "#include <stdlib.h>" > conftest.c
4280     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
4281         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
4282     rm -f conftest.c conftest.obj
4283     if test -z "$SHOWINCLUDES_PREFIX"; then
4284         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
4285     else
4286         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
4287     fi
4289 AC_SUBST(SHOWINCLUDES_PREFIX)
4292 # prefix C with ccache if needed
4294 UNCACHED_CC="$CC"
4295 if test "$CCACHE" != ""; then
4296     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
4298     AC_LANG_PUSH([C])
4299     save_CFLAGS=$CFLAGS
4300     CFLAGS="$CFLAGS --ccache-skip -O2"
4301     dnl an empty program will do, we're checking the compiler flags
4302     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
4303                       [use_ccache=yes], [use_ccache=no])
4304     CFLAGS=$save_CFLAGS
4305     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
4306         AC_MSG_RESULT([yes])
4307     else
4308         CC="$CCACHE $CC"
4309         CC_BASE="ccache $CC_BASE"
4310         AC_MSG_RESULT([no])
4311     fi
4312     AC_LANG_POP([C])
4315 # ===================================================================
4316 # check various GCC options that Clang does not support now but maybe
4317 # will somewhen in the future, check them even for GCC, so that the
4318 # flags are set
4319 # ===================================================================
4321 HAVE_GCC_GGDB2=
4322 if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4323     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
4324     save_CFLAGS=$CFLAGS
4325     CFLAGS="$CFLAGS -Werror -ggdb2"
4326     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
4327     CFLAGS=$save_CFLAGS
4328     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
4329         AC_MSG_RESULT([yes])
4330     else
4331         AC_MSG_RESULT([no])
4332     fi
4334     if test "$host_cpu" = "m68k"; then
4335         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
4336         save_CFLAGS=$CFLAGS
4337         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
4338         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
4339         CFLAGS=$save_CFLAGS
4340         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
4341             AC_MSG_RESULT([yes])
4342         else
4343             AC_MSG_ERROR([no])
4344         fi
4345     fi
4347 AC_SUBST(HAVE_GCC_GGDB2)
4349 dnl ===================================================================
4350 dnl  Test the gcc version
4351 dnl ===================================================================
4352 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
4353     AC_MSG_CHECKING([the GCC version])
4354     _gcc_version=`$CC -dumpversion`
4355     gcc_full_version=$(printf '%s' "$_gcc_version" | \
4356         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
4357     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
4359     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
4361     if test "$gcc_full_version" -lt 70000; then
4362         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
4363     fi
4364 else
4365     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
4366     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
4367     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
4368     # (which reports itself as GCC 4.2.1).
4369     GCC_VERSION=
4371 AC_SUBST(GCC_VERSION)
4373 dnl Set the ENABLE_DBGUTIL variable
4374 dnl ===================================================================
4375 AC_MSG_CHECKING([whether to build with additional debug utilities])
4376 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
4377     ENABLE_DBGUTIL="TRUE"
4378     # this is an extra var so it can have different default on different MSVC
4379     # versions (in case there are version specific problems with it)
4380     MSVC_USE_DEBUG_RUNTIME="TRUE"
4382     AC_MSG_RESULT([yes])
4383     # cppunit and graphite expose STL in public headers
4384     if test "$with_system_cppunit" = "yes"; then
4385         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
4386     else
4387         with_system_cppunit=no
4388     fi
4389     if test "$with_system_graphite" = "yes"; then
4390         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
4391     else
4392         with_system_graphite=no
4393     fi
4394     if test "$with_system_orcus" = "yes"; then
4395         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
4396     else
4397         with_system_orcus=no
4398     fi
4399     if test "$with_system_libcmis" = "yes"; then
4400         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
4401     else
4402         with_system_libcmis=no
4403     fi
4404     if test "$with_system_hunspell" = "yes"; then
4405         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
4406     else
4407         with_system_hunspell=no
4408     fi
4409     if test "$with_system_gpgmepp" = "yes"; then
4410         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
4411     else
4412         with_system_gpgmepp=no
4413     fi
4414     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
4415     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
4416     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
4417     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
4418     # of those two is using the system variant:
4419     if test "$with_system_libnumbertext" = "yes"; then
4420         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
4421     else
4422         with_system_libnumbertext=no
4423     fi
4424     if test "$with_system_libwps" = "yes"; then
4425         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
4426     else
4427         with_system_libwps=no
4428     fi
4429 else
4430     ENABLE_DBGUTIL=""
4431     MSVC_USE_DEBUG_RUNTIME=""
4432     AC_MSG_RESULT([no])
4434 AC_SUBST(ENABLE_DBGUTIL)
4435 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
4437 dnl Set the ENABLE_DEBUG variable.
4438 dnl ===================================================================
4439 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
4440     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
4442 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
4443     if test -z "$libo_fuzzed_enable_debug"; then
4444         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
4445     else
4446         AC_MSG_NOTICE([Resetting --enable-debug=yes])
4447         enable_debug=yes
4448     fi
4451 AC_MSG_CHECKING([whether to do a debug build])
4452 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
4453     ENABLE_DEBUG="TRUE"
4454     if test -n "$ENABLE_DBGUTIL" ; then
4455         AC_MSG_RESULT([yes (dbgutil)])
4456     else
4457         AC_MSG_RESULT([yes])
4458     fi
4459 else
4460     ENABLE_DEBUG=""
4461     AC_MSG_RESULT([no])
4463 AC_SUBST(ENABLE_DEBUG)
4465 dnl ===================================================================
4466 dnl Select the linker to use (gold/lld/ld.bfd).
4467 dnl This is done only after compiler checks (need to know if Clang is
4468 dnl used, for different defaults) and after checking if a debug build
4469 dnl is wanted (non-debug builds get the default linker if not explicitly
4470 dnl specified otherwise).
4471 dnl All checks for linker features/options should come after this.
4472 dnl ===================================================================
4473 check_use_ld()
4475     use_ld=-fuse-ld=${1%%:*}
4476     use_ld_path=${1#*:}
4477     if test "$use_ld_path" != "$1"; then
4478         use_ld="$use_ld --ld-path=$use_ld_path"
4479     fi
4480     use_ld_fail_if_error=$2
4481     use_ld_ok=
4482     AC_MSG_CHECKING([for $use_ld linker support])
4483     use_ld_ldflags_save="$LDFLAGS"
4484     LDFLAGS="$LDFLAGS $use_ld"
4485     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4486 #include <stdio.h>
4487         ],[
4488 printf ("hello world\n");
4489         ])], USE_LD=$use_ld, [])
4490     if test -n "$USE_LD"; then
4491         AC_MSG_RESULT( yes )
4492         use_ld_ok=yes
4493     else
4494         if test -n "$use_ld_fail_if_error"; then
4495             AC_MSG_ERROR( no )
4496         else
4497             AC_MSG_RESULT( no )
4498         fi
4499     fi
4500     if test -n "$use_ld_ok"; then
4501         dnl keep the value of LDFLAGS
4502         return 0
4503     fi
4504     LDFLAGS="$use_ld_ldflags_save"
4505     return 1
4507 USE_LD=
4508 if test "$enable_ld" != "no"; then
4509     if test "$GCC" = "yes"; then
4510         if test -n "$enable_ld"; then
4511             check_use_ld "$enable_ld" fail_if_error
4512         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4513             dnl non-debug builds default to the default linker
4514             true
4515         elif test -n "$COM_IS_CLANG"; then
4516             check_use_ld lld
4517             if test $? -ne 0; then
4518                 check_use_ld gold
4519             fi
4520         else
4521             # For gcc first try gold, new versions also support lld.
4522             check_use_ld gold
4523             if test $? -ne 0; then
4524                 check_use_ld lld
4525             fi
4526         fi
4527         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4528         rm conftest.out
4529         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4530         if test -z "$ld_used"; then
4531             ld_used="unknown"
4532         fi
4533         AC_MSG_CHECKING([for linker that is used])
4534         AC_MSG_RESULT([$ld_used])
4535         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4536             if echo "$ld_used" | grep -q "^GNU ld"; then
4537                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4538                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4539             fi
4540         fi
4541     else
4542         if test "$enable_ld" = "yes"; then
4543             AC_MSG_ERROR([--enable-ld not supported])
4544         fi
4545     fi
4547 AC_SUBST(USE_LD)
4549 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4550 if test "$GCC" = "yes" -a "$_os" != Emscripten ; then
4551     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4552     bsymbolic_functions_ldflags_save=$LDFLAGS
4553     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4554     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4555 #include <stdio.h>
4556         ],[
4557 printf ("hello world\n");
4558         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4559     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4560         AC_MSG_RESULT( found )
4561     else
4562         AC_MSG_RESULT( not found )
4563     fi
4564     LDFLAGS=$bsymbolic_functions_ldflags_save
4566 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4568 LD_GC_SECTIONS=
4569 if test "$GCC" = "yes"; then
4570     for flag in "--gc-sections" "-dead_strip"; do
4571         AC_MSG_CHECKING([for $flag linker support])
4572         ldflags_save=$LDFLAGS
4573         LDFLAGS="$LDFLAGS -Wl,$flag"
4574         AC_LINK_IFELSE([AC_LANG_PROGRAM([
4575 #include <stdio.h>
4576             ],[
4577 printf ("hello world\n");
4578             ])],[
4579             LD_GC_SECTIONS="-Wl,$flag"
4580             AC_MSG_RESULT( found )
4581             ], [
4582             AC_MSG_RESULT( not found )
4583             ])
4584         LDFLAGS=$ldflags_save
4585         if test -n "$LD_GC_SECTIONS"; then
4586             break
4587         fi
4588     done
4590 AC_SUBST(LD_GC_SECTIONS)
4592 HAVE_GSPLIT_DWARF=
4593 if test "$enable_split_debug" != no; then
4594     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4595     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4596         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4597         save_CFLAGS=$CFLAGS
4598         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4599         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4600         CFLAGS=$save_CFLAGS
4601         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4602             AC_MSG_RESULT([yes])
4603         else
4604             if test "$enable_split_debug" = yes; then
4605                 AC_MSG_ERROR([no])
4606             else
4607                 AC_MSG_RESULT([no])
4608             fi
4609         fi
4610     fi
4611     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4612         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4613         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4614     fi
4616 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4618 HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=
4619 AC_MSG_CHECKING([whether $CC_BASE supports -Xclang -debug-info-kind=constructor])
4620 save_CFLAGS=$CFLAGS
4621 CFLAGS="$CFLAGS -Werror -Xclang -debug-info-kind=constructor"
4622 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=TRUE ],[])
4623 CFLAGS=$save_CFLAGS
4624 if test "$HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR" = "TRUE"; then
4625     AC_MSG_RESULT([yes])
4626 else
4627     AC_MSG_RESULT([no])
4629 AC_SUBST(HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR)
4631 ENABLE_GDB_INDEX=
4632 if test "$enable_gdb_index" != "no"; then
4633     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4634     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4635         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4636         save_CFLAGS=$CFLAGS
4637         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4638         have_ggnu_pubnames=
4639         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4640         if test "$have_ggnu_pubnames" != "TRUE"; then
4641             if test "$enable_gdb_index" = "yes"; then
4642                 AC_MSG_ERROR([no, --enable-gdb-index not supported])
4643             else
4644                 AC_MSG_RESULT( no )
4645             fi
4646         else
4647             AC_MSG_RESULT( yes )
4648             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4649             ldflags_save=$LDFLAGS
4650             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4651             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4652 #include <stdio.h>
4653                 ],[
4654 printf ("hello world\n");
4655                 ])], ENABLE_GDB_INDEX=TRUE, [])
4656             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4657                 AC_MSG_RESULT( yes )
4658             else
4659                 if test "$enable_gdb_index" = "yes"; then
4660                     AC_MSG_ERROR( no )
4661                 else
4662                     AC_MSG_RESULT( no )
4663                 fi
4664             fi
4665             LDFLAGS=$ldflags_save
4666         fi
4667         CFLAGS=$save_CFLAGS
4668         fi
4669     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4670         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4671         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4672     fi
4674 AC_SUBST(ENABLE_GDB_INDEX)
4676 if test -z "$enable_sal_log" && test "$ENABLE_DEBUG" = TRUE; then
4677     enable_sal_log=yes
4679 if test "$enable_sal_log" = yes; then
4680     ENABLE_SAL_LOG=TRUE
4682 AC_SUBST(ENABLE_SAL_LOG)
4684 dnl Check for enable symbols option
4685 dnl ===================================================================
4686 AC_MSG_CHECKING([whether to generate debug information])
4687 if test -z "$enable_symbols"; then
4688     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4689         enable_symbols=yes
4690     else
4691         enable_symbols=no
4692     fi
4694 if test "$enable_symbols" = yes; then
4695     ENABLE_SYMBOLS_FOR=all
4696     AC_MSG_RESULT([yes])
4697 elif test "$enable_symbols" = no; then
4698     ENABLE_SYMBOLS_FOR=
4699     AC_MSG_RESULT([no])
4700 else
4701     # Selective debuginfo.
4702     ENABLE_SYMBOLS_FOR="$enable_symbols"
4703     AC_MSG_RESULT([for "$enable_symbols"])
4705 AC_SUBST(ENABLE_SYMBOLS_FOR)
4707 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4708     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4709     AC_MSG_CHECKING([whether enough memory is available for linking])
4710     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4711     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4712     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4713         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4714     else
4715         AC_MSG_RESULT([yes])
4716     fi
4719 ENABLE_OPTIMIZED=
4720 ENABLE_OPTIMIZED_DEBUG=
4721 AC_MSG_CHECKING([whether to compile with optimization flags])
4722 if test -z "$enable_optimized"; then
4723     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4724         enable_optimized=no
4725     else
4726         enable_optimized=yes
4727     fi
4729 if test "$enable_optimized" = yes; then
4730     ENABLE_OPTIMIZED=TRUE
4731     AC_MSG_RESULT([yes])
4732 elif test "$enable_optimized" = debug; then
4733     ENABLE_OPTIMIZED_DEBUG=TRUE
4734     AC_MSG_RESULT([yes (debug)])
4735     HAVE_GCC_OG=
4736     if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4737         AC_MSG_CHECKING([whether $CC_BASE supports -Og])
4738         save_CFLAGS=$CFLAGS
4739         CFLAGS="$CFLAGS -Werror -Og"
4740         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[])
4741         CFLAGS=$save_CFLAGS
4742         if test "$HAVE_GCC_OG" = "TRUE"; then
4743             AC_MSG_RESULT([yes])
4744         else
4745             AC_MSG_RESULT([no])
4746         fi
4747     fi
4748     if test -z "$HAVE_GCC_OG" -a "$_os" != "Emscripten"; then
4749         AC_MSG_ERROR([The compiler does not support optimizations suitable for debugging.])
4750     fi
4751 else
4752     AC_MSG_RESULT([no])
4754 AC_SUBST(ENABLE_OPTIMIZED)
4755 AC_SUBST(ENABLE_OPTIMIZED_DEBUG)
4758 # determine CPUNAME, OS, ...
4760 case "$host_os" in
4762 aix*)
4763     COM=GCC
4764     CPUNAME=POWERPC
4765     OS=AIX
4766     RTL_OS=AIX
4767     RTL_ARCH=PowerPC
4768     PLATFORMID=aix_powerpc
4769     P_SEP=:
4770     ;;
4772 cygwin*|wsl*)
4773     # Already handled
4774     ;;
4776 darwin*|macos*)
4777     COM=GCC
4778     OS=MACOSX
4779     RTL_OS=MacOSX
4780     P_SEP=:
4782     case "$host_cpu" in
4783     aarch64|arm64)
4784         if test "$enable_ios_simulator" = "yes"; then
4785             OS=iOS
4786         else
4787             CPUNAME=AARCH64
4788             RTL_ARCH=AARCH64
4789             PLATFORMID=macosx_aarch64
4790         fi
4791         ;;
4792     x86_64)
4793         if test "$enable_ios_simulator" = "yes"; then
4794             OS=iOS
4795         fi
4796         CPUNAME=X86_64
4797         RTL_ARCH=X86_64
4798         PLATFORMID=macosx_x86_64
4799         ;;
4800     *)
4801         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4802         ;;
4803     esac
4804     ;;
4806 ios*)
4807     COM=GCC
4808     OS=iOS
4809     RTL_OS=iOS
4810     P_SEP=:
4812     case "$host_cpu" in
4813     aarch64|arm64)
4814         if test "$enable_ios_simulator" = "yes"; then
4815             AC_MSG_ERROR([iOS simulator is only available in macOS not iOS])
4816         fi
4817         ;;
4818     *)
4819         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4820         ;;
4821     esac
4822     CPUNAME=AARCH64
4823     RTL_ARCH=AARCH64
4824     PLATFORMID=ios_arm64
4825     ;;
4827 dragonfly*)
4828     COM=GCC
4829     OS=DRAGONFLY
4830     RTL_OS=DragonFly
4831     P_SEP=:
4833     case "$host_cpu" in
4834     i*86)
4835         CPUNAME=INTEL
4836         RTL_ARCH=x86
4837         PLATFORMID=dragonfly_x86
4838         ;;
4839     x86_64)
4840         CPUNAME=X86_64
4841         RTL_ARCH=X86_64
4842         PLATFORMID=dragonfly_x86_64
4843         ;;
4844     *)
4845         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4846         ;;
4847     esac
4848     ;;
4850 freebsd*)
4851     COM=GCC
4852     RTL_OS=FreeBSD
4853     OS=FREEBSD
4854     P_SEP=:
4856     case "$host_cpu" in
4857     aarch64)
4858         CPUNAME=AARCH64
4859         PLATFORMID=freebsd_aarch64
4860         RTL_ARCH=AARCH64
4861         ;;
4862     i*86)
4863         CPUNAME=INTEL
4864         RTL_ARCH=x86
4865         PLATFORMID=freebsd_x86
4866         ;;
4867     x86_64|amd64)
4868         CPUNAME=X86_64
4869         RTL_ARCH=X86_64
4870         PLATFORMID=freebsd_x86_64
4871         ;;
4872     powerpc64)
4873         CPUNAME=POWERPC64
4874         RTL_ARCH=PowerPC_64
4875         PLATFORMID=freebsd_powerpc64
4876         ;;
4877     powerpc|powerpcspe)
4878         CPUNAME=POWERPC
4879         RTL_ARCH=PowerPC
4880         PLATFORMID=freebsd_powerpc
4881         ;;
4882     *)
4883         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4884         ;;
4885     esac
4886     ;;
4888 haiku*)
4889     COM=GCC
4890     GUIBASE=haiku
4891     RTL_OS=Haiku
4892     OS=HAIKU
4893     P_SEP=:
4895     case "$host_cpu" in
4896     i*86)
4897         CPUNAME=INTEL
4898         RTL_ARCH=x86
4899         PLATFORMID=haiku_x86
4900         ;;
4901     x86_64|amd64)
4902         CPUNAME=X86_64
4903         RTL_ARCH=X86_64
4904         PLATFORMID=haiku_x86_64
4905         ;;
4906     *)
4907         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4908         ;;
4909     esac
4910     ;;
4912 kfreebsd*)
4913     COM=GCC
4914     OS=LINUX
4915     RTL_OS=kFreeBSD
4916     P_SEP=:
4918     case "$host_cpu" in
4920     i*86)
4921         CPUNAME=INTEL
4922         RTL_ARCH=x86
4923         PLATFORMID=kfreebsd_x86
4924         ;;
4925     x86_64)
4926         CPUNAME=X86_64
4927         RTL_ARCH=X86_64
4928         PLATFORMID=kfreebsd_x86_64
4929         ;;
4930     *)
4931         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4932         ;;
4933     esac
4934     ;;
4936 linux-gnu*)
4937     COM=GCC
4938     OS=LINUX
4939     RTL_OS=Linux
4940     P_SEP=:
4942     case "$host_cpu" in
4944     aarch64)
4945         CPUNAME=AARCH64
4946         PLATFORMID=linux_aarch64
4947         RTL_ARCH=AARCH64
4948         EPM_FLAGS="-a arm64"
4949         ;;
4950     alpha)
4951         CPUNAME=AXP
4952         RTL_ARCH=ALPHA
4953         PLATFORMID=linux_alpha
4954         ;;
4955     arm*)
4956         CPUNAME=ARM
4957         EPM_FLAGS="-a arm"
4958         RTL_ARCH=ARM_EABI
4959         PLATFORMID=linux_arm_eabi
4960         case "$host_cpu" in
4961         arm*-linux)
4962             RTL_ARCH=ARM_OABI
4963             PLATFORMID=linux_arm_oabi
4964             ;;
4965         esac
4966         ;;
4967     hppa)
4968         CPUNAME=HPPA
4969         RTL_ARCH=HPPA
4970         EPM_FLAGS="-a hppa"
4971         PLATFORMID=linux_hppa
4972         ;;
4973     i*86)
4974         CPUNAME=INTEL
4975         RTL_ARCH=x86
4976         PLATFORMID=linux_x86
4977         ;;
4978     ia64)
4979         CPUNAME=IA64
4980         RTL_ARCH=IA64
4981         PLATFORMID=linux_ia64
4982         ;;
4983     mips)
4984         CPUNAME=GODSON
4985         RTL_ARCH=MIPS_EB
4986         EPM_FLAGS="-a mips"
4987         PLATFORMID=linux_mips_eb
4988         ;;
4989     mips64)
4990         CPUNAME=GODSON64
4991         RTL_ARCH=MIPS64_EB
4992         EPM_FLAGS="-a mips64"
4993         PLATFORMID=linux_mips64_eb
4994         ;;
4995     mips64el)
4996         CPUNAME=GODSON64
4997         RTL_ARCH=MIPS64_EL
4998         EPM_FLAGS="-a mips64el"
4999         PLATFORMID=linux_mips64_el
5000         ;;
5001     mipsel)
5002         CPUNAME=GODSON
5003         RTL_ARCH=MIPS_EL
5004         EPM_FLAGS="-a mipsel"
5005         PLATFORMID=linux_mips_el
5006         ;;
5007     m68k)
5008         CPUNAME=M68K
5009         RTL_ARCH=M68K
5010         PLATFORMID=linux_m68k
5011         ;;
5012     powerpc)
5013         CPUNAME=POWERPC
5014         RTL_ARCH=PowerPC
5015         PLATFORMID=linux_powerpc
5016         ;;
5017     powerpc64)
5018         CPUNAME=POWERPC64
5019         RTL_ARCH=PowerPC_64
5020         PLATFORMID=linux_powerpc64
5021         ;;
5022     powerpc64le)
5023         CPUNAME=POWERPC64
5024         RTL_ARCH=PowerPC_64_LE
5025         PLATFORMID=linux_powerpc64_le
5026         ;;
5027     sparc)
5028         CPUNAME=SPARC
5029         RTL_ARCH=SPARC
5030         PLATFORMID=linux_sparc
5031         ;;
5032     sparc64)
5033         CPUNAME=SPARC64
5034         RTL_ARCH=SPARC64
5035         PLATFORMID=linux_sparc64
5036         ;;
5037     s390)
5038         CPUNAME=S390
5039         RTL_ARCH=S390
5040         PLATFORMID=linux_s390
5041         ;;
5042     s390x)
5043         CPUNAME=S390X
5044         RTL_ARCH=S390x
5045         PLATFORMID=linux_s390x
5046         ;;
5047     x86_64)
5048         CPUNAME=X86_64
5049         RTL_ARCH=X86_64
5050         PLATFORMID=linux_x86_64
5051         ;;
5052     *)
5053         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5054         ;;
5055     esac
5056     ;;
5058 linux-android*)
5059     COM=GCC
5060     OS=ANDROID
5061     RTL_OS=Android
5062     P_SEP=:
5064     case "$host_cpu" in
5066     arm|armel)
5067         CPUNAME=ARM
5068         RTL_ARCH=ARM_EABI
5069         PLATFORMID=android_arm_eabi
5070         ;;
5071     aarch64)
5072         CPUNAME=AARCH64
5073         RTL_ARCH=AARCH64
5074         PLATFORMID=android_aarch64
5075         ;;
5076     i*86)
5077         CPUNAME=INTEL
5078         RTL_ARCH=x86
5079         PLATFORMID=android_x86
5080         ;;
5081     x86_64)
5082         CPUNAME=X86_64
5083         RTL_ARCH=X86_64
5084         PLATFORMID=android_x86_64
5085         ;;
5086     *)
5087         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5088         ;;
5089     esac
5090     ;;
5092 *netbsd*)
5093     COM=GCC
5094     OS=NETBSD
5095     RTL_OS=NetBSD
5096     P_SEP=:
5098     case "$host_cpu" in
5099     i*86)
5100         CPUNAME=INTEL
5101         RTL_ARCH=x86
5102         PLATFORMID=netbsd_x86
5103         ;;
5104     powerpc)
5105         CPUNAME=POWERPC
5106         RTL_ARCH=PowerPC
5107         PLATFORMID=netbsd_powerpc
5108         ;;
5109     sparc)
5110         CPUNAME=SPARC
5111         RTL_ARCH=SPARC
5112         PLATFORMID=netbsd_sparc
5113         ;;
5114     x86_64)
5115         CPUNAME=X86_64
5116         RTL_ARCH=X86_64
5117         PLATFORMID=netbsd_x86_64
5118         ;;
5119     *)
5120         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5121         ;;
5122     esac
5123     ;;
5125 openbsd*)
5126     COM=GCC
5127     OS=OPENBSD
5128     RTL_OS=OpenBSD
5129     P_SEP=:
5131     case "$host_cpu" in
5132     i*86)
5133         CPUNAME=INTEL
5134         RTL_ARCH=x86
5135         PLATFORMID=openbsd_x86
5136         ;;
5137     x86_64)
5138         CPUNAME=X86_64
5139         RTL_ARCH=X86_64
5140         PLATFORMID=openbsd_x86_64
5141         ;;
5142     *)
5143         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5144         ;;
5145     esac
5146     SOLARINC="$SOLARINC -I/usr/local/include"
5147     ;;
5149 solaris*)
5150     COM=GCC
5151     OS=SOLARIS
5152     RTL_OS=Solaris
5153     P_SEP=:
5155     case "$host_cpu" in
5156     i*86)
5157         CPUNAME=INTEL
5158         RTL_ARCH=x86
5159         PLATFORMID=solaris_x86
5160         ;;
5161     sparc)
5162         CPUNAME=SPARC
5163         RTL_ARCH=SPARC
5164         PLATFORMID=solaris_sparc
5165         ;;
5166     sparc64)
5167         CPUNAME=SPARC64
5168         RTL_ARCH=SPARC64
5169         PLATFORMID=solaris_sparc64
5170         ;;
5171     *)
5172         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5173         ;;
5174     esac
5175     SOLARINC="$SOLARINC -I/usr/local/include"
5176     ;;
5178 emscripten*)
5179     COM=GCC
5180     OS=EMSCRIPTEN
5181     RTL_OS=Emscripten
5182     P_SEP=:
5184     case "$host_cpu" in
5185     wasm32|wasm64)
5186         ;;
5187     *)
5188         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5189         ;;
5190     esac
5191     CPUNAME=INTEL
5192     RTL_ARCH=x86
5193     PLATFORMID=linux_x86
5194     ;;
5197     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
5198     ;;
5199 esac
5201 if test "$with_x" = "no"; then
5202     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
5205 DISABLE_GUI=""
5206 if test "$enable_gui" = "no"; then
5207     if test "$using_x11" != yes; then
5208         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
5209     fi
5210     USING_X11=
5211     DISABLE_GUI=TRUE
5212 else
5213     AC_DEFINE(HAVE_FEATURE_UI)
5215 AC_SUBST(DISABLE_GUI)
5217 if test "$using_x11" = yes; then
5218     if test "$USING_X11" = TRUE; then
5219         AC_DEFINE(USING_X11)
5220     else
5221         disable_x11_tests
5222     fi
5223 else
5224     if test "$USING_X11" = TRUE; then
5225         AC_MSG_ERROR([Platform doesn't support X11 (\$using_x11), but \$USING_X11 is set!])
5226     fi
5229 WORKDIR="${BUILDDIR}/workdir"
5230 INSTDIR="${BUILDDIR}/instdir"
5231 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
5232 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
5233 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
5234 AC_SUBST(COM)
5235 AC_SUBST(CPUNAME)
5236 AC_SUBST(RTL_OS)
5237 AC_SUBST(RTL_ARCH)
5238 AC_SUBST(EPM_FLAGS)
5239 AC_SUBST(USING_X11)
5240 AC_SUBST([INSTDIR])
5241 AC_SUBST([INSTROOT])
5242 AC_SUBST([INSTROOTBASE])
5243 AC_SUBST(OS)
5244 AC_SUBST(P_SEP)
5245 AC_SUBST(WORKDIR)
5246 AC_SUBST(PLATFORMID)
5247 AC_SUBST(WINDOWS_X64)
5248 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
5250 if test "$OS" = WNT -a "$COM" = MSC; then
5251     case "$CPUNAME" in
5252     INTEL) CPPU_ENV=msci ;;
5253     X86_64) CPPU_ENV=mscx ;;
5254     AARCH64) CPPU_ENV=msca ;;
5255     *)
5256         AC_MSG_ERROR([Unknown \$CPUNAME '$CPUNAME' for $OS / $COM"])
5257         ;;
5258     esac
5259 else
5260     CPPU_ENV=gcc3
5262 AC_SUBST(CPPU_ENV)
5264 dnl ===================================================================
5265 dnl Test which package format to use
5266 dnl ===================================================================
5267 AC_MSG_CHECKING([which package format to use])
5268 if test -n "$with_package_format" -a "$with_package_format" != no; then
5269     for i in $with_package_format; do
5270         case "$i" in
5271         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
5272             ;;
5273         *)
5274             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
5275 aix - AIX software distribution
5276 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
5277 deb - Debian software distribution
5278 pkg - Solaris software distribution
5279 rpm - RedHat software distribution
5281 LibreOffice additionally supports:
5282 archive - .tar.gz or .zip
5283 dmg - macOS .dmg
5284 installed - installation tree
5285 msi - Windows .msi
5286         ])
5287             ;;
5288         esac
5289     done
5290     # fakeroot is needed to ensure correct file ownerships/permissions
5291     # inside deb packages and tar archives created on Linux and Solaris.
5292     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
5293         AC_PATH_PROG(FAKEROOT, fakeroot, no)
5294         if test "$FAKEROOT" = "no"; then
5295             AC_MSG_ERROR(
5296                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
5297         fi
5298     fi
5299     PKGFORMAT="$with_package_format"
5300     AC_MSG_RESULT([$PKGFORMAT])
5301 else
5302     PKGFORMAT=
5303     AC_MSG_RESULT([none])
5305 AC_SUBST(PKGFORMAT)
5307 dnl ===================================================================
5308 dnl Set up a different compiler to produce tools to run on the build
5309 dnl machine when doing cross-compilation
5310 dnl ===================================================================
5312 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
5313 m4_pattern_allow([PKG_CONFIG_LIBDIR])
5314 if test "$cross_compiling" = "yes"; then
5315     AC_MSG_CHECKING([for BUILD platform configuration])
5316     echo
5317     rm -rf CONF-FOR-BUILD config_build.mk
5318     mkdir CONF-FOR-BUILD
5319     # Here must be listed all files needed when running the configure script. In particular, also
5320     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
5321     # keep them in the same order as there.
5322     (cd $SRC_ROOT && tar cf - \
5323         config.guess \
5324         bin/get_config_variables \
5325         solenv/bin/getcompver.awk \
5326         solenv/inc/langlist.mk \
5327         download.lst \
5328         config_host.mk.in \
5329         config_host_lang.mk.in \
5330         Makefile.in \
5331         bin/bffvalidator.sh.in \
5332         bin/odfvalidator.sh.in \
5333         bin/officeotron.sh.in \
5334         hardened_runtime.xcent.in \
5335         instsetoo_native/util/openoffice.lst.in \
5336         config_host/*.in \
5337         sysui/desktop/macosx/Info.plist.in \
5338         .vscode/vs-code-template.code-workspace.in \
5339         ) \
5340     | (cd CONF-FOR-BUILD && tar xf -)
5341     cp configure CONF-FOR-BUILD
5342     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
5343     (
5344     unset COM USING_X11 OS CPUNAME
5345     unset CC CXX SYSBASE CFLAGS
5346     unset AR LD NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
5347     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
5348     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
5349     unset PKG_CONFIG_LIBDIR PKG_CONFIG_PATH
5350     if test -n "$CC_FOR_BUILD"; then
5351         export CC="$CC_FOR_BUILD"
5352         CC_BASE=`first_arg_basename "$CC"`
5353     fi
5354     if test -n "$CXX_FOR_BUILD"; then
5355         export CXX="$CXX_FOR_BUILD"
5356         CXX_BASE=`first_arg_basename "$CXX"`
5357     fi
5358     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
5359     cd CONF-FOR-BUILD
5361     # Handle host configuration, which affects the cross-toolset too
5362     sub_conf_opts=""
5363     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
5364     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
5365     test "$with_junit" = "no" && sub_conf_opts="$sub_conf_opts --without-junit"
5366     if test -n "$ENABLE_JAVA"; then
5367         case "$_os" in
5368         iOS) sub_conf_opts="$sub_conf_opts --without-java" ;; # force it off, like it used to be
5369         Android)
5370             # Hack for Android - the build doesn't need a host JDK, so just forward to build for convenience
5371             test -n "$with_jdk_home" && sub_conf_opts="$sub_conf_opts --with-jdk-home=$with_jdk_home"
5372             ;;
5373         *)
5374             if test -z "$with_jdk_home"; then
5375                 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.])
5376             fi
5377             ;;
5378         esac
5379     else
5380         sub_conf_opts="$sub_conf_opts --without-java"
5381     fi
5382     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
5383     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
5384     test "$with_galleries" = "no" -o -z "$WITH_GALLERY_BUILD" && sub_conf_opts="$sub_conf_opts --with-galleries=no --disable-database-connectivity"
5385     test "$enable_wasm_strip" = "yes" && sub_conf_opts="$sub_conf_opts --enable-wasm-strip"
5386     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
5388     # Don't bother having configure look for stuff not needed for the build platform anyway
5389     ./configure \
5390         --build="$build_alias" \
5391         --disable-cairo-canvas \
5392         --disable-cups \
5393         --disable-firebird-sdbc \
5394         --disable-gpgmepp \
5395         --disable-gstreamer-1-0 \
5396         --disable-gtk3 \
5397         --disable-gtk4 \
5398         --disable-mariadb-sdbc \
5399         --disable-nss \
5400         --disable-online-update \
5401         --disable-opencl \
5402         --disable-pdfimport \
5403         --disable-postgresql-sdbc \
5404         --disable-skia \
5405         --enable-icecream="$enable_icecream" \
5406         --without-doxygen \
5407         --without-webdav \
5408         --with-parallelism="$with_parallelism" \
5409         --with-theme="$with_theme" \
5410         --with-tls=openssl \
5411         $sub_conf_opts \
5412         --srcdir=$srcdir \
5413         2>&1 | sed -e 's/^/    /'
5414     if test [${PIPESTATUS[0]}] -ne 0; then
5415         AC_MSG_ERROR([Running the configure script for BUILD side failed, see CONF-FOR-BUILD/config.log])
5416     fi
5418     # filter permitted build targets
5419     PERMITTED_BUILD_TARGETS="
5420         AVMEDIA
5421         BOOST
5422         CAIRO
5423         CLUCENE
5424         CURL
5425         DBCONNECTIVITY
5426         DESKTOP
5427         DYNLOADING
5428         EPOXY
5429         EXPAT
5430         GLM
5431         GRAPHITE
5432         HARFBUZZ
5433         ICU
5434         LCMS2
5435         LIBJPEG_TURBO
5436         LIBLANGTAG
5437         LibO
5438         LIBFFI
5439         LIBPN
5440         LIBXML2
5441         LIBXSLT
5442         MDDS
5443         NATIVE
5444         OPENSSL
5445         ORCUS
5446         PYTHON
5447         SCRIPTING
5448         ZLIB
5450     # converts BUILD_TYPE and PERMITTED_BUILD_TARGETS into non-whitespace,
5451     # newlined lists, to use grep as a filter
5452     PERMITTED_BUILD_TARGETS=$(echo "$PERMITTED_BUILD_TARGETS" | sed -e '/^ *$/d' -e 's/ *//')
5453     BUILD_TARGETS="$(sed -n -e '/^export BUILD_TYPE=/ s/.*=//p' config_host.mk | tr ' ' '\n')"
5454     BUILD_TARGETS="$(echo "$BUILD_TARGETS" | grep -F "$PERMITTED_BUILD_TARGETS" | tr '\n' ' ')"
5455     sed -i -e "s/ BUILD_TYPE=.*$/ BUILD_TYPE=$BUILD_TARGETS/" config_host.mk
5457     cp config_host.mk ../config_build.mk
5458     cp config_host_lang.mk ../config_build_lang.mk
5459     mv config.log ../config.Build.log
5460     mkdir -p ../config_build
5461     mv config_host/*.h ../config_build
5462     test -f "$WARNINGS_FILE" && mv "$WARNINGS_FILE" "../$WARNINGS_FILE_FOR_BUILD"
5464     # all these will get a _FOR_BUILD postfix
5465     DIRECT_FOR_BUILD_SETTINGS="
5466         CC
5467         CPPU_ENV
5468         CXX
5469         ILIB
5470         JAVA_HOME
5471         JAVAIFLAGS
5472         JDK
5473         LIBO_BIN_FOLDER
5474         LIBO_LIB_FOLDER
5475         LIBO_URE_LIB_FOLDER
5476         LIBO_URE_MISC_FOLDER
5477         OS
5478         SDKDIRNAME
5479         SYSTEM_LIBXML
5480         SYSTEM_LIBXSLT
5482     # these overwrite host config with build config
5483     OVERWRITING_SETTINGS="
5484         ANT
5485         ANT_HOME
5486         ANT_LIB
5487         HSQLDB_USE_JDBC_4_1
5488         JAVA_CLASSPATH_NOT_SET
5489         JAVA_SOURCE_VER
5490         JAVA_TARGET_VER
5491         JAVACFLAGS
5492         JAVACOMPILER
5493         JAVADOC
5494         JAVADOCISGJDOC
5496     # these need some special handling
5497     EXTRA_HANDLED_SETTINGS="
5498         INSTDIR
5499         INSTROOT
5500         PATH
5501         WORKDIR
5503     OLD_PATH=$PATH
5504     . ./bin/get_config_variables $DIRECT_FOR_BUILD_SETTINGS $OVERWRITING_SETTINGS $EXTRA_HANDLED_SETTINGS
5505     BUILD_PATH=$PATH
5506     PATH=$OLD_PATH
5508     line=`echo "LO_PATH_FOR_BUILD='${BUILD_PATH}'" | sed -e 's,/CONF-FOR-BUILD,,g'`
5509     echo "$line" >>build-config
5511     for V in $DIRECT_FOR_BUILD_SETTINGS; do
5512         VV='$'$V
5513         VV=`eval "echo $VV"`
5514         if test -n "$VV"; then
5515             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
5516             echo "$line" >>build-config
5517         fi
5518     done
5520     for V in $OVERWRITING_SETTINGS; do
5521         VV='$'$V
5522         VV=`eval "echo $VV"`
5523         if test -n "$VV"; then
5524             line=${V}='${'${V}:-$VV'}'
5525             echo "$line" >>build-config
5526         fi
5527     done
5529     for V in INSTDIR INSTROOT WORKDIR; do
5530         VV='$'$V
5531         VV=`eval "echo $VV"`
5532         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
5533         if test -n "$VV"; then
5534             line="${V}_FOR_BUILD='$VV'"
5535             echo "$line" >>build-config
5536         fi
5537     done
5539     )
5540     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([setup/configure for BUILD side failed, see CONF-FOR-BUILD/config.log])
5541     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])
5542     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
5543              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
5545     eval `cat CONF-FOR-BUILD/build-config`
5547     AC_MSG_RESULT([checking for BUILD platform configuration... done])
5549     rm -rf CONF-FOR-BUILD
5550 else
5551     OS_FOR_BUILD="$OS"
5552     CC_FOR_BUILD="$CC"
5553     CPPU_ENV_FOR_BUILD="$CPPU_ENV"
5554     CXX_FOR_BUILD="$CXX"
5555     INSTDIR_FOR_BUILD="$INSTDIR"
5556     INSTROOT_FOR_BUILD="$INSTROOT"
5557     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
5558     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
5559     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
5560     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
5561     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
5562     WORKDIR_FOR_BUILD="$WORKDIR"
5564 AC_SUBST(OS_FOR_BUILD)
5565 AC_SUBST(INSTDIR_FOR_BUILD)
5566 AC_SUBST(INSTROOT_FOR_BUILD)
5567 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
5568 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
5569 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
5570 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
5571 AC_SUBST(SDKDIRNAME_FOR_BUILD)
5572 AC_SUBST(WORKDIR_FOR_BUILD)
5573 AC_SUBST(CC_FOR_BUILD)
5574 AC_SUBST(CXX_FOR_BUILD)
5575 AC_SUBST(CPPU_ENV_FOR_BUILD)
5577 dnl ===================================================================
5578 dnl Check for syslog header
5579 dnl ===================================================================
5580 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
5582 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
5583 dnl ===================================================================
5584 AC_MSG_CHECKING([whether to turn warnings to errors])
5585 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
5586     ENABLE_WERROR="TRUE"
5587     PYTHONWARNINGS="error"
5588     AC_MSG_RESULT([yes])
5589 else
5590     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
5591         ENABLE_WERROR="TRUE"
5592         PYTHONWARNINGS="error"
5593         AC_MSG_RESULT([yes])
5594     else
5595         AC_MSG_RESULT([no])
5596     fi
5598 AC_SUBST(ENABLE_WERROR)
5599 AC_SUBST(PYTHONWARNINGS)
5601 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
5602 dnl ===================================================================
5603 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
5604 if test -z "$enable_assert_always_abort"; then
5605    if test "$ENABLE_DEBUG" = TRUE; then
5606        enable_assert_always_abort=yes
5607    else
5608        enable_assert_always_abort=no
5609    fi
5611 if test "$enable_assert_always_abort" = "yes"; then
5612     ASSERT_ALWAYS_ABORT="TRUE"
5613     AC_MSG_RESULT([yes])
5614 else
5615     ASSERT_ALWAYS_ABORT="FALSE"
5616     AC_MSG_RESULT([no])
5618 AC_SUBST(ASSERT_ALWAYS_ABORT)
5620 # Determine whether to use ooenv for the instdir installation
5621 # ===================================================================
5622 if test $_os != "WINNT" -a $_os != "Darwin"; then
5623     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
5624     if test -z "$enable_ooenv"; then
5625         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5626             enable_ooenv=yes
5627         else
5628             enable_ooenv=no
5629         fi
5630     fi
5631     if test "$enable_ooenv" = "no"; then
5632         AC_MSG_RESULT([no])
5633     else
5634         ENABLE_OOENV="TRUE"
5635         AC_MSG_RESULT([yes])
5636     fi
5638 AC_SUBST(ENABLE_OOENV)
5640 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
5641     if test "$enable_qt5" = "no"; then
5642         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
5643     else
5644         enable_qt5=yes
5645     fi
5648 dnl ===================================================================
5649 dnl check for cups support
5650 dnl ===================================================================
5652 AC_MSG_CHECKING([whether to enable CUPS support])
5653 if test "$test_cups" = yes -a "$enable_cups" != no; then
5654     ENABLE_CUPS=TRUE
5655     AC_MSG_RESULT([yes])
5657     AC_MSG_CHECKING([whether cups support is present])
5658     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
5659     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
5660     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
5661         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
5662     fi
5663 else
5664     AC_MSG_RESULT([no])
5667 AC_SUBST(ENABLE_CUPS)
5669 # fontconfig checks
5670 if test "$using_freetype_fontconfig" = yes; then
5671     AC_MSG_CHECKING([which fontconfig to use])
5673 if test "$using_freetype_fontconfig" = yes -a "$test_system_fontconfig" != no; then
5674     AC_MSG_RESULT([external])
5675     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
5676     SYSTEM_FONTCONFIG=TRUE
5677     FilterLibs "${FONTCONFIG_LIBS}"
5678     FONTCONFIG_LIBS="${filteredlibs}"
5679 elif test "$using_freetype_fontconfig" = yes; then
5680     AC_MSG_RESULT([internal])
5681     BUILD_TYPE="$BUILD_TYPE FONTCONFIG"
5683 AC_SUBST(FONTCONFIG_CFLAGS)
5684 AC_SUBST(FONTCONFIG_LIBS)
5685 AC_SUBST([SYSTEM_FONTCONFIG])
5687 dnl whether to find & fetch external tarballs?
5688 dnl ===================================================================
5689 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
5690    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5691        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
5692    else
5693        TARFILE_LOCATION="$LODE_HOME/ext_tar"
5694    fi
5696 if test -z "$TARFILE_LOCATION"; then
5697     if test -d "$SRC_ROOT/src" ; then
5698         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
5699         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
5700     fi
5701     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
5702 else
5703     AbsolutePath "$TARFILE_LOCATION"
5704     PathFormat "${absolute_path}"
5705     TARFILE_LOCATION="${formatted_path}"
5707 AC_SUBST(TARFILE_LOCATION)
5709 AC_MSG_CHECKING([whether we want to fetch tarballs])
5710 if test "$enable_fetch_external" != "no"; then
5711     if test "$with_all_tarballs" = "yes"; then
5712         AC_MSG_RESULT([yes, all of them])
5713         DO_FETCH_TARBALLS="ALL"
5714     else
5715         AC_MSG_RESULT([yes, if we use them])
5716         DO_FETCH_TARBALLS="TRUE"
5717     fi
5718 else
5719     AC_MSG_RESULT([no])
5720     DO_FETCH_TARBALLS=
5722 AC_SUBST(DO_FETCH_TARBALLS)
5724 AC_MSG_CHECKING([whether to build help])
5725 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
5726     BUILD_TYPE="$BUILD_TYPE HELP"
5727     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5728     case "$with_help" in
5729     "html")
5730         ENABLE_HTMLHELP=TRUE
5731         SCPDEFS="$SCPDEFS -DWITH_HELP"
5732         AC_MSG_RESULT([HTML])
5733         ;;
5734     "online")
5735         ENABLE_HTMLHELP=TRUE
5736         HELP_ONLINE=TRUE
5737         AC_MSG_RESULT([HTML])
5738         ;;
5739     yes)
5740         SCPDEFS="$SCPDEFS -DWITH_HELP"
5741         AC_MSG_RESULT([yes])
5742         ;;
5743     *)
5744         AC_MSG_ERROR([Unknown --with-help=$with_help])
5745         ;;
5746     esac
5747 else
5748     AC_MSG_RESULT([no])
5750 AC_SUBST([ENABLE_HTMLHELP])
5751 AC_SUBST([HELP_ONLINE])
5753 AC_MSG_CHECKING([whether to enable xapian-omega support for help])
5754 if test -n "$with_omindex" -a "$with_omindex" != "no" -a $_os != iOS -a $_os != Android; then
5755     BUILD_TYPE="$BUILD_TYPE HELP"
5756     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5757     case "$with_omindex" in
5758     "server")
5759         ENABLE_HTMLHELP=TRUE
5760         HELP_ONLINE=TRUE
5761         HELP_OMINDEX_PAGE=TRUE
5762         AC_MSG_RESULT([SERVER])
5763         ;;
5764     "noxap")
5765         ENABLE_HTMLHELP=TRUE
5766         HELP_ONLINE=TRUE
5767         HELP_OMINDEX_PAGE=FALSE
5768         AC_MSG_RESULT([NOXAP])
5769         ;;
5770     *)
5771         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5772         ;;
5773     esac
5774 else
5775     HELP_OMINDEX_PAGE=FALSE
5776     AC_MSG_RESULT([no])
5778 AC_SUBST([ENABLE_HTMLHELP])
5779 AC_SUBST([HELP_OMINDEX_PAGE])
5780 AC_SUBST([HELP_ONLINE])
5783 dnl Test whether to include MySpell dictionaries
5784 dnl ===================================================================
5785 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5786 if test "$with_myspell_dicts" = "yes"; then
5787     AC_MSG_RESULT([yes])
5788     WITH_MYSPELL_DICTS=TRUE
5789     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5790     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5791 else
5792     AC_MSG_RESULT([no])
5793     WITH_MYSPELL_DICTS=
5795 AC_SUBST(WITH_MYSPELL_DICTS)
5797 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5798 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5799     if test "$with_system_dicts" = yes; then
5800         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5801     fi
5802     with_system_dicts=no
5805 AC_MSG_CHECKING([whether to use dicts from external paths])
5806 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5807     AC_MSG_RESULT([yes])
5808     SYSTEM_DICTS=TRUE
5809     AC_MSG_CHECKING([for spelling dictionary directory])
5810     if test -n "$with_external_dict_dir"; then
5811         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5812     else
5813         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5814         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5815             DICT_SYSTEM_DIR=file:///usr/share/myspell
5816         fi
5817     fi
5818     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5819     AC_MSG_CHECKING([for hyphenation patterns directory])
5820     if test -n "$with_external_hyph_dir"; then
5821         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5822     else
5823         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5824     fi
5825     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5826     AC_MSG_CHECKING([for thesaurus directory])
5827     if test -n "$with_external_thes_dir"; then
5828         THES_SYSTEM_DIR=file://$with_external_thes_dir
5829     else
5830         THES_SYSTEM_DIR=file:///usr/share/mythes
5831     fi
5832     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5833 else
5834     AC_MSG_RESULT([no])
5835     SYSTEM_DICTS=
5837 AC_SUBST(SYSTEM_DICTS)
5838 AC_SUBST(DICT_SYSTEM_DIR)
5839 AC_SUBST(HYPH_SYSTEM_DIR)
5840 AC_SUBST(THES_SYSTEM_DIR)
5842 dnl ===================================================================
5843 dnl Precompiled headers.
5844 ENABLE_PCH=""
5845 AC_MSG_CHECKING([whether to enable pch feature])
5846 if test -z "$enable_pch"; then
5847     if test "$_os" = "WINNT"; then
5848         # Enabled by default on Windows.
5849         enable_pch=yes
5850     else
5851         enable_pch=no
5852     fi
5854 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5855     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5857 if test "$enable_pch" = "system"; then
5858     ENABLE_PCH="1"
5859     AC_MSG_RESULT([yes (system headers)])
5860 elif test "$enable_pch" = "base"; then
5861     ENABLE_PCH="2"
5862     AC_MSG_RESULT([yes (system and base headers)])
5863 elif test "$enable_pch" = "normal"; then
5864     ENABLE_PCH="3"
5865     AC_MSG_RESULT([yes (normal)])
5866 elif test "$enable_pch" = "full"; then
5867     ENABLE_PCH="4"
5868     AC_MSG_RESULT([yes (full)])
5869 elif test "$enable_pch" = "yes"; then
5870     # Pick a suitable default.
5871     if test "$GCC" = "yes"; then
5872         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5873         # while making the PCHs larger and rebuilds more likely.
5874         ENABLE_PCH="2"
5875         AC_MSG_RESULT([yes (system and base headers)])
5876     else
5877         # With MSVC the highest level makes a significant difference,
5878         # and it was the default when there used to be no PCH levels.
5879         ENABLE_PCH="4"
5880         AC_MSG_RESULT([yes (full)])
5881     fi
5882 elif test "$enable_pch" = "no"; then
5883     AC_MSG_RESULT([no])
5884 else
5885     AC_MSG_ERROR([Unknown value for --enable-pch])
5887 AC_SUBST(ENABLE_PCH)
5888 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5889 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5890     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5891     if test "$CCACHE_BIN" != "not found"; then
5892         AC_MSG_CHECKING([ccache version])
5893         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5894         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5895         AC_MSG_RESULT([$CCACHE_VERSION])
5896         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5897         if test "$CCACHE_NUMVER" -gt "030701"; then
5898             AC_MSG_RESULT([yes])
5899         else
5900             AC_MSG_RESULT([no (not newer than 3.7.1)])
5901             CCACHE_DEPEND_MODE=
5902         fi
5903     fi
5906 PCH_INSTANTIATE_TEMPLATES=
5907 if test -n "$ENABLE_PCH"; then
5908     AC_MSG_CHECKING([whether $CC supports -fpch-instantiate-templates])
5909     save_CFLAGS=$CFLAGS
5910     CFLAGS="$CFLAGS -Werror -fpch-instantiate-templates"
5911     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_INSTANTIATE_TEMPLATES="-fpch-instantiate-templates" ],[])
5912     CFLAGS=$save_CFLAGS
5913     if test -n "$PCH_INSTANTIATE_TEMPLATES"; then
5914         AC_MSG_RESULT(yes)
5915     else
5916         AC_MSG_RESULT(no)
5917     fi
5919 AC_SUBST(PCH_INSTANTIATE_TEMPLATES)
5921 BUILDING_PCH_WITH_OBJ=
5922 if test -n "$ENABLE_PCH"; then
5923     AC_MSG_CHECKING([whether $CC supports -Xclang -building-pch-with-obj])
5924     save_CFLAGS=$CFLAGS
5925     CFLAGS="$CFLAGS -Werror -Xclang -building-pch-with-obj"
5926     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ BUILDING_PCH_WITH_OBJ="-Xclang -building-pch-with-obj" ],[])
5927     CFLAGS=$save_CFLAGS
5928     if test -n "$BUILDING_PCH_WITH_OBJ"; then
5929         AC_MSG_RESULT(yes)
5930     else
5931         AC_MSG_RESULT(no)
5932     fi
5934 AC_SUBST(BUILDING_PCH_WITH_OBJ)
5936 PCH_CODEGEN=
5937 PCH_NO_CODEGEN=
5938 if test -n "$BUILDING_PCH_WITH_OBJ"; then
5939     AC_MSG_CHECKING([whether $CC supports -fpch-codegen])
5940     save_CFLAGS=$CFLAGS
5941     CFLAGS="$CFLAGS -Werror -fpch-codegen"
5942     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
5943         [
5944         PCH_CODEGEN="-fpch-codegen"
5945         PCH_NO_CODEGEN="-fno-pch-codegen"
5946         ],[])
5947     CFLAGS=$save_CFLAGS
5948     if test -n "$PCH_CODEGEN"; then
5949         AC_MSG_RESULT(yes)
5950     else
5951         AC_MSG_RESULT(no)
5952     fi
5954 AC_SUBST(PCH_CODEGEN)
5955 AC_SUBST(PCH_NO_CODEGEN)
5956 PCH_DEBUGINFO=
5957 if test -n "$BUILDING_PCH_WITH_OBJ"; then
5958     AC_MSG_CHECKING([whether $CC supports -fpch-debuginfo])
5959     save_CFLAGS=$CFLAGS
5960     CFLAGS="$CFLAGS -Werror -fpch-debuginfo"
5961     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_DEBUGINFO="-fpch-debuginfo" ],[])
5962     CFLAGS=$save_CFLAGS
5963     if test -n "$PCH_DEBUGINFO"; then
5964         AC_MSG_RESULT(yes)
5965     else
5966         AC_MSG_RESULT(no)
5967     fi
5969 AC_SUBST(PCH_DEBUGINFO)
5971 TAB=`printf '\t'`
5973 AC_MSG_CHECKING([the GNU Make version])
5974 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5975 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5976 if test "$_make_longver" -ge "038200"; then
5977     AC_MSG_RESULT([$GNUMAKE $_make_version])
5979 elif test "$_make_longver" -ge "038100"; then
5980     if test "$build_os" = "cygwin"; then
5981         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5982     fi
5983     AC_MSG_RESULT([$GNUMAKE $_make_version])
5985     dnl ===================================================================
5986     dnl Search all the common names for sha1sum
5987     dnl ===================================================================
5988     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5989     if test -z "$SHA1SUM"; then
5990         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5991     elif test "$SHA1SUM" = "openssl"; then
5992         SHA1SUM="openssl sha1"
5993     fi
5994     AC_MSG_CHECKING([for GNU Make bug 20033])
5995     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5996     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5997 A := \$(wildcard *.a)
5999 .PHONY: all
6000 all: \$(A:.a=.b)
6001 <TAB>@echo survived bug20033.
6003 .PHONY: setup
6004 setup:
6005 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
6007 define d1
6008 @echo lala \$(1)
6009 @sleep 1
6010 endef
6012 define d2
6013 @echo tyty \$(1)
6014 @sleep 1
6015 endef
6017 %.b : %.a
6018 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
6019 <TAB>\$(call d1,\$(CHECKSUM)),\
6020 <TAB>\$(call d2,\$(CHECKSUM)))
6022     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
6023         no_parallelism_make="YES"
6024         AC_MSG_RESULT([yes, disable parallelism])
6025     else
6026         AC_MSG_RESULT([no, keep parallelism enabled])
6027     fi
6028     rm -rf $TESTGMAKEBUG20033
6029 else
6030     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
6033 # find if gnumake support file function
6034 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
6035 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
6036 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6037     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
6039 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
6040 \$(file >test.txt,Success )
6042 .PHONY: all
6043 all:
6044 <TAB>@cat test.txt
6047 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
6048 if test -f $TESTGMAKEFILEFUNC/test.txt; then
6049     HAVE_GNUMAKE_FILE_FUNC=TRUE
6050     AC_MSG_RESULT([yes])
6051 else
6052     AC_MSG_RESULT([no])
6054 rm -rf $TESTGMAKEFILEFUNC
6055 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
6057 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
6058 STALE_MAKE=
6059 if test "$_make_ver_check" = ""; then
6060    STALE_MAKE=TRUE
6063 HAVE_LD_HASH_STYLE=FALSE
6064 WITH_LINKER_HASH_STYLE=
6065 AC_MSG_CHECKING([for --hash-style gcc linker support])
6066 if test "$GCC" = "yes"; then
6067     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
6068         hash_styles="gnu sysv"
6069     elif test "$with_linker_hash_style" = "no"; then
6070         hash_styles=
6071     else
6072         hash_styles="$with_linker_hash_style"
6073     fi
6075     for hash_style in $hash_styles; do
6076         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
6077         hash_style_ldflags_save=$LDFLAGS
6078         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
6080         AC_RUN_IFELSE([AC_LANG_PROGRAM(
6081             [
6082 #include <stdio.h>
6083             ],[
6084 printf ("");
6085             ])],
6086             [
6087                   HAVE_LD_HASH_STYLE=TRUE
6088                   WITH_LINKER_HASH_STYLE=$hash_style
6089             ],
6090             [HAVE_LD_HASH_STYLE=FALSE],
6091             [HAVE_LD_HASH_STYLE=FALSE])
6092         LDFLAGS=$hash_style_ldflags_save
6093     done
6095     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
6096         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
6097     else
6098         AC_MSG_RESULT( no )
6099     fi
6100     LDFLAGS=$hash_style_ldflags_save
6101 else
6102     AC_MSG_RESULT( no )
6104 AC_SUBST(HAVE_LD_HASH_STYLE)
6105 AC_SUBST(WITH_LINKER_HASH_STYLE)
6107 dnl ===================================================================
6108 dnl Check whether there's a Perl version available.
6109 dnl ===================================================================
6110 if test -z "$with_perl_home"; then
6111     AC_PATH_PROG(PERL, perl)
6112 else
6113     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
6114     _perl_path="$with_perl_home/bin/perl"
6115     if test -x "$_perl_path"; then
6116         PERL=$_perl_path
6117     else
6118         AC_MSG_ERROR([$_perl_path not found])
6119     fi
6122 dnl ===================================================================
6123 dnl Testing for Perl version 5 or greater.
6124 dnl $] is the Perl version variable, it is returned as an integer
6125 dnl ===================================================================
6126 if test "$PERL"; then
6127     AC_MSG_CHECKING([the Perl version])
6128     ${PERL} -e "exit($]);"
6129     _perl_version=$?
6130     if test "$_perl_version" -lt 5; then
6131         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
6132     fi
6133     AC_MSG_RESULT([Perl $_perl_version])
6134 else
6135     AC_MSG_ERROR([Perl not found, install Perl 5])
6138 dnl ===================================================================
6139 dnl Testing for required Perl modules
6140 dnl ===================================================================
6142 AC_MSG_CHECKING([for required Perl modules])
6143 perl_use_string="use Cwd ; use Digest::MD5"
6144 if test "$_os" = "WINNT"; then
6145     if test -n "$PKGFORMAT"; then
6146         for i in $PKGFORMAT; do
6147             case "$i" in
6148             msi)
6149                 # for getting fonts versions to use in MSI
6150                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
6151                 ;;
6152             esac
6153         done
6154     fi
6156 if test "$with_system_hsqldb" = "yes"; then
6157     perl_use_string="$perl_use_string ; use Archive::Zip"
6159 if test "$enable_openssl" = "yes" -a "$with_system_openssl" != "yes"; then
6160     # OpenSSL needs that to build
6161     perl_use_string="$perl_use_string ; use FindBin"
6163 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
6164     AC_MSG_RESULT([all modules found])
6165 else
6166     AC_MSG_RESULT([failed to find some modules])
6167     # Find out which modules are missing.
6168     for i in $perl_use_string; do
6169         if test "$i" != "use" -a "$i" != ";"; then
6170             if ! $PERL -e "use $i;">/dev/null 2>&1; then
6171                 missing_perl_modules="$missing_perl_modules $i"
6172             fi
6173         fi
6174     done
6175     AC_MSG_ERROR([
6176     The missing Perl modules are: $missing_perl_modules
6177     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
6180 dnl ===================================================================
6181 dnl Check for pkg-config
6182 dnl ===================================================================
6183 if test "$_os" != "WINNT"; then
6184     PKG_PROG_PKG_CONFIG
6187 if test "$_os" != "WINNT"; then
6189     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
6190     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
6191     # explicitly. Or put /path/to/compiler in PATH yourself.
6193     # Use wrappers for LTO
6194     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
6195         AC_CHECK_TOOL(AR,gcc-ar)
6196         AC_CHECK_TOOL(NM,gcc-nm)
6197         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
6198     else
6199         AC_CHECK_TOOL(AR,ar)
6200         AC_CHECK_TOOL(NM,nm)
6201         AC_CHECK_TOOL(RANLIB,ranlib)
6202     fi
6203     AC_CHECK_TOOL(OBJDUMP,objdump)
6204     AC_CHECK_TOOL(READELF,readelf)
6205     AC_CHECK_TOOL(STRIP,strip)
6206     if test "$_os" = "WINNT"; then
6207         AC_CHECK_TOOL(DLLTOOL,dlltool)
6208         AC_CHECK_TOOL(WINDRES,windres)
6209     fi
6211 AC_SUBST(AR)
6212 AC_SUBST(DLLTOOL)
6213 AC_SUBST(LD)
6214 AC_SUBST(NM)
6215 AC_SUBST(OBJDUMP)
6216 AC_SUBST(PKG_CONFIG)
6217 AC_SUBST(PKG_CONFIG_PATH)
6218 AC_SUBST(PKG_CONFIG_LIBDIR)
6219 AC_SUBST(RANLIB)
6220 AC_SUBST(READELF)
6221 AC_SUBST(STRIP)
6222 AC_SUBST(WINDRES)
6224 dnl ===================================================================
6225 dnl pkg-config checks on macOS
6226 dnl ===================================================================
6228 if test $_os = Darwin; then
6229     AC_MSG_CHECKING([for bogus pkg-config])
6230     if test -n "$PKG_CONFIG"; then
6231         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
6232             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
6233         else
6234             if test "$enable_bogus_pkg_config" = "yes"; then
6235                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
6236             else
6237                 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.])
6238             fi
6239         fi
6240     else
6241         AC_MSG_RESULT([no, good])
6242     fi
6245 find_csc()
6247     # Return value: $csctest
6249     unset csctest
6251     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
6252     if test -n "$regvalue"; then
6253         csctest=$regvalue
6254         return
6255     fi
6258 find_al()
6260     # Return value: $altest
6262     unset altest
6264     # We need this check to detect 4.6.1 or above.
6265     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
6266         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
6267         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
6268             altest=$regvalue
6269             return
6270         fi
6271     done
6273     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
6274         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
6275         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
6276             altest=$regvalue
6277             return
6278         fi
6279     done
6282 find_dotnetsdk46()
6284     unset frametest
6286     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
6287         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
6288         if test -n "$regvalue"; then
6289             frametest=$regvalue
6290             return
6291         fi
6292     done
6295 find_winsdk_version()
6297     # Args: $1 : SDK version as in "8.0", "8.1A" etc
6298     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
6300     unset winsdktest winsdkbinsubdir winsdklibsubdir
6302     case "$1" in
6303     8.0|8.0A)
6304         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
6305         if test -n "$regvalue"; then
6306             winsdktest=$regvalue
6307             winsdklibsubdir=win8
6308             return
6309         fi
6310         ;;
6311     8.1|8.1A)
6312         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
6313         if test -n "$regvalue"; then
6314             winsdktest=$regvalue
6315             winsdklibsubdir=winv6.3
6316             return
6317         fi
6318         ;;
6319     10.0)
6320         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
6321         if test -n "$regvalue"; then
6322             winsdktest=$regvalue
6323             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
6324             if test -n "$regvalue"; then
6325                 winsdkbinsubdir="$regvalue".0
6326                 winsdklibsubdir=$winsdkbinsubdir
6327                 local tmppath="$winsdktest\\Include\\$winsdklibsubdir"
6328                 local tmppath_unix=$(cygpath -u "$tmppath")
6329                 # test exist the SDK path
6330                 if test -d "$tmppath_unix"; then
6331                    # when path is convertible to a short path then path is okay
6332                    cygpath -d "$tmppath" >/dev/null 2>&1
6333                    if test $? -ne 0; then
6334                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
6335                    fi
6336                 else
6337                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
6338                 fi
6339             fi
6340             return
6341         fi
6342         ;;
6343     esac
6346 find_winsdk()
6348     # Return value: From find_winsdk_version
6350     unset winsdktest
6352     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
6353         find_winsdk_version $ver
6354         if test -n "$winsdktest"; then
6355             return
6356         fi
6357     done
6360 find_msms()
6362     # Return value: $msmdir
6364     AC_MSG_CHECKING([for MSVC merge modules directory])
6365     local my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
6366     local my_msm_dir
6368     case "$VCVER" in
6369         160)
6370         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
6371         ;;
6372     esac
6373     for f in $my_msm_files; do
6374         echo "$as_me:$LINENO: searching for $f" >&5
6375     done
6377     msmdir=
6378     for ver in 14.0 15.0; do
6379         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
6380         if test -n "$regvalue"; then
6381             for f in ${my_msm_files}; do
6382                 if test -e "$regvalue/${f}"; then
6383                     msmdir=$regvalue
6384                     break
6385                 fi
6386             done
6387         fi
6388     done
6389     dnl Is the following fallback really necessary, or was it added in response
6390     dnl to never having started Visual Studio on a given machine, so the
6391     dnl registry keys checked above had presumably not yet been created?
6392     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
6393     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
6394     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
6395     dnl expanding to "C:\Program Files\Common Files"), which would need
6396     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
6397     dnl obtain its value from cygwin:
6398     if test -z "$msmdir"; then
6399         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
6400         for f in ${my_msm_files}; do
6401             if test -e "$my_msm_dir/${f}"; then
6402                 msmdir=$my_msm_dir
6403             fi
6404         done
6405     fi
6407     dnl Starting from MSVC 15.0, merge modules are located in different directory
6408     case "$VCVER" in
6409     160)
6410         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6411             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
6412             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
6413             for f in ${my_msm_files}; do
6414                 if test -e "$my_msm_dir/${f}"; then
6415                     msmdir=$my_msm_dir
6416                     break
6417                 fi
6418             done
6419         done
6420         ;;
6421     esac
6423     if test -n "$msmdir"; then
6424         msmdir=`cygpath -m "$msmdir"`
6425         AC_MSG_RESULT([$msmdir])
6426     else
6427         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
6428             AC_MSG_FAILURE([not found])
6429         else
6430             AC_MSG_WARN([not found (check config.log)])
6431             add_warning "MSM none of ${my_msm_files} found"
6432         fi
6433     fi
6436 find_msvc_x64_dlls()
6438     # Return value: $msvcdllpath, $msvcdlls
6440     AC_MSG_CHECKING([for MSVC x64 DLL path])
6441     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
6442     case "$VCVER" in
6443     160)
6444         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6445             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
6446             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
6447                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
6448                 break
6449             fi
6450             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
6451             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
6452                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
6453                 break
6454             fi
6455         done
6456         ;;
6457     esac
6458     AC_MSG_RESULT([$msvcdllpath])
6459     AC_MSG_CHECKING([for MSVC x64 DLLs])
6460     msvcdlls="msvcp140.dll vcruntime140.dll"
6461     for dll in $msvcdlls; do
6462         if ! test -f "$msvcdllpath/$dll"; then
6463             AC_MSG_FAILURE([missing $dll])
6464         fi
6465     done
6466     AC_MSG_RESULT([found all ($msvcdlls)])
6469 dnl =========================================
6470 dnl Check for the Windows  SDK.
6471 dnl =========================================
6472 if test "$_os" = "WINNT"; then
6473     AC_MSG_CHECKING([for Windows SDK])
6474     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6475         find_winsdk
6476         WINDOWS_SDK_HOME=$winsdktest
6478         # normalize if found
6479         if test -n "$WINDOWS_SDK_HOME"; then
6480             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
6481             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
6482         fi
6484         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
6485     fi
6487     if test -n "$WINDOWS_SDK_HOME"; then
6488         # Remove a possible trailing backslash
6489         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
6491         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
6492              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
6493              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
6494             have_windows_sdk_headers=yes
6495         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
6496              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
6497              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
6498             have_windows_sdk_headers=yes
6499         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
6500              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
6501              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
6502             have_windows_sdk_headers=yes
6503         else
6504             have_windows_sdk_headers=no
6505         fi
6507         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
6508             have_windows_sdk_libs=yes
6509         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/user32.lib"; then
6510             have_windows_sdk_libs=yes
6511         else
6512             have_windows_sdk_libs=no
6513         fi
6515         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
6516             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
6517 the  Windows SDK are installed.])
6518         fi
6519     fi
6521     if test -z "$WINDOWS_SDK_HOME"; then
6522         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
6523     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
6524         WINDOWS_SDK_VERSION=80
6525         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
6526     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
6527         WINDOWS_SDK_VERSION=81
6528         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
6529     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
6530         WINDOWS_SDK_VERSION=10
6531         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
6532     else
6533         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
6534     fi
6535     PathFormat "$WINDOWS_SDK_HOME"
6536     WINDOWS_SDK_HOME="$formatted_path"
6537     WINDOWS_SDK_HOME_unix="$formatted_path_unix"
6538     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6539         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
6540         if test -d "$WINDOWS_SDK_HOME/include/um"; then
6541             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
6542         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
6543             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
6544         fi
6545     fi
6547     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
6548     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
6549     dnl but not in v8.0), so allow this to be overridden with a
6550     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
6551     dnl and configuration error if no WiLangId.vbs is found would arguably be
6552     dnl better, but I do not know under which conditions exactly it is needed by
6553     dnl msiglobal.pm:
6554     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
6555         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
6556         WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6557         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6558             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WIN_BUILD_ARCH}/WiLangId.vbs"
6559             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6560         fi
6561         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6562             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WIN_BUILD_ARCH/WiLangId.vbs
6563             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6564         fi
6565         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6566             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WIN_BUILD_ARCH/WiLangId.vbs")
6567             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6568         fi
6569     fi
6570     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
6571         if test -n "$with_package_format" -a "$with_package_format" != no; then
6572             for i in "$with_package_format"; do
6573                 if test "$i" = "msi"; then
6574                     if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6575                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
6576                     fi
6577                 fi
6578             done
6579         fi
6580     fi
6582 AC_SUBST(WINDOWS_SDK_HOME)
6583 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
6584 AC_SUBST(WINDOWS_SDK_VERSION)
6585 AC_SUBST(WINDOWS_SDK_WILANGID)
6587 if test "$build_os" = "cygwin"; then
6588     dnl Check midl.exe; this being the first check for a tool in the SDK bin
6589     dnl dir, it also determines that dir's path w/o an arch segment if any,
6590     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
6591     AC_MSG_CHECKING([for midl.exe])
6593     find_winsdk
6594     if test -n "$winsdkbinsubdir" \
6595         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/midl.exe"
6596     then
6597         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH
6598         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
6599     elif test -f "$winsdktest/Bin/$WIN_BUILD_ARCH/midl.exe"; then
6600         MIDL_PATH=$winsdktest/Bin/$WIN_BUILD_ARCH
6601         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
6602     elif test -f "$winsdktest/Bin/midl.exe"; then
6603         MIDL_PATH=$winsdktest/Bin
6604         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
6605     fi
6606     if test ! -f "$MIDL_PATH/midl.exe"; then
6607         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WIN_BUILD_ARCH, Windows SDK installation broken?])
6608     else
6609         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
6610     fi
6612     # Convert to posix path with 8.3 filename restrictions ( No spaces )
6613     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
6615     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
6616          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
6617          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
6618          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
6619     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
6620          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
6621          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6622          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
6623     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
6624          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
6625          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6626          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
6627     else
6628         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
6629     fi
6631     dnl Check csc.exe
6632     AC_MSG_CHECKING([for csc.exe])
6633     find_csc
6634     if test -f "$csctest/csc.exe"; then
6635         CSC_PATH="$csctest"
6636     fi
6637     if test ! -f "$CSC_PATH/csc.exe"; then
6638         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
6639     else
6640         AC_MSG_RESULT([$CSC_PATH/csc.exe])
6641     fi
6643     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
6645     dnl Check al.exe
6646     AC_MSG_CHECKING([for al.exe])
6647     find_winsdk
6648     if test -n "$winsdkbinsubdir" \
6649         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/al.exe"
6650     then
6651         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH"
6652     elif test -f "$winsdktest/Bin/$WIN_BUILD_ARCH/al.exe"; then
6653         AL_PATH="$winsdktest/Bin/$WIN_BUILD_ARCH"
6654     elif test -f "$winsdktest/Bin/al.exe"; then
6655         AL_PATH="$winsdktest/Bin"
6656     fi
6658     if test -z "$AL_PATH"; then
6659         find_al
6660         if test -f "$altest/bin/al.exe"; then
6661             AL_PATH="$altest/bin"
6662         elif test -f "$altest/al.exe"; then
6663             AL_PATH="$altest"
6664         fi
6665     fi
6666     if test ! -f "$AL_PATH/al.exe"; then
6667         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
6668     else
6669         AC_MSG_RESULT([$AL_PATH/al.exe])
6670     fi
6672     AL_PATH=`win_short_path_for_make "$AL_PATH"`
6674     dnl Check mscoree.lib / .NET Framework dir
6675     AC_MSG_CHECKING(.NET Framework)
6676     find_dotnetsdk46
6677     PathFormat "$frametest"
6678     frametest="$formatted_path"
6679     if test -f "$frametest/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6680         DOTNET_FRAMEWORK_HOME="$frametest"
6681     else
6682         find_winsdk
6683         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6684             DOTNET_FRAMEWORK_HOME="$winsdktest"
6685         fi
6686     fi
6687     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
6688         AC_MSG_ERROR([mscoree.lib not found])
6689     fi
6690     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
6692     PathFormat "$MIDL_PATH"
6693     MIDL_PATH="$formatted_path"
6695     PathFormat "$AL_PATH"
6696     AL_PATH="$formatted_path"
6698     PathFormat "$DOTNET_FRAMEWORK_HOME"
6699     DOTNET_FRAMEWORK_HOME="$formatted_path"
6701     PathFormat "$CSC_PATH"
6702     CSC_PATH="$formatted_path"
6705 dnl ===================================================================
6706 dnl Testing for C++ compiler and version...
6707 dnl ===================================================================
6709 if test "$_os" != "WINNT"; then
6710     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
6711     save_CXXFLAGS=$CXXFLAGS
6712     AC_PROG_CXX
6713     CXXFLAGS=$save_CXXFLAGS
6714     if test -z "$CXX_BASE"; then
6715         CXX_BASE=`first_arg_basename "$CXX"`
6716     fi
6719 dnl check for GNU C++ compiler version
6720 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
6721     AC_MSG_CHECKING([the GNU C++ compiler version])
6723     _gpp_version=`$CXX -dumpversion`
6724     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
6726     if test "$_gpp_majmin" -lt "700"; then
6727         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
6728     else
6729         AC_MSG_RESULT([ok (g++ $_gpp_version)])
6730     fi
6732     dnl see https://code.google.com/p/android/issues/detail?id=41770
6733         glibcxx_threads=no
6734         AC_LANG_PUSH([C++])
6735         AC_REQUIRE_CPP
6736         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
6737         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
6738             #include <bits/c++config.h>]],[[
6739             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
6740             && !defined(_GLIBCXX__PTHREADS) \
6741             && !defined(_GLIBCXX_HAS_GTHREADS)
6742             choke me
6743             #endif
6744         ]])],[AC_MSG_RESULT([yes])
6745         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
6746         AC_LANG_POP([C++])
6747         if test $glibcxx_threads = yes; then
6748             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
6749         fi
6751 AC_SUBST(BOOST_CXXFLAGS)
6754 # prefx CXX with ccache if needed
6756 UNCACHED_CXX="$CXX"
6757 if test "$CCACHE" != ""; then
6758     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
6759     AC_LANG_PUSH([C++])
6760     save_CXXFLAGS=$CXXFLAGS
6761     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
6762     dnl an empty program will do, we're checking the compiler flags
6763     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
6764                       [use_ccache=yes], [use_ccache=no])
6765     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
6766         AC_MSG_RESULT([yes])
6767     else
6768         CXX="$CCACHE $CXX"
6769         CXX_BASE="ccache $CXX_BASE"
6770         AC_MSG_RESULT([no])
6771     fi
6772     CXXFLAGS=$save_CXXFLAGS
6773     AC_LANG_POP([C++])
6776 dnl ===================================================================
6777 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
6778 dnl ===================================================================
6780 if test "$_os" != "WINNT"; then
6781     AC_PROG_CXXCPP
6783     dnl Check whether there's a C pre-processor.
6784     AC_PROG_CPP
6788 dnl ===================================================================
6789 dnl Find integral type sizes and alignments
6790 dnl ===================================================================
6792 if test "$_os" != "WINNT"; then
6794     AC_CHECK_SIZEOF(long)
6795     AC_CHECK_SIZEOF(short)
6796     AC_CHECK_SIZEOF(int)
6797     AC_CHECK_SIZEOF(long long)
6798     AC_CHECK_SIZEOF(double)
6799     AC_CHECK_SIZEOF(void*)
6801     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
6802     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
6803     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
6804     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
6805     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6807     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6808     m4_pattern_allow([AC_CHECK_ALIGNOF])
6809     m4_ifdef([AC_CHECK_ALIGNOF],
6810         [
6811             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6812             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6813             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6814             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6815         ],
6816         [
6817             case "$_os-$host_cpu" in
6818             Linux-i686)
6819                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6820                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6821                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6822                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6823                 ;;
6824             Linux-x86_64)
6825                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6826                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6827                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6828                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6829                 ;;
6830             *)
6831                 if test -z "$ac_cv_alignof_short" -o \
6832                         -z "$ac_cv_alignof_int" -o \
6833                         -z "$ac_cv_alignof_long" -o \
6834                         -z "$ac_cv_alignof_double"; then
6835                    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.])
6836                 fi
6837                 ;;
6838             esac
6839         ])
6841     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6842     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6843     if test $ac_cv_sizeof_long -eq 8; then
6844         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6845     elif test $ac_cv_sizeof_double -eq 8; then
6846         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6847     else
6848         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6849     fi
6851     dnl Check for large file support
6852     AC_SYS_LARGEFILE
6853     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6854         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6855     fi
6856     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6857         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6858     fi
6859 else
6860     # Hardcode for MSVC
6861     SAL_TYPES_SIZEOFSHORT=2
6862     SAL_TYPES_SIZEOFINT=4
6863     SAL_TYPES_SIZEOFLONG=4
6864     SAL_TYPES_SIZEOFLONGLONG=8
6865     if test $WIN_HOST_BITS -eq 32; then
6866         SAL_TYPES_SIZEOFPOINTER=4
6867     else
6868         SAL_TYPES_SIZEOFPOINTER=8
6869     fi
6870     SAL_TYPES_ALIGNMENT2=2
6871     SAL_TYPES_ALIGNMENT4=4
6872     SAL_TYPES_ALIGNMENT8=8
6873     LFS_CFLAGS=''
6875 AC_SUBST(LFS_CFLAGS)
6877 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6878 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6879 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6880 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6881 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6882 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6883 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6884 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6886 dnl ===================================================================
6887 dnl Check whether to enable runtime optimizations
6888 dnl ===================================================================
6889 ENABLE_RUNTIME_OPTIMIZATIONS=
6890 AC_MSG_CHECKING([whether to enable runtime optimizations])
6891 if test -z "$enable_runtime_optimizations"; then
6892     for i in $CC; do
6893         case $i in
6894         -fsanitize=*)
6895             enable_runtime_optimizations=no
6896             break
6897             ;;
6898         esac
6899     done
6901 if test "$enable_runtime_optimizations" != no; then
6902     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6903     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6904     AC_MSG_RESULT([yes])
6905 else
6906     AC_MSG_RESULT([no])
6908 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6910 dnl ===================================================================
6911 dnl Check if valgrind headers are available
6912 dnl ===================================================================
6913 ENABLE_VALGRIND=
6914 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6915     prev_cppflags=$CPPFLAGS
6916     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6917     # or where does it come from?
6918     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6919     AC_CHECK_HEADER([valgrind/valgrind.h],
6920         [ENABLE_VALGRIND=TRUE])
6921     CPPFLAGS=$prev_cppflags
6923 AC_SUBST([ENABLE_VALGRIND])
6924 if test -z "$ENABLE_VALGRIND"; then
6925     if test "$with_valgrind" = yes; then
6926         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6927     fi
6928     VALGRIND_CFLAGS=
6930 AC_SUBST([VALGRIND_CFLAGS])
6933 dnl ===================================================================
6934 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6935 dnl ===================================================================
6937 # We need at least the sys/sdt.h include header.
6938 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6939 if test "$SDT_H_FOUND" = "TRUE"; then
6940     # Found sys/sdt.h header, now make sure the c++ compiler works.
6941     # Old g++ versions had problems with probes in constructors/destructors.
6942     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6943     AC_LANG_PUSH([C++])
6944     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6945     #include <sys/sdt.h>
6946     class ProbeClass
6947     {
6948     private:
6949       int& ref;
6950       const char *name;
6952     public:
6953       ProbeClass(int& v, const char *n) : ref(v), name(n)
6954       {
6955         DTRACE_PROBE2(_test_, cons, name, ref);
6956       }
6958       void method(int min)
6959       {
6960         DTRACE_PROBE3(_test_, meth, name, ref, min);
6961         ref -= min;
6962       }
6964       ~ProbeClass()
6965       {
6966         DTRACE_PROBE2(_test_, dest, name, ref);
6967       }
6968     };
6969     ]],[[
6970     int i = 64;
6971     DTRACE_PROBE1(_test_, call, i);
6972     ProbeClass inst = ProbeClass(i, "call");
6973     inst.method(24);
6974     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6975           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6976     AC_LANG_POP([C++])
6978 AC_CONFIG_HEADERS([config_host/config_probes.h])
6980 dnl ===================================================================
6981 dnl GCC features
6982 dnl ===================================================================
6983 HAVE_GCC_STACK_CLASH_PROTECTION=
6984 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6985     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
6986     save_CFLAGS=$CFLAGS
6987     CFLAGS="$CFLAGS -Werror -fstack-clash-protection"
6988     AC_LINK_IFELSE(
6989         [AC_LANG_PROGRAM(, [[return 0;]])],
6990         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
6991         [AC_MSG_RESULT([no])])
6992     CFLAGS=$save_CFLAGS
6994     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6995     save_CFLAGS=$CFLAGS
6996     CFLAGS="$CFLAGS -Werror -mno-avx"
6997     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6998     CFLAGS=$save_CFLAGS
6999     if test "$HAVE_GCC_AVX" = "TRUE"; then
7000         AC_MSG_RESULT([yes])
7001     else
7002         AC_MSG_RESULT([no])
7003     fi
7005     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
7006     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
7007     int v = 0;
7008     if (__sync_add_and_fetch(&v, 1) != 1 ||
7009         __sync_sub_and_fetch(&v, 1) != 0)
7010         return 1;
7011     __sync_synchronize();
7012     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
7013         v != 1)
7014         return 1;
7015     return 0;
7016 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
7017     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
7018         AC_MSG_RESULT([yes])
7019         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
7020     else
7021         AC_MSG_RESULT([no])
7022     fi
7024     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
7025     AC_LANG_PUSH([C++])
7026     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7027             #include <cstddef>
7028             #include <cxxabi.h>
7029             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
7030         ])], [
7031             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
7032             AC_MSG_RESULT([yes])
7033         ], [AC_MSG_RESULT([no])])
7034     AC_LANG_POP([C++])
7036     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
7037     AC_LANG_PUSH([C++])
7038     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7039             #include <cstddef>
7040             #include <cxxabi.h>
7041             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
7042         ])], [
7043             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
7044             AC_MSG_RESULT([yes])
7045         ], [AC_MSG_RESULT([no])])
7046     AC_LANG_POP([C++])
7048     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
7049     AC_LANG_PUSH([C++])
7050     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7051             #include <cxxabi.h>
7052             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
7053         ])], [
7054             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
7055             AC_MSG_RESULT([yes])
7056         ], [AC_MSG_RESULT([no])])
7057     AC_LANG_POP([C++])
7059     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
7060     AC_LANG_PUSH([C++])
7061     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7062             #include <cstddef>
7063             #include <cxxabi.h>
7064             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
7065         ])], [
7066             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
7067             AC_MSG_RESULT([yes])
7068         ], [AC_MSG_RESULT([no])])
7069     AC_LANG_POP([C++])
7071     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exception in cxxabi.h])
7072     AC_LANG_PUSH([C++])
7073     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7074             #include <cstddef>
7075             #include <cxxabi.h>
7076             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exception); }
7077         ])], [
7078             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTION],[1])
7079             AC_MSG_RESULT([yes])
7080         ], [AC_MSG_RESULT([no])])
7081     AC_LANG_POP([C++])
7083     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
7084     AC_LANG_PUSH([C++])
7085     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7086             #include <cxxabi.h>
7087             void * f() { return __cxxabiv1::__cxa_get_globals(); }
7088         ])], [
7089             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
7090             AC_MSG_RESULT([yes])
7091         ], [AC_MSG_RESULT([no])])
7092     AC_LANG_POP([C++])
7094     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
7095     AC_LANG_PUSH([C++])
7096     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7097             #include <cxxabi.h>
7098             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
7099         ])], [
7100             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
7101             AC_MSG_RESULT([yes])
7102         ], [AC_MSG_RESULT([no])])
7103     AC_LANG_POP([C++])
7105     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
7106     AC_LANG_PUSH([C++])
7107     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7108             #include <cxxabi.h>
7109             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
7110         ])], [
7111             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
7112             AC_MSG_RESULT([yes])
7113         ], [AC_MSG_RESULT([no])])
7114     AC_LANG_POP([C++])
7116     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
7117     AC_LANG_PUSH([C++])
7118     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7119             #include <cstddef>
7120             #include <cxxabi.h>
7121             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
7122         ])], [
7123             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
7124             AC_MSG_RESULT([yes])
7125         ], [AC_MSG_RESULT([no])])
7126     AC_LANG_POP([C++])
7128     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
7129     AC_LANG_PUSH([C++])
7130     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7131             #include <cstddef>
7132             #include <cxxabi.h>
7133             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
7134         ])], [
7135             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
7136             AC_MSG_RESULT([yes])
7137         ], [AC_MSG_RESULT([no])])
7138     AC_LANG_POP([C++])
7141 AC_SUBST(HAVE_GCC_AVX)
7142 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
7143 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
7145 dnl ===================================================================
7146 dnl Identify the C++ library
7147 dnl ===================================================================
7149 AC_MSG_CHECKING([what the C++ library is])
7150 AC_LANG_PUSH([C++])
7151 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7152 #include <utility>
7153 #ifndef __GLIBCXX__
7154 foo bar
7155 #endif
7156 ]])],
7157     [CPP_LIBRARY=GLIBCXX
7158      cpp_library_name="GNU libstdc++"
7159     ],
7160     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7161 #include <utility>
7162 #ifndef _LIBCPP_VERSION
7163 foo bar
7164 #endif
7165 ]])],
7166     [CPP_LIBRARY=LIBCPP
7167      cpp_library_name="LLVM libc++"
7168      AC_DEFINE([HAVE_LIBCXX])
7169     ],
7170     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7171 #include <utility>
7172 #ifndef _MSC_VER
7173 foo bar
7174 #endif
7175 ]])],
7176     [CPP_LIBRARY=MSVCRT
7177      cpp_library_name="Microsoft"
7178     ],
7179     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
7180 AC_MSG_RESULT([$cpp_library_name])
7181 AC_LANG_POP([C++])
7183 dnl ===================================================================
7184 dnl Check for gperf
7185 dnl ===================================================================
7186 AC_PATH_PROG(GPERF, gperf)
7187 if test -z "$GPERF"; then
7188     AC_MSG_ERROR([gperf not found but needed. Install it.])
7190 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7191     GPERF=`cygpath -m $GPERF`
7193 AC_MSG_CHECKING([whether gperf is new enough])
7194 my_gperf_ver1=$($GPERF --version | head -n 1)
7195 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
7196 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
7197 if test "$my_gperf_ver3" -ge 301; then
7198     AC_MSG_RESULT([yes ($my_gperf_ver2)])
7199 else
7200     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
7202 AC_SUBST(GPERF)
7204 dnl ===================================================================
7205 dnl Check for system libcmis
7206 dnl ===================================================================
7207 # libcmis requires curl and we can't build curl for iOS
7208 if test "$test_cmis" = "yes" -a "$enable_cmis" = "yes"; then
7209     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
7210     ENABLE_LIBCMIS=TRUE
7211 else
7212     ENABLE_LIBCMIS=
7214 AC_SUBST(ENABLE_LIBCMIS)
7216 dnl ===================================================================
7217 dnl C++11
7218 dnl ===================================================================
7220 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
7221 CXXFLAGS_CXX11=
7222 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
7223     if test "$with_latest_c__" = yes; then
7224         CXXFLAGS_CXX11=-std:c++latest
7225     else
7226         CXXFLAGS_CXX11=-std:c++17
7227     fi
7228     CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -permissive- -Zc:__cplusplus"
7229 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7230     my_flags='-std=c++17 -std=c++1z'
7231     if test "$with_latest_c__" = yes; then
7232         my_flags="-std=c++23 -std=c++2b -std=c++20 -std=c++2a $my_flags"
7233     fi
7234     for flag in $my_flags; do
7235         if test "$COM" = MSC; then
7236             flag="-Xclang $flag"
7237         fi
7238         save_CXXFLAGS=$CXXFLAGS
7239         CXXFLAGS="$CXXFLAGS $flag -Werror"
7240         if test "$SYSTEM_LIBCMIS" = TRUE; then
7241             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
7242         fi
7243         AC_LANG_PUSH([C++])
7244         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7245             #include <algorithm>
7246             #include <functional>
7247             #include <vector>
7249             #if defined SYSTEM_LIBCMIS
7250             // See ucb/source/ucp/cmis/auth_provider.hxx:
7251             #if !defined __clang__
7252             #pragma GCC diagnostic push
7253             #pragma GCC diagnostic ignored "-Wdeprecated"
7254             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
7255             #endif
7256             #include <libcmis/libcmis.hxx>
7257             #if !defined __clang__
7258             #pragma GCC diagnostic pop
7259             #endif
7260             #endif
7262             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
7263                 std::sort(v.begin(), v.end(), fn);
7264             }
7265             ]])],[CXXFLAGS_CXX11=$flag])
7266         AC_LANG_POP([C++])
7267         CXXFLAGS=$save_CXXFLAGS
7268         if test -n "$CXXFLAGS_CXX11"; then
7269             break
7270         fi
7271     done
7273 if test -n "$CXXFLAGS_CXX11"; then
7274     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
7275 else
7276     AC_MSG_ERROR(no)
7278 AC_SUBST(CXXFLAGS_CXX11)
7280 if test "$GCC" = "yes"; then
7281     save_CXXFLAGS=$CXXFLAGS
7282     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7283     CHECK_L_ATOMIC
7284     CXXFLAGS=$save_CXXFLAGS
7285     AC_SUBST(ATOMIC_LIB)
7288 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
7289 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
7290 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
7291 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
7292 dnl again towards 4.7.2:
7293 if test $CPP_LIBRARY = GLIBCXX; then
7294     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
7295     AC_LANG_PUSH([C++])
7296     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7297 #include <list>
7298 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
7299     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
7300     //   GCC 4.7.0: 20120322
7301     //   GCC 4.7.1: 20120614
7302     // and using a range check is not possible as the mapping between
7303     // __GLIBCXX__ values and GCC versions is not monotonic
7304 /* ok */
7305 #else
7306 abi broken
7307 #endif
7308         ]])], [AC_MSG_RESULT(no, ok)],
7309         [AC_MSG_ERROR(yes)])
7310     AC_LANG_POP([C++])
7313 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
7314 save_CXXFLAGS=$CXXFLAGS
7315 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7316 AC_LANG_PUSH([C++])
7318 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7319 #include <stddef.h>
7321 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
7323 namespace
7325         struct b
7326         {
7327                 int i;
7328                 int j;
7329         };
7331 ]], [[
7332 struct a
7334         int i;
7335         int j;
7337 a thinga[]={{0,0}, {1,1}};
7338 b thingb[]={{0,0}, {1,1}};
7339 size_t i = sizeof(sal_n_array_size(thinga));
7340 size_t j = sizeof(sal_n_array_size(thingb));
7341 return !(i != 0 && j != 0);
7343     ], [ AC_MSG_RESULT(yes) ],
7344     [ AC_MSG_ERROR(no)])
7345 AC_LANG_POP([C++])
7346 CXXFLAGS=$save_CXXFLAGS
7348 HAVE_GCC_FNO_SIZED_DEALLOCATION=
7349 if test "$GCC" = yes; then
7350     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
7351     AC_LANG_PUSH([C++])
7352     save_CXXFLAGS=$CXXFLAGS
7353     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
7354     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
7355     CXXFLAGS=$save_CXXFLAGS
7356     AC_LANG_POP([C++])
7357     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
7358         AC_MSG_RESULT([yes])
7359     else
7360         AC_MSG_RESULT([no])
7361     fi
7363 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
7365 AC_MSG_CHECKING([whether $CXX_BASE supports a working C++20 consteval])
7366 dnl ...that does not suffer from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96994> "Missing code
7367 dnl from consteval constructor initializing const variable",
7368 dnl <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98752> "wrong 'error: â€˜this’ is not a constant
7369 dnl expression' with consteval constructor", or <https://bugs.llvm.org/show_bug.cgi?id=50063> "code
7370 dnl using consteval: 'clang/lib/CodeGen/Address.h:38: llvm::Value*
7371 dnl clang::CodeGen::Address::getPointer() const: Assertion `isValid()' failed.'":
7372 AC_LANG_PUSH([C++])
7373 save_CXXFLAGS=$CXXFLAGS
7374 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7375 AC_RUN_IFELSE([AC_LANG_PROGRAM([
7376         struct S {
7377             consteval S() { i = 1; }
7378             int i = 0;
7379         };
7380         S const s;
7382         struct S1 { consteval S1(int) {} };
7383         struct S2 {
7384             S1 x;
7385             S2(): x(0) {}
7386         };
7388         struct S3 {
7389             consteval S3() {}
7390             union {
7391                 int a;
7392                 unsigned b = 0;
7393             };
7394         };
7395         void f() { S3(); }
7396     ], [
7397         return (s.i == 1) ? 0 : 1;
7398     ])], [
7399         AC_DEFINE([HAVE_CPP_CONSTEVAL],[1])
7400         AC_MSG_RESULT([yes])
7401     ], [AC_MSG_RESULT([no])], [AC_MSG_RESULT([assumed no (cross compiling)])])
7402 CXXFLAGS=$save_CXXFLAGS
7403 AC_LANG_POP([C++])
7405 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
7406 AC_LANG_PUSH([C++])
7407 save_CXXFLAGS=$CXXFLAGS
7408 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7409 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7410         #include <algorithm>
7411         #include <initializer_list>
7412         #include <vector>
7413         template<typename T> class S {
7414         private:
7415             std::vector<T> v_;
7416         public:
7417             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
7418         };
7419         constinit S<int> s{3, 2, 1};
7420     ])], [
7421         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
7422         AC_MSG_RESULT([yes])
7423     ], [AC_MSG_RESULT([no])])
7424 CXXFLAGS=$save_CXXFLAGS
7425 AC_LANG_POP([C++])
7427 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
7428 AC_LANG_PUSH([C++])
7429 save_CXXFLAGS=$CXXFLAGS
7430 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7431 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7432         #include <span>
7433         #include <type_traits>
7434         // Don't check size_type directly, as it was called index_type before P1872R0:
7435         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
7436     ])], [
7437         AC_DEFINE([HAVE_CPP_SPAN],[1])
7438         AC_MSG_RESULT([yes])
7439     ], [AC_MSG_RESULT([no])])
7440 CXXFLAGS=$save_CXXFLAGS
7441 AC_LANG_POP([C++])
7443 AC_MSG_CHECKING([whether $CXX_BASE implements C++ DR P1155R3])
7444 AC_LANG_PUSH([C++])
7445 save_CXXFLAGS=$CXXFLAGS
7446 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7447 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7448         struct S1 { S1(S1 &&); };
7449         struct S2: S1 {};
7450         S1 f(S2 s) { return s; }
7451     ])], [
7452         AC_DEFINE([HAVE_P1155R3],[1])
7453         AC_MSG_RESULT([yes])
7454     ], [AC_MSG_RESULT([no])])
7455 CXXFLAGS=$save_CXXFLAGS
7456 AC_LANG_POP([C++])
7458 dnl Supported since GCC 9 and Clang 10 (which each also started to support -Wdeprecated-copy, but
7459 dnl which is included in -Wextra anyway):
7460 HAVE_WDEPRECATED_COPY_DTOR=
7461 if test "$GCC" = yes; then
7462     AC_MSG_CHECKING([whether $CXX_BASE supports -Wdeprecated-copy-dtor])
7463     AC_LANG_PUSH([C++])
7464     save_CXXFLAGS=$CXXFLAGS
7465     CXXFLAGS="$CXXFLAGS -Werror -Wdeprecated-copy-dtor"
7466     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
7467             HAVE_WDEPRECATED_COPY_DTOR=TRUE
7468             AC_MSG_RESULT([yes])
7469         ], [AC_MSG_RESULT([no])])
7470     CXXFLAGS=$save_CXXFLAGS
7471     AC_LANG_POP([C++])
7473 AC_SUBST([HAVE_WDEPRECATED_COPY_DTOR])
7475 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
7476 dnl uninitialized warning for code like
7478 dnl   OString f();
7479 dnl   boost::optional<OString> * g(bool b) {
7480 dnl       boost::optional<OString> o;
7481 dnl       if (b) o = f();
7482 dnl       return new boost::optional<OString>(o);
7483 dnl   }
7485 dnl (as is e.g. present, in a slightly more elaborate form, in
7486 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
7487 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
7488 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
7489 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7490     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
7491     AC_LANG_PUSH([C++])
7492     save_CXXFLAGS=$CXXFLAGS
7493     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
7494     if test "$ENABLE_OPTIMIZED" = TRUE; then
7495         CXXFLAGS="$CXXFLAGS -O2"
7496     else
7497         CXXFLAGS="$CXXFLAGS -O0"
7498     fi
7499     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7500             #include <new>
7501             void f1(int);
7502             struct S1 {
7503                 ~S1() { f1(n); }
7504                 int n = 0;
7505             };
7506             struct S2 {
7507                 S2() {}
7508                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
7509                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
7510                 void set(S1 s) {
7511                     new (stg) S1(s);
7512                     init = true;
7513                 }
7514                 bool init = false;
7515                 char stg[sizeof (S1)];
7516             } ;
7517             S1 f2();
7518             S2 * f3(bool b) {
7519                 S2 o;
7520                 if (b) o.set(f2());
7521                 return new S2(o);
7522             }
7523         ]])], [AC_MSG_RESULT([no])], [
7524             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
7525             AC_MSG_RESULT([yes])
7526         ])
7527     CXXFLAGS=$save_CXXFLAGS
7528     AC_LANG_POP([C++])
7530 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
7532 dnl Check for <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c5> "[8/9/10/11 Regression]
7533 dnl -Wstringop-overflow false positive due to using MEM_REF type of &MEM" (fixed in GCC 11), which
7534 dnl hits us e.g. with GCC 10 and --enable-optimized at
7536 dnl   In file included from include/rtl/string.hxx:49,
7537 dnl                    from include/rtl/ustring.hxx:43,
7538 dnl                    from include/osl/file.hxx:35,
7539 dnl                    from include/codemaker/global.hxx:28,
7540 dnl                    from include/codemaker/options.hxx:23,
7541 dnl                    from codemaker/source/commoncpp/commoncpp.cxx:24:
7542 dnl   In function â€˜char* rtl::addDataHelper(char*, const char*, std::size_t)’,
7543 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,
7544 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,
7545 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,
7546 dnl       inlined from â€˜rtl::OString codemaker::cpp::scopedCppName(const rtl::OString&, bool)’ at codemaker/source/commoncpp/commoncpp.cxx:53:55:
7547 dnl   include/rtl/stringconcat.hxx:78:15: error: writing 2 bytes into a region of size 1 [-Werror=stringop-overflow=]
7548 dnl      78 |         memcpy( buffer, data, length );
7549 dnl         |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
7550 HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=
7551 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7552     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=stringop-overflow=])
7553     AC_LANG_PUSH([C++])
7554     save_CXXFLAGS=$CXXFLAGS
7555     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wstringop-overflow"
7556     if test "$ENABLE_OPTIMIZED" = TRUE; then
7557         CXXFLAGS="$CXXFLAGS -O2"
7558     else
7559         CXXFLAGS="$CXXFLAGS -O0"
7560     fi
7561     dnl Test code taken from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c0>:
7562     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7563             void fill(char const * begin, char const * end, char c);
7564             struct q {
7565                 char ids[4];
7566                 char username[6];
7567             };
7568             void test(q & c) {
7569                 fill(c.ids, c.ids + sizeof(c.ids), '\0');
7570                 __builtin_strncpy(c.username, "root", sizeof(c.username));
7571             }
7572         ]])], [AC_MSG_RESULT([no])], [
7573             HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=TRUE
7574             AC_MSG_RESULT([yes])
7575         ])
7576     CXXFLAGS=$save_CXXFLAGS
7577     AC_LANG_POP([C++])
7579 AC_SUBST([HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW])
7581 dnl ===================================================================
7582 dnl CPU Intrinsics support - SSE, AVX
7583 dnl ===================================================================
7585 CXXFLAGS_INTRINSICS_SSE2=
7586 CXXFLAGS_INTRINSICS_SSSE3=
7587 CXXFLAGS_INTRINSICS_SSE41=
7588 CXXFLAGS_INTRINSICS_SSE42=
7589 CXXFLAGS_INTRINSICS_AVX=
7590 CXXFLAGS_INTRINSICS_AVX2=
7591 CXXFLAGS_INTRINSICS_AVX512=
7592 CXXFLAGS_INTRINSICS_F16C=
7593 CXXFLAGS_INTRINSICS_FMA=
7595 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7596     # GCC, Clang or Clang-cl (clang-cl + MSVC's -arch options don't work well together)
7597     flag_sse2=-msse2
7598     flag_ssse3=-mssse3
7599     flag_sse41=-msse4.1
7600     flag_sse42=-msse4.2
7601     flag_avx=-mavx
7602     flag_avx2=-mavx2
7603     flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
7604     flag_f16c=-mf16c
7605     flag_fma=-mfma
7606 else
7607     # https://docs.microsoft.com/en-us/cpp/build/reference/arch-x86
7608     # MSVC seems to differentiate only between SSE and SSE2, where in fact
7609     # SSE2 seems to be SSE2+.
7610     # Even if -arch:SSE2 is the default, set it explicitly, so that the variable
7611     # is not empty (and can be tested in gbuild).
7612     flag_sse2=-arch:SSE2
7613     flag_ssse3=-arch:SSE2
7614     flag_sse41=-arch:SSE2
7615     flag_sse42=-arch:SSE2
7616     flag_avx=-arch:AVX
7617     flag_avx2=-arch:AVX2
7618     flag_avx512=-arch:AVX512
7619     # These are part of -arch:AVX2
7620     flag_f16c=-arch:AVX2
7621     flag_fma=-arch:AVX2
7624 AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
7625 AC_LANG_PUSH([C++])
7626 save_CXXFLAGS=$CXXFLAGS
7627 CXXFLAGS="$CXXFLAGS $flag_sse2"
7628 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7629     #include <emmintrin.h>
7630     int main () {
7631         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7632         c = _mm_xor_si128 (a, b);
7633         return 0;
7634     }
7635     ])],
7636     [can_compile_sse2=yes],
7637     [can_compile_sse2=no])
7638 AC_LANG_POP([C++])
7639 CXXFLAGS=$save_CXXFLAGS
7640 AC_MSG_RESULT([${can_compile_sse2}])
7641 if test "${can_compile_sse2}" = "yes" ; then
7642     CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
7645 AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
7646 AC_LANG_PUSH([C++])
7647 save_CXXFLAGS=$CXXFLAGS
7648 CXXFLAGS="$CXXFLAGS $flag_ssse3"
7649 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7650     #include <tmmintrin.h>
7651     int main () {
7652         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7653         c = _mm_maddubs_epi16 (a, b);
7654         return 0;
7655     }
7656     ])],
7657     [can_compile_ssse3=yes],
7658     [can_compile_ssse3=no])
7659 AC_LANG_POP([C++])
7660 CXXFLAGS=$save_CXXFLAGS
7661 AC_MSG_RESULT([${can_compile_ssse3}])
7662 if test "${can_compile_ssse3}" = "yes" ; then
7663     CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
7666 AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
7667 AC_LANG_PUSH([C++])
7668 save_CXXFLAGS=$CXXFLAGS
7669 CXXFLAGS="$CXXFLAGS $flag_sse41"
7670 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7671     #include <smmintrin.h>
7672     int main () {
7673         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7674         c = _mm_cmpeq_epi64 (a, b);
7675         return 0;
7676     }
7677     ])],
7678     [can_compile_sse41=yes],
7679     [can_compile_sse41=no])
7680 AC_LANG_POP([C++])
7681 CXXFLAGS=$save_CXXFLAGS
7682 AC_MSG_RESULT([${can_compile_sse41}])
7683 if test "${can_compile_sse41}" = "yes" ; then
7684     CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
7687 AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
7688 AC_LANG_PUSH([C++])
7689 save_CXXFLAGS=$CXXFLAGS
7690 CXXFLAGS="$CXXFLAGS $flag_sse42"
7691 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7692     #include <nmmintrin.h>
7693     int main () {
7694         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7695         c = _mm_cmpgt_epi64 (a, b);
7696         return 0;
7697     }
7698     ])],
7699     [can_compile_sse42=yes],
7700     [can_compile_sse42=no])
7701 AC_LANG_POP([C++])
7702 CXXFLAGS=$save_CXXFLAGS
7703 AC_MSG_RESULT([${can_compile_sse42}])
7704 if test "${can_compile_sse42}" = "yes" ; then
7705     CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
7708 AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
7709 AC_LANG_PUSH([C++])
7710 save_CXXFLAGS=$CXXFLAGS
7711 CXXFLAGS="$CXXFLAGS $flag_avx"
7712 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7713     #include <immintrin.h>
7714     int main () {
7715         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
7716         c = _mm256_xor_ps(a, b);
7717         return 0;
7718     }
7719     ])],
7720     [can_compile_avx=yes],
7721     [can_compile_avx=no])
7722 AC_LANG_POP([C++])
7723 CXXFLAGS=$save_CXXFLAGS
7724 AC_MSG_RESULT([${can_compile_avx}])
7725 if test "${can_compile_avx}" = "yes" ; then
7726     CXXFLAGS_INTRINSICS_AVX="$flag_avx"
7729 AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
7730 AC_LANG_PUSH([C++])
7731 save_CXXFLAGS=$CXXFLAGS
7732 CXXFLAGS="$CXXFLAGS $flag_avx2"
7733 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7734     #include <immintrin.h>
7735     int main () {
7736         __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
7737         c = _mm256_maddubs_epi16(a, b);
7738         return 0;
7739     }
7740     ])],
7741     [can_compile_avx2=yes],
7742     [can_compile_avx2=no])
7743 AC_LANG_POP([C++])
7744 CXXFLAGS=$save_CXXFLAGS
7745 AC_MSG_RESULT([${can_compile_avx2}])
7746 if test "${can_compile_avx2}" = "yes" ; then
7747     CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
7750 AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
7751 AC_LANG_PUSH([C++])
7752 save_CXXFLAGS=$CXXFLAGS
7753 CXXFLAGS="$CXXFLAGS $flag_avx512"
7754 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7755     #include <immintrin.h>
7756     int main () {
7757         __m512i a = _mm512_loadu_si512(0);
7758         return 0;
7759     }
7760     ])],
7761     [can_compile_avx512=yes],
7762     [can_compile_avx512=no])
7763 AC_LANG_POP([C++])
7764 CXXFLAGS=$save_CXXFLAGS
7765 AC_MSG_RESULT([${can_compile_avx512}])
7766 if test "${can_compile_avx512}" = "yes" ; then
7767     CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
7770 AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
7771 AC_LANG_PUSH([C++])
7772 save_CXXFLAGS=$CXXFLAGS
7773 CXXFLAGS="$CXXFLAGS $flag_f16c"
7774 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7775     #include <immintrin.h>
7776     int main () {
7777         __m128i a = _mm_set1_epi32 (0);
7778         __m128 c;
7779         c = _mm_cvtph_ps(a);
7780         return 0;
7781     }
7782     ])],
7783     [can_compile_f16c=yes],
7784     [can_compile_f16c=no])
7785 AC_LANG_POP([C++])
7786 CXXFLAGS=$save_CXXFLAGS
7787 AC_MSG_RESULT([${can_compile_f16c}])
7788 if test "${can_compile_f16c}" = "yes" ; then
7789     CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
7792 AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
7793 AC_LANG_PUSH([C++])
7794 save_CXXFLAGS=$CXXFLAGS
7795 CXXFLAGS="$CXXFLAGS $flag_fma"
7796 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7797     #include <immintrin.h>
7798     int main () {
7799         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
7800         d = _mm256_fmadd_ps(a, b, c);
7801         return 0;
7802     }
7803     ])],
7804     [can_compile_fma=yes],
7805     [can_compile_fma=no])
7806 AC_LANG_POP([C++])
7807 CXXFLAGS=$save_CXXFLAGS
7808 AC_MSG_RESULT([${can_compile_fma}])
7809 if test "${can_compile_fma}" = "yes" ; then
7810     CXXFLAGS_INTRINSICS_FMA="$flag_fma"
7813 AC_SUBST([CXXFLAGS_INTRINSICS_SSE2])
7814 AC_SUBST([CXXFLAGS_INTRINSICS_SSSE3])
7815 AC_SUBST([CXXFLAGS_INTRINSICS_SSE41])
7816 AC_SUBST([CXXFLAGS_INTRINSICS_SSE42])
7817 AC_SUBST([CXXFLAGS_INTRINSICS_AVX])
7818 AC_SUBST([CXXFLAGS_INTRINSICS_AVX2])
7819 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512])
7820 AC_SUBST([CXXFLAGS_INTRINSICS_F16C])
7821 AC_SUBST([CXXFLAGS_INTRINSICS_FMA])
7823 dnl ===================================================================
7824 dnl system stl sanity tests
7825 dnl ===================================================================
7826 if test "$_os" != "WINNT"; then
7828     AC_LANG_PUSH([C++])
7830     save_CPPFLAGS="$CPPFLAGS"
7831     if test -n "$MACOSX_SDK_PATH"; then
7832         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
7833     fi
7835     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
7836     # only.
7837     if test "$CPP_LIBRARY" = GLIBCXX; then
7838         dnl gcc#19664, gcc#22482, rhbz#162935
7839         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
7840         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
7841         AC_MSG_RESULT([$stlvisok])
7842         if test "$stlvisok" = "no"; then
7843             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
7844         fi
7845     fi
7847     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
7848     # when we don't make any dynamic libraries?
7849     if test "$DISABLE_DYNLOADING" = ""; then
7850         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
7851         cat > conftestlib1.cc <<_ACEOF
7852 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7853 struct S2: S1<int> { virtual ~S2(); };
7854 S2::~S2() {}
7855 _ACEOF
7856         cat > conftestlib2.cc <<_ACEOF
7857 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7858 struct S2: S1<int> { virtual ~S2(); };
7859 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
7860 _ACEOF
7861         gccvisinlineshiddenok=yes
7862         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
7863             gccvisinlineshiddenok=no
7864         else
7865             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
7866             dnl known to not work with -z defs (unsetting which makes the test
7867             dnl moot, though):
7868             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
7869             if test "$COM_IS_CLANG" = TRUE; then
7870                 for i in $CXX $CXXFLAGS; do
7871                     case $i in
7872                     -fsanitize=*)
7873                         my_linkflagsnoundefs=
7874                         break
7875                         ;;
7876                     esac
7877                 done
7878             fi
7879             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
7880                 gccvisinlineshiddenok=no
7881             fi
7882         fi
7884         rm -fr libconftest*
7885         AC_MSG_RESULT([$gccvisinlineshiddenok])
7886         if test "$gccvisinlineshiddenok" = "no"; then
7887             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
7888         fi
7889     fi
7891    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
7892     cat >visibility.cxx <<_ACEOF
7893 #pragma GCC visibility push(hidden)
7894 struct __attribute__ ((visibility ("default"))) TestStruct {
7895   static void Init();
7897 __attribute__ ((visibility ("default"))) void TestFunc() {
7898   TestStruct::Init();
7900 _ACEOF
7901     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
7902         gccvisbroken=yes
7903     else
7904         case "$host_cpu" in
7905         i?86|x86_64)
7906             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
7907                 gccvisbroken=no
7908             else
7909                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
7910                     gccvisbroken=no
7911                 else
7912                     gccvisbroken=yes
7913                 fi
7914             fi
7915             ;;
7916         *)
7917             gccvisbroken=no
7918             ;;
7919         esac
7920     fi
7921     rm -f visibility.s visibility.cxx
7923     AC_MSG_RESULT([$gccvisbroken])
7924     if test "$gccvisbroken" = "yes"; then
7925         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
7926     fi
7928     CPPFLAGS="$save_CPPFLAGS"
7930     AC_LANG_POP([C++])
7933 dnl ===================================================================
7934 dnl  Clang++ tests
7935 dnl ===================================================================
7937 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
7938 if test "$GCC" = "yes"; then
7939     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
7940     AC_LANG_PUSH([C++])
7941     save_CXXFLAGS=$CXXFLAGS
7942     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
7943     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
7944     CXXFLAGS=$save_CXXFLAGS
7945     AC_LANG_POP([C++])
7946     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
7947         AC_MSG_RESULT([yes])
7948     else
7949         AC_MSG_RESULT([no])
7950     fi
7952 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
7954 dnl ===================================================================
7955 dnl Compiler plugins
7956 dnl ===================================================================
7958 COMPILER_PLUGINS=
7959 # currently only Clang
7961 if test "$COM_IS_CLANG" != "TRUE"; then
7962     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
7963         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
7964         enable_compiler_plugins=no
7965     fi
7968 COMPILER_PLUGINS_COM_IS_CLANG=
7969 if test "$COM_IS_CLANG" = "TRUE"; then
7970     if test -n "$enable_compiler_plugins"; then
7971         compiler_plugins="$enable_compiler_plugins"
7972     elif test -n "$ENABLE_DBGUTIL"; then
7973         compiler_plugins=test
7974     else
7975         compiler_plugins=no
7976     fi
7977     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
7978         if test "$CLANGVER" -lt 50002; then
7979             if test "$compiler_plugins" = yes; then
7980                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
7981             else
7982                 compiler_plugins=no
7983             fi
7984         fi
7985     fi
7986     if test "$compiler_plugins" != "no"; then
7987         dnl The prefix where Clang resides, override to where Clang resides if
7988         dnl using a source build:
7989         if test -z "$CLANGDIR"; then
7990             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $(printf '%s\n' $CXX | grep clang | head -n 1)))))
7991         fi
7992         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
7993         if test -z "$COMPILER_PLUGINS_CXX"; then
7994             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
7995         fi
7996         clangbindir=$CLANGDIR/bin
7997         if test "$build_os" = "cygwin"; then
7998             clangbindir=$(cygpath -u "$clangbindir")
7999         fi
8000         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
8001         if test -n "$LLVM_CONFIG"; then
8002             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
8003             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
8004             if test -z "$CLANGLIBDIR"; then
8005                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
8006             fi
8007             # Try if clang is built from source (in which case its includes are not together with llvm includes).
8008             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
8009             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
8010             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
8011                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
8012             fi
8013             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
8014             clangobjdir=$($LLVM_CONFIG --obj-root)
8015             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
8016                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
8017             fi
8018         fi
8019         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
8020         AC_LANG_PUSH([C++])
8021         save_CXX=$CXX
8022         save_CXXCPP=$CXXCPP
8023         save_CPPFLAGS=$CPPFLAGS
8024         save_CXXFLAGS=$CXXFLAGS
8025         save_LDFLAGS=$LDFLAGS
8026         save_LIBS=$LIBS
8027         CXX=$COMPILER_PLUGINS_CXX
8028         CXXCPP="$COMPILER_PLUGINS_CXX -E"
8029         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
8030         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
8031         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
8032             [COMPILER_PLUGINS=TRUE],
8033             [
8034             if test "$compiler_plugins" = "yes"; then
8035                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
8036             else
8037                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
8038                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
8039             fi
8040             ])
8041         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
8042         dnl comment in compilerplugins/Makefile-clang.mk:
8043         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
8044             LDFLAGS=""
8045             AC_MSG_CHECKING([for clang libraries to use])
8046             if test -z "$CLANGTOOLLIBS"; then
8047                 LIBS="-lclangTooling -lclangFrontend -lclangDriver -lclangParse -lclangSema -lclangEdit \
8048  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
8049                 AC_LINK_IFELSE([
8050                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8051                         [[ clang::FullSourceLoc().dump(); ]])
8052                 ],[CLANGTOOLLIBS="$LIBS"],[])
8053             fi
8054             if test -z "$CLANGTOOLLIBS"; then
8055                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
8056                 AC_LINK_IFELSE([
8057                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8058                         [[ clang::FullSourceLoc().dump(); ]])
8059                 ],[CLANGTOOLLIBS="$LIBS"],[])
8060             fi
8061             AC_MSG_RESULT([$CLANGTOOLLIBS])
8062             if test -z "$CLANGTOOLLIBS"; then
8063                 if test "$compiler_plugins" = "yes"; then
8064                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
8065                 else
8066                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
8067                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
8068                 fi
8069                 COMPILER_PLUGINS=
8070             fi
8071             if test -n "$COMPILER_PLUGINS"; then
8072                 if test -z "$CLANGSYSINCLUDE"; then
8073                     if test -n "$LLVM_CONFIG"; then
8074                         # Path to the clang system headers (no idea if there's a better way to get it).
8075                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/git\|svn//')/include
8076                     fi
8077                 fi
8078             fi
8079         fi
8080         CXX=$save_CXX
8081         CXXCPP=$save_CXXCPP
8082         CPPFLAGS=$save_CPPFLAGS
8083         CXXFLAGS=$save_CXXFLAGS
8084         LDFLAGS=$save_LDFLAGS
8085         LIBS="$save_LIBS"
8086         AC_LANG_POP([C++])
8088         AC_MSG_CHECKING([whether the compiler for building compilerplugins is actually Clang])
8089         AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
8090             #ifndef __clang__
8091             you lose
8092             #endif
8093             int foo=42;
8094             ]])],
8095             [AC_MSG_RESULT([yes])
8096              COMPILER_PLUGINS_COM_IS_CLANG=TRUE],
8097             [AC_MSG_RESULT([no])])
8098         AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8099     fi
8100 else
8101     if test "$enable_compiler_plugins" = "yes"; then
8102         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
8103     fi
8105 COMPILER_PLUGINS_ANALYZER_PCH=
8106 if test "$enable_compiler_plugins_analyzer_pch" != no; then
8107     COMPILER_PLUGINS_ANALYZER_PCH=TRUE
8109 AC_SUBST(COMPILER_PLUGINS)
8110 AC_SUBST(COMPILER_PLUGINS_ANALYZER_PCH)
8111 AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8112 AC_SUBST(COMPILER_PLUGINS_CXX)
8113 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
8114 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
8115 AC_SUBST(COMPILER_PLUGINS_DEBUG)
8116 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
8117 AC_SUBST(CLANGDIR)
8118 AC_SUBST(CLANGLIBDIR)
8119 AC_SUBST(CLANGTOOLLIBS)
8120 AC_SUBST(CLANGSYSINCLUDE)
8122 # Plugin to help linker.
8123 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
8124 # This makes --enable-lto build with clang work.
8125 AC_SUBST(LD_PLUGIN)
8127 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
8128 AC_SUBST(HAVE_POSIX_FALLOCATE)
8130 JITC_PROCESSOR_TYPE=""
8131 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
8132     # IBMs JDK needs this...
8133     JITC_PROCESSOR_TYPE=6
8134     export JITC_PROCESSOR_TYPE
8136 AC_SUBST([JITC_PROCESSOR_TYPE])
8138 # Misc Windows Stuff
8139 AC_ARG_WITH(ucrt-dir,
8140     AS_HELP_STRING([--with-ucrt-dir],
8141         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
8142         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
8143         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
8144             Windows6.1-KB2999226-x64.msu
8145             Windows6.1-KB2999226-x86.msu
8146             Windows8.1-KB2999226-x64.msu
8147             Windows8.1-KB2999226-x86.msu
8148             Windows8-RT-KB2999226-x64.msu
8149             Windows8-RT-KB2999226-x86.msu
8150         A zip archive including those files is available from Microsoft site:
8151         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
8154 UCRT_REDISTDIR="$with_ucrt_dir"
8155 if test $_os = "WINNT"; then
8156     find_msvc_x64_dlls
8157     for i in $PKGFORMAT; do
8158         if test "$i" = msi; then
8159             find_msms
8160             break
8161         fi
8162     done
8163     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
8164     MSVC_DLLS="$msvcdlls"
8165     test -n "$msmdir" && MSM_PATH=`win_short_path_for_make "$msmdir"`
8166     # MSVC 15.3 changed it to VC141
8167     if echo "$msvcdllpath" | grep -q "VC142.CRT$"; then
8168         SCPDEFS="$SCPDEFS -DWITH_VC142_REDIST"
8169     elif echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
8170         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
8171     else
8172         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
8173     fi
8175     if test "$UCRT_REDISTDIR" = "no"; then
8176         dnl explicitly disabled
8177         UCRT_REDISTDIR=""
8178     else
8179         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
8180                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
8181                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
8182                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
8183                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
8184                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
8185             UCRT_REDISTDIR=""
8186             if test -n "$PKGFORMAT"; then
8187                for i in $PKGFORMAT; do
8188                    case "$i" in
8189                    msi)
8190                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
8191                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
8192                        ;;
8193                    esac
8194                done
8195             fi
8196         fi
8197     fi
8200 AC_SUBST(UCRT_REDISTDIR)
8201 AC_SUBST(MSVC_DLL_PATH)
8202 AC_SUBST(MSVC_DLLS)
8203 AC_SUBST(MSM_PATH)
8206 dnl ===================================================================
8207 dnl Checks for Java
8208 dnl ===================================================================
8209 if test "$ENABLE_JAVA" != ""; then
8211     # Windows-specific tests
8212     if test "$build_os" = "cygwin"; then
8213         if test -z "$with_jdk_home"; then
8214             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
8215             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
8216             reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
8217             if test -n "$regvalue"; then
8218                 ver=$regvalue
8219                 reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
8220                 with_jdk_home=$regvalue
8221             fi
8222             howfound="found automatically"
8223         else
8224             with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
8225             howfound="you passed"
8226         fi
8228         if ! test -f "$with_jdk_home/lib/jvm.lib" -a -f "$with_jdk_home/bin/java.exe"; then
8229             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])
8230         fi
8231     fi
8233     # 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.
8234     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
8235     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
8236         with_jdk_home=`/usr/libexec/java_home`
8237     fi
8239     JAVA_HOME=; export JAVA_HOME
8240     if test -z "$with_jdk_home"; then
8241         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
8242     else
8243         _java_path="$with_jdk_home/bin/$with_java"
8244         dnl Check if there is a Java interpreter at all.
8245         if test -x "$_java_path"; then
8246             JAVAINTERPRETER=$_java_path
8247         else
8248             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
8249         fi
8250     fi
8252     dnl Check that the JDK found is correct architecture (at least 2 reasons to
8253     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
8254     dnl loaded by java to run JunitTests:
8255     if test "$build_os" = "cygwin" -a "$cross_compiling" != "yes"; then
8256         shortjdkhome=`cygpath -d "$with_jdk_home"`
8257         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
8258             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
8259             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8260         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
8261             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8262             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8263         fi
8265         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
8266             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
8267         fi
8268         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
8269     elif test "$cross_compiling" != "yes"; then
8270         case $CPUNAME in
8271             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
8272                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
8273                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
8274                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8275                 fi
8276                 ;;
8277             *) # assumption: everything else 32-bit
8278                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
8279                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8280                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8281                 fi
8282                 ;;
8283         esac
8284     fi
8287 dnl ===================================================================
8288 dnl Checks for JDK.
8289 dnl ===================================================================
8291 # Whether all the complexity here actually is needed any more or not, no idea.
8293 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8294     _gij_longver=0
8295     AC_MSG_CHECKING([the installed JDK])
8296     if test -n "$JAVAINTERPRETER"; then
8297         dnl java -version sends output to stderr!
8298         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
8299             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8300         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
8301             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8302         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
8303             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8304         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
8305             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8306         else
8307             JDK=sun
8309             dnl Sun JDK specific tests
8310             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
8311             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
8313             if test "$_jdk_ver" -lt 10900; then
8314                 AC_MSG_ERROR([JDK is too old, you need at least 9 ($_jdk_ver < 10900)])
8315             fi
8316             if test "$_jdk_ver" -gt 10900; then
8317                 JAVA_CLASSPATH_NOT_SET=TRUE
8318             fi
8320             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
8321             if test "$_os" = "WINNT"; then
8322                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
8323             fi
8324             AC_MSG_RESULT([found $JAVA_HOME (JDK $_jdk)])
8326             # set to limit VM usage for JunitTests
8327             JAVAIFLAGS=-Xmx64M
8328             # set to limit VM usage for javac
8329             JAVACFLAGS=-J-Xmx128M
8330         fi
8331     else
8332         AC_MSG_ERROR([Java not found. You need at least JDK 9])
8333     fi
8334 else
8335     if test -z "$ENABLE_JAVA"; then
8336         dnl Java disabled
8337         JAVA_HOME=
8338         export JAVA_HOME
8339     elif test "$cross_compiling" = "yes"; then
8340         # Just assume compatibility of build and host JDK
8341         JDK=$JDK_FOR_BUILD
8342         JAVAIFLAGS=$JAVAIFLAGS_FOR_BUILD
8343     fi
8346 dnl ===================================================================
8347 dnl Checks for javac
8348 dnl ===================================================================
8349 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8350     javacompiler="javac"
8351     : ${JAVA_SOURCE_VER=8}
8352     : ${JAVA_TARGET_VER=8}
8353     if test -z "$with_jdk_home"; then
8354         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
8355     else
8356         _javac_path="$with_jdk_home/bin/$javacompiler"
8357         dnl Check if there is a Java compiler at all.
8358         if test -x "$_javac_path"; then
8359             JAVACOMPILER=$_javac_path
8360         fi
8361     fi
8362     if test -z "$JAVACOMPILER"; then
8363         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
8364     fi
8365     if test "$build_os" = "cygwin"; then
8366         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
8367             JAVACOMPILER="${JAVACOMPILER}.exe"
8368         fi
8369         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
8370     fi
8373 dnl ===================================================================
8374 dnl Checks for javadoc
8375 dnl ===================================================================
8376 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8377     if test -z "$with_jdk_home"; then
8378         AC_PATH_PROG(JAVADOC, javadoc)
8379     else
8380         _javadoc_path="$with_jdk_home/bin/javadoc"
8381         dnl Check if there is a javadoc at all.
8382         if test -x "$_javadoc_path"; then
8383             JAVADOC=$_javadoc_path
8384         else
8385             AC_PATH_PROG(JAVADOC, javadoc)
8386         fi
8387     fi
8388     if test -z "$JAVADOC"; then
8389         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
8390     fi
8391     if test "$build_os" = "cygwin"; then
8392         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
8393             JAVADOC="${JAVADOC}.exe"
8394         fi
8395         JAVADOC=`win_short_path_for_make "$JAVADOC"`
8396     fi
8398     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
8399     JAVADOCISGJDOC="yes"
8400     fi
8402 AC_SUBST(JAVADOC)
8403 AC_SUBST(JAVADOCISGJDOC)
8405 if test "$ENABLE_JAVA" != "" -a \( "$cross_compiling" != "yes" -o -n "$with_jdk_home" \); then
8406     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
8407     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
8408         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
8409            # try to recover first by looking whether we have an alternative
8410            # system as in Debian or newer SuSEs where following /usr/bin/javac
8411            # over /etc/alternatives/javac leads to the right bindir where we
8412            # just need to strip a bit away to get a valid JAVA_HOME
8413            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
8414         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
8415             # maybe only one level of symlink (e.g. on Mac)
8416             JAVA_HOME=$(readlink $JAVACOMPILER)
8417             if test "$(dirname $JAVA_HOME)" = "."; then
8418                 # we've got no path to trim back
8419                 JAVA_HOME=""
8420             fi
8421         else
8422             # else warn
8423             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
8424             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
8425             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
8426             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
8427         fi
8428         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
8429         if test "$JAVA_HOME" != "/usr"; then
8430             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8431                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
8432                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
8433                 dnl Tiger already returns a JDK path...
8434                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
8435             else
8436                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
8437                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
8438                 dnl that checks which version to run
8439                 if test -f "$JAVA_HOME"; then
8440                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
8441                 fi
8442             fi
8443         fi
8444     fi
8445     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
8447     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
8448     if test -z "$JAVA_HOME"; then
8449         if test "x$with_jdk_home" = "x"; then
8450             cat > findhome.java <<_ACEOF
8451 [import java.io.File;
8453 class findhome
8455     public static void main(String args[])
8456     {
8457         String jrelocation = System.getProperty("java.home");
8458         File jre = new File(jrelocation);
8459         System.out.println(jre.getParent());
8460     }
8462 _ACEOF
8463             AC_MSG_CHECKING([if javac works])
8464             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
8465             AC_TRY_EVAL(javac_cmd)
8466             if test $? = 0 -a -f ./findhome.class; then
8467                 AC_MSG_RESULT([javac works])
8468             else
8469                 echo "configure: javac test failed" >&5
8470                 cat findhome.java >&5
8471                 AC_MSG_ERROR([javac does not work - java projects will not build!])
8472             fi
8473             AC_MSG_CHECKING([if gij knows its java.home])
8474             JAVA_HOME=`$JAVAINTERPRETER findhome`
8475             if test $? = 0 -a "$JAVA_HOME" != ""; then
8476                 AC_MSG_RESULT([$JAVA_HOME])
8477             else
8478                 echo "configure: java test failed" >&5
8479                 cat findhome.java >&5
8480                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
8481             fi
8482             # clean-up after ourselves
8483             rm -f ./findhome.java ./findhome.class
8484         else
8485             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
8486         fi
8487     fi
8489     # now check if $JAVA_HOME is really valid
8490     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8491         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
8492             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
8493             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
8494             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
8495             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
8496             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
8497             add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
8498         fi
8499     fi
8500     PathFormat "$JAVA_HOME"
8501     JAVA_HOME="$formatted_path"
8504 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
8505     "$_os" != Darwin
8506 then
8507     AC_MSG_CHECKING([for JAWT lib])
8508     if test "$_os" = WINNT; then
8509         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
8510         JAWTLIB=jawt.lib
8511     else
8512         case "$host_cpu" in
8513         arm*)
8514             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
8515             JAVA_ARCH=$my_java_arch
8516             ;;
8517         i*86)
8518             my_java_arch=i386
8519             ;;
8520         m68k)
8521             my_java_arch=m68k
8522             ;;
8523         powerpc)
8524             my_java_arch=ppc
8525             ;;
8526         powerpc64)
8527             my_java_arch=ppc64
8528             ;;
8529         powerpc64le)
8530             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
8531             JAVA_ARCH=$my_java_arch
8532             ;;
8533         sparc64)
8534             my_java_arch=sparcv9
8535             ;;
8536         x86_64)
8537             my_java_arch=amd64
8538             ;;
8539         *)
8540             my_java_arch=$host_cpu
8541             ;;
8542         esac
8543         # This is where JDK9 puts the library
8544         if test -e "$JAVA_HOME/lib/libjawt.so"; then
8545             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
8546         else
8547             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
8548         fi
8549         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
8550     fi
8551     AC_MSG_RESULT([$JAWTLIB])
8553 AC_SUBST(JAWTLIB)
8555 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
8556     case "$host_os" in
8558     aix*)
8559         JAVAINC="-I$JAVA_HOME/include"
8560         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
8561         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8562         ;;
8564     cygwin*|wsl*)
8565         JAVAINC="-I$JAVA_HOME/include/win32"
8566         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
8567         ;;
8569     darwin*|macos*)
8570         if test -d "$JAVA_HOME/include/darwin"; then
8571             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
8572         else
8573             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
8574         fi
8575         ;;
8577     dragonfly*)
8578         JAVAINC="-I$JAVA_HOME/include"
8579         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8580         ;;
8582     freebsd*)
8583         JAVAINC="-I$JAVA_HOME/include"
8584         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
8585         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
8586         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8587         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8588         ;;
8590     k*bsd*-gnu*)
8591         JAVAINC="-I$JAVA_HOME/include"
8592         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8593         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8594         ;;
8596     linux-gnu*)
8597         JAVAINC="-I$JAVA_HOME/include"
8598         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8599         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8600         ;;
8602     *netbsd*)
8603         JAVAINC="-I$JAVA_HOME/include"
8604         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
8605         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8606        ;;
8608     openbsd*)
8609         JAVAINC="-I$JAVA_HOME/include"
8610         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
8611         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8612         ;;
8614     solaris*)
8615         JAVAINC="-I$JAVA_HOME/include"
8616         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
8617         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8618         ;;
8619     esac
8621 SOLARINC="$SOLARINC $JAVAINC"
8623 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8624     JAVA_HOME_FOR_BUILD=$JAVA_HOME
8625     JAVAIFLAGS_FOR_BUILD=$JAVAIFLAGS
8626     JDK_FOR_BUILD=$JDK
8629 AC_SUBST(JAVACFLAGS)
8630 AC_SUBST(JAVACOMPILER)
8631 AC_SUBST(JAVAINTERPRETER)
8632 AC_SUBST(JAVAIFLAGS)
8633 AC_SUBST(JAVAIFLAGS_FOR_BUILD)
8634 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
8635 AC_SUBST(JAVA_HOME)
8636 AC_SUBST(JAVA_HOME_FOR_BUILD)
8637 AC_SUBST(JDK)
8638 AC_SUBST(JDK_FOR_BUILD)
8639 AC_SUBST(JAVA_SOURCE_VER)
8640 AC_SUBST(JAVA_TARGET_VER)
8643 dnl ===================================================================
8644 dnl Export file validation
8645 dnl ===================================================================
8646 AC_MSG_CHECKING([whether to enable export file validation])
8647 if test "$with_export_validation" != "no"; then
8648     if test -z "$ENABLE_JAVA"; then
8649         if test "$with_export_validation" = "yes"; then
8650             AC_MSG_ERROR([requested, but Java is disabled])
8651         else
8652             AC_MSG_RESULT([no, as Java is disabled])
8653         fi
8654     elif ! test -d "${SRC_ROOT}/schema"; then
8655         if test "$with_export_validation" = "yes"; then
8656             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
8657         else
8658             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
8659         fi
8660     else
8661         AC_MSG_RESULT([yes])
8662         AC_DEFINE(HAVE_EXPORT_VALIDATION)
8664         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
8665         if test -z "$ODFVALIDATOR"; then
8666             # remember to download the ODF toolkit with validator later
8667             AC_MSG_NOTICE([no odfvalidator found, will download it])
8668             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
8669             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
8671             # and fetch name of odfvalidator jar name from download.lst
8672             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
8673             AC_SUBST(ODFVALIDATOR_JAR)
8675             if test -z "$ODFVALIDATOR_JAR"; then
8676                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
8677             fi
8678         fi
8679         if test "$build_os" = "cygwin"; then
8680             # In case of Cygwin it will be executed from Windows,
8681             # so we need to run bash and absolute path to validator
8682             # so instead of "odfvalidator" it will be
8683             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
8684             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
8685         else
8686             ODFVALIDATOR="sh $ODFVALIDATOR"
8687         fi
8688         AC_SUBST(ODFVALIDATOR)
8691         AC_PATH_PROGS(OFFICEOTRON, officeotron)
8692         if test -z "$OFFICEOTRON"; then
8693             # remember to download the officeotron with validator later
8694             AC_MSG_NOTICE([no officeotron found, will download it])
8695             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
8696             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
8698             # and fetch name of officeotron jar name from download.lst
8699             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
8700             AC_SUBST(OFFICEOTRON_JAR)
8702             if test -z "$OFFICEOTRON_JAR"; then
8703                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
8704             fi
8705         else
8706             # check version of existing officeotron
8707             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
8708             if test 0"$OFFICEOTRON_VER" -lt 704; then
8709                 AC_MSG_ERROR([officeotron too old])
8710             fi
8711         fi
8712         if test "$build_os" = "cygwin"; then
8713             # In case of Cygwin it will be executed from Windows,
8714             # so we need to run bash and absolute path to validator
8715             # so instead of "odfvalidator" it will be
8716             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
8717             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
8718         else
8719             OFFICEOTRON="sh $OFFICEOTRON"
8720         fi
8721     fi
8722     AC_SUBST(OFFICEOTRON)
8723 else
8724     AC_MSG_RESULT([no])
8727 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
8728 if test "$with_bffvalidator" != "no"; then
8729     AC_DEFINE(HAVE_BFFVALIDATOR)
8731     if test "$with_export_validation" = "no"; then
8732         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
8733     fi
8735     if test "$with_bffvalidator" = "yes"; then
8736         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
8737     else
8738         BFFVALIDATOR="$with_bffvalidator"
8739     fi
8741     if test "$build_os" = "cygwin"; then
8742         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
8743             AC_MSG_RESULT($BFFVALIDATOR)
8744         else
8745             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8746         fi
8747     elif test -n "$BFFVALIDATOR"; then
8748         # We are not in Cygwin but need to run Windows binary with wine
8749         AC_PATH_PROGS(WINE, wine)
8751         # so swap in a shell wrapper that converts paths transparently
8752         BFFVALIDATOR_EXE="$BFFVALIDATOR"
8753         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
8754         AC_SUBST(BFFVALIDATOR_EXE)
8755         AC_MSG_RESULT($BFFVALIDATOR)
8756     else
8757         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8758     fi
8759     AC_SUBST(BFFVALIDATOR)
8760 else
8761     AC_MSG_RESULT([no])
8764 dnl ===================================================================
8765 dnl Check for C preprocessor to use
8766 dnl ===================================================================
8767 AC_MSG_CHECKING([which C preprocessor to use in idlc])
8768 if test -n "$with_idlc_cpp"; then
8769     AC_MSG_RESULT([$with_idlc_cpp])
8770     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
8771 else
8772     AC_MSG_RESULT([ucpp])
8773     AC_MSG_CHECKING([which ucpp tp use])
8774     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
8775         AC_MSG_RESULT([external])
8776         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
8777     else
8778         AC_MSG_RESULT([internal])
8779         BUILD_TYPE="$BUILD_TYPE UCPP"
8780     fi
8782 AC_SUBST(SYSTEM_UCPP)
8784 dnl ===================================================================
8785 dnl Check for epm (not needed for Windows)
8786 dnl ===================================================================
8787 AC_MSG_CHECKING([whether to enable EPM for packing])
8788 if test "$enable_epm" = "yes"; then
8789     AC_MSG_RESULT([yes])
8790     if test "$_os" != "WINNT"; then
8791         if test $_os = Darwin; then
8792             EPM=internal
8793         elif test -n "$with_epm"; then
8794             EPM=$with_epm
8795         else
8796             AC_PATH_PROG(EPM, epm, no)
8797         fi
8798         if test "$EPM" = "no" -o "$EPM" = "internal"; then
8799             AC_MSG_NOTICE([EPM will be built.])
8800             BUILD_TYPE="$BUILD_TYPE EPM"
8801             EPM=${WORKDIR}/UnpackedTarball/epm/epm
8802         else
8803             # Gentoo has some epm which is something different...
8804             AC_MSG_CHECKING([whether the found epm is the right epm])
8805             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
8806                 AC_MSG_RESULT([yes])
8807             else
8808                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8809             fi
8810             AC_MSG_CHECKING([epm version])
8811             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
8812             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
8813                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
8814                 AC_MSG_RESULT([OK, >= 3.7])
8815             else
8816                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
8817                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8818             fi
8819         fi
8820     fi
8822     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
8823         AC_MSG_CHECKING([for rpm])
8824         for a in "$RPM" rpmbuild rpm; do
8825             $a --usage >/dev/null 2> /dev/null
8826             if test $? -eq 0; then
8827                 RPM=$a
8828                 break
8829             else
8830                 $a --version >/dev/null 2> /dev/null
8831                 if test $? -eq 0; then
8832                     RPM=$a
8833                     break
8834                 fi
8835             fi
8836         done
8837         if test -z "$RPM"; then
8838             AC_MSG_ERROR([not found])
8839         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
8840             RPM_PATH=`which $RPM`
8841             AC_MSG_RESULT([$RPM_PATH])
8842             SCPDEFS="$SCPDEFS -DWITH_RPM"
8843         else
8844             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
8845         fi
8846     fi
8847     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
8848         AC_PATH_PROG(DPKG, dpkg, no)
8849         if test "$DPKG" = "no"; then
8850             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
8851         fi
8852     fi
8853     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
8854        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8855         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
8856             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
8857                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
8858                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
8859                     AC_MSG_RESULT([yes])
8860                 else
8861                     AC_MSG_RESULT([no])
8862                     if echo "$PKGFORMAT" | $GREP -q rpm; then
8863                         _pt="rpm"
8864                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
8865                         add_warning "the rpms will need to be installed with --nodeps"
8866                     else
8867                         _pt="pkg"
8868                     fi
8869                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
8870                     add_warning "the ${_pt}s will not be relocatable"
8871                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
8872                                  relocation will work, you need to patch your epm with the
8873                                  patch in epm/epm-3.7.patch or build with
8874                                  --with-epm=internal which will build a suitable epm])
8875                 fi
8876             fi
8877         fi
8878     fi
8879     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8880         AC_PATH_PROG(PKGMK, pkgmk, no)
8881         if test "$PKGMK" = "no"; then
8882             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
8883         fi
8884     fi
8885     AC_SUBST(RPM)
8886     AC_SUBST(DPKG)
8887     AC_SUBST(PKGMK)
8888 else
8889     for i in $PKGFORMAT; do
8890         case "$i" in
8891         aix | bsd | deb | pkg | rpm | native | portable)
8892             AC_MSG_ERROR(
8893                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
8894             ;;
8895         esac
8896     done
8897     AC_MSG_RESULT([no])
8898     EPM=NO
8900 AC_SUBST(EPM)
8902 ENABLE_LWP=
8903 if test "$enable_lotuswordpro" = "yes"; then
8904     ENABLE_LWP="TRUE"
8906 AC_SUBST(ENABLE_LWP)
8908 dnl ===================================================================
8909 dnl Check for building ODK
8910 dnl ===================================================================
8911 if test "$enable_odk" != yes; then
8912     unset DOXYGEN
8913 else
8914     if test "$with_doxygen" = no; then
8915         AC_MSG_CHECKING([for doxygen])
8916         unset DOXYGEN
8917         AC_MSG_RESULT([no])
8918     else
8919         if test "$with_doxygen" = yes; then
8920             AC_PATH_PROG([DOXYGEN], [doxygen])
8921             if test -z "$DOXYGEN"; then
8922                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
8923             fi
8924             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
8925                 if ! dot -V 2>/dev/null; then
8926                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
8927                 fi
8928             fi
8929         else
8930             AC_MSG_CHECKING([for doxygen])
8931             DOXYGEN=$with_doxygen
8932             AC_MSG_RESULT([$DOXYGEN])
8933         fi
8934         if test -n "$DOXYGEN"; then
8935             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
8936             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
8937             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
8938                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
8939             fi
8940         fi
8941     fi
8943 AC_SUBST([DOXYGEN])
8945 AC_MSG_CHECKING([whether to build the ODK])
8946 if test "$enable_odk" = yes; then
8947     AC_MSG_RESULT([yes])
8948     BUILD_TYPE="$BUILD_TYPE ODK"
8949 else
8950     AC_MSG_RESULT([no])
8953 dnl ===================================================================
8954 dnl Check for system zlib
8955 dnl ===================================================================
8956 if test "$with_system_zlib" = "auto"; then
8957     case "$_os" in
8958     WINNT)
8959         with_system_zlib="$with_system_libs"
8960         ;;
8961     *)
8962         if test "$enable_fuzzers" != "yes"; then
8963             with_system_zlib=yes
8964         else
8965             with_system_zlib=no
8966         fi
8967         ;;
8968     esac
8971 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8972 dnl and has no pkg-config for it at least on some tinderboxes,
8973 dnl so leaving that out for now
8974 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8975 AC_MSG_CHECKING([which zlib to use])
8976 if test "$with_system_zlib" = "yes"; then
8977     AC_MSG_RESULT([external])
8978     SYSTEM_ZLIB=TRUE
8979     AC_CHECK_HEADER(zlib.h, [],
8980         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8981     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8982         [AC_MSG_ERROR(zlib not found or functional)], [])
8983 else
8984     AC_MSG_RESULT([internal])
8985     SYSTEM_ZLIB=
8986     BUILD_TYPE="$BUILD_TYPE ZLIB"
8987     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8988     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8990 AC_SUBST(ZLIB_CFLAGS)
8991 AC_SUBST(ZLIB_LIBS)
8992 AC_SUBST(SYSTEM_ZLIB)
8994 dnl ===================================================================
8995 dnl Check for system jpeg
8996 dnl ===================================================================
8997 AC_MSG_CHECKING([which libjpeg to use])
8998 if test "$with_system_jpeg" = "yes"; then
8999     AC_MSG_RESULT([external])
9000     SYSTEM_LIBJPEG=TRUE
9001     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
9002         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
9003     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
9004         [AC_MSG_ERROR(jpeg library not found or functional)], [])
9005 else
9006     SYSTEM_LIBJPEG=
9007     AC_MSG_RESULT([internal, libjpeg-turbo])
9008     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
9009     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
9010     if test "$COM" = "MSC"; then
9011         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
9012     else
9013         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
9014     fi
9016     case "$host_cpu" in
9017     x86_64 | amd64 | i*86 | x86 | ia32)
9018         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
9019         if test -z "$NASM" -a "$build_os" = "cygwin"; then
9020             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
9021                 NASM="$LODE_HOME/opt/bin/nasm"
9022             elif test -x "/opt/lo/bin/nasm"; then
9023                 NASM="/opt/lo/bin/nasm"
9024             fi
9025         fi
9027         if test -n "$NASM"; then
9028             AC_MSG_CHECKING([for object file format of host system])
9029             case "$host_os" in
9030               cygwin* | mingw* | pw32* | wsl*)
9031                 case "$host_cpu" in
9032                   x86_64)
9033                     objfmt='Win64-COFF'
9034                     ;;
9035                   *)
9036                     objfmt='Win32-COFF'
9037                     ;;
9038                 esac
9039               ;;
9040               msdosdjgpp* | go32*)
9041                 objfmt='COFF'
9042               ;;
9043               os2-emx*) # not tested
9044                 objfmt='MSOMF' # obj
9045               ;;
9046               linux*coff* | linux*oldld*)
9047                 objfmt='COFF' # ???
9048               ;;
9049               linux*aout*)
9050                 objfmt='a.out'
9051               ;;
9052               linux*)
9053                 case "$host_cpu" in
9054                   x86_64)
9055                     objfmt='ELF64'
9056                     ;;
9057                   *)
9058                     objfmt='ELF'
9059                     ;;
9060                 esac
9061               ;;
9062               kfreebsd* | freebsd* | netbsd* | openbsd*)
9063                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
9064                   objfmt='BSD-a.out'
9065                 else
9066                   case "$host_cpu" in
9067                     x86_64 | amd64)
9068                       objfmt='ELF64'
9069                       ;;
9070                     *)
9071                       objfmt='ELF'
9072                       ;;
9073                   esac
9074                 fi
9075               ;;
9076               solaris* | sunos* | sysv* | sco*)
9077                 case "$host_cpu" in
9078                   x86_64)
9079                     objfmt='ELF64'
9080                     ;;
9081                   *)
9082                     objfmt='ELF'
9083                     ;;
9084                 esac
9085               ;;
9086               darwin* | rhapsody* | nextstep* | openstep* | macos*)
9087                 case "$host_cpu" in
9088                   x86_64)
9089                     objfmt='Mach-O64'
9090                     ;;
9091                   *)
9092                     objfmt='Mach-O'
9093                     ;;
9094                 esac
9095               ;;
9096               *)
9097                 objfmt='ELF ?'
9098               ;;
9099             esac
9101             AC_MSG_RESULT([$objfmt])
9102             if test "$objfmt" = 'ELF ?'; then
9103               objfmt='ELF'
9104               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
9105             fi
9107             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
9108             case "$objfmt" in
9109               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
9110               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
9111               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
9112               COFF)       NAFLAGS='-fcoff -DCOFF';;
9113               a.out)      NAFLAGS='-faout -DAOUT';;
9114               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
9115               ELF)        NAFLAGS='-felf -DELF';;
9116               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
9117               RDF)        NAFLAGS='-frdf -DRDF';;
9118               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
9119               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
9120             esac
9121             AC_MSG_RESULT([$NAFLAGS])
9123             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
9124             cat > conftest.asm << EOF
9125             [%line __oline__ "configure"
9126                     section .text
9127                     global  _main,main
9128             _main:
9129             main:   xor     eax,eax
9130                     ret
9131             ]
9133             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
9134             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
9135               AC_MSG_RESULT(yes)
9136             else
9137               echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
9138               cat conftest.asm >&AS_MESSAGE_LOG_FD
9139               rm -rf conftest*
9140               AC_MSG_RESULT(no)
9141               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
9142               NASM=""
9143             fi
9145         fi
9147         if test -z "$NASM"; then
9148 cat << _EOS
9149 ****************************************************************************
9150 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
9151 To get one please:
9153 _EOS
9154             if test "$build_os" = "cygwin"; then
9155 cat << _EOS
9156 install a pre-compiled binary for Win32
9158 mkdir -p /opt/lo/bin
9159 cd /opt/lo/bin
9160 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
9161 chmod +x nasm
9163 or get and install one from http://www.nasm.us/
9165 Then re-run autogen.sh
9167 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
9168 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
9170 _EOS
9171             else
9172 cat << _EOS
9173 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
9175 _EOS
9176             fi
9177             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
9178             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
9179         fi
9180       ;;
9181     esac
9184 AC_SUBST(NASM)
9185 AC_SUBST(LIBJPEG_CFLAGS)
9186 AC_SUBST(LIBJPEG_LIBS)
9187 AC_SUBST(SYSTEM_LIBJPEG)
9189 dnl ===================================================================
9190 dnl Check for system clucene
9191 dnl ===================================================================
9192 dnl we should rather be using
9193 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
9194 dnl but the contribs-lib check seems tricky
9195 AC_MSG_CHECKING([which clucene to use])
9196 if test "$with_system_clucene" = "yes"; then
9197     AC_MSG_RESULT([external])
9198     SYSTEM_CLUCENE=TRUE
9199     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
9200     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
9201     FilterLibs "${CLUCENE_LIBS}"
9202     CLUCENE_LIBS="${filteredlibs}"
9203     AC_LANG_PUSH([C++])
9204     save_CXXFLAGS=$CXXFLAGS
9205     save_CPPFLAGS=$CPPFLAGS
9206     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
9207     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
9208     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
9209     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
9210     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
9211                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
9212     CXXFLAGS=$save_CXXFLAGS
9213     CPPFLAGS=$save_CPPFLAGS
9214     AC_LANG_POP([C++])
9216     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
9217 else
9218     AC_MSG_RESULT([internal])
9219     SYSTEM_CLUCENE=
9220     BUILD_TYPE="$BUILD_TYPE CLUCENE"
9222 AC_SUBST(SYSTEM_CLUCENE)
9223 AC_SUBST(CLUCENE_CFLAGS)
9224 AC_SUBST(CLUCENE_LIBS)
9226 dnl ===================================================================
9227 dnl Check for system expat
9228 dnl ===================================================================
9229 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
9231 dnl ===================================================================
9232 dnl Check for system xmlsec
9233 dnl ===================================================================
9234 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
9236 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
9237 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
9238     ENABLE_EOT="TRUE"
9239     AC_DEFINE([ENABLE_EOT])
9240     AC_MSG_RESULT([yes])
9242     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
9243 else
9244     ENABLE_EOT=
9245     AC_MSG_RESULT([no])
9247 AC_SUBST([ENABLE_EOT])
9249 dnl ===================================================================
9250 dnl Check for DLP libs
9251 dnl ===================================================================
9252 AS_IF([test "$COM" = "MSC"],
9253       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
9254       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
9256 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
9258 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
9260 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
9262 AS_IF([test "$COM" = "MSC"],
9263       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
9264       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
9266 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
9268 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
9270 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
9271 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.12])
9273 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
9275 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
9277 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
9279 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
9280 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.19])
9282 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
9283 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.10])
9285 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
9287 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
9288 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
9290 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
9292 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
9294 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
9296 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
9298 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
9299 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.7])
9301 dnl ===================================================================
9302 dnl Check for system lcms2
9303 dnl ===================================================================
9304 if test "$with_system_lcms2" != "yes"; then
9305     SYSTEM_LCMS2=
9307 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
9308 if test "$GCC" = "yes"; then
9309     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
9311 if test "$COM" = "MSC"; then # override the above
9312     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
9315 dnl ===================================================================
9316 dnl Check for system cppunit
9317 dnl ===================================================================
9318 if test "$_os" != "Android" ; then
9319     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
9322 dnl ===================================================================
9323 dnl Check whether freetype is available
9324 dnl ===================================================================
9325 if test "$using_freetype_fontconfig" = yes; then
9326     AC_MSG_CHECKING([which freetype to use])
9328 if test "$using_freetype_fontconfig" = yes -a "$test_system_freetype" != no; then
9329     AC_MSG_RESULT([external])
9330     # FreeType has 3 different kinds of versions
9331     # * release, like 2.4.10
9332     # * libtool, like 13.0.7 (this what pkg-config returns)
9333     # * soname
9334     # FreeType's docs/VERSION.DLL provides a table mapping between the three
9335     #
9336     # 9.9.3 is 2.2.0
9337     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
9338     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9339     FilterLibs "${FREETYPE_LIBS}"
9340     FREETYPE_LIBS="${filteredlibs}"
9341     SYSTEM_FREETYPE=TRUE
9342 elif test "$using_freetype_fontconfig" = yes; then
9343     AC_MSG_RESULT([internal])
9344     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
9345     if test "x$ac_config_site_64bit_host" = xYES; then
9346         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
9347     else
9348         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
9349     fi
9350     BUILD_TYPE="$BUILD_TYPE FREETYPE"
9352 AC_SUBST(FREETYPE_CFLAGS)
9353 AC_SUBST(FREETYPE_LIBS)
9354 AC_SUBST([SYSTEM_FREETYPE])
9356 # ===================================================================
9357 # Check for system libxslt
9358 # to prevent incompatibilities between internal libxml2 and external libxslt,
9359 # or vice versa, use with_system_libxml here
9360 # ===================================================================
9361 if test "$with_system_libxml" = "auto"; then
9362     case "$_os" in
9363     WINNT|iOS|Android)
9364         with_system_libxml="$with_system_libs"
9365         ;;
9366     Emscripten)
9367         with_system_libxml=no
9368         ;;
9369     *)
9370         if test "$enable_fuzzers" != "yes"; then
9371             with_system_libxml=yes
9372         else
9373             with_system_libxml=no
9374         fi
9375         ;;
9376     esac
9379 AC_MSG_CHECKING([which libxslt to use])
9380 if test "$with_system_libxml" = "yes"; then
9381     AC_MSG_RESULT([external])
9382     SYSTEM_LIBXSLT=TRUE
9383     if test "$_os" = "Darwin"; then
9384         dnl make sure to use SDK path
9385         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9386         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
9387         dnl omit -L/usr/lib
9388         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
9389         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
9390     else
9391         PKG_CHECK_MODULES(LIBXSLT, libxslt)
9392         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9393         FilterLibs "${LIBXSLT_LIBS}"
9394         LIBXSLT_LIBS="${filteredlibs}"
9395         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
9396         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9397         FilterLibs "${LIBEXSLT_LIBS}"
9398         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
9399     fi
9401     dnl Check for xsltproc
9402     AC_PATH_PROG(XSLTPROC, xsltproc, no)
9403     if test "$XSLTPROC" = "no"; then
9404         AC_MSG_ERROR([xsltproc is required])
9405     fi
9406 else
9407     AC_MSG_RESULT([internal])
9408     SYSTEM_LIBXSLT=
9409     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
9411 AC_SUBST(SYSTEM_LIBXSLT)
9412 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
9413     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
9415 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
9417 AC_SUBST(LIBEXSLT_CFLAGS)
9418 AC_SUBST(LIBEXSLT_LIBS)
9419 AC_SUBST(LIBXSLT_CFLAGS)
9420 AC_SUBST(LIBXSLT_LIBS)
9421 AC_SUBST(XSLTPROC)
9423 # ===================================================================
9424 # Check for system libxml
9425 # ===================================================================
9426 AC_MSG_CHECKING([which libxml to use])
9427 if test "$with_system_libxml" = "yes"; then
9428     AC_MSG_RESULT([external])
9429     SYSTEM_LIBXML=TRUE
9430     if test "$_os" = "Darwin"; then
9431         dnl make sure to use SDK path
9432         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9433         dnl omit -L/usr/lib
9434         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
9435     elif test $_os = iOS; then
9436         dnl make sure to use SDK path
9437         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
9438         LIBXML_CFLAGS="-I$usr/include/libxml2"
9439         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
9440     else
9441         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
9442         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9443         FilterLibs "${LIBXML_LIBS}"
9444         LIBXML_LIBS="${filteredlibs}"
9445     fi
9447     dnl Check for xmllint
9448     AC_PATH_PROG(XMLLINT, xmllint, no)
9449     if test "$XMLLINT" = "no"; then
9450         AC_MSG_ERROR([xmllint is required])
9451     fi
9452 else
9453     AC_MSG_RESULT([internal])
9454     SYSTEM_LIBXML=
9455     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
9456     if test "$COM" = "MSC"; then
9457         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9458     fi
9459     if test "$COM" = "MSC"; then
9460         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
9461     else
9462         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
9463         if test "$_os" = Android; then
9464             LIBXML_LIBS="$LIBXML_LIBS -lm"
9465         fi
9466     fi
9467     BUILD_TYPE="$BUILD_TYPE LIBXML2"
9469 AC_SUBST(SYSTEM_LIBXML)
9470 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
9471     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
9473 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
9474 AC_SUBST(LIBXML_CFLAGS)
9475 AC_SUBST(LIBXML_LIBS)
9476 AC_SUBST(XMLLINT)
9478 # =====================================================================
9479 # Checking for a Python interpreter with version >= 3.3.
9480 # Optionally user can pass an option to configure, i. e.
9481 # ./configure PYTHON=/usr/bin/python
9482 # =====================================================================
9483 if test $_os = Darwin -a "$enable_python" != no -a "$enable_python" != fully-internal -a "$enable_python" != internal -a "$enable_python" != system; then
9484     # Only allowed choices for macOS are 'no', 'internal' (default), and 'fully-internal'
9485     # unless PYTHON is defined as above which allows 'system'
9486     enable_python=internal
9488 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
9489     if test -n "$PYTHON"; then
9490         PYTHON_FOR_BUILD=$PYTHON
9491     else
9492         # This allows a lack of system python with no error, we use internal one in that case.
9493         AM_PATH_PYTHON([3.3],, [:])
9494         # Clean PYTHON_VERSION checked below if cross-compiling
9495         PYTHON_VERSION=""
9496         if test "$PYTHON" != ":"; then
9497             PYTHON_FOR_BUILD=$PYTHON
9498         fi
9499     fi
9501 AC_SUBST(PYTHON_FOR_BUILD)
9503 # Checks for Python to use for Pyuno
9504 AC_MSG_CHECKING([which Python to use for Pyuno])
9505 case "$enable_python" in
9506 no|disable)
9507     if test -z $PYTHON_FOR_BUILD; then
9508         # Python is required to build LibreOffice. In theory we could separate the build-time Python
9509         # requirement from the choice whether to include Python stuff in the installer, but why
9510         # bother?
9511         if test "$cross_compiling" = yes; then
9512             enable_python=system
9513         else
9514             AC_MSG_ERROR([Python is required at build time.])
9515         fi
9516     fi
9517     enable_python=no
9518     AC_MSG_RESULT([none])
9519     ;;
9520 ""|yes|auto)
9521     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
9522         AC_MSG_RESULT([no, overridden by --disable-scripting])
9523         enable_python=no
9524     elif test $build_os = cygwin; then
9525         dnl When building on Windows we don't attempt to use any installed
9526         dnl "system"  Python.
9527         AC_MSG_RESULT([fully internal])
9528         enable_python=internal
9529     elif test "$cross_compiling" = yes; then
9530         AC_MSG_RESULT([system])
9531         enable_python=system
9532     else
9533         # Unset variables set by the above AM_PATH_PYTHON so that
9534         # we actually do check anew.
9535         AC_MSG_RESULT([])
9536         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
9537         AM_PATH_PYTHON([3.3],, [:])
9538         AC_MSG_CHECKING([which Python to use for Pyuno])
9539         if test "$PYTHON" = ":"; then
9540             if test -z "$PYTHON_FOR_BUILD"; then
9541                 AC_MSG_RESULT([fully internal])
9542             else
9543                 AC_MSG_RESULT([internal])
9544             fi
9545             enable_python=internal
9546         else
9547             AC_MSG_RESULT([system])
9548             enable_python=system
9549         fi
9550     fi
9551     ;;
9552 internal)
9553     AC_MSG_RESULT([internal])
9554     ;;
9555 fully-internal)
9556     AC_MSG_RESULT([fully internal])
9557     enable_python=internal
9558     ;;
9559 system)
9560     AC_MSG_RESULT([system])
9561     if test "$_os" = Darwin -a -z "$PYTHON"; then
9562         AC_MSG_ERROR([--enable-python=system doesn't work on macOS because the version provided is obsolete])
9563     fi
9564     ;;
9566     AC_MSG_ERROR([Incorrect --enable-python option])
9567     ;;
9568 esac
9570 if test $enable_python != no; then
9571     BUILD_TYPE="$BUILD_TYPE PYUNO"
9574 if test $enable_python = system; then
9575     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
9576         # Fallback: Accept these in the environment, or as set above
9577         # for MacOSX.
9578         :
9579     elif test "$cross_compiling" != yes; then
9580         # Unset variables set by the above AM_PATH_PYTHON so that
9581         # we actually do check anew.
9582         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
9583         # This causes an error if no python command is found
9584         AM_PATH_PYTHON([3.3])
9585         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
9586         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
9587         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
9588         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
9589         if test -z "$PKG_CONFIG"; then
9590             PYTHON_CFLAGS="-I$python_include"
9591             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
9592         elif $PKG_CONFIG --exists python-$python_version-embed; then
9593             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
9594             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
9595         elif $PKG_CONFIG --exists python-$python_version; then
9596             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
9597             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
9598         else
9599             PYTHON_CFLAGS="-I$python_include"
9600             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
9601         fi
9602         FilterLibs "${PYTHON_LIBS}"
9603         PYTHON_LIBS="${filteredlibs}"
9604     else
9605         dnl How to find out the cross-compilation Python installation path?
9606         AC_MSG_CHECKING([for python version])
9607         AS_IF([test -n "$PYTHON_VERSION"],
9608               [AC_MSG_RESULT([$PYTHON_VERSION])],
9609               [AC_MSG_RESULT([not found])
9610                AC_MSG_ERROR([no usable python found])])
9611         test -n "$PYTHON_CFLAGS" && break
9612     fi
9614     dnl Check if the headers really work
9615     save_CPPFLAGS="$CPPFLAGS"
9616     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
9617     AC_CHECK_HEADER(Python.h)
9618     CPPFLAGS="$save_CPPFLAGS"
9620     # let the PYTHON_FOR_BUILD match the same python installation that
9621     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
9622     # better for PythonTests.
9623     PYTHON_FOR_BUILD=$PYTHON
9626 if test "$with_lxml" != no; then
9627     if test -z "$PYTHON_FOR_BUILD"; then
9628         case $build_os in
9629             cygwin)
9630                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
9631                 ;;
9632             *)
9633                 if test "$cross_compiling" != yes ; then
9634                     BUILD_TYPE="$BUILD_TYPE LXML"
9635                 fi
9636                 ;;
9637         esac
9638     else
9639         AC_MSG_CHECKING([for python lxml])
9640         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
9641             AC_MSG_RESULT([yes])
9642         else
9643             case $build_os in
9644                 cygwin)
9645                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
9646                     ;;
9647                 *)
9648                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
9649                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
9650                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
9651                         else
9652                             BUILD_TYPE="$BUILD_TYPE LXML"
9653                             AC_MSG_RESULT([no, using internal lxml])
9654                         fi
9655                     else
9656                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
9657                     fi
9658                     ;;
9659             esac
9660         fi
9661     fi
9664 dnl By now enable_python should be "system", "internal" or "no"
9665 case $enable_python in
9666 system)
9667     SYSTEM_PYTHON=TRUE
9669     if test "x$ac_cv_header_Python_h" != "xyes"; then
9670        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
9671     fi
9673     AC_LANG_PUSH(C)
9674     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
9675     AC_MSG_CHECKING([for correct python library version])
9676        AC_RUN_IFELSE([AC_LANG_SOURCE([[
9677 #include <Python.h>
9679 int main(int argc, char **argv) {
9680    if ((PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
9681    else return 1;
9683        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3])],[AC_MSG_RESULT([skipped; cross-compiling])])
9684     AC_LANG_POP(C)
9686     dnl FIXME Check if the Python library can be linked with, too?
9687     ;;
9689 internal)
9690     SYSTEM_PYTHON=
9691     PYTHON_VERSION_MAJOR=3
9692     PYTHON_VERSION_MINOR=8
9693     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.10
9694     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
9695         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
9696     fi
9697     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
9698     BUILD_TYPE="$BUILD_TYPE PYTHON"
9699     if test "$OS" = LINUX -o "$OS" = WNT ; then
9700         BUILD_TYPE="$BUILD_TYPE LIBFFI"
9701     fi
9702     # Embedded Python dies without Home set
9703     if test "$HOME" = ""; then
9704         export HOME=""
9705     fi
9706     ;;
9708     DISABLE_PYTHON=TRUE
9709     SYSTEM_PYTHON=
9710     ;;
9712     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
9713     ;;
9714 esac
9716 AC_SUBST(DISABLE_PYTHON)
9717 AC_SUBST(SYSTEM_PYTHON)
9718 AC_SUBST(PYTHON_CFLAGS)
9719 AC_SUBST(PYTHON_LIBS)
9720 AC_SUBST(PYTHON_VERSION)
9721 AC_SUBST(PYTHON_VERSION_MAJOR)
9722 AC_SUBST(PYTHON_VERSION_MINOR)
9724 AC_MSG_CHECKING([whether to build LibreLogo])
9725 case "$enable_python" in
9726 no|disable)
9727     AC_MSG_RESULT([no; Python disabled])
9728     ;;
9730     if test "${enable_librelogo}" = "no"; then
9731         AC_MSG_RESULT([no])
9732     else
9733         AC_MSG_RESULT([yes])
9734         BUILD_TYPE="${BUILD_TYPE} LIBRELOGO"
9735         AC_DEFINE([ENABLE_LIBRELOGO],1)
9736     fi
9737     ;;
9738 esac
9739 AC_SUBST(ENABLE_LIBRELOGO)
9741 ENABLE_MARIADBC=
9742 MARIADBC_MAJOR=1
9743 MARIADBC_MINOR=0
9744 MARIADBC_MICRO=2
9745 AC_MSG_CHECKING([whether to build the MariaDB/MySQL SDBC driver])
9746 if test "x$enable_mariadb_sdbc" != "xno" -a "$enable_mpl_subset" != "yes"; then
9747     ENABLE_MARIADBC=TRUE
9748     AC_MSG_RESULT([yes])
9749     BUILD_TYPE="$BUILD_TYPE MARIADBC"
9750 else
9751     AC_MSG_RESULT([no])
9753 AC_SUBST(ENABLE_MARIADBC)
9754 AC_SUBST(MARIADBC_MAJOR)
9755 AC_SUBST(MARIADBC_MINOR)
9756 AC_SUBST(MARIADBC_MICRO)
9758 if test "$ENABLE_MARIADBC" = "TRUE"; then
9759     dnl ===================================================================
9760     dnl Check for system MariaDB
9761     dnl ===================================================================
9762     AC_MSG_CHECKING([which MariaDB to use])
9763     if test "$with_system_mariadb" = "yes"; then
9764         AC_MSG_RESULT([external])
9765         SYSTEM_MARIADB_CONNECTOR_C=TRUE
9766         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
9767         if test -z "$MARIADBCONFIG"; then
9768             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
9769             if test -z "$MARIADBCONFIG"; then
9770                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
9771                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
9772             fi
9773         fi
9774         AC_MSG_CHECKING([MariaDB version])
9775         MARIADB_VERSION=`$MARIADBCONFIG --version`
9776         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
9777         if test "$MARIADB_MAJOR" -ge "5"; then
9778             AC_MSG_RESULT([OK])
9779         else
9780             AC_MSG_ERROR([too old, use 5.0.x or later])
9781         fi
9782         AC_MSG_CHECKING([for MariaDB Client library])
9783         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
9784         if test "$COM_IS_CLANG" = TRUE; then
9785             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
9786         fi
9787         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
9788         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
9789         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
9790         dnl linux32:
9791         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
9792             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
9793             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
9794                 | sed -e 's|/lib64/|/lib/|')
9795         fi
9796         FilterLibs "${MARIADB_LIBS}"
9797         MARIADB_LIBS="${filteredlibs}"
9798         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
9799         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
9800         if test "$enable_bundle_mariadb" = "yes"; then
9801             AC_MSG_RESULT([yes])
9802             BUNDLE_MARIADB_CONNECTOR_C=TRUE
9803             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
9805 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
9807 /g' | grep -E '(mysqlclient|mariadb)')
9808             if test "$_os" = "Darwin"; then
9809                 LIBMARIADB=${LIBMARIADB}.dylib
9810             elif test "$_os" = "WINNT"; then
9811                 LIBMARIADB=${LIBMARIADB}.dll
9812             else
9813                 LIBMARIADB=${LIBMARIADB}.so
9814             fi
9815             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
9816             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
9817             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
9818                 AC_MSG_RESULT([found.])
9819                 PathFormat "$LIBMARIADB_PATH"
9820                 LIBMARIADB_PATH="$formatted_path"
9821             else
9822                 AC_MSG_ERROR([not found.])
9823             fi
9824         else
9825             AC_MSG_RESULT([no])
9826             BUNDLE_MARIADB_CONNECTOR_C=
9827         fi
9828     else
9829         AC_MSG_RESULT([internal])
9830         SYSTEM_MARIADB_CONNECTOR_C=
9831         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
9832         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
9833         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
9834     fi
9836     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
9837     AC_SUBST(MARIADB_CFLAGS)
9838     AC_SUBST(MARIADB_LIBS)
9839     AC_SUBST(LIBMARIADB)
9840     AC_SUBST(LIBMARIADB_PATH)
9841     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
9844 dnl ===================================================================
9845 dnl Check for system hsqldb
9846 dnl ===================================================================
9847 if test "$with_java" != "no" -a "$cross_compiling" != "yes"; then
9848     HSQLDB_USE_JDBC_4_1=
9849     AC_MSG_CHECKING([which hsqldb to use])
9850     if test "$with_system_hsqldb" = "yes"; then
9851         AC_MSG_RESULT([external])
9852         SYSTEM_HSQLDB=TRUE
9853         if test -z $HSQLDB_JAR; then
9854             HSQLDB_JAR=/usr/share/java/hsqldb.jar
9855         fi
9856         if ! test -f $HSQLDB_JAR; then
9857                AC_MSG_ERROR(hsqldb.jar not found.)
9858         fi
9859         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
9860         export HSQLDB_JAR
9861         if $PERL -e \
9862            'use Archive::Zip;
9863             my $file = "$ENV{'HSQLDB_JAR'}";
9864             my $zip = Archive::Zip->new( $file );
9865             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
9866             if ( $mf =~ m/Specification-Version: 1.8.*/ )
9867             {
9868                 push @l, split(/\n/, $mf);
9869                 foreach my $line (@l)
9870                 {
9871                     if ($line =~ m/Specification-Version:/)
9872                     {
9873                         ($t, $version) = split (/:/,$line);
9874                         $version =~ s/^\s//;
9875                         ($a, $b, $c, $d) = split (/\./,$version);
9876                         if ($c == "0" && $d > "8")
9877                         {
9878                             exit 0;
9879                         }
9880                         else
9881                         {
9882                             exit 1;
9883                         }
9884                     }
9885                 }
9886             }
9887             else
9888             {
9889                 exit 1;
9890             }'; then
9891             AC_MSG_RESULT([yes])
9892         else
9893             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
9894         fi
9895     else
9896         AC_MSG_RESULT([internal])
9897         SYSTEM_HSQLDB=
9898         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9899         NEED_ANT=TRUE
9900         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
9901         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
9902         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
9903             AC_MSG_RESULT([yes])
9904             HSQLDB_USE_JDBC_4_1=TRUE
9905         else
9906             AC_MSG_RESULT([no])
9907         fi
9908     fi
9909 else
9910     if test "$with_java" != "no" -a -z "$HSQLDB_JAR"; then
9911         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9912     fi
9914 AC_SUBST(SYSTEM_HSQLDB)
9915 AC_SUBST(HSQLDB_JAR)
9916 AC_SUBST([HSQLDB_USE_JDBC_4_1])
9918 dnl ===================================================================
9919 dnl Check for PostgreSQL stuff
9920 dnl ===================================================================
9921 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
9922 if test "x$enable_postgresql_sdbc" != "xno"; then
9923     AC_MSG_RESULT([yes])
9924     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
9926     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
9927         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
9928     fi
9929     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
9930         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
9931     fi
9933     postgres_interface=""
9934     if test "$with_system_postgresql" = "yes"; then
9935         postgres_interface="external PostgreSQL"
9936         SYSTEM_POSTGRESQL=TRUE
9937         if test "$_os" = Darwin; then
9938             supp_path=''
9939             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
9940                 pg_supp_path="$P_SEP$d$pg_supp_path"
9941             done
9942         fi
9943         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
9944         if test -n "$PGCONFIG"; then
9945             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
9946             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
9947         else
9948             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
9949               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
9950               POSTGRESQL_LIB=$POSTGRESQL_LIBS
9951             ],[
9952               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
9953             ])
9954         fi
9955         FilterLibs "${POSTGRESQL_LIB}"
9956         POSTGRESQL_LIB="${filteredlibs}"
9957     else
9958         # if/when anything else than PostgreSQL uses Kerberos,
9959         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
9960         WITH_KRB5=
9961         WITH_GSSAPI=
9962         case "$_os" in
9963         Darwin)
9964             # macOS has system MIT Kerberos 5 since 10.4
9965             if test "$with_krb5" != "no"; then
9966                 WITH_KRB5=TRUE
9967                 save_LIBS=$LIBS
9968                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
9969                 # that the libraries where these functions are located on macOS will change, is it?
9970                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9971                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9972                 KRB5_LIBS=$LIBS
9973                 LIBS=$save_LIBS
9974                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9975                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9976                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9977                 LIBS=$save_LIBS
9978             fi
9979             if test "$with_gssapi" != "no"; then
9980                 WITH_GSSAPI=TRUE
9981                 save_LIBS=$LIBS
9982                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9983                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9984                 GSSAPI_LIBS=$LIBS
9985                 LIBS=$save_LIBS
9986             fi
9987             ;;
9988         WINNT)
9989             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
9990                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
9991             fi
9992             ;;
9993         Linux|GNU|*BSD|DragonFly)
9994             if test "$with_krb5" != "no"; then
9995                 WITH_KRB5=TRUE
9996                 save_LIBS=$LIBS
9997                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9998                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9999                 KRB5_LIBS=$LIBS
10000                 LIBS=$save_LIBS
10001                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10002                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10003                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10004                 LIBS=$save_LIBS
10005             fi
10006             if test "$with_gssapi" != "no"; then
10007                 WITH_GSSAPI=TRUE
10008                 save_LIBS=$LIBS
10009                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10010                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10011                 GSSAPI_LIBS=$LIBS
10012                 LIBS=$save_LIBS
10013             fi
10014             ;;
10015         *)
10016             if test "$with_krb5" = "yes"; then
10017                 WITH_KRB5=TRUE
10018                 save_LIBS=$LIBS
10019                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10020                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10021                 KRB5_LIBS=$LIBS
10022                 LIBS=$save_LIBS
10023                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10024                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10025                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10026                 LIBS=$save_LIBS
10027             fi
10028             if test "$with_gssapi" = "yes"; then
10029                 WITH_GSSAPI=TRUE
10030                 save_LIBS=$LIBS
10031                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10032                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10033                 LIBS=$save_LIBS
10034                 GSSAPI_LIBS=$LIBS
10035             fi
10036         esac
10038         if test -n "$with_libpq_path"; then
10039             SYSTEM_POSTGRESQL=TRUE
10040             postgres_interface="external libpq"
10041             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
10042             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
10043         else
10044             SYSTEM_POSTGRESQL=
10045             postgres_interface="internal"
10046             POSTGRESQL_LIB=""
10047             POSTGRESQL_INC="%OVERRIDE_ME%"
10048             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
10049         fi
10050     fi
10052     AC_MSG_CHECKING([PostgreSQL C interface])
10053     AC_MSG_RESULT([$postgres_interface])
10055     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
10056         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
10057         save_CFLAGS=$CFLAGS
10058         save_CPPFLAGS=$CPPFLAGS
10059         save_LIBS=$LIBS
10060         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
10061         LIBS="${LIBS} ${POSTGRESQL_LIB}"
10062         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
10063         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
10064             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
10065         CFLAGS=$save_CFLAGS
10066         CPPFLAGS=$save_CPPFLAGS
10067         LIBS=$save_LIBS
10068     fi
10069     BUILD_POSTGRESQL_SDBC=TRUE
10070 else
10071     AC_MSG_RESULT([no])
10073 AC_SUBST(WITH_KRB5)
10074 AC_SUBST(WITH_GSSAPI)
10075 AC_SUBST(GSSAPI_LIBS)
10076 AC_SUBST(KRB5_LIBS)
10077 AC_SUBST(BUILD_POSTGRESQL_SDBC)
10078 AC_SUBST(SYSTEM_POSTGRESQL)
10079 AC_SUBST(POSTGRESQL_INC)
10080 AC_SUBST(POSTGRESQL_LIB)
10082 dnl ===================================================================
10083 dnl Check for Firebird stuff
10084 dnl ===================================================================
10085 ENABLE_FIREBIRD_SDBC=
10086 if test "$enable_firebird_sdbc" = "yes" ; then
10087     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
10089     dnl ===================================================================
10090     dnl Check for system Firebird
10091     dnl ===================================================================
10092     AC_MSG_CHECKING([which Firebird to use])
10093     if test "$with_system_firebird" = "yes"; then
10094         AC_MSG_RESULT([external])
10095         SYSTEM_FIREBIRD=TRUE
10096         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
10097         if test -z "$FIREBIRDCONFIG"; then
10098             AC_MSG_NOTICE([No fb_config -- using pkg-config])
10099             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
10100                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
10101             ])
10102             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
10103         else
10104             AC_MSG_NOTICE([fb_config found])
10105             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
10106             AC_MSG_CHECKING([for Firebird Client library])
10107             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
10108             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
10109             FilterLibs "${FIREBIRD_LIBS}"
10110             FIREBIRD_LIBS="${filteredlibs}"
10111         fi
10112         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
10113         AC_MSG_CHECKING([Firebird version])
10114         if test -n "${FIREBIRD_VERSION}"; then
10115             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
10116             if test "$FIREBIRD_MAJOR" -ge "3"; then
10117                 AC_MSG_RESULT([OK])
10118             else
10119                 AC_MSG_ERROR([Ensure firebird >= 3 is installed])
10120             fi
10121         else
10122             save_CFLAGS="${CFLAGS}"
10123             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
10124             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
10125 #if defined(FB_API_VER) && FB_API_VER == 30
10126 int fb_api_is_30(void) { return 0; }
10127 #else
10128 #error "Wrong Firebird API version"
10129 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
10130             CFLAGS="$save_CFLAGS"
10131         fi
10132         ENABLE_FIREBIRD_SDBC=TRUE
10133         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10134     elif test "$enable_database_connectivity" = no; then
10135         AC_MSG_RESULT([none])
10136     elif test "$cross_compiling" = "yes"; then
10137         AC_MSG_RESULT([none])
10138     else
10139         dnl Embedded Firebird has version 3.0
10140         dnl We need libatomic_ops for any non X86/X64 system
10141         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
10142             dnl ===================================================================
10143             dnl Check for system libatomic_ops
10144             dnl ===================================================================
10145             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[LIBATOMIC_OPS],[atomic_ops >= 0.7.2])
10146             if test "$with_system_libatomic_ops" = "yes"; then
10147                 SYSTEM_LIBATOMIC_OPS=TRUE
10148                 AC_CHECK_HEADERS(atomic_ops.h, [],
10149                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
10150             else
10151                 SYSTEM_LIBATOMIC_OPS=
10152                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
10153                 LIBATOMIC_OPS_LIBS="-latomic_ops"
10154                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
10155             fi
10156         fi
10158         AC_MSG_RESULT([internal])
10159         SYSTEM_FIREBIRD=
10160         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
10161         FIREBIRD_LIBS="-lfbclient"
10163         if test "$with_system_libtommath" = "yes"; then
10164             SYSTEM_LIBTOMMATH=TRUE
10165             dnl check for tommath presence
10166             save_LIBS=$LIBS
10167             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
10168             AC_CHECK_LIB(tommath, mp_init, LIBTOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
10169             LIBS=$save_LIBS
10170         else
10171             SYSTEM_LIBTOMMATH=
10172             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
10173             LIBTOMMATH_LIBS="-ltommath"
10174             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
10175         fi
10177         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
10178         ENABLE_FIREBIRD_SDBC=TRUE
10179         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10180     fi
10182 AC_SUBST(ENABLE_FIREBIRD_SDBC)
10183 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
10184 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
10185 AC_SUBST(LIBATOMIC_OPS_LIBS)
10186 AC_SUBST(SYSTEM_FIREBIRD)
10187 AC_SUBST(FIREBIRD_CFLAGS)
10188 AC_SUBST(FIREBIRD_LIBS)
10189 AC_SUBST(SYSTEM_LIBTOMMATH)
10190 AC_SUBST(LIBTOMMATH_CFLAGS)
10191 AC_SUBST(LIBTOMMATH_LIBS)
10193 dnl ===================================================================
10194 dnl Check for system curl
10195 dnl ===================================================================
10196 AC_MSG_CHECKING([which libcurl to use])
10197 if test "$with_system_curl" = "auto"; then
10198     with_system_curl="$with_system_libs"
10201 if test "$test_curl" = "yes" -a "$enable_curl" = "yes" -a "$with_system_curl" = "yes"; then
10202     AC_MSG_RESULT([external])
10203     SYSTEM_CURL=TRUE
10205     # First try PKGCONFIG and then fall back
10206     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
10208     if test -n "$CURL_PKG_ERRORS"; then
10209         AC_PATH_PROG(CURLCONFIG, curl-config)
10210         if test -z "$CURLCONFIG"; then
10211             AC_MSG_ERROR([curl development files not found])
10212         fi
10213         CURL_LIBS=`$CURLCONFIG --libs`
10214         FilterLibs "${CURL_LIBS}"
10215         CURL_LIBS="${filteredlibs}"
10216         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
10217         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
10219         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
10220         case $curl_version in
10221         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
10222         dnl so they need to be doubled to end up in the configure script
10223         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
10224             AC_MSG_RESULT([yes])
10225             ;;
10226         *)
10227             AC_MSG_ERROR([no, you have $curl_version])
10228             ;;
10229         esac
10230     fi
10232     ENABLE_CURL=TRUE
10233 elif test "$test_curl" = "no"; then
10234     AC_MSG_RESULT([none])
10235 else
10236     AC_MSG_RESULT([internal])
10237     SYSTEM_CURL=
10238     BUILD_TYPE="$BUILD_TYPE CURL"
10239     ENABLE_CURL=TRUE
10241 AC_SUBST(SYSTEM_CURL)
10242 AC_SUBST(CURL_CFLAGS)
10243 AC_SUBST(CURL_LIBS)
10244 AC_SUBST(ENABLE_CURL)
10246 dnl ===================================================================
10247 dnl Check for system boost
10248 dnl ===================================================================
10249 AC_MSG_CHECKING([which boost to use])
10250 if test "$with_system_boost" = "yes"; then
10251     AC_MSG_RESULT([external])
10252     SYSTEM_BOOST=TRUE
10253     AX_BOOST_BASE([1.66],,[AC_MSG_ERROR([no suitable Boost found])])
10254     AX_BOOST_DATE_TIME
10255     AX_BOOST_FILESYSTEM
10256     AX_BOOST_IOSTREAMS
10257     AX_BOOST_LOCALE
10258     AC_LANG_PUSH([C++])
10259     save_CXXFLAGS=$CXXFLAGS
10260     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
10261     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
10262        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
10263     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
10264        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
10265     CXXFLAGS=$save_CXXFLAGS
10266     AC_LANG_POP([C++])
10267     # this is in m4/ax_boost_base.m4
10268     FilterLibs "${BOOST_LDFLAGS}"
10269     BOOST_LDFLAGS="${filteredlibs}"
10270 else
10271     AC_MSG_RESULT([internal])
10272     BUILD_TYPE="$BUILD_TYPE BOOST"
10273     SYSTEM_BOOST=
10274     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
10275         # use warning-suppressing wrapper headers
10276         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
10277     else
10278         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
10279     fi
10281 AC_SUBST(SYSTEM_BOOST)
10283 dnl ===================================================================
10284 dnl Check for system mdds
10285 dnl ===================================================================
10286 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
10288 dnl ===================================================================
10289 dnl Check for system glm
10290 dnl ===================================================================
10291 AC_MSG_CHECKING([which glm to use])
10292 if test "$with_system_glm" = "yes"; then
10293     AC_MSG_RESULT([external])
10294     SYSTEM_GLM=TRUE
10295     AC_LANG_PUSH([C++])
10296     AC_CHECK_HEADER([glm/glm.hpp], [],
10297        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
10298     AC_LANG_POP([C++])
10299 else
10300     AC_MSG_RESULT([internal])
10301     BUILD_TYPE="$BUILD_TYPE GLM"
10302     SYSTEM_GLM=
10303     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
10305 AC_SUBST([GLM_CFLAGS])
10306 AC_SUBST([SYSTEM_GLM])
10308 dnl ===================================================================
10309 dnl Check for system odbc
10310 dnl ===================================================================
10311 AC_MSG_CHECKING([which odbc headers to use])
10312 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
10313     AC_MSG_RESULT([external])
10314     SYSTEM_ODBC_HEADERS=TRUE
10316     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
10317         save_CPPFLAGS=$CPPFLAGS
10318         find_winsdk
10319         PathFormat "$winsdktest"
10320         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"
10321         AC_CHECK_HEADER(sqlext.h, [],
10322             [AC_MSG_ERROR(odbc not found. install odbc)],
10323             [#include <windows.h>])
10324         CPPFLAGS=$save_CPPFLAGS
10325     else
10326         AC_CHECK_HEADER(sqlext.h, [],
10327             [AC_MSG_ERROR(odbc not found. install odbc)],[])
10328     fi
10329 elif test "$enable_database_connectivity" = no; then
10330     AC_MSG_RESULT([none])
10331 else
10332     AC_MSG_RESULT([internal])
10333     SYSTEM_ODBC_HEADERS=
10335 AC_SUBST(SYSTEM_ODBC_HEADERS)
10337 dnl ===================================================================
10338 dnl Check for system NSS
10339 dnl ===================================================================
10340 if test "$enable_fuzzers" != "yes" -a "$enable_nss" = "yes"; then
10341     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
10342     AC_DEFINE(HAVE_FEATURE_NSS)
10343     ENABLE_NSS=TRUE
10344 elif test $_os != iOS ; then
10345     with_tls=openssl
10347 AC_SUBST(ENABLE_NSS)
10349 dnl ===================================================================
10350 dnl Enable LDAP support
10351 dnl ===================================================================
10353 if test "$test_openldap" = yes; then
10354     AC_MSG_CHECKING([whether to enable LDAP support])
10355     if test "$enable_ldap" = yes -a \( "$ENABLE_NSS" = TRUE -o "$with_system_openldap" = yes \); then
10356         AC_MSG_RESULT([yes])
10357         ENABLE_LDAP=TRUE
10358     else
10359         if test "$enable_ldap" != "yes"; then
10360             AC_MSG_RESULT([no])
10361         else
10362             AC_MSG_RESULT([no (needs NSS or system openldap)])
10363         fi
10364     fi
10366 dnl ===================================================================
10367 dnl Check for system openldap
10368 dnl ===================================================================
10370     if test "$ENABLE_LDAP" = TRUE; then
10371         AC_MSG_CHECKING([which openldap library to use])
10372         if test "$with_system_openldap" = yes; then
10373             AC_MSG_RESULT([external])
10374             SYSTEM_OPENLDAP=TRUE
10375             AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
10376             AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10377             AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10378         else
10379             AC_MSG_RESULT([internal])
10380             BUILD_TYPE="$BUILD_TYPE OPENLDAP"
10381         fi
10382     fi
10385 AC_SUBST(ENABLE_LDAP)
10386 AC_SUBST(SYSTEM_OPENLDAP)
10388 dnl ===================================================================
10389 dnl Check for TLS/SSL and cryptographic implementation to use
10390 dnl ===================================================================
10391 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
10392 if test -n "$with_tls"; then
10393     case $with_tls in
10394     openssl)
10395         AC_DEFINE(USE_TLS_OPENSSL)
10396         TLS=OPENSSL
10397         AC_MSG_RESULT([$TLS])
10399         if test "$enable_openssl" != "yes"; then
10400             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
10401         fi
10403         # warn that OpenSSL has been selected but not all TLS code has this option
10404         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
10405         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
10406         ;;
10407     nss)
10408         AC_DEFINE(USE_TLS_NSS)
10409         TLS=NSS
10410         AC_MSG_RESULT([$TLS])
10411         ;;
10412     no)
10413         AC_MSG_RESULT([none])
10414         AC_MSG_WARN([Skipping TLS/SSL])
10415         ;;
10416     *)
10417         AC_MSG_RESULT([])
10418         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
10419 openssl - OpenSSL
10420 nss - Mozilla's Network Security Services (NSS)
10421     ])
10422         ;;
10423     esac
10424 else
10425     # default to using NSS, it results in smaller oox lib
10426     AC_DEFINE(USE_TLS_NSS)
10427     TLS=NSS
10428     AC_MSG_RESULT([$TLS])
10430 AC_SUBST(TLS)
10432 dnl ===================================================================
10433 dnl Check for system sane
10434 dnl ===================================================================
10435 AC_MSG_CHECKING([which sane header to use])
10436 if test "$with_system_sane" = "yes"; then
10437     AC_MSG_RESULT([external])
10438     AC_CHECK_HEADER(sane/sane.h, [],
10439       [AC_MSG_ERROR(sane not found. install sane)], [])
10440 else
10441     AC_MSG_RESULT([internal])
10442     BUILD_TYPE="$BUILD_TYPE SANE"
10445 dnl ===================================================================
10446 dnl Check for system icu
10447 dnl ===================================================================
10448 SYSTEM_GENBRK=
10449 SYSTEM_GENCCODE=
10450 SYSTEM_GENCMN=
10452 ICU_MAJOR=69
10453 ICU_MINOR=1
10454 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
10455 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
10456 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
10457 AC_MSG_CHECKING([which icu to use])
10458 if test "$with_system_icu" = "yes"; then
10459     AC_MSG_RESULT([external])
10460     SYSTEM_ICU=TRUE
10461     AC_LANG_PUSH([C++])
10462     AC_MSG_CHECKING([for unicode/rbbi.h])
10463     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
10464     AC_LANG_POP([C++])
10466     if test "$cross_compiling" != "yes"; then
10467         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
10468         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
10469         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
10470         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
10471     fi
10473     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
10474         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
10475         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
10476         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
10477         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
10478         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
10479             AC_MSG_RESULT([yes])
10480         else
10481             AC_MSG_RESULT([no])
10482             if test "$with_system_icu_for_build" != "force"; then
10483                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
10484 You can use --with-system-icu-for-build=force to use it anyway.])
10485             fi
10486         fi
10487     fi
10489     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
10490         # using the system icu tools can lead to version confusion, use the
10491         # ones from the build environment when cross-compiling
10492         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
10493         if test -z "$SYSTEM_GENBRK"; then
10494             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
10495         fi
10496         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
10497         if test -z "$SYSTEM_GENCCODE"; then
10498             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
10499         fi
10500         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
10501         if test -z "$SYSTEM_GENCMN"; then
10502             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
10503         fi
10504         if test "$ICU_MAJOR" -ge "49"; then
10505             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
10506             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
10507             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
10508         else
10509             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
10510             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
10511             ICU_RECLASSIFIED_HEBREW_LETTER=
10512         fi
10513     fi
10515     if test "$cross_compiling" = "yes"; then
10516         if test "$ICU_MAJOR" -ge "50"; then
10517             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
10518             ICU_MINOR=""
10519         fi
10520     fi
10521 else
10522     AC_MSG_RESULT([internal])
10523     SYSTEM_ICU=
10524     BUILD_TYPE="$BUILD_TYPE ICU"
10525     # surprisingly set these only for "internal" (to be used by various other
10526     # external libs): the system icu-config is quite unhelpful and spits out
10527     # dozens of weird flags and also default path -I/usr/include
10528     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
10529     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
10531 if test "$ICU_MAJOR" -ge "59"; then
10532     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
10533     # with -std=c++11 but not all external libraries can be built with that,
10534     # for those use a bit-compatible typedef uint16_t UChar; see
10535     # icu/source/common/unicode/umachine.h
10536     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
10537 else
10538     ICU_UCHAR_TYPE=""
10540 AC_SUBST(SYSTEM_ICU)
10541 AC_SUBST(SYSTEM_GENBRK)
10542 AC_SUBST(SYSTEM_GENCCODE)
10543 AC_SUBST(SYSTEM_GENCMN)
10544 AC_SUBST(ICU_MAJOR)
10545 AC_SUBST(ICU_MINOR)
10546 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
10547 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
10548 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
10549 AC_SUBST(ICU_CFLAGS)
10550 AC_SUBST(ICU_LIBS)
10551 AC_SUBST(ICU_UCHAR_TYPE)
10553 dnl ==================================================================
10554 dnl Breakpad
10555 dnl ==================================================================
10556 DEFAULT_CRASHDUMP_VALUE="true"
10557 AC_MSG_CHECKING([whether to enable breakpad])
10558 if test "$enable_breakpad" != yes; then
10559     AC_MSG_RESULT([no])
10560 else
10561     AC_MSG_RESULT([yes])
10562     ENABLE_BREAKPAD="TRUE"
10563     AC_DEFINE(ENABLE_BREAKPAD)
10564     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
10565     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
10567     AC_MSG_CHECKING([for disable crash dump])
10568     if test "$enable_crashdump" = no; then
10569         DEFAULT_CRASHDUMP_VALUE="false"
10570         AC_MSG_RESULT([yes])
10571     else
10572        AC_MSG_RESULT([no])
10573     fi
10575     AC_MSG_CHECKING([for crashreport config])
10576     if test "$with_symbol_config" = "no"; then
10577         BREAKPAD_SYMBOL_CONFIG="invalid"
10578         AC_MSG_RESULT([no])
10579     else
10580         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
10581         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
10582         AC_MSG_RESULT([yes])
10583     fi
10584     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
10586 AC_SUBST(ENABLE_BREAKPAD)
10587 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
10589 dnl ==================================================================
10590 dnl libfuzzer
10591 dnl ==================================================================
10592 AC_MSG_CHECKING([whether to enable fuzzers])
10593 if test "$enable_fuzzers" != yes; then
10594     AC_MSG_RESULT([no])
10595 else
10596     if test $LIB_FUZZING_ENGINE == ""; then
10597       AC_MSG_ERROR(['LIB_FUZZING_ENGINE' must be set when using --enable-fuzzers. Examples include '-fsanitize=fuzzer'.])
10598     fi
10599     AC_MSG_RESULT([yes])
10600     ENABLE_FUZZERS="TRUE"
10601     AC_DEFINE([ENABLE_FUZZERS],1)
10602     BUILD_TYPE="$BUILD_TYPE FUZZERS"
10604 AC_SUBST(LIB_FUZZING_ENGINE)
10605 AC_SUBST(ENABLE_FUZZERS)
10607 dnl ===================================================================
10608 dnl Orcus
10609 dnl ===================================================================
10610 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.16 >= 0.16.0])
10611 if test "$with_system_orcus" != "yes"; then
10612     if test "$SYSTEM_BOOST" = "TRUE"; then
10613         # ===========================================================
10614         # Determine if we are going to need to link with Boost.System
10615         # ===========================================================
10616         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
10617         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
10618         dnl in documentation has no effect.
10619         AC_MSG_CHECKING([if we need to link with Boost.System])
10620         AC_LANG_PUSH([C++])
10621         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
10622                 @%:@include <boost/version.hpp>
10623             ]],[[
10624                 #if BOOST_VERSION >= 105000
10625                 #   error yes, we need to link with Boost.System
10626                 #endif
10627             ]])],[
10628                 AC_MSG_RESULT([no])
10629             ],[
10630                 AC_MSG_RESULT([yes])
10631                 AX_BOOST_SYSTEM
10632         ])
10633         AC_LANG_POP([C++])
10634     fi
10636 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
10637 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
10638 AC_SUBST([BOOST_SYSTEM_LIB])
10639 AC_SUBST(SYSTEM_LIBORCUS)
10641 dnl ===================================================================
10642 dnl HarfBuzz
10643 dnl ===================================================================
10644 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
10645                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
10646                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
10648 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
10649                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
10650                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
10652 if test "$COM" = "MSC"; then # override the above
10653     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
10654     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
10657 if test "$with_system_harfbuzz" = "yes"; then
10658     if test "$with_system_graphite" = "no"; then
10659         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
10660     fi
10661     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
10662     save_LIBS="$LIBS"
10663     save_CFLAGS="$CFLAGS"
10664     LIBS="$LIBS $HARFBUZZ_LIBS"
10665     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
10666     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
10667     LIBS="$save_LIBS"
10668     CFLAGS="$save_CFLAGS"
10669 else
10670     if test "$with_system_graphite" = "yes"; then
10671         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
10672     fi
10675 if test "$USING_X11" = TRUE; then
10676     AC_PATH_X
10677     AC_PATH_XTRA
10678     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
10680     if test -z "$x_includes"; then
10681         x_includes="default_x_includes"
10682     fi
10683     if test -z "$x_libraries"; then
10684         x_libraries="default_x_libraries"
10685     fi
10686     CFLAGS="$CFLAGS $X_CFLAGS"
10687     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
10688     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
10689 else
10690     x_includes="no_x_includes"
10691     x_libraries="no_x_libraries"
10694 if test "$USING_X11" = TRUE; then
10695     dnl ===================================================================
10696     dnl Check for extension headers
10697     dnl ===================================================================
10698     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
10699      [#include <X11/extensions/shape.h>])
10701     # vcl needs ICE and SM
10702     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
10703     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
10704         [AC_MSG_ERROR(ICE library not found)])
10705     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
10706     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
10707         [AC_MSG_ERROR(SM library not found)])
10710 if test "$USING_X11" = TRUE -a "$ENABLE_JAVA" != ""; then
10711     # bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c needs Xt
10712     AC_CHECK_HEADERS(X11/Intrinsic.h,[],[AC_MSG_ERROR([libXt headers not found])])
10715 dnl ===================================================================
10716 dnl Check for system Xrender
10717 dnl ===================================================================
10718 AC_MSG_CHECKING([whether to use Xrender])
10719 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
10720     AC_MSG_RESULT([yes])
10721     PKG_CHECK_MODULES(XRENDER, xrender)
10722     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10723     FilterLibs "${XRENDER_LIBS}"
10724     XRENDER_LIBS="${filteredlibs}"
10725     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
10726       [AC_MSG_ERROR(libXrender not found or functional)], [])
10727     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
10728       [AC_MSG_ERROR(Xrender not found. install X)], [])
10729 else
10730     AC_MSG_RESULT([no])
10732 AC_SUBST(XRENDER_CFLAGS)
10733 AC_SUBST(XRENDER_LIBS)
10735 dnl ===================================================================
10736 dnl Check for XRandr
10737 dnl ===================================================================
10738 AC_MSG_CHECKING([whether to enable RandR support])
10739 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
10740     AC_MSG_RESULT([yes])
10741     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
10742     if test "$ENABLE_RANDR" != "TRUE"; then
10743         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
10744                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
10745         XRANDR_CFLAGS=" "
10746         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
10747           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
10748         XRANDR_LIBS="-lXrandr "
10749         ENABLE_RANDR="TRUE"
10750     fi
10751     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10752     FilterLibs "${XRANDR_LIBS}"
10753     XRANDR_LIBS="${filteredlibs}"
10754 else
10755     ENABLE_RANDR=""
10756     AC_MSG_RESULT([no])
10758 AC_SUBST(XRANDR_CFLAGS)
10759 AC_SUBST(XRANDR_LIBS)
10760 AC_SUBST(ENABLE_RANDR)
10762 if test "$test_webdav" = yes; then
10763     if test -z "$with_webdav"; then
10764         WITH_WEBDAV=neon
10765         if test "$enable_mpl_subset" = yes; then
10766             WITH_WEBDAV=serf
10767         fi
10768     else
10769         WITH_WEBDAV="$with_webdav"
10770     fi
10773 AC_MSG_CHECKING([for webdav library])
10774 case "$WITH_WEBDAV" in
10775 serf)
10776     AC_MSG_RESULT([serf])
10777     # Check for system apr-util
10778     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
10779                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
10780                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
10781     if test "$COM" = "MSC"; then
10782         APR_LIB_DIR="LibR"
10783         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
10784         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
10785     fi
10787     # Check for system serf
10788     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.3.9])
10789     ;;
10790 neon)
10791     AC_MSG_RESULT([neon])
10792     # Check for system neon
10793     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.31.2])
10794     if test "$with_system_neon" = "yes"; then
10795         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
10796     else
10797         NEON_VERSION=0312
10798     fi
10799     AC_SUBST(NEON_VERSION)
10800     ;;
10802     AC_MSG_RESULT([none, disabled])
10803     WITH_WEBDAV=""
10804     ;;
10805 esac
10806 AC_SUBST(WITH_WEBDAV)
10808 dnl ===================================================================
10809 dnl Check for disabling cve_tests
10810 dnl ===================================================================
10811 AC_MSG_CHECKING([whether to execute CVE tests])
10812 # If not explicitly enabled or disabled, default
10813 if test -z "$enable_cve_tests"; then
10814     case "$OS" in
10815     WNT)
10816         # Default cves off for Windows with its wild and wonderful
10817         # variety of AV software kicking in and panicking
10818         enable_cve_tests=no
10819         ;;
10820     *)
10821         # otherwise yes
10822         enable_cve_tests=yes
10823         ;;
10824     esac
10826 if test "$enable_cve_tests" = "no"; then
10827     AC_MSG_RESULT([no])
10828     DISABLE_CVE_TESTS=TRUE
10829     AC_SUBST(DISABLE_CVE_TESTS)
10830 else
10831     AC_MSG_RESULT([yes])
10834 dnl ===================================================================
10835 dnl Check for enabling chart XShape tests
10836 dnl ===================================================================
10837 AC_MSG_CHECKING([whether to execute chart XShape tests])
10838 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
10839     AC_MSG_RESULT([yes])
10840     ENABLE_CHART_TESTS=TRUE
10841     AC_SUBST(ENABLE_CHART_TESTS)
10842 else
10843     AC_MSG_RESULT([no])
10846 dnl ===================================================================
10847 dnl Check for system openssl
10848 dnl ===================================================================
10849 ENABLE_OPENSSL=
10850 AC_MSG_CHECKING([whether to disable OpenSSL usage])
10851 if test "$enable_openssl" = "yes"; then
10852     AC_MSG_RESULT([no])
10853     ENABLE_OPENSSL=TRUE
10854     if test "$_os" = Darwin ; then
10855         # OpenSSL is deprecated when building for 10.7 or later.
10856         #
10857         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
10858         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
10860         with_system_openssl=no
10861         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10862     elif test "$_os" = "FreeBSD" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
10863             && test "$with_system_openssl" != "no"; then
10864         with_system_openssl=yes
10865         SYSTEM_OPENSSL=TRUE
10866         OPENSSL_CFLAGS=
10867         OPENSSL_LIBS="-lssl -lcrypto"
10868     else
10869         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10870     fi
10871     if test "$with_system_openssl" = "yes"; then
10872         AC_MSG_CHECKING([whether openssl supports SHA512])
10873         AC_LANG_PUSH([C])
10874         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
10875             SHA512_CTX context;
10876 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
10877         AC_LANG_POP(C)
10878     fi
10879 else
10880     AC_MSG_RESULT([yes])
10882     # warn that although OpenSSL is disabled, system libraries may depend on it
10883     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
10884     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
10887 AC_SUBST([ENABLE_OPENSSL])
10889 if test "$enable_cipher_openssl_backend" = yes && test "$ENABLE_OPENSSL" != TRUE; then
10890     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
10891         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
10892         enable_cipher_openssl_backend=no
10893     else
10894         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
10895     fi
10897 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
10898 ENABLE_CIPHER_OPENSSL_BACKEND=
10899 if test "$enable_cipher_openssl_backend" = yes; then
10900     AC_MSG_RESULT([yes])
10901     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
10902 else
10903     AC_MSG_RESULT([no])
10905 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
10907 dnl ===================================================================
10908 dnl Select the crypto backends used by LO
10909 dnl ===================================================================
10911 if test "$build_crypto" = yes; then
10912     if test "$OS" = WNT; then
10913         BUILD_TYPE="$BUILD_TYPE CRYPTO_MSCAPI"
10914         AC_DEFINE([USE_CRYPTO_MSCAPI])
10915     elif test "$ENABLE_NSS" = TRUE; then
10916         BUILD_TYPE="$BUILD_TYPE CRYPTO_NSS"
10917         AC_DEFINE([USE_CRYPTO_NSS])
10918     fi
10921 dnl ===================================================================
10922 dnl Check for building gnutls
10923 dnl ===================================================================
10924 AC_MSG_CHECKING([whether to use gnutls])
10925 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
10926     AC_MSG_RESULT([yes])
10927     AM_PATH_LIBGCRYPT()
10928     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
10929         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
10930                       available in the system to use as replacement.]]))
10931     FilterLibs "${LIBGCRYPT_LIBS}"
10932     LIBGCRYPT_LIBS="${filteredlibs}"
10933 else
10934     AC_MSG_RESULT([no])
10937 AC_SUBST([LIBGCRYPT_CFLAGS])
10938 AC_SUBST([LIBGCRYPT_LIBS])
10940 dnl ===================================================================
10941 dnl Check for system redland
10942 dnl ===================================================================
10943 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
10944 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
10945 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
10946 if test "$with_system_redland" = "yes"; then
10947     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
10948             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
10949 else
10950     RAPTOR_MAJOR="0"
10951     RASQAL_MAJOR="3"
10952     REDLAND_MAJOR="0"
10954 AC_SUBST(RAPTOR_MAJOR)
10955 AC_SUBST(RASQAL_MAJOR)
10956 AC_SUBST(REDLAND_MAJOR)
10958 dnl ===================================================================
10959 dnl Check for system hunspell
10960 dnl ===================================================================
10961 AC_MSG_CHECKING([which libhunspell to use])
10962 if test "$with_system_hunspell" = "yes"; then
10963     AC_MSG_RESULT([external])
10964     SYSTEM_HUNSPELL=TRUE
10965     AC_LANG_PUSH([C++])
10966     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
10967     if test "$HUNSPELL_PC" != "TRUE"; then
10968         AC_CHECK_HEADER(hunspell.hxx, [],
10969             [
10970             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
10971             [AC_MSG_ERROR(hunspell headers not found.)], [])
10972             ], [])
10973         AC_CHECK_LIB([hunspell], [main], [:],
10974            [ AC_MSG_ERROR(hunspell library not found.) ], [])
10975         HUNSPELL_LIBS=-lhunspell
10976     fi
10977     AC_LANG_POP([C++])
10978     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10979     FilterLibs "${HUNSPELL_LIBS}"
10980     HUNSPELL_LIBS="${filteredlibs}"
10981 else
10982     AC_MSG_RESULT([internal])
10983     SYSTEM_HUNSPELL=
10984     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
10985     if test "$COM" = "MSC"; then
10986         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
10987     else
10988         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
10989     fi
10990     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
10992 AC_SUBST(SYSTEM_HUNSPELL)
10993 AC_SUBST(HUNSPELL_CFLAGS)
10994 AC_SUBST(HUNSPELL_LIBS)
10996 dnl ===================================================================
10997 dnl Check for system zxing
10998 dnl ===================================================================
10999 AC_MSG_CHECKING([whether to use zxing])
11000 if test "$enable_zxing" = "no"; then
11001     AC_MSG_RESULT([no])
11002     ENABLE_ZXING=
11003     SYSTEM_ZXING=
11004 else
11005     AC_MSG_RESULT([yes])
11006     ENABLE_ZXING=TRUE
11007     AC_MSG_CHECKING([which libzxing to use])
11008     if test "$with_system_zxing" = "yes"; then
11009         AC_MSG_RESULT([external])
11010         SYSTEM_ZXING=TRUE
11011         AC_LANG_PUSH([C++])
11012         AC_CHECK_HEADER(ZXing/MultiFormatWriter.h, [],
11013             [AC_MSG_ERROR(zxing headers not found.)], [#include <stdexcept>])
11014         ZXING_CFLAGS=-I/usr/include/ZXing
11015         AC_CHECK_LIB([ZXing], [main], [ZXING_LIBS=-lZXing],
11016             [ AC_CHECK_LIB([ZXingCore], [main], [ZXING_LIBS=-lZXingCore],
11017             [ AC_MSG_ERROR(zxing C++ library not found.) ])], [])
11018         AC_LANG_POP([C++])
11019         ZXING_CFLAGS=$(printf '%s' "$ZXING_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11020         FilterLibs "${ZXING_LIBS}"
11021         ZXING_LIBS="${filteredlibs}"
11022     else
11023         AC_MSG_RESULT([internal])
11024         SYSTEM_ZXING=
11025         BUILD_TYPE="$BUILD_TYPE ZXING"
11026     fi
11027     if test "$ENABLE_ZXING" = TRUE; then
11028         AC_DEFINE(ENABLE_ZXING)
11029     fi
11031 AC_SUBST(SYSTEM_ZXING)
11032 AC_SUBST(ENABLE_ZXING)
11033 AC_SUBST(ZXING_CFLAGS)
11034 AC_SUBST(ZXING_LIBS)
11036 dnl ===================================================================
11037 dnl Check for system box2d
11038 dnl ===================================================================
11039 AC_MSG_CHECKING([which box2d to use])
11040 if test "$with_system_box2d" = "yes"; then
11041     AC_MSG_RESULT([external])
11042     SYSTEM_BOX2D=TRUE
11043     AC_LANG_PUSH([C++])
11044     AC_CHECK_HEADER(box2d/box2d.h, [BOX2D_H_FOUND='TRUE'],
11045         [BOX2D_H_FOUND='FALSE'])
11046     if test "$BOX2D_H_FOUND" = "TRUE"; then # 2.4.0+
11047         _BOX2D_LIB=box2d
11048         AC_DEFINE(BOX2D_HEADER,<box2d/box2d.h>)
11049     else
11050         # fail this. there's no other alternative to check when we are here.
11051         AC_CHECK_HEADER([Box2D/Box2D.h], [],
11052             [AC_MSG_ERROR(box2d headers not found.)])
11053         _BOX2D_LIB=Box2D
11054         AC_DEFINE(BOX2D_HEADER,<Box2D/Box2D.h>)
11055     fi
11056     AC_CHECK_LIB([$_BOX2D_LIB], [main], [:],
11057         [ AC_MSG_ERROR(box2d library not found.) ], [])
11058     BOX2D_LIBS=-l$_BOX2D_LIB
11059     AC_LANG_POP([C++])
11060     BOX2D_CFLAGS=$(printf '%s' "$BOX2D_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11061     FilterLibs "${BOX2D_LIBS}"
11062     BOX2D_LIBS="${filteredlibs}"
11063 else
11064     AC_MSG_RESULT([internal])
11065     SYSTEM_BOX2D=
11066     BUILD_TYPE="$BUILD_TYPE BOX2D"
11068 AC_SUBST(SYSTEM_BOX2D)
11069 AC_SUBST(BOX2D_CFLAGS)
11070 AC_SUBST(BOX2D_LIBS)
11072 dnl ===================================================================
11073 dnl Checking for altlinuxhyph
11074 dnl ===================================================================
11075 AC_MSG_CHECKING([which altlinuxhyph to use])
11076 if test "$with_system_altlinuxhyph" = "yes"; then
11077     AC_MSG_RESULT([external])
11078     SYSTEM_HYPH=TRUE
11079     AC_CHECK_HEADER(hyphen.h, [],
11080        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
11081     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
11082        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
11083        [#include <hyphen.h>])
11084     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
11085         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11086     if test -z "$HYPHEN_LIB"; then
11087         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
11088            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11089     fi
11090     if test -z "$HYPHEN_LIB"; then
11091         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
11092            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11093     fi
11094 else
11095     AC_MSG_RESULT([internal])
11096     SYSTEM_HYPH=
11097     BUILD_TYPE="$BUILD_TYPE HYPHEN"
11098     if test "$COM" = "MSC"; then
11099         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
11100     else
11101         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
11102     fi
11104 AC_SUBST(SYSTEM_HYPH)
11105 AC_SUBST(HYPHEN_LIB)
11107 dnl ===================================================================
11108 dnl Checking for mythes
11109 dnl ===================================================================
11110 AC_MSG_CHECKING([which mythes to use])
11111 if test "$with_system_mythes" = "yes"; then
11112     AC_MSG_RESULT([external])
11113     SYSTEM_MYTHES=TRUE
11114     AC_LANG_PUSH([C++])
11115     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
11116     if test "$MYTHES_PKGCONFIG" = "no"; then
11117         AC_CHECK_HEADER(mythes.hxx, [],
11118             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
11119         AC_CHECK_LIB([mythes-1.2], [main], [:],
11120             [ MYTHES_FOUND=no], [])
11121     if test "$MYTHES_FOUND" = "no"; then
11122         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
11123                 [ MYTHES_FOUND=no], [])
11124     fi
11125     if test "$MYTHES_FOUND" = "no"; then
11126         AC_MSG_ERROR([mythes library not found!.])
11127     fi
11128     fi
11129     AC_LANG_POP([C++])
11130     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11131     FilterLibs "${MYTHES_LIBS}"
11132     MYTHES_LIBS="${filteredlibs}"
11133 else
11134     AC_MSG_RESULT([internal])
11135     SYSTEM_MYTHES=
11136     BUILD_TYPE="$BUILD_TYPE MYTHES"
11137     if test "$COM" = "MSC"; then
11138         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
11139     else
11140         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
11141     fi
11143 AC_SUBST(SYSTEM_MYTHES)
11144 AC_SUBST(MYTHES_CFLAGS)
11145 AC_SUBST(MYTHES_LIBS)
11147 dnl ===================================================================
11148 dnl How should we build the linear programming solver ?
11149 dnl ===================================================================
11151 ENABLE_COINMP=
11152 AC_MSG_CHECKING([whether to build with CoinMP])
11153 if test "$enable_coinmp" != "no"; then
11154     ENABLE_COINMP=TRUE
11155     AC_MSG_RESULT([yes])
11156     if test "$with_system_coinmp" = "yes"; then
11157         SYSTEM_COINMP=TRUE
11158         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
11159         FilterLibs "${COINMP_LIBS}"
11160         COINMP_LIBS="${filteredlibs}"
11161     else
11162         BUILD_TYPE="$BUILD_TYPE COINMP"
11163     fi
11164 else
11165     AC_MSG_RESULT([no])
11167 AC_SUBST(ENABLE_COINMP)
11168 AC_SUBST(SYSTEM_COINMP)
11169 AC_SUBST(COINMP_CFLAGS)
11170 AC_SUBST(COINMP_LIBS)
11172 ENABLE_LPSOLVE=
11173 AC_MSG_CHECKING([whether to build with lpsolve])
11174 if test "$enable_lpsolve" != "no"; then
11175     ENABLE_LPSOLVE=TRUE
11176     AC_MSG_RESULT([yes])
11177 else
11178     AC_MSG_RESULT([no])
11180 AC_SUBST(ENABLE_LPSOLVE)
11182 if test "$ENABLE_LPSOLVE" = TRUE; then
11183     AC_MSG_CHECKING([which lpsolve to use])
11184     if test "$with_system_lpsolve" = "yes"; then
11185         AC_MSG_RESULT([external])
11186         SYSTEM_LPSOLVE=TRUE
11187         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
11188            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
11189         save_LIBS=$LIBS
11190         # some systems need this. Like Ubuntu...
11191         AC_CHECK_LIB(m, floor)
11192         AC_CHECK_LIB(dl, dlopen)
11193         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
11194             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
11195         LIBS=$save_LIBS
11196     else
11197         AC_MSG_RESULT([internal])
11198         SYSTEM_LPSOLVE=
11199         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
11200     fi
11202 AC_SUBST(SYSTEM_LPSOLVE)
11204 dnl ===================================================================
11205 dnl Checking for libexttextcat
11206 dnl ===================================================================
11207 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
11208 if test "$with_system_libexttextcat" = "yes"; then
11209     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
11211 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
11213 dnl ===================================================================
11214 dnl Checking for libnumbertext
11215 dnl ===================================================================
11216 libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.6])
11217 if test "$with_system_libnumbertext" = "yes"; then
11218     SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
11219     SYSTEM_LIBNUMBERTEXT=YES
11220 else
11221     SYSTEM_LIBNUMBERTEXT=
11222     AC_LANG_PUSH([C++])
11223     save_CPPFLAGS=$CPPFLAGS
11224     CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
11225     AC_CHECK_HEADERS([codecvt regex])
11226     AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
11227             [ LIBNUMBERTEXT_CFLAGS=''
11228               AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
11229                            Enable libnumbertext fallback (missing number to number name conversion).])
11230             ])
11231     CPPFLAGS=$save_CPPFLAGS
11232     AC_LANG_POP([C++])
11234 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
11235 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
11236 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
11238 dnl ***************************************
11239 dnl testing libc version for Linux...
11240 dnl ***************************************
11241 if test "$_os" = "Linux"; then
11242     AC_MSG_CHECKING([whether libc is >= 2.1.1])
11243     exec 6>/dev/null # no output
11244     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
11245     exec 6>&1 # output on again
11246     if test "$HAVE_LIBC"; then
11247         AC_MSG_RESULT([yes])
11248     else
11249         AC_MSG_ERROR([no, upgrade libc])
11250     fi
11253 dnl =========================================
11254 dnl Check for uuidgen
11255 dnl =========================================
11256 if test "$_os" = "WINNT"; then
11257     # we must use the uuidgen from the Windows SDK, which will be in the LO_PATH, but isn't in
11258     # the PATH for AC_PATH_PROG. It is already tested above in the WINDOWS_SDK_HOME check.
11259     UUIDGEN=uuidgen.exe
11260     AC_SUBST(UUIDGEN)
11261 else
11262     AC_PATH_PROG([UUIDGEN], [uuidgen])
11263     if test -z "$UUIDGEN"; then
11264         AC_MSG_WARN([uuid is needed for building installation sets])
11265     fi
11268 dnl ***************************************
11269 dnl Checking for bison and flex
11270 dnl ***************************************
11271 AC_PATH_PROG(BISON, bison)
11272 if test -z "$BISON"; then
11273     AC_MSG_ERROR([no bison found in \$PATH, install it])
11274 else
11275     AC_MSG_CHECKING([the bison version])
11276     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
11277     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
11278     dnl Accept newer than 2.0; for --enable-compiler-plugins at least 2.3 is known to be bad and
11279     dnl cause
11280     dnl
11281     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]
11282     dnl   typedef union YYSTYPE
11283     dnl           ~~~~~~^~~~~~~
11284     dnl
11285     dnl while at least 3.4.1 is know to be good:
11286     if test "$COMPILER_PLUGINS" = TRUE; then
11287         if test "$_bison_longver" -lt 2004; then
11288             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.4+ for --enable-compiler-plugins)])
11289         fi
11290     else
11291         if test "$_bison_longver" -lt 2000; then
11292             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
11293         fi
11294     fi
11296 AC_SUBST([BISON])
11298 AC_PATH_PROG(FLEX, flex)
11299 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11300     FLEX=`cygpath -m $FLEX`
11302 if test -z "$FLEX"; then
11303     AC_MSG_ERROR([no flex found in \$PATH, install it])
11304 else
11305     AC_MSG_CHECKING([the flex version])
11306     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
11307     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
11308         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
11309     fi
11311 AC_SUBST([FLEX])
11312 dnl ***************************************
11313 dnl Checking for patch
11314 dnl ***************************************
11315 AC_PATH_PROG(PATCH, patch)
11316 if test -z "$PATCH"; then
11317     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
11320 dnl On Solaris or macOS, check if --with-gnu-patch was used
11321 if test "$_os" = "SunOS" -o "$_os" = "Darwin"; then
11322     if test -z "$with_gnu_patch"; then
11323         GNUPATCH=$PATCH
11324     else
11325         if test -x "$with_gnu_patch"; then
11326             GNUPATCH=$with_gnu_patch
11327         else
11328             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
11329         fi
11330     fi
11332     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
11333     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
11334         AC_MSG_RESULT([yes])
11335     else
11336         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
11337     fi
11338 else
11339     GNUPATCH=$PATCH
11342 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11343     GNUPATCH=`cygpath -m $GNUPATCH`
11346 dnl We also need to check for --with-gnu-cp
11348 if test -z "$with_gnu_cp"; then
11349     # check the place where the good stuff is hidden on Solaris...
11350     if test -x /usr/gnu/bin/cp; then
11351         GNUCP=/usr/gnu/bin/cp
11352     else
11353         AC_PATH_PROGS(GNUCP, gnucp cp)
11354     fi
11355     if test -z $GNUCP; then
11356         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
11357     fi
11358 else
11359     if test -x "$with_gnu_cp"; then
11360         GNUCP=$with_gnu_cp
11361     else
11362         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
11363     fi
11366 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11367     GNUCP=`cygpath -m $GNUCP`
11370 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
11371 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
11372     AC_MSG_RESULT([yes])
11373 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
11374     AC_MSG_RESULT([yes])
11375 else
11376     case "$build_os" in
11377     darwin*|macos*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
11378         x_GNUCP=[\#]
11379         GNUCP=''
11380         AC_MSG_RESULT([no gnucp found - using the system's cp command])
11381         ;;
11382     *)
11383         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
11384         ;;
11385     esac
11388 AC_SUBST(GNUPATCH)
11389 AC_SUBST(GNUCP)
11390 AC_SUBST(x_GNUCP)
11392 dnl ***************************************
11393 dnl testing assembler path
11394 dnl ***************************************
11395 ML_EXE=""
11396 if test "$_os" = "WINNT"; then
11397     case "$WIN_HOST_ARCH" in
11398     x86) assembler=ml.exe ;;
11399     x64) assembler=ml64.exe ;;
11400     arm64) assembler=armasm64.exe ;;
11401     esac
11403     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
11404     if test -f "$MSVC_HOST_PATH/$assembler"; then
11405         ML_EXE=`win_short_path_for_make "$MSVC_HOST_PATH/$assembler"`
11406         AC_MSG_RESULT([$ML_EXE])
11407     else
11408         AC_MSG_ERROR([not found in $MSVC_HOST_PATH])
11409     fi
11412 AC_SUBST(ML_EXE)
11414 dnl ===================================================================
11415 dnl We need zip and unzip
11416 dnl ===================================================================
11417 AC_PATH_PROG(ZIP, zip)
11418 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
11419 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
11420     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],,)
11423 AC_PATH_PROG(UNZIP, unzip)
11424 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
11426 dnl ===================================================================
11427 dnl Zip must be a specific type for different build types.
11428 dnl ===================================================================
11429 if test $build_os = cygwin; then
11430     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
11431         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
11432     fi
11435 dnl ===================================================================
11436 dnl We need touch with -h option support.
11437 dnl ===================================================================
11438 AC_PATH_PROG(TOUCH, touch)
11439 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
11440 touch "$WARNINGS_FILE"
11441 if ! "$TOUCH" -h "$WARNINGS_FILE" 2>/dev/null > /dev/null; then
11442     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],,)
11445 dnl ===================================================================
11446 dnl Check for system epoxy
11447 dnl ===================================================================
11448 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
11450 dnl ===================================================================
11451 dnl Set vcl option: coordinate device in double or sal_Int32
11452 dnl ===================================================================
11454 dnl disabled for now, we don't want subtle differences between OSs
11455 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
11456 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
11457 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
11458 dnl     AC_MSG_RESULT([double])
11459 dnl else
11460 dnl     AC_MSG_RESULT([sal_Int32])
11461 dnl fi
11463 dnl ===================================================================
11464 dnl Show which vclplugs will be built.
11465 dnl ===================================================================
11466 R=""
11467 if test "$USING_X11" != TRUE; then
11468     enable_gtk3=no
11471 ENABLE_GTK3=""
11472 if test "x$enable_gtk3" = "xyes"; then
11473     ENABLE_GTK3="TRUE"
11474     AC_DEFINE(ENABLE_GTK3)
11475     R="$R gtk3"
11477 AC_SUBST(ENABLE_GTK3)
11479 ENABLE_GTK3_KDE5=""
11480 if test "x$enable_gtk3_kde5" = "xyes"; then
11481     ENABLE_GTK3_KDE5="TRUE"
11482     AC_DEFINE(ENABLE_GTK3_KDE5)
11483     R="$R gtk3_kde5"
11485 AC_SUBST(ENABLE_GTK3_KDE5)
11487 ENABLE_GTK4=""
11488 if test "x$enable_gtk4" = "xyes"; then
11489     ENABLE_GTK4="TRUE"
11490     AC_DEFINE(ENABLE_GTK4)
11491     R="$R gtk4"
11493 AC_SUBST(ENABLE_GTK4)
11495 ENABLE_QT5=""
11496 if test "x$enable_qt5" = "xyes"; then
11497     ENABLE_QT5="TRUE"
11498     AC_DEFINE(ENABLE_QT5)
11499     R="$R qt5"
11501 AC_SUBST(ENABLE_QT5)
11503 ENABLE_KF5=""
11504 if test "x$enable_kf5" = "xyes"; then
11505     ENABLE_KF5="TRUE"
11506     AC_DEFINE(ENABLE_KF5)
11507     R="$R kf5"
11509 AC_SUBST(ENABLE_KF5)
11511 if test "x$USING_X11" = "xyes"; then
11512     R="$R gen"
11515 if test "$_os" = "WINNT"; then
11516     R="$R win"
11517 elif test "$_os" = "Darwin"; then
11518     R="$R osx"
11519 elif test "$_os" = "iOS"; then
11520     R="ios"
11521 elif test "$_os" = Android; then
11522     R="android"
11525 build_vcl_plugins="$R"
11526 if test -z "$build_vcl_plugins"; then
11527     build_vcl_plugins=" none"
11529 AC_MSG_NOTICE([VCLplugs to be built:${build_vcl_plugins}])
11530 VCL_PLUGIN_INFO=$R
11531 AC_SUBST([VCL_PLUGIN_INFO])
11533 dnl ===================================================================
11534 dnl Check for GTK libraries
11535 dnl ===================================================================
11537 GTK3_CFLAGS=""
11538 GTK3_LIBS=""
11539 if test "$test_gtk3" = yes -a "x$enable_gtk3" = "xyes" -o "x$enable_gtk3_kde5" = "xyes"; then
11540     if test "$with_system_cairo" = no; then
11541         add_warning 'Non-system cairo combined with gtk3 is assumed to cause trouble; proceed at your own risk.'
11542     fi
11543     : ${with_system_cairo:=yes}
11544     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)
11545     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11546     GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
11547     FilterLibs "${GTK3_LIBS}"
11548     GTK3_LIBS="${filteredlibs}"
11550     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
11551     if test "$with_system_epoxy" != "yes"; then
11552         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
11553         AC_CHECK_HEADER(EGL/eglplatform.h, [],
11554                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
11555     fi
11557 AC_SUBST(GTK3_LIBS)
11558 AC_SUBST(GTK3_CFLAGS)
11560 GTK4_CFLAGS=""
11561 GTK4_LIBS=""
11562 if test "$test_gtk4" = yes -a "x$enable_gtk4" = "xyes"; then
11563     if test "$with_system_cairo" = no; then
11564         add_warning 'Non-system cairo combined with gtk4 is assumed to cause trouble; proceed at your own risk.'
11565     fi
11566     : ${with_system_cairo:=yes}
11567     PKG_CHECK_MODULES(GTK4, gtk4 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo atk)
11568     GTK4_CFLAGS=$(printf '%s' "$GTK4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11569     GTK4_CFLAGS="$GTK4_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
11570     FilterLibs "${GTK4_LIBS}"
11571     GTK4_LIBS="${filteredlibs}"
11573     dnl We require egl only for the gtk4 plugin. Otherwise we use glx.
11574     if test "$with_system_epoxy" != "yes"; then
11575         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
11576         AC_CHECK_HEADER(EGL/eglplatform.h, [],
11577                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
11578     fi
11580 AC_SUBST(GTK4_LIBS)
11581 AC_SUBST(GTK4_CFLAGS)
11583 if test "$enable_introspection" = yes; then
11584     if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
11585         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
11586     else
11587         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
11588     fi
11591 dnl ===================================================================
11592 dnl check for dbus support
11593 dnl ===================================================================
11594 ENABLE_DBUS=""
11595 DBUS_CFLAGS=""
11596 DBUS_LIBS=""
11597 DBUS_GLIB_CFLAGS=""
11598 DBUS_GLIB_LIBS=""
11599 DBUS_HAVE_GLIB=""
11601 if test "$enable_dbus" = "no"; then
11602     test_dbus=no
11605 AC_MSG_CHECKING([whether to enable DBUS support])
11606 if test "$test_dbus" = "yes"; then
11607     ENABLE_DBUS="TRUE"
11608     AC_MSG_RESULT([yes])
11609     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
11610     AC_DEFINE(ENABLE_DBUS)
11611     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11612     FilterLibs "${DBUS_LIBS}"
11613     DBUS_LIBS="${filteredlibs}"
11615     # Glib is needed for BluetoothServer
11616     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
11617     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
11618         [
11619             DBUS_HAVE_GLIB="TRUE"
11620             AC_DEFINE(DBUS_HAVE_GLIB,1)
11621         ],
11622         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
11623     )
11624 else
11625     AC_MSG_RESULT([no])
11628 AC_SUBST(ENABLE_DBUS)
11629 AC_SUBST(DBUS_CFLAGS)
11630 AC_SUBST(DBUS_LIBS)
11631 AC_SUBST(DBUS_GLIB_CFLAGS)
11632 AC_SUBST(DBUS_GLIB_LIBS)
11633 AC_SUBST(DBUS_HAVE_GLIB)
11635 AC_MSG_CHECKING([whether to enable Impress remote control])
11636 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
11637     AC_MSG_RESULT([yes])
11638     ENABLE_SDREMOTE=TRUE
11639     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
11641     if test $OS = MACOSX && test "$MACOSX_SDK_VERSION" -ge 101500; then
11642         # The Bluetooth code doesn't compile with macOS SDK 10.15
11643         if test "$enable_sdremote_bluetooth" = yes; then
11644             AC_MSG_ERROR([macOS SDK $with_macosx_sdk does not currently support --enable-sdremote-bluetooth])
11645         fi
11646         enable_sdremote_bluetooth=no
11647     fi
11648     # If not explicitly enabled or disabled, default
11649     if test -z "$enable_sdremote_bluetooth"; then
11650         case "$OS" in
11651         LINUX|MACOSX|WNT)
11652             # Default to yes for these
11653             enable_sdremote_bluetooth=yes
11654             ;;
11655         *)
11656             # otherwise no
11657             enable_sdremote_bluetooth=no
11658             ;;
11659         esac
11660     fi
11661     # $enable_sdremote_bluetooth is guaranteed non-empty now
11663     if test "$enable_sdremote_bluetooth" != "no"; then
11664         if test "$OS" = "LINUX"; then
11665             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
11666                 AC_MSG_RESULT([yes])
11667                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
11668                 dnl ===================================================================
11669                 dnl Check for system bluez
11670                 dnl ===================================================================
11671                 AC_MSG_CHECKING([which Bluetooth header to use])
11672                 if test "$with_system_bluez" = "yes"; then
11673                     AC_MSG_RESULT([external])
11674                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
11675                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
11676                     SYSTEM_BLUEZ=TRUE
11677                 else
11678                     AC_MSG_RESULT([internal])
11679                     SYSTEM_BLUEZ=
11680                 fi
11681             else
11682                 AC_MSG_RESULT([no, dbus disabled])
11683                 ENABLE_SDREMOTE_BLUETOOTH=
11684                 SYSTEM_BLUEZ=
11685             fi
11686         else
11687             AC_MSG_RESULT([yes])
11688             ENABLE_SDREMOTE_BLUETOOTH=TRUE
11689             SYSTEM_BLUEZ=
11690         fi
11691     else
11692         AC_MSG_RESULT([no])
11693         ENABLE_SDREMOTE_BLUETOOTH=
11694         SYSTEM_BLUEZ=
11695     fi
11696 else
11697     ENABLE_SDREMOTE=
11698     SYSTEM_BLUEZ=
11699     AC_MSG_RESULT([no])
11701 AC_SUBST(ENABLE_SDREMOTE)
11702 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
11703 AC_SUBST(SYSTEM_BLUEZ)
11705 dnl ===================================================================
11706 dnl Check whether to enable GIO support
11707 dnl ===================================================================
11708 if test "$ENABLE_GTK4" = "TRUE" -o "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
11709     AC_MSG_CHECKING([whether to enable GIO support])
11710     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
11711         dnl Need at least 2.26 for the dbus support.
11712         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
11713                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
11714         if test "$ENABLE_GIO" = "TRUE"; then
11715             AC_DEFINE(ENABLE_GIO)
11716             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11717             FilterLibs "${GIO_LIBS}"
11718             GIO_LIBS="${filteredlibs}"
11719         fi
11720     else
11721         AC_MSG_RESULT([no])
11722     fi
11724 AC_SUBST(ENABLE_GIO)
11725 AC_SUBST(GIO_CFLAGS)
11726 AC_SUBST(GIO_LIBS)
11729 dnl ===================================================================
11731 SPLIT_APP_MODULES=""
11732 if test "$enable_split_app_modules" = "yes"; then
11733     SPLIT_APP_MODULES="TRUE"
11735 AC_SUBST(SPLIT_APP_MODULES)
11737 SPLIT_OPT_FEATURES=""
11738 if test "$enable_split_opt_features" = "yes"; then
11739     SPLIT_OPT_FEATURES="TRUE"
11741 AC_SUBST(SPLIT_OPT_FEATURES)
11743 dnl ===================================================================
11744 dnl Check whether the GStreamer libraries are available.
11745 dnl ===================================================================
11747 ENABLE_GSTREAMER_1_0=""
11749 if test "$test_gstreamer_1_0" = yes; then
11751     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
11752     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
11753         ENABLE_GSTREAMER_1_0="TRUE"
11754         AC_MSG_RESULT([yes])
11755         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
11756         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11757         FilterLibs "${GSTREAMER_1_0_LIBS}"
11758         GSTREAMER_1_0_LIBS="${filteredlibs}"
11759         AC_DEFINE(ENABLE_GSTREAMER_1_0)
11760     else
11761         AC_MSG_RESULT([no])
11762     fi
11764 AC_SUBST(GSTREAMER_1_0_CFLAGS)
11765 AC_SUBST(GSTREAMER_1_0_LIBS)
11766 AC_SUBST(ENABLE_GSTREAMER_1_0)
11768 ENABLE_OPENGL_TRANSITIONS=
11769 ENABLE_OPENGL_CANVAS=
11770 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
11771    : # disable
11772 elif test "$_os" = "Darwin"; then
11773     # We use frameworks on macOS, no need for detail checks
11774     ENABLE_OPENGL_TRANSITIONS=TRUE
11775     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11776     ENABLE_OPENGL_CANVAS=TRUE
11777 elif test $_os = WINNT; then
11778     ENABLE_OPENGL_TRANSITIONS=TRUE
11779     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11780     ENABLE_OPENGL_CANVAS=TRUE
11781 else
11782     if test "$USING_X11" = TRUE; then
11783         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
11784         ENABLE_OPENGL_TRANSITIONS=TRUE
11785         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11786         ENABLE_OPENGL_CANVAS=TRUE
11787     fi
11790 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
11791 AC_SUBST(ENABLE_OPENGL_CANVAS)
11793 dnl =================================================
11794 dnl Check whether to build with OpenCL support.
11795 dnl =================================================
11797 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE" -a "$enable_opencl" = "yes"; then
11798     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
11799     # platform (optional at run-time, used through clew).
11800     BUILD_TYPE="$BUILD_TYPE OPENCL"
11801     AC_DEFINE(HAVE_FEATURE_OPENCL)
11804 dnl =================================================
11805 dnl Check whether to build with dconf support.
11806 dnl =================================================
11808 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
11809     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
11810         if test "$enable_dconf" = yes; then
11811             AC_MSG_ERROR([dconf not found])
11812         else
11813             enable_dconf=no
11814         fi])
11816 AC_MSG_CHECKING([whether to enable dconf])
11817 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
11818     DCONF_CFLAGS=
11819     DCONF_LIBS=
11820     ENABLE_DCONF=
11821     AC_MSG_RESULT([no])
11822 else
11823     ENABLE_DCONF=TRUE
11824     AC_DEFINE(ENABLE_DCONF)
11825     AC_MSG_RESULT([yes])
11827 AC_SUBST([DCONF_CFLAGS])
11828 AC_SUBST([DCONF_LIBS])
11829 AC_SUBST([ENABLE_DCONF])
11831 # pdf import?
11832 AC_MSG_CHECKING([whether to build the PDF import feature])
11833 ENABLE_PDFIMPORT=
11834 if test -z "$enable_pdfimport" -o "$enable_pdfimport" = yes; then
11835     AC_MSG_RESULT([yes])
11836     ENABLE_PDFIMPORT=TRUE
11837     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
11838 else
11839     AC_MSG_RESULT([no])
11842 # Pdfium?
11843 AC_MSG_CHECKING([whether to build PDFium])
11844 ENABLE_PDFIUM=
11845 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
11846     AC_MSG_RESULT([yes])
11847     ENABLE_PDFIUM=TRUE
11848     BUILD_TYPE="$BUILD_TYPE PDFIUM"
11849 else
11850     AC_MSG_RESULT([no])
11852 AC_SUBST(ENABLE_PDFIUM)
11854 dnl ===================================================================
11855 dnl Check for poppler
11856 dnl ===================================================================
11857 ENABLE_POPPLER=
11858 AC_MSG_CHECKING([whether to build Poppler])
11859 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" -a $_os != Android \) -o "$enable_poppler" = yes; then
11860     AC_MSG_RESULT([yes])
11861     ENABLE_POPPLER=TRUE
11862     AC_DEFINE(HAVE_FEATURE_POPPLER)
11863 else
11864     AC_MSG_RESULT([no])
11866 AC_SUBST(ENABLE_POPPLER)
11868 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
11869     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
11872 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
11873     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
11876 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
11877     dnl ===================================================================
11878     dnl Check for system poppler
11879     dnl ===================================================================
11880     AC_MSG_CHECKING([which PDF import poppler to use])
11881     if test "$with_system_poppler" = "yes"; then
11882         AC_MSG_RESULT([external])
11883         SYSTEM_POPPLER=TRUE
11884         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
11885         AC_LANG_PUSH([C++])
11886         save_CXXFLAGS=$CXXFLAGS
11887         save_CPPFLAGS=$CPPFLAGS
11888         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
11889         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
11890         AC_CHECK_HEADER([cpp/poppler-version.h],
11891             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
11892             [])
11893         CXXFLAGS=$save_CXXFLAGS
11894         CPPFLAGS=$save_CPPFLAGS
11895         AC_LANG_POP([C++])
11896         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11898         FilterLibs "${POPPLER_LIBS}"
11899         POPPLER_LIBS="${filteredlibs}"
11900     else
11901         AC_MSG_RESULT([internal])
11902         SYSTEM_POPPLER=
11903         BUILD_TYPE="$BUILD_TYPE POPPLER"
11904         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
11905     fi
11906     AC_DEFINE([ENABLE_PDFIMPORT],1)
11908 AC_SUBST(ENABLE_PDFIMPORT)
11909 AC_SUBST(SYSTEM_POPPLER)
11910 AC_SUBST(POPPLER_CFLAGS)
11911 AC_SUBST(POPPLER_LIBS)
11913 # Skia?
11914 AC_MSG_CHECKING([whether to build Skia])
11915 ENABLE_SKIA=
11916 if test "$enable_skia" != "no" -a "$build_skia" = "yes" -a -z "$DISABLE_GUI"; then
11917     if test "$enable_skia" = "debug"; then
11918         AC_MSG_RESULT([yes (debug)])
11919         ENABLE_SKIA_DEBUG=TRUE
11920     else
11921         AC_MSG_RESULT([yes])
11922         ENABLE_SKIA_DEBUG=
11923     fi
11924     ENABLE_SKIA=TRUE
11925     AC_DEFINE(HAVE_FEATURE_SKIA)
11926     BUILD_TYPE="$BUILD_TYPE SKIA"
11927 else
11928     AC_MSG_RESULT([no])
11930 AC_SUBST(ENABLE_SKIA)
11931 AC_SUBST(ENABLE_SKIA_DEBUG)
11933 LO_CLANG_CXXFLAGS_INTRINSICS_SSE2=
11934 LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3=
11935 LO_CLANG_CXXFLAGS_INTRINSICS_SSE41=
11936 LO_CLANG_CXXFLAGS_INTRINSICS_SSE42=
11937 LO_CLANG_CXXFLAGS_INTRINSICS_AVX=
11938 LO_CLANG_CXXFLAGS_INTRINSICS_AVX2=
11939 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512=
11940 LO_CLANG_CXXFLAGS_INTRINSICS_F16C=
11941 LO_CLANG_CXXFLAGS_INTRINSICS_FMA=
11942 HAVE_LO_CLANG_DLLEXPORTINLINES=
11944 if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE -a ! \( "$_os" = "WINNT" -a "$CPUNAME" = "AARCH64" \); then
11945     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
11946         AC_MSG_CHECKING([for Clang])
11947         AC_MSG_RESULT([$LO_CLANG_CC / $LO_CLANG_CXX])
11948     else
11949         if test "$_os" = "WINNT"; then
11950             AC_MSG_CHECKING([for clang-cl])
11951             if test -x "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"; then
11952                 LO_CLANG_CC=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"`
11953                 dnl explicitly set -m32/-m64
11954                 LO_CLANG_CC="$LO_CLANG_CC -m$WIN_HOST_BITS"
11955                 LO_CLANG_CXX="$LO_CLANG_CC"
11956                 AC_MSG_RESULT([$LO_CLANG_CC])
11957             else
11958                 AC_MSG_RESULT([no])
11959             fi
11960         else
11961             AC_CHECK_PROG(LO_CLANG_CC,clang,clang,[])
11962             AC_CHECK_PROG(LO_CLANG_CXX,clang++,clang++,[])
11963         fi
11964     fi
11965     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
11966         clang2_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $LO_CLANG_CC -E - | tail -1 | sed 's/ //g'`
11967         clang2_ver=`echo "$clang2_version" | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
11968         if test "$clang2_ver" -lt 50002; then
11969             AC_MSG_WARN(["$clang2_version" is too old or unrecognized, must be at least Clang 5.0.2])
11970             LO_CLANG_CC=
11971             LO_CLANG_CXX=
11972         fi
11973     fi
11974     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX" -a "$_os" = "WINNT"; then
11975         save_CXX="$CXX"
11976         CXX="$LO_CLANG_CXX"
11977         AC_MSG_CHECKING([whether $CXX supports -Zc:dllexportInlines-])
11978         AC_LANG_PUSH([C++])
11979         save_CXXFLAGS=$CXXFLAGS
11980         CXXFLAGS="$CXXFLAGS -Werror -Zc:dllexportInlines-"
11981         AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
11982                 HAVE_LO_CLANG_DLLEXPORTINLINES=TRUE
11983                 AC_MSG_RESULT([yes])
11984             ], [AC_MSG_RESULT([no])])
11985         CXXFLAGS=$save_CXXFLAGS
11986         AC_LANG_POP([C++])
11987         CXX="$save_CXX"
11988         if test -z "$HAVE_LO_CLANG_DLLEXPORTINLINES"; then
11989             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.])
11990         fi
11991     fi
11992     if test -z "$LO_CLANG_CC" -o -z "$LO_CLANG_CXX"; then
11993         # Skia is the default on Windows, so hard-require Clang.
11994         # Elsewhere it's used just by the 'gen' VCL backend which is rarely used.
11995         if test "$_os" = "WINNT"; then
11996             AC_MSG_ERROR([Clang compiler not found. The Skia library needs to be built using Clang.])
11997         else
11998             AC_MSG_WARN([Clang compiler not found.])
11999         fi
12000     else
12002         save_CXX="$CXX"
12003         CXX="$LO_CLANG_CXX"
12004         # copy&paste (and adjust) of intrinsics checks, since MSVC's -arch doesn't work well for Clang-cl
12005         flag_sse2=-msse2
12006         flag_ssse3=-mssse3
12007         flag_sse41=-msse4.1
12008         flag_sse42=-msse4.2
12009         flag_avx=-mavx
12010         flag_avx2=-mavx2
12011         flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
12012         flag_f16c=-mf16c
12013         flag_fma=-mfma
12015         AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
12016         AC_LANG_PUSH([C++])
12017         save_CXXFLAGS=$CXXFLAGS
12018         CXXFLAGS="$CXXFLAGS $flag_sse2"
12019         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12020             #include <emmintrin.h>
12021             int main () {
12022                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12023                 c = _mm_xor_si128 (a, b);
12024                 return 0;
12025             }
12026             ])],
12027             [can_compile_sse2=yes],
12028             [can_compile_sse2=no])
12029         AC_LANG_POP([C++])
12030         CXXFLAGS=$save_CXXFLAGS
12031         AC_MSG_RESULT([${can_compile_sse2}])
12032         if test "${can_compile_sse2}" = "yes" ; then
12033             LO_CLANG_CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
12034         fi
12036         AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
12037         AC_LANG_PUSH([C++])
12038         save_CXXFLAGS=$CXXFLAGS
12039         CXXFLAGS="$CXXFLAGS $flag_ssse3"
12040         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12041             #include <tmmintrin.h>
12042             int main () {
12043                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12044                 c = _mm_maddubs_epi16 (a, b);
12045                 return 0;
12046             }
12047             ])],
12048             [can_compile_ssse3=yes],
12049             [can_compile_ssse3=no])
12050         AC_LANG_POP([C++])
12051         CXXFLAGS=$save_CXXFLAGS
12052         AC_MSG_RESULT([${can_compile_ssse3}])
12053         if test "${can_compile_ssse3}" = "yes" ; then
12054             LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
12055         fi
12057         AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
12058         AC_LANG_PUSH([C++])
12059         save_CXXFLAGS=$CXXFLAGS
12060         CXXFLAGS="$CXXFLAGS $flag_sse41"
12061         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12062             #include <smmintrin.h>
12063             int main () {
12064                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12065                 c = _mm_cmpeq_epi64 (a, b);
12066                 return 0;
12067             }
12068             ])],
12069             [can_compile_sse41=yes],
12070             [can_compile_sse41=no])
12071         AC_LANG_POP([C++])
12072         CXXFLAGS=$save_CXXFLAGS
12073         AC_MSG_RESULT([${can_compile_sse41}])
12074         if test "${can_compile_sse41}" = "yes" ; then
12075             LO_CLANG_CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
12076         fi
12078         AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
12079         AC_LANG_PUSH([C++])
12080         save_CXXFLAGS=$CXXFLAGS
12081         CXXFLAGS="$CXXFLAGS $flag_sse42"
12082         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12083             #include <nmmintrin.h>
12084             int main () {
12085                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12086                 c = _mm_cmpgt_epi64 (a, b);
12087                 return 0;
12088             }
12089             ])],
12090             [can_compile_sse42=yes],
12091             [can_compile_sse42=no])
12092         AC_LANG_POP([C++])
12093         CXXFLAGS=$save_CXXFLAGS
12094         AC_MSG_RESULT([${can_compile_sse42}])
12095         if test "${can_compile_sse42}" = "yes" ; then
12096             LO_CLANG_CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
12097         fi
12099         AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
12100         AC_LANG_PUSH([C++])
12101         save_CXXFLAGS=$CXXFLAGS
12102         CXXFLAGS="$CXXFLAGS $flag_avx"
12103         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12104             #include <immintrin.h>
12105             int main () {
12106                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
12107                 c = _mm256_xor_ps(a, b);
12108                 return 0;
12109             }
12110             ])],
12111             [can_compile_avx=yes],
12112             [can_compile_avx=no])
12113         AC_LANG_POP([C++])
12114         CXXFLAGS=$save_CXXFLAGS
12115         AC_MSG_RESULT([${can_compile_avx}])
12116         if test "${can_compile_avx}" = "yes" ; then
12117             LO_CLANG_CXXFLAGS_INTRINSICS_AVX="$flag_avx"
12118         fi
12120         AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
12121         AC_LANG_PUSH([C++])
12122         save_CXXFLAGS=$CXXFLAGS
12123         CXXFLAGS="$CXXFLAGS $flag_avx2"
12124         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12125             #include <immintrin.h>
12126             int main () {
12127                 __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
12128                 c = _mm256_maddubs_epi16(a, b);
12129                 return 0;
12130             }
12131             ])],
12132             [can_compile_avx2=yes],
12133             [can_compile_avx2=no])
12134         AC_LANG_POP([C++])
12135         CXXFLAGS=$save_CXXFLAGS
12136         AC_MSG_RESULT([${can_compile_avx2}])
12137         if test "${can_compile_avx2}" = "yes" ; then
12138             LO_CLANG_CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
12139         fi
12141         AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
12142         AC_LANG_PUSH([C++])
12143         save_CXXFLAGS=$CXXFLAGS
12144         CXXFLAGS="$CXXFLAGS $flag_avx512"
12145         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12146             #include <immintrin.h>
12147             int main () {
12148                 __m512i a = _mm512_loadu_si512(0);
12149                 return 0;
12150             }
12151             ])],
12152             [can_compile_avx512=yes],
12153             [can_compile_avx512=no])
12154         AC_LANG_POP([C++])
12155         CXXFLAGS=$save_CXXFLAGS
12156         AC_MSG_RESULT([${can_compile_avx512}])
12157         if test "${can_compile_avx512}" = "yes" ; then
12158             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
12159         fi
12161         AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
12162         AC_LANG_PUSH([C++])
12163         save_CXXFLAGS=$CXXFLAGS
12164         CXXFLAGS="$CXXFLAGS $flag_f16c"
12165         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12166             #include <immintrin.h>
12167             int main () {
12168                 __m128i a = _mm_set1_epi32 (0);
12169                 __m128 c;
12170                 c = _mm_cvtph_ps(a);
12171                 return 0;
12172             }
12173             ])],
12174             [can_compile_f16c=yes],
12175             [can_compile_f16c=no])
12176         AC_LANG_POP([C++])
12177         CXXFLAGS=$save_CXXFLAGS
12178         AC_MSG_RESULT([${can_compile_f16c}])
12179         if test "${can_compile_f16c}" = "yes" ; then
12180             LO_CLANG_CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
12181         fi
12183         AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
12184         AC_LANG_PUSH([C++])
12185         save_CXXFLAGS=$CXXFLAGS
12186         CXXFLAGS="$CXXFLAGS $flag_fma"
12187         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12188             #include <immintrin.h>
12189             int main () {
12190                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
12191                 d = _mm256_fmadd_ps(a, b, c);
12192                 return 0;
12193             }
12194             ])],
12195             [can_compile_fma=yes],
12196             [can_compile_fma=no])
12197         AC_LANG_POP([C++])
12198         CXXFLAGS=$save_CXXFLAGS
12199         AC_MSG_RESULT([${can_compile_fma}])
12200         if test "${can_compile_fma}" = "yes" ; then
12201             LO_CLANG_CXXFLAGS_INTRINSICS_FMA="$flag_fma"
12202         fi
12204         CXX="$save_CXX"
12205     fi
12208 # prefix LO_CLANG_CC/LO_CLANG_CXX with ccache if needed
12210 UNCACHED_CLANG_CC="$LO_CLANG_CC"
12211 UNCACHED_CLANG_CXX="$LO_CLANG_CXX"
12212 if test "$CCACHE" != "" -a -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12213     AC_MSG_CHECKING([whether $LO_CLANG_CC is already ccached])
12214     AC_LANG_PUSH([C])
12215     save_CC="$CC"
12216     CC="$LO_CLANG_CC"
12217     save_CFLAGS=$CFLAGS
12218     CFLAGS="$CFLAGS --ccache-skip -O2"
12219     dnl an empty program will do, we're checking the compiler flags
12220     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12221                       [use_ccache=yes], [use_ccache=no])
12222     CFLAGS=$save_CFLAGS
12223     CC=$save_CC
12224     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12225         AC_MSG_RESULT([yes])
12226     else
12227         LO_CLANG_CC="$CCACHE $LO_CLANG_CC"
12228         AC_MSG_RESULT([no])
12229     fi
12230     AC_LANG_POP([C])
12232     AC_MSG_CHECKING([whether $LO_CLANG_CXX is already ccached])
12233     AC_LANG_PUSH([C++])
12234     save_CXX="$CXX"
12235     CXX="$LO_CLANG_CXX"
12236     save_CXXFLAGS=$CXXFLAGS
12237     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
12238     dnl an empty program will do, we're checking the compiler flags
12239     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12240                       [use_ccache=yes], [use_ccache=no])
12241     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12242         AC_MSG_RESULT([yes])
12243     else
12244         LO_CLANG_CXX="$CCACHE $LO_CLANG_CXX"
12245         AC_MSG_RESULT([no])
12246     fi
12247     CXXFLAGS=$save_CXXFLAGS
12248     CXX=$save_CXX
12249     AC_LANG_POP([C++])
12252 AC_SUBST(UNCACHED_CC)
12253 AC_SUBST(UNCACHED_CXX)
12254 AC_SUBST(LO_CLANG_CC)
12255 AC_SUBST(LO_CLANG_CXX)
12256 AC_SUBST(UNCACHED_CLANG_CC)
12257 AC_SUBST(UNCACHED_CLANG_CXX)
12258 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE2)
12259 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3)
12260 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE41)
12261 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE42)
12262 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX)
12263 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX2)
12264 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512)
12265 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_F16C)
12266 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_FMA)
12267 AC_SUBST(CLANG_USE_LD)
12268 AC_SUBST([HAVE_LO_CLANG_DLLEXPORTINLINES])
12270 SYSTEM_GPGMEPP=
12272 if test "$enable_gpgmepp" = no; then
12273     AC_MSG_CHECKING([whether to enable gpgmepp])
12274     AC_MSG_RESULT([no])
12275 elif test "$enable_mpl_subset" = "yes"; then
12276     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
12277     AC_MSG_RESULT([yes])
12278 elif test "$enable_fuzzers" = "yes"; then
12279     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
12280     AC_MSG_RESULT([yes])
12281 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
12282     dnl ===================================================================
12283     dnl Check for system gpgme
12284     dnl ===================================================================
12285     AC_MSG_CHECKING([which gpgmepp to use])
12286     if test "$with_system_gpgmepp" = "yes"; then
12287         AC_MSG_RESULT([external])
12288         SYSTEM_GPGMEPP=TRUE
12290         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
12291         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
12292             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
12293         # progress_callback is the only func with plain C linkage
12294         # checking for it also filters out older, KDE-dependent libgpgmepp versions
12295         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
12296             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
12297         AC_CHECK_HEADER(gpgme.h, [],
12298             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
12299     else
12300         AC_MSG_RESULT([internal])
12301         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
12302         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
12304         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
12305         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
12306         if test "$_os" != "WINNT"; then
12307             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
12308             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
12309         fi
12310     fi
12311     ENABLE_GPGMEPP=TRUE
12312     AC_DEFINE([HAVE_FEATURE_GPGME])
12313     AC_PATH_PROG(GPG, gpg)
12314     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
12315     # so let's exclude that manually for the moment
12316     if test -n "$GPG" -a "$_os" != "WINNT"; then
12317         # make sure we not only have a working gpgme, but a full working
12318         # gpg installation to run OpenPGP signature verification
12319         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
12320     fi
12321     if test "$_os" = "Linux"; then
12322       uid=`id -u`
12323       AC_MSG_CHECKING([for /run/user/$uid])
12324       if test -d /run/user/$uid; then
12325         AC_MSG_RESULT([yes])
12326         AC_PATH_PROG(GPGCONF, gpgconf)
12328         # Older versions of gpgconf are not working as expected, since
12329         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
12330         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
12331         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
12332         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
12333         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
12334         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
12335         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
12336           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
12337           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
12338           if $GPGCONF --dump-options > /dev/null ; then
12339             if $GPGCONF --dump-options | grep -q create-socketdir ; then
12340               AC_MSG_RESULT([yes])
12341               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
12342               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
12343             else
12344               AC_MSG_RESULT([no])
12345             fi
12346           else
12347             AC_MSG_RESULT([no. missing or broken gpgconf?])
12348           fi
12349         else
12350           AC_MSG_RESULT([no, $GPGCONF_VERSION])
12351         fi
12352       else
12353         AC_MSG_RESULT([no])
12354      fi
12355    fi
12357 AC_SUBST(ENABLE_GPGMEPP)
12358 AC_SUBST(SYSTEM_GPGMEPP)
12359 AC_SUBST(GPG_ERROR_CFLAGS)
12360 AC_SUBST(GPG_ERROR_LIBS)
12361 AC_SUBST(LIBASSUAN_CFLAGS)
12362 AC_SUBST(LIBASSUAN_LIBS)
12363 AC_SUBST(GPGMEPP_CFLAGS)
12364 AC_SUBST(GPGMEPP_LIBS)
12366 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
12367 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
12368     AC_MSG_RESULT([yes])
12369     ENABLE_MEDIAWIKI=TRUE
12370     BUILD_TYPE="$BUILD_TYPE XSLTML"
12371     if test  "x$with_java" = "xno"; then
12372         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
12373     fi
12374 else
12375     AC_MSG_RESULT([no])
12376     ENABLE_MEDIAWIKI=
12377     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
12379 AC_SUBST(ENABLE_MEDIAWIKI)
12381 AC_MSG_CHECKING([whether to build the Report Builder])
12382 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12383     AC_MSG_RESULT([yes])
12384     ENABLE_REPORTBUILDER=TRUE
12385     AC_MSG_CHECKING([which jfreereport libs to use])
12386     if test "$with_system_jfreereport" = "yes"; then
12387         SYSTEM_JFREEREPORT=TRUE
12388         AC_MSG_RESULT([external])
12389         if test -z $SAC_JAR; then
12390             SAC_JAR=/usr/share/java/sac.jar
12391         fi
12392         if ! test -f $SAC_JAR; then
12393              AC_MSG_ERROR(sac.jar not found.)
12394         fi
12396         if test -z $LIBXML_JAR; then
12397             if test -f /usr/share/java/libxml-1.0.0.jar; then
12398                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
12399             elif test -f /usr/share/java/libxml.jar; then
12400                 LIBXML_JAR=/usr/share/java/libxml.jar
12401             else
12402                 AC_MSG_ERROR(libxml.jar replacement not found.)
12403             fi
12404         elif ! test -f $LIBXML_JAR; then
12405             AC_MSG_ERROR(libxml.jar not found.)
12406         fi
12408         if test -z $FLUTE_JAR; then
12409             if test -f /usr/share/java/flute-1.3.0.jar; then
12410                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
12411             elif test -f /usr/share/java/flute.jar; then
12412                 FLUTE_JAR=/usr/share/java/flute.jar
12413             else
12414                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
12415             fi
12416         elif ! test -f $FLUTE_JAR; then
12417             AC_MSG_ERROR(flute-1.3.0.jar not found.)
12418         fi
12420         if test -z $JFREEREPORT_JAR; then
12421             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
12422                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
12423             elif test -f /usr/share/java/flow-engine.jar; then
12424                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
12425             else
12426                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
12427             fi
12428         elif ! test -f  $JFREEREPORT_JAR; then
12429                 AC_MSG_ERROR(jfreereport.jar not found.)
12430         fi
12432         if test -z $LIBLAYOUT_JAR; then
12433             if test -f /usr/share/java/liblayout-0.2.9.jar; then
12434                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
12435             elif test -f /usr/share/java/liblayout.jar; then
12436                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
12437             else
12438                 AC_MSG_ERROR(liblayout.jar replacement not found.)
12439             fi
12440         elif ! test -f $LIBLAYOUT_JAR; then
12441                 AC_MSG_ERROR(liblayout.jar not found.)
12442         fi
12444         if test -z $LIBLOADER_JAR; then
12445             if test -f /usr/share/java/libloader-1.0.0.jar; then
12446                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
12447             elif test -f /usr/share/java/libloader.jar; then
12448                 LIBLOADER_JAR=/usr/share/java/libloader.jar
12449             else
12450                 AC_MSG_ERROR(libloader.jar replacement not found.)
12451             fi
12452         elif ! test -f  $LIBLOADER_JAR; then
12453             AC_MSG_ERROR(libloader.jar not found.)
12454         fi
12456         if test -z $LIBFORMULA_JAR; then
12457             if test -f /usr/share/java/libformula-0.2.0.jar; then
12458                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
12459             elif test -f /usr/share/java/libformula.jar; then
12460                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
12461             else
12462                 AC_MSG_ERROR(libformula.jar replacement not found.)
12463             fi
12464         elif ! test -f $LIBFORMULA_JAR; then
12465                 AC_MSG_ERROR(libformula.jar not found.)
12466         fi
12468         if test -z $LIBREPOSITORY_JAR; then
12469             if test -f /usr/share/java/librepository-1.0.0.jar; then
12470                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
12471             elif test -f /usr/share/java/librepository.jar; then
12472                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
12473             else
12474                 AC_MSG_ERROR(librepository.jar replacement not found.)
12475             fi
12476         elif ! test -f $LIBREPOSITORY_JAR; then
12477             AC_MSG_ERROR(librepository.jar not found.)
12478         fi
12480         if test -z $LIBFONTS_JAR; then
12481             if test -f /usr/share/java/libfonts-1.0.0.jar; then
12482                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
12483             elif test -f /usr/share/java/libfonts.jar; then
12484                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
12485             else
12486                 AC_MSG_ERROR(libfonts.jar replacement not found.)
12487             fi
12488         elif ! test -f $LIBFONTS_JAR; then
12489                 AC_MSG_ERROR(libfonts.jar not found.)
12490         fi
12492         if test -z $LIBSERIALIZER_JAR; then
12493             if test -f /usr/share/java/libserializer-1.0.0.jar; then
12494                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
12495             elif test -f /usr/share/java/libserializer.jar; then
12496                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
12497             else
12498                 AC_MSG_ERROR(libserializer.jar replacement not found.)
12499             fi
12500         elif ! test -f $LIBSERIALIZER_JAR; then
12501                 AC_MSG_ERROR(libserializer.jar not found.)
12502         fi
12504         if test -z $LIBBASE_JAR; then
12505             if test -f /usr/share/java/libbase-1.0.0.jar; then
12506                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
12507             elif test -f /usr/share/java/libbase.jar; then
12508                 LIBBASE_JAR=/usr/share/java/libbase.jar
12509             else
12510                 AC_MSG_ERROR(libbase.jar replacement not found.)
12511             fi
12512         elif ! test -f $LIBBASE_JAR; then
12513             AC_MSG_ERROR(libbase.jar not found.)
12514         fi
12516     else
12517         AC_MSG_RESULT([internal])
12518         SYSTEM_JFREEREPORT=
12519         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
12520         NEED_ANT=TRUE
12521     fi
12522 else
12523     AC_MSG_RESULT([no])
12524     ENABLE_REPORTBUILDER=
12525     SYSTEM_JFREEREPORT=
12527 AC_SUBST(ENABLE_REPORTBUILDER)
12528 AC_SUBST(SYSTEM_JFREEREPORT)
12529 AC_SUBST(SAC_JAR)
12530 AC_SUBST(LIBXML_JAR)
12531 AC_SUBST(FLUTE_JAR)
12532 AC_SUBST(JFREEREPORT_JAR)
12533 AC_SUBST(LIBBASE_JAR)
12534 AC_SUBST(LIBLAYOUT_JAR)
12535 AC_SUBST(LIBLOADER_JAR)
12536 AC_SUBST(LIBFORMULA_JAR)
12537 AC_SUBST(LIBREPOSITORY_JAR)
12538 AC_SUBST(LIBFONTS_JAR)
12539 AC_SUBST(LIBSERIALIZER_JAR)
12541 # scripting provider for BeanShell?
12542 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
12543 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
12544     AC_MSG_RESULT([yes])
12545     ENABLE_SCRIPTING_BEANSHELL=TRUE
12547     dnl ===================================================================
12548     dnl Check for system beanshell
12549     dnl ===================================================================
12550     AC_MSG_CHECKING([which beanshell to use])
12551     if test "$with_system_beanshell" = "yes"; then
12552         AC_MSG_RESULT([external])
12553         SYSTEM_BSH=TRUE
12554         if test -z $BSH_JAR; then
12555             BSH_JAR=/usr/share/java/bsh.jar
12556         fi
12557         if ! test -f $BSH_JAR; then
12558             AC_MSG_ERROR(bsh.jar not found.)
12559         fi
12560     else
12561         AC_MSG_RESULT([internal])
12562         SYSTEM_BSH=
12563         BUILD_TYPE="$BUILD_TYPE BSH"
12564     fi
12565 else
12566     AC_MSG_RESULT([no])
12567     ENABLE_SCRIPTING_BEANSHELL=
12568     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
12570 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
12571 AC_SUBST(SYSTEM_BSH)
12572 AC_SUBST(BSH_JAR)
12574 # scripting provider for JavaScript?
12575 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
12576 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
12577     AC_MSG_RESULT([yes])
12578     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
12580     dnl ===================================================================
12581     dnl Check for system rhino
12582     dnl ===================================================================
12583     AC_MSG_CHECKING([which rhino to use])
12584     if test "$with_system_rhino" = "yes"; then
12585         AC_MSG_RESULT([external])
12586         SYSTEM_RHINO=TRUE
12587         if test -z $RHINO_JAR; then
12588             RHINO_JAR=/usr/share/java/js.jar
12589         fi
12590         if ! test -f $RHINO_JAR; then
12591             AC_MSG_ERROR(js.jar not found.)
12592         fi
12593     else
12594         AC_MSG_RESULT([internal])
12595         SYSTEM_RHINO=
12596         BUILD_TYPE="$BUILD_TYPE RHINO"
12597         NEED_ANT=TRUE
12598     fi
12599 else
12600     AC_MSG_RESULT([no])
12601     ENABLE_SCRIPTING_JAVASCRIPT=
12602     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
12604 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
12605 AC_SUBST(SYSTEM_RHINO)
12606 AC_SUBST(RHINO_JAR)
12608 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
12609 # paths should be added to library search path. So lets put all 64-bit
12610 # platforms there.
12611 supports_multilib=
12612 case "$host_cpu" in
12613 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
12614     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
12615         supports_multilib="yes"
12616     fi
12617     ;;
12619     ;;
12620 esac
12622 dnl ===================================================================
12623 dnl QT5 Integration
12624 dnl ===================================================================
12626 QT5_CFLAGS=""
12627 QT5_LIBS=""
12628 QMAKE5="qmake"
12629 MOC5="moc"
12630 QT5_GOBJECT_CFLAGS=""
12631 QT5_GOBJECT_LIBS=""
12632 QT5_HAVE_GOBJECT=""
12633 QT5_PLATFORMS_SRCDIR=""
12634 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
12635         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
12636         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
12637 then
12638     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
12639     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
12641     if test -n "$supports_multilib"; then
12642         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
12643     fi
12645     qt5_test_include="QtWidgets/qapplication.h"
12646     if test "$_os" = "Emscripten"; then
12647         qt5_test_library="libQt5Widgets.a"
12648     else
12649         qt5_test_library="libQt5Widgets.so"
12650     fi
12652     dnl Check for qmake5
12653     if test -n "$QT5DIR"; then
12654         AC_PATH_PROG(QMAKE5, [qmake], no, [$QT5DIR/bin])
12655     else
12656         AC_PATH_PROGS(QMAKE5, [qmake-qt5 qmake], no)
12657     fi
12658     if test "$QMAKE5" = "no"; then
12659         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12660     else
12661         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
12662         if test -z "$qmake5_test_ver"; then
12663             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12664         fi
12665         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
12666         qt5_minimal_minor="6"
12667         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
12668             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
12669         else
12670             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
12671         fi
12672     fi
12674     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
12675     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
12676     qt5_platformsdir="`$QMAKE5 -query QT_INSTALL_PLUGINS`/platforms"
12677     QT5_PLATFORMS_SRCDIR="$qt5_platformsdir"
12679     AC_MSG_CHECKING([for Qt5 headers])
12680     qt5_incdir="no"
12681     for inc_dir in $qt5_incdirs; do
12682         if test -r "$inc_dir/$qt5_test_include"; then
12683             qt5_incdir="$inc_dir"
12684             break
12685         fi
12686     done
12687     AC_MSG_RESULT([$qt5_incdir])
12688     if test "x$qt5_incdir" = "xno"; then
12689         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12690     fi
12691     # check for scenario: qt5-qtbase-devel-*.86_64 installed but host is i686
12692     AC_LANG_PUSH([C++])
12693     save_CPPFLAGS=$CPPFLAGS
12694     CPPFLAGS="${CPPFLAGS} -I${qt5_incdir}"
12695     AC_CHECK_HEADER(QtCore/qconfig.h, [],
12696         [AC_MSG_ERROR(qconfig.h header not found.)], [])
12697     CPPFLAGS=$save_CPPFLAGS
12698     AC_LANG_POP([C++])
12700     AC_MSG_CHECKING([for Qt5 libraries])
12701     qt5_libdir="no"
12702     for lib_dir in $qt5_libdirs; do
12703         if test -r "$lib_dir/$qt5_test_library"; then
12704             qt5_libdir="$lib_dir"
12705             break
12706         fi
12707     done
12708     AC_MSG_RESULT([$qt5_libdir])
12709     if test "x$qt5_libdir" = "xno"; then
12710         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12711     fi
12713     if test "$_os" = "Emscripten"; then
12714         if test ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html ; then
12715             QT5_PLATFORMS_SRCDIR="${QT5_PLATFORMS_SRCDIR/plugins/src\/plugins}/wasm"
12716         fi
12717         if test ! -f "${qt5_platformsdir}"/libqwasm.a -o ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html; then
12718             AC_MSG_ERROR([No Qt5 WASM QPA plugin found in ${qt5_platformsdir} or ${QT5_PLATFORMS_SRCDIR}])
12719         fi
12720     fi
12722     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
12723     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12724     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
12725     if test "$_os" = "Emscripten"; then
12726         QT5_LIBS="$QT5_LIBS -lqtpcre2 -lQt5EventDispatcherSupport -lQt5FontDatabaseSupport -L${qt5_platformsdir} -lqwasm"
12727     fi
12729     if test "$USING_X11" = TRUE; then
12730         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
12731         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
12732             QT5_HAVE_XCB_ICCCM=1
12733             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
12734         ],[
12735             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)])
12736             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
12737         ])
12738         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
12739         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
12740         QT5_USING_X11=1
12741         AC_DEFINE(QT5_USING_X11)
12742     fi
12744     dnl Check for Meta Object Compiler
12746     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
12747     if test "$MOC5" = "no"; then
12748         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
12749 the root of your Qt installation by exporting QT5DIR before running "configure".])
12750     fi
12752     if test "$test_gstreamer_1_0" = yes; then
12753         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
12754                 QT5_HAVE_GOBJECT=1
12755                 AC_DEFINE(QT5_HAVE_GOBJECT)
12756             ],
12757             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
12758         )
12759     fi
12761 AC_SUBST(QT5_CFLAGS)
12762 AC_SUBST(QT5_LIBS)
12763 AC_SUBST(MOC5)
12764 AC_SUBST(QT5_GOBJECT_CFLAGS)
12765 AC_SUBST(QT5_GOBJECT_LIBS)
12766 AC_SUBST(QT5_HAVE_GOBJECT)
12767 AC_SUBST(QT5_PLATFORMS_SRCDIR)
12769 dnl ===================================================================
12770 dnl KF5 Integration
12771 dnl ===================================================================
12773 KF5_CFLAGS=""
12774 KF5_LIBS=""
12775 KF5_CONFIG="kf5-config"
12776 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
12777         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
12778 then
12779     if test "$OS" = "HAIKU"; then
12780         haiku_arch="`echo $RTL_ARCH | tr X x`"
12781         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
12782         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
12783     fi
12785     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
12786     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
12787     if test -n "$supports_multilib"; then
12788         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
12789     fi
12791     kf5_test_include="KF5/kcoreaddons_version.h"
12792     kf5_test_library="libKF5CoreAddons.so"
12793     kf5_libdirs="$qt5_libdir $kf5_libdirs"
12795     dnl kf5 KDE4 support compatibility installed
12796     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
12797     if test "$KF5_CONFIG" != "no"; then
12798         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
12799         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
12800     fi
12802     dnl Check for KF5 headers
12803     AC_MSG_CHECKING([for KF5 headers])
12804     kf5_incdir="no"
12805     for kf5_check in $kf5_incdirs; do
12806         if test -r "$kf5_check/$kf5_test_include"; then
12807             kf5_incdir="$kf5_check/KF5"
12808             break
12809         fi
12810     done
12811     AC_MSG_RESULT([$kf5_incdir])
12812     if test "x$kf5_incdir" = "xno"; then
12813         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
12814     fi
12816     dnl Check for KF5 libraries
12817     AC_MSG_CHECKING([for KF5 libraries])
12818     kf5_libdir="no"
12819     for kf5_check in $kf5_libdirs; do
12820         if test -r "$kf5_check/$kf5_test_library"; then
12821             kf5_libdir="$kf5_check"
12822             break
12823         fi
12824     done
12826     AC_MSG_RESULT([$kf5_libdir])
12827     if test "x$kf5_libdir" = "xno"; then
12828         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
12829     fi
12831     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"
12832     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
12833     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12835     if test "$USING_X11" = TRUE; then
12836         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
12837     fi
12839     AC_LANG_PUSH([C++])
12840     save_CXXFLAGS=$CXXFLAGS
12841     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
12842     AC_MSG_CHECKING([whether KDE is >= 5.0])
12843        AC_RUN_IFELSE([AC_LANG_SOURCE([[
12844 #include <kcoreaddons_version.h>
12846 int main(int argc, char **argv) {
12847        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
12848        else return 1;
12850        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
12851     CXXFLAGS=$save_CXXFLAGS
12852     AC_LANG_POP([C++])
12854 AC_SUBST(KF5_CFLAGS)
12855 AC_SUBST(KF5_LIBS)
12857 dnl ===================================================================
12858 dnl Test whether to include Evolution 2 support
12859 dnl ===================================================================
12860 AC_MSG_CHECKING([whether to enable evolution 2 support])
12861 if test "$enable_evolution2" = yes; then
12862     AC_MSG_RESULT([yes])
12863     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
12864     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12865     FilterLibs "${GOBJECT_LIBS}"
12866     GOBJECT_LIBS="${filteredlibs}"
12867     ENABLE_EVOAB2="TRUE"
12868 else
12869     AC_MSG_RESULT([no])
12871 AC_SUBST(ENABLE_EVOAB2)
12872 AC_SUBST(GOBJECT_CFLAGS)
12873 AC_SUBST(GOBJECT_LIBS)
12875 dnl ===================================================================
12876 dnl Test which themes to include
12877 dnl ===================================================================
12878 AC_MSG_CHECKING([which themes to include])
12879 # if none given use default subset of available themes
12880 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
12881     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"
12884 WITH_THEMES=""
12885 if test "x$with_theme" != "xno"; then
12886     for theme in $with_theme; do
12887         case $theme in
12888         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" ;;
12889         default) real_theme=colibre ;;
12890         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
12891         esac
12892         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
12893     done
12895 AC_MSG_RESULT([$WITH_THEMES])
12896 AC_SUBST([WITH_THEMES])
12897 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
12898 for theme in $with_theme; do
12899     case $theme in
12900     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
12901     *) ;;
12902     esac
12903 done
12905 dnl ===================================================================
12906 dnl Test whether to integrate helppacks into the product's installer
12907 dnl ===================================================================
12908 AC_MSG_CHECKING([for helppack integration])
12909 if test "$with_helppack_integration" = "no"; then
12910     AC_MSG_RESULT([no integration])
12911 else
12912     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
12913     AC_MSG_RESULT([integration])
12916 ###############################################################################
12917 # Extensions checking
12918 ###############################################################################
12919 AC_MSG_CHECKING([for extensions integration])
12920 if test "x$enable_extension_integration" != "xno"; then
12921     WITH_EXTENSION_INTEGRATION=TRUE
12922     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
12923     AC_MSG_RESULT([yes, use integration])
12924 else
12925     WITH_EXTENSION_INTEGRATION=
12926     AC_MSG_RESULT([no, do not integrate])
12928 AC_SUBST(WITH_EXTENSION_INTEGRATION)
12930 dnl Should any extra extensions be included?
12931 dnl There are standalone tests for each of these below.
12932 WITH_EXTRA_EXTENSIONS=
12933 AC_SUBST([WITH_EXTRA_EXTENSIONS])
12935 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
12936 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
12937 if test "x$with_java" != "xno"; then
12938     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
12939     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
12942 AC_MSG_CHECKING([whether to build opens___.ttf])
12943 if test "$enable_build_opensymbol" = "yes"; then
12944     AC_MSG_RESULT([yes])
12945     AC_PATH_PROG(FONTFORGE, fontforge)
12946     if test -z "$FONTFORGE"; then
12947         AC_MSG_ERROR([fontforge not installed])
12948     fi
12949 else
12950     AC_MSG_RESULT([no])
12951     OPENSYMBOL_TTF=f543e6e2d7275557a839a164941c0a86e5f2c3f2a0042bfc434c88c6dde9e140-opens___.ttf
12952     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
12954 AC_SUBST(OPENSYMBOL_TTF)
12955 AC_SUBST(FONTFORGE)
12957 dnl ===================================================================
12958 dnl Test whether to include fonts
12959 dnl ===================================================================
12960 AC_MSG_CHECKING([whether to include third-party fonts])
12961 if test "$with_fonts" != "no"; then
12962     AC_MSG_RESULT([yes])
12963     WITH_FONTS=TRUE
12964     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
12965     AC_DEFINE(HAVE_MORE_FONTS)
12966 else
12967     AC_MSG_RESULT([no])
12968     WITH_FONTS=
12969     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
12971 AC_SUBST(WITH_FONTS)
12974 dnl ===================================================================
12975 dnl Test whether to enable online update service
12976 dnl ===================================================================
12977 AC_MSG_CHECKING([whether to enable online update])
12978 ENABLE_ONLINE_UPDATE=
12979 ENABLE_ONLINE_UPDATE_MAR=
12980 UPDATE_CONFIG=
12981 if test "$enable_online_update" = ""; then
12982     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
12983         AC_MSG_RESULT([yes])
12984         ENABLE_ONLINE_UPDATE="TRUE"
12985     else
12986         AC_MSG_RESULT([no])
12987     fi
12988 else
12989     if test "$enable_online_update" = "mar"; then
12990         AC_MSG_RESULT([yes - MAR-based online update])
12991         ENABLE_ONLINE_UPDATE_MAR="TRUE"
12992         if test "$with_update_config" = ""; then
12993             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
12994         fi
12995         UPDATE_CONFIG="$with_update_config"
12996         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
12997     elif test "$enable_online_update" = "yes"; then
12998         AC_MSG_RESULT([yes])
12999         ENABLE_ONLINE_UPDATE="TRUE"
13000     else
13001         AC_MSG_RESULT([no])
13002     fi
13004 AC_SUBST(ENABLE_ONLINE_UPDATE)
13005 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
13006 AC_SUBST(UPDATE_CONFIG)
13009 PRIVACY_POLICY_URL="$with_privacy_policy_url"
13010 if test "$ENABLE_ONLINE_UPDATE" = TRUE -o "$ENABLE_BREAKPAD" = "TRUE"; then
13011     if test "x$with_privacy_policy_url" = "xundefined"; then
13012         AC_MSG_FAILURE([online update or breakpad/crashreporting are enabled, but no --with-privacy-policy-url=... was provided])
13013     fi
13015 AC_SUBST(PRIVACY_POLICY_URL)
13016 dnl ===================================================================
13017 dnl Test whether we need bzip2
13018 dnl ===================================================================
13019 SYSTEM_BZIP2=
13020 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
13021     AC_MSG_CHECKING([whether to use system bzip2])
13022     if test "$with_system_bzip2" = yes; then
13023         SYSTEM_BZIP2=TRUE
13024         AC_MSG_RESULT([yes])
13025         PKG_CHECK_MODULES(BZIP2, bzip2)
13026         FilterLibs "${BZIP2_LIBS}"
13027         BZIP2_LIBS="${filteredlibs}"
13028     else
13029         AC_MSG_RESULT([no])
13030         BUILD_TYPE="$BUILD_TYPE BZIP2"
13031     fi
13033 AC_SUBST(SYSTEM_BZIP2)
13034 AC_SUBST(BZIP2_CFLAGS)
13035 AC_SUBST(BZIP2_LIBS)
13037 dnl ===================================================================
13038 dnl Test whether to enable extension update
13039 dnl ===================================================================
13040 AC_MSG_CHECKING([whether to enable extension update])
13041 ENABLE_EXTENSION_UPDATE=
13042 if test "x$enable_extension_update" = "xno"; then
13043     AC_MSG_RESULT([no])
13044 else
13045     AC_MSG_RESULT([yes])
13046     ENABLE_EXTENSION_UPDATE="TRUE"
13047     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
13048     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
13050 AC_SUBST(ENABLE_EXTENSION_UPDATE)
13053 dnl ===================================================================
13054 dnl Test whether to create MSI with LIMITUI=1 (silent install)
13055 dnl ===================================================================
13056 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
13057 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
13058     AC_MSG_RESULT([no])
13059     ENABLE_SILENT_MSI=
13060 else
13061     AC_MSG_RESULT([yes])
13062     ENABLE_SILENT_MSI=TRUE
13063     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
13065 AC_SUBST(ENABLE_SILENT_MSI)
13067 AC_MSG_CHECKING([whether and how to use Xinerama])
13068 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
13069     if test "$x_libraries" = "default_x_libraries"; then
13070         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
13071         if test "x$XINERAMALIB" = x; then
13072            XINERAMALIB="/usr/lib"
13073         fi
13074     else
13075         XINERAMALIB="$x_libraries"
13076     fi
13077     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
13078         # we have both versions, let the user decide but use the dynamic one
13079         # per default
13080         USE_XINERAMA=TRUE
13081         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
13082             XINERAMA_LINK=dynamic
13083         else
13084             XINERAMA_LINK=static
13085         fi
13086     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
13087         # we have only the dynamic version
13088         USE_XINERAMA=TRUE
13089         XINERAMA_LINK=dynamic
13090     elif test -e "$XINERAMALIB/libXinerama.a"; then
13091         # static version
13092         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
13093             USE_XINERAMA=TRUE
13094             XINERAMA_LINK=static
13095         else
13096             USE_XINERAMA=
13097             XINERAMA_LINK=none
13098         fi
13099     else
13100         # no Xinerama
13101         USE_XINERAMA=
13102         XINERAMA_LINK=none
13103     fi
13104     if test "$USE_XINERAMA" = "TRUE"; then
13105         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
13106         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
13107             [AC_MSG_ERROR(Xinerama header not found.)], [])
13108         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
13109         if test "x$XEXTLIB" = x; then
13110            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
13111         fi
13112         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
13113         if test "$_os" = "FreeBSD"; then
13114             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
13115         fi
13116         if test "$_os" = "Linux"; then
13117             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
13118         fi
13119         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
13120             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
13121     else
13122         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
13123     fi
13124 else
13125     USE_XINERAMA=
13126     XINERAMA_LINK=none
13127     AC_MSG_RESULT([no])
13129 AC_SUBST(USE_XINERAMA)
13130 AC_SUBST(XINERAMA_LINK)
13132 dnl ===================================================================
13133 dnl Test whether to build cairo or rely on the system version
13134 dnl ===================================================================
13136 if test "$test_cairo" = "yes"; then
13137     AC_MSG_CHECKING([whether to use the system cairo])
13139     : ${with_system_cairo:=$with_system_libs}
13140     if test "$with_system_cairo" = "yes"; then
13141         SYSTEM_CAIRO=TRUE
13142         AC_MSG_RESULT([yes])
13144         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
13145         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13146         FilterLibs "${CAIRO_LIBS}"
13147         CAIRO_LIBS="${filteredlibs}"
13149         if test "$test_xrender" = "yes"; then
13150             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
13151             AC_LANG_PUSH([C])
13152             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
13153 #ifdef PictStandardA8
13154 #else
13155       return fail;
13156 #endif
13157 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
13159             AC_LANG_POP([C])
13160         fi
13161     else
13162         AC_MSG_RESULT([no])
13163         BUILD_TYPE="$BUILD_TYPE CAIRO"
13164     fi
13166     if test "$enable_cairo_canvas" != no; then
13167         AC_DEFINE(ENABLE_CAIRO_CANVAS)
13168         ENABLE_CAIRO_CANVAS=TRUE
13169     fi
13172 AC_SUBST(CAIRO_CFLAGS)
13173 AC_SUBST(CAIRO_LIBS)
13174 AC_SUBST(ENABLE_CAIRO_CANVAS)
13175 AC_SUBST(SYSTEM_CAIRO)
13177 dnl ===================================================================
13178 dnl Test whether to use avahi
13179 dnl ===================================================================
13180 if test "$_os" = "WINNT"; then
13181     # Windows uses bundled mDNSResponder
13182     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
13183 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
13184     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
13185                       [ENABLE_AVAHI="TRUE"])
13186     AC_DEFINE(HAVE_FEATURE_AVAHI)
13187     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13188     FilterLibs "${AVAHI_LIBS}"
13189     AVAHI_LIBS="${filteredlibs}"
13192 AC_SUBST(ENABLE_AVAHI)
13193 AC_SUBST(AVAHI_CFLAGS)
13194 AC_SUBST(AVAHI_LIBS)
13196 dnl ===================================================================
13197 dnl Test whether to use liblangtag
13198 dnl ===================================================================
13199 SYSTEM_LIBLANGTAG=
13200 AC_MSG_CHECKING([whether to use system liblangtag])
13201 if test "$with_system_liblangtag" = yes; then
13202     SYSTEM_LIBLANGTAG=TRUE
13203     AC_MSG_RESULT([yes])
13204     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
13205     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
13206     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
13207     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13208     FilterLibs "${LIBLANGTAG_LIBS}"
13209     LIBLANGTAG_LIBS="${filteredlibs}"
13210 else
13211     SYSTEM_LIBLANGTAG=
13212     AC_MSG_RESULT([no])
13213     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
13214     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
13215     if test "$COM" = "MSC"; then
13216         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
13217     else
13218         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
13219     fi
13221 AC_SUBST(SYSTEM_LIBLANGTAG)
13222 AC_SUBST(LIBLANGTAG_CFLAGS)
13223 AC_SUBST(LIBLANGTAG_LIBS)
13225 dnl ===================================================================
13226 dnl Test whether to build libpng or rely on the system version
13227 dnl ===================================================================
13229 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
13231 dnl ===================================================================
13232 dnl Check for runtime JVM search path
13233 dnl ===================================================================
13234 if test "$ENABLE_JAVA" != ""; then
13235     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
13236     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
13237         AC_MSG_RESULT([yes])
13238         if ! test -d "$with_jvm_path"; then
13239             AC_MSG_ERROR(["$with_jvm_path" not a directory])
13240         fi
13241         if ! test -d "$with_jvm_path"jvm; then
13242             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
13243         fi
13244         JVM_ONE_PATH_CHECK="$with_jvm_path"
13245         AC_SUBST(JVM_ONE_PATH_CHECK)
13246     else
13247         AC_MSG_RESULT([no])
13248     fi
13251 dnl ===================================================================
13252 dnl Test for the presence of Ant and that it works
13253 dnl ===================================================================
13255 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE" -a "$cross_compiling" != "yes"; then
13256     ANT_HOME=; export ANT_HOME
13257     WITH_ANT_HOME=; export WITH_ANT_HOME
13258     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
13259         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
13260             if test "$_os" = "WINNT"; then
13261                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
13262             else
13263                 with_ant_home="$LODE_HOME/opt/ant"
13264             fi
13265         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
13266             with_ant_home="$LODE_HOME/opt/ant"
13267         fi
13268     fi
13269     if test -z "$with_ant_home"; then
13270         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
13271     else
13272         if test "$_os" = "WINNT"; then
13273             # AC_PATH_PROGS needs unix path
13274             with_ant_home=`cygpath -u "$with_ant_home"`
13275         fi
13276         AbsolutePath "$with_ant_home"
13277         with_ant_home=$absolute_path
13278         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
13279         WITH_ANT_HOME=$with_ant_home
13280         ANT_HOME=$with_ant_home
13281     fi
13283     if test -z "$ANT"; then
13284         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
13285     else
13286         # resolve relative or absolute symlink
13287         while test -h "$ANT"; do
13288             a_cwd=`pwd`
13289             a_basename=`basename "$ANT"`
13290             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
13291             cd "`dirname "$ANT"`"
13292             cd "`dirname "$a_script"`"
13293             ANT="`pwd`"/"`basename "$a_script"`"
13294             cd "$a_cwd"
13295         done
13297         AC_MSG_CHECKING([if $ANT works])
13298         mkdir -p conftest.dir
13299         a_cwd=$(pwd)
13300         cd conftest.dir
13301         cat > conftest.java << EOF
13302         public class conftest {
13303             int testmethod(int a, int b) {
13304                     return a + b;
13305             }
13306         }
13309         cat > conftest.xml << EOF
13310         <project name="conftest" default="conftest">
13311         <target name="conftest">
13312             <javac srcdir="." includes="conftest.java">
13313             </javac>
13314         </target>
13315         </project>
13318         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
13319         if test $? = 0 -a -f ./conftest.class; then
13320             AC_MSG_RESULT([Ant works])
13321             if test -z "$WITH_ANT_HOME"; then
13322                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
13323                 if test -z "$ANT_HOME"; then
13324                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
13325                 fi
13326             else
13327                 ANT_HOME="$WITH_ANT_HOME"
13328             fi
13329         else
13330             echo "configure: Ant test failed" >&5
13331             cat conftest.java >&5
13332             cat conftest.xml >&5
13333             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
13334         fi
13335         cd "$a_cwd"
13336         rm -fr conftest.dir
13337     fi
13338     if test -z "$ANT_HOME"; then
13339         ANT_HOME="NO_ANT_HOME"
13340     else
13341         PathFormat "$ANT_HOME"
13342         ANT_HOME="$formatted_path"
13343         PathFormat "$ANT"
13344         ANT="$formatted_path"
13345     fi
13347     dnl Checking for ant.jar
13348     if test "$ANT_HOME" != "NO_ANT_HOME"; then
13349         AC_MSG_CHECKING([Ant lib directory])
13350         if test -f $ANT_HOME/lib/ant.jar; then
13351             ANT_LIB="$ANT_HOME/lib"
13352         else
13353             if test -f $ANT_HOME/ant.jar; then
13354                 ANT_LIB="$ANT_HOME"
13355             else
13356                 if test -f /usr/share/java/ant.jar; then
13357                     ANT_LIB=/usr/share/java
13358                 else
13359                     if test -f /usr/share/ant-core/lib/ant.jar; then
13360                         ANT_LIB=/usr/share/ant-core/lib
13361                     else
13362                         if test -f $ANT_HOME/lib/ant/ant.jar; then
13363                             ANT_LIB="$ANT_HOME/lib/ant"
13364                         else
13365                             if test -f /usr/share/lib/ant/ant.jar; then
13366                                 ANT_LIB=/usr/share/lib/ant
13367                             else
13368                                 AC_MSG_ERROR([Ant libraries not found!])
13369                             fi
13370                         fi
13371                     fi
13372                 fi
13373             fi
13374         fi
13375         PathFormat "$ANT_LIB"
13376         ANT_LIB="$formatted_path"
13377         AC_MSG_RESULT([Ant lib directory found.])
13378     fi
13380     ant_minver=1.6.0
13381     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
13383     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
13384     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
13385     ant_version_major=`echo $ant_version | cut -d. -f1`
13386     ant_version_minor=`echo $ant_version | cut -d. -f2`
13387     echo "configure: ant_version $ant_version " >&5
13388     echo "configure: ant_version_major $ant_version_major " >&5
13389     echo "configure: ant_version_minor $ant_version_minor " >&5
13390     if test "$ant_version_major" -ge "2"; then
13391         AC_MSG_RESULT([yes, $ant_version])
13392     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
13393         AC_MSG_RESULT([yes, $ant_version])
13394     else
13395         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
13396     fi
13398     rm -f conftest* core core.* *.core
13400 AC_SUBST(ANT)
13401 AC_SUBST(ANT_HOME)
13402 AC_SUBST(ANT_LIB)
13404 OOO_JUNIT_JAR=
13405 HAMCREST_JAR=
13406 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no" -a "$cross_compiling" != "yes"; then
13407     AC_MSG_CHECKING([for JUnit 4])
13408     if test "$with_junit" = "yes"; then
13409         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
13410             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
13411         elif test -e /usr/share/java/junit4.jar; then
13412             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
13413         else
13414            if test -e /usr/share/lib/java/junit.jar; then
13415               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
13416            else
13417               OOO_JUNIT_JAR=/usr/share/java/junit.jar
13418            fi
13419         fi
13420     else
13421         OOO_JUNIT_JAR=$with_junit
13422     fi
13423     if test "$_os" = "WINNT"; then
13424         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
13425     fi
13426     printf 'import org.junit.Before;' > conftest.java
13427     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
13428         AC_MSG_RESULT([$OOO_JUNIT_JAR])
13429     else
13430         AC_MSG_ERROR(
13431 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
13432  specify its pathname via --with-junit=..., or disable it via --without-junit])
13433     fi
13434     rm -f conftest.class conftest.java
13435     if test $OOO_JUNIT_JAR != ""; then
13436         BUILD_TYPE="$BUILD_TYPE QADEVOOO"
13437     fi
13439     AC_MSG_CHECKING([for included Hamcrest])
13440     printf 'import org.hamcrest.BaseDescription;' > conftest.java
13441     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
13442         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
13443     else
13444         AC_MSG_RESULT([Not included])
13445         AC_MSG_CHECKING([for standalone hamcrest jar.])
13446         if test "$with_hamcrest" = "yes"; then
13447             if test -e /usr/share/lib/java/hamcrest.jar; then
13448                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
13449             elif test -e /usr/share/java/hamcrest/core.jar; then
13450                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
13451             elif test -e /usr/share/java/hamcrest/hamcrest.jar; then
13452                 HAMCREST_JAR=/usr/share/java/hamcrest/hamcrest.jar
13453             else
13454                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
13455             fi
13456         else
13457             HAMCREST_JAR=$with_hamcrest
13458         fi
13459         if test "$_os" = "WINNT"; then
13460             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
13461         fi
13462         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
13463             AC_MSG_RESULT([$HAMCREST_JAR])
13464         else
13465             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),
13466                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
13467         fi
13468     fi
13469     rm -f conftest.class conftest.java
13471 AC_SUBST(OOO_JUNIT_JAR)
13472 AC_SUBST(HAMCREST_JAR)
13475 AC_SUBST(SCPDEFS)
13478 # check for wget and curl
13480 WGET=
13481 CURL=
13483 if test "$enable_fetch_external" != "no"; then
13485 CURL=`which curl 2>/dev/null`
13487 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
13488     # wget new enough?
13489     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
13490     if test $? -eq 0; then
13491         WGET=$i
13492         break
13493     fi
13494 done
13496 if test -z "$WGET" -a -z "$CURL"; then
13497     AC_MSG_ERROR([neither wget nor curl found!])
13502 AC_SUBST(WGET)
13503 AC_SUBST(CURL)
13506 # check for sha256sum
13508 SHA256SUM=
13510 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
13511     eval "$i -a 256 --version" > /dev/null 2>&1
13512     ret=$?
13513     if test $ret -eq 0; then
13514         SHA256SUM="$i -a 256"
13515         break
13516     fi
13517 done
13519 if test -z "$SHA256SUM"; then
13520     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
13521         eval "$i --version" > /dev/null 2>&1
13522         ret=$?
13523         if test $ret -eq 0; then
13524             SHA256SUM=$i
13525             break
13526         fi
13527     done
13530 if test -z "$SHA256SUM"; then
13531     AC_MSG_ERROR([no sha256sum found!])
13534 AC_SUBST(SHA256SUM)
13536 dnl ===================================================================
13537 dnl Dealing with l10n options
13538 dnl ===================================================================
13539 AC_MSG_CHECKING([which languages to be built])
13540 # get list of all languages
13541 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
13542 # the sed command does the following:
13543 #   + if a line ends with a backslash, append the next line to it
13544 #   + adds " on the beginning of the value (after =)
13545 #   + adds " at the end of the value
13546 #   + removes en-US; we want to put it on the beginning
13547 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
13548 [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)]
13549 ALL_LANGS="en-US $completelangiso"
13550 # check the configured localizations
13551 WITH_LANG="$with_lang"
13553 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
13554 # (Norwegian is "nb" and "nn".)
13555 if test "$WITH_LANG" = "no"; then
13556     WITH_LANG=
13559 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
13560     AC_MSG_RESULT([en-US])
13561 else
13562     AC_MSG_RESULT([$WITH_LANG])
13563     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
13564     if test -z "$MSGFMT"; then
13565         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
13566             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
13567         elif test -x "/opt/lo/bin/msgfmt"; then
13568             MSGFMT="/opt/lo/bin/msgfmt"
13569         else
13570             AC_CHECK_PROGS(MSGFMT, [msgfmt])
13571             if test -z "$MSGFMT"; then
13572                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
13573             fi
13574         fi
13575     fi
13576     if test -z "$MSGUNIQ"; then
13577         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
13578             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
13579         elif test -x "/opt/lo/bin/msguniq"; then
13580             MSGUNIQ="/opt/lo/bin/msguniq"
13581         else
13582             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
13583             if test -z "$MSGUNIQ"; then
13584                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
13585             fi
13586         fi
13587     fi
13589 AC_SUBST(MSGFMT)
13590 AC_SUBST(MSGUNIQ)
13591 # check that the list is valid
13592 for lang in $WITH_LANG; do
13593     test "$lang" = "ALL" && continue
13594     # need to check for the exact string, so add space before and after the list of all languages
13595     for vl in $ALL_LANGS; do
13596         if test "$vl" = "$lang"; then
13597            break
13598         fi
13599     done
13600     if test "$vl" != "$lang"; then
13601         # if you're reading this - you prolly quoted your languages remove the quotes ...
13602         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
13603     fi
13604 done
13605 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
13606     echo $WITH_LANG | grep -q en-US
13607     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
13609 # list with substituted ALL
13610 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
13611 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
13612 test "$WITH_LANG" = "en-US" && WITH_LANG=
13613 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
13614     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
13615     ALL_LANGS=`echo $ALL_LANGS qtz`
13617 AC_SUBST(ALL_LANGS)
13618 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
13619 AC_SUBST(WITH_LANG)
13620 AC_SUBST(WITH_LANG_LIST)
13621 AC_SUBST(GIT_NEEDED_SUBMODULES)
13623 WITH_POOR_HELP_LOCALIZATIONS=
13624 if test -d "$SRC_ROOT/translations/source"; then
13625     for l in `ls -1 $SRC_ROOT/translations/source`; do
13626         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
13627             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
13628         fi
13629     done
13631 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
13633 if test -n "$with_locales"; then
13634     WITH_LOCALES="$with_locales"
13636     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
13637     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
13638     # config_host/config_locales.h.in
13639     for locale in $WITH_LOCALES; do
13640         lang=${locale%_*}
13642         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
13644         case $lang in
13645         hi|mr*ne)
13646             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
13647             ;;
13648         bg|ru)
13649             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
13650             ;;
13651         esac
13652     done
13653 else
13654     AC_DEFINE(WITH_LOCALE_ALL)
13656 AC_SUBST(WITH_LOCALES)
13658 dnl git submodule update --reference
13659 dnl ===================================================================
13660 if test -n "${GIT_REFERENCE_SRC}"; then
13661     for repo in ${GIT_NEEDED_SUBMODULES}; do
13662         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
13663             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
13664         fi
13665     done
13667 AC_SUBST(GIT_REFERENCE_SRC)
13669 dnl git submodules linked dirs
13670 dnl ===================================================================
13671 if test -n "${GIT_LINK_SRC}"; then
13672     for repo in ${GIT_NEEDED_SUBMODULES}; do
13673         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
13674             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
13675         fi
13676     done
13678 AC_SUBST(GIT_LINK_SRC)
13680 dnl branding
13681 dnl ===================================================================
13682 AC_MSG_CHECKING([for alternative branding images directory])
13683 # initialize mapped arrays
13684 BRAND_INTRO_IMAGES="intro.png intro-highres.png"
13685 brand_files="$BRAND_INTRO_IMAGES logo.svg logo_inverted.svg logo-sc.svg logo-sc_inverted.svg about.svg"
13687 if test -z "$with_branding" -o "$with_branding" = "no"; then
13688     AC_MSG_RESULT([none])
13689     DEFAULT_BRAND_IMAGES="$brand_files"
13690 else
13691     if ! test -d $with_branding ; then
13692         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
13693     else
13694         AC_MSG_RESULT([$with_branding])
13695         CUSTOM_BRAND_DIR="$with_branding"
13696         for lfile in $brand_files
13697         do
13698             if ! test -f $with_branding/$lfile ; then
13699                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
13700                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
13701             else
13702                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
13703             fi
13704         done
13705         check_for_progress="yes"
13706     fi
13708 AC_SUBST([BRAND_INTRO_IMAGES])
13709 AC_SUBST([CUSTOM_BRAND_DIR])
13710 AC_SUBST([CUSTOM_BRAND_IMAGES])
13711 AC_SUBST([DEFAULT_BRAND_IMAGES])
13714 AC_MSG_CHECKING([for 'intro' progress settings])
13715 PROGRESSBARCOLOR=
13716 PROGRESSSIZE=
13717 PROGRESSPOSITION=
13718 PROGRESSFRAMECOLOR=
13719 PROGRESSTEXTCOLOR=
13720 PROGRESSTEXTBASELINE=
13722 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
13723     source "$with_branding/progress.conf"
13724     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
13725 else
13726     AC_MSG_RESULT([none])
13729 AC_SUBST(PROGRESSBARCOLOR)
13730 AC_SUBST(PROGRESSSIZE)
13731 AC_SUBST(PROGRESSPOSITION)
13732 AC_SUBST(PROGRESSFRAMECOLOR)
13733 AC_SUBST(PROGRESSTEXTCOLOR)
13734 AC_SUBST(PROGRESSTEXTBASELINE)
13737 dnl ===================================================================
13738 dnl Custom build version
13739 dnl ===================================================================
13740 AC_MSG_CHECKING([for extra build ID])
13741 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
13742     EXTRA_BUILDID="$with_extra_buildid"
13744 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
13745 if test -n "$EXTRA_BUILDID" ; then
13746     AC_MSG_RESULT([$EXTRA_BUILDID])
13747 else
13748     AC_MSG_RESULT([not set])
13750 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
13752 OOO_VENDOR=
13753 AC_MSG_CHECKING([for vendor])
13754 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
13755     OOO_VENDOR="$USERNAME"
13757     if test -z "$OOO_VENDOR"; then
13758         OOO_VENDOR="$USER"
13759     fi
13761     if test -z "$OOO_VENDOR"; then
13762         OOO_VENDOR="`id -u -n`"
13763     fi
13765     AC_MSG_RESULT([not set, using $OOO_VENDOR])
13766 else
13767     OOO_VENDOR="$with_vendor"
13768     AC_MSG_RESULT([$OOO_VENDOR])
13770 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
13771 AC_SUBST(OOO_VENDOR)
13773 if test "$_os" = "Android" ; then
13774     ANDROID_PACKAGE_NAME=
13775     AC_MSG_CHECKING([for Android package name])
13776     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
13777         if test -n "$ENABLE_DEBUG"; then
13778             # Default to the package name that makes ndk-gdb happy.
13779             ANDROID_PACKAGE_NAME="org.libreoffice"
13780         else
13781             ANDROID_PACKAGE_NAME="org.example.libreoffice"
13782         fi
13784         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
13785     else
13786         ANDROID_PACKAGE_NAME="$with_android_package_name"
13787         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
13788     fi
13789     AC_SUBST(ANDROID_PACKAGE_NAME)
13792 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
13793 if test "$with_compat_oowrappers" = "yes"; then
13794     WITH_COMPAT_OOWRAPPERS=TRUE
13795     AC_MSG_RESULT(yes)
13796 else
13797     WITH_COMPAT_OOWRAPPERS=
13798     AC_MSG_RESULT(no)
13800 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
13802 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
13803 AC_MSG_CHECKING([for install dirname])
13804 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
13805     INSTALLDIRNAME="$with_install_dirname"
13807 AC_MSG_RESULT([$INSTALLDIRNAME])
13808 AC_SUBST(INSTALLDIRNAME)
13810 AC_MSG_CHECKING([for prefix])
13811 test "x$prefix" = xNONE && prefix=$ac_default_prefix
13812 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
13813 PREFIXDIR="$prefix"
13814 AC_MSG_RESULT([$PREFIXDIR])
13815 AC_SUBST(PREFIXDIR)
13817 LIBDIR=[$(eval echo $(eval echo $libdir))]
13818 AC_SUBST(LIBDIR)
13820 DATADIR=[$(eval echo $(eval echo $datadir))]
13821 AC_SUBST(DATADIR)
13823 MANDIR=[$(eval echo $(eval echo $mandir))]
13824 AC_SUBST(MANDIR)
13826 DOCDIR=[$(eval echo $(eval echo $docdir))]
13827 AC_SUBST(DOCDIR)
13829 BINDIR=[$(eval echo $(eval echo $bindir))]
13830 AC_SUBST(BINDIR)
13832 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
13833 AC_SUBST(INSTALLDIR)
13835 TESTINSTALLDIR="${BUILDDIR}/test-install"
13836 AC_SUBST(TESTINSTALLDIR)
13839 # ===================================================================
13840 # OAuth2 id and secrets
13841 # ===================================================================
13843 AC_MSG_CHECKING([for Google Drive client id and secret])
13844 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
13845     AC_MSG_RESULT([not set])
13846     GDRIVE_CLIENT_ID="\"\""
13847     GDRIVE_CLIENT_SECRET="\"\""
13848 else
13849     AC_MSG_RESULT([set])
13850     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
13851     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
13853 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
13854 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
13856 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
13857 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
13858     AC_MSG_RESULT([not set])
13859     ALFRESCO_CLOUD_CLIENT_ID="\"\""
13860     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
13861 else
13862     AC_MSG_RESULT([set])
13863     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
13864     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
13866 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
13867 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
13869 AC_MSG_CHECKING([for OneDrive client id and secret])
13870 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
13871     AC_MSG_RESULT([not set])
13872     ONEDRIVE_CLIENT_ID="\"\""
13873     ONEDRIVE_CLIENT_SECRET="\"\""
13874 else
13875     AC_MSG_RESULT([set])
13876     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
13877     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
13879 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
13880 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
13883 dnl ===================================================================
13884 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
13885 dnl --enable-dependency-tracking configure option
13886 dnl ===================================================================
13887 AC_MSG_CHECKING([whether to enable dependency tracking])
13888 if test "$enable_dependency_tracking" = "no"; then
13889     nodep=TRUE
13890     AC_MSG_RESULT([no])
13891 else
13892     AC_MSG_RESULT([yes])
13894 AC_SUBST(nodep)
13896 dnl ===================================================================
13897 dnl Number of CPUs to use during the build
13898 dnl ===================================================================
13899 AC_MSG_CHECKING([for number of processors to use])
13900 # plain --with-parallelism is just the default
13901 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
13902     if test "$with_parallelism" = "no"; then
13903         PARALLELISM=0
13904     else
13905         PARALLELISM=$with_parallelism
13906     fi
13907 else
13908     if test "$enable_icecream" = "yes"; then
13909         PARALLELISM="40"
13910     else
13911         case `uname -s` in
13913         Darwin|FreeBSD|NetBSD|OpenBSD)
13914             PARALLELISM=`sysctl -n hw.ncpu`
13915             ;;
13917         Linux)
13918             PARALLELISM=`getconf _NPROCESSORS_ONLN`
13919         ;;
13920         # what else than above does profit here *and* has /proc?
13921         *)
13922             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
13923             ;;
13924         esac
13926         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
13927         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
13928     fi
13931 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
13932     if test -z "$with_parallelism"; then
13933             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
13934             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
13935             PARALLELISM="1"
13936     else
13937         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."
13938     fi
13941 if test $PARALLELISM -eq 0; then
13942     AC_MSG_RESULT([explicit make -j option needed])
13943 else
13944     AC_MSG_RESULT([$PARALLELISM])
13946 AC_SUBST(PARALLELISM)
13948 IWYU_PATH="$with_iwyu"
13949 AC_SUBST(IWYU_PATH)
13950 if test ! -z "$IWYU_PATH"; then
13951     if test ! -f "$IWYU_PATH"; then
13952         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
13953     fi
13957 # Set up ILIB for MSVC build
13959 ILIB1=
13960 if test "$build_os" = "cygwin"; then
13961     ILIB="."
13962     if test -n "$JAVA_HOME"; then
13963         ILIB="$ILIB;$JAVA_HOME/lib"
13964     fi
13965     ILIB1=-link
13966     ILIB="$ILIB;$COMPATH/lib/$WIN_HOST_ARCH"
13967     ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/$WIN_HOST_ARCH"
13968     ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
13969     ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
13970     if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
13971         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
13972         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
13973     fi
13974     PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/$WIN_HOST_ARCH"
13975     ucrtlibpath_formatted=$formatted_path
13976     ILIB="$ILIB;$ucrtlibpath_formatted"
13977     ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
13978     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
13979         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
13980     else
13981         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WIN_HOST_ARCH"
13982     fi
13984     if test "$cross_compiling" != "yes"; then
13985         ILIB_FOR_BUILD="$ILIB"
13986     fi
13988 AC_SUBST(ILIB)
13989 AC_SUBST(ILIB_FOR_BUILD)
13991 # ===================================================================
13992 # Creating bigger shared library to link against
13993 # ===================================================================
13994 AC_MSG_CHECKING([whether to create huge library])
13995 MERGELIBS=
13997 if test $_os = iOS -o $_os = Android; then
13998     # Never any point in mergelibs for these as we build just static
13999     # libraries anyway...
14000     enable_mergelibs=no
14003 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
14004     if test $_os != Linux -a $_os != WINNT; then
14005         add_warning "--enable-mergelibs is not tested for this platform"
14006     fi
14007     MERGELIBS="TRUE"
14008     AC_MSG_RESULT([yes])
14009     AC_DEFINE(ENABLE_MERGELIBS)
14010 else
14011     AC_MSG_RESULT([no])
14013 AC_SUBST([MERGELIBS])
14015 dnl ===================================================================
14016 dnl icerun is a wrapper that stops us spawning tens of processes
14017 dnl locally - for tools that can't be executed on the compile cluster
14018 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
14019 dnl ===================================================================
14020 AC_MSG_CHECKING([whether to use icerun wrapper])
14021 ICECREAM_RUN=
14022 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
14023     ICECREAM_RUN=icerun
14024     AC_MSG_RESULT([yes])
14025 else
14026     AC_MSG_RESULT([no])
14028 AC_SUBST(ICECREAM_RUN)
14030 dnl ===================================================================
14031 dnl Setup the ICECC_VERSION for the build the same way it was set for
14032 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
14033 dnl ===================================================================
14034 x_ICECC_VERSION=[\#]
14035 if test -n "$ICECC_VERSION" ; then
14036     x_ICECC_VERSION=
14038 AC_SUBST(x_ICECC_VERSION)
14039 AC_SUBST(ICECC_VERSION)
14041 dnl ===================================================================
14043 AC_MSG_CHECKING([MPL subset])
14044 MPL_SUBSET=
14046 if test "$enable_mpl_subset" = "yes"; then
14047     warn_report=false
14048     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
14049         warn_report=true
14050     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
14051         warn_report=true
14052     fi
14053     if test "$warn_report" = "true"; then
14054         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
14055     fi
14056     if test "x$enable_postgresql_sdbc" != "xno"; then
14057         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
14058     fi
14059     if test "$enable_lotuswordpro" = "yes"; then
14060         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
14061     fi
14062     if test "$WITH_WEBDAV" = "neon"; then
14063         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
14064     fi
14065     if test -n "$ENABLE_POPPLER"; then
14066         if test "x$SYSTEM_POPPLER" = "x"; then
14067             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
14068         fi
14069     fi
14070     # cf. m4/libo_check_extension.m4
14071     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
14072         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
14073     fi
14074     for theme in $WITH_THEMES; do
14075         case $theme in
14076         breeze|breeze_dark|breeze_dark_svg|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #denylist of icon themes under GPL or LGPL
14077             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=colibre]) ;;
14078         *) : ;;
14079         esac
14080     done
14082     ENABLE_OPENGL_TRANSITIONS=
14084     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
14085         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
14086     fi
14088     MPL_SUBSET="TRUE"
14089     AC_DEFINE(MPL_HAVE_SUBSET)
14090     AC_MSG_RESULT([only])
14091 else
14092     AC_MSG_RESULT([no restrictions])
14094 AC_SUBST(MPL_SUBSET)
14096 dnl ===================================================================
14098 AC_MSG_CHECKING([formula logger])
14099 ENABLE_FORMULA_LOGGER=
14101 if test "x$enable_formula_logger" = "xyes"; then
14102     AC_MSG_RESULT([yes])
14103     AC_DEFINE(ENABLE_FORMULA_LOGGER)
14104     ENABLE_FORMULA_LOGGER=TRUE
14105 elif test -n "$ENABLE_DBGUTIL" ; then
14106     AC_MSG_RESULT([yes])
14107     AC_DEFINE(ENABLE_FORMULA_LOGGER)
14108     ENABLE_FORMULA_LOGGER=TRUE
14109 else
14110     AC_MSG_RESULT([no])
14113 AC_SUBST(ENABLE_FORMULA_LOGGER)
14115 dnl ===================================================================
14116 dnl Checking for active Antivirus software.
14117 dnl ===================================================================
14119 if test $_os = WINNT -a -f "$SRC_ROOT/antivirusDetection.vbs" ; then
14120     AC_MSG_CHECKING([for active Antivirus software])
14121     ANTIVIRUS_LIST=`cscript.exe //Nologo $SRC_ROOT/antivirusDetection.vbs`
14122     if [ [ "$ANTIVIRUS_LIST" != "NULL" ] ]; then
14123         if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then
14124             AC_MSG_RESULT([found])
14125             EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
14126             echo $EICAR_STRING > $SRC_ROOT/eicar
14127             EICAR_TEMP_FILE_CONTENTS=`cat $SRC_ROOT/eicar`
14128             rm $SRC_ROOT/eicar
14129             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
14130                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
14131             fi
14132             echo $EICAR_STRING > $BUILDDIR/eicar
14133             EICAR_TEMP_FILE_CONTENTS=`cat $BUILDDIR/eicar`
14134             rm $BUILDDIR/eicar
14135             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
14136                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
14137             fi
14138             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"
14139         else
14140             AC_MSG_RESULT([not found])
14141         fi
14142     else
14143         AC_MSG_RESULT([n/a])
14144     fi
14147 dnl ===================================================================
14148 dnl Setting up the environment.
14149 dnl ===================================================================
14150 AC_MSG_NOTICE([setting up the build environment variables...])
14152 AC_SUBST(COMPATH)
14154 if test "$build_os" = "cygwin"; then
14155     if test -d "$COMPATH/atlmfc/lib/spectre"; then
14156         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
14157         ATL_INCLUDE="$COMPATH/atlmfc/include"
14158     elif test -d "$COMPATH/atlmfc/lib"; then
14159         ATL_LIB="$COMPATH/atlmfc/lib"
14160         ATL_INCLUDE="$COMPATH/atlmfc/include"
14161     else
14162         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
14163         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
14164     fi
14165     ATL_LIB="$ATL_LIB/$WIN_HOST_ARCH"
14166     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
14167     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
14169     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
14170     PathFormat "/usr/bin/find.exe"
14171     FIND="$formatted_path"
14172     PathFormat "/usr/bin/sort.exe"
14173     SORT="$formatted_path"
14174     PathFormat "/usr/bin/grep.exe"
14175     WIN_GREP="$formatted_path"
14176     PathFormat "/usr/bin/ls.exe"
14177     WIN_LS="$formatted_path"
14178     PathFormat "/usr/bin/touch.exe"
14179     WIN_TOUCH="$formatted_path"
14180 else
14181     FIND=find
14182     SORT=sort
14185 AC_SUBST(ATL_INCLUDE)
14186 AC_SUBST(ATL_LIB)
14187 AC_SUBST(FIND)
14188 AC_SUBST(SORT)
14189 AC_SUBST(WIN_GREP)
14190 AC_SUBST(WIN_LS)
14191 AC_SUBST(WIN_TOUCH)
14193 AC_SUBST(BUILD_TYPE)
14195 AC_SUBST(SOLARINC)
14197 PathFormat "$PERL"
14198 PERL="$formatted_path"
14199 AC_SUBST(PERL)
14201 if test -n "$TMPDIR"; then
14202     TEMP_DIRECTORY="$TMPDIR"
14203 else
14204     TEMP_DIRECTORY="/tmp"
14206 if test "$build_os" = "cygwin"; then
14207     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
14209 AC_SUBST(TEMP_DIRECTORY)
14211 # setup the PATH for the environment
14212 if test -n "$LO_PATH_FOR_BUILD"; then
14213     LO_PATH="$LO_PATH_FOR_BUILD"
14214     case "$host_os" in
14215     cygwin*|wsl*)
14216         pathmunge "$MSVC_HOST_PATH" "before"
14217         ;;
14218     esac
14219 else
14220     LO_PATH="$PATH"
14222     case "$host_os" in
14224     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
14225         if test "$ENABLE_JAVA" != ""; then
14226             pathmunge "$JAVA_HOME/bin" "after"
14227         fi
14228         ;;
14230     cygwin*|wsl*)
14231         # Win32 make needs native paths
14232         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
14233             LO_PATH=`cygpath -p -m "$PATH"`
14234         fi
14235         if test "$WIN_BUILD_ARCH" = "x64"; then
14236             # needed for msi packaging
14237             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
14238         fi
14239         # .NET 4.6 and higher don't have bin directory
14240         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
14241             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
14242         fi
14243         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
14244         pathmunge "$CSC_PATH" "before"
14245         pathmunge "$MIDL_PATH" "before"
14246         pathmunge "$AL_PATH" "before"
14247         pathmunge "$MSVC_MULTI_PATH" "before"
14248         pathmunge "$MSVC_BUILD_PATH" "before"
14249         if test -n "$MSBUILD_PATH" ; then
14250             pathmunge "$MSBUILD_PATH" "before"
14251         fi
14252         pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/$WIN_BUILD_ARCH" "before"
14253         if test "$ENABLE_JAVA" != ""; then
14254             if test -d "$JAVA_HOME/jre/bin/client"; then
14255                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
14256             fi
14257             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
14258                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
14259             fi
14260             pathmunge "$JAVA_HOME/bin" "before"
14261         fi
14262         pathmunge "$MSVC_HOST_PATH" "before"
14263         ;;
14265     solaris*)
14266         pathmunge "/usr/css/bin" "before"
14267         if test "$ENABLE_JAVA" != ""; then
14268             pathmunge "$JAVA_HOME/bin" "after"
14269         fi
14270         ;;
14271     esac
14274 AC_SUBST(LO_PATH)
14276 # Allow to pass LO_ELFCHECK_ALLOWLIST from autogen.input to bin/check-elf-dynamic-objects:
14277 if test "$LO_ELFCHECK_ALLOWLIST" = x || test "${LO_ELFCHECK_ALLOWLIST-x}" != x; then
14278     x_LO_ELFCHECK_ALLOWLIST=
14279 else
14280     x_LO_ELFCHECK_ALLOWLIST=[\#]
14282 AC_SUBST(x_LO_ELFCHECK_ALLOWLIST)
14283 AC_SUBST(LO_ELFCHECK_ALLOWLIST)
14285 libo_FUZZ_SUMMARY
14287 # Generate a configuration sha256 we can use for deps
14288 if test -f config_host.mk; then
14289     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
14291 if test -f config_host_lang.mk; then
14292     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
14295 CFLAGS=$my_original_CFLAGS
14296 CXXFLAGS=$my_original_CXXFLAGS
14297 CPPFLAGS=$my_original_CPPFLAGS
14299 AC_CONFIG_LINKS([include:include])
14301 # Keep in sync with list of files far up, at AC_MSG_CHECKING([for
14302 # BUILD platform configuration] - otherwise breaks cross building
14303 AC_CONFIG_FILES([config_host.mk
14304                  config_host_lang.mk
14305                  Makefile
14306                  bin/bffvalidator.sh
14307                  bin/odfvalidator.sh
14308                  bin/officeotron.sh
14309                  hardened_runtime.xcent
14310                  instsetoo_native/util/openoffice.lst
14311                  sysui/desktop/macosx/Info.plist
14312                  vs-code-template.code-workspace:.vscode/vs-code-template.code-workspace.in])
14313 AC_CONFIG_HEADERS([config_host/config_buildid.h])
14314 AC_CONFIG_HEADERS([config_host/config_box2d.h])
14315 AC_CONFIG_HEADERS([config_host/config_clang.h])
14316 AC_CONFIG_HEADERS([config_host/config_crypto.h])
14317 AC_CONFIG_HEADERS([config_host/config_dconf.h])
14318 AC_CONFIG_HEADERS([config_host/config_eot.h])
14319 AC_CONFIG_HEADERS([config_host/config_extensions.h])
14320 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
14321 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
14322 AC_CONFIG_HEADERS([config_host/config_dbus.h])
14323 AC_CONFIG_HEADERS([config_host/config_features.h])
14324 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
14325 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
14326 AC_CONFIG_HEADERS([config_host/config_firebird.h])
14327 AC_CONFIG_HEADERS([config_host/config_folders.h])
14328 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
14329 AC_CONFIG_HEADERS([config_host/config_gio.h])
14330 AC_CONFIG_HEADERS([config_host/config_global.h])
14331 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
14332 AC_CONFIG_HEADERS([config_host/config_java.h])
14333 AC_CONFIG_HEADERS([config_host/config_langs.h])
14334 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
14335 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
14336 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
14337 AC_CONFIG_HEADERS([config_host/config_locales.h])
14338 AC_CONFIG_HEADERS([config_host/config_mpl.h])
14339 AC_CONFIG_HEADERS([config_host/config_oox.h])
14340 AC_CONFIG_HEADERS([config_host/config_options.h])
14341 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
14342 AC_CONFIG_HEADERS([config_host/config_zxing.h])
14343 AC_CONFIG_HEADERS([config_host/config_skia.h])
14344 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
14345 AC_CONFIG_HEADERS([config_host/config_vendor.h])
14346 AC_CONFIG_HEADERS([config_host/config_vcl.h])
14347 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
14348 AC_CONFIG_HEADERS([config_host/config_version.h])
14349 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
14350 AC_CONFIG_HEADERS([config_host/config_poppler.h])
14351 AC_CONFIG_HEADERS([config_host/config_python.h])
14352 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
14353 AC_OUTPUT
14355 if test "$CROSS_COMPILING" = TRUE; then
14356     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
14359 # touch the config timestamp file
14360 if test ! -f config_host.mk.stamp; then
14361     echo > config_host.mk.stamp
14362 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
14363     echo "Host Configuration unchanged - avoiding scp2 stamp update"
14364 else
14365     echo > config_host.mk.stamp
14368 # touch the config lang timestamp file
14369 if test ! -f config_host_lang.mk.stamp; then
14370     echo > config_host_lang.mk.stamp
14371 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
14372     echo "Language Configuration unchanged - avoiding scp2 stamp update"
14373 else
14374     echo > config_host_lang.mk.stamp
14378 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
14379         -a "$build_os" = "cygwin"; then
14381 cat << _EOS
14382 ****************************************************************************
14383 WARNING:
14384 Your make version is known to be horribly slow, and hard to debug
14385 problems with. To get a reasonably functional make please do:
14387 to install a pre-compiled binary make for Win32
14389  mkdir -p /opt/lo/bin
14390  cd /opt/lo/bin
14391  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
14392  cp make-4.2.1-msvc.exe make
14393  chmod +x make
14395 to install from source:
14396 place yourself in a working directory of you choice.
14398  git clone git://git.savannah.gnu.org/make.git
14400  [go to Start menu, open "Visual Studio 2019", click "x86 Native Tools Command Prompt" or "x64 Native Tools Command Prompt"]
14401  set PATH=%PATH%;C:\Cygwin\bin
14402  [or Cygwin64, if that is what you have]
14403  cd path-to-make-repo-you-cloned-above
14404  build_w32.bat --without-guile
14406 should result in a WinRel/gnumake.exe.
14407 Copy it to the Cygwin /opt/lo/bin directory as make.exe
14409 Then re-run autogen.sh
14411 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
14412 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
14414 _EOS
14415 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
14416     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
14421 cat << _EOF
14422 ****************************************************************************
14424 To build, run:
14425 $GNUMAKE
14427 To view some help, run:
14428 $GNUMAKE help
14430 _EOF
14432 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
14433     cat << _EOF
14434 After the build has finished successfully, you can immediately run what you built using the command:
14435 _EOF
14437     if test $_os = Darwin; then
14438         echo open instdir/$PRODUCTNAME_WITHOUT_SPACES.app
14439     else
14440         echo instdir/program/soffice
14441     fi
14442     cat << _EOF
14444 If you want to run the smoketest, run:
14445 $GNUMAKE check
14447 _EOF
14450 if test -f "$WARNINGS_FILE_FOR_BUILD"; then
14451     echo "BUILD / cross-toolset config, repeated ($WARNINGS_FILE_FOR_BUILD)"
14452     cat "$WARNINGS_FILE_FOR_BUILD"
14453     echo
14456 if test -f "$WARNINGS_FILE"; then
14457     echo "HOST config ($WARNINGS_FILE)"
14458     cat "$WARNINGS_FILE"
14461 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: