sw: undo/redo: change undo id for numbering
[LibreOffice.git] / configure.ac
blob675a6a1e8395e05941e2516d14b66e368fa8049b
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 100 -*-
2 dnl configure.ac serves as input for the GNU autoconf package
3 dnl in order to create a configure script.
5 # The version number in the second argument to AC_INIT should be four numbers separated by
6 # periods. Some parts of the code requires the first one to be less than 128 and the others to be less
7 # than 256. The four numbers can optionally be followed by a period and a free-form string containing
8 # no spaces or periods, like "frobozz-mumble-42" or "alpha0". If the free-form string ends with one or
9 # several non-alphanumeric characters, those are split off and used only for the
10 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
12 AC_INIT([LibreOffice],[7.3.0.0.alpha0+],[],[],[http://documentfoundation.org/])
14 dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed
15 dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard
16 dnl so check for the version of autoconf that is actually used to create the configure script
17 AC_PREREQ([2.59])
18 m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.68]), -1,
19     [AC_MSG_ERROR([at least autoconf version 2.68 is needed (you can use AUTOCONF environment variable to point to a suitable one)])])
21 if test -n "$BUILD_TYPE"; then
22     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
25 save_CC=$CC
26 save_CXX=$CXX
28 first_arg_basename()
30     for i in $1; do
31         basename "$i"
32         break
33     done
36 CC_BASE=`first_arg_basename "$CC"`
37 CXX_BASE=`first_arg_basename "$CXX"`
39 BUILD_TYPE="LibO"
40 SCPDEFS=""
41 GIT_NEEDED_SUBMODULES=""
42 LO_PATH= # used by path_munge to construct a PATH variable
44 FilterLibs()
46     # Return value: $filteredlibs
48     filteredlibs=
49     for f in $1; do
50         case "$f" in
51             # let's start with Fedora's paths for now
52             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
53                 # ignore it: on UNIXoids it is searched by default anyway
54                 # but if it's given explicitly then it may override other paths
55                 # (on macOS it would be an error to use it instead of SDK)
56                 ;;
57             *)
58                 filteredlibs="$filteredlibs $f"
59                 ;;
60         esac
61     done
64 PathFormat()
66     # Args: $1: A pathname. On Cygwin and WSL, in either the Unix or the Windows format. Note that this
67     # function is called also on Unix.
68     #
69     # Return value: $formatted_path and $formatted_path_unix.
70     #
71     # $formatted_path is the argument in Windows format, but using forward slashes instead of
72     # backslashes, using 8.3 pathname components if necessary (if it otherwise would contains spaces
73     # or shell metacharacters).
74     #
75     # $formatted_path_unix is the argument in a form usable in Cygwin or WSL, using 8.3 components if
76     # necessary. On Cygwin, it is the same as $formatted_path, but on WSL it is $formatted_path as a
77     # Unix pathname.
78     #
79     # Errors out if 8.3 names are needed but aren't present for some of the path components.
81     # Examples:
82     #
83     # /home/tml/lo/master-optimised => C:/cygwin64/home/tml/lo/master-optimised
84     #
85     # C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe => C:/PROGRA~2/MICROS~3/INSTAL~1/vswhere.exe
86     #
87     # C:\Program Files (x86)\Microsoft Visual Studio\2019\Community => C:/PROGRA~2/MICROS~3/2019/COMMUN~1
88     #
89     # C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/ucrt => C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/ucrt
90     #
91     # /cygdrive/c/PROGRA~2/WI3CF2~1/10 => C:/PROGRA~2/WI3CF2~1/10
92     #
93     # C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\ => C:/PROGRA~2/WI3CF2~1/NETFXSDK/4.8/
94     #
95     # /usr/bin/find.exe => C:/cygwin64/bin/find.exe
97     if test -n "$UNITTEST_WSL_PATHFORMAT"; then
98         printf "PathFormat $1 ==> "
99     fi
101     formatted_path="$1"
102     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
103         if test "$build_os" = "wsl"; then
104             formatted_path=$(echo "$formatted_path" | tr -d '\r')
105         fi
107         pf_conv_to_dos=
108         # spaces,parentheses,brackets,braces are problematic in pathname
109         # so are backslashes
110         case "$formatted_path" in
111             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
112                 pf_conv_to_dos="yes"
113             ;;
114         esac
115         if test "$pf_conv_to_dos" = "yes"; then
116             if test "$build_os" = "wsl"; then
117                 case "$formatted_path" in
118                     /*)
119                         formatted_path=$(wslpath -w "$formatted_path")
120                         ;;
121                 esac
122                 formatted_path=$($BUILDDIR/solenv/wsl/wsl-lo-helper.exe --8.3 "$formatted_path")
123             elif test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
124                 formatted_path=`cygpath -sm "$formatted_path"`
125             else
126                 formatted_path=`cygpath -d "$formatted_path"`
127             fi
128             if test $? -ne 0;  then
129                 AC_MSG_ERROR([path conversion failed for "$1".])
130             fi
131         fi
132         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
133         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
134         if test "$fp_count_slash$fp_count_colon" != "00"; then
135             if test "$fp_count_colon" = "0"; then
136                 new_formatted_path=`realpath "$formatted_path"`
137                 if test $? -ne 0;  then
138                     AC_MSG_WARN([realpath failed for "$formatted_path", not necessarily a problem.])
139                 else
140                     formatted_path="$new_formatted_path"
141                 fi
142             fi
143             if test "$build_os" = "wsl"; then
144                 if test "$fp_count_colon" != "0"; then
145                     formatted_path=$(wslpath "$formatted_path")
146                     local final_slash=
147                     case "$formatted_path" in
148                         */)
149                             final_slash=/
150                             ;;
151                     esac
152                     formatted_path=$(wslpath -m $formatted_path)
153                     case "$formatted_path" in
154                         */)
155                             ;;
156                         *)
157                             formatted_path="$formatted_path"$final_slash
158                             ;;
159                     esac
160                 else
161                     formatted_path=$(wslpath -m "$formatted_path")
162                 fi
163             else
164                 formatted_path=`cygpath -m "$formatted_path"`
165             fi
166             if test $? -ne 0;  then
167                 AC_MSG_ERROR([path conversion failed for "$1".])
168             fi
169         fi
170         fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
171         if test "$fp_count_space" != "0"; then
172             AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
173         fi
174     fi
175     if test "$build_os" = "wsl"; then
176         # WSL can't run Windows binaries from Windows pathnames so we need a separate return value in Unix format
177         formatted_path_unix=$(wslpath "$formatted_path")
178     else
179         # But Cygwin can
180         formatted_path_unix="$formatted_path"
181     fi
184 AbsolutePath()
186     # There appears to be no simple and portable method to get an absolute and
187     # canonical path, so we try creating the directory if does not exist and
188     # utilizing the shell and pwd.
190     # Args: $1: A possibly relative pathname
191     # Return value: $absolute_path
193     local rel="$1"
194     absolute_path=""
195     test ! -e "$rel" && mkdir -p "$rel"
196     if test -d "$rel" ; then
197         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
198         absolute_path="$(pwd)"
199         cd - > /dev/null
200     else
201         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
202     fi
205 WARNINGS_FILE=config.warn
206 WARNINGS_FILE_FOR_BUILD=config.Build.warn
207 rm -f "$WARNINGS_FILE" "$WARNINGS_FILE_FOR_BUILD"
208 have_WARNINGS="no"
209 add_warning()
211     if test "$have_WARNINGS" = "no"; then
212         echo "*************************************" > "$WARNINGS_FILE"
213         have_WARNINGS="yes"
214         if which tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
215             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
216             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
217         else
218             COLORWARN="* WARNING :"
219         fi
220     fi
221     echo "$COLORWARN $@" >> "$WARNINGS_FILE"
224 dnl Some Mac User have the bad habit of letting a lot of crap
225 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
226 dnl that confuse the build.
227 dnl For the ones that use LODE, let's be nice and protect them
228 dnl from themselves
230 mac_sanitize_path()
232     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
233 dnl a common but nevertheless necessary thing that may be in a fancy
234 dnl path location is git, so make sure we have it
235     mac_git_path=`which git 2>/dev/null`
236     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
237         mac_path="$mac_path:`dirname $mac_git_path`"
238     fi
239 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
240 dnl path location is gpg, so make sure we find it
241     mac_gpg_path=`which gpg 2>/dev/null`
242     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
243         mac_path="$mac_path:`dirname $mac_gpg_path`"
244     fi
245     PATH="$mac_path"
246     unset mac_path
247     unset mac_git_path
248     unset mac_gpg_path
251 echo "********************************************************************"
252 echo "*"
253 echo "*   Running ${PACKAGE_NAME} build configuration."
254 echo "*"
255 echo "********************************************************************"
256 echo ""
258 dnl ===================================================================
259 dnl checks build and host OSes
260 dnl do this before argument processing to allow for platform dependent defaults
261 dnl ===================================================================
263 # Check for WSL (version 2, at least). But if --host is explicitly specified (to really do build for
264 # Linux on WSL) trust that.
265 if test -z "$host" -a -z "$build" -a "`wslsys -v 2>/dev/null`" != ""; then
266     ac_cv_host="x86_64-pc-wsl"
267     ac_cv_host_cpu="x86_64"
268     ac_cv_host_os="wsl"
269     ac_cv_build="$ac_cv_host"
270     ac_cv_build_cpu="$ac_cv_host_cpu"
271     ac_cv_build_os="$ac_cv_host_os"
273     # Emulation of Cygwin's cygpath command for WSL.
274     cygpath()
275     {
276         if test -n "$UNITTEST_WSL_CYGPATH"; then
277             echo -n cygpath "$@" "==> "
278         fi
280         # Cygwin's real cygpath has a plethora of options but we use only a few here.
281         local args="$@"
282         local opt
283         local opt_d opt_m opt_u opt_w opt_l opt_s opt_p
284         OPTIND=1
286         while getopts dmuwlsp opt; do
287             case "$opt" in
288                 \?)
289                     AC_MSG_ERROR([Unimplemented cygpath emulation option in invocation: cygpath $args])
290                     ;;
291                 ?)
292                     eval opt_$opt=yes
293                     ;;
294             esac
295         done
297         shift $((OPTIND-1))
299         if test $# -ne 1; then
300             AC_MSG_ERROR([Invalid cygpath emulation invocation: Pathname missing]);
301         fi
303         local input="$1"
305         local result
307         if test -n "$opt_d" -o -n "$opt_m" -o -n "$opt_w"; then
308             # Print Windows path, possibly in 8.3 form (-d) or with forward slashes (-m)
310             if test -n "$opt_u"; then
311                 AC_MSG_ERROR([Invalid cygpath invocation: Both Windows and Unix path output requested])
312             fi
314             case "$input" in
315                 /mnt/*)
316                     # A Windows file in WSL format
317                     input=$(wslpath -w "$input")
318                     ;;
319                 [[a-zA-Z]]:\\* | \\* | [[a-zA-Z]]:/* | /*)
320                     # Already in Windows format
321                     ;;
322                 /*)
323                     input=$(wslpath -w "$input")
324                     ;;
325                 *)
326                     AC_MSG_ERROR([Invalid cygpath invocation: Path '$input' is not absolute])
327                     ;;
328             esac
329             if test -n "$opt_d" -o -n "$opt_s"; then
330                 input=$($BUILDDIR/solenv/wsl/wsl-lo-helper.exe --8.3 "$input")
331             fi
332             if test -n "$opt_m"; then
333                 input="${input//\\//}"
334             fi
335             echo "$input"
336         else
337             # Print Unix path
339             case "$input" in
340                 [[a-zA-Z]]:\\* | \\* | [[a-zA-Z]]:/* | /*)
341                     wslpath -u "$input"
342                     ;;
343                 /)
344                     echo "$input"
345                     ;;
346                 *)
347                     AC_MSG_ERROR([Invalid cygpath invocation: Path '$input' is not absolute])
348                     ;;
349             esac
350         fi
351     }
353     if test -n "$UNITTEST_WSL_CYGPATH"; then
354         BUILDDIR=.
356         # Nothing special with these file names, just arbitrary ones picked to test with
357         cygpath -d /usr/lib64/ld-linux-x86-64.so.2
358         cygpath -w /usr/lib64/ld-linux-x86-64.so.2
359         cygpath -m /usr/lib64/ld-linux-x86-64.so.2
360         cygpath -m -s /usr/lib64/ld-linux-x86-64.so.2
361         # At least on my machine for instance this file does have an 8.3 name
362         cygpath -d /mnt/c/windows/WindowsUpdate.log
363         # But for instance this one doesn't
364         cygpath -w /mnt/c/windows/system32/AboutSettingsHandlers.dll
365         cygpath -ws /mnt/c/windows/WindowsUpdate.log
366         cygpath -m /mnt/c/windows/system32/AboutSettingsHandlers.dll
367         cygpath -ms /mnt/c/windows/WindowsUpdate.log
369         cygpath -u 'c:\windows\system32\AboutSettingsHandlers.dll'
370         cygpath -u 'c:/windows/system32/AboutSettingsHandlers.dll'
372         exit 0
373     fi
376 AC_CANONICAL_HOST
377 AC_CANONICAL_BUILD
379 if test -n "$UNITTEST_WSL_PATHFORMAT"; then
380     BUILDDIR=.
381     GREP=grep
383     # Use of PathFormat must be after AC_CANONICAL_BUILD above
384     PathFormat /
385     printf "$formatted_path , $formatted_path_unix\n"
387     PathFormat $PWD
388     printf "$formatted_path , $formatted_path_unix\n"
390     PathFormat "$PROGRAMFILESX86"
391     printf "$formatted_path , $formatted_path_unix\n"
393     exit 0
396 AC_MSG_CHECKING([for product name])
397 PRODUCTNAME="AC_PACKAGE_NAME"
398 if test -n "$with_product_name" -a "$with_product_name" != no; then
399     PRODUCTNAME="$with_product_name"
401 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
402     PRODUCTNAME="${PRODUCTNAME}Dev"
404 AC_MSG_RESULT([$PRODUCTNAME])
405 AC_SUBST(PRODUCTNAME)
406 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
407 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
409 dnl ===================================================================
410 dnl Our version is defined by the AC_INIT() at the top of this script.
411 dnl ===================================================================
413 AC_MSG_CHECKING([for package version])
414 if test -n "$with_package_version" -a "$with_package_version" != no; then
415     PACKAGE_VERSION="$with_package_version"
417 AC_MSG_RESULT([$PACKAGE_VERSION])
419 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
421 LIBO_VERSION_MAJOR=$1
422 LIBO_VERSION_MINOR=$2
423 LIBO_VERSION_MICRO=$3
424 LIBO_VERSION_PATCH=$4
426 LIBO_VERSION_SUFFIX=$5
428 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
429 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
430 # they get undoubled before actually passed to sed.
431 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
432 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
433 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
434 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
436 # The value for key CFBundleVersion in the Info.plist file must be a period-separated list of at most
437 # three non-negative integers. Please find more information about CFBundleVersion at
438 # https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleversion
440 # The value for key CFBundleShortVersionString in the Info.plist file must be a period-separated list
441 # of at most three non-negative integers. Please find more information about
442 # CFBundleShortVersionString at
443 # https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleshortversionstring
445 # But that is enforced only in the App Store, and we apparently want to break the rules otherwise.
447 if test "$enable_macosx_sandbox" = yes; then
448     MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
449     MACOSX_BUNDLE_VERSION=$MACOSX_BUNDLE_SHORTVERSION
450 else
451     MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.$LIBO_VERSION_MICRO.$LIBO_VERSION_PATCH
452     MACOSX_BUNDLE_VERSION=$MACOSX_BUNDLE_SHORTVERSION$LIBO_VERSION_SUFFIX
455 AC_SUBST(LIBO_VERSION_MAJOR)
456 AC_SUBST(LIBO_VERSION_MINOR)
457 AC_SUBST(LIBO_VERSION_MICRO)
458 AC_SUBST(LIBO_VERSION_PATCH)
459 AC_SUBST(LIBO_VERSION_SUFFIX)
460 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
461 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
462 AC_SUBST(MACOSX_BUNDLE_VERSION)
464 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
465 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
466 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
467 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
469 LIBO_THIS_YEAR=`date +%Y`
470 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
472 dnl ===================================================================
473 dnl Product version
474 dnl ===================================================================
475 AC_MSG_CHECKING([for product version])
476 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
477 AC_MSG_RESULT([$PRODUCTVERSION])
478 AC_SUBST(PRODUCTVERSION)
480 AC_PROG_EGREP
481 # AC_PROG_EGREP doesn't set GREP on all systems as well
482 AC_PATH_PROG(GREP, grep)
484 BUILDDIR=`pwd`
485 cd $srcdir
486 SRC_ROOT=`pwd`
487 cd $BUILDDIR
488 x_Cygwin=[\#]
490 dnl ======================================
491 dnl Required GObject introspection version
492 dnl ======================================
493 INTROSPECTION_REQUIRED_VERSION=1.32.0
495 dnl ===================================================================
496 dnl Search all the common names for GNU Make
497 dnl ===================================================================
498 AC_MSG_CHECKING([for GNU Make])
500 # try to use our own make if it is available and GNUMAKE was not already defined
501 if test -z "$GNUMAKE"; then
502     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
503         GNUMAKE="$LODE_HOME/opt/bin/make"
504     elif test -x "/opt/lo/bin/make"; then
505         GNUMAKE="/opt/lo/bin/make"
506     fi
509 GNUMAKE_WIN_NATIVE=
510 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
511     if test -n "$a"; then
512         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
513         if test $? -eq 0;  then
514             if test "$build_os" = "cygwin"; then
515                 if test -n "$($a -v | grep 'Built for Windows')" ; then
516                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
517                     GNUMAKE_WIN_NATIVE="TRUE"
518                 else
519                     GNUMAKE=`which $a`
520                 fi
521             else
522                 GNUMAKE=`which $a`
523             fi
524             break
525         fi
526     fi
527 done
528 AC_MSG_RESULT($GNUMAKE)
529 if test -z "$GNUMAKE"; then
530     AC_MSG_ERROR([not found. install GNU Make.])
531 else
532     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
533         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
534     fi
537 win_short_path_for_make()
539     local short_path="$1"
540     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
541         cygpath -sm "$short_path"
542     else
543         cygpath -u "$(cygpath -d "$short_path")"
544     fi
548 if test "$build_os" = "cygwin"; then
549     PathFormat "$SRC_ROOT"
550     SRC_ROOT="$formatted_path"
551     PathFormat "$BUILDDIR"
552     BUILDDIR="$formatted_path"
553     x_Cygwin=
554     AC_MSG_CHECKING(for explicit COMSPEC)
555     if test -z "$COMSPEC"; then
556         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
557     else
558         AC_MSG_RESULT([found: $COMSPEC])
559     fi
562 AC_SUBST(SRC_ROOT)
563 AC_SUBST(BUILDDIR)
564 AC_SUBST(x_Cygwin)
565 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
566 AC_DEFINE_UNQUOTED(SRC_ROOT,"$SRC_ROOT")
567 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
569 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
570     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
573 # need sed in os checks...
574 AC_PATH_PROGS(SED, sed)
575 if test -z "$SED"; then
576     AC_MSG_ERROR([install sed to run this script])
579 # Set the ENABLE_LTO variable
580 # ===================================================================
581 AC_MSG_CHECKING([whether to use link-time optimization])
582 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
583     ENABLE_LTO="TRUE"
584     AC_MSG_RESULT([yes])
585 else
586     ENABLE_LTO=""
587     AC_MSG_RESULT([no])
589 AC_SUBST(ENABLE_LTO)
591 AC_ARG_ENABLE(fuzz-options,
592     AS_HELP_STRING([--enable-fuzz-options],
593         [Randomly enable or disable each of those configurable options
594          that are supposed to be freely selectable without interdependencies,
595          or where bad interaction from interdependencies is automatically avoided.])
598 dnl ===================================================================
599 dnl When building for Android, --with-android-ndk,
600 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
601 dnl mandatory
602 dnl ===================================================================
604 AC_ARG_WITH(android-ndk,
605     AS_HELP_STRING([--with-android-ndk],
606         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
609 AC_ARG_WITH(android-ndk-toolchain-version,
610     AS_HELP_STRING([--with-android-ndk-toolchain-version],
611         [Specify which toolchain version to use, of those present in the
612         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
613         with_android_ndk_toolchain_version=clang5.0)
615 AC_ARG_WITH(android-sdk,
616     AS_HELP_STRING([--with-android-sdk],
617         [Specify location of the Android SDK. Mandatory when building for Android.]),
620 AC_ARG_WITH(android-api-level,
621     AS_HELP_STRING([--with-android-api-level],
622         [Specify the API level when building for Android. Defaults to 16 for ARM and x86 and to 21 for ARM64 and x86-64]),
625 ANDROID_NDK_HOME=
626 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
627     with_android_ndk="$SRC_ROOT/external/android-ndk"
629 if test -n "$with_android_ndk"; then
630     eval ANDROID_NDK_HOME=$with_android_ndk
632     # Set up a lot of pre-canned defaults
634     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
635         if test ! -f $ANDROID_NDK_HOME/source.properties; then
636             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
637         fi
638         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
639     else
640         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
641     fi
642     if test -z "$ANDROID_NDK_VERSION";  then
643         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
644     fi
645     case $ANDROID_NDK_VERSION in
646     r9*|r10*)
647         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
648         ;;
649     11.1.*|12.1.*|13.1.*|14.1.*)
650         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
651         ;;
652     16.*|17.*|18.*|19.*|20.*)
653         ;;
654     *)
655         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk.])
656         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk."
657         ;;
658     esac
660     ANDROID_API_LEVEL=16
661     if test -n "$with_android_api_level" ; then
662         ANDROID_API_LEVEL="$with_android_api_level"
663     fi
665     android_cpu=$host_cpu
666     if test $host_cpu = arm; then
667         android_platform_prefix=arm-linux-androideabi
668         android_gnu_prefix=$android_platform_prefix
669         LLVM_TRIPLE=armv7a-linux-androideabi
670         ANDROID_APP_ABI=armeabi-v7a
671         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
672     elif test $host_cpu = aarch64; then
673         android_platform_prefix=aarch64-linux-android
674         android_gnu_prefix=$android_platform_prefix
675         LLVM_TRIPLE=$android_platform_prefix
676         # minimum android version that supports aarch64
677         if test "$ANDROID_API_LEVEL" -lt "21" ; then
678             ANDROID_API_LEVEL=21
679         fi
680         ANDROID_APP_ABI=arm64-v8a
681     elif test $host_cpu = x86_64; then
682         android_platform_prefix=x86_64-linux-android
683         android_gnu_prefix=$android_platform_prefix
684         LLVM_TRIPLE=$android_platform_prefix
685         # minimum android version that supports x86_64
686         ANDROID_API_LEVEL=21
687         ANDROID_APP_ABI=x86_64
688     else
689         # host_cpu is something like "i386" or "i686" I guess, NDK uses
690         # "x86" in some contexts
691         android_cpu=x86
692         android_platform_prefix=$android_cpu
693         android_gnu_prefix=i686-linux-android
694         LLVM_TRIPLE=$android_gnu_prefix
695         ANDROID_APP_ABI=x86
696     fi
698     case "$with_android_ndk_toolchain_version" in
699     clang5.0)
700         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
701         ;;
702     *)
703         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
704     esac
706     AC_MSG_NOTICE([using the Android API level... $ANDROID_API_LEVEL])
708     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
709     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
710     # manage to link the (app-specific) single huge .so that is built for the app in
711     # android/source/ if there is debug information in a significant part of the object files.
712     # (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
713     # all objects have been built with debug information.)
714     case $build_os in
715     linux-gnu*)
716         android_HOST_TAG=linux-x86_64
717         ;;
718     darwin*)
719         android_HOST_TAG=darwin-x86_64
720         ;;
721     *)
722         AC_MSG_ERROR([We only support building for Android from Linux or macOS])
723         # ndk would also support windows and windows-x86_64
724         ;;
725     esac
726     android_TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$android_HOST_TAG
727     ANDROID_COMPILER_BIN=$android_TOOLCHAIN/bin
728     dnl TODO: NSS build uses it...
729     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION/prebuilt/$android_HOST_TAG
730     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
732     test -z "$AR" && AR=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ar
733     test -z "$NM" && NM=$ANDROID_COMPILER_BIN/$android_gnu_prefix-nm
734     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-objdump
735     test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ranlib
736     test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-strip
738     ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
739     ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
740     if test "$ENABLE_LTO" = TRUE; then
741         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
742         # $CC and $CXX when building external libraries
743         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
744     fi
746     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -stdlib=libc++"
748     if test -z "$CC"; then
749         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
750         CC_BASE="clang"
751     fi
752     if test -z "$CXX"; then
753         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
754         CXX_BASE="clang++"
755     fi
757 AC_SUBST(ANDROID_NDK_HOME)
758 AC_SUBST(ANDROID_APP_ABI)
759 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
761 dnl ===================================================================
762 dnl --with-android-sdk
763 dnl ===================================================================
764 ANDROID_SDK_HOME=
765 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
766     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
768 if test -n "$with_android_sdk"; then
769     eval ANDROID_SDK_HOME=$with_android_sdk
770     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
772 AC_SUBST(ANDROID_SDK_HOME)
774 AC_ARG_ENABLE([android-lok],
775     AS_HELP_STRING([--enable-android-lok],
776         [The Android app from the android/ subdir needs several tweaks all
777          over the place that break the LOK when used in the Online-based
778          Android app.  This switch indicates that the intent of this build is
779          actually the Online-based, non-modified LOK.])
781 ENABLE_ANDROID_LOK=
782 if test -n "$ANDROID_NDK_HOME" ; then
783     if test "$enable_android_lok" = yes; then
784         ENABLE_ANDROID_LOK=TRUE
785         AC_DEFINE(HAVE_FEATURE_ANDROID_LOK)
786         AC_MSG_NOTICE([building the Android version... for the Online-based Android app])
787     else
788         AC_MSG_NOTICE([building the Android version... for the app from the android/ subdir])
789     fi
791 AC_SUBST([ENABLE_ANDROID_LOK])
793 libo_FUZZ_ARG_ENABLE([android-editing],
794     AS_HELP_STRING([--enable-android-editing],
795         [Enable the experimental editing feature on Android.])
797 ENABLE_ANDROID_EDITING=
798 if test "$enable_android_editing" = yes; then
799     ENABLE_ANDROID_EDITING=TRUE
801 AC_SUBST([ENABLE_ANDROID_EDITING])
803 disable_database_connectivity_dependencies()
805     enable_evolution2=no
806     enable_firebird_sdbc=no
807     enable_mariadb_sdbc=no
808     enable_postgresql_sdbc=no
809     enable_report_builder=no
812 # ===================================================================
814 # Start initial platform setup
816 # The using_* variables reflect platform support and should not be
817 # changed after the "End initial platform setup" block.
818 # This is also true for most test_* variables.
819 # ===================================================================
820 build_crypto=yes
821 test_cmis=yes
822 test_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     build_skia=yes
932     if test -n "$LODE_HOME" ; then
933         mac_sanitize_path
934         AC_MSG_NOTICE([sanitized the PATH to $PATH])
935     fi
936     _os=Darwin
937     INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
938     INSTROOTCONTENTSUFFIX=/Contents
939     SDKDIRNAME=${PRODUCTNAME_WITHOUT_SPACES}${PRODUCTVERSION}_SDK
940     # See comment above the case "$host_os"
941     LINKFLAGSSHL="-dynamiclib -single_module"
943     # -fPIC is default
944     PICSWITCH=""
946     DLLPOST=".dylib"
948     # -undefined error is the default
949     LINKFLAGSNOUNDEFS=""
950     case "$host_cpu" in
951     aarch64|arm64)
952         case "$host_os" in
953         macos*)
954             # HOST_PLATFORM is used for external projects and their configury occasionally doesn't like
955             # the "macos" part so be sure to use aarch64-apple-darwin for now.
956             HOST_PLATFORM=aarch64-apple-darwin
957             ;;
958         esac
960         # Apple's Clang uses "arm64"
961         host_cpu_for_clang=arm64
962     esac
965 ios*) # iOS
966     using_freetype_fontconfig=no
967     using_vclplug=no
968     using_x11=no
969     build_crypto=no
970     test_cmis=no
971     test_openldap=no
972     test_webdav=no
973     if test -n "$LODE_HOME" ; then
974         mac_sanitize_path
975         AC_MSG_NOTICE([sanitized the PATH to $PATH])
976     fi
977     enable_gpgmepp=no
978     _os=iOS
979     enable_mpl_subset=yes
980     enable_lotuswordpro=no
981     disable_database_connectivity_dependencies
982     enable_coinmp=no
983     enable_lpsolve=no
984     enable_extension_integration=no
985     enable_xmlhelp=no
986     with_ppds=no
987     if test "$enable_ios_simulator" = "yes"; then
988         host=x86_64-apple-darwin
989     fi
990     # See comment above the case "$host_os"
991     LINKFLAGSSHL="-dynamiclib -single_module"
993     # -fPIC is default
994     PICSWITCH=""
996     DLLPOST=".dylib"
998     # -undefined error is the default
999     LINKFLAGSNOUNDEFS=""
1001     # HOST_PLATFORM is used for external projects and their configury typically doesn't like the "ios"
1002     # part, so use aarch64-apple-darwin for now.
1003     HOST_PLATFORM=aarch64-apple-darwin
1005     # Apple's Clang uses "arm64"
1006     host_cpu_for_clang=arm64
1009 freebsd*)
1010     using_freetype_fontconfig=yes
1011     using_x11=yes
1012     build_skia=yes
1013     AC_MSG_CHECKING([the FreeBSD operating system release])
1014     if test -n "$with_os_version"; then
1015         OSVERSION="$with_os_version"
1016     else
1017         OSVERSION=`/sbin/sysctl -n kern.osreldate`
1018     fi
1019     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
1020     AC_MSG_CHECKING([which thread library to use])
1021     if test "$OSVERSION" -lt "500016"; then
1022         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1023         PTHREAD_LIBS="-pthread"
1024     elif test "$OSVERSION" -lt "502102"; then
1025         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1026         PTHREAD_LIBS="-lc_r"
1027     else
1028         PTHREAD_CFLAGS=""
1029         PTHREAD_LIBS="-pthread"
1030     fi
1031     AC_MSG_RESULT([$PTHREAD_LIBS])
1032     _os=FreeBSD
1033     ;;
1035 *netbsd*)
1036     using_freetype_fontconfig=yes
1037     using_x11=yes
1038     test_gtk3_kde5=no
1039     build_skia=yes
1040     PTHREAD_LIBS="-pthread -lpthread"
1041     _os=NetBSD
1042     ;;
1044 aix*)
1045     using_freetype_fontconfig=yes
1046     using_x11=yes
1047     test_randr=no
1048     test_gstreamer_1_0=no
1049     PTHREAD_LIBS=-pthread
1050     _os=AIX
1051     ;;
1053 openbsd*)
1054     using_freetype_fontconfig=yes
1055     using_x11=yes
1056     PTHREAD_CFLAGS="-D_THREAD_SAFE"
1057     PTHREAD_LIBS="-pthread"
1058     _os=OpenBSD
1059     ;;
1061 dragonfly*)
1062     using_freetype_fontconfig=yes
1063     using_x11=yes
1064     build_skia=yes
1065     PTHREAD_LIBS="-pthread"
1066     _os=DragonFly
1067     ;;
1069 linux-android*)
1070     using_freetype_fontconfig=yes
1071     using_headless_plugin=no
1072     using_x11=no
1073     build_crypto=no
1074     test_openldap=no
1075     test_system_freetype=no
1076     test_webdav=no
1077     disable_database_connectivity_dependencies
1078     enable_lotuswordpro=no
1079     enable_mpl_subset=yes
1080     enable_cairo_canvas=no
1081     enable_coinmp=yes
1082     enable_lpsolve=no
1083     enable_odk=no
1084     enable_python=no
1085     enable_xmlhelp=no
1086     _os=Android
1088     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
1089     ;;
1091 haiku*)
1092     using_freetype_fontconfig=yes
1093     using_x11=no
1094     test_gtk3_kde5=no
1095     test_kf5=yes
1096     enable_odk=no
1097     enable_coinmp=no
1098     enable_pdfium=no
1099     enable_sdremote=no
1100     enable_postgresql_sdbc=no
1101     enable_firebird_sdbc=no
1102     _os=Haiku
1103     ;;
1105 emscripten)
1106     using_freetype_fontconfig=yes
1107     using_x11=no
1108     test_openldap=no
1109     enable_compiler_plugins=no
1110     test_cmis=no
1111     test_webdav=no
1112     enable_database_connectivity=no
1113     enable_lpsolve=no
1114     enable_xmlhelp=no
1115     with_system_zlib=no
1116     with_theme="breeze"
1117     _os=Emscripten
1118     ;;
1121     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
1122     ;;
1123 esac
1125 AC_SUBST(HOST_PLATFORM)
1127 if test -z "$using_x11" -o -z "$using_freetype_fontconfig"; then
1128     AC_MSG_ERROR([You must set \$using_freetype_fontconfig and \$using_x11 for your platform])
1131 # Set defaults, if not set by platform
1132 test "${test_cups+set}" = set || test_cups="$using_x11"
1133 test "${test_dbus+set}" = set || test_dbus="$using_x11"
1134 test "${test_gstreamer_1_0+set}" = set || test_gstreamer_1_0="$using_x11"
1135 test "${test_gtk3+set}" = set || test_gtk3="$using_x11"
1136 test "${test_gtk4+set}" = set || test_gtk4="$using_x11"
1137 test "${test_kf5+set}" = set || test_kf5="$using_x11"
1138 # don't handle test_qt5, so it can disable test_kf5 later
1139 test "${test_randr+set}" = set || test_randr="$using_x11"
1140 test "${test_xrender+set}" = set || test_xrender="$using_x11"
1141 test "${using_headless_plugin+set}" = set || using_headless_plugin="$using_freetype_fontconfig"
1143 test "${test_gtk3_kde5+set}" != set -a "$test_kf5" = yes -a "$test_gtk3" = yes && test_gtk3_kde5="yes"
1144 test "${test_system_fontconfig+set}" != set -a "${test_system_freetype+set}" = set && test_system_fontconfig="$test_system_freetype"
1145 test "${test_system_freetype+set}" != set -a "${test_system_fontconfig+set}" = set && test_system_freetype="$test_system_fontconfig"
1147 # convenience / platform overriding "fixes"
1148 # Don't sort!
1149 test "$test_kf5" = yes -a "$test_qt5" = no && test_kf5=no
1150 test "$test_kf5" = yes && test_qt5=yes
1151 test "$test_gtk3" != yes -o "$test_kf5" != yes && test_gtk3_kde5=no
1152 test "$using_freetype_fontconfig" = no && using_headless_plugin=no
1153 test "$using_freetype_fontconfig" = yes && test_cairo=yes
1155 # Keep in sync with the above $using_x11 depending test default list
1156 disable_x11_tests()
1158     test_cups=no
1159     test_dbus=no
1160     test_gstreamer_1_0=no
1161     test_gtk3_kde5=no
1162     test_gtk3=no
1163     test_gtk4=no
1164     test_kf5=no
1165     test_qt5=no
1166     test_randr=no
1167     test_xrender=no
1170 test "$using_x11" = yes && USING_X11=TRUE
1172 if test "$using_freetype_fontconfig" = yes; then
1173     if test "$using_headless_plugin" = yes; then
1174         AC_DEFINE(ENABLE_HEADLESS)
1175         ENABLE_HEADLESS=TRUE
1176     fi
1179 AC_SUBST(ENABLE_HEADLESS)
1181 AC_MSG_NOTICE([VCL platform uses freetype+fontconfig: $using_freetype_fontconfig])
1182 AC_MSG_NOTICE([VCL platform uses headless plugin: $using_headless_plugin])
1183 AC_MSG_NOTICE([VCL platform uses vclplug: $using_vclplug])
1184 AC_MSG_NOTICE([VCL platform uses X11: $using_x11])
1186 # ===================================================================
1188 # End initial platform setup
1190 # ===================================================================
1192 if test "$_os" = "Android" ; then
1193     # Verify that the NDK and SDK options are proper
1194     if test -z "$with_android_ndk"; then
1195         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
1196     elif test ! -f "$ANDROID_NDK_HOME/meta/abis.json"; then
1197         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
1198     fi
1200     if test -z "$ANDROID_SDK_HOME"; then
1201         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
1202     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
1203         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
1204     fi
1206     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
1207     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
1208         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
1209                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
1210                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
1211         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
1212         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
1213         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
1214     fi
1215     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
1216         AC_MSG_WARN([android support repository not found - install with
1217                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
1218                      to allow the build to download the specified version of the android support libraries])
1219         add_warning "android support repository not found - install with"
1220         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
1221         add_warning "to allow the build to download the specified version of the android support libraries"
1222     fi
1225 if test "$_os" = "AIX"; then
1226     AC_PATH_PROG(GAWK, gawk)
1227     if test -z "$GAWK"; then
1228         AC_MSG_ERROR([gawk not found in \$PATH])
1229     fi
1232 AC_SUBST(SDKDIRNAME)
1234 AC_SUBST(PTHREAD_CFLAGS)
1235 AC_SUBST(PTHREAD_LIBS)
1237 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
1238 # By default use the ones specified by our build system,
1239 # but explicit override is possible.
1240 AC_MSG_CHECKING(for explicit AFLAGS)
1241 if test -n "$AFLAGS"; then
1242     AC_MSG_RESULT([$AFLAGS])
1243     x_AFLAGS=
1244 else
1245     AC_MSG_RESULT(no)
1246     x_AFLAGS=[\#]
1248 AC_MSG_CHECKING(for explicit CFLAGS)
1249 if test -n "$CFLAGS"; then
1250     AC_MSG_RESULT([$CFLAGS])
1251     x_CFLAGS=
1252 else
1253     AC_MSG_RESULT(no)
1254     x_CFLAGS=[\#]
1256 AC_MSG_CHECKING(for explicit CXXFLAGS)
1257 if test -n "$CXXFLAGS"; then
1258     AC_MSG_RESULT([$CXXFLAGS])
1259     x_CXXFLAGS=
1260 else
1261     AC_MSG_RESULT(no)
1262     x_CXXFLAGS=[\#]
1264 AC_MSG_CHECKING(for explicit OBJCFLAGS)
1265 if test -n "$OBJCFLAGS"; then
1266     AC_MSG_RESULT([$OBJCFLAGS])
1267     x_OBJCFLAGS=
1268 else
1269     AC_MSG_RESULT(no)
1270     x_OBJCFLAGS=[\#]
1272 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
1273 if test -n "$OBJCXXFLAGS"; then
1274     AC_MSG_RESULT([$OBJCXXFLAGS])
1275     x_OBJCXXFLAGS=
1276 else
1277     AC_MSG_RESULT(no)
1278     x_OBJCXXFLAGS=[\#]
1280 AC_MSG_CHECKING(for explicit LDFLAGS)
1281 if test -n "$LDFLAGS"; then
1282     AC_MSG_RESULT([$LDFLAGS])
1283     x_LDFLAGS=
1284 else
1285     AC_MSG_RESULT(no)
1286     x_LDFLAGS=[\#]
1288 AC_SUBST(AFLAGS)
1289 AC_SUBST(CFLAGS)
1290 AC_SUBST(CXXFLAGS)
1291 AC_SUBST(OBJCFLAGS)
1292 AC_SUBST(OBJCXXFLAGS)
1293 AC_SUBST(LDFLAGS)
1294 AC_SUBST(x_AFLAGS)
1295 AC_SUBST(x_CFLAGS)
1296 AC_SUBST(x_CXXFLAGS)
1297 AC_SUBST(x_OBJCFLAGS)
1298 AC_SUBST(x_OBJCXXFLAGS)
1299 AC_SUBST(x_LDFLAGS)
1301 dnl These are potentially set for MSVC, in the code checking for UCRT below:
1302 my_original_CFLAGS=$CFLAGS
1303 my_original_CXXFLAGS=$CXXFLAGS
1304 my_original_CPPFLAGS=$CPPFLAGS
1306 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
1307 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
1308 dnl AC_PROG_CC internally.
1309 if test "$_os" != "WINNT"; then
1310     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
1311     save_CFLAGS=$CFLAGS
1312     AC_PROG_CC
1313     CFLAGS=$save_CFLAGS
1314     if test -z "$CC_BASE"; then
1315         CC_BASE=`first_arg_basename "$CC"`
1316     fi
1319 if test "$_os" != "WINNT"; then
1320     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
1321 else
1322     ENDIANNESS=little
1324 AC_SUBST(ENDIANNESS)
1326 if test $_os != "WINNT"; then
1327     save_LIBS="$LIBS"
1328     AC_SEARCH_LIBS([dlsym], [dl],
1329         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
1330         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
1331     LIBS="$save_LIBS"
1333 AC_SUBST(DLOPEN_LIBS)
1335 dnl ===================================================================
1336 dnl Sanity checks for Emscripten SDK setup
1337 dnl ===================================================================
1339 if test "$_os" = "Emscripten"; then
1340     EMSCRIPTEN_ERROR=0
1341     if ! which emconfigure >/dev/null 2>&1; then
1342         AC_MSG_WARN([emconfigure must be in your \$PATH])
1343         EMSCRIPTEN_ERROR=1
1344     fi
1345     if test -z "$EMMAKEN_JUST_CONFIGURE"; then
1346         AC_MSG_WARN(["\$EMMAKEN_JUST_CONFIGURE wasn't set by emconfigure. Prefix configure or use autogen.sh])
1347         EMSCRIPTEN_ERROR=1
1348     fi
1349     if test $EMSCRIPTEN_ERROR -ne 0; then
1350         AC_MSG_ERROR(["Please fix your EMSDK setup to build with Emscripten!"])
1351     fi
1354 ###############################################################################
1355 # Extensions switches --enable/--disable
1356 ###############################################################################
1357 # By default these should be enabled unless having extra dependencies.
1358 # If there is extra dependency over configure options then the enable should
1359 # be automagic based on whether the requiring feature is enabled or not.
1360 # All this options change anything only with --enable-extension-integration.
1362 # The name of this option and its help string makes it sound as if
1363 # extensions are built anyway, just not integrated in the installer,
1364 # if you use --disable-extension-integration. Is that really the
1365 # case?
1367 AC_ARG_ENABLE(ios-simulator,
1368     AS_HELP_STRING([--enable-ios-simulator],
1369         [build for iOS simulator])
1372 libo_FUZZ_ARG_ENABLE(extension-integration,
1373     AS_HELP_STRING([--disable-extension-integration],
1374         [Disable integration of the built extensions in the installer of the
1375          product. Use this switch to disable the integration.])
1378 AC_ARG_ENABLE(avmedia,
1379     AS_HELP_STRING([--disable-avmedia],
1380         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
1383 AC_ARG_ENABLE(database-connectivity,
1384     AS_HELP_STRING([--disable-database-connectivity],
1385         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1388 # This doesn't mean not building (or "integrating") extensions
1389 # (although it probably should; i.e. it should imply
1390 # --disable-extension-integration I guess), it means not supporting
1391 # any extension mechanism at all
1392 libo_FUZZ_ARG_ENABLE(extensions,
1393     AS_HELP_STRING([--disable-extensions],
1394         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1397 AC_ARG_ENABLE(scripting,
1398     AS_HELP_STRING([--disable-scripting],
1399         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1402 # This is mainly for Android and iOS, but could potentially be used in some
1403 # special case otherwise, too, so factored out as a separate setting
1405 AC_ARG_ENABLE(dynamic-loading,
1406     AS_HELP_STRING([--disable-dynamic-loading],
1407         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1410 libo_FUZZ_ARG_ENABLE(report-builder,
1411     AS_HELP_STRING([--disable-report-builder],
1412         [Disable the Report Builder.])
1415 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1416     AS_HELP_STRING([--enable-ext-wiki-publisher],
1417         [Enable the Wiki Publisher extension.])
1420 libo_FUZZ_ARG_ENABLE(lpsolve,
1421     AS_HELP_STRING([--disable-lpsolve],
1422         [Disable compilation of the lp solve solver ])
1424 libo_FUZZ_ARG_ENABLE(coinmp,
1425     AS_HELP_STRING([--disable-coinmp],
1426         [Disable compilation of the CoinMP solver ])
1429 libo_FUZZ_ARG_ENABLE(pdfimport,
1430     AS_HELP_STRING([--disable-pdfimport],
1431         [Disable building the PDF import feature.])
1434 libo_FUZZ_ARG_ENABLE(pdfium,
1435     AS_HELP_STRING([--disable-pdfium],
1436         [Disable building PDFium. Results in unsecure PDF signature verification.])
1439 libo_FUZZ_ARG_ENABLE(skia,
1440     AS_HELP_STRING([--disable-skia],
1441         [Disable building Skia. Use --enable-skia=debug to build without optimizations.])
1444 ###############################################################################
1446 dnl ---------- *** ----------
1448 libo_FUZZ_ARG_ENABLE(mergelibs,
1449     AS_HELP_STRING([--enable-mergelibs],
1450         [Merge several of the smaller libraries into one big, "merged", one.])
1453 libo_FUZZ_ARG_ENABLE(breakpad,
1454     AS_HELP_STRING([--enable-breakpad],
1455         [Enables breakpad for crash reporting.])
1458 libo_FUZZ_ARG_ENABLE(crashdump,
1459     AS_HELP_STRING([--disable-crashdump],
1460         [Disable dump.ini and dump-file, when --enable-breakpad])
1463 AC_ARG_ENABLE(fetch-external,
1464     AS_HELP_STRING([--disable-fetch-external],
1465         [Disables fetching external tarballs from web sources.])
1468 AC_ARG_ENABLE(fuzzers,
1469     AS_HELP_STRING([--enable-fuzzers],
1470         [Enables building libfuzzer targets for fuzz testing.])
1473 libo_FUZZ_ARG_ENABLE(pch,
1474     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1475         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1476          Using 'system' will include only external headers, 'base' will add also headers
1477          from base modules, 'normal' will also add all headers except from the module built,
1478          'full' will use all suitable headers even from a module itself.])
1481 libo_FUZZ_ARG_ENABLE(epm,
1482     AS_HELP_STRING([--enable-epm],
1483         [LibreOffice includes self-packaging code, that requires epm, however epm is
1484          useless for large scale package building.])
1487 libo_FUZZ_ARG_ENABLE(odk,
1488     AS_HELP_STRING([--enable-odk],
1489         [Enable building the Office Development Kit, the part that extensions need to build against])
1492 AC_ARG_ENABLE(mpl-subset,
1493     AS_HELP_STRING([--enable-mpl-subset],
1494         [Don't compile any pieces which are not MPL or more liberally licensed])
1497 libo_FUZZ_ARG_ENABLE(evolution2,
1498     AS_HELP_STRING([--enable-evolution2],
1499         [Allows the built-in evolution 2 addressbook connectivity build to be
1500          enabled.])
1503 AC_ARG_ENABLE(avahi,
1504     AS_HELP_STRING([--enable-avahi],
1505         [Determines whether to use Avahi to advertise Impress to remote controls.])
1508 libo_FUZZ_ARG_ENABLE(werror,
1509     AS_HELP_STRING([--enable-werror],
1510         [Turn warnings to errors. (Has no effect in modules where the treating
1511          of warnings as errors is disabled explicitly.)]),
1514 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1515     AS_HELP_STRING([--enable-assert-always-abort],
1516         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1519 libo_FUZZ_ARG_ENABLE(dbgutil,
1520     AS_HELP_STRING([--enable-dbgutil],
1521         [Provide debugging support from --enable-debug and include additional debugging
1522          utilities such as object counting or more expensive checks.
1523          This is the recommended option for developers.
1524          Note that this makes the build ABI incompatible, it is not possible to mix object
1525          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1527 libo_FUZZ_ARG_ENABLE(debug,
1528     AS_HELP_STRING([--enable-debug],
1529         [Include debugging information, disable compiler optimization and inlining plus
1530          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1532 libo_FUZZ_ARG_ENABLE(split-debug,
1533     AS_HELP_STRING([--disable-split-debug],
1534         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1535          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1537 libo_FUZZ_ARG_ENABLE(gdb-index,
1538     AS_HELP_STRING([--disable-gdb-index],
1539         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1540          The feature requires the gold or lld linker.]))
1542 libo_FUZZ_ARG_ENABLE(sal-log,
1543     AS_HELP_STRING([--enable-sal-log],
1544         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1546 libo_FUZZ_ARG_ENABLE(symbols,
1547     AS_HELP_STRING([--enable-symbols],
1548         [Generate debug information.
1549          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1550          otherwise. It is possible to explicitly specify gbuild build targets
1551          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1552          everything in the directory; there is no ordering, more specific overrides
1553          more general, and disabling takes precedence).
1554          Example: --enable-symbols="all -sw/ -Library_sc".]))
1556 libo_FUZZ_ARG_ENABLE(optimized,
1557     AS_HELP_STRING([--enable-optimized=<yes/no/debug>],
1558         [Whether to compile with optimization flags.
1559          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1560          otherwise. Using 'debug' will try to use only optimizations that should
1561          not interfere with debugging. For Emscripten we default to optimized (-O1)
1562          debug build, as otherwise binaries become too large.]))
1564 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1565     AS_HELP_STRING([--disable-runtime-optimizations],
1566         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1567          JVM JIT) that are known to interact badly with certain dynamic analysis
1568          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1569          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1570          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1572 AC_ARG_WITH(valgrind,
1573     AS_HELP_STRING([--with-valgrind],
1574         [Make availability of Valgrind headers a hard requirement.]))
1576 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1577     AS_HELP_STRING([--enable-compiler-plugins],
1578         [Enable compiler plugins that will perform additional checks during
1579          building. Enabled automatically by --enable-dbgutil.
1580          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1581 COMPILER_PLUGINS_DEBUG=
1582 if test "$enable_compiler_plugins" = debug; then
1583     enable_compiler_plugins=yes
1584     COMPILER_PLUGINS_DEBUG=TRUE
1587 libo_FUZZ_ARG_ENABLE(compiler-plugins-analyzer-pch,
1588     AS_HELP_STRING([--disable-compiler-plugins-analyzer-pch],
1589         [Disable use of precompiled headers when running the Clang compiler plugin analyzer.  Not
1590          relevant in the --disable-compiler-plugins case.]))
1592 libo_FUZZ_ARG_ENABLE(ooenv,
1593     AS_HELP_STRING([--enable-ooenv],
1594         [Enable ooenv for the instdir installation.]))
1596 AC_ARG_ENABLE(lto,
1597     AS_HELP_STRING([--enable-lto],
1598         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1599          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1600          linker. For MSVC, this option is broken at the moment. This is experimental work
1601          in progress that shouldn't be used unless you are working on it.)]))
1603 AC_ARG_ENABLE(python,
1604     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1605         [Enables or disables Python support at run-time.
1606          Also specifies what Python to use at build-time.
1607          'fully-internal' even forces the internal version for uses of Python
1608          during the build.
1609          On macOS the only choices are
1610          'internal' (default) or 'fully-internal'. Otherwise the default is 'auto'.
1611          ]))
1613 libo_FUZZ_ARG_ENABLE(gtk3,
1614     AS_HELP_STRING([--disable-gtk3],
1615         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1616 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1618 AC_ARG_ENABLE(gtk4,
1619     AS_HELP_STRING([--enable-gtk4],
1620         [Determines whether to use Gtk+ 4.0 vclplug on platforms where Gtk+ 4.0 is available.]))
1622 AC_ARG_ENABLE(introspection,
1623     AS_HELP_STRING([--enable-introspection],
1624         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1625          Linux distributions.)]))
1627 AC_ARG_ENABLE(split-app-modules,
1628     AS_HELP_STRING([--enable-split-app-modules],
1629         [Split file lists for app modules, e.g. base, calc.
1630          Has effect only with make distro-pack-install]),
1633 AC_ARG_ENABLE(split-opt-features,
1634     AS_HELP_STRING([--enable-split-opt-features],
1635         [Split file lists for some optional features, e.g. pyuno, testtool.
1636          Has effect only with make distro-pack-install]),
1639 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1640     AS_HELP_STRING([--disable-cairo-canvas],
1641         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1644 libo_FUZZ_ARG_ENABLE(dbus,
1645     AS_HELP_STRING([--disable-dbus],
1646         [Determines whether to enable features that depend on dbus.
1647          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1648 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1650 libo_FUZZ_ARG_ENABLE(sdremote,
1651     AS_HELP_STRING([--disable-sdremote],
1652         [Determines whether to enable Impress remote control (i.e. the server component).]),
1653 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1655 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1656     AS_HELP_STRING([--disable-sdremote-bluetooth],
1657         [Determines whether to build sdremote with bluetooth support.
1658          Requires dbus on Linux.]))
1660 libo_FUZZ_ARG_ENABLE(gio,
1661     AS_HELP_STRING([--disable-gio],
1662         [Determines whether to use the GIO support.]),
1663 ,test "${enable_gio+set}" = set || enable_gio=yes)
1665 AC_ARG_ENABLE(qt5,
1666     AS_HELP_STRING([--enable-qt5],
1667         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1668          available.]),
1671 AC_ARG_ENABLE(kf5,
1672     AS_HELP_STRING([--enable-kf5],
1673         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1674          KF5 are available.]),
1677 AC_ARG_ENABLE(gtk3_kde5,
1678     AS_HELP_STRING([--enable-gtk3-kde5],
1679         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1680          platforms where Gtk3, Qt5 and Plasma is available.]),
1683 AC_ARG_ENABLE(gui,
1684     AS_HELP_STRING([--disable-gui],
1685         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1686 ,enable_gui=yes)
1688 libo_FUZZ_ARG_ENABLE(randr,
1689     AS_HELP_STRING([--disable-randr],
1690         [Disable RandR support in the vcl project.]),
1691 ,test "${enable_randr+set}" = set || enable_randr=yes)
1693 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1694     AS_HELP_STRING([--disable-gstreamer-1-0],
1695         [Disable building with the gstreamer 1.0 avmedia backend.]),
1696 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1698 libo_FUZZ_ARG_ENABLE([eot],
1699     [AS_HELP_STRING([--enable-eot],
1700         [Enable support for Embedded OpenType fonts.])],
1701 ,test "${enable_eot+set}" = set || enable_eot=no)
1703 libo_FUZZ_ARG_ENABLE(cve-tests,
1704     AS_HELP_STRING([--disable-cve-tests],
1705         [Prevent CVE tests to be executed]),
1708 libo_FUZZ_ARG_ENABLE(chart-tests,
1709     AS_HELP_STRING([--enable-chart-tests],
1710         [Executes chart XShape tests. In a perfect world these tests would be
1711          stable and everyone could run them, in reality it is best to run them
1712          only on a few machines that are known to work and maintained by people
1713          who can judge if a test failure is a regression or not.]),
1716 AC_ARG_ENABLE(build-opensymbol,
1717     AS_HELP_STRING([--enable-build-opensymbol],
1718         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1719          fontforge installed.]),
1722 AC_ARG_ENABLE(dependency-tracking,
1723     AS_HELP_STRING([--enable-dependency-tracking],
1724         [Do not reject slow dependency extractors.])[
1725   --disable-dependency-tracking
1726                           Disables generation of dependency information.
1727                           Speed up one-time builds.],
1730 AC_ARG_ENABLE(icecream,
1731     AS_HELP_STRING([--enable-icecream],
1732         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1733          It defaults to /opt/icecream for the location of the icecream gcc/g++
1734          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1737 AC_ARG_ENABLE(ld,
1738     AS_HELP_STRING([--enable-ld=<linker>],
1739         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1740          By default tries to use the best linker possible, use --disable-ld to use the default linker.
1741          If <linker> contains any ':', the part before the first ':' is used as the value of
1742          -fuse-ld, while the part after the first ':' is used as the value of --ld-path (which is
1743          needed for Clang 12).]),
1746 libo_FUZZ_ARG_ENABLE(cups,
1747     AS_HELP_STRING([--disable-cups],
1748         [Do not build cups support.])
1751 AC_ARG_ENABLE(ccache,
1752     AS_HELP_STRING([--disable-ccache],
1753         [Do not try to use ccache automatically.
1754          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1755          CC/CXX are not yet set, and --enable-icecream is not given, we
1756          attempt to use ccache. --disable-ccache disables ccache completely.
1757          Additionally ccache's depend mode is enabled if possible,
1758          use --enable-ccache=nodepend to enable ccache without depend mode.
1762 libo_FUZZ_ARG_ENABLE(online-update,
1763     AS_HELP_STRING([--enable-online-update],
1764         [Enable the online update service that will check for new versions of
1765          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1766          If the value is "mar", the experimental Mozilla-like update will be
1767          enabled instead of the traditional update mechanism.]),
1770 AC_ARG_WITH(update-config,
1771     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1772                    [Path to the update config ini file]))
1774 libo_FUZZ_ARG_ENABLE(extension-update,
1775     AS_HELP_STRING([--disable-extension-update],
1776         [Disable possibility to update installed extensions.]),
1779 libo_FUZZ_ARG_ENABLE(release-build,
1780     AS_HELP_STRING([--enable-release-build],
1781         [Enable release build. Note that the "release build" choice is orthogonal to
1782          whether symbols are present, debug info is generated, or optimization
1783          is done.
1784          See http://wiki.documentfoundation.org/Development/DevBuild]),
1787 AC_ARG_ENABLE(windows-build-signing,
1788     AS_HELP_STRING([--enable-windows-build-signing],
1789         [Enable signing of windows binaries (*.exe, *.dll)]),
1792 AC_ARG_ENABLE(silent-msi,
1793     AS_HELP_STRING([--enable-silent-msi],
1794         [Enable MSI with LIMITUI=1 (silent install).]),
1797 AC_ARG_ENABLE(macosx-code-signing,
1798     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1799         [Sign executables, dylibs, frameworks and the app bundle. If you
1800          don't provide an identity the first suitable certificate
1801          in your keychain is used.]),
1804 AC_ARG_ENABLE(macosx-package-signing,
1805     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1806         [Create a .pkg suitable for uploading to the Mac App Store and sign
1807          it. If you don't provide an identity the first suitable certificate
1808          in your keychain is used.]),
1811 AC_ARG_ENABLE(macosx-sandbox,
1812     AS_HELP_STRING([--enable-macosx-sandbox],
1813         [Make the app bundle run in a sandbox. Requires code signing.
1814          Is required by apps distributed in the Mac App Store, and implies
1815          adherence to App Store rules.]),
1818 AC_ARG_WITH(macosx-bundle-identifier,
1819     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1820         [Define the macOS bundle identifier. Default is the somewhat weird
1821          org.libreoffice.script ("script", huh?).]),
1822 ,with_macosx_bundle_identifier=org.libreoffice.script)
1824 AC_ARG_WITH(product-name,
1825     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1826         [Define the product name. Default is AC_PACKAGE_NAME.]),
1827 ,with_product_name=$PRODUCTNAME)
1829 libo_FUZZ_ARG_ENABLE(community-flavor,
1830     AS_HELP_STRING([--disable-community-flavor],
1831         [Disable the Community branding.]),
1834 AC_ARG_WITH(package-version,
1835     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1836         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1839 libo_FUZZ_ARG_ENABLE(readonly-installset,
1840     AS_HELP_STRING([--enable-readonly-installset],
1841         [Prevents any attempts by LibreOffice to write into its installation. That means
1842          at least that no "system-wide" extensions can be added. Partly experimental work in
1843          progress, probably not fully implemented. Always enabled for macOS.]),
1846 libo_FUZZ_ARG_ENABLE(mariadb-sdbc,
1847     AS_HELP_STRING([--disable-mariadb-sdbc],
1848         [Disable the build of the MariaDB/MySQL-SDBC driver.])
1851 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1852     AS_HELP_STRING([--disable-postgresql-sdbc],
1853         [Disable the build of the PostgreSQL-SDBC driver.])
1856 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1857     AS_HELP_STRING([--disable-lotuswordpro],
1858         [Disable the build of the Lotus Word Pro filter.]),
1859 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1861 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1862     AS_HELP_STRING([--disable-firebird-sdbc],
1863         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1864 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1866 AC_ARG_ENABLE(bogus-pkg-config,
1867     AS_HELP_STRING([--enable-bogus-pkg-config],
1868         [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.]),
1871 AC_ARG_ENABLE(openssl,
1872     AS_HELP_STRING([--disable-openssl],
1873         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1874          components will either use GNUTLS or NSS. Work in progress,
1875          use only if you are hacking on it.]),
1876 ,enable_openssl=yes)
1878 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1879     AS_HELP_STRING([--enable-cipher-openssl-backend],
1880         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1881          Requires --enable-openssl.]))
1883 AC_ARG_ENABLE(nss,
1884     AS_HELP_STRING([--disable-nss],
1885         [Disable using NSS. If disabled,
1886          components will either use GNUTLS or openssl. Work in progress,
1887          use only if you are hacking on it.]),
1888 ,enable_nss=yes)
1890 AC_ARG_ENABLE(library-bin-tar,
1891     AS_HELP_STRING([--enable-library-bin-tar],
1892         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1893         Some libraries can save their build result in a tarball
1894         stored in TARFILE_LOCATION. That binary tarball is
1895         uniquely identified by the source tarball,
1896         the content of the config_host.mk file and the content
1897         of the top-level directory in core for that library
1898         If this option is enabled, then if such a tarfile exist, it will be untarred
1899         instead of the source tarfile, and the build step will be skipped for that
1900         library.
1901         If a proper tarfile does not exist, then the normal source-based
1902         build is done for that library and a proper binary tarfile is created
1903         for the next time.]),
1906 AC_ARG_ENABLE(dconf,
1907     AS_HELP_STRING([--disable-dconf],
1908         [Disable the dconf configuration backend (enabled by default where
1909          available).]))
1911 libo_FUZZ_ARG_ENABLE(formula-logger,
1912     AS_HELP_STRING(
1913         [--enable-formula-logger],
1914         [Enable formula logger for logging formula calculation flow in Calc.]
1915     )
1918 AC_ARG_ENABLE(ldap,
1919     AS_HELP_STRING([--disable-ldap],
1920         [Disable LDAP support.]),
1921 ,enable_ldap=yes)
1923 AC_ARG_ENABLE(opencl,
1924     AS_HELP_STRING([--disable-opencl],
1925         [Disable OpenCL support.]),
1926 ,enable_opencl=yes)
1928 libo_FUZZ_ARG_ENABLE(librelogo,
1929     AS_HELP_STRING([--disable-librelogo],
1930         [Do not build LibreLogo.]),
1931 ,enable_librelogo=yes)
1933 AC_ARG_ENABLE(cmis,
1934     AS_HELP_STRING([--disable-cmis],
1935         [Disable CMIS support.]),
1936 ,enable_cmis=yes)
1938 AC_ARG_ENABLE(curl,
1939     AS_HELP_STRING([--disable-curl],
1940         [Disable CURL support.]),
1941 ,enable_curl=yes)
1943 AC_ARG_ENABLE(wasm-strip,
1944     AS_HELP_STRING([--enable-wasm-strip],
1945         [Strip the static build like for WASM/emscripten platform.]),
1946 ,enable_wasm_strip=yes)
1948 AC_ARG_ENABLE(xmlhelp,
1949     AS_HELP_STRING([--disable-xmlhelp],
1950         [Disable XML help support]),
1951 ,enable_xmlhelp=yes)
1954 dnl ===================================================================
1955 dnl Optional Packages (--with/without-)
1956 dnl ===================================================================
1958 AC_ARG_WITH(gcc-home,
1959     AS_HELP_STRING([--with-gcc-home],
1960         [Specify the location of gcc/g++ manually. This can be used in conjunction
1961          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1962          non-default path.]),
1965 AC_ARG_WITH(gnu-patch,
1966     AS_HELP_STRING([--with-gnu-patch],
1967         [Specify location of GNU patch on Solaris or FreeBSD.]),
1970 AC_ARG_WITH(build-platform-configure-options,
1971     AS_HELP_STRING([--with-build-platform-configure-options],
1972         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1975 AC_ARG_WITH(gnu-cp,
1976     AS_HELP_STRING([--with-gnu-cp],
1977         [Specify location of GNU cp on Solaris or FreeBSD.]),
1980 AC_ARG_WITH(external-tar,
1981     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1982         [Specify an absolute path of where to find (and store) tarfiles.]),
1983     TARFILE_LOCATION=$withval ,
1986 AC_ARG_WITH(referenced-git,
1987     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1988         [Specify another checkout directory to reference. This makes use of
1989                  git submodule update --reference, and saves a lot of diskspace
1990                  when having multiple trees side-by-side.]),
1991     GIT_REFERENCE_SRC=$withval ,
1994 AC_ARG_WITH(linked-git,
1995     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1996         [Specify a directory where the repositories of submodules are located.
1997          This uses a method similar to git-new-workdir to get submodules.]),
1998     GIT_LINK_SRC=$withval ,
2001 AC_ARG_WITH(galleries,
2002     AS_HELP_STRING([--with-galleries],
2003         [Specify how galleries should be built. It is possible either to
2004          build these internally from source ("build"),
2005          or to disable them ("no")]),
2008 AC_ARG_WITH(theme,
2009     AS_HELP_STRING([--with-theme="theme1 theme2..."],
2010         [Choose which themes to include. By default those themes with an '*' are included.
2011          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg, *colibre, *colibre_svg, *elementary,
2012          *elementary_svg, *karasa_jaga, *karasa_jaga_svg, *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg, *sukapura, *sukapura_svg.]),
2015 libo_FUZZ_ARG_WITH(helppack-integration,
2016     AS_HELP_STRING([--without-helppack-integration],
2017         [It will not integrate the helppacks to the installer
2018          of the product. Please use this switch to use the online help
2019          or separate help packages.]),
2022 libo_FUZZ_ARG_WITH(fonts,
2023     AS_HELP_STRING([--without-fonts],
2024         [LibreOffice includes some third-party fonts to provide a reliable basis for
2025          help content, templates, samples, etc. When these fonts are already
2026          known to be available on the system then you should use this option.]),
2029 AC_ARG_WITH(epm,
2030     AS_HELP_STRING([--with-epm],
2031         [Decides which epm to use. Default is to use the one from the system if
2032          one is built. When either this is not there or you say =internal epm
2033          will be built.]),
2036 AC_ARG_WITH(package-format,
2037     AS_HELP_STRING([--with-package-format],
2038         [Specify package format(s) for LibreOffice installation sets. The
2039          implicit --without-package-format leads to no installation sets being
2040          generated. Possible values: aix, archive, bsd, deb, dmg,
2041          installed, msi, pkg, and rpm.
2042          Example: --with-package-format='deb rpm']),
2045 AC_ARG_WITH(tls,
2046     AS_HELP_STRING([--with-tls],
2047         [Decides which TLS/SSL and cryptographic implementations to use for
2048          LibreOffice's code. Notice that this doesn't apply for depending
2049          libraries like "neon", for example. Default is to use NSS
2050          although OpenSSL is also possible. Notice that selecting NSS restricts
2051          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
2052          restrict by now the usage of NSS in LO's code. Possible values:
2053          openssl, nss. Example: --with-tls="nss"]),
2056 AC_ARG_WITH(system-libs,
2057     AS_HELP_STRING([--with-system-libs],
2058         [Use libraries already on system -- enables all --with-system-* flags.]),
2061 AC_ARG_WITH(system-bzip2,
2062     AS_HELP_STRING([--with-system-bzip2],
2063         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
2064     [with_system_bzip2="$with_system_libs"])
2066 AC_ARG_WITH(system-headers,
2067     AS_HELP_STRING([--with-system-headers],
2068         [Use headers already on system -- enables all --with-system-* flags for
2069          external packages whose headers are the only entities used i.e.
2070          boost/odbc/sane-header(s).]),,
2071     [with_system_headers="$with_system_libs"])
2073 AC_ARG_WITH(system-jars,
2074     AS_HELP_STRING([--without-system-jars],
2075         [When building with --with-system-libs, also the needed jars are expected
2076          on the system. Use this to disable that]),,
2077     [with_system_jars="$with_system_libs"])
2079 AC_ARG_WITH(system-cairo,
2080     AS_HELP_STRING([--with-system-cairo],
2081         [Use cairo libraries already on system.  Happens automatically for
2082          (implicit) --enable-gtk3.]))
2084 AC_ARG_WITH(system-epoxy,
2085     AS_HELP_STRING([--with-system-epoxy],
2086         [Use epoxy libraries already on system.  Happens automatically for
2087          (implicit) --enable-gtk3.]),,
2088        [with_system_epoxy="$with_system_libs"])
2090 AC_ARG_WITH(myspell-dicts,
2091     AS_HELP_STRING([--with-myspell-dicts],
2092         [Adds myspell dictionaries to the LibreOffice installation set]),
2095 AC_ARG_WITH(system-dicts,
2096     AS_HELP_STRING([--without-system-dicts],
2097         [Do not use dictionaries from system paths.]),
2100 AC_ARG_WITH(external-dict-dir,
2101     AS_HELP_STRING([--with-external-dict-dir],
2102         [Specify external dictionary dir.]),
2105 AC_ARG_WITH(external-hyph-dir,
2106     AS_HELP_STRING([--with-external-hyph-dir],
2107         [Specify external hyphenation pattern dir.]),
2110 AC_ARG_WITH(external-thes-dir,
2111     AS_HELP_STRING([--with-external-thes-dir],
2112         [Specify external thesaurus dir.]),
2115 AC_ARG_WITH(system-zlib,
2116     AS_HELP_STRING([--with-system-zlib],
2117         [Use zlib already on system.]),,
2118     [with_system_zlib=auto])
2120 AC_ARG_WITH(system-jpeg,
2121     AS_HELP_STRING([--with-system-jpeg],
2122         [Use jpeg already on system.]),,
2123     [with_system_jpeg="$with_system_libs"])
2125 AC_ARG_WITH(system-clucene,
2126     AS_HELP_STRING([--with-system-clucene],
2127         [Use clucene already on system.]),,
2128     [with_system_clucene="$with_system_libs"])
2130 AC_ARG_WITH(system-expat,
2131     AS_HELP_STRING([--with-system-expat],
2132         [Use expat already on system.]),,
2133     [with_system_expat="$with_system_libs"])
2135 AC_ARG_WITH(system-libxml,
2136     AS_HELP_STRING([--with-system-libxml],
2137         [Use libxml/libxslt already on system.]),,
2138     [with_system_libxml=auto])
2140 AC_ARG_WITH(system-icu,
2141     AS_HELP_STRING([--with-system-icu],
2142         [Use icu already on system.]),,
2143     [with_system_icu="$with_system_libs"])
2145 AC_ARG_WITH(system-ucpp,
2146     AS_HELP_STRING([--with-system-ucpp],
2147         [Use ucpp already on system.]),,
2148     [])
2150 AC_ARG_WITH(system-openldap,
2151     AS_HELP_STRING([--with-system-openldap],
2152         [Use the OpenLDAP LDAP SDK already on system.]),,
2153     [with_system_openldap="$with_system_libs"])
2155 libo_FUZZ_ARG_ENABLE(poppler,
2156     AS_HELP_STRING([--disable-poppler],
2157         [Disable building Poppler.])
2160 AC_ARG_WITH(system-poppler,
2161     AS_HELP_STRING([--with-system-poppler],
2162         [Use system poppler (only needed for PDF import).]),,
2163     [with_system_poppler="$with_system_libs"])
2165 libo_FUZZ_ARG_ENABLE(gpgmepp,
2166     AS_HELP_STRING([--disable-gpgmepp],
2167         [Disable building gpgmepp. Do not use in normal cases unless you want to fix potential problems it causes.])
2170 AC_ARG_WITH(system-gpgmepp,
2171     AS_HELP_STRING([--with-system-gpgmepp],
2172         [Use gpgmepp already on system]),,
2173     [with_system_gpgmepp="$with_system_libs"])
2175 AC_ARG_WITH(system-mariadb,
2176     AS_HELP_STRING([--with-system-mariadb],
2177         [Use MariaDB/MySQL libraries already on system.]),,
2178     [with_system_mariadb="$with_system_libs"])
2180 AC_ARG_ENABLE(bundle-mariadb,
2181     AS_HELP_STRING([--enable-bundle-mariadb],
2182         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
2185 AC_ARG_WITH(system-postgresql,
2186     AS_HELP_STRING([--with-system-postgresql],
2187         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
2188          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
2189     [with_system_postgresql="$with_system_libs"])
2191 AC_ARG_WITH(libpq-path,
2192     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
2193         [Use this PostgreSQL C interface (libpq) installation for building
2194          the PostgreSQL-SDBC extension.]),
2197 AC_ARG_WITH(system-firebird,
2198     AS_HELP_STRING([--with-system-firebird],
2199         [Use Firebird libraries already on system, for building the Firebird-SDBC
2200          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
2201     [with_system_firebird="$with_system_libs"])
2203 AC_ARG_WITH(system-libtommath,
2204             AS_HELP_STRING([--with-system-libtommath],
2205                            [Use libtommath already on system]),,
2206             [with_system_libtommath="$with_system_libs"])
2208 AC_ARG_WITH(system-hsqldb,
2209     AS_HELP_STRING([--with-system-hsqldb],
2210         [Use hsqldb already on system.]))
2212 AC_ARG_WITH(hsqldb-jar,
2213     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
2214         [Specify path to jarfile manually.]),
2215     HSQLDB_JAR=$withval)
2217 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
2218     AS_HELP_STRING([--disable-scripting-beanshell],
2219         [Disable support for scripts in BeanShell.]),
2223 AC_ARG_WITH(system-beanshell,
2224     AS_HELP_STRING([--with-system-beanshell],
2225         [Use beanshell already on system.]),,
2226     [with_system_beanshell="$with_system_jars"])
2228 AC_ARG_WITH(beanshell-jar,
2229     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
2230         [Specify path to jarfile manually.]),
2231     BSH_JAR=$withval)
2233 libo_FUZZ_ARG_ENABLE(scripting-javascript,
2234     AS_HELP_STRING([--disable-scripting-javascript],
2235         [Disable support for scripts in JavaScript.]),
2239 AC_ARG_WITH(system-rhino,
2240     AS_HELP_STRING([--with-system-rhino],
2241         [Use rhino already on system.]),,)
2242 #    [with_system_rhino="$with_system_jars"])
2243 # Above is not used as we have different debug interface
2244 # patched into internal rhino. This code needs to be fixed
2245 # before we can enable it by default.
2247 AC_ARG_WITH(rhino-jar,
2248     AS_HELP_STRING([--with-rhino-jar=JARFILE],
2249         [Specify path to jarfile manually.]),
2250     RHINO_JAR=$withval)
2252 AC_ARG_WITH(system-jfreereport,
2253     AS_HELP_STRING([--with-system-jfreereport],
2254         [Use JFreeReport already on system.]),,
2255     [with_system_jfreereport="$with_system_jars"])
2257 AC_ARG_WITH(sac-jar,
2258     AS_HELP_STRING([--with-sac-jar=JARFILE],
2259         [Specify path to jarfile manually.]),
2260     SAC_JAR=$withval)
2262 AC_ARG_WITH(libxml-jar,
2263     AS_HELP_STRING([--with-libxml-jar=JARFILE],
2264         [Specify path to jarfile manually.]),
2265     LIBXML_JAR=$withval)
2267 AC_ARG_WITH(flute-jar,
2268     AS_HELP_STRING([--with-flute-jar=JARFILE],
2269         [Specify path to jarfile manually.]),
2270     FLUTE_JAR=$withval)
2272 AC_ARG_WITH(jfreereport-jar,
2273     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
2274         [Specify path to jarfile manually.]),
2275     JFREEREPORT_JAR=$withval)
2277 AC_ARG_WITH(liblayout-jar,
2278     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
2279         [Specify path to jarfile manually.]),
2280     LIBLAYOUT_JAR=$withval)
2282 AC_ARG_WITH(libloader-jar,
2283     AS_HELP_STRING([--with-libloader-jar=JARFILE],
2284         [Specify path to jarfile manually.]),
2285     LIBLOADER_JAR=$withval)
2287 AC_ARG_WITH(libformula-jar,
2288     AS_HELP_STRING([--with-libformula-jar=JARFILE],
2289         [Specify path to jarfile manually.]),
2290     LIBFORMULA_JAR=$withval)
2292 AC_ARG_WITH(librepository-jar,
2293     AS_HELP_STRING([--with-librepository-jar=JARFILE],
2294         [Specify path to jarfile manually.]),
2295     LIBREPOSITORY_JAR=$withval)
2297 AC_ARG_WITH(libfonts-jar,
2298     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
2299         [Specify path to jarfile manually.]),
2300     LIBFONTS_JAR=$withval)
2302 AC_ARG_WITH(libserializer-jar,
2303     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
2304         [Specify path to jarfile manually.]),
2305     LIBSERIALIZER_JAR=$withval)
2307 AC_ARG_WITH(libbase-jar,
2308     AS_HELP_STRING([--with-libbase-jar=JARFILE],
2309         [Specify path to jarfile manually.]),
2310     LIBBASE_JAR=$withval)
2312 AC_ARG_WITH(system-odbc,
2313     AS_HELP_STRING([--with-system-odbc],
2314         [Use the odbc headers already on system.]),,
2315     [with_system_odbc="auto"])
2317 AC_ARG_WITH(system-sane,
2318     AS_HELP_STRING([--with-system-sane],
2319         [Use sane.h already on system.]),,
2320     [with_system_sane="$with_system_headers"])
2322 AC_ARG_WITH(system-bluez,
2323     AS_HELP_STRING([--with-system-bluez],
2324         [Use bluetooth.h already on system.]),,
2325     [with_system_bluez="$with_system_headers"])
2327 AC_ARG_WITH(system-curl,
2328     AS_HELP_STRING([--with-system-curl],
2329         [Use curl already on system.]),,
2330     [with_system_curl=auto])
2332 AC_ARG_WITH(system-boost,
2333     AS_HELP_STRING([--with-system-boost],
2334         [Use boost already on system.]),,
2335     [with_system_boost="$with_system_headers"])
2337 AC_ARG_WITH(system-glm,
2338     AS_HELP_STRING([--with-system-glm],
2339         [Use glm already on system.]),,
2340     [with_system_glm="$with_system_headers"])
2342 AC_ARG_WITH(system-hunspell,
2343     AS_HELP_STRING([--with-system-hunspell],
2344         [Use libhunspell already on system.]),,
2345     [with_system_hunspell="$with_system_libs"])
2347 libo_FUZZ_ARG_ENABLE(zxing,
2348     AS_HELP_STRING([--disable-zxing],
2349        [Disable use of zxing external library.]))
2351 AC_ARG_WITH(system-zxing,
2352     AS_HELP_STRING([--with-system-zxing],
2353         [Use libzxing already on system.]),,
2354     [with_system_zxing="$with_system_libs"])
2356 AC_ARG_WITH(system-box2d,
2357     AS_HELP_STRING([--with-system-box2d],
2358         [Use box2d already on system.]),,
2359     [with_system_box2d="$with_system_libs"])
2361 AC_ARG_WITH(system-mythes,
2362     AS_HELP_STRING([--with-system-mythes],
2363         [Use mythes already on system.]),,
2364     [with_system_mythes="$with_system_libs"])
2366 AC_ARG_WITH(system-altlinuxhyph,
2367     AS_HELP_STRING([--with-system-altlinuxhyph],
2368         [Use ALTLinuxhyph already on system.]),,
2369     [with_system_altlinuxhyph="$with_system_libs"])
2371 AC_ARG_WITH(system-lpsolve,
2372     AS_HELP_STRING([--with-system-lpsolve],
2373         [Use lpsolve already on system.]),,
2374     [with_system_lpsolve="$with_system_libs"])
2376 AC_ARG_WITH(system-coinmp,
2377     AS_HELP_STRING([--with-system-coinmp],
2378         [Use CoinMP already on system.]),,
2379     [with_system_coinmp="$with_system_libs"])
2381 AC_ARG_WITH(system-liblangtag,
2382     AS_HELP_STRING([--with-system-liblangtag],
2383         [Use liblangtag library already on system.]),,
2384     [with_system_liblangtag="$with_system_libs"])
2386 AC_ARG_WITH(webdav,
2387     AS_HELP_STRING([--with-webdav],
2388         [Specify which library to use for webdav implementation.
2389          Possible values: "neon", "serf", "no". The default value is "neon".
2390          Example: --with-webdav="serf"]))
2392 AC_ARG_WITH(linker-hash-style,
2393     AS_HELP_STRING([--with-linker-hash-style],
2394         [Use linker with --hash-style=<style> when linking shared objects.
2395          Possible values: "sysv", "gnu", "both". The default value is "gnu"
2396          if supported on the build system, and "sysv" otherwise.]))
2398 AC_ARG_WITH(jdk-home,
2399     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
2400         [If you have installed JDK 9 or later on your system please supply the
2401          path here. Note that this is not the location of the java command but the
2402          location of the entire distribution. In case of cross-compiling, this
2403          is the JDK of the host os. Use --with-build-platform-configure-options
2404          to point to a different build platform JDK.]),
2407 AC_ARG_WITH(help,
2408     AS_HELP_STRING([--with-help],
2409         [Enable the build of help. There is a special parameter "common" that
2410          can be used to bundle only the common part, .e.g help-specific icons.
2411          This is useful when you build the helpcontent separately.])
2412     [
2413                           Usage:     --with-help    build the old local help
2414                                  --without-help     no local help (default)
2415                                  --with-help=html   build the new HTML local help
2416                                  --with-help=online build the new HTML online help
2417     ],
2420 AC_ARG_WITH(omindex,
2421    AS_HELP_STRING([--with-omindex],
2422         [Enable the support of xapian-omega index for online help.])
2423    [
2424                          Usage: --with-omindex=server prepare the pages for omindex
2425                                 but let xapian-omega be built in server.
2426                                 --with-omindex=noxap do not prepare online pages
2427                                 for xapian-omega
2428   ],
2431 libo_FUZZ_ARG_WITH(java,
2432     AS_HELP_STRING([--with-java=<java command>],
2433         [Specify the name of the Java interpreter command. Typically "java"
2434          which is the default.
2436          To build without support for Java components, applets, accessibility
2437          or the XML filters written in Java, use --without-java or --with-java=no.]),
2438     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2439     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2442 AC_ARG_WITH(jvm-path,
2443     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2444         [Use a specific JVM search path at runtime.
2445          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2448 AC_ARG_WITH(ant-home,
2449     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2450         [If you have installed Apache Ant on your system, please supply the path here.
2451          Note that this is not the location of the Ant binary but the location
2452          of the entire distribution.]),
2455 AC_ARG_WITH(symbol-config,
2456     AS_HELP_STRING([--with-symbol-config],
2457         [Configuration for the crashreport symbol upload]),
2458         [],
2459         [with_symbol_config=no])
2461 AC_ARG_WITH(export-validation,
2462     AS_HELP_STRING([--without-export-validation],
2463         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2464 ,with_export_validation=auto)
2466 AC_ARG_WITH(bffvalidator,
2467     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2468         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2469          Requires installed Microsoft Office Binary File Format Validator.
2470          Note: export-validation (--with-export-validation) is required to be turned on.
2471          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2472 ,with_bffvalidator=no)
2474 libo_FUZZ_ARG_WITH(junit,
2475     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2476         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2477          --without-junit disables those tests. Not relevant in the --without-java case.]),
2478 ,with_junit=yes)
2480 AC_ARG_WITH(hamcrest,
2481     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2482         [Specifies the hamcrest jar file to use for JUnit-based tests.
2483          --without-junit disables those tests. Not relevant in the --without-java case.]),
2484 ,with_hamcrest=yes)
2486 AC_ARG_WITH(perl-home,
2487     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2488         [If you have installed Perl 5 Distribution, on your system, please
2489          supply the path here. Note that this is not the location of the Perl
2490          binary but the location of the entire distribution.]),
2493 libo_FUZZ_ARG_WITH(doxygen,
2494     AS_HELP_STRING(
2495         [--with-doxygen=<absolute path to doxygen executable>],
2496         [Specifies the doxygen executable to use when generating ODK C/C++
2497          documentation. --without-doxygen disables generation of ODK C/C++
2498          documentation. Not relevant in the --disable-odk case.]),
2499 ,with_doxygen=yes)
2501 AC_ARG_WITH(visual-studio,
2502     AS_HELP_STRING([--with-visual-studio=<2019>],
2503         [Specify which Visual Studio version to use in case several are
2504          installed. Currently only 2019 (default) is supported.]),
2507 AC_ARG_WITH(windows-sdk,
2508     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10.0>],
2509         [Specify which Windows SDK, or "Windows Kit", version to use
2510          in case the one that came with the selected Visual Studio
2511          is not what you want for some reason. Note that not all compiler/SDK
2512          combinations are supported. The intent is that this option should not
2513          be needed.]),
2516 AC_ARG_WITH(lang,
2517     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2518         [Use this option to build LibreOffice with additional UI language support.
2519          English (US) is always included by default.
2520          Separate multiple languages with space.
2521          For all languages, use --with-lang=ALL.]),
2524 AC_ARG_WITH(locales,
2525     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2526         [Use this option to limit the locale information built in.
2527          Separate multiple locales with space.
2528          Very experimental and might well break stuff.
2529          Just a desperate measure to shrink code and data size.
2530          By default all the locales available is included.
2531          This option is completely unrelated to --with-lang.])
2532     [
2533                           Affects also our character encoding conversion
2534                           tables for encodings mainly targeted for a
2535                           particular locale, like EUC-CN and EUC-TW for
2536                           zh, ISO-2022-JP for ja.
2538                           Affects also our add-on break iterator data for
2539                           some languages.
2541                           For the default, all locales, don't use this switch at all.
2542                           Specifying just the language part of a locale means all matching
2543                           locales will be included.
2544     ],
2547 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2548 libo_FUZZ_ARG_WITH(krb5,
2549     AS_HELP_STRING([--with-krb5],
2550         [Enable MIT Kerberos 5 support in modules that support it.
2551          By default automatically enabled on platforms
2552          where a good system Kerberos 5 is available.]),
2555 libo_FUZZ_ARG_WITH(gssapi,
2556     AS_HELP_STRING([--with-gssapi],
2557         [Enable GSSAPI support in modules that support it.
2558          By default automatically enabled on platforms
2559          where a good system GSSAPI is available.]),
2562 AC_ARG_WITH(iwyu,
2563     AS_HELP_STRING([--with-iwyu],
2564         [Use given IWYU binary path to check unneeded includes instead of building.
2565          Use only if you are hacking on it.]),
2568 libo_FUZZ_ARG_WITH(lxml,
2569     AS_HELP_STRING([--without-lxml],
2570         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2571          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2572          report widget classes and ids.]),
2575 libo_FUZZ_ARG_WITH(latest-c++,
2576     AS_HELP_STRING([--with-latest-c++],
2577         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2578          published standard.]),,
2579         [with_latest_c__=no])
2581 dnl ===================================================================
2582 dnl Branding
2583 dnl ===================================================================
2585 AC_ARG_WITH(branding,
2586     AS_HELP_STRING([--with-branding=/path/to/images],
2587         [Use given path to retrieve branding images set.])
2588     [
2589                           Search for intro.png about.svg and logo.svg.
2590                           If any is missing, default ones will be used instead.
2592                           Search also progress.conf for progress
2593                           settings on intro screen :
2595                           PROGRESSBARCOLOR="255,255,255" Set color of
2596                           progress bar. Comma separated RGB decimal values.
2597                           PROGRESSSIZE="407,6" Set size of progress bar.
2598                           Comma separated decimal values (width, height).
2599                           PROGRESSPOSITION="61,317" Set position of progress
2600                           bar from left,top. Comma separated decimal values.
2601                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2602                           bar frame. Comma separated RGB decimal values.
2603                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2604                           bar text. Comma separated RGB decimal values.
2605                           PROGRESSTEXTBASELINE="287" Set vertical position of
2606                           progress bar text from top. Decimal value.
2608                           Default values will be used if not found.
2609     ],
2613 AC_ARG_WITH(extra-buildid,
2614     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2615         [Show addition build identification in about dialog.]),
2619 AC_ARG_WITH(vendor,
2620     AS_HELP_STRING([--with-vendor="John the Builder"],
2621         [Set vendor of the build.]),
2624 AC_ARG_WITH(privacy-policy-url,
2625     AS_HELP_STRING([--with-privacy-policy-url="https://yourdomain/privacy-policy"],
2626         [The URL to your privacy policy (needed when
2627          enabling online-update or crashreporting via breakpad)]),
2628         [if test "x$with_privacy_policy_url" = "xyes"; then
2629             AC_MSG_FAILURE([you need to specify an argument when using --with-privacy-policy-url])
2630          elif test "x$with_privacy_policy_url" = "xno"; then
2631             with_privacy_policy_url="undefined"
2632          fi]
2633 ,[with_privacy_policy_url="undefined"])
2635 AC_ARG_WITH(android-package-name,
2636     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2637         [Set Android package name of the build.]),
2640 AC_ARG_WITH(compat-oowrappers,
2641     AS_HELP_STRING([--with-compat-oowrappers],
2642         [Install oo* wrappers in parallel with
2643          lo* ones to keep backward compatibility.
2644          Has effect only with make distro-pack-install]),
2647 AC_ARG_WITH(os-version,
2648     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2649         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2652 AC_ARG_WITH(idlc-cpp,
2653     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2654         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2657 AC_ARG_WITH(parallelism,
2658     AS_HELP_STRING([--with-parallelism],
2659         [Number of jobs to run simultaneously during build. Parallel builds can
2660         save a lot of time on multi-cpu machines. Defaults to the number of
2661         CPUs on the machine, unless you configure --enable-icecream - then to
2662         40.]),
2665 AC_ARG_WITH(all-tarballs,
2666     AS_HELP_STRING([--with-all-tarballs],
2667         [Download all external tarballs unconditionally]))
2669 AC_ARG_WITH(gdrive-client-id,
2670     AS_HELP_STRING([--with-gdrive-client-id],
2671         [Provides the client id of the application for OAuth2 authentication
2672         on Google Drive. If either this or --with-gdrive-client-secret is
2673         empty, the feature will be disabled]),
2676 AC_ARG_WITH(gdrive-client-secret,
2677     AS_HELP_STRING([--with-gdrive-client-secret],
2678         [Provides the client secret of the application for OAuth2
2679         authentication on Google Drive. If either this or
2680         --with-gdrive-client-id is empty, the feature will be disabled]),
2683 AC_ARG_WITH(alfresco-cloud-client-id,
2684     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2685         [Provides the client id of the application for OAuth2 authentication
2686         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2687         empty, the feature will be disabled]),
2690 AC_ARG_WITH(alfresco-cloud-client-secret,
2691     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2692         [Provides the client secret of the application for OAuth2
2693         authentication on Alfresco Cloud. If either this or
2694         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2697 AC_ARG_WITH(onedrive-client-id,
2698     AS_HELP_STRING([--with-onedrive-client-id],
2699         [Provides the client id of the application for OAuth2 authentication
2700         on OneDrive. If either this or --with-onedrive-client-secret is
2701         empty, the feature will be disabled]),
2704 AC_ARG_WITH(onedrive-client-secret,
2705     AS_HELP_STRING([--with-onedrive-client-secret],
2706         [Provides the client secret of the application for OAuth2
2707         authentication on OneDrive. If either this or
2708         --with-onedrive-client-id is empty, the feature will be disabled]),
2710 dnl ===================================================================
2711 dnl Do we want to use pre-build binary tarball for recompile
2712 dnl ===================================================================
2714 if test "$enable_library_bin_tar" = "yes" ; then
2715     USE_LIBRARY_BIN_TAR=TRUE
2716 else
2717     USE_LIBRARY_BIN_TAR=
2719 AC_SUBST(USE_LIBRARY_BIN_TAR)
2721 dnl ===================================================================
2722 dnl Test whether build target is Release Build
2723 dnl ===================================================================
2724 AC_MSG_CHECKING([whether build target is Release Build])
2725 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2726     AC_MSG_RESULT([no])
2727     ENABLE_RELEASE_BUILD=
2728     GET_TASK_ALLOW_ENTITLEMENT='
2729         <!-- We want to be able to debug a hardened process when not building for release -->
2730         <key>com.apple.security.get-task-allow</key>
2731         <true/>'
2732 else
2733     AC_MSG_RESULT([yes])
2734     ENABLE_RELEASE_BUILD=TRUE
2735     GET_TASK_ALLOW_ENTITLEMENT=''
2737 AC_SUBST(ENABLE_RELEASE_BUILD)
2738 AC_SUBST(GET_TASK_ALLOW_ENTITLEMENT)
2740 AC_MSG_CHECKING([whether to build a Community flavor])
2741 if test -z "$enable_community_flavor" -o "$enable_community_flavor" = "yes"; then
2742     AC_DEFINE(HAVE_FEATURE_COMMUNITY_FLAVOR)
2743     AC_MSG_RESULT([yes])
2744 else
2745     AC_MSG_RESULT([no])
2748 dnl ===================================================================
2749 dnl Test whether to sign Windows Build
2750 dnl ===================================================================
2751 AC_MSG_CHECKING([whether to sign windows build])
2752 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2753     AC_MSG_RESULT([yes])
2754     WINDOWS_BUILD_SIGNING="TRUE"
2755 else
2756     AC_MSG_RESULT([no])
2757     WINDOWS_BUILD_SIGNING="FALSE"
2759 AC_SUBST(WINDOWS_BUILD_SIGNING)
2761 dnl ===================================================================
2762 dnl MacOSX build and runtime environment options
2763 dnl ===================================================================
2765 AC_ARG_WITH(macosx-sdk,
2766     AS_HELP_STRING([--with-macosx-sdk=<version>],
2767         [Prefer a specific SDK for building.])
2768     [
2769                           If the requested SDK is not available, a search for the oldest one will be done.
2770                           With current Xcode versions, only the latest SDK is included, so this option is
2771                           not terribly useful. It works fine to build with a new SDK and run the result
2772                           on an older OS.
2774                           e. g.: --with-macosx-sdk=10.10
2776                           there are 3 options to control the MacOSX build:
2777                           --with-macosx-sdk (referred as 'sdk' below)
2778                           --with-macosx-version-min-required (referred as 'min' below)
2779                           --with-macosx-version-max-allowed (referred as 'max' below)
2781                           the connection between these value and the default they take is as follow:
2782                           ( ? means not specified on the command line, s means the SDK version found,
2783                           constraint: 8 <= x <= y <= z)
2785                           ==========================================
2786                            command line      || config result
2787                           ==========================================
2788                           min  | max  | sdk  || min   | max  | sdk  |
2789                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2790                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2791                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2792                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2793                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2794                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2795                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2796                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2799                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2800                           for a detailed technical explanation of these variables
2802                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2803     ],
2806 AC_ARG_WITH(macosx-version-min-required,
2807     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2808         [set the minimum OS version needed to run the built LibreOffice])
2809     [
2810                           e. g.: --with-macosx-version-min-required=10.10
2811                           see --with-macosx-sdk for more info
2812     ],
2815 AC_ARG_WITH(macosx-version-max-allowed,
2816     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2817         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2818     [
2819                           e. g.: --with-macosx-version-max-allowed=10.10
2820                           see --with-macosx-sdk for more info
2821     ],
2825 dnl ===================================================================
2826 dnl options for stuff used during cross-compilation build
2827 dnl Not quite superseded by --with-build-platform-configure-options.
2828 dnl TODO: check, if the "force" option is still needed anywhere.
2829 dnl ===================================================================
2831 AC_ARG_WITH(system-icu-for-build,
2832     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2833         [Use icu already on system for build tools (cross-compilation only).]))
2836 dnl ===================================================================
2837 dnl Check for incompatible options set by fuzzing, and reset those
2838 dnl automatically to working combinations
2839 dnl ===================================================================
2841 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2842         "$enable_dbus" != "$enable_avahi"; then
2843     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2844     enable_avahi=$enable_dbus
2847 add_lopath_after ()
2849     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2850         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2851     fi
2854 add_lopath_before ()
2856     local IFS=${P_SEP}
2857     local path_cleanup
2858     local dir
2859     for dir in $LO_PATH ; do
2860         if test "$dir" != "$1" ; then
2861             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2862         fi
2863     done
2864     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2867 dnl ===================================================================
2868 dnl check for required programs (grep, awk, sed, bash)
2869 dnl ===================================================================
2871 pathmunge ()
2873     local new_path
2874     if test -n "$1"; then
2875         if test "$build_os" = "cygwin"; then
2876             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2877                 PathFormat "$1"
2878                 new_path=`cygpath -sm "$formatted_path"`
2879             else
2880                 PathFormat "$1"
2881                 new_path=`cygpath -u "$formatted_path"`
2882             fi
2883         else
2884             new_path="$1"
2885         fi
2886         if test "$2" = "after"; then
2887             add_lopath_after "$new_path"
2888         else
2889             add_lopath_before "$new_path"
2890         fi
2891     fi
2894 AC_PROG_AWK
2895 AC_PATH_PROG( AWK, $AWK)
2896 if test -z "$AWK"; then
2897     AC_MSG_ERROR([install awk to run this script])
2900 AC_PATH_PROG(BASH, bash)
2901 if test -z "$BASH"; then
2902     AC_MSG_ERROR([bash not found in \$PATH])
2904 AC_SUBST(BASH)
2906 AC_MSG_CHECKING([for GNU or BSD tar])
2907 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2908     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2909     if test $? -eq 0;  then
2910         GNUTAR=$a
2911         break
2912     fi
2913 done
2914 AC_MSG_RESULT($GNUTAR)
2915 if test -z "$GNUTAR"; then
2916     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2918 AC_SUBST(GNUTAR)
2920 AC_MSG_CHECKING([for tar's option to strip components])
2921 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2922 if test $? -eq 0; then
2923     STRIP_COMPONENTS="--strip-components"
2924 else
2925     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2926     if test $? -eq 0; then
2927         STRIP_COMPONENTS="--strip-path"
2928     else
2929         STRIP_COMPONENTS="unsupported"
2930     fi
2932 AC_MSG_RESULT($STRIP_COMPONENTS)
2933 if test x$STRIP_COMPONENTS = xunsupported; then
2934     AC_MSG_ERROR([you need a tar that is able to strip components.])
2936 AC_SUBST(STRIP_COMPONENTS)
2938 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2939 dnl desktop OSes from "mobile" ones.
2941 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2942 dnl In other words, that when building for an OS that is not a
2943 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2945 dnl Note the direction of the implication; there is no assumption that
2946 dnl cross-compiling would imply a non-desktop OS.
2948 if test $_os != iOS -a $_os != Android -a $_os != Emscripten -a "$enable_fuzzers" != "yes"; then
2949     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2950     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2951     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2954 # Whether to build "avmedia" functionality or not.
2956 if test -z "$enable_avmedia"; then
2957     enable_avmedia=yes
2960 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2961 if test "$enable_avmedia" = yes; then
2962     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2963 else
2964     USE_AVMEDIA_DUMMY='TRUE'
2966 AC_SUBST(USE_AVMEDIA_DUMMY)
2968 # Decide whether to build database connectivity stuff (including Base) or not.
2969 if test "$enable_database_connectivity" != no; then
2970     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2971     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2972 else
2973     if test "$_os" = iOS; then
2974         AC_MSG_ERROR([Presumly can't disable DB connectivity on iOS.])
2975     fi
2976     disable_database_connectivity_dependencies
2979 if test -z "$enable_extensions"; then
2980     # For iOS and Android Viewer, disable extensions unless specifically overridden with --enable-extensions.
2981     if test $_os != iOS && test $_os != Android -o "$ENABLE_ANDROID_LOK" = TRUE ; then
2982         enable_extensions=yes
2983     fi
2986 if test "$enable_extensions" = yes; then
2987     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2988     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2989 else
2990     enable_extension_integration=no
2991     enable_extension_update=no
2994 if test -z "$enable_scripting"; then
2995     # Disable scripting for iOS unless specifically overridden
2996     # with --enable-scripting.
2997     if test $_os != iOS -o $_os = Emscripten; then
2998         enable_scripting=yes
2999     fi
3002 DISABLE_SCRIPTING=''
3003 if test "$enable_scripting" = yes; then
3004     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
3005     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
3006 else
3007     DISABLE_SCRIPTING='TRUE'
3008     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
3011 if test $_os = iOS -o $_os = Android -o $_os = Emscripten; then
3012     # Disable dynamic_loading always for iOS and Android
3013     enable_dynamic_loading=no
3014 elif test -z "$enable_dynamic_loading"; then
3015     # Otherwise enable it unless specifically disabled
3016     enable_dynamic_loading=yes
3019 DISABLE_DYNLOADING=''
3020 if test "$enable_dynamic_loading" = yes; then
3021     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
3022 else
3023     DISABLE_DYNLOADING='TRUE'
3025 AC_SUBST(DISABLE_DYNLOADING)
3027 # remember SYSBASE value
3028 AC_SUBST(SYSBASE)
3030 dnl ===================================================================
3031 dnl  Sort out various gallery compilation options
3032 dnl ===================================================================
3033 WITH_GALLERY_BUILD=TRUE
3034 AC_MSG_CHECKING([how to build and package galleries])
3035 if test -n "${with_galleries}"; then
3036     if test "$with_galleries" = "build"; then
3037         if test "$enable_database_connectivity" = no; then
3038             AC_MSG_ERROR([DB connectivity is needed for gengal / svx])
3039         fi
3040         AC_MSG_RESULT([build from source images internally])
3041     elif test "$with_galleries" = "no"; then
3042         WITH_GALLERY_BUILD=
3043         AC_MSG_RESULT([disable non-internal gallery build])
3044     else
3045         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
3046     fi
3047 else
3048     if test $_os != iOS -a $_os != Android; then
3049         AC_MSG_RESULT([internal src images for desktop])
3050     else
3051         WITH_GALLERY_BUILD=
3052         AC_MSG_RESULT([disable src image build])
3053     fi
3055 AC_SUBST(WITH_GALLERY_BUILD)
3057 dnl ===================================================================
3058 dnl  Checks if ccache is available
3059 dnl ===================================================================
3060 CCACHE_DEPEND_MODE=
3061 if test "$enable_ccache" = "no"; then
3062     CCACHE=""
3063 elif test "$_os" = "WINNT"; then
3064     # on windows/VC build do not use ccache - but perhaps sccache is around?
3065     case "%$CC%$CXX%" in
3066     # If $CC and/or $CXX already contain "sccache" (possibly suffixed with some version number etc),
3067     # assume that's good then
3068     *%sccache[[-_' ']]*|*/sccache[[-_' ']]*)
3069         AC_MSG_NOTICE([sccache seems to be included in a pre-defined CC and/or CXX])
3070         CCACHE_DEPEND_MODE=1
3071         ;;
3072     *)
3073         # for sharing code below, reuse CCACHE env var
3074         AC_PATH_PROG([CCACHE],[sccache],[not found])
3075         if test "$CCACHE" = "not found"; then
3076             CCACHE=""
3077         else
3078             CCACHE=`win_short_path_for_make "$CCACHE"`
3079             CCACHE_DEPEND_MODE=1
3080         fi
3081         ;;
3082     esac
3083 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
3084     case "%$CC%$CXX%" in
3085     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
3086     # assume that's good then
3087     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
3088         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
3089         CCACHE_DEPEND_MODE=1
3090         ;;
3091     *)
3092         AC_PATH_PROG([CCACHE],[ccache],[not found])
3093         if test "$CCACHE" = "not found"; then
3094             CCACHE=""
3095         else
3096             CCACHE_DEPEND_MODE=1
3097             # Need to check for ccache version: otherwise prevents
3098             # caching of the results (like "-x objective-c++" for Mac)
3099             if test $_os = Darwin -o $_os = iOS; then
3100                 # Check ccache version
3101                 AC_MSG_CHECKING([whether version of ccache is suitable])
3102                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
3103                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3104                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
3105                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
3106                 else
3107                     AC_MSG_RESULT([no, $CCACHE_VERSION])
3108                     CCACHE=""
3109                     CCACHE_DEPEND_MODE=
3110                 fi
3111             fi
3112         fi
3113         ;;
3114     esac
3115 else
3116     CCACHE=""
3118 if test "$enable_ccache" = "nodepend"; then
3119     CCACHE_DEPEND_MODE=""
3121 AC_SUBST(CCACHE_DEPEND_MODE)
3123 # skip on windows - sccache defaults are good enough
3124 if test "$CCACHE" != "" -a "$_os" != "WINNT"; then
3125     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
3126     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
3127     if test "$ccache_size" = ""; then
3128         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
3129         if test "$ccache_size" = ""; then
3130             ccache_size=0
3131         fi
3132         # we could not determine the size or it was less than 1GB -> disable auto-ccache
3133         if test $ccache_size -lt 1024; then
3134             CCACHE=""
3135             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
3136             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
3137         else
3138             # warn that ccache may be too small for debug build
3139             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3140             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3141         fi
3142     else
3143         if test $ccache_size -lt 5; then
3144             #warn that ccache may be too small for debug build
3145             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3146             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3147         fi
3148     fi
3151 dnl ===================================================================
3152 dnl  Checks for C compiler,
3153 dnl  The check for the C++ compiler is later on.
3154 dnl ===================================================================
3155 if test "$_os" != "WINNT"; then
3156     GCC_HOME_SET="true"
3157     AC_MSG_CHECKING([gcc home])
3158     if test -z "$with_gcc_home"; then
3159         if test "$enable_icecream" = "yes"; then
3160             if test -d "/usr/lib/icecc/bin"; then
3161                 GCC_HOME="/usr/lib/icecc/"
3162             elif test -d "/usr/libexec/icecc/bin"; then
3163                 GCC_HOME="/usr/libexec/icecc/"
3164             elif test -d "/opt/icecream/bin"; then
3165                 GCC_HOME="/opt/icecream/"
3166             else
3167                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
3169             fi
3170         else
3171             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
3172             GCC_HOME_SET="false"
3173         fi
3174     else
3175         GCC_HOME="$with_gcc_home"
3176     fi
3177     AC_MSG_RESULT($GCC_HOME)
3178     AC_SUBST(GCC_HOME)
3180     if test "$GCC_HOME_SET" = "true"; then
3181         if test -z "$CC"; then
3182             CC="$GCC_HOME/bin/gcc"
3183             CC_BASE="gcc"
3184         fi
3185         if test -z "$CXX"; then
3186             CXX="$GCC_HOME/bin/g++"
3187             CXX_BASE="g++"
3188         fi
3189     fi
3192 COMPATH=`dirname "$CC"`
3193 if test "$COMPATH" = "."; then
3194     AC_PATH_PROGS(COMPATH, $CC)
3195     dnl double square bracket to get single because of M4 quote...
3196     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
3198 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
3200 dnl ===================================================================
3201 dnl Java support
3202 dnl ===================================================================
3203 AC_MSG_CHECKING([whether to build with Java support])
3204 if test "$with_java" != "no"; then
3205     if test "$DISABLE_SCRIPTING" = TRUE; then
3206         AC_MSG_RESULT([no, overridden by --disable-scripting])
3207         ENABLE_JAVA=""
3208         with_java=no
3209     else
3210         AC_MSG_RESULT([yes])
3211         ENABLE_JAVA="TRUE"
3212         AC_DEFINE(HAVE_FEATURE_JAVA)
3213     fi
3214 else
3215     AC_MSG_RESULT([no])
3216     ENABLE_JAVA=""
3219 AC_SUBST(ENABLE_JAVA)
3221 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
3223 dnl ENABLE_JAVA="" indicate no Java support at all
3225 dnl ===================================================================
3226 dnl Check macOS SDK and compiler
3227 dnl ===================================================================
3229 if test $_os = Darwin; then
3231     # If no --with-macosx-sdk option is given, look for one
3233     # The intent is that for "most" Mac-based developers, a suitable
3234     # SDK will be found automatically without any configure options.
3236     # For developers with a current Xcode, the lowest-numbered SDK
3237     # higher than or equal to the minimum required should be found.
3239     AC_MSG_CHECKING([what macOS SDK to use])
3240     for _macosx_sdk in ${with_macosx_sdk-11.3 11.1 11.0 10.15 10.14 10.13}; do
3241         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
3242         if test -d "$MACOSX_SDK_PATH"; then
3243             with_macosx_sdk="${_macosx_sdk}"
3244             break
3245         else
3246             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
3247             if test -d "$MACOSX_SDK_PATH"; then
3248                 with_macosx_sdk="${_macosx_sdk}"
3249                 break
3250             fi
3251         fi
3252     done
3253     if test ! -d "$MACOSX_SDK_PATH"; then
3254         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
3255     fi
3257     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
3259     case $with_macosx_sdk in
3260     10.13)
3261         MACOSX_SDK_VERSION=101300
3262         ;;
3263     10.14)
3264         MACOSX_SDK_VERSION=101400
3265         ;;
3266     10.15)
3267         MACOSX_SDK_VERSION=101500
3268         ;;
3269     11.0)
3270         MACOSX_SDK_VERSION=110000
3271         ;;
3272     11.1)
3273         MACOSX_SDK_VERSION=110100
3274         ;;
3275     11.3)
3276         MACOSX_SDK_VERSION=110300
3277         ;;
3278     *)
3279         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.13--11.3])
3280         ;;
3281     esac
3283     if test "$host_cpu" = arm64 -a $MACOSX_SDK_VERSION -lt 110000; then
3284         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value for Apple Silicon])
3285     fi
3287     if test "$with_macosx_version_min_required" = "" ; then
3288         if test "$host_cpu" = x86_64; then
3289             with_macosx_version_min_required="10.10";
3290         else
3291             with_macosx_version_min_required="11.0";
3292         fi
3293     fi
3295     if test "$with_macosx_version_max_allowed" = "" ; then
3296         with_macosx_version_max_allowed="$with_macosx_sdk"
3297     fi
3299     # export this so that "xcrun" invocations later return matching values
3300     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
3301     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
3302     export DEVELOPER_DIR
3303     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
3304     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
3306     AC_MSG_CHECKING([whether Xcode is new enough])
3307     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
3308     my_xcode_ver2=${my_xcode_ver1#Xcode }
3309     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
3310     if test "$my_xcode_ver3" -ge 1103; then
3311         AC_MSG_RESULT([yes ($my_xcode_ver2)])
3312     else
3313         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 11.3])
3314     fi
3316     case "$with_macosx_version_min_required" in
3317     10.10)
3318         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
3319         ;;
3320     10.11)
3321         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
3322         ;;
3323     10.12)
3324         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
3325         ;;
3326     10.13)
3327         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
3328         ;;
3329     10.14)
3330         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
3331         ;;
3332     10.15)
3333         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
3334         ;;
3335     10.16)
3336         MAC_OS_X_VERSION_MIN_REQUIRED="101600"
3337         ;;
3338     11.0)
3339         MAC_OS_X_VERSION_MIN_REQUIRED="110000"
3340         ;;
3341     11.1)
3342         MAC_OS_X_VERSION_MIN_REQUIRED="110100"
3343         ;;
3344     11.3)
3345         MAC_OS_X_VERSION_MIN_REQUIRED="110300"
3346         ;;
3347     *)
3348         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--11.3])
3349         ;;
3350     esac
3352     LIBTOOL=/usr/bin/libtool
3353     INSTALL_NAME_TOOL=install_name_tool
3354     if test -z "$save_CC"; then
3355         stdlib=-stdlib=libc++
3357         AC_MSG_CHECKING([what C compiler to use])
3358         CC="`xcrun -find clang`"
3359         CC_BASE=`first_arg_basename "$CC"`
3360         if test "$host_cpu" = x86_64; then
3361             CC+=" -target x86_64-apple-macos"
3362         else
3363             CC+=" -target arm64-apple-macos"
3364         fi
3365         CC+=" -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3366         AC_MSG_RESULT([$CC])
3368         AC_MSG_CHECKING([what C++ compiler to use])
3369         CXX="`xcrun -find clang++`"
3370         CXX_BASE=`first_arg_basename "$CXX"`
3371         if test "$host_cpu" = x86_64; then
3372             CXX+=" -target x86_64-apple-macos"
3373         else
3374             CXX+=" -target arm64-apple-macos"
3375         fi
3376         CXX+=" $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3377         AC_MSG_RESULT([$CXX])
3379         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3380         AR=`xcrun -find ar`
3381         NM=`xcrun -find nm`
3382         STRIP=`xcrun -find strip`
3383         LIBTOOL=`xcrun -find libtool`
3384         RANLIB=`xcrun -find ranlib`
3385     fi
3387     case "$with_macosx_version_max_allowed" in
3388     10.10)
3389         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
3390         ;;
3391     10.11)
3392         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
3393         ;;
3394     10.12)
3395         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
3396         ;;
3397     10.13)
3398         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
3399         ;;
3400     10.14)
3401         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
3402         ;;
3403     10.15)
3404         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
3405         ;;
3406     11.0)
3407         MAC_OS_X_VERSION_MAX_ALLOWED="110000"
3408         ;;
3409     11.1)
3410         MAC_OS_X_VERSION_MAX_ALLOWED="110100"
3411         ;;
3412     11.3)
3413         MAC_OS_X_VERSION_MAX_ALLOWED="110300"
3414         ;;
3415     *)
3416         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--11.3])
3417         ;;
3418     esac
3420     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
3421     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
3422         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])
3423     else
3424         AC_MSG_RESULT([ok])
3425     fi
3427     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
3428     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
3429         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
3430     else
3431         AC_MSG_RESULT([ok])
3432     fi
3433     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
3434     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
3436     AC_MSG_CHECKING([whether to do code signing])
3438     if test "$enable_macosx_code_signing" = yes; then
3439         # By default use the first suitable certificate (?).
3441         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
3442         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
3443         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
3444         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
3445         # "Developer ID Application" one.
3447         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
3448         if test -n "$identity"; then
3449             MACOSX_CODESIGNING_IDENTITY=$identity
3450             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3451             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3452         else
3453             AC_MSG_ERROR([cannot determine identity to use])
3454         fi
3455     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
3456         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
3457         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3458         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3459     else
3460         AC_MSG_RESULT([no])
3461     fi
3463     AC_MSG_CHECKING([whether to create a Mac App Store package])
3465     if test -z "$enable_macosx_package_signing" || test "$enable_macosx_package_signing" == no; then
3466         AC_MSG_RESULT([no])
3467     elif test -z "$MACOSX_CODESIGNING_IDENTITY"; then
3468         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3469     elif test "$enable_macosx_package_signing" = yes; then
3470         # By default use the first suitable certificate.
3471         # It should be a "3rd Party Mac Developer Installer" one
3473         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
3474         if test -n "$identity"; then
3475             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3476             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3477             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3478         else
3479             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3480         fi
3481     else
3482         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
3483         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3484         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3485     fi
3487     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3488         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3489     fi
3491     AC_MSG_CHECKING([whether to sandbox the application])
3493     if test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3494         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3495     elif test "$enable_macosx_sandbox" = yes; then
3496         ENABLE_MACOSX_SANDBOX=TRUE
3497         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3498         AC_MSG_RESULT([yes])
3499     else
3500         AC_MSG_RESULT([no])
3501     fi
3503     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3504     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3505     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3507 AC_SUBST(MACOSX_SDK_PATH)
3508 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3509 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3510 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3511 AC_SUBST(INSTALL_NAME_TOOL)
3512 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3513 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3514 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3515 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3516 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3518 dnl ===================================================================
3519 dnl Check iOS SDK and compiler
3520 dnl ===================================================================
3522 if test $_os = iOS; then
3523     AC_MSG_CHECKING([what iOS SDK to use])
3524     current_sdk_ver=14.5
3525     older_sdk_vers="14.4 14.3 14.2 14.1 14.0 13.7"
3526     if test "$enable_ios_simulator" = "yes"; then
3527         platform=iPhoneSimulator
3528         versionmin=-mios-simulator-version-min=12.2
3529     else
3530         platform=iPhoneOS
3531         versionmin=-miphoneos-version-min=12.2
3532     fi
3533     xcode_developer=`xcode-select -print-path`
3535     for sdkver in $current_sdk_ver $older_sdk_vers; do
3536         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3537         if test -d $t; then
3538             sysroot=$t
3539             break
3540         fi
3541     done
3543     if test -z "$sysroot"; then
3544         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3545     fi
3547     AC_MSG_RESULT($sysroot)
3549     stdlib="-stdlib=libc++"
3551     AC_MSG_CHECKING([what C compiler to use])
3552     CC="`xcrun -find clang`"
3553     CC_BASE=`first_arg_basename "$CC"`
3554     CC+=" -arch $host_cpu_for_clang -isysroot $sysroot $versionmin"
3555     AC_MSG_RESULT([$CC])
3557     AC_MSG_CHECKING([what C++ compiler to use])
3558     CXX="`xcrun -find clang++`"
3559     CXX_BASE=`first_arg_basename "$CXX"`
3560     CXX+=" -arch $host_cpu_for_clang $stdlib -isysroot $sysroot $versionmin"
3561     AC_MSG_RESULT([$CXX])
3563     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3564     AR=`xcrun -find ar`
3565     NM=`xcrun -find nm`
3566     STRIP=`xcrun -find strip`
3567     LIBTOOL=`xcrun -find libtool`
3568     RANLIB=`xcrun -find ranlib`
3571 AC_MSG_CHECKING([whether to treat the installation as read-only])
3573 if test $_os = Darwin; then
3574     enable_readonly_installset=yes
3575 elif test "$enable_extensions" != yes; then
3576     enable_readonly_installset=yes
3578 if test "$enable_readonly_installset" = yes; then
3579     AC_MSG_RESULT([yes])
3580     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3581 else
3582     AC_MSG_RESULT([no])
3585 dnl ===================================================================
3586 dnl Structure of install set
3587 dnl ===================================================================
3589 if test $_os = Darwin; then
3590     LIBO_BIN_FOLDER=MacOS
3591     LIBO_ETC_FOLDER=Resources
3592     LIBO_LIBEXEC_FOLDER=MacOS
3593     LIBO_LIB_FOLDER=Frameworks
3594     LIBO_LIB_PYUNO_FOLDER=Resources
3595     LIBO_SHARE_FOLDER=Resources
3596     LIBO_SHARE_HELP_FOLDER=Resources/help
3597     LIBO_SHARE_JAVA_FOLDER=Resources/java
3598     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3599     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3600     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3601     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3602     LIBO_URE_BIN_FOLDER=MacOS
3603     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3604     LIBO_URE_LIB_FOLDER=Frameworks
3605     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3606     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3607 elif test $_os = WINNT; then
3608     LIBO_BIN_FOLDER=program
3609     LIBO_ETC_FOLDER=program
3610     LIBO_LIBEXEC_FOLDER=program
3611     LIBO_LIB_FOLDER=program
3612     LIBO_LIB_PYUNO_FOLDER=program
3613     LIBO_SHARE_FOLDER=share
3614     LIBO_SHARE_HELP_FOLDER=help
3615     LIBO_SHARE_JAVA_FOLDER=program/classes
3616     LIBO_SHARE_PRESETS_FOLDER=presets
3617     LIBO_SHARE_READMES_FOLDER=readmes
3618     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3619     LIBO_SHARE_SHELL_FOLDER=program/shell
3620     LIBO_URE_BIN_FOLDER=program
3621     LIBO_URE_ETC_FOLDER=program
3622     LIBO_URE_LIB_FOLDER=program
3623     LIBO_URE_MISC_FOLDER=program
3624     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3625 else
3626     LIBO_BIN_FOLDER=program
3627     LIBO_ETC_FOLDER=program
3628     LIBO_LIBEXEC_FOLDER=program
3629     LIBO_LIB_FOLDER=program
3630     LIBO_LIB_PYUNO_FOLDER=program
3631     LIBO_SHARE_FOLDER=share
3632     LIBO_SHARE_HELP_FOLDER=help
3633     LIBO_SHARE_JAVA_FOLDER=program/classes
3634     LIBO_SHARE_PRESETS_FOLDER=presets
3635     LIBO_SHARE_READMES_FOLDER=readmes
3636     if test "$enable_fuzzers" != yes; then
3637         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3638     else
3639         LIBO_SHARE_RESOURCE_FOLDER=resource
3640     fi
3641     LIBO_SHARE_SHELL_FOLDER=program/shell
3642     LIBO_URE_BIN_FOLDER=program
3643     LIBO_URE_ETC_FOLDER=program
3644     LIBO_URE_LIB_FOLDER=program
3645     LIBO_URE_MISC_FOLDER=program
3646     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3648 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3649 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3650 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3651 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3652 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3653 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3654 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3655 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3656 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3657 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3658 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3659 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3660 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3661 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3662 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3663 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3665 # Not all of them needed in config_host.mk, add more if need arises
3666 AC_SUBST(LIBO_BIN_FOLDER)
3667 AC_SUBST(LIBO_ETC_FOLDER)
3668 AC_SUBST(LIBO_LIB_FOLDER)
3669 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3670 AC_SUBST(LIBO_SHARE_FOLDER)
3671 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3672 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3673 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3674 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3675 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3676 AC_SUBST(LIBO_URE_BIN_FOLDER)
3677 AC_SUBST(LIBO_URE_ETC_FOLDER)
3678 AC_SUBST(LIBO_URE_LIB_FOLDER)
3679 AC_SUBST(LIBO_URE_MISC_FOLDER)
3680 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3682 dnl ===================================================================
3683 dnl Windows specific tests and stuff
3684 dnl ===================================================================
3686 reg_get_value()
3688     # Return value: $regvalue
3689     unset regvalue
3691     if test "$build_os" = "wsl"; then
3692         regvalue=$($BUILDDIR/solenv/wsl/wsl-lo-helper.exe --read-registry $1 "$2" 2>/dev/null)
3693         return
3694     fi
3696     local _regentry="/proc/registry${1}/${2}"
3697     if test -f "$_regentry"; then
3698         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3699         # Registry keys read via /proc/registry* are always \0 terminated!
3700         local _regvalue=$(tr -d '\0' < "$_regentry")
3701         if test $? -eq 0; then
3702             regvalue=$_regvalue
3703         fi
3704     fi
3707 # Get a value from the 32-bit side of the Registry
3708 reg_get_value_32()
3710     reg_get_value "32" "$1"
3713 # Get a value from the 64-bit side of the Registry
3714 reg_get_value_64()
3716     reg_get_value "64" "$1"
3719 case "$host_os" in
3720 cygwin*|wsl*)
3721     COM=MSC
3722     OS=WNT
3723     RTL_OS=Windows
3724     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3725         P_SEP=";"
3726     else
3727         P_SEP=:
3728     fi
3729     case "$host_cpu" in
3730     x86_64)
3731         CPUNAME=X86_64
3732         RTL_ARCH=X86_64
3733         PLATFORMID=windows_x86_64
3734         WINDOWS_X64=1
3735         SCPDEFS="$SCPDEFS -DWINDOWS_X64"
3736         WIN_HOST_ARCH="x64"
3737         WIN_MULTI_ARCH="x86"
3738         WIN_HOST_BITS=64
3739         ;;
3740     i*86)
3741         CPUNAME=INTEL
3742         RTL_ARCH=x86
3743         PLATFORMID=windows_x86
3744         WIN_HOST_ARCH="x86"
3745         WIN_HOST_BITS=32
3746         WIN_OTHER_ARCH="x64"
3747         ;;
3748     aarch64)
3749         CPUNAME=AARCH64
3750         RTL_ARCH=AARCH64
3751         PLATFORMID=windows_aarch64
3752         WINDOWS_X64=1
3753         SCPDEFS="$SCPDEFS -DWINDOWS_AARCH64"
3754         WIN_HOST_ARCH="arm64"
3755         WIN_HOST_BITS=64
3756         with_ucrt_dir=no
3757         ;;
3758     *)
3759         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3760         ;;
3761     esac
3763     case "$build_cpu" in
3764     x86_64) WIN_BUILD_ARCH="x64" ;;
3765     i*86) WIN_BUILD_ARCH="x86" ;;
3766     aarch64) WIN_BUILD_ARCH="arm64" ;;
3767     *)
3768         AC_MSG_ERROR([Unsupported build_cpu $build_cpu for host_os $host_os])
3769         ;;
3770     esac
3772     SCPDEFS="$SCPDEFS -D_MSC_VER"
3773     ;;
3774 esac
3776 # multi-arch is an arch, which can execute on the host (x86 on x64), while
3777 # other-arch won't, but wouldn't break the build (x64 on x86).
3778 if test -n "$WIN_MULTI_ARCH" -a -n "$WIN_OTHER_ARCH"; then
3779     AC_MSG_ERROR([Broken configure.ac file: can't have set \$WIN_MULTI_ARCH and $WIN_OTHER_ARCH])
3783 if test "$_os" = "iOS" -o "$build_cpu" != "$host_cpu"; then
3784     # To allow building Windows multi-arch releases without cross-tooling
3785     if test -z "$WIN_MULTI_ARCH" -a -z "$WIN_OTHER_ARCH"; then
3786         cross_compiling="yes"
3787     fi
3790 ENABLE_WASM_STRIP=''
3791 if test "$cross_compiling" = "yes"; then
3792     export CROSS_COMPILING=TRUE
3793     if test "$enable_dynamic_loading" != yes -a "$enable_wasm_strip" = yes; then
3794         ENABLE_WASM_STRIP=TRUE
3795     fi
3796 else
3797     CROSS_COMPILING=
3798     BUILD_TYPE="$BUILD_TYPE NATIVE"
3800 AC_SUBST(CROSS_COMPILING)
3801 AC_SUBST(ENABLE_WASM_STRIP)
3803 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3804 # NOTE: must _not_ be used for bundled external libraries!
3805 ISYSTEM=
3806 if test "$GCC" = "yes"; then
3807     AC_MSG_CHECKING( for -isystem )
3808     save_CFLAGS=$CFLAGS
3809     CFLAGS="$CFLAGS -Werror"
3810     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3811     CFLAGS=$save_CFLAGS
3812     if test -n "$ISYSTEM"; then
3813         AC_MSG_RESULT(yes)
3814     else
3815         AC_MSG_RESULT(no)
3816     fi
3818 if test -z "$ISYSTEM"; then
3819     # fall back to using -I
3820     ISYSTEM=-I
3822 AC_SUBST(ISYSTEM)
3824 dnl ===================================================================
3825 dnl  Check which Visual Studio compiler is used
3826 dnl ===================================================================
3828 map_vs_year_to_version()
3830     # Return value: $vsversion
3832     unset vsversion
3834     case $1 in
3835     2019)
3836         vsversion=16;;
3837     *)
3838         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3839     esac
3842 vs_versions_to_check()
3844     # Args: $1 (optional) : versions to check, in the order of preference
3845     # Return value: $vsversions
3847     unset vsversions
3849     if test -n "$1"; then
3850         map_vs_year_to_version "$1"
3851         vsversions=$vsversion
3852     else
3853         # We accept only 2019
3854         vsversions="16"
3855     fi
3858 win_get_env_from_vsvars32bat()
3860     local WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3861     # Also seems to be located in another directory under the same name: vsvars32.bat
3862     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3863     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3864     # use 'echo.%ENV%' syntax (instead of 'echo %ENV%') to avoid outputting "ECHO is off." in case when ENV is empty or a space
3865     printf '@setlocal\r\n@echo.%%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3866     local result
3867     if test "$build_os" = "wsl"; then
3868         result=$(cd /mnt/c && cmd.exe /c $(wslpath -w $WRAPPERBATCHFILEPATH) | tr -d '\r')
3869     else
3870         chmod +x $WRAPPERBATCHFILEPATH
3871         result=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3872     fi
3873     rm -f $WRAPPERBATCHFILEPATH
3874     printf '%s' "$result"
3877 find_ucrt()
3879     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3880     if test -n "$regvalue"; then
3881         PathFormat "$regvalue"
3882         UCRTSDKDIR=$formatted_path_unix
3883         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3884         UCRTVERSION=$regvalue
3885         # Rest if not exist
3886         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3887           UCRTSDKDIR=
3888         fi
3889     fi
3890     if test -z "$UCRTSDKDIR"; then
3891         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3892         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3893         if test -f "$ide_env_file"; then
3894             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3895             UCRTSDKDIR=$formatted_path
3896             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3897             dnl Hack needed at least by tml:
3898             if test "$UCRTVERSION" = 10.0.15063.0 \
3899                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3900                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3901             then
3902                 UCRTVERSION=10.0.14393.0
3903             fi
3904         else
3905           AC_MSG_ERROR([No UCRT found])
3906         fi
3907     fi
3910 find_msvc()
3912     # Find Visual C++ 2019
3913     # Args: $1 (optional) : The VS version year
3914     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3916     unset vctest vcnum vcnumwithdot vcbuildnumber
3918     vs_versions_to_check "$1"
3919     if test "$build_os" = wsl; then
3920         vswhere="$PROGRAMFILESX86"
3921     else
3922         vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3923     fi
3924     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3925     PathFormat "$vswhere"
3926     vswhere=$formatted_path_unix
3927     for ver in $vsversions; do
3928         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3929         # Fall back to all MS products (this includes VC++ Build Tools)
3930         if ! test -n "$vswhereoutput"; then
3931             AC_MSG_CHECKING([VC++ Build Tools and similar])
3932             vswhereoutput=`$vswhere -products \* -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3933         fi
3934         if test -n "$vswhereoutput"; then
3935             PathFormat "$vswhereoutput"
3936             vctest=$formatted_path_unix
3937             break
3938         fi
3939     done
3941     if test -n "$vctest"; then
3942         vcnumwithdot="$ver.0"
3943         case "$vcnumwithdot" in
3944         16.0)
3945             vcyear=2019
3946             vcnum=160
3947             ;;
3948         esac
3949         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3951     fi
3954 test_cl_exe()
3956     AC_MSG_CHECKING([$1 compiler])
3958     CL_EXE_PATH="$2/cl.exe"
3960     if test ! -f "$CL_EXE_PATH"; then
3961         if test "$1" = "multi-arch"; then
3962             AC_MSG_WARN([no compiler (cl.exe) in $2])
3963             return 1
3964         else
3965             AC_MSG_ERROR([no compiler (cl.exe) in $2])
3966         fi
3967     fi
3969     dnl ===========================================================
3970     dnl  Check for the corresponding mspdb*.dll
3971     dnl ===========================================================
3973     # MSVC 15.0 has libraries from 14.0?
3974     mspdbnum="140"
3976     if test ! -e "$2/mspdb${mspdbnum}.dll"; then
3977         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $2, Visual Studio installation broken?])
3978     fi
3980     # The compiles has to find its shared libraries
3981     OLD_PATH="$PATH"
3982     TEMP_PATH=`cygpath -d "$2"`
3983     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3985     if ! "$CL_EXE_PATH" -? </dev/null >/dev/null 2>&1; then
3986         AC_MSG_ERROR([no compiler (cl.exe) in $2])
3987     fi
3989     PATH="$OLD_PATH"
3991     AC_MSG_RESULT([$CL_EXE_PATH])
3994 SOLARINC=
3995 MSBUILD_PATH=
3996 DEVENV=
3997 if test "$_os" = "WINNT"; then
3998     AC_MSG_CHECKING([Visual C++])
3999     find_msvc "$with_visual_studio"
4000     if test -z "$vctest"; then
4001         if test -n "$with_visual_studio"; then
4002             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
4003         else
4004             AC_MSG_ERROR([no Visual Studio 2019 installation found])
4005         fi
4006     fi
4007     AC_MSG_RESULT([])
4009     VC_PRODUCT_DIR="$vctest/VC"
4010     COMPATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber"
4012     # $WIN_OTHER_ARCH is a hack to test the x64 compiler on x86, even if it's not multi-arch
4013     if test -n "$WIN_MULTI_ARCH" -o -n "$WIN_OTHER_ARCH"; then
4014         MSVC_MULTI_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/${WIN_MULTI_ARCH}${WIN_OTHER_ARCH}"
4015         test_cl_exe "multi-arch" "$MSVC_MULTI_PATH"
4016         if test $? -ne 0; then
4017             WIN_MULTI_ARCH=""
4018             WIN_OTHER_ARCH=""
4019         fi
4020     fi
4022     if test "$WIN_BUILD_ARCH" = "$WIN_HOST_ARCH"; then
4023         MSVC_BUILD_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_BUILD_ARCH"
4024         test_cl_exe "build" "$MSVC_BUILD_PATH"
4025     fi
4027     if test "$WIN_BUILD_ARCH" != "$WIN_HOST_ARCH"; then
4028         MSVC_HOST_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_HOST_ARCH"
4029         test_cl_exe "host" "$MSVC_HOST_PATH"
4030     else
4031         MSVC_HOST_PATH="$MSVC_BUILD_PATH"
4032     fi
4034     AC_MSG_CHECKING([for short pathname of VC product directory])
4035     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
4036     AC_MSG_RESULT([$VC_PRODUCT_DIR])
4038     UCRTSDKDIR=
4039     UCRTVERSION=
4041     AC_MSG_CHECKING([for UCRT location])
4042     find_ucrt
4043     # find_ucrt errors out if it doesn't find it
4044     AC_MSG_RESULT([$UCRTSDKDIR ($UCRTVERSION)])
4045     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
4046     ucrtincpath_formatted=$formatted_path
4047     # SOLARINC is used for external modules and must be set too.
4048     # And no, it's not sufficient to set SOLARINC only, as configure
4049     # itself doesn't honour it.
4050     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
4051     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
4052     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
4053     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
4055     AC_SUBST(UCRTSDKDIR)
4056     AC_SUBST(UCRTVERSION)
4058     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
4059     # Find the proper version of MSBuild.exe to use based on the VS version
4060     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
4061     if test -n "$regvalue" ; then
4062         AC_MSG_RESULT([found: $regvalue])
4063         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
4064     else
4065         if test "$vcnumwithdot" = "16.0"; then
4066             if test "$WIN_BUILD_ARCH" != "x64"; then
4067                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
4068             else
4069                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
4070             fi
4071         else
4072             if test "$WIN_BUILD_ARCH" != "x64"; then
4073                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
4074             else
4075                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
4076             fi
4077         fi
4078         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
4079         AC_MSG_RESULT([$regvalue])
4080     fi
4082     # Find the version of devenv.exe
4083     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
4084     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
4085     DEVENV_unix=$(cygpath -u "$DEVENV")
4086     if test ! -e "$DEVENV_unix"; then
4087         AC_MSG_WARN([No devenv.exe found - this is expected for VC++ Build Tools])
4088     fi
4090     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
4091     dnl needed when building CLR code:
4092     if test -z "$MSVC_CXX"; then
4093         # This gives us a posix path with 8.3 filename restrictions
4094         MSVC_CXX=`win_short_path_for_make "$MSVC_HOST_PATH/cl.exe"`
4095     fi
4097     if test -z "$CC"; then
4098         CC=$MSVC_CXX
4099         CC_BASE=`first_arg_basename "$CC"`
4100     fi
4101     if test -z "$CXX"; then
4102         CXX=$MSVC_CXX
4103         CXX_BASE=`first_arg_basename "$CXX"`
4104     fi
4106     if test -n "$CC"; then
4107         # Remove /cl.exe from CC case insensitive
4108         AC_MSG_NOTICE([found Visual C++ $vcyear])
4110         main_include_dir=`cygpath -d -m "$COMPATH/Include"`
4111         CPPFLAGS="$CPPFLAGS -I$main_include_dir"
4113         PathFormat "$COMPATH"
4114         COMPATH=`win_short_path_for_make "$formatted_path"`
4116         VCVER=$vcnum
4118         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
4119         # are always "better", we list them in reverse chronological order.
4121         case "$vcnum" in
4122         160)
4123             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
4124             ;;
4125         esac
4127         # The expectation is that --with-windows-sdk should not need to be used
4128         if test -n "$with_windows_sdk"; then
4129             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
4130             *" "$with_windows_sdk" "*)
4131                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
4132                 ;;
4133             *)
4134                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $vcyear])
4135                 ;;
4136             esac
4137         fi
4139         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
4140         ac_objext=obj
4141         ac_exeext=exe
4143     else
4144         AC_MSG_ERROR([Visual C++ not found after all, huh])
4145     fi
4147     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.5])
4148     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4149         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
4150         // between Visual Studio versions and _MSC_VER:
4151         #if _MSC_VER < 1925
4152         #error
4153         #endif
4154     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
4156     # Check for 64-bit (cross-)compiler to use to build the 64-bit
4157     # version of the Explorer extension (and maybe other small
4158     # bits, too) needed when installing a 32-bit LibreOffice on a
4159     # 64-bit OS. The 64-bit Explorer extension is a feature that
4160     # has been present since long in OOo. Don't confuse it with
4161     # building LibreOffice itself as 64-bit code.
4163     BUILD_X64=
4164     CXX_X64_BINARY=
4166     if test "$WIN_HOST_ARCH" = "x86" -a -n "$WIN_OTHER_ARCH"; then
4167         AC_MSG_CHECKING([for the libraries to build the 64-bit Explorer extensions])
4168         if test -f "$COMPATH/atlmfc/lib/x64/atls.lib" -o \
4169              -f "$COMPATH/atlmfc/lib/spectre/x64/atls.lib"
4170         then
4171             BUILD_X64=TRUE
4172             CXX_X64_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4173             AC_MSG_RESULT([found])
4174         else
4175             AC_MSG_RESULT([not found])
4176             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
4177         fi
4178     elif test "$WIN_HOST_ARCH" = "x64"; then
4179         CXX_X64_BINARY=$CXX
4180     fi
4181     AC_SUBST(BUILD_X64)
4183     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
4184     AC_SUBST(CXX_X64_BINARY)
4186     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
4187     # needed to support TWAIN scan on both 32- and 64-bit systems
4189     case "$WIN_HOST_ARCH" in
4190     x64)
4191         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
4192         if test -n "$CXX_X86_BINARY"; then
4193             BUILD_X86=TRUE
4194             AC_MSG_RESULT([preset])
4195         elif test -n "$WIN_MULTI_ARCH"; then
4196             BUILD_X86=TRUE
4197             CXX_X86_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4198             CXX_X86_BINARY+=" /arch:SSE"
4199             AC_MSG_RESULT([found])
4200         else
4201             AC_MSG_RESULT([not found])
4202             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
4203         fi
4204         ;;
4205     x86)
4206         BUILD_X86=TRUE
4207         CXX_X86_BINARY=$MSVC_CXX
4208         ;;
4209     esac
4210     AC_SUBST(BUILD_X86)
4211     AC_SUBST(CXX_X86_BINARY)
4213 AC_SUBST(VCVER)
4214 AC_SUBST(DEVENV)
4215 AC_SUBST(MSVC_CXX)
4217 COM_IS_CLANG=
4218 AC_MSG_CHECKING([whether the compiler is actually Clang])
4219 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4220     #ifndef __clang__
4221     you lose
4222     #endif
4223     int foo=42;
4224     ]])],
4225     [AC_MSG_RESULT([yes])
4226      COM_IS_CLANG=TRUE],
4227     [AC_MSG_RESULT([no])])
4228 AC_SUBST(COM_IS_CLANG)
4230 CC_PLAIN=$CC
4231 CLANGVER=
4232 if test "$COM_IS_CLANG" = TRUE; then
4233     AC_MSG_CHECKING([whether Clang is new enough])
4234     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4235         #if !defined __apple_build_version__
4236         #error
4237         #endif
4238         ]])],
4239         [my_apple_clang=yes],[my_apple_clang=])
4240     if test "$my_apple_clang" = yes; then
4241         AC_MSG_RESULT([assumed yes (Apple Clang)])
4242     elif test "$_os" = Emscripten; then
4243         AC_MSG_RESULT([assumed yes (Emscripten Clang)])
4244     else
4245         if test "$_os" = WINNT; then
4246             dnl In which case, assume clang-cl:
4247             my_args="/EP /TC"
4248             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
4249             dnl clang-cl:
4250             CC_PLAIN=
4251             for i in $CC; do
4252                 case $i in
4253                 -FIIntrin.h)
4254                     ;;
4255                 *)
4256                     CC_PLAIN="$CC_PLAIN $i"
4257                     ;;
4258                 esac
4259             done
4260         else
4261             my_args="-E -P"
4262         fi
4263         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
4264         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
4265         CLANGVER=`echo $clang_version \
4266             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
4267         if test "$CLANGVER" -ge 50002; then
4268             AC_MSG_RESULT([yes ($clang_version)])
4269         else
4270             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
4271         fi
4272         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
4273         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
4274     fi
4277 SHOWINCLUDES_PREFIX=
4278 if test "$_os" = WINNT; then
4279     dnl We need to guess the prefix of the -showIncludes output, it can be
4280     dnl localized
4281     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
4282     echo "#include <stdlib.h>" > conftest.c
4283     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
4284         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
4285     rm -f conftest.c conftest.obj
4286     if test -z "$SHOWINCLUDES_PREFIX"; then
4287         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
4288     else
4289         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
4290     fi
4292 AC_SUBST(SHOWINCLUDES_PREFIX)
4295 # prefix C with ccache if needed
4297 UNCACHED_CC="$CC"
4298 if test "$CCACHE" != ""; then
4299     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
4301     AC_LANG_PUSH([C])
4302     save_CFLAGS=$CFLAGS
4303     CFLAGS="$CFLAGS --ccache-skip -O2"
4304     dnl an empty program will do, we're checking the compiler flags
4305     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
4306                       [use_ccache=yes], [use_ccache=no])
4307     CFLAGS=$save_CFLAGS
4308     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
4309         AC_MSG_RESULT([yes])
4310     else
4311         CC="$CCACHE $CC"
4312         CC_BASE="ccache $CC_BASE"
4313         AC_MSG_RESULT([no])
4314     fi
4315     AC_LANG_POP([C])
4318 # ===================================================================
4319 # check various GCC options that Clang does not support now but maybe
4320 # will somewhen in the future, check them even for GCC, so that the
4321 # flags are set
4322 # ===================================================================
4324 HAVE_GCC_GGDB2=
4325 if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4326     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
4327     save_CFLAGS=$CFLAGS
4328     CFLAGS="$CFLAGS -Werror -ggdb2"
4329     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
4330     CFLAGS=$save_CFLAGS
4331     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
4332         AC_MSG_RESULT([yes])
4333     else
4334         AC_MSG_RESULT([no])
4335     fi
4337     if test "$host_cpu" = "m68k"; then
4338         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
4339         save_CFLAGS=$CFLAGS
4340         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
4341         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
4342         CFLAGS=$save_CFLAGS
4343         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
4344             AC_MSG_RESULT([yes])
4345         else
4346             AC_MSG_ERROR([no])
4347         fi
4348     fi
4350 AC_SUBST(HAVE_GCC_GGDB2)
4352 dnl ===================================================================
4353 dnl  Test the gcc version
4354 dnl ===================================================================
4355 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
4356     AC_MSG_CHECKING([the GCC version])
4357     _gcc_version=`$CC -dumpversion`
4358     gcc_full_version=$(printf '%s' "$_gcc_version" | \
4359         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
4360     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
4362     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
4364     if test "$gcc_full_version" -lt 70000; then
4365         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
4366     fi
4367 else
4368     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
4369     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
4370     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
4371     # (which reports itself as GCC 4.2.1).
4372     GCC_VERSION=
4374 AC_SUBST(GCC_VERSION)
4376 dnl Set the ENABLE_DBGUTIL variable
4377 dnl ===================================================================
4378 AC_MSG_CHECKING([whether to build with additional debug utilities])
4379 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
4380     ENABLE_DBGUTIL="TRUE"
4381     # this is an extra var so it can have different default on different MSVC
4382     # versions (in case there are version specific problems with it)
4383     MSVC_USE_DEBUG_RUNTIME="TRUE"
4385     AC_MSG_RESULT([yes])
4386     # cppunit and graphite expose STL in public headers
4387     if test "$with_system_cppunit" = "yes"; then
4388         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
4389     else
4390         with_system_cppunit=no
4391     fi
4392     if test "$with_system_graphite" = "yes"; then
4393         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
4394     else
4395         with_system_graphite=no
4396     fi
4397     if test "$with_system_orcus" = "yes"; then
4398         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
4399     else
4400         with_system_orcus=no
4401     fi
4402     if test "$with_system_libcmis" = "yes"; then
4403         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
4404     else
4405         with_system_libcmis=no
4406     fi
4407     if test "$with_system_hunspell" = "yes"; then
4408         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
4409     else
4410         with_system_hunspell=no
4411     fi
4412     if test "$with_system_gpgmepp" = "yes"; then
4413         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
4414     else
4415         with_system_gpgmepp=no
4416     fi
4417     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
4418     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
4419     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
4420     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
4421     # of those two is using the system variant:
4422     if test "$with_system_libnumbertext" = "yes"; then
4423         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
4424     else
4425         with_system_libnumbertext=no
4426     fi
4427     if test "$with_system_libwps" = "yes"; then
4428         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
4429     else
4430         with_system_libwps=no
4431     fi
4432 else
4433     ENABLE_DBGUTIL=""
4434     MSVC_USE_DEBUG_RUNTIME=""
4435     AC_MSG_RESULT([no])
4437 AC_SUBST(ENABLE_DBGUTIL)
4438 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
4440 dnl Set the ENABLE_DEBUG variable.
4441 dnl ===================================================================
4442 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
4443     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
4445 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
4446     if test -z "$libo_fuzzed_enable_debug"; then
4447         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
4448     else
4449         AC_MSG_NOTICE([Resetting --enable-debug=yes])
4450         enable_debug=yes
4451     fi
4454 AC_MSG_CHECKING([whether to do a debug build])
4455 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
4456     ENABLE_DEBUG="TRUE"
4457     if test -n "$ENABLE_DBGUTIL" ; then
4458         AC_MSG_RESULT([yes (dbgutil)])
4459     else
4460         AC_MSG_RESULT([yes])
4461     fi
4462 else
4463     ENABLE_DEBUG=""
4464     AC_MSG_RESULT([no])
4466 AC_SUBST(ENABLE_DEBUG)
4468 dnl ===================================================================
4469 dnl Select the linker to use (gold/lld/ld.bfd).
4470 dnl This is done only after compiler checks (need to know if Clang is
4471 dnl used, for different defaults) and after checking if a debug build
4472 dnl is wanted (non-debug builds get the default linker if not explicitly
4473 dnl specified otherwise).
4474 dnl All checks for linker features/options should come after this.
4475 dnl ===================================================================
4476 check_use_ld()
4478     use_ld=-fuse-ld=${1%%:*}
4479     use_ld_path=${1#*:}
4480     if test "$use_ld_path" != "$1"; then
4481         use_ld="$use_ld --ld-path=$use_ld_path"
4482     fi
4483     use_ld_fail_if_error=$2
4484     use_ld_ok=
4485     AC_MSG_CHECKING([for $use_ld linker support])
4486     use_ld_ldflags_save="$LDFLAGS"
4487     LDFLAGS="$LDFLAGS $use_ld"
4488     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4489 #include <stdio.h>
4490         ],[
4491 printf ("hello world\n");
4492         ])], USE_LD=$use_ld, [])
4493     if test -n "$USE_LD"; then
4494         AC_MSG_RESULT( yes )
4495         use_ld_ok=yes
4496     else
4497         if test -n "$use_ld_fail_if_error"; then
4498             AC_MSG_ERROR( no )
4499         else
4500             AC_MSG_RESULT( no )
4501         fi
4502     fi
4503     if test -n "$use_ld_ok"; then
4504         dnl keep the value of LDFLAGS
4505         return 0
4506     fi
4507     LDFLAGS="$use_ld_ldflags_save"
4508     return 1
4510 USE_LD=
4511 if test "$enable_ld" != "no"; then
4512     if test "$GCC" = "yes"; then
4513         if test -n "$enable_ld"; then
4514             check_use_ld "$enable_ld" fail_if_error
4515         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4516             dnl non-debug builds default to the default linker
4517             true
4518         elif test -n "$COM_IS_CLANG"; then
4519             check_use_ld lld
4520             if test $? -ne 0; then
4521                 check_use_ld gold
4522             fi
4523         else
4524             # For gcc first try gold, new versions also support lld.
4525             check_use_ld gold
4526             if test $? -ne 0; then
4527                 check_use_ld lld
4528             fi
4529         fi
4530         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4531         rm conftest.out
4532         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4533         if test -z "$ld_used"; then
4534             ld_used="unknown"
4535         fi
4536         AC_MSG_CHECKING([for linker that is used])
4537         AC_MSG_RESULT([$ld_used])
4538         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4539             if echo "$ld_used" | grep -q "^GNU ld"; then
4540                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4541                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4542             fi
4543         fi
4544     else
4545         if test "$enable_ld" = "yes"; then
4546             AC_MSG_ERROR([--enable-ld not supported])
4547         fi
4548     fi
4550 AC_SUBST(USE_LD)
4552 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4553 if test "$GCC" = "yes" -a "$_os" != Emscripten ; then
4554     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4555     bsymbolic_functions_ldflags_save=$LDFLAGS
4556     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4557     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4558 #include <stdio.h>
4559         ],[
4560 printf ("hello world\n");
4561         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4562     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4563         AC_MSG_RESULT( found )
4564     else
4565         AC_MSG_RESULT( not found )
4566     fi
4567     LDFLAGS=$bsymbolic_functions_ldflags_save
4569 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4571 LD_GC_SECTIONS=
4572 if test "$GCC" = "yes"; then
4573     for flag in "--gc-sections" "-dead_strip"; do
4574         AC_MSG_CHECKING([for $flag linker support])
4575         ldflags_save=$LDFLAGS
4576         LDFLAGS="$LDFLAGS -Wl,$flag"
4577         AC_LINK_IFELSE([AC_LANG_PROGRAM([
4578 #include <stdio.h>
4579             ],[
4580 printf ("hello world\n");
4581             ])],[
4582             LD_GC_SECTIONS="-Wl,$flag"
4583             AC_MSG_RESULT( found )
4584             ], [
4585             AC_MSG_RESULT( not found )
4586             ])
4587         LDFLAGS=$ldflags_save
4588         if test -n "$LD_GC_SECTIONS"; then
4589             break
4590         fi
4591     done
4593 AC_SUBST(LD_GC_SECTIONS)
4595 HAVE_GSPLIT_DWARF=
4596 if test "$enable_split_debug" != no; then
4597     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4598     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4599         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4600         save_CFLAGS=$CFLAGS
4601         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4602         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4603         CFLAGS=$save_CFLAGS
4604         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4605             AC_MSG_RESULT([yes])
4606         else
4607             if test "$enable_split_debug" = yes; then
4608                 AC_MSG_ERROR([no])
4609             else
4610                 AC_MSG_RESULT([no])
4611             fi
4612         fi
4613     fi
4614     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4615         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4616         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4617     fi
4619 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4621 HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=
4622 AC_MSG_CHECKING([whether $CC_BASE supports -Xclang -debug-info-kind=constructor])
4623 save_CFLAGS=$CFLAGS
4624 CFLAGS="$CFLAGS -Werror -Xclang -debug-info-kind=constructor"
4625 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=TRUE ],[])
4626 CFLAGS=$save_CFLAGS
4627 if test "$HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR" = "TRUE"; then
4628     AC_MSG_RESULT([yes])
4629 else
4630     AC_MSG_RESULT([no])
4632 AC_SUBST(HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR)
4634 ENABLE_GDB_INDEX=
4635 if test "$enable_gdb_index" != "no"; then
4636     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4637     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4638         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4639         save_CFLAGS=$CFLAGS
4640         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4641         have_ggnu_pubnames=
4642         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4643         if test "$have_ggnu_pubnames" != "TRUE"; then
4644             if test "$enable_gdb_index" = "yes"; then
4645                 AC_MSG_ERROR([no, --enable-gdb-index not supported])
4646             else
4647                 AC_MSG_RESULT( no )
4648             fi
4649         else
4650             AC_MSG_RESULT( yes )
4651             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4652             ldflags_save=$LDFLAGS
4653             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4654             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4655 #include <stdio.h>
4656                 ],[
4657 printf ("hello world\n");
4658                 ])], ENABLE_GDB_INDEX=TRUE, [])
4659             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4660                 AC_MSG_RESULT( yes )
4661             else
4662                 if test "$enable_gdb_index" = "yes"; then
4663                     AC_MSG_ERROR( no )
4664                 else
4665                     AC_MSG_RESULT( no )
4666                 fi
4667             fi
4668             LDFLAGS=$ldflags_save
4669         fi
4670         CFLAGS=$save_CFLAGS
4671         fi
4672     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4673         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4674         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4675     fi
4677 AC_SUBST(ENABLE_GDB_INDEX)
4679 if test -z "$enable_sal_log" && test "$ENABLE_DEBUG" = TRUE; then
4680     enable_sal_log=yes
4682 if test "$enable_sal_log" = yes; then
4683     ENABLE_SAL_LOG=TRUE
4685 AC_SUBST(ENABLE_SAL_LOG)
4687 dnl Check for enable symbols option
4688 dnl ===================================================================
4689 AC_MSG_CHECKING([whether to generate debug information])
4690 if test -z "$enable_symbols"; then
4691     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4692         enable_symbols=yes
4693     else
4694         enable_symbols=no
4695     fi
4697 if test "$enable_symbols" = yes; then
4698     ENABLE_SYMBOLS_FOR=all
4699     AC_MSG_RESULT([yes])
4700 elif test "$enable_symbols" = no; then
4701     ENABLE_SYMBOLS_FOR=
4702     AC_MSG_RESULT([no])
4703 else
4704     # Selective debuginfo.
4705     ENABLE_SYMBOLS_FOR="$enable_symbols"
4706     AC_MSG_RESULT([for "$enable_symbols"])
4708 AC_SUBST(ENABLE_SYMBOLS_FOR)
4710 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4711     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4712     AC_MSG_CHECKING([whether enough memory is available for linking])
4713     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4714     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4715     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4716         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4717     else
4718         AC_MSG_RESULT([yes])
4719     fi
4722 ENABLE_OPTIMIZED=
4723 ENABLE_OPTIMIZED_DEBUG=
4724 AC_MSG_CHECKING([whether to compile with optimization flags])
4725 if test -z "$enable_optimized"; then
4726     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4727         enable_optimized=no
4728     else
4729         enable_optimized=yes
4730     fi
4732 if test "$enable_optimized" = yes; then
4733     ENABLE_OPTIMIZED=TRUE
4734     AC_MSG_RESULT([yes])
4735 elif test "$enable_optimized" = debug; then
4736     ENABLE_OPTIMIZED_DEBUG=TRUE
4737     AC_MSG_RESULT([yes (debug)])
4738     HAVE_GCC_OG=
4739     if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4740         AC_MSG_CHECKING([whether $CC_BASE supports -Og])
4741         save_CFLAGS=$CFLAGS
4742         CFLAGS="$CFLAGS -Werror -Og"
4743         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[])
4744         CFLAGS=$save_CFLAGS
4745         if test "$HAVE_GCC_OG" = "TRUE"; then
4746             AC_MSG_RESULT([yes])
4747         else
4748             AC_MSG_RESULT([no])
4749         fi
4750     fi
4751     if test -z "$HAVE_GCC_OG" -a "$_os" != "Emscripten"; then
4752         AC_MSG_ERROR([The compiler does not support optimizations suitable for debugging.])
4753     fi
4754 else
4755     AC_MSG_RESULT([no])
4757 AC_SUBST(ENABLE_OPTIMIZED)
4758 AC_SUBST(ENABLE_OPTIMIZED_DEBUG)
4761 # determine CPUNAME, OS, ...
4763 case "$host_os" in
4765 aix*)
4766     COM=GCC
4767     CPUNAME=POWERPC
4768     OS=AIX
4769     RTL_OS=AIX
4770     RTL_ARCH=PowerPC
4771     PLATFORMID=aix_powerpc
4772     P_SEP=:
4773     ;;
4775 cygwin*|wsl*)
4776     # Already handled
4777     ;;
4779 darwin*|macos*)
4780     COM=GCC
4781     OS=MACOSX
4782     RTL_OS=MacOSX
4783     P_SEP=:
4785     case "$host_cpu" in
4786     aarch64|arm64)
4787         if test "$enable_ios_simulator" = "yes"; then
4788             OS=iOS
4789         else
4790             CPUNAME=AARCH64
4791             RTL_ARCH=AARCH64
4792             PLATFORMID=macosx_aarch64
4793         fi
4794         ;;
4795     x86_64)
4796         if test "$enable_ios_simulator" = "yes"; then
4797             OS=iOS
4798         fi
4799         CPUNAME=X86_64
4800         RTL_ARCH=X86_64
4801         PLATFORMID=macosx_x86_64
4802         ;;
4803     *)
4804         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4805         ;;
4806     esac
4807     ;;
4809 ios*)
4810     COM=GCC
4811     OS=iOS
4812     RTL_OS=iOS
4813     P_SEP=:
4815     case "$host_cpu" in
4816     aarch64|arm64)
4817         if test "$enable_ios_simulator" = "yes"; then
4818             AC_MSG_ERROR([iOS simulator is only available in macOS not iOS])
4819         fi
4820         ;;
4821     *)
4822         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4823         ;;
4824     esac
4825     CPUNAME=AARCH64
4826     RTL_ARCH=AARCH64
4827     PLATFORMID=ios_arm64
4828     ;;
4830 dragonfly*)
4831     COM=GCC
4832     OS=DRAGONFLY
4833     RTL_OS=DragonFly
4834     P_SEP=:
4836     case "$host_cpu" in
4837     i*86)
4838         CPUNAME=INTEL
4839         RTL_ARCH=x86
4840         PLATFORMID=dragonfly_x86
4841         ;;
4842     x86_64)
4843         CPUNAME=X86_64
4844         RTL_ARCH=X86_64
4845         PLATFORMID=dragonfly_x86_64
4846         ;;
4847     *)
4848         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4849         ;;
4850     esac
4851     ;;
4853 freebsd*)
4854     COM=GCC
4855     RTL_OS=FreeBSD
4856     OS=FREEBSD
4857     P_SEP=:
4859     case "$host_cpu" in
4860     aarch64)
4861         CPUNAME=AARCH64
4862         PLATFORMID=freebsd_aarch64
4863         RTL_ARCH=AARCH64
4864         ;;
4865     i*86)
4866         CPUNAME=INTEL
4867         RTL_ARCH=x86
4868         PLATFORMID=freebsd_x86
4869         ;;
4870     x86_64|amd64)
4871         CPUNAME=X86_64
4872         RTL_ARCH=X86_64
4873         PLATFORMID=freebsd_x86_64
4874         ;;
4875     powerpc64)
4876         CPUNAME=POWERPC64
4877         RTL_ARCH=PowerPC_64
4878         PLATFORMID=freebsd_powerpc64
4879         ;;
4880     powerpc|powerpcspe)
4881         CPUNAME=POWERPC
4882         RTL_ARCH=PowerPC
4883         PLATFORMID=freebsd_powerpc
4884         ;;
4885     *)
4886         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4887         ;;
4888     esac
4889     ;;
4891 haiku*)
4892     COM=GCC
4893     GUIBASE=haiku
4894     RTL_OS=Haiku
4895     OS=HAIKU
4896     P_SEP=:
4898     case "$host_cpu" in
4899     i*86)
4900         CPUNAME=INTEL
4901         RTL_ARCH=x86
4902         PLATFORMID=haiku_x86
4903         ;;
4904     x86_64|amd64)
4905         CPUNAME=X86_64
4906         RTL_ARCH=X86_64
4907         PLATFORMID=haiku_x86_64
4908         ;;
4909     *)
4910         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4911         ;;
4912     esac
4913     ;;
4915 kfreebsd*)
4916     COM=GCC
4917     OS=LINUX
4918     RTL_OS=kFreeBSD
4919     P_SEP=:
4921     case "$host_cpu" in
4923     i*86)
4924         CPUNAME=INTEL
4925         RTL_ARCH=x86
4926         PLATFORMID=kfreebsd_x86
4927         ;;
4928     x86_64)
4929         CPUNAME=X86_64
4930         RTL_ARCH=X86_64
4931         PLATFORMID=kfreebsd_x86_64
4932         ;;
4933     *)
4934         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4935         ;;
4936     esac
4937     ;;
4939 linux-gnu*)
4940     COM=GCC
4941     OS=LINUX
4942     RTL_OS=Linux
4943     P_SEP=:
4945     case "$host_cpu" in
4947     aarch64)
4948         CPUNAME=AARCH64
4949         PLATFORMID=linux_aarch64
4950         RTL_ARCH=AARCH64
4951         EPM_FLAGS="-a arm64"
4952         ;;
4953     alpha)
4954         CPUNAME=AXP
4955         RTL_ARCH=ALPHA
4956         PLATFORMID=linux_alpha
4957         ;;
4958     arm*)
4959         CPUNAME=ARM
4960         EPM_FLAGS="-a arm"
4961         RTL_ARCH=ARM_EABI
4962         PLATFORMID=linux_arm_eabi
4963         case "$host_cpu" in
4964         arm*-linux)
4965             RTL_ARCH=ARM_OABI
4966             PLATFORMID=linux_arm_oabi
4967             ;;
4968         esac
4969         ;;
4970     hppa)
4971         CPUNAME=HPPA
4972         RTL_ARCH=HPPA
4973         EPM_FLAGS="-a hppa"
4974         PLATFORMID=linux_hppa
4975         ;;
4976     i*86)
4977         CPUNAME=INTEL
4978         RTL_ARCH=x86
4979         PLATFORMID=linux_x86
4980         ;;
4981     ia64)
4982         CPUNAME=IA64
4983         RTL_ARCH=IA64
4984         PLATFORMID=linux_ia64
4985         ;;
4986     mips)
4987         CPUNAME=GODSON
4988         RTL_ARCH=MIPS_EB
4989         EPM_FLAGS="-a mips"
4990         PLATFORMID=linux_mips_eb
4991         ;;
4992     mips64)
4993         CPUNAME=GODSON64
4994         RTL_ARCH=MIPS64_EB
4995         EPM_FLAGS="-a mips64"
4996         PLATFORMID=linux_mips64_eb
4997         ;;
4998     mips64el)
4999         CPUNAME=GODSON64
5000         RTL_ARCH=MIPS64_EL
5001         EPM_FLAGS="-a mips64el"
5002         PLATFORMID=linux_mips64_el
5003         ;;
5004     mipsel)
5005         CPUNAME=GODSON
5006         RTL_ARCH=MIPS_EL
5007         EPM_FLAGS="-a mipsel"
5008         PLATFORMID=linux_mips_el
5009         ;;
5010     m68k)
5011         CPUNAME=M68K
5012         RTL_ARCH=M68K
5013         PLATFORMID=linux_m68k
5014         ;;
5015     powerpc)
5016         CPUNAME=POWERPC
5017         RTL_ARCH=PowerPC
5018         PLATFORMID=linux_powerpc
5019         ;;
5020     powerpc64)
5021         CPUNAME=POWERPC64
5022         RTL_ARCH=PowerPC_64
5023         PLATFORMID=linux_powerpc64
5024         ;;
5025     powerpc64le)
5026         CPUNAME=POWERPC64
5027         RTL_ARCH=PowerPC_64_LE
5028         PLATFORMID=linux_powerpc64_le
5029         ;;
5030     sparc)
5031         CPUNAME=SPARC
5032         RTL_ARCH=SPARC
5033         PLATFORMID=linux_sparc
5034         ;;
5035     sparc64)
5036         CPUNAME=SPARC64
5037         RTL_ARCH=SPARC64
5038         PLATFORMID=linux_sparc64
5039         ;;
5040     s390)
5041         CPUNAME=S390
5042         RTL_ARCH=S390
5043         PLATFORMID=linux_s390
5044         ;;
5045     s390x)
5046         CPUNAME=S390X
5047         RTL_ARCH=S390x
5048         PLATFORMID=linux_s390x
5049         ;;
5050     x86_64)
5051         CPUNAME=X86_64
5052         RTL_ARCH=X86_64
5053         PLATFORMID=linux_x86_64
5054         ;;
5055     *)
5056         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5057         ;;
5058     esac
5059     ;;
5061 linux-android*)
5062     COM=GCC
5063     OS=ANDROID
5064     RTL_OS=Android
5065     P_SEP=:
5067     case "$host_cpu" in
5069     arm|armel)
5070         CPUNAME=ARM
5071         RTL_ARCH=ARM_EABI
5072         PLATFORMID=android_arm_eabi
5073         ;;
5074     aarch64)
5075         CPUNAME=AARCH64
5076         RTL_ARCH=AARCH64
5077         PLATFORMID=android_aarch64
5078         ;;
5079     i*86)
5080         CPUNAME=INTEL
5081         RTL_ARCH=x86
5082         PLATFORMID=android_x86
5083         ;;
5084     x86_64)
5085         CPUNAME=X86_64
5086         RTL_ARCH=X86_64
5087         PLATFORMID=android_x86_64
5088         ;;
5089     *)
5090         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5091         ;;
5092     esac
5093     ;;
5095 *netbsd*)
5096     COM=GCC
5097     OS=NETBSD
5098     RTL_OS=NetBSD
5099     P_SEP=:
5101     case "$host_cpu" in
5102     i*86)
5103         CPUNAME=INTEL
5104         RTL_ARCH=x86
5105         PLATFORMID=netbsd_x86
5106         ;;
5107     powerpc)
5108         CPUNAME=POWERPC
5109         RTL_ARCH=PowerPC
5110         PLATFORMID=netbsd_powerpc
5111         ;;
5112     sparc)
5113         CPUNAME=SPARC
5114         RTL_ARCH=SPARC
5115         PLATFORMID=netbsd_sparc
5116         ;;
5117     x86_64)
5118         CPUNAME=X86_64
5119         RTL_ARCH=X86_64
5120         PLATFORMID=netbsd_x86_64
5121         ;;
5122     *)
5123         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5124         ;;
5125     esac
5126     ;;
5128 openbsd*)
5129     COM=GCC
5130     OS=OPENBSD
5131     RTL_OS=OpenBSD
5132     P_SEP=:
5134     case "$host_cpu" in
5135     i*86)
5136         CPUNAME=INTEL
5137         RTL_ARCH=x86
5138         PLATFORMID=openbsd_x86
5139         ;;
5140     x86_64)
5141         CPUNAME=X86_64
5142         RTL_ARCH=X86_64
5143         PLATFORMID=openbsd_x86_64
5144         ;;
5145     *)
5146         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5147         ;;
5148     esac
5149     SOLARINC="$SOLARINC -I/usr/local/include"
5150     ;;
5152 solaris*)
5153     COM=GCC
5154     OS=SOLARIS
5155     RTL_OS=Solaris
5156     P_SEP=:
5158     case "$host_cpu" in
5159     i*86)
5160         CPUNAME=INTEL
5161         RTL_ARCH=x86
5162         PLATFORMID=solaris_x86
5163         ;;
5164     sparc)
5165         CPUNAME=SPARC
5166         RTL_ARCH=SPARC
5167         PLATFORMID=solaris_sparc
5168         ;;
5169     sparc64)
5170         CPUNAME=SPARC64
5171         RTL_ARCH=SPARC64
5172         PLATFORMID=solaris_sparc64
5173         ;;
5174     *)
5175         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5176         ;;
5177     esac
5178     SOLARINC="$SOLARINC -I/usr/local/include"
5179     ;;
5181 emscripten*)
5182     COM=GCC
5183     OS=EMSCRIPTEN
5184     RTL_OS=Emscripten
5185     P_SEP=:
5187     case "$host_cpu" in
5188     wasm32|wasm64)
5189         ;;
5190     *)
5191         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5192         ;;
5193     esac
5194     CPUNAME=INTEL
5195     RTL_ARCH=x86
5196     PLATFORMID=linux_x86
5197     ;;
5200     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
5201     ;;
5202 esac
5204 if test "$with_x" = "no"; then
5205     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
5208 DISABLE_GUI=""
5209 if test "$enable_gui" = "no"; then
5210     if test "$using_x11" != yes; then
5211         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
5212     fi
5213     USING_X11=
5214     DISABLE_GUI=TRUE
5215 else
5216     AC_DEFINE(HAVE_FEATURE_UI)
5218 AC_SUBST(DISABLE_GUI)
5220 if test "$using_x11" = yes; then
5221     if test "$USING_X11" = TRUE; then
5222         AC_DEFINE(USING_X11)
5223     else
5224         disable_x11_tests
5225     fi
5226 else
5227     if test "$USING_X11" = TRUE; then
5228         AC_MSG_ERROR([Platform doesn't support X11 (\$using_x11), but \$USING_X11 is set!])
5229     fi
5232 WORKDIR="${BUILDDIR}/workdir"
5233 INSTDIR="${BUILDDIR}/instdir"
5234 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
5235 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
5236 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
5237 AC_SUBST(COM)
5238 AC_SUBST(CPUNAME)
5239 AC_SUBST(RTL_OS)
5240 AC_SUBST(RTL_ARCH)
5241 AC_SUBST(EPM_FLAGS)
5242 AC_SUBST(USING_X11)
5243 AC_SUBST([INSTDIR])
5244 AC_SUBST([INSTROOT])
5245 AC_SUBST([INSTROOTBASE])
5246 AC_SUBST(OS)
5247 AC_SUBST(P_SEP)
5248 AC_SUBST(WORKDIR)
5249 AC_SUBST(PLATFORMID)
5250 AC_SUBST(WINDOWS_X64)
5251 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
5253 if test "$OS" = WNT -a "$COM" = MSC; then
5254     case "$CPUNAME" in
5255     INTEL) CPPU_ENV=msci ;;
5256     X86_64) CPPU_ENV=mscx ;;
5257     AARCH64) CPPU_ENV=msca ;;
5258     *)
5259         AC_MSG_ERROR([Unknown \$CPUNAME '$CPUNAME' for $OS / $COM"])
5260         ;;
5261     esac
5262 else
5263     CPPU_ENV=gcc3
5265 AC_SUBST(CPPU_ENV)
5267 dnl ===================================================================
5268 dnl Test which package format to use
5269 dnl ===================================================================
5270 AC_MSG_CHECKING([which package format to use])
5271 if test -n "$with_package_format" -a "$with_package_format" != no; then
5272     for i in $with_package_format; do
5273         case "$i" in
5274         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
5275             ;;
5276         *)
5277             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
5278 aix - AIX software distribution
5279 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
5280 deb - Debian software distribution
5281 pkg - Solaris software distribution
5282 rpm - RedHat software distribution
5284 LibreOffice additionally supports:
5285 archive - .tar.gz or .zip
5286 dmg - macOS .dmg
5287 installed - installation tree
5288 msi - Windows .msi
5289         ])
5290             ;;
5291         esac
5292     done
5293     # fakeroot is needed to ensure correct file ownerships/permissions
5294     # inside deb packages and tar archives created on Linux and Solaris.
5295     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
5296         AC_PATH_PROG(FAKEROOT, fakeroot, no)
5297         if test "$FAKEROOT" = "no"; then
5298             AC_MSG_ERROR(
5299                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
5300         fi
5301     fi
5302     PKGFORMAT="$with_package_format"
5303     AC_MSG_RESULT([$PKGFORMAT])
5304 else
5305     PKGFORMAT=
5306     AC_MSG_RESULT([none])
5308 AC_SUBST(PKGFORMAT)
5310 dnl ===================================================================
5311 dnl handle help related options
5313 dnl If you change help related options, please update README.help
5314 dnl ===================================================================
5316 ENABLE_HTMLHELP=
5317 HELP_OMINDEX_PAGE=
5318 HELP_ONLINE=
5319 WITH_HELPPACKS=
5321 AC_MSG_CHECKING([which help to build])
5322 if test -n "$with_help" -a "$with_help" != "no"; then
5323     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5324     BUILD_TYPE="$BUILD_TYPE HELP"
5325     case "$with_help" in
5326     "html")
5327         ENABLE_HTMLHELP=TRUE
5328         WITH_HELPPACKS=TRUE
5329         SCPDEFS="$SCPDEFS -DWITH_HELPPACKS"
5330         AC_MSG_RESULT([HTML (local)])
5331         ;;
5332     "online")
5333         ENABLE_HTMLHELP=TRUE
5334         HELP_ONLINE=TRUE
5335         AC_MSG_RESULT([HTML (online)])
5336         ;;
5337     yes)
5338         WITH_HELPPACKS=TRUE
5339         SCPDEFS="$SCPDEFS -DWITH_HELPPACKS"
5340         AC_MSG_RESULT([XML (local)])
5341         ;;
5342     *)
5343         AC_MSG_ERROR([Unknown --with-help=$with_help])
5344         ;;
5345     esac
5346 else
5347     AC_MSG_RESULT([no])
5350 AC_MSG_CHECKING([if we need to build the help index tooling])
5351 if test "$with_help" = yes -o "$enable_extension_integration" != no; then
5352     BUILD_TYPE="$BUILD_TYPE HELPTOOLS"
5353     AC_MSG_RESULT([yes])
5354 else
5355     AC_MSG_RESULT([no])
5358 AC_MSG_CHECKING([whether to enable xapian-omega support for online help])
5359 if test -n "$with_omindex" -a "$with_omindex" != "no"; then
5360     if test "$HELP_ONLINE" != TRUE; then
5361         AC_MSG_ERROR([Can't build xapian-omega index without --help=online])
5362     fi
5363     case "$with_omindex" in
5364     "server")
5365         HELP_OMINDEX_PAGE=TRUE
5366         AC_MSG_RESULT([SERVER])
5367         ;;
5368     "noxap")
5369         AC_MSG_RESULT([NOXAP])
5370         ;;
5371     *)
5372         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5373         ;;
5374     esac
5375 else
5376     AC_MSG_RESULT([no])
5379 AC_MSG_CHECKING([whether to include the XML-help support])
5380 if test "$enable_xmlhelp" = yes; then
5381     BUILD_TYPE="$BUILD_TYPE XMLHELP"
5382     AC_DEFINE(HAVE_FEATURE_XMLHELP)
5383     AC_MSG_RESULT([yes])
5384 else
5385     if test "$with_help" = yes; then
5386         add_warning "Building the XML help, but LO with disabled xmlhelp support. Generated help can't be accessed from this LO build!"
5387     fi
5388     AC_MSG_RESULT([no])
5391 dnl Test whether to integrate helppacks into the product's installer
5392 AC_MSG_CHECKING([for helppack integration])
5393 if test -z "$WITH_HELPPACKS" -o "$with_helppack_integration" = no; then
5394     AC_MSG_RESULT([no integration])
5395 else
5396     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
5397     AC_MSG_RESULT([integration])
5400 AC_SUBST([ENABLE_HTMLHELP])
5401 AC_SUBST([HELP_OMINDEX_PAGE])
5402 AC_SUBST([HELP_ONLINE])
5403 # WITH_HELPPACKS is used only in configure
5405 dnl ===================================================================
5406 dnl Set up a different compiler to produce tools to run on the build
5407 dnl machine when doing cross-compilation
5408 dnl ===================================================================
5410 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
5411 m4_pattern_allow([PKG_CONFIG_LIBDIR])
5412 if test "$cross_compiling" = "yes"; then
5413     AC_MSG_CHECKING([for BUILD platform configuration])
5414     echo
5415     rm -rf CONF-FOR-BUILD config_build.mk
5416     mkdir CONF-FOR-BUILD
5417     # Here must be listed all files needed when running the configure script. In particular, also
5418     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
5419     # keep them in the same order as there.
5420     (cd $SRC_ROOT && tar cf - \
5421         config.guess \
5422         bin/get_config_variables \
5423         solenv/bin/getcompver.awk \
5424         solenv/inc/langlist.mk \
5425         download.lst \
5426         config_host.mk.in \
5427         config_host_lang.mk.in \
5428         Makefile.in \
5429         bin/bffvalidator.sh.in \
5430         bin/odfvalidator.sh.in \
5431         bin/officeotron.sh.in \
5432         hardened_runtime.xcent.in \
5433         instsetoo_native/util/openoffice.lst.in \
5434         config_host/*.in \
5435         sysui/desktop/macosx/Info.plist.in \
5436         .vscode/vs-code-template.code-workspace.in \
5437         ) \
5438     | (cd CONF-FOR-BUILD && tar xf -)
5439     cp configure CONF-FOR-BUILD
5440     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
5441     (
5442     unset COM USING_X11 OS CPUNAME
5443     unset CC CXX SYSBASE CFLAGS
5444     unset AR LD NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
5445     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
5446     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
5447     unset PKG_CONFIG_LIBDIR PKG_CONFIG_PATH
5448     if test -n "$CC_FOR_BUILD"; then
5449         export CC="$CC_FOR_BUILD"
5450         CC_BASE=`first_arg_basename "$CC"`
5451     fi
5452     if test -n "$CXX_FOR_BUILD"; then
5453         export CXX="$CXX_FOR_BUILD"
5454         CXX_BASE=`first_arg_basename "$CXX"`
5455     fi
5456     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
5457     cd CONF-FOR-BUILD
5459     # Handle host configuration, which affects the cross-toolset too
5460     sub_conf_opts=""
5461     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
5462     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
5463     test "$with_junit" = "no" && sub_conf_opts="$sub_conf_opts --without-junit"
5464     if test -n "$ENABLE_JAVA"; then
5465         case "$_os" in
5466         iOS) sub_conf_opts="$sub_conf_opts --without-java" ;; # force it off, like it used to be
5467         Android)
5468             # Hack for Android - the build doesn't need a host JDK, so just forward to build for convenience
5469             test -n "$with_jdk_home" && sub_conf_opts="$sub_conf_opts --with-jdk-home=$with_jdk_home"
5470             ;;
5471         *)
5472             if test -z "$with_jdk_home"; then
5473                 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.])
5474             fi
5475             ;;
5476         esac
5477     else
5478         sub_conf_opts="$sub_conf_opts --without-java"
5479     fi
5480     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
5481     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
5482     test "$with_galleries" = "no" -o -z "$WITH_GALLERY_BUILD" && sub_conf_opts="$sub_conf_opts --with-galleries=no --disable-database-connectivity"
5483     test -n "$with_help" -a "$with_help" != "no" && sub_conf_opts="$sub_conf_opts --with-help=$with_help"
5484     test "$enable_extensions" = yes || sub_conf_opts="$sub_conf_opts --disable-extensions"
5485     test "$enable_wasm_strip" = "yes" && sub_conf_opts="$sub_conf_opts --enable-wasm-strip"
5486     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
5488     # Don't bother having configure look for stuff not needed for the build platform anyway
5489     ./configure \
5490         --build="$build_alias" \
5491         --disable-cairo-canvas \
5492         --disable-cups \
5493         --disable-firebird-sdbc \
5494         --disable-gpgmepp \
5495         --disable-gstreamer-1-0 \
5496         --disable-gtk3 \
5497         --disable-gtk4 \
5498         --disable-mariadb-sdbc \
5499         --disable-nss \
5500         --disable-online-update \
5501         --disable-opencl \
5502         --disable-pdfimport \
5503         --disable-postgresql-sdbc \
5504         --disable-skia \
5505         --enable-icecream="$enable_icecream" \
5506         --without-doxygen \
5507         --without-webdav \
5508         --with-parallelism="$with_parallelism" \
5509         --with-theme="$with_theme" \
5510         --with-tls=openssl \
5511         $sub_conf_opts \
5512         --srcdir=$srcdir \
5513         2>&1 | sed -e 's/^/    /'
5514     if test [${PIPESTATUS[0]}] -ne 0; then
5515         AC_MSG_ERROR([Running the configure script for BUILD side failed, see CONF-FOR-BUILD/config.log])
5516     fi
5518     # filter permitted build targets
5519     PERMITTED_BUILD_TARGETS="
5520         AVMEDIA
5521         BOOST
5522         CAIRO
5523         CLUCENE
5524         CURL
5525         DBCONNECTIVITY
5526         DESKTOP
5527         DYNLOADING
5528         EPOXY
5529         EXPAT
5530         GLM
5531         GRAPHITE
5532         HARFBUZZ
5533         HELPTOOLS
5534         ICU
5535         LCMS2
5536         LIBJPEG_TURBO
5537         LIBLANGTAG
5538         LibO
5539         LIBFFI
5540         LIBPN
5541         LIBXML2
5542         LIBXSLT
5543         MDDS
5544         NATIVE
5545         OPENSSL
5546         ORCUS
5547         PYTHON
5548         SCRIPTING
5549         ZLIB
5551     # converts BUILD_TYPE and PERMITTED_BUILD_TARGETS into non-whitespace,
5552     # newlined lists, to use grep as a filter
5553     PERMITTED_BUILD_TARGETS=$(echo "$PERMITTED_BUILD_TARGETS" | sed -e '/^ *$/d' -e 's/ *//')
5554     BUILD_TARGETS="$(sed -n -e '/^export BUILD_TYPE=/ s/.*=//p' config_host.mk | tr ' ' '\n')"
5555     BUILD_TARGETS="$(echo "$BUILD_TARGETS" | grep -F "$PERMITTED_BUILD_TARGETS" | tr '\n' ' ')"
5556     sed -i -e "s/ BUILD_TYPE=.*$/ BUILD_TYPE=$BUILD_TARGETS/" config_host.mk
5558     cp config_host.mk ../config_build.mk
5559     cp config_host_lang.mk ../config_build_lang.mk
5560     mv config.log ../config.Build.log
5561     mkdir -p ../config_build
5562     mv config_host/*.h ../config_build
5563     test -f "$WARNINGS_FILE" && mv "$WARNINGS_FILE" "../$WARNINGS_FILE_FOR_BUILD"
5565     # all these will get a _FOR_BUILD postfix
5566     DIRECT_FOR_BUILD_SETTINGS="
5567         CC
5568         CPPU_ENV
5569         CXX
5570         ILIB
5571         JAVA_HOME
5572         JAVAIFLAGS
5573         JDK
5574         LIBO_BIN_FOLDER
5575         LIBO_LIB_FOLDER
5576         LIBO_URE_LIB_FOLDER
5577         LIBO_URE_MISC_FOLDER
5578         OS
5579         SDKDIRNAME
5580         SYSTEM_LIBXML
5581         SYSTEM_LIBXSLT
5583     # these overwrite host config with build config
5584     OVERWRITING_SETTINGS="
5585         ANT
5586         ANT_HOME
5587         ANT_LIB
5588         HSQLDB_USE_JDBC_4_1
5589         JAVA_CLASSPATH_NOT_SET
5590         JAVA_SOURCE_VER
5591         JAVA_TARGET_VER
5592         JAVACFLAGS
5593         JAVACOMPILER
5594         JAVADOC
5595         JAVADOCISGJDOC
5597     # these need some special handling
5598     EXTRA_HANDLED_SETTINGS="
5599         INSTDIR
5600         INSTROOT
5601         PATH
5602         WORKDIR
5604     OLD_PATH=$PATH
5605     . ./bin/get_config_variables $DIRECT_FOR_BUILD_SETTINGS $OVERWRITING_SETTINGS $EXTRA_HANDLED_SETTINGS
5606     BUILD_PATH=$PATH
5607     PATH=$OLD_PATH
5609     line=`echo "LO_PATH_FOR_BUILD='${BUILD_PATH}'" | sed -e 's,/CONF-FOR-BUILD,,g'`
5610     echo "$line" >>build-config
5612     for V in $DIRECT_FOR_BUILD_SETTINGS; do
5613         VV='$'$V
5614         VV=`eval "echo $VV"`
5615         if test -n "$VV"; then
5616             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
5617             echo "$line" >>build-config
5618         fi
5619     done
5621     for V in $OVERWRITING_SETTINGS; do
5622         VV='$'$V
5623         VV=`eval "echo $VV"`
5624         if test -n "$VV"; then
5625             line=${V}='${'${V}:-$VV'}'
5626             echo "$line" >>build-config
5627         fi
5628     done
5630     for V in INSTDIR INSTROOT WORKDIR; do
5631         VV='$'$V
5632         VV=`eval "echo $VV"`
5633         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
5634         if test -n "$VV"; then
5635             line="${V}_FOR_BUILD='$VV'"
5636             echo "$line" >>build-config
5637         fi
5638     done
5640     )
5641     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([setup/configure for BUILD side failed, see CONF-FOR-BUILD/config.log])
5642     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])
5643     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
5644              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
5646     eval `cat CONF-FOR-BUILD/build-config`
5648     AC_MSG_RESULT([checking for BUILD platform configuration... done])
5650     rm -rf CONF-FOR-BUILD
5651 else
5652     OS_FOR_BUILD="$OS"
5653     CC_FOR_BUILD="$CC"
5654     CPPU_ENV_FOR_BUILD="$CPPU_ENV"
5655     CXX_FOR_BUILD="$CXX"
5656     INSTDIR_FOR_BUILD="$INSTDIR"
5657     INSTROOT_FOR_BUILD="$INSTROOT"
5658     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
5659     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
5660     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
5661     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
5662     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
5663     WORKDIR_FOR_BUILD="$WORKDIR"
5665 AC_SUBST(OS_FOR_BUILD)
5666 AC_SUBST(INSTDIR_FOR_BUILD)
5667 AC_SUBST(INSTROOT_FOR_BUILD)
5668 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
5669 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
5670 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
5671 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
5672 AC_SUBST(SDKDIRNAME_FOR_BUILD)
5673 AC_SUBST(WORKDIR_FOR_BUILD)
5674 AC_SUBST(CC_FOR_BUILD)
5675 AC_SUBST(CXX_FOR_BUILD)
5676 AC_SUBST(CPPU_ENV_FOR_BUILD)
5678 dnl ===================================================================
5679 dnl Check for syslog header
5680 dnl ===================================================================
5681 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
5683 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
5684 dnl ===================================================================
5685 AC_MSG_CHECKING([whether to turn warnings to errors])
5686 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
5687     ENABLE_WERROR="TRUE"
5688     PYTHONWARNINGS="error"
5689     AC_MSG_RESULT([yes])
5690 else
5691     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
5692         ENABLE_WERROR="TRUE"
5693         PYTHONWARNINGS="error"
5694         AC_MSG_RESULT([yes])
5695     else
5696         AC_MSG_RESULT([no])
5697     fi
5699 AC_SUBST(ENABLE_WERROR)
5700 AC_SUBST(PYTHONWARNINGS)
5702 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
5703 dnl ===================================================================
5704 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
5705 if test -z "$enable_assert_always_abort"; then
5706    if test "$ENABLE_DEBUG" = TRUE; then
5707        enable_assert_always_abort=yes
5708    else
5709        enable_assert_always_abort=no
5710    fi
5712 if test "$enable_assert_always_abort" = "yes"; then
5713     ASSERT_ALWAYS_ABORT="TRUE"
5714     AC_MSG_RESULT([yes])
5715 else
5716     ASSERT_ALWAYS_ABORT="FALSE"
5717     AC_MSG_RESULT([no])
5719 AC_SUBST(ASSERT_ALWAYS_ABORT)
5721 # Determine whether to use ooenv for the instdir installation
5722 # ===================================================================
5723 if test $_os != "WINNT" -a $_os != "Darwin"; then
5724     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
5725     if test -z "$enable_ooenv"; then
5726         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5727             enable_ooenv=yes
5728         else
5729             enable_ooenv=no
5730         fi
5731     fi
5732     if test "$enable_ooenv" = "no"; then
5733         AC_MSG_RESULT([no])
5734     else
5735         ENABLE_OOENV="TRUE"
5736         AC_MSG_RESULT([yes])
5737     fi
5739 AC_SUBST(ENABLE_OOENV)
5741 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
5742     if test "$enable_qt5" = "no"; then
5743         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
5744     else
5745         enable_qt5=yes
5746     fi
5749 dnl ===================================================================
5750 dnl check for cups support
5751 dnl ===================================================================
5753 AC_MSG_CHECKING([whether to enable CUPS support])
5754 if test "$test_cups" = yes -a "$enable_cups" != no; then
5755     ENABLE_CUPS=TRUE
5756     AC_MSG_RESULT([yes])
5758     AC_MSG_CHECKING([whether cups support is present])
5759     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
5760     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
5761     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
5762         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
5763     fi
5764 else
5765     AC_MSG_RESULT([no])
5768 AC_SUBST(ENABLE_CUPS)
5770 # fontconfig checks
5771 if test "$using_freetype_fontconfig" = yes; then
5772     AC_MSG_CHECKING([which fontconfig to use])
5774 if test "$using_freetype_fontconfig" = yes -a "$test_system_fontconfig" != no; then
5775     AC_MSG_RESULT([external])
5776     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
5777     SYSTEM_FONTCONFIG=TRUE
5778     FilterLibs "${FONTCONFIG_LIBS}"
5779     FONTCONFIG_LIBS="${filteredlibs}"
5780 elif test "$using_freetype_fontconfig" = yes; then
5781     AC_MSG_RESULT([internal])
5782     BUILD_TYPE="$BUILD_TYPE FONTCONFIG"
5784 AC_SUBST(FONTCONFIG_CFLAGS)
5785 AC_SUBST(FONTCONFIG_LIBS)
5786 AC_SUBST([SYSTEM_FONTCONFIG])
5788 dnl whether to find & fetch external tarballs?
5789 dnl ===================================================================
5790 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
5791    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5792        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
5793    else
5794        TARFILE_LOCATION="$LODE_HOME/ext_tar"
5795    fi
5797 if test -z "$TARFILE_LOCATION"; then
5798     if test -d "$SRC_ROOT/src" ; then
5799         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
5800         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
5801     fi
5802     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
5803 else
5804     AbsolutePath "$TARFILE_LOCATION"
5805     PathFormat "${absolute_path}"
5806     TARFILE_LOCATION="${formatted_path}"
5808 AC_SUBST(TARFILE_LOCATION)
5810 AC_MSG_CHECKING([whether we want to fetch tarballs])
5811 if test "$enable_fetch_external" != "no"; then
5812     if test "$with_all_tarballs" = "yes"; then
5813         AC_MSG_RESULT([yes, all of them])
5814         DO_FETCH_TARBALLS="ALL"
5815     else
5816         AC_MSG_RESULT([yes, if we use them])
5817         DO_FETCH_TARBALLS="TRUE"
5818     fi
5819 else
5820     AC_MSG_RESULT([no])
5821     DO_FETCH_TARBALLS=
5823 AC_SUBST(DO_FETCH_TARBALLS)
5825 dnl Test whether to include MySpell dictionaries
5826 dnl ===================================================================
5827 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5828 if test "$with_myspell_dicts" = "yes"; then
5829     AC_MSG_RESULT([yes])
5830     WITH_MYSPELL_DICTS=TRUE
5831     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5832     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5833 else
5834     AC_MSG_RESULT([no])
5835     WITH_MYSPELL_DICTS=
5837 AC_SUBST(WITH_MYSPELL_DICTS)
5839 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5840 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5841     if test "$with_system_dicts" = yes; then
5842         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5843     fi
5844     with_system_dicts=no
5847 AC_MSG_CHECKING([whether to use dicts from external paths])
5848 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5849     AC_MSG_RESULT([yes])
5850     SYSTEM_DICTS=TRUE
5851     AC_MSG_CHECKING([for spelling dictionary directory])
5852     if test -n "$with_external_dict_dir"; then
5853         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5854     else
5855         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5856         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5857             DICT_SYSTEM_DIR=file:///usr/share/myspell
5858         fi
5859     fi
5860     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5861     AC_MSG_CHECKING([for hyphenation patterns directory])
5862     if test -n "$with_external_hyph_dir"; then
5863         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5864     else
5865         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5866     fi
5867     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5868     AC_MSG_CHECKING([for thesaurus directory])
5869     if test -n "$with_external_thes_dir"; then
5870         THES_SYSTEM_DIR=file://$with_external_thes_dir
5871     else
5872         THES_SYSTEM_DIR=file:///usr/share/mythes
5873     fi
5874     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5875 else
5876     AC_MSG_RESULT([no])
5877     SYSTEM_DICTS=
5879 AC_SUBST(SYSTEM_DICTS)
5880 AC_SUBST(DICT_SYSTEM_DIR)
5881 AC_SUBST(HYPH_SYSTEM_DIR)
5882 AC_SUBST(THES_SYSTEM_DIR)
5884 dnl ===================================================================
5885 dnl Precompiled headers.
5886 ENABLE_PCH=""
5887 AC_MSG_CHECKING([whether to enable pch feature])
5888 if test -z "$enable_pch"; then
5889     if test "$_os" = "WINNT"; then
5890         # Enabled by default on Windows.
5891         enable_pch=yes
5892     else
5893         enable_pch=no
5894     fi
5896 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5897     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5899 if test "$enable_pch" = "system"; then
5900     ENABLE_PCH="1"
5901     AC_MSG_RESULT([yes (system headers)])
5902 elif test "$enable_pch" = "base"; then
5903     ENABLE_PCH="2"
5904     AC_MSG_RESULT([yes (system and base headers)])
5905 elif test "$enable_pch" = "normal"; then
5906     ENABLE_PCH="3"
5907     AC_MSG_RESULT([yes (normal)])
5908 elif test "$enable_pch" = "full"; then
5909     ENABLE_PCH="4"
5910     AC_MSG_RESULT([yes (full)])
5911 elif test "$enable_pch" = "yes"; then
5912     # Pick a suitable default.
5913     if test "$GCC" = "yes"; then
5914         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5915         # while making the PCHs larger and rebuilds more likely.
5916         ENABLE_PCH="2"
5917         AC_MSG_RESULT([yes (system and base headers)])
5918     else
5919         # With MSVC the highest level makes a significant difference,
5920         # and it was the default when there used to be no PCH levels.
5921         ENABLE_PCH="4"
5922         AC_MSG_RESULT([yes (full)])
5923     fi
5924 elif test "$enable_pch" = "no"; then
5925     AC_MSG_RESULT([no])
5926 else
5927     AC_MSG_ERROR([Unknown value for --enable-pch])
5929 AC_SUBST(ENABLE_PCH)
5930 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5931 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5932     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5933     if test "$CCACHE_BIN" != "not found"; then
5934         AC_MSG_CHECKING([ccache version])
5935         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5936         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5937         AC_MSG_RESULT([$CCACHE_VERSION])
5938         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5939         if test "$CCACHE_NUMVER" -gt "030701"; then
5940             AC_MSG_RESULT([yes])
5941         else
5942             AC_MSG_RESULT([no (not newer than 3.7.1)])
5943             CCACHE_DEPEND_MODE=
5944         fi
5945     fi
5948 PCH_INSTANTIATE_TEMPLATES=
5949 if test -n "$ENABLE_PCH"; then
5950     AC_MSG_CHECKING([whether $CC supports -fpch-instantiate-templates])
5951     save_CFLAGS=$CFLAGS
5952     CFLAGS="$CFLAGS -Werror -fpch-instantiate-templates"
5953     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_INSTANTIATE_TEMPLATES="-fpch-instantiate-templates" ],[])
5954     CFLAGS=$save_CFLAGS
5955     if test -n "$PCH_INSTANTIATE_TEMPLATES"; then
5956         AC_MSG_RESULT(yes)
5957     else
5958         AC_MSG_RESULT(no)
5959     fi
5961 AC_SUBST(PCH_INSTANTIATE_TEMPLATES)
5963 BUILDING_PCH_WITH_OBJ=
5964 if test -n "$ENABLE_PCH"; then
5965     AC_MSG_CHECKING([whether $CC supports -Xclang -building-pch-with-obj])
5966     save_CFLAGS=$CFLAGS
5967     CFLAGS="$CFLAGS -Werror -Xclang -building-pch-with-obj"
5968     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ BUILDING_PCH_WITH_OBJ="-Xclang -building-pch-with-obj" ],[])
5969     CFLAGS=$save_CFLAGS
5970     if test -n "$BUILDING_PCH_WITH_OBJ"; then
5971         AC_MSG_RESULT(yes)
5972     else
5973         AC_MSG_RESULT(no)
5974     fi
5976 AC_SUBST(BUILDING_PCH_WITH_OBJ)
5978 PCH_CODEGEN=
5979 PCH_NO_CODEGEN=
5980 if test -n "$BUILDING_PCH_WITH_OBJ"; then
5981     AC_MSG_CHECKING([whether $CC supports -fpch-codegen])
5982     save_CFLAGS=$CFLAGS
5983     CFLAGS="$CFLAGS -Werror -fpch-codegen"
5984     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
5985         [
5986         PCH_CODEGEN="-fpch-codegen"
5987         PCH_NO_CODEGEN="-fno-pch-codegen"
5988         ],[])
5989     CFLAGS=$save_CFLAGS
5990     if test -n "$PCH_CODEGEN"; then
5991         AC_MSG_RESULT(yes)
5992     else
5993         AC_MSG_RESULT(no)
5994     fi
5996 AC_SUBST(PCH_CODEGEN)
5997 AC_SUBST(PCH_NO_CODEGEN)
5998 PCH_DEBUGINFO=
5999 if test -n "$BUILDING_PCH_WITH_OBJ"; then
6000     AC_MSG_CHECKING([whether $CC supports -fpch-debuginfo])
6001     save_CFLAGS=$CFLAGS
6002     CFLAGS="$CFLAGS -Werror -fpch-debuginfo"
6003     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_DEBUGINFO="-fpch-debuginfo" ],[])
6004     CFLAGS=$save_CFLAGS
6005     if test -n "$PCH_DEBUGINFO"; then
6006         AC_MSG_RESULT(yes)
6007     else
6008         AC_MSG_RESULT(no)
6009     fi
6011 AC_SUBST(PCH_DEBUGINFO)
6013 TAB=`printf '\t'`
6015 AC_MSG_CHECKING([the GNU Make version])
6016 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
6017 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6018 if test "$_make_longver" -ge "038200"; then
6019     AC_MSG_RESULT([$GNUMAKE $_make_version])
6021 elif test "$_make_longver" -ge "038100"; then
6022     if test "$build_os" = "cygwin"; then
6023         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
6024     fi
6025     AC_MSG_RESULT([$GNUMAKE $_make_version])
6027     dnl ===================================================================
6028     dnl Search all the common names for sha1sum
6029     dnl ===================================================================
6030     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
6031     if test -z "$SHA1SUM"; then
6032         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
6033     elif test "$SHA1SUM" = "openssl"; then
6034         SHA1SUM="openssl sha1"
6035     fi
6036     AC_MSG_CHECKING([for GNU Make bug 20033])
6037     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
6038     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
6039 A := \$(wildcard *.a)
6041 .PHONY: all
6042 all: \$(A:.a=.b)
6043 <TAB>@echo survived bug20033.
6045 .PHONY: setup
6046 setup:
6047 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
6049 define d1
6050 @echo lala \$(1)
6051 @sleep 1
6052 endef
6054 define d2
6055 @echo tyty \$(1)
6056 @sleep 1
6057 endef
6059 %.b : %.a
6060 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
6061 <TAB>\$(call d1,\$(CHECKSUM)),\
6062 <TAB>\$(call d2,\$(CHECKSUM)))
6064     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
6065         no_parallelism_make="YES"
6066         AC_MSG_RESULT([yes, disable parallelism])
6067     else
6068         AC_MSG_RESULT([no, keep parallelism enabled])
6069     fi
6070     rm -rf $TESTGMAKEBUG20033
6071 else
6072     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
6075 # find if gnumake support file function
6076 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
6077 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
6078 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6079     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
6081 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
6082 \$(file >test.txt,Success )
6084 .PHONY: all
6085 all:
6086 <TAB>@cat test.txt
6089 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
6090 if test -f $TESTGMAKEFILEFUNC/test.txt; then
6091     HAVE_GNUMAKE_FILE_FUNC=TRUE
6092     AC_MSG_RESULT([yes])
6093 else
6094     AC_MSG_RESULT([no])
6096 rm -rf $TESTGMAKEFILEFUNC
6097 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
6098 AC_SUBST(GNUMAKE_WIN_NATIVE)
6100 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
6101 STALE_MAKE=
6102 if test "$_make_ver_check" = ""; then
6103    STALE_MAKE=TRUE
6106 HAVE_LD_HASH_STYLE=FALSE
6107 WITH_LINKER_HASH_STYLE=
6108 AC_MSG_CHECKING([for --hash-style gcc linker support])
6109 if test "$GCC" = "yes"; then
6110     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
6111         hash_styles="gnu sysv"
6112     elif test "$with_linker_hash_style" = "no"; then
6113         hash_styles=
6114     else
6115         hash_styles="$with_linker_hash_style"
6116     fi
6118     for hash_style in $hash_styles; do
6119         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
6120         hash_style_ldflags_save=$LDFLAGS
6121         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
6123         AC_RUN_IFELSE([AC_LANG_PROGRAM(
6124             [
6125 #include <stdio.h>
6126             ],[
6127 printf ("");
6128             ])],
6129             [
6130                   HAVE_LD_HASH_STYLE=TRUE
6131                   WITH_LINKER_HASH_STYLE=$hash_style
6132             ],
6133             [HAVE_LD_HASH_STYLE=FALSE],
6134             [HAVE_LD_HASH_STYLE=FALSE])
6135         LDFLAGS=$hash_style_ldflags_save
6136     done
6138     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
6139         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
6140     else
6141         AC_MSG_RESULT( no )
6142     fi
6143     LDFLAGS=$hash_style_ldflags_save
6144 else
6145     AC_MSG_RESULT( no )
6147 AC_SUBST(HAVE_LD_HASH_STYLE)
6148 AC_SUBST(WITH_LINKER_HASH_STYLE)
6150 dnl ===================================================================
6151 dnl Check whether there's a Perl version available.
6152 dnl ===================================================================
6153 if test -z "$with_perl_home"; then
6154     AC_PATH_PROG(PERL, perl)
6155 else
6156     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
6157     _perl_path="$with_perl_home/bin/perl"
6158     if test -x "$_perl_path"; then
6159         PERL=$_perl_path
6160     else
6161         AC_MSG_ERROR([$_perl_path not found])
6162     fi
6165 dnl ===================================================================
6166 dnl Testing for Perl version 5 or greater.
6167 dnl $] is the Perl version variable, it is returned as an integer
6168 dnl ===================================================================
6169 if test "$PERL"; then
6170     AC_MSG_CHECKING([the Perl version])
6171     ${PERL} -e "exit($]);"
6172     _perl_version=$?
6173     if test "$_perl_version" -lt 5; then
6174         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
6175     fi
6176     AC_MSG_RESULT([Perl $_perl_version])
6177 else
6178     AC_MSG_ERROR([Perl not found, install Perl 5])
6181 dnl ===================================================================
6182 dnl Testing for required Perl modules
6183 dnl ===================================================================
6185 AC_MSG_CHECKING([for required Perl modules])
6186 perl_use_string="use Cwd ; use Digest::MD5"
6187 if test "$_os" = "WINNT"; then
6188     if test -n "$PKGFORMAT"; then
6189         for i in $PKGFORMAT; do
6190             case "$i" in
6191             msi)
6192                 # for getting fonts versions to use in MSI
6193                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
6194                 ;;
6195             esac
6196         done
6197     fi
6199 if test "$with_system_hsqldb" = "yes"; then
6200     perl_use_string="$perl_use_string ; use Archive::Zip"
6202 if test "$enable_openssl" = "yes" -a "$with_system_openssl" != "yes"; then
6203     # OpenSSL needs that to build
6204     perl_use_string="$perl_use_string ; use FindBin"
6206 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
6207     AC_MSG_RESULT([all modules found])
6208 else
6209     AC_MSG_RESULT([failed to find some modules])
6210     # Find out which modules are missing.
6211     for i in $perl_use_string; do
6212         if test "$i" != "use" -a "$i" != ";"; then
6213             if ! $PERL -e "use $i;">/dev/null 2>&1; then
6214                 missing_perl_modules="$missing_perl_modules $i"
6215             fi
6216         fi
6217     done
6218     AC_MSG_ERROR([
6219     The missing Perl modules are: $missing_perl_modules
6220     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
6223 dnl ===================================================================
6224 dnl Check for pkg-config
6225 dnl ===================================================================
6226 if test "$_os" != "WINNT"; then
6227     PKG_PROG_PKG_CONFIG
6230 if test "$_os" != "WINNT"; then
6232     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
6233     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
6234     # explicitly. Or put /path/to/compiler in PATH yourself.
6236     # Use wrappers for LTO
6237     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
6238         AC_CHECK_TOOL(AR,gcc-ar)
6239         AC_CHECK_TOOL(NM,gcc-nm)
6240         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
6241     else
6242         AC_CHECK_TOOL(AR,ar)
6243         AC_CHECK_TOOL(NM,nm)
6244         AC_CHECK_TOOL(RANLIB,ranlib)
6245     fi
6246     AC_CHECK_TOOL(OBJDUMP,objdump)
6247     AC_CHECK_TOOL(READELF,readelf)
6248     AC_CHECK_TOOL(STRIP,strip)
6249     if test "$_os" = "WINNT"; then
6250         AC_CHECK_TOOL(DLLTOOL,dlltool)
6251         AC_CHECK_TOOL(WINDRES,windres)
6252     fi
6254 AC_SUBST(AR)
6255 AC_SUBST(DLLTOOL)
6256 AC_SUBST(LD)
6257 AC_SUBST(NM)
6258 AC_SUBST(OBJDUMP)
6259 AC_SUBST(PKG_CONFIG)
6260 AC_SUBST(PKG_CONFIG_PATH)
6261 AC_SUBST(PKG_CONFIG_LIBDIR)
6262 AC_SUBST(RANLIB)
6263 AC_SUBST(READELF)
6264 AC_SUBST(STRIP)
6265 AC_SUBST(WINDRES)
6267 dnl ===================================================================
6268 dnl pkg-config checks on macOS
6269 dnl ===================================================================
6271 if test $_os = Darwin; then
6272     AC_MSG_CHECKING([for bogus pkg-config])
6273     if test -n "$PKG_CONFIG"; then
6274         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
6275             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
6276         else
6277             if test "$enable_bogus_pkg_config" = "yes"; then
6278                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
6279             else
6280                 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.])
6281             fi
6282         fi
6283     else
6284         AC_MSG_RESULT([no, good])
6285     fi
6288 find_csc()
6290     # Return value: $csctest
6292     unset csctest
6294     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
6295     if test -n "$regvalue"; then
6296         csctest=$regvalue
6297         return
6298     fi
6301 find_al()
6303     # Return value: $altest
6305     unset altest
6307     # We need this check to detect 4.6.1 or above.
6308     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
6309         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
6310         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
6311             altest=$regvalue
6312             return
6313         fi
6314     done
6316     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
6317         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
6318         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
6319             altest=$regvalue
6320             return
6321         fi
6322     done
6325 find_dotnetsdk46()
6327     unset frametest
6329     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
6330         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
6331         if test -n "$regvalue"; then
6332             frametest=$regvalue
6333             return
6334         fi
6335     done
6338 find_winsdk_version()
6340     # Args: $1 : SDK version as in "8.0", "8.1A" etc
6341     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
6343     unset winsdktest winsdkbinsubdir winsdklibsubdir
6345     case "$1" in
6346     8.0|8.0A)
6347         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
6348         if test -n "$regvalue"; then
6349             winsdktest=$regvalue
6350             winsdklibsubdir=win8
6351             return
6352         fi
6353         ;;
6354     8.1|8.1A)
6355         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
6356         if test -n "$regvalue"; then
6357             winsdktest=$regvalue
6358             winsdklibsubdir=winv6.3
6359             return
6360         fi
6361         ;;
6362     10.0)
6363         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
6364         if test -n "$regvalue"; then
6365             winsdktest=$regvalue
6366             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
6367             if test -n "$regvalue"; then
6368                 winsdkbinsubdir="$regvalue".0
6369                 winsdklibsubdir=$winsdkbinsubdir
6370                 local tmppath="$winsdktest\\Include\\$winsdklibsubdir"
6371                 local tmppath_unix=$(cygpath -u "$tmppath")
6372                 # test exist the SDK path
6373                 if test -d "$tmppath_unix"; then
6374                    # when path is convertible to a short path then path is okay
6375                    cygpath -d "$tmppath" >/dev/null 2>&1
6376                    if test $? -ne 0; then
6377                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
6378                    fi
6379                 else
6380                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
6381                 fi
6382             fi
6383             return
6384         fi
6385         ;;
6386     esac
6389 find_winsdk()
6391     # Return value: From find_winsdk_version
6393     unset winsdktest
6395     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
6396         find_winsdk_version $ver
6397         if test -n "$winsdktest"; then
6398             return
6399         fi
6400     done
6403 find_msms()
6405     # Return value: $msmdir
6407     AC_MSG_CHECKING([for MSVC merge modules directory])
6408     local my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
6409     local my_msm_dir
6411     case "$VCVER" in
6412         160)
6413         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
6414         ;;
6415     esac
6416     for f in $my_msm_files; do
6417         echo "$as_me:$LINENO: searching for $f" >&5
6418     done
6420     msmdir=
6421     for ver in 14.0 15.0; do
6422         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
6423         if test -n "$regvalue"; then
6424             for f in ${my_msm_files}; do
6425                 if test -e "$regvalue/${f}"; then
6426                     msmdir=$regvalue
6427                     break
6428                 fi
6429             done
6430         fi
6431     done
6432     dnl Is the following fallback really necessary, or was it added in response
6433     dnl to never having started Visual Studio on a given machine, so the
6434     dnl registry keys checked above had presumably not yet been created?
6435     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
6436     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
6437     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
6438     dnl expanding to "C:\Program Files\Common Files"), which would need
6439     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
6440     dnl obtain its value from cygwin:
6441     if test -z "$msmdir"; then
6442         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
6443         for f in ${my_msm_files}; do
6444             if test -e "$my_msm_dir/${f}"; then
6445                 msmdir=$my_msm_dir
6446             fi
6447         done
6448     fi
6450     dnl Starting from MSVC 15.0, merge modules are located in different directory
6451     case "$VCVER" in
6452     160)
6453         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6454             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
6455             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
6456             for f in ${my_msm_files}; do
6457                 if test -e "$my_msm_dir/${f}"; then
6458                     msmdir=$my_msm_dir
6459                     break
6460                 fi
6461             done
6462         done
6463         ;;
6464     esac
6466     if test -n "$msmdir"; then
6467         msmdir=`cygpath -m "$msmdir"`
6468         AC_MSG_RESULT([$msmdir])
6469     else
6470         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
6471             AC_MSG_FAILURE([not found])
6472         else
6473             AC_MSG_WARN([not found (check config.log)])
6474             add_warning "MSM none of ${my_msm_files} found"
6475         fi
6476     fi
6479 find_msvc_x64_dlls()
6481     # Return value: $msvcdllpath, $msvcdlls
6483     AC_MSG_CHECKING([for MSVC x64 DLL path])
6484     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
6485     case "$VCVER" in
6486     160)
6487         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6488             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
6489             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
6490                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
6491                 break
6492             fi
6493             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
6494             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
6495                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
6496                 break
6497             fi
6498         done
6499         ;;
6500     esac
6501     AC_MSG_RESULT([$msvcdllpath])
6502     AC_MSG_CHECKING([for MSVC x64 DLLs])
6503     msvcdlls="msvcp140.dll vcruntime140.dll"
6504     for dll in $msvcdlls; do
6505         if ! test -f "$msvcdllpath/$dll"; then
6506             AC_MSG_FAILURE([missing $dll])
6507         fi
6508     done
6509     AC_MSG_RESULT([found all ($msvcdlls)])
6512 dnl =========================================
6513 dnl Check for the Windows  SDK.
6514 dnl =========================================
6515 if test "$_os" = "WINNT"; then
6516     AC_MSG_CHECKING([for Windows SDK])
6517     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6518         find_winsdk
6519         WINDOWS_SDK_HOME=$winsdktest
6521         # normalize if found
6522         if test -n "$WINDOWS_SDK_HOME"; then
6523             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
6524             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
6525         fi
6527         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
6528     fi
6530     if test -n "$WINDOWS_SDK_HOME"; then
6531         # Remove a possible trailing backslash
6532         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
6534         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
6535              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
6536              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
6537             have_windows_sdk_headers=yes
6538         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
6539              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
6540              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
6541             have_windows_sdk_headers=yes
6542         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
6543              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
6544              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
6545             have_windows_sdk_headers=yes
6546         else
6547             have_windows_sdk_headers=no
6548         fi
6550         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
6551             have_windows_sdk_libs=yes
6552         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/user32.lib"; then
6553             have_windows_sdk_libs=yes
6554         else
6555             have_windows_sdk_libs=no
6556         fi
6558         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
6559             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
6560 the  Windows SDK are installed.])
6561         fi
6562     fi
6564     if test -z "$WINDOWS_SDK_HOME"; then
6565         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
6566     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
6567         WINDOWS_SDK_VERSION=80
6568         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
6569     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
6570         WINDOWS_SDK_VERSION=81
6571         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
6572     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
6573         WINDOWS_SDK_VERSION=10
6574         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
6575     else
6576         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
6577     fi
6578     PathFormat "$WINDOWS_SDK_HOME"
6579     WINDOWS_SDK_HOME="$formatted_path"
6580     WINDOWS_SDK_HOME_unix="$formatted_path_unix"
6581     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6582         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
6583         if test -d "$WINDOWS_SDK_HOME/include/um"; then
6584             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
6585         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
6586             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
6587         fi
6588     fi
6590     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
6591     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
6592     dnl but not in v8.0), so allow this to be overridden with a
6593     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
6594     dnl and configuration error if no WiLangId.vbs is found would arguably be
6595     dnl better, but I do not know under which conditions exactly it is needed by
6596     dnl msiglobal.pm:
6597     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
6598         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
6599         WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6600         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6601             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WIN_BUILD_ARCH}/WiLangId.vbs"
6602             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6603         fi
6604         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6605             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WIN_BUILD_ARCH/WiLangId.vbs
6606             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6607         fi
6608         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6609             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WIN_BUILD_ARCH/WiLangId.vbs")
6610             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6611         fi
6612     fi
6613     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
6614         if test -n "$with_package_format" -a "$with_package_format" != no; then
6615             for i in "$with_package_format"; do
6616                 if test "$i" = "msi"; then
6617                     if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6618                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
6619                     fi
6620                 fi
6621             done
6622         fi
6623     fi
6625 AC_SUBST(WINDOWS_SDK_HOME)
6626 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
6627 AC_SUBST(WINDOWS_SDK_VERSION)
6628 AC_SUBST(WINDOWS_SDK_WILANGID)
6630 if test "$build_os" = "cygwin"; then
6631     dnl Check midl.exe; this being the first check for a tool in the SDK bin
6632     dnl dir, it also determines that dir's path w/o an arch segment if any,
6633     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
6634     AC_MSG_CHECKING([for midl.exe])
6636     find_winsdk
6637     if test -n "$winsdkbinsubdir" \
6638         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/midl.exe"
6639     then
6640         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH
6641         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
6642     elif test -f "$winsdktest/Bin/$WIN_BUILD_ARCH/midl.exe"; then
6643         MIDL_PATH=$winsdktest/Bin/$WIN_BUILD_ARCH
6644         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
6645     elif test -f "$winsdktest/Bin/midl.exe"; then
6646         MIDL_PATH=$winsdktest/Bin
6647         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
6648     fi
6649     if test ! -f "$MIDL_PATH/midl.exe"; then
6650         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WIN_BUILD_ARCH, Windows SDK installation broken?])
6651     else
6652         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
6653     fi
6655     # Convert to posix path with 8.3 filename restrictions ( No spaces )
6656     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
6658     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
6659          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
6660          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
6661          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
6662     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
6663          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
6664          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6665          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
6666     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
6667          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
6668          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6669          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
6670     else
6671         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
6672     fi
6674     dnl Check csc.exe
6675     AC_MSG_CHECKING([for csc.exe])
6676     find_csc
6677     if test -f "$csctest/csc.exe"; then
6678         CSC_PATH="$csctest"
6679     fi
6680     if test ! -f "$CSC_PATH/csc.exe"; then
6681         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
6682     else
6683         AC_MSG_RESULT([$CSC_PATH/csc.exe])
6684     fi
6686     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
6688     dnl Check al.exe
6689     AC_MSG_CHECKING([for al.exe])
6690     find_winsdk
6691     if test -n "$winsdkbinsubdir" \
6692         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/al.exe"
6693     then
6694         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH"
6695     elif test -f "$winsdktest/Bin/$WIN_BUILD_ARCH/al.exe"; then
6696         AL_PATH="$winsdktest/Bin/$WIN_BUILD_ARCH"
6697     elif test -f "$winsdktest/Bin/al.exe"; then
6698         AL_PATH="$winsdktest/Bin"
6699     fi
6701     if test -z "$AL_PATH"; then
6702         find_al
6703         if test -f "$altest/bin/al.exe"; then
6704             AL_PATH="$altest/bin"
6705         elif test -f "$altest/al.exe"; then
6706             AL_PATH="$altest"
6707         fi
6708     fi
6709     if test ! -f "$AL_PATH/al.exe"; then
6710         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
6711     else
6712         AC_MSG_RESULT([$AL_PATH/al.exe])
6713     fi
6715     AL_PATH=`win_short_path_for_make "$AL_PATH"`
6717     dnl Check mscoree.lib / .NET Framework dir
6718     AC_MSG_CHECKING(.NET Framework)
6719     find_dotnetsdk46
6720     PathFormat "$frametest"
6721     frametest="$formatted_path"
6722     if test -f "$frametest/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6723         DOTNET_FRAMEWORK_HOME="$frametest"
6724     else
6725         find_winsdk
6726         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6727             DOTNET_FRAMEWORK_HOME="$winsdktest"
6728         fi
6729     fi
6730     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
6731         AC_MSG_ERROR([mscoree.lib not found])
6732     fi
6733     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
6735     PathFormat "$MIDL_PATH"
6736     MIDL_PATH="$formatted_path"
6738     PathFormat "$AL_PATH"
6739     AL_PATH="$formatted_path"
6741     PathFormat "$DOTNET_FRAMEWORK_HOME"
6742     DOTNET_FRAMEWORK_HOME="$formatted_path"
6744     PathFormat "$CSC_PATH"
6745     CSC_PATH="$formatted_path"
6748 dnl ===================================================================
6749 dnl Testing for C++ compiler and version...
6750 dnl ===================================================================
6752 if test "$_os" != "WINNT"; then
6753     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
6754     save_CXXFLAGS=$CXXFLAGS
6755     AC_PROG_CXX
6756     CXXFLAGS=$save_CXXFLAGS
6757     if test -z "$CXX_BASE"; then
6758         CXX_BASE=`first_arg_basename "$CXX"`
6759     fi
6762 dnl check for GNU C++ compiler version
6763 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
6764     AC_MSG_CHECKING([the GNU C++ compiler version])
6766     _gpp_version=`$CXX -dumpversion`
6767     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
6769     if test "$_gpp_majmin" -lt "700"; then
6770         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
6771     else
6772         AC_MSG_RESULT([ok (g++ $_gpp_version)])
6773     fi
6775     dnl see https://code.google.com/p/android/issues/detail?id=41770
6776         glibcxx_threads=no
6777         AC_LANG_PUSH([C++])
6778         AC_REQUIRE_CPP
6779         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
6780         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
6781             #include <bits/c++config.h>]],[[
6782             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
6783             && !defined(_GLIBCXX__PTHREADS) \
6784             && !defined(_GLIBCXX_HAS_GTHREADS)
6785             choke me
6786             #endif
6787         ]])],[AC_MSG_RESULT([yes])
6788         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
6789         AC_LANG_POP([C++])
6790         if test $glibcxx_threads = yes; then
6791             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
6792         fi
6794 AC_SUBST(BOOST_CXXFLAGS)
6797 # prefx CXX with ccache if needed
6799 UNCACHED_CXX="$CXX"
6800 if test "$CCACHE" != ""; then
6801     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
6802     AC_LANG_PUSH([C++])
6803     save_CXXFLAGS=$CXXFLAGS
6804     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
6805     dnl an empty program will do, we're checking the compiler flags
6806     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
6807                       [use_ccache=yes], [use_ccache=no])
6808     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
6809         AC_MSG_RESULT([yes])
6810     else
6811         CXX="$CCACHE $CXX"
6812         CXX_BASE="ccache $CXX_BASE"
6813         AC_MSG_RESULT([no])
6814     fi
6815     CXXFLAGS=$save_CXXFLAGS
6816     AC_LANG_POP([C++])
6819 dnl ===================================================================
6820 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
6821 dnl ===================================================================
6823 if test "$_os" != "WINNT"; then
6824     AC_PROG_CXXCPP
6826     dnl Check whether there's a C pre-processor.
6827     AC_PROG_CPP
6831 dnl ===================================================================
6832 dnl Find integral type sizes and alignments
6833 dnl ===================================================================
6835 if test "$_os" != "WINNT"; then
6837     AC_CHECK_SIZEOF(long)
6838     AC_CHECK_SIZEOF(short)
6839     AC_CHECK_SIZEOF(int)
6840     AC_CHECK_SIZEOF(long long)
6841     AC_CHECK_SIZEOF(double)
6842     AC_CHECK_SIZEOF(void*)
6844     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
6845     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
6846     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
6847     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
6848     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6850     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6851     m4_pattern_allow([AC_CHECK_ALIGNOF])
6852     m4_ifdef([AC_CHECK_ALIGNOF],
6853         [
6854             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6855             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6856             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6857             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6858         ],
6859         [
6860             case "$_os-$host_cpu" in
6861             Linux-i686)
6862                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6863                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6864                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6865                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6866                 ;;
6867             Linux-x86_64)
6868                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6869                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6870                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6871                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6872                 ;;
6873             *)
6874                 if test -z "$ac_cv_alignof_short" -o \
6875                         -z "$ac_cv_alignof_int" -o \
6876                         -z "$ac_cv_alignof_long" -o \
6877                         -z "$ac_cv_alignof_double"; then
6878                    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.])
6879                 fi
6880                 ;;
6881             esac
6882         ])
6884     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6885     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6886     if test $ac_cv_sizeof_long -eq 8; then
6887         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6888     elif test $ac_cv_sizeof_double -eq 8; then
6889         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6890     else
6891         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6892     fi
6894     dnl Check for large file support
6895     AC_SYS_LARGEFILE
6896     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6897         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6898     fi
6899     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6900         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6901     fi
6902 else
6903     # Hardcode for MSVC
6904     SAL_TYPES_SIZEOFSHORT=2
6905     SAL_TYPES_SIZEOFINT=4
6906     SAL_TYPES_SIZEOFLONG=4
6907     SAL_TYPES_SIZEOFLONGLONG=8
6908     if test $WIN_HOST_BITS -eq 32; then
6909         SAL_TYPES_SIZEOFPOINTER=4
6910     else
6911         SAL_TYPES_SIZEOFPOINTER=8
6912     fi
6913     SAL_TYPES_ALIGNMENT2=2
6914     SAL_TYPES_ALIGNMENT4=4
6915     SAL_TYPES_ALIGNMENT8=8
6916     LFS_CFLAGS=''
6918 AC_SUBST(LFS_CFLAGS)
6920 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6921 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6922 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6923 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6924 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6925 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6926 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6927 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6929 dnl ===================================================================
6930 dnl Check whether to enable runtime optimizations
6931 dnl ===================================================================
6932 ENABLE_RUNTIME_OPTIMIZATIONS=
6933 AC_MSG_CHECKING([whether to enable runtime optimizations])
6934 if test -z "$enable_runtime_optimizations"; then
6935     for i in $CC; do
6936         case $i in
6937         -fsanitize=*)
6938             enable_runtime_optimizations=no
6939             break
6940             ;;
6941         esac
6942     done
6944 if test "$enable_runtime_optimizations" != no; then
6945     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6946     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6947     AC_MSG_RESULT([yes])
6948 else
6949     AC_MSG_RESULT([no])
6951 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6953 dnl ===================================================================
6954 dnl Check if valgrind headers are available
6955 dnl ===================================================================
6956 ENABLE_VALGRIND=
6957 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6958     prev_cppflags=$CPPFLAGS
6959     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6960     # or where does it come from?
6961     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6962     AC_CHECK_HEADER([valgrind/valgrind.h],
6963         [ENABLE_VALGRIND=TRUE])
6964     CPPFLAGS=$prev_cppflags
6966 AC_SUBST([ENABLE_VALGRIND])
6967 if test -z "$ENABLE_VALGRIND"; then
6968     if test "$with_valgrind" = yes; then
6969         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6970     fi
6971     VALGRIND_CFLAGS=
6973 AC_SUBST([VALGRIND_CFLAGS])
6976 dnl ===================================================================
6977 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6978 dnl ===================================================================
6980 # We need at least the sys/sdt.h include header.
6981 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6982 if test "$SDT_H_FOUND" = "TRUE"; then
6983     # Found sys/sdt.h header, now make sure the c++ compiler works.
6984     # Old g++ versions had problems with probes in constructors/destructors.
6985     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6986     AC_LANG_PUSH([C++])
6987     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6988     #include <sys/sdt.h>
6989     class ProbeClass
6990     {
6991     private:
6992       int& ref;
6993       const char *name;
6995     public:
6996       ProbeClass(int& v, const char *n) : ref(v), name(n)
6997       {
6998         DTRACE_PROBE2(_test_, cons, name, ref);
6999       }
7001       void method(int min)
7002       {
7003         DTRACE_PROBE3(_test_, meth, name, ref, min);
7004         ref -= min;
7005       }
7007       ~ProbeClass()
7008       {
7009         DTRACE_PROBE2(_test_, dest, name, ref);
7010       }
7011     };
7012     ]],[[
7013     int i = 64;
7014     DTRACE_PROBE1(_test_, call, i);
7015     ProbeClass inst = ProbeClass(i, "call");
7016     inst.method(24);
7017     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
7018           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
7019     AC_LANG_POP([C++])
7021 AC_CONFIG_HEADERS([config_host/config_probes.h])
7023 dnl ===================================================================
7024 dnl GCC features
7025 dnl ===================================================================
7026 HAVE_GCC_STACK_CLASH_PROTECTION=
7027 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7028     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
7029     save_CFLAGS=$CFLAGS
7030     CFLAGS="$CFLAGS -Werror -fstack-clash-protection"
7031     AC_LINK_IFELSE(
7032         [AC_LANG_PROGRAM(, [[return 0;]])],
7033         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
7034         [AC_MSG_RESULT([no])])
7035     CFLAGS=$save_CFLAGS
7037     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
7038     save_CFLAGS=$CFLAGS
7039     CFLAGS="$CFLAGS -Werror -mno-avx"
7040     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
7041     CFLAGS=$save_CFLAGS
7042     if test "$HAVE_GCC_AVX" = "TRUE"; then
7043         AC_MSG_RESULT([yes])
7044     else
7045         AC_MSG_RESULT([no])
7046     fi
7048     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
7049     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
7050     int v = 0;
7051     if (__sync_add_and_fetch(&v, 1) != 1 ||
7052         __sync_sub_and_fetch(&v, 1) != 0)
7053         return 1;
7054     __sync_synchronize();
7055     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
7056         v != 1)
7057         return 1;
7058     return 0;
7059 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
7060     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
7061         AC_MSG_RESULT([yes])
7062         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
7063     else
7064         AC_MSG_RESULT([no])
7065     fi
7067     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
7068     AC_LANG_PUSH([C++])
7069     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7070             #include <cstddef>
7071             #include <cxxabi.h>
7072             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
7073         ])], [
7074             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
7075             AC_MSG_RESULT([yes])
7076         ], [AC_MSG_RESULT([no])])
7077     AC_LANG_POP([C++])
7079     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
7080     AC_LANG_PUSH([C++])
7081     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7082             #include <cstddef>
7083             #include <cxxabi.h>
7084             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
7085         ])], [
7086             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
7087             AC_MSG_RESULT([yes])
7088         ], [AC_MSG_RESULT([no])])
7089     AC_LANG_POP([C++])
7091     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
7092     AC_LANG_PUSH([C++])
7093     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7094             #include <cxxabi.h>
7095             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
7096         ])], [
7097             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
7098             AC_MSG_RESULT([yes])
7099         ], [AC_MSG_RESULT([no])])
7100     AC_LANG_POP([C++])
7102     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
7103     AC_LANG_PUSH([C++])
7104     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7105             #include <cstddef>
7106             #include <cxxabi.h>
7107             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
7108         ])], [
7109             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
7110             AC_MSG_RESULT([yes])
7111         ], [AC_MSG_RESULT([no])])
7112     AC_LANG_POP([C++])
7114     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exception in cxxabi.h])
7115     AC_LANG_PUSH([C++])
7116     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7117             #include <cstddef>
7118             #include <cxxabi.h>
7119             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exception); }
7120         ])], [
7121             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTION],[1])
7122             AC_MSG_RESULT([yes])
7123         ], [AC_MSG_RESULT([no])])
7124     AC_LANG_POP([C++])
7126     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
7127     AC_LANG_PUSH([C++])
7128     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7129             #include <cxxabi.h>
7130             void * f() { return __cxxabiv1::__cxa_get_globals(); }
7131         ])], [
7132             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
7133             AC_MSG_RESULT([yes])
7134         ], [AC_MSG_RESULT([no])])
7135     AC_LANG_POP([C++])
7137     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
7138     AC_LANG_PUSH([C++])
7139     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7140             #include <cxxabi.h>
7141             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
7142         ])], [
7143             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
7144             AC_MSG_RESULT([yes])
7145         ], [AC_MSG_RESULT([no])])
7146     AC_LANG_POP([C++])
7148     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
7149     AC_LANG_PUSH([C++])
7150     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7151             #include <cxxabi.h>
7152             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
7153         ])], [
7154             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
7155             AC_MSG_RESULT([yes])
7156         ], [AC_MSG_RESULT([no])])
7157     AC_LANG_POP([C++])
7159     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
7160     AC_LANG_PUSH([C++])
7161     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7162             #include <cstddef>
7163             #include <cxxabi.h>
7164             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
7165         ])], [
7166             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
7167             AC_MSG_RESULT([yes])
7168         ], [AC_MSG_RESULT([no])])
7169     AC_LANG_POP([C++])
7171     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
7172     AC_LANG_PUSH([C++])
7173     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7174             #include <cstddef>
7175             #include <cxxabi.h>
7176             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
7177         ])], [
7178             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
7179             AC_MSG_RESULT([yes])
7180         ], [AC_MSG_RESULT([no])])
7181     AC_LANG_POP([C++])
7184 AC_SUBST(HAVE_GCC_AVX)
7185 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
7186 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
7188 dnl ===================================================================
7189 dnl Identify the C++ library
7190 dnl ===================================================================
7192 AC_MSG_CHECKING([what the C++ library is])
7193 AC_LANG_PUSH([C++])
7194 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7195 #include <utility>
7196 #ifndef __GLIBCXX__
7197 foo bar
7198 #endif
7199 ]])],
7200     [CPP_LIBRARY=GLIBCXX
7201      cpp_library_name="GNU libstdc++"
7202     ],
7203     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7204 #include <utility>
7205 #ifndef _LIBCPP_VERSION
7206 foo bar
7207 #endif
7208 ]])],
7209     [CPP_LIBRARY=LIBCPP
7210      cpp_library_name="LLVM libc++"
7211      AC_DEFINE([HAVE_LIBCXX])
7212     ],
7213     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7214 #include <utility>
7215 #ifndef _MSC_VER
7216 foo bar
7217 #endif
7218 ]])],
7219     [CPP_LIBRARY=MSVCRT
7220      cpp_library_name="Microsoft"
7221     ],
7222     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
7223 AC_MSG_RESULT([$cpp_library_name])
7224 AC_LANG_POP([C++])
7226 dnl ===================================================================
7227 dnl Check for gperf
7228 dnl ===================================================================
7229 AC_PATH_PROG(GPERF, gperf)
7230 if test -z "$GPERF"; then
7231     AC_MSG_ERROR([gperf not found but needed. Install it.])
7233 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7234     GPERF=`cygpath -m $GPERF`
7236 AC_MSG_CHECKING([whether gperf is new enough])
7237 my_gperf_ver1=$($GPERF --version | head -n 1)
7238 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
7239 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
7240 if test "$my_gperf_ver3" -ge 301; then
7241     AC_MSG_RESULT([yes ($my_gperf_ver2)])
7242 else
7243     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
7245 AC_SUBST(GPERF)
7247 dnl ===================================================================
7248 dnl Check for system libcmis
7249 dnl ===================================================================
7250 # libcmis requires curl and we can't build curl for iOS
7251 if test "$test_cmis" = "yes" -a "$enable_cmis" = "yes"; then
7252     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
7253     ENABLE_LIBCMIS=TRUE
7254 else
7255     ENABLE_LIBCMIS=
7257 AC_SUBST(ENABLE_LIBCMIS)
7259 dnl ===================================================================
7260 dnl C++11
7261 dnl ===================================================================
7263 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
7264 CXXFLAGS_CXX11=
7265 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
7266     if test "$with_latest_c__" = yes; then
7267         CXXFLAGS_CXX11=-std:c++latest
7268     else
7269         CXXFLAGS_CXX11=-std:c++17
7270     fi
7271     CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -permissive- -Zc:__cplusplus"
7272 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7273     my_flags='-std=c++17 -std=c++1z'
7274     if test "$with_latest_c__" = yes; then
7275         my_flags="-std=c++23 -std=c++2b -std=c++20 -std=c++2a $my_flags"
7276     fi
7277     for flag in $my_flags; do
7278         if test "$COM" = MSC; then
7279             flag="-Xclang $flag"
7280         fi
7281         save_CXXFLAGS=$CXXFLAGS
7282         CXXFLAGS="$CXXFLAGS $flag -Werror"
7283         if test "$SYSTEM_LIBCMIS" = TRUE; then
7284             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
7285         fi
7286         AC_LANG_PUSH([C++])
7287         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7288             #include <algorithm>
7289             #include <functional>
7290             #include <vector>
7292             #if defined SYSTEM_LIBCMIS
7293             // See ucb/source/ucp/cmis/auth_provider.hxx:
7294             #if !defined __clang__
7295             #pragma GCC diagnostic push
7296             #pragma GCC diagnostic ignored "-Wdeprecated"
7297             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
7298             #endif
7299             #include <libcmis/libcmis.hxx>
7300             #if !defined __clang__
7301             #pragma GCC diagnostic pop
7302             #endif
7303             #endif
7305             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
7306                 std::sort(v.begin(), v.end(), fn);
7307             }
7308             ]])],[CXXFLAGS_CXX11=$flag])
7309         AC_LANG_POP([C++])
7310         CXXFLAGS=$save_CXXFLAGS
7311         if test -n "$CXXFLAGS_CXX11"; then
7312             break
7313         fi
7314     done
7316 if test -n "$CXXFLAGS_CXX11"; then
7317     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
7318 else
7319     AC_MSG_ERROR(no)
7321 AC_SUBST(CXXFLAGS_CXX11)
7323 if test "$GCC" = "yes"; then
7324     save_CXXFLAGS=$CXXFLAGS
7325     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7326     CHECK_L_ATOMIC
7327     CXXFLAGS=$save_CXXFLAGS
7328     AC_SUBST(ATOMIC_LIB)
7331 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
7332 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
7333 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
7334 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
7335 dnl again towards 4.7.2:
7336 if test $CPP_LIBRARY = GLIBCXX; then
7337     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
7338     AC_LANG_PUSH([C++])
7339     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7340 #include <list>
7341 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
7342     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
7343     //   GCC 4.7.0: 20120322
7344     //   GCC 4.7.1: 20120614
7345     // and using a range check is not possible as the mapping between
7346     // __GLIBCXX__ values and GCC versions is not monotonic
7347 /* ok */
7348 #else
7349 abi broken
7350 #endif
7351         ]])], [AC_MSG_RESULT(no, ok)],
7352         [AC_MSG_ERROR(yes)])
7353     AC_LANG_POP([C++])
7356 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
7357 save_CXXFLAGS=$CXXFLAGS
7358 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7359 AC_LANG_PUSH([C++])
7361 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7362 #include <stddef.h>
7364 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
7366 namespace
7368         struct b
7369         {
7370                 int i;
7371                 int j;
7372         };
7374 ]], [[
7375 struct a
7377         int i;
7378         int j;
7380 a thinga[]={{0,0}, {1,1}};
7381 b thingb[]={{0,0}, {1,1}};
7382 size_t i = sizeof(sal_n_array_size(thinga));
7383 size_t j = sizeof(sal_n_array_size(thingb));
7384 return !(i != 0 && j != 0);
7386     ], [ AC_MSG_RESULT(yes) ],
7387     [ AC_MSG_ERROR(no)])
7388 AC_LANG_POP([C++])
7389 CXXFLAGS=$save_CXXFLAGS
7391 HAVE_GCC_FNO_SIZED_DEALLOCATION=
7392 if test "$GCC" = yes; then
7393     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
7394     AC_LANG_PUSH([C++])
7395     save_CXXFLAGS=$CXXFLAGS
7396     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
7397     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
7398     CXXFLAGS=$save_CXXFLAGS
7399     AC_LANG_POP([C++])
7400     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
7401         AC_MSG_RESULT([yes])
7402     else
7403         AC_MSG_RESULT([no])
7404     fi
7406 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
7408 AC_MSG_CHECKING([whether $CXX_BASE supports a working C++20 consteval])
7409 dnl ...that does not suffer from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96994> "Missing code
7410 dnl from consteval constructor initializing const variable",
7411 dnl <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98752> "wrong 'error: â€˜this’ is not a constant
7412 dnl expression' with consteval constructor", or <https://bugs.llvm.org/show_bug.cgi?id=50063> "code
7413 dnl using consteval: 'clang/lib/CodeGen/Address.h:38: llvm::Value*
7414 dnl clang::CodeGen::Address::getPointer() const: Assertion `isValid()' failed.'":
7415 AC_LANG_PUSH([C++])
7416 save_CXXFLAGS=$CXXFLAGS
7417 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7418 AC_RUN_IFELSE([AC_LANG_PROGRAM([
7419         struct S {
7420             consteval S() { i = 1; }
7421             int i = 0;
7422         };
7423         S const s;
7425         struct S1 { consteval S1(int) {} };
7426         struct S2 {
7427             S1 x;
7428             S2(): x(0) {}
7429         };
7431         struct S3 {
7432             consteval S3() {}
7433             union {
7434                 int a;
7435                 unsigned b = 0;
7436             };
7437         };
7438         void f() { S3(); }
7439     ], [
7440         return (s.i == 1) ? 0 : 1;
7441     ])], [
7442         AC_DEFINE([HAVE_CPP_CONSTEVAL],[1])
7443         AC_MSG_RESULT([yes])
7444     ], [AC_MSG_RESULT([no])], [AC_MSG_RESULT([assumed no (cross compiling)])])
7445 CXXFLAGS=$save_CXXFLAGS
7446 AC_LANG_POP([C++])
7448 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
7449 AC_LANG_PUSH([C++])
7450 save_CXXFLAGS=$CXXFLAGS
7451 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7452 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7453         #include <algorithm>
7454         #include <initializer_list>
7455         #include <vector>
7456         template<typename T> class S {
7457         private:
7458             std::vector<T> v_;
7459         public:
7460             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
7461         };
7462         constinit S<int> s{3, 2, 1};
7463     ])], [
7464         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
7465         AC_MSG_RESULT([yes])
7466     ], [AC_MSG_RESULT([no])])
7467 CXXFLAGS=$save_CXXFLAGS
7468 AC_LANG_POP([C++])
7470 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
7471 AC_LANG_PUSH([C++])
7472 save_CXXFLAGS=$CXXFLAGS
7473 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7474 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7475         #include <span>
7476         #include <type_traits>
7477         // Don't check size_type directly, as it was called index_type before P1872R0:
7478         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
7479     ])], [
7480         AC_DEFINE([HAVE_CPP_SPAN],[1])
7481         AC_MSG_RESULT([yes])
7482     ], [AC_MSG_RESULT([no])])
7483 CXXFLAGS=$save_CXXFLAGS
7484 AC_LANG_POP([C++])
7486 AC_MSG_CHECKING([whether $CXX_BASE implements C++ DR P1155R3])
7487 AC_LANG_PUSH([C++])
7488 save_CXXFLAGS=$CXXFLAGS
7489 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7490 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7491         struct S1 { S1(S1 &&); };
7492         struct S2: S1 {};
7493         S1 f(S2 s) { return s; }
7494     ])], [
7495         AC_DEFINE([HAVE_P1155R3],[1])
7496         AC_MSG_RESULT([yes])
7497     ], [AC_MSG_RESULT([no])])
7498 CXXFLAGS=$save_CXXFLAGS
7499 AC_LANG_POP([C++])
7501 dnl Supported since GCC 9 and Clang 10 (which each also started to support -Wdeprecated-copy, but
7502 dnl which is included in -Wextra anyway):
7503 HAVE_WDEPRECATED_COPY_DTOR=
7504 if test "$GCC" = yes; then
7505     AC_MSG_CHECKING([whether $CXX_BASE supports -Wdeprecated-copy-dtor])
7506     AC_LANG_PUSH([C++])
7507     save_CXXFLAGS=$CXXFLAGS
7508     CXXFLAGS="$CXXFLAGS -Werror -Wdeprecated-copy-dtor"
7509     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
7510             HAVE_WDEPRECATED_COPY_DTOR=TRUE
7511             AC_MSG_RESULT([yes])
7512         ], [AC_MSG_RESULT([no])])
7513     CXXFLAGS=$save_CXXFLAGS
7514     AC_LANG_POP([C++])
7516 AC_SUBST([HAVE_WDEPRECATED_COPY_DTOR])
7518 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
7519 dnl uninitialized warning for code like
7521 dnl   OString f();
7522 dnl   boost::optional<OString> * g(bool b) {
7523 dnl       boost::optional<OString> o;
7524 dnl       if (b) o = f();
7525 dnl       return new boost::optional<OString>(o);
7526 dnl   }
7528 dnl (as is e.g. present, in a slightly more elaborate form, in
7529 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
7530 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
7531 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
7532 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7533     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
7534     AC_LANG_PUSH([C++])
7535     save_CXXFLAGS=$CXXFLAGS
7536     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
7537     if test "$ENABLE_OPTIMIZED" = TRUE; then
7538         CXXFLAGS="$CXXFLAGS -O2"
7539     else
7540         CXXFLAGS="$CXXFLAGS -O0"
7541     fi
7542     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7543             #include <new>
7544             void f1(int);
7545             struct S1 {
7546                 ~S1() { f1(n); }
7547                 int n = 0;
7548             };
7549             struct S2 {
7550                 S2() {}
7551                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
7552                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
7553                 void set(S1 s) {
7554                     new (stg) S1(s);
7555                     init = true;
7556                 }
7557                 bool init = false;
7558                 char stg[sizeof (S1)];
7559             } ;
7560             S1 f2();
7561             S2 * f3(bool b) {
7562                 S2 o;
7563                 if (b) o.set(f2());
7564                 return new S2(o);
7565             }
7566         ]])], [AC_MSG_RESULT([no])], [
7567             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
7568             AC_MSG_RESULT([yes])
7569         ])
7570     CXXFLAGS=$save_CXXFLAGS
7571     AC_LANG_POP([C++])
7573 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
7575 dnl Check for <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c5> "[8/9/10/11 Regression]
7576 dnl -Wstringop-overflow false positive due to using MEM_REF type of &MEM" (fixed in GCC 11), which
7577 dnl hits us e.g. with GCC 10 and --enable-optimized at
7579 dnl   In file included from include/rtl/string.hxx:49,
7580 dnl                    from include/rtl/ustring.hxx:43,
7581 dnl                    from include/osl/file.hxx:35,
7582 dnl                    from include/codemaker/global.hxx:28,
7583 dnl                    from include/codemaker/options.hxx:23,
7584 dnl                    from codemaker/source/commoncpp/commoncpp.cxx:24:
7585 dnl   In function â€˜char* rtl::addDataHelper(char*, const char*, std::size_t)’,
7586 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,
7587 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,
7588 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,
7589 dnl       inlined from â€˜rtl::OString codemaker::cpp::scopedCppName(const rtl::OString&, bool)’ at codemaker/source/commoncpp/commoncpp.cxx:53:55:
7590 dnl   include/rtl/stringconcat.hxx:78:15: error: writing 2 bytes into a region of size 1 [-Werror=stringop-overflow=]
7591 dnl      78 |         memcpy( buffer, data, length );
7592 dnl         |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
7593 HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=
7594 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7595     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=stringop-overflow=])
7596     AC_LANG_PUSH([C++])
7597     save_CXXFLAGS=$CXXFLAGS
7598     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wstringop-overflow"
7599     if test "$ENABLE_OPTIMIZED" = TRUE; then
7600         CXXFLAGS="$CXXFLAGS -O2"
7601     else
7602         CXXFLAGS="$CXXFLAGS -O0"
7603     fi
7604     dnl Test code taken from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c0>:
7605     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7606             void fill(char const * begin, char const * end, char c);
7607             struct q {
7608                 char ids[4];
7609                 char username[6];
7610             };
7611             void test(q & c) {
7612                 fill(c.ids, c.ids + sizeof(c.ids), '\0');
7613                 __builtin_strncpy(c.username, "root", sizeof(c.username));
7614             }
7615         ]])], [AC_MSG_RESULT([no])], [
7616             HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=TRUE
7617             AC_MSG_RESULT([yes])
7618         ])
7619     CXXFLAGS=$save_CXXFLAGS
7620     AC_LANG_POP([C++])
7622 AC_SUBST([HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW])
7624 dnl ===================================================================
7625 dnl CPU Intrinsics support - SSE, AVX
7626 dnl ===================================================================
7628 CXXFLAGS_INTRINSICS_SSE2=
7629 CXXFLAGS_INTRINSICS_SSSE3=
7630 CXXFLAGS_INTRINSICS_SSE41=
7631 CXXFLAGS_INTRINSICS_SSE42=
7632 CXXFLAGS_INTRINSICS_AVX=
7633 CXXFLAGS_INTRINSICS_AVX2=
7634 CXXFLAGS_INTRINSICS_AVX512=
7635 CXXFLAGS_INTRINSICS_F16C=
7636 CXXFLAGS_INTRINSICS_FMA=
7638 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7639     # GCC, Clang or Clang-cl (clang-cl + MSVC's -arch options don't work well together)
7640     flag_sse2=-msse2
7641     flag_ssse3=-mssse3
7642     flag_sse41=-msse4.1
7643     flag_sse42=-msse4.2
7644     flag_avx=-mavx
7645     flag_avx2=-mavx2
7646     flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
7647     flag_f16c=-mf16c
7648     flag_fma=-mfma
7649 else
7650     # https://docs.microsoft.com/en-us/cpp/build/reference/arch-x86
7651     # MSVC seems to differentiate only between SSE and SSE2, where in fact
7652     # SSE2 seems to be SSE2+.
7653     # Even if -arch:SSE2 is the default, set it explicitly, so that the variable
7654     # is not empty (and can be tested in gbuild).
7655     flag_sse2=-arch:SSE2
7656     flag_ssse3=-arch:SSE2
7657     flag_sse41=-arch:SSE2
7658     flag_sse42=-arch:SSE2
7659     flag_avx=-arch:AVX
7660     flag_avx2=-arch:AVX2
7661     flag_avx512=-arch:AVX512
7662     # These are part of -arch:AVX2
7663     flag_f16c=-arch:AVX2
7664     flag_fma=-arch:AVX2
7667 AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
7668 AC_LANG_PUSH([C++])
7669 save_CXXFLAGS=$CXXFLAGS
7670 CXXFLAGS="$CXXFLAGS $flag_sse2"
7671 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7672     #include <emmintrin.h>
7673     int main () {
7674         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7675         c = _mm_xor_si128 (a, b);
7676         return 0;
7677     }
7678     ])],
7679     [can_compile_sse2=yes],
7680     [can_compile_sse2=no])
7681 AC_LANG_POP([C++])
7682 CXXFLAGS=$save_CXXFLAGS
7683 AC_MSG_RESULT([${can_compile_sse2}])
7684 if test "${can_compile_sse2}" = "yes" ; then
7685     CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
7688 AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
7689 AC_LANG_PUSH([C++])
7690 save_CXXFLAGS=$CXXFLAGS
7691 CXXFLAGS="$CXXFLAGS $flag_ssse3"
7692 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7693     #include <tmmintrin.h>
7694     int main () {
7695         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7696         c = _mm_maddubs_epi16 (a, b);
7697         return 0;
7698     }
7699     ])],
7700     [can_compile_ssse3=yes],
7701     [can_compile_ssse3=no])
7702 AC_LANG_POP([C++])
7703 CXXFLAGS=$save_CXXFLAGS
7704 AC_MSG_RESULT([${can_compile_ssse3}])
7705 if test "${can_compile_ssse3}" = "yes" ; then
7706     CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
7709 AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
7710 AC_LANG_PUSH([C++])
7711 save_CXXFLAGS=$CXXFLAGS
7712 CXXFLAGS="$CXXFLAGS $flag_sse41"
7713 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7714     #include <smmintrin.h>
7715     int main () {
7716         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7717         c = _mm_cmpeq_epi64 (a, b);
7718         return 0;
7719     }
7720     ])],
7721     [can_compile_sse41=yes],
7722     [can_compile_sse41=no])
7723 AC_LANG_POP([C++])
7724 CXXFLAGS=$save_CXXFLAGS
7725 AC_MSG_RESULT([${can_compile_sse41}])
7726 if test "${can_compile_sse41}" = "yes" ; then
7727     CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
7730 AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
7731 AC_LANG_PUSH([C++])
7732 save_CXXFLAGS=$CXXFLAGS
7733 CXXFLAGS="$CXXFLAGS $flag_sse42"
7734 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7735     #include <nmmintrin.h>
7736     int main () {
7737         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7738         c = _mm_cmpgt_epi64 (a, b);
7739         return 0;
7740     }
7741     ])],
7742     [can_compile_sse42=yes],
7743     [can_compile_sse42=no])
7744 AC_LANG_POP([C++])
7745 CXXFLAGS=$save_CXXFLAGS
7746 AC_MSG_RESULT([${can_compile_sse42}])
7747 if test "${can_compile_sse42}" = "yes" ; then
7748     CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
7751 AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
7752 AC_LANG_PUSH([C++])
7753 save_CXXFLAGS=$CXXFLAGS
7754 CXXFLAGS="$CXXFLAGS $flag_avx"
7755 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7756     #include <immintrin.h>
7757     int main () {
7758         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
7759         c = _mm256_xor_ps(a, b);
7760         return 0;
7761     }
7762     ])],
7763     [can_compile_avx=yes],
7764     [can_compile_avx=no])
7765 AC_LANG_POP([C++])
7766 CXXFLAGS=$save_CXXFLAGS
7767 AC_MSG_RESULT([${can_compile_avx}])
7768 if test "${can_compile_avx}" = "yes" ; then
7769     CXXFLAGS_INTRINSICS_AVX="$flag_avx"
7772 AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
7773 AC_LANG_PUSH([C++])
7774 save_CXXFLAGS=$CXXFLAGS
7775 CXXFLAGS="$CXXFLAGS $flag_avx2"
7776 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7777     #include <immintrin.h>
7778     int main () {
7779         __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
7780         c = _mm256_maddubs_epi16(a, b);
7781         return 0;
7782     }
7783     ])],
7784     [can_compile_avx2=yes],
7785     [can_compile_avx2=no])
7786 AC_LANG_POP([C++])
7787 CXXFLAGS=$save_CXXFLAGS
7788 AC_MSG_RESULT([${can_compile_avx2}])
7789 if test "${can_compile_avx2}" = "yes" ; then
7790     CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
7793 AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
7794 AC_LANG_PUSH([C++])
7795 save_CXXFLAGS=$CXXFLAGS
7796 CXXFLAGS="$CXXFLAGS $flag_avx512"
7797 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7798     #include <immintrin.h>
7799     int main () {
7800         __m512i a = _mm512_loadu_si512(0);
7801         return 0;
7802     }
7803     ])],
7804     [can_compile_avx512=yes],
7805     [can_compile_avx512=no])
7806 AC_LANG_POP([C++])
7807 CXXFLAGS=$save_CXXFLAGS
7808 AC_MSG_RESULT([${can_compile_avx512}])
7809 if test "${can_compile_avx512}" = "yes" ; then
7810     CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
7813 AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
7814 AC_LANG_PUSH([C++])
7815 save_CXXFLAGS=$CXXFLAGS
7816 CXXFLAGS="$CXXFLAGS $flag_f16c"
7817 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7818     #include <immintrin.h>
7819     int main () {
7820         __m128i a = _mm_set1_epi32 (0);
7821         __m128 c;
7822         c = _mm_cvtph_ps(a);
7823         return 0;
7824     }
7825     ])],
7826     [can_compile_f16c=yes],
7827     [can_compile_f16c=no])
7828 AC_LANG_POP([C++])
7829 CXXFLAGS=$save_CXXFLAGS
7830 AC_MSG_RESULT([${can_compile_f16c}])
7831 if test "${can_compile_f16c}" = "yes" ; then
7832     CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
7835 AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
7836 AC_LANG_PUSH([C++])
7837 save_CXXFLAGS=$CXXFLAGS
7838 CXXFLAGS="$CXXFLAGS $flag_fma"
7839 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7840     #include <immintrin.h>
7841     int main () {
7842         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
7843         d = _mm256_fmadd_ps(a, b, c);
7844         return 0;
7845     }
7846     ])],
7847     [can_compile_fma=yes],
7848     [can_compile_fma=no])
7849 AC_LANG_POP([C++])
7850 CXXFLAGS=$save_CXXFLAGS
7851 AC_MSG_RESULT([${can_compile_fma}])
7852 if test "${can_compile_fma}" = "yes" ; then
7853     CXXFLAGS_INTRINSICS_FMA="$flag_fma"
7856 AC_SUBST([CXXFLAGS_INTRINSICS_SSE2])
7857 AC_SUBST([CXXFLAGS_INTRINSICS_SSSE3])
7858 AC_SUBST([CXXFLAGS_INTRINSICS_SSE41])
7859 AC_SUBST([CXXFLAGS_INTRINSICS_SSE42])
7860 AC_SUBST([CXXFLAGS_INTRINSICS_AVX])
7861 AC_SUBST([CXXFLAGS_INTRINSICS_AVX2])
7862 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512])
7863 AC_SUBST([CXXFLAGS_INTRINSICS_F16C])
7864 AC_SUBST([CXXFLAGS_INTRINSICS_FMA])
7866 dnl ===================================================================
7867 dnl system stl sanity tests
7868 dnl ===================================================================
7869 if test "$_os" != "WINNT"; then
7871     AC_LANG_PUSH([C++])
7873     save_CPPFLAGS="$CPPFLAGS"
7874     if test -n "$MACOSX_SDK_PATH"; then
7875         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
7876     fi
7878     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
7879     # only.
7880     if test "$CPP_LIBRARY" = GLIBCXX; then
7881         dnl gcc#19664, gcc#22482, rhbz#162935
7882         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
7883         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
7884         AC_MSG_RESULT([$stlvisok])
7885         if test "$stlvisok" = "no"; then
7886             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
7887         fi
7888     fi
7890     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
7891     # when we don't make any dynamic libraries?
7892     if test "$DISABLE_DYNLOADING" = ""; then
7893         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
7894         cat > conftestlib1.cc <<_ACEOF
7895 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7896 struct S2: S1<int> { virtual ~S2(); };
7897 S2::~S2() {}
7898 _ACEOF
7899         cat > conftestlib2.cc <<_ACEOF
7900 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7901 struct S2: S1<int> { virtual ~S2(); };
7902 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
7903 _ACEOF
7904         gccvisinlineshiddenok=yes
7905         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
7906             gccvisinlineshiddenok=no
7907         else
7908             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
7909             dnl known to not work with -z defs (unsetting which makes the test
7910             dnl moot, though):
7911             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
7912             if test "$COM_IS_CLANG" = TRUE; then
7913                 for i in $CXX $CXXFLAGS; do
7914                     case $i in
7915                     -fsanitize=*)
7916                         my_linkflagsnoundefs=
7917                         break
7918                         ;;
7919                     esac
7920                 done
7921             fi
7922             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
7923                 gccvisinlineshiddenok=no
7924             fi
7925         fi
7927         rm -fr libconftest*
7928         AC_MSG_RESULT([$gccvisinlineshiddenok])
7929         if test "$gccvisinlineshiddenok" = "no"; then
7930             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
7931         fi
7932     fi
7934    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
7935     cat >visibility.cxx <<_ACEOF
7936 #pragma GCC visibility push(hidden)
7937 struct __attribute__ ((visibility ("default"))) TestStruct {
7938   static void Init();
7940 __attribute__ ((visibility ("default"))) void TestFunc() {
7941   TestStruct::Init();
7943 _ACEOF
7944     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
7945         gccvisbroken=yes
7946     else
7947         case "$host_cpu" in
7948         i?86|x86_64)
7949             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
7950                 gccvisbroken=no
7951             else
7952                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
7953                     gccvisbroken=no
7954                 else
7955                     gccvisbroken=yes
7956                 fi
7957             fi
7958             ;;
7959         *)
7960             gccvisbroken=no
7961             ;;
7962         esac
7963     fi
7964     rm -f visibility.s visibility.cxx
7966     AC_MSG_RESULT([$gccvisbroken])
7967     if test "$gccvisbroken" = "yes"; then
7968         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
7969     fi
7971     CPPFLAGS="$save_CPPFLAGS"
7973     AC_LANG_POP([C++])
7976 dnl ===================================================================
7977 dnl  Clang++ tests
7978 dnl ===================================================================
7980 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
7981 if test "$GCC" = "yes"; then
7982     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
7983     AC_LANG_PUSH([C++])
7984     save_CXXFLAGS=$CXXFLAGS
7985     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
7986     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
7987     CXXFLAGS=$save_CXXFLAGS
7988     AC_LANG_POP([C++])
7989     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
7990         AC_MSG_RESULT([yes])
7991     else
7992         AC_MSG_RESULT([no])
7993     fi
7995 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
7997 dnl ===================================================================
7998 dnl Compiler plugins
7999 dnl ===================================================================
8001 COMPILER_PLUGINS=
8002 # currently only Clang
8004 if test "$COM_IS_CLANG" != "TRUE"; then
8005     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
8006         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
8007         enable_compiler_plugins=no
8008     fi
8011 COMPILER_PLUGINS_COM_IS_CLANG=
8012 if test "$COM_IS_CLANG" = "TRUE"; then
8013     if test -n "$enable_compiler_plugins"; then
8014         compiler_plugins="$enable_compiler_plugins"
8015     elif test -n "$ENABLE_DBGUTIL"; then
8016         compiler_plugins=test
8017     else
8018         compiler_plugins=no
8019     fi
8020     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
8021         if test "$CLANGVER" -lt 50002; then
8022             if test "$compiler_plugins" = yes; then
8023                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
8024             else
8025                 compiler_plugins=no
8026             fi
8027         fi
8028     fi
8029     if test "$compiler_plugins" != "no"; then
8030         dnl The prefix where Clang resides, override to where Clang resides if
8031         dnl using a source build:
8032         if test -z "$CLANGDIR"; then
8033             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $(printf '%s\n' $CXX | grep clang | head -n 1)))))
8034         fi
8035         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
8036         if test -z "$COMPILER_PLUGINS_CXX"; then
8037             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
8038         fi
8039         clangbindir=$CLANGDIR/bin
8040         if test "$build_os" = "cygwin"; then
8041             clangbindir=$(cygpath -u "$clangbindir")
8042         fi
8043         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
8044         if test -n "$LLVM_CONFIG"; then
8045             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
8046             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
8047             if test -z "$CLANGLIBDIR"; then
8048                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
8049             fi
8050             # Try if clang is built from source (in which case its includes are not together with llvm includes).
8051             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
8052             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
8053             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
8054                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
8055             fi
8056             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
8057             clangobjdir=$($LLVM_CONFIG --obj-root)
8058             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
8059                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
8060             fi
8061         fi
8062         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
8063         AC_LANG_PUSH([C++])
8064         save_CXX=$CXX
8065         save_CXXCPP=$CXXCPP
8066         save_CPPFLAGS=$CPPFLAGS
8067         save_CXXFLAGS=$CXXFLAGS
8068         save_LDFLAGS=$LDFLAGS
8069         save_LIBS=$LIBS
8070         CXX=$COMPILER_PLUGINS_CXX
8071         CXXCPP="$COMPILER_PLUGINS_CXX -E"
8072         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
8073         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
8074         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
8075             [COMPILER_PLUGINS=TRUE],
8076             [
8077             if test "$compiler_plugins" = "yes"; then
8078                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
8079             else
8080                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
8081                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
8082             fi
8083             ])
8084         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
8085         dnl comment in compilerplugins/Makefile-clang.mk:
8086         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
8087             LDFLAGS=""
8088             AC_MSG_CHECKING([for clang libraries to use])
8089             if test -z "$CLANGTOOLLIBS"; then
8090                 LIBS="-lclangTooling -lclangFrontend -lclangDriver -lclangParse -lclangSema -lclangEdit \
8091  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
8092                 AC_LINK_IFELSE([
8093                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8094                         [[ clang::FullSourceLoc().dump(); ]])
8095                 ],[CLANGTOOLLIBS="$LIBS"],[])
8096             fi
8097             if test -z "$CLANGTOOLLIBS"; then
8098                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
8099                 AC_LINK_IFELSE([
8100                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8101                         [[ clang::FullSourceLoc().dump(); ]])
8102                 ],[CLANGTOOLLIBS="$LIBS"],[])
8103             fi
8104             AC_MSG_RESULT([$CLANGTOOLLIBS])
8105             if test -z "$CLANGTOOLLIBS"; then
8106                 if test "$compiler_plugins" = "yes"; then
8107                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
8108                 else
8109                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
8110                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
8111                 fi
8112                 COMPILER_PLUGINS=
8113             fi
8114             if test -n "$COMPILER_PLUGINS"; then
8115                 if test -z "$CLANGSYSINCLUDE"; then
8116                     if test -n "$LLVM_CONFIG"; then
8117                         # Path to the clang system headers (no idea if there's a better way to get it).
8118                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/git\|svn//')/include
8119                     fi
8120                 fi
8121             fi
8122         fi
8123         CXX=$save_CXX
8124         CXXCPP=$save_CXXCPP
8125         CPPFLAGS=$save_CPPFLAGS
8126         CXXFLAGS=$save_CXXFLAGS
8127         LDFLAGS=$save_LDFLAGS
8128         LIBS="$save_LIBS"
8129         AC_LANG_POP([C++])
8131         AC_MSG_CHECKING([whether the compiler for building compilerplugins is actually Clang])
8132         AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
8133             #ifndef __clang__
8134             you lose
8135             #endif
8136             int foo=42;
8137             ]])],
8138             [AC_MSG_RESULT([yes])
8139              COMPILER_PLUGINS_COM_IS_CLANG=TRUE],
8140             [AC_MSG_RESULT([no])])
8141         AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8142     fi
8143 else
8144     if test "$enable_compiler_plugins" = "yes"; then
8145         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
8146     fi
8148 COMPILER_PLUGINS_ANALYZER_PCH=
8149 if test "$enable_compiler_plugins_analyzer_pch" != no; then
8150     COMPILER_PLUGINS_ANALYZER_PCH=TRUE
8152 AC_SUBST(COMPILER_PLUGINS)
8153 AC_SUBST(COMPILER_PLUGINS_ANALYZER_PCH)
8154 AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8155 AC_SUBST(COMPILER_PLUGINS_CXX)
8156 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
8157 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
8158 AC_SUBST(COMPILER_PLUGINS_DEBUG)
8159 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
8160 AC_SUBST(CLANGDIR)
8161 AC_SUBST(CLANGLIBDIR)
8162 AC_SUBST(CLANGTOOLLIBS)
8163 AC_SUBST(CLANGSYSINCLUDE)
8165 # Plugin to help linker.
8166 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
8167 # This makes --enable-lto build with clang work.
8168 AC_SUBST(LD_PLUGIN)
8170 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
8171 AC_SUBST(HAVE_POSIX_FALLOCATE)
8173 JITC_PROCESSOR_TYPE=""
8174 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
8175     # IBMs JDK needs this...
8176     JITC_PROCESSOR_TYPE=6
8177     export JITC_PROCESSOR_TYPE
8179 AC_SUBST([JITC_PROCESSOR_TYPE])
8181 # Misc Windows Stuff
8182 AC_ARG_WITH(ucrt-dir,
8183     AS_HELP_STRING([--with-ucrt-dir],
8184         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
8185         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
8186         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
8187             Windows6.1-KB2999226-x64.msu
8188             Windows6.1-KB2999226-x86.msu
8189             Windows8.1-KB2999226-x64.msu
8190             Windows8.1-KB2999226-x86.msu
8191             Windows8-RT-KB2999226-x64.msu
8192             Windows8-RT-KB2999226-x86.msu
8193         A zip archive including those files is available from Microsoft site:
8194         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
8197 UCRT_REDISTDIR="$with_ucrt_dir"
8198 if test $_os = "WINNT"; then
8199     find_msvc_x64_dlls
8200     for i in $PKGFORMAT; do
8201         if test "$i" = msi; then
8202             find_msms
8203             break
8204         fi
8205     done
8206     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
8207     MSVC_DLLS="$msvcdlls"
8208     test -n "$msmdir" && MSM_PATH=`win_short_path_for_make "$msmdir"`
8209     # MSVC 15.3 changed it to VC141
8210     if echo "$msvcdllpath" | grep -q "VC142.CRT$"; then
8211         SCPDEFS="$SCPDEFS -DWITH_VC142_REDIST"
8212     elif echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
8213         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
8214     else
8215         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
8216     fi
8218     if test "$UCRT_REDISTDIR" = "no"; then
8219         dnl explicitly disabled
8220         UCRT_REDISTDIR=""
8221     else
8222         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
8223                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
8224                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
8225                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
8226                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
8227                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
8228             UCRT_REDISTDIR=""
8229             if test -n "$PKGFORMAT"; then
8230                for i in $PKGFORMAT; do
8231                    case "$i" in
8232                    msi)
8233                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
8234                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
8235                        ;;
8236                    esac
8237                done
8238             fi
8239         fi
8240     fi
8243 AC_SUBST(UCRT_REDISTDIR)
8244 AC_SUBST(MSVC_DLL_PATH)
8245 AC_SUBST(MSVC_DLLS)
8246 AC_SUBST(MSM_PATH)
8249 dnl ===================================================================
8250 dnl Checks for Java
8251 dnl ===================================================================
8252 if test "$ENABLE_JAVA" != ""; then
8254     # Windows-specific tests
8255     if test "$build_os" = "cygwin"; then
8256         if test -z "$with_jdk_home"; then
8257             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
8258             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
8259             reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
8260             if test -n "$regvalue"; then
8261                 ver=$regvalue
8262                 reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
8263                 with_jdk_home=$regvalue
8264             fi
8265             howfound="found automatically"
8266         else
8267             with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
8268             howfound="you passed"
8269         fi
8271         if ! test -f "$with_jdk_home/lib/jvm.lib" -a -f "$with_jdk_home/bin/java.exe"; then
8272             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])
8273         fi
8274     fi
8276     # 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.
8277     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
8278     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
8279         with_jdk_home=`/usr/libexec/java_home`
8280     fi
8282     JAVA_HOME=; export JAVA_HOME
8283     if test -z "$with_jdk_home"; then
8284         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
8285     else
8286         _java_path="$with_jdk_home/bin/$with_java"
8287         dnl Check if there is a Java interpreter at all.
8288         if test -x "$_java_path"; then
8289             JAVAINTERPRETER=$_java_path
8290         else
8291             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
8292         fi
8293     fi
8295     dnl Check that the JDK found is correct architecture (at least 2 reasons to
8296     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
8297     dnl loaded by java to run JunitTests:
8298     if test "$build_os" = "cygwin" -a "$cross_compiling" != "yes"; then
8299         shortjdkhome=`cygpath -d "$with_jdk_home"`
8300         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
8301             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
8302             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8303         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
8304             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8305             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8306         fi
8308         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
8309             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
8310         fi
8311         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
8312     elif test "$cross_compiling" != "yes"; then
8313         case $CPUNAME in
8314             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
8315                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
8316                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
8317                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8318                 fi
8319                 ;;
8320             *) # assumption: everything else 32-bit
8321                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
8322                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8323                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8324                 fi
8325                 ;;
8326         esac
8327     fi
8330 dnl ===================================================================
8331 dnl Checks for JDK.
8332 dnl ===================================================================
8334 # Whether all the complexity here actually is needed any more or not, no idea.
8336 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8337     _gij_longver=0
8338     AC_MSG_CHECKING([the installed JDK])
8339     if test -n "$JAVAINTERPRETER"; then
8340         dnl java -version sends output to stderr!
8341         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
8342             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8343         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
8344             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8345         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
8346             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8347         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
8348             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8349         else
8350             JDK=sun
8352             dnl Sun JDK specific tests
8353             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
8354             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
8356             if test "$_jdk_ver" -lt 10900; then
8357                 AC_MSG_ERROR([JDK is too old, you need at least 9 ($_jdk_ver < 10900)])
8358             fi
8359             if test "$_jdk_ver" -gt 10900; then
8360                 JAVA_CLASSPATH_NOT_SET=TRUE
8361             fi
8363             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
8364             if test "$_os" = "WINNT"; then
8365                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
8366             fi
8367             AC_MSG_RESULT([found $JAVA_HOME (JDK $_jdk)])
8369             # set to limit VM usage for JunitTests
8370             JAVAIFLAGS=-Xmx64M
8371             # set to limit VM usage for javac
8372             JAVACFLAGS=-J-Xmx128M
8373         fi
8374     else
8375         AC_MSG_ERROR([Java not found. You need at least JDK 9])
8376     fi
8377 else
8378     if test -z "$ENABLE_JAVA"; then
8379         dnl Java disabled
8380         JAVA_HOME=
8381         export JAVA_HOME
8382     elif test "$cross_compiling" = "yes"; then
8383         # Just assume compatibility of build and host JDK
8384         JDK=$JDK_FOR_BUILD
8385         JAVAIFLAGS=$JAVAIFLAGS_FOR_BUILD
8386     fi
8389 dnl ===================================================================
8390 dnl Checks for javac
8391 dnl ===================================================================
8392 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8393     javacompiler="javac"
8394     : ${JAVA_SOURCE_VER=8}
8395     : ${JAVA_TARGET_VER=8}
8396     if test -z "$with_jdk_home"; then
8397         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
8398     else
8399         _javac_path="$with_jdk_home/bin/$javacompiler"
8400         dnl Check if there is a Java compiler at all.
8401         if test -x "$_javac_path"; then
8402             JAVACOMPILER=$_javac_path
8403         fi
8404     fi
8405     if test -z "$JAVACOMPILER"; then
8406         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
8407     fi
8408     if test "$build_os" = "cygwin"; then
8409         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
8410             JAVACOMPILER="${JAVACOMPILER}.exe"
8411         fi
8412         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
8413     fi
8416 dnl ===================================================================
8417 dnl Checks for javadoc
8418 dnl ===================================================================
8419 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8420     if test -z "$with_jdk_home"; then
8421         AC_PATH_PROG(JAVADOC, javadoc)
8422     else
8423         _javadoc_path="$with_jdk_home/bin/javadoc"
8424         dnl Check if there is a javadoc at all.
8425         if test -x "$_javadoc_path"; then
8426             JAVADOC=$_javadoc_path
8427         else
8428             AC_PATH_PROG(JAVADOC, javadoc)
8429         fi
8430     fi
8431     if test -z "$JAVADOC"; then
8432         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
8433     fi
8434     if test "$build_os" = "cygwin"; then
8435         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
8436             JAVADOC="${JAVADOC}.exe"
8437         fi
8438         JAVADOC=`win_short_path_for_make "$JAVADOC"`
8439     fi
8441     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
8442     JAVADOCISGJDOC="yes"
8443     fi
8445 AC_SUBST(JAVADOC)
8446 AC_SUBST(JAVADOCISGJDOC)
8448 if test "$ENABLE_JAVA" != "" -a \( "$cross_compiling" != "yes" -o -n "$with_jdk_home" \); then
8449     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
8450     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
8451         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
8452            # try to recover first by looking whether we have an alternative
8453            # system as in Debian or newer SuSEs where following /usr/bin/javac
8454            # over /etc/alternatives/javac leads to the right bindir where we
8455            # just need to strip a bit away to get a valid JAVA_HOME
8456            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
8457         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
8458             # maybe only one level of symlink (e.g. on Mac)
8459             JAVA_HOME=$(readlink $JAVACOMPILER)
8460             if test "$(dirname $JAVA_HOME)" = "."; then
8461                 # we've got no path to trim back
8462                 JAVA_HOME=""
8463             fi
8464         else
8465             # else warn
8466             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
8467             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
8468             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
8469             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
8470         fi
8471         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
8472         if test "$JAVA_HOME" != "/usr"; then
8473             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8474                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
8475                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
8476                 dnl Tiger already returns a JDK path...
8477                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
8478             else
8479                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
8480                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
8481                 dnl that checks which version to run
8482                 if test -f "$JAVA_HOME"; then
8483                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
8484                 fi
8485             fi
8486         fi
8487     fi
8488     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
8490     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
8491     if test -z "$JAVA_HOME"; then
8492         if test "x$with_jdk_home" = "x"; then
8493             cat > findhome.java <<_ACEOF
8494 [import java.io.File;
8496 class findhome
8498     public static void main(String args[])
8499     {
8500         String jrelocation = System.getProperty("java.home");
8501         File jre = new File(jrelocation);
8502         System.out.println(jre.getParent());
8503     }
8505 _ACEOF
8506             AC_MSG_CHECKING([if javac works])
8507             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
8508             AC_TRY_EVAL(javac_cmd)
8509             if test $? = 0 -a -f ./findhome.class; then
8510                 AC_MSG_RESULT([javac works])
8511             else
8512                 echo "configure: javac test failed" >&5
8513                 cat findhome.java >&5
8514                 AC_MSG_ERROR([javac does not work - java projects will not build!])
8515             fi
8516             AC_MSG_CHECKING([if gij knows its java.home])
8517             JAVA_HOME=`$JAVAINTERPRETER findhome`
8518             if test $? = 0 -a "$JAVA_HOME" != ""; then
8519                 AC_MSG_RESULT([$JAVA_HOME])
8520             else
8521                 echo "configure: java test failed" >&5
8522                 cat findhome.java >&5
8523                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
8524             fi
8525             # clean-up after ourselves
8526             rm -f ./findhome.java ./findhome.class
8527         else
8528             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
8529         fi
8530     fi
8532     # now check if $JAVA_HOME is really valid
8533     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8534         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
8535             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
8536             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
8537             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
8538             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
8539             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
8540             add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
8541         fi
8542     fi
8543     PathFormat "$JAVA_HOME"
8544     JAVA_HOME="$formatted_path"
8547 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
8548     "$_os" != Darwin
8549 then
8550     AC_MSG_CHECKING([for JAWT lib])
8551     if test "$_os" = WINNT; then
8552         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
8553         JAWTLIB=jawt.lib
8554     else
8555         case "$host_cpu" in
8556         arm*)
8557             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
8558             JAVA_ARCH=$my_java_arch
8559             ;;
8560         i*86)
8561             my_java_arch=i386
8562             ;;
8563         m68k)
8564             my_java_arch=m68k
8565             ;;
8566         powerpc)
8567             my_java_arch=ppc
8568             ;;
8569         powerpc64)
8570             my_java_arch=ppc64
8571             ;;
8572         powerpc64le)
8573             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
8574             JAVA_ARCH=$my_java_arch
8575             ;;
8576         sparc64)
8577             my_java_arch=sparcv9
8578             ;;
8579         x86_64)
8580             my_java_arch=amd64
8581             ;;
8582         *)
8583             my_java_arch=$host_cpu
8584             ;;
8585         esac
8586         # This is where JDK9 puts the library
8587         if test -e "$JAVA_HOME/lib/libjawt.so"; then
8588             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
8589         else
8590             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
8591         fi
8592         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
8593     fi
8594     AC_MSG_RESULT([$JAWTLIB])
8596 AC_SUBST(JAWTLIB)
8598 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
8599     case "$host_os" in
8601     aix*)
8602         JAVAINC="-I$JAVA_HOME/include"
8603         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
8604         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8605         ;;
8607     cygwin*|wsl*)
8608         JAVAINC="-I$JAVA_HOME/include/win32"
8609         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
8610         ;;
8612     darwin*|macos*)
8613         if test -d "$JAVA_HOME/include/darwin"; then
8614             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
8615         else
8616             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
8617         fi
8618         ;;
8620     dragonfly*)
8621         JAVAINC="-I$JAVA_HOME/include"
8622         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8623         ;;
8625     freebsd*)
8626         JAVAINC="-I$JAVA_HOME/include"
8627         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
8628         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
8629         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8630         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8631         ;;
8633     k*bsd*-gnu*)
8634         JAVAINC="-I$JAVA_HOME/include"
8635         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8636         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8637         ;;
8639     linux-gnu*)
8640         JAVAINC="-I$JAVA_HOME/include"
8641         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8642         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8643         ;;
8645     *netbsd*)
8646         JAVAINC="-I$JAVA_HOME/include"
8647         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
8648         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8649        ;;
8651     openbsd*)
8652         JAVAINC="-I$JAVA_HOME/include"
8653         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
8654         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8655         ;;
8657     solaris*)
8658         JAVAINC="-I$JAVA_HOME/include"
8659         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
8660         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8661         ;;
8662     esac
8664 SOLARINC="$SOLARINC $JAVAINC"
8666 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8667     JAVA_HOME_FOR_BUILD=$JAVA_HOME
8668     JAVAIFLAGS_FOR_BUILD=$JAVAIFLAGS
8669     JDK_FOR_BUILD=$JDK
8672 AC_SUBST(JAVACFLAGS)
8673 AC_SUBST(JAVACOMPILER)
8674 AC_SUBST(JAVAINTERPRETER)
8675 AC_SUBST(JAVAIFLAGS)
8676 AC_SUBST(JAVAIFLAGS_FOR_BUILD)
8677 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
8678 AC_SUBST(JAVA_HOME)
8679 AC_SUBST(JAVA_HOME_FOR_BUILD)
8680 AC_SUBST(JDK)
8681 AC_SUBST(JDK_FOR_BUILD)
8682 AC_SUBST(JAVA_SOURCE_VER)
8683 AC_SUBST(JAVA_TARGET_VER)
8686 dnl ===================================================================
8687 dnl Export file validation
8688 dnl ===================================================================
8689 AC_MSG_CHECKING([whether to enable export file validation])
8690 if test "$with_export_validation" != "no"; then
8691     if test -z "$ENABLE_JAVA"; then
8692         if test "$with_export_validation" = "yes"; then
8693             AC_MSG_ERROR([requested, but Java is disabled])
8694         else
8695             AC_MSG_RESULT([no, as Java is disabled])
8696         fi
8697     elif ! test -d "${SRC_ROOT}/schema"; then
8698         if test "$with_export_validation" = "yes"; then
8699             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
8700         else
8701             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
8702         fi
8703     else
8704         AC_MSG_RESULT([yes])
8705         AC_DEFINE(HAVE_EXPORT_VALIDATION)
8707         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
8708         if test -z "$ODFVALIDATOR"; then
8709             # remember to download the ODF toolkit with validator later
8710             AC_MSG_NOTICE([no odfvalidator found, will download it])
8711             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
8712             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
8714             # and fetch name of odfvalidator jar name from download.lst
8715             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
8716             AC_SUBST(ODFVALIDATOR_JAR)
8718             if test -z "$ODFVALIDATOR_JAR"; then
8719                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
8720             fi
8721         fi
8722         if test "$build_os" = "cygwin"; then
8723             # In case of Cygwin it will be executed from Windows,
8724             # so we need to run bash and absolute path to validator
8725             # so instead of "odfvalidator" it will be
8726             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
8727             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
8728         else
8729             ODFVALIDATOR="sh $ODFVALIDATOR"
8730         fi
8731         AC_SUBST(ODFVALIDATOR)
8734         AC_PATH_PROGS(OFFICEOTRON, officeotron)
8735         if test -z "$OFFICEOTRON"; then
8736             # remember to download the officeotron with validator later
8737             AC_MSG_NOTICE([no officeotron found, will download it])
8738             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
8739             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
8741             # and fetch name of officeotron jar name from download.lst
8742             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
8743             AC_SUBST(OFFICEOTRON_JAR)
8745             if test -z "$OFFICEOTRON_JAR"; then
8746                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
8747             fi
8748         else
8749             # check version of existing officeotron
8750             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
8751             if test 0"$OFFICEOTRON_VER" -lt 704; then
8752                 AC_MSG_ERROR([officeotron too old])
8753             fi
8754         fi
8755         if test "$build_os" = "cygwin"; then
8756             # In case of Cygwin it will be executed from Windows,
8757             # so we need to run bash and absolute path to validator
8758             # so instead of "odfvalidator" it will be
8759             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
8760             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
8761         else
8762             OFFICEOTRON="sh $OFFICEOTRON"
8763         fi
8764     fi
8765     AC_SUBST(OFFICEOTRON)
8766 else
8767     AC_MSG_RESULT([no])
8770 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
8771 if test "$with_bffvalidator" != "no"; then
8772     AC_DEFINE(HAVE_BFFVALIDATOR)
8774     if test "$with_export_validation" = "no"; then
8775         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
8776     fi
8778     if test "$with_bffvalidator" = "yes"; then
8779         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
8780     else
8781         BFFVALIDATOR="$with_bffvalidator"
8782     fi
8784     if test "$build_os" = "cygwin"; then
8785         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
8786             AC_MSG_RESULT($BFFVALIDATOR)
8787         else
8788             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8789         fi
8790     elif test -n "$BFFVALIDATOR"; then
8791         # We are not in Cygwin but need to run Windows binary with wine
8792         AC_PATH_PROGS(WINE, wine)
8794         # so swap in a shell wrapper that converts paths transparently
8795         BFFVALIDATOR_EXE="$BFFVALIDATOR"
8796         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
8797         AC_SUBST(BFFVALIDATOR_EXE)
8798         AC_MSG_RESULT($BFFVALIDATOR)
8799     else
8800         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8801     fi
8802     AC_SUBST(BFFVALIDATOR)
8803 else
8804     AC_MSG_RESULT([no])
8807 dnl ===================================================================
8808 dnl Check for C preprocessor to use
8809 dnl ===================================================================
8810 AC_MSG_CHECKING([which C preprocessor to use in idlc])
8811 if test -n "$with_idlc_cpp"; then
8812     AC_MSG_RESULT([$with_idlc_cpp])
8813     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
8814 else
8815     AC_MSG_RESULT([ucpp])
8816     AC_MSG_CHECKING([which ucpp tp use])
8817     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
8818         AC_MSG_RESULT([external])
8819         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
8820     else
8821         AC_MSG_RESULT([internal])
8822         BUILD_TYPE="$BUILD_TYPE UCPP"
8823     fi
8825 AC_SUBST(SYSTEM_UCPP)
8827 dnl ===================================================================
8828 dnl Check for epm (not needed for Windows)
8829 dnl ===================================================================
8830 AC_MSG_CHECKING([whether to enable EPM for packing])
8831 if test "$enable_epm" = "yes"; then
8832     AC_MSG_RESULT([yes])
8833     if test "$_os" != "WINNT"; then
8834         if test $_os = Darwin; then
8835             EPM=internal
8836         elif test -n "$with_epm"; then
8837             EPM=$with_epm
8838         else
8839             AC_PATH_PROG(EPM, epm, no)
8840         fi
8841         if test "$EPM" = "no" -o "$EPM" = "internal"; then
8842             AC_MSG_NOTICE([EPM will be built.])
8843             BUILD_TYPE="$BUILD_TYPE EPM"
8844             EPM=${WORKDIR}/UnpackedTarball/epm/epm
8845         else
8846             # Gentoo has some epm which is something different...
8847             AC_MSG_CHECKING([whether the found epm is the right epm])
8848             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
8849                 AC_MSG_RESULT([yes])
8850             else
8851                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8852             fi
8853             AC_MSG_CHECKING([epm version])
8854             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
8855             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
8856                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
8857                 AC_MSG_RESULT([OK, >= 3.7])
8858             else
8859                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
8860                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8861             fi
8862         fi
8863     fi
8865     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
8866         AC_MSG_CHECKING([for rpm])
8867         for a in "$RPM" rpmbuild rpm; do
8868             $a --usage >/dev/null 2> /dev/null
8869             if test $? -eq 0; then
8870                 RPM=$a
8871                 break
8872             else
8873                 $a --version >/dev/null 2> /dev/null
8874                 if test $? -eq 0; then
8875                     RPM=$a
8876                     break
8877                 fi
8878             fi
8879         done
8880         if test -z "$RPM"; then
8881             AC_MSG_ERROR([not found])
8882         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
8883             RPM_PATH=`which $RPM`
8884             AC_MSG_RESULT([$RPM_PATH])
8885             SCPDEFS="$SCPDEFS -DWITH_RPM"
8886         else
8887             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
8888         fi
8889     fi
8890     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
8891         AC_PATH_PROG(DPKG, dpkg, no)
8892         if test "$DPKG" = "no"; then
8893             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
8894         fi
8895     fi
8896     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
8897        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8898         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
8899             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
8900                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
8901                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
8902                     AC_MSG_RESULT([yes])
8903                 else
8904                     AC_MSG_RESULT([no])
8905                     if echo "$PKGFORMAT" | $GREP -q rpm; then
8906                         _pt="rpm"
8907                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
8908                         add_warning "the rpms will need to be installed with --nodeps"
8909                     else
8910                         _pt="pkg"
8911                     fi
8912                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
8913                     add_warning "the ${_pt}s will not be relocatable"
8914                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
8915                                  relocation will work, you need to patch your epm with the
8916                                  patch in epm/epm-3.7.patch or build with
8917                                  --with-epm=internal which will build a suitable epm])
8918                 fi
8919             fi
8920         fi
8921     fi
8922     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8923         AC_PATH_PROG(PKGMK, pkgmk, no)
8924         if test "$PKGMK" = "no"; then
8925             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
8926         fi
8927     fi
8928     AC_SUBST(RPM)
8929     AC_SUBST(DPKG)
8930     AC_SUBST(PKGMK)
8931 else
8932     for i in $PKGFORMAT; do
8933         case "$i" in
8934         aix | bsd | deb | pkg | rpm | native | portable)
8935             AC_MSG_ERROR(
8936                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
8937             ;;
8938         esac
8939     done
8940     AC_MSG_RESULT([no])
8941     EPM=NO
8943 AC_SUBST(EPM)
8945 ENABLE_LWP=
8946 if test "$enable_lotuswordpro" = "yes"; then
8947     ENABLE_LWP="TRUE"
8949 AC_SUBST(ENABLE_LWP)
8951 dnl ===================================================================
8952 dnl Check for building ODK
8953 dnl ===================================================================
8954 if test "$enable_odk" != yes; then
8955     unset DOXYGEN
8956 else
8957     if test "$with_doxygen" = no; then
8958         AC_MSG_CHECKING([for doxygen])
8959         unset DOXYGEN
8960         AC_MSG_RESULT([no])
8961     else
8962         if test "$with_doxygen" = yes; then
8963             AC_PATH_PROG([DOXYGEN], [doxygen])
8964             if test -z "$DOXYGEN"; then
8965                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
8966             fi
8967             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
8968                 if ! dot -V 2>/dev/null; then
8969                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
8970                 fi
8971             fi
8972         else
8973             AC_MSG_CHECKING([for doxygen])
8974             DOXYGEN=$with_doxygen
8975             AC_MSG_RESULT([$DOXYGEN])
8976         fi
8977         if test -n "$DOXYGEN"; then
8978             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
8979             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
8980             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
8981                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
8982             fi
8983         fi
8984     fi
8986 AC_SUBST([DOXYGEN])
8988 AC_MSG_CHECKING([whether to build the ODK])
8989 if test "$enable_odk" = yes; then
8990     AC_MSG_RESULT([yes])
8991     BUILD_TYPE="$BUILD_TYPE ODK"
8992 else
8993     AC_MSG_RESULT([no])
8996 dnl ===================================================================
8997 dnl Check for system zlib
8998 dnl ===================================================================
8999 if test "$with_system_zlib" = "auto"; then
9000     case "$_os" in
9001     WINNT)
9002         with_system_zlib="$with_system_libs"
9003         ;;
9004     *)
9005         if test "$enable_fuzzers" != "yes"; then
9006             with_system_zlib=yes
9007         else
9008             with_system_zlib=no
9009         fi
9010         ;;
9011     esac
9014 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
9015 dnl and has no pkg-config for it at least on some tinderboxes,
9016 dnl so leaving that out for now
9017 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
9018 AC_MSG_CHECKING([which zlib to use])
9019 if test "$with_system_zlib" = "yes"; then
9020     AC_MSG_RESULT([external])
9021     SYSTEM_ZLIB=TRUE
9022     AC_CHECK_HEADER(zlib.h, [],
9023         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
9024     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
9025         [AC_MSG_ERROR(zlib not found or functional)], [])
9026 else
9027     AC_MSG_RESULT([internal])
9028     SYSTEM_ZLIB=
9029     BUILD_TYPE="$BUILD_TYPE ZLIB"
9030     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
9031     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
9033 AC_SUBST(ZLIB_CFLAGS)
9034 AC_SUBST(ZLIB_LIBS)
9035 AC_SUBST(SYSTEM_ZLIB)
9037 dnl ===================================================================
9038 dnl Check for system jpeg
9039 dnl ===================================================================
9040 AC_MSG_CHECKING([which libjpeg to use])
9041 if test "$with_system_jpeg" = "yes"; then
9042     AC_MSG_RESULT([external])
9043     SYSTEM_LIBJPEG=TRUE
9044     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
9045         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
9046     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
9047         [AC_MSG_ERROR(jpeg library not found or functional)], [])
9048 else
9049     SYSTEM_LIBJPEG=
9050     AC_MSG_RESULT([internal, libjpeg-turbo])
9051     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
9052     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
9053     if test "$COM" = "MSC"; then
9054         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
9055     else
9056         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
9057     fi
9059     case "$host_cpu" in
9060     x86_64 | amd64 | i*86 | x86 | ia32)
9061         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
9062         if test -z "$NASM" -a "$build_os" = "cygwin"; then
9063             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
9064                 NASM="$LODE_HOME/opt/bin/nasm"
9065             elif test -x "/opt/lo/bin/nasm"; then
9066                 NASM="/opt/lo/bin/nasm"
9067             fi
9068         fi
9070         if test -n "$NASM"; then
9071             AC_MSG_CHECKING([for object file format of host system])
9072             case "$host_os" in
9073               cygwin* | mingw* | pw32* | wsl*)
9074                 case "$host_cpu" in
9075                   x86_64)
9076                     objfmt='Win64-COFF'
9077                     ;;
9078                   *)
9079                     objfmt='Win32-COFF'
9080                     ;;
9081                 esac
9082               ;;
9083               msdosdjgpp* | go32*)
9084                 objfmt='COFF'
9085               ;;
9086               os2-emx*) # not tested
9087                 objfmt='MSOMF' # obj
9088               ;;
9089               linux*coff* | linux*oldld*)
9090                 objfmt='COFF' # ???
9091               ;;
9092               linux*aout*)
9093                 objfmt='a.out'
9094               ;;
9095               linux*)
9096                 case "$host_cpu" in
9097                   x86_64)
9098                     objfmt='ELF64'
9099                     ;;
9100                   *)
9101                     objfmt='ELF'
9102                     ;;
9103                 esac
9104               ;;
9105               kfreebsd* | freebsd* | netbsd* | openbsd*)
9106                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
9107                   objfmt='BSD-a.out'
9108                 else
9109                   case "$host_cpu" in
9110                     x86_64 | amd64)
9111                       objfmt='ELF64'
9112                       ;;
9113                     *)
9114                       objfmt='ELF'
9115                       ;;
9116                   esac
9117                 fi
9118               ;;
9119               solaris* | sunos* | sysv* | sco*)
9120                 case "$host_cpu" in
9121                   x86_64)
9122                     objfmt='ELF64'
9123                     ;;
9124                   *)
9125                     objfmt='ELF'
9126                     ;;
9127                 esac
9128               ;;
9129               darwin* | rhapsody* | nextstep* | openstep* | macos*)
9130                 case "$host_cpu" in
9131                   x86_64)
9132                     objfmt='Mach-O64'
9133                     ;;
9134                   *)
9135                     objfmt='Mach-O'
9136                     ;;
9137                 esac
9138               ;;
9139               *)
9140                 objfmt='ELF ?'
9141               ;;
9142             esac
9144             AC_MSG_RESULT([$objfmt])
9145             if test "$objfmt" = 'ELF ?'; then
9146               objfmt='ELF'
9147               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
9148             fi
9150             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
9151             case "$objfmt" in
9152               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
9153               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
9154               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
9155               COFF)       NAFLAGS='-fcoff -DCOFF';;
9156               a.out)      NAFLAGS='-faout -DAOUT';;
9157               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
9158               ELF)        NAFLAGS='-felf -DELF';;
9159               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
9160               RDF)        NAFLAGS='-frdf -DRDF';;
9161               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
9162               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
9163             esac
9164             AC_MSG_RESULT([$NAFLAGS])
9166             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
9167             cat > conftest.asm << EOF
9168             [%line __oline__ "configure"
9169                     section .text
9170                     global  _main,main
9171             _main:
9172             main:   xor     eax,eax
9173                     ret
9174             ]
9176             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
9177             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
9178               AC_MSG_RESULT(yes)
9179             else
9180               echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
9181               cat conftest.asm >&AS_MESSAGE_LOG_FD
9182               rm -rf conftest*
9183               AC_MSG_RESULT(no)
9184               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
9185               NASM=""
9186             fi
9188         fi
9190         if test -z "$NASM"; then
9191 cat << _EOS
9192 ****************************************************************************
9193 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
9194 To get one please:
9196 _EOS
9197             if test "$build_os" = "cygwin"; then
9198 cat << _EOS
9199 install a pre-compiled binary for Win32
9201 mkdir -p /opt/lo/bin
9202 cd /opt/lo/bin
9203 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
9204 chmod +x nasm
9206 or get and install one from http://www.nasm.us/
9208 Then re-run autogen.sh
9210 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
9211 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
9213 _EOS
9214             else
9215 cat << _EOS
9216 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
9218 _EOS
9219             fi
9220             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
9221             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
9222         fi
9223       ;;
9224     esac
9227 AC_SUBST(NASM)
9228 AC_SUBST(LIBJPEG_CFLAGS)
9229 AC_SUBST(LIBJPEG_LIBS)
9230 AC_SUBST(SYSTEM_LIBJPEG)
9232 dnl ===================================================================
9233 dnl Check for system clucene
9234 dnl ===================================================================
9235 dnl we should rather be using
9236 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
9237 dnl but the contribs-lib check seems tricky
9238 if test "$enable_xmlhelp" = yes -o "$enable_extension_integration" = yes; then
9239 AC_MSG_CHECKING([which clucene to use])
9240 if test "$with_system_clucene" = "yes"; then
9241     AC_MSG_RESULT([external])
9242     SYSTEM_CLUCENE=TRUE
9243     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
9244     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
9245     FilterLibs "${CLUCENE_LIBS}"
9246     CLUCENE_LIBS="${filteredlibs}"
9247     AC_LANG_PUSH([C++])
9248     save_CXXFLAGS=$CXXFLAGS
9249     save_CPPFLAGS=$CPPFLAGS
9250     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
9251     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
9252     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
9253     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
9254     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
9255                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
9256     CXXFLAGS=$save_CXXFLAGS
9257     CPPFLAGS=$save_CPPFLAGS
9258     AC_LANG_POP([C++])
9260     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
9261 else
9262     AC_MSG_RESULT([internal])
9263     SYSTEM_CLUCENE=
9264     BUILD_TYPE="$BUILD_TYPE CLUCENE"
9267 AC_SUBST(SYSTEM_CLUCENE)
9268 AC_SUBST(CLUCENE_CFLAGS)
9269 AC_SUBST(CLUCENE_LIBS)
9271 dnl ===================================================================
9272 dnl Check for system expat
9273 dnl ===================================================================
9274 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
9276 dnl ===================================================================
9277 dnl Check for system xmlsec
9278 dnl ===================================================================
9279 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
9281 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
9282 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
9283     ENABLE_EOT="TRUE"
9284     AC_DEFINE([ENABLE_EOT])
9285     AC_MSG_RESULT([yes])
9287     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
9288 else
9289     ENABLE_EOT=
9290     AC_MSG_RESULT([no])
9292 AC_SUBST([ENABLE_EOT])
9294 dnl ===================================================================
9295 dnl Check for DLP libs
9296 dnl ===================================================================
9297 AS_IF([test "$COM" = "MSC"],
9298       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
9299       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
9301 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
9303 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
9305 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
9307 AS_IF([test "$COM" = "MSC"],
9308       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
9309       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
9311 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
9313 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
9315 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
9316 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.12])
9318 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
9320 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
9322 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
9324 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
9325 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.19])
9327 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
9328 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.10])
9330 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
9332 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
9333 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
9335 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
9337 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
9339 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
9341 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
9343 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
9344 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.7])
9346 dnl ===================================================================
9347 dnl Check for system lcms2
9348 dnl ===================================================================
9349 if test "$with_system_lcms2" != "yes"; then
9350     SYSTEM_LCMS2=
9352 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
9353 if test "$GCC" = "yes"; then
9354     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
9356 if test "$COM" = "MSC"; then # override the above
9357     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
9360 dnl ===================================================================
9361 dnl Check for system cppunit
9362 dnl ===================================================================
9363 if test "$_os" != "Android" ; then
9364     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
9367 dnl ===================================================================
9368 dnl Check whether freetype is available
9369 dnl ===================================================================
9370 if test "$using_freetype_fontconfig" = yes; then
9371     AC_MSG_CHECKING([which freetype to use])
9373 if test "$using_freetype_fontconfig" = yes -a "$test_system_freetype" != no; then
9374     AC_MSG_RESULT([external])
9375     # FreeType has 3 different kinds of versions
9376     # * release, like 2.4.10
9377     # * libtool, like 13.0.7 (this what pkg-config returns)
9378     # * soname
9379     # FreeType's docs/VERSION.DLL provides a table mapping between the three
9380     #
9381     # 9.9.3 is 2.2.0
9382     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
9383     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9384     FilterLibs "${FREETYPE_LIBS}"
9385     FREETYPE_LIBS="${filteredlibs}"
9386     SYSTEM_FREETYPE=TRUE
9387 elif test "$using_freetype_fontconfig" = yes; then
9388     AC_MSG_RESULT([internal])
9389     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
9390     if test "x$ac_config_site_64bit_host" = xYES; then
9391         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
9392     else
9393         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
9394     fi
9395     BUILD_TYPE="$BUILD_TYPE FREETYPE"
9397 AC_SUBST(FREETYPE_CFLAGS)
9398 AC_SUBST(FREETYPE_LIBS)
9399 AC_SUBST([SYSTEM_FREETYPE])
9401 # ===================================================================
9402 # Check for system libxslt
9403 # to prevent incompatibilities between internal libxml2 and external libxslt,
9404 # or vice versa, use with_system_libxml here
9405 # ===================================================================
9406 if test "$with_system_libxml" = "auto"; then
9407     case "$_os" in
9408     WINNT|iOS|Android)
9409         with_system_libxml="$with_system_libs"
9410         ;;
9411     Emscripten)
9412         with_system_libxml=no
9413         ;;
9414     *)
9415         if test "$enable_fuzzers" != "yes"; then
9416             with_system_libxml=yes
9417         else
9418             with_system_libxml=no
9419         fi
9420         ;;
9421     esac
9424 AC_MSG_CHECKING([which libxslt to use])
9425 if test "$with_system_libxml" = "yes"; then
9426     AC_MSG_RESULT([external])
9427     SYSTEM_LIBXSLT=TRUE
9428     if test "$_os" = "Darwin"; then
9429         dnl make sure to use SDK path
9430         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9431         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
9432         dnl omit -L/usr/lib
9433         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
9434         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
9435     else
9436         PKG_CHECK_MODULES(LIBXSLT, libxslt)
9437         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9438         FilterLibs "${LIBXSLT_LIBS}"
9439         LIBXSLT_LIBS="${filteredlibs}"
9440         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
9441         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9442         FilterLibs "${LIBEXSLT_LIBS}"
9443         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
9444     fi
9446     dnl Check for xsltproc
9447     AC_PATH_PROG(XSLTPROC, xsltproc, no)
9448     if test "$XSLTPROC" = "no"; then
9449         AC_MSG_ERROR([xsltproc is required])
9450     fi
9451 else
9452     AC_MSG_RESULT([internal])
9453     SYSTEM_LIBXSLT=
9454     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
9456 AC_SUBST(SYSTEM_LIBXSLT)
9457 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
9458     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
9460 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
9462 AC_SUBST(LIBEXSLT_CFLAGS)
9463 AC_SUBST(LIBEXSLT_LIBS)
9464 AC_SUBST(LIBXSLT_CFLAGS)
9465 AC_SUBST(LIBXSLT_LIBS)
9466 AC_SUBST(XSLTPROC)
9468 # ===================================================================
9469 # Check for system libxml
9470 # ===================================================================
9471 AC_MSG_CHECKING([which libxml to use])
9472 if test "$with_system_libxml" = "yes"; then
9473     AC_MSG_RESULT([external])
9474     SYSTEM_LIBXML=TRUE
9475     if test "$_os" = "Darwin"; then
9476         dnl make sure to use SDK path
9477         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9478         dnl omit -L/usr/lib
9479         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
9480     elif test $_os = iOS; then
9481         dnl make sure to use SDK path
9482         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
9483         LIBXML_CFLAGS="-I$usr/include/libxml2"
9484         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
9485     else
9486         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
9487         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9488         FilterLibs "${LIBXML_LIBS}"
9489         LIBXML_LIBS="${filteredlibs}"
9490     fi
9492     dnl Check for xmllint
9493     AC_PATH_PROG(XMLLINT, xmllint, no)
9494     if test "$XMLLINT" = "no"; then
9495         AC_MSG_ERROR([xmllint is required])
9496     fi
9497 else
9498     AC_MSG_RESULT([internal])
9499     SYSTEM_LIBXML=
9500     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
9501     if test "$COM" = "MSC"; then
9502         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9503     fi
9504     if test "$COM" = "MSC"; then
9505         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
9506     else
9507         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
9508         if test "$_os" = Android; then
9509             LIBXML_LIBS="$LIBXML_LIBS -lm"
9510         fi
9511     fi
9512     BUILD_TYPE="$BUILD_TYPE LIBXML2"
9514 AC_SUBST(SYSTEM_LIBXML)
9515 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
9516     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
9518 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
9519 AC_SUBST(LIBXML_CFLAGS)
9520 AC_SUBST(LIBXML_LIBS)
9521 AC_SUBST(XMLLINT)
9523 # =====================================================================
9524 # Checking for a Python interpreter with version >= 3.3.
9525 # Optionally user can pass an option to configure, i. e.
9526 # ./configure PYTHON=/usr/bin/python
9527 # =====================================================================
9528 if test $_os = Darwin -a "$enable_python" != no -a "$enable_python" != fully-internal -a "$enable_python" != internal -a "$enable_python" != system; then
9529     # Only allowed choices for macOS are 'no', 'internal' (default), and 'fully-internal'
9530     # unless PYTHON is defined as above which allows 'system'
9531     enable_python=internal
9533 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
9534     if test -n "$PYTHON"; then
9535         PYTHON_FOR_BUILD=$PYTHON
9536     else
9537         # This allows a lack of system python with no error, we use internal one in that case.
9538         AM_PATH_PYTHON([3.3],, [:])
9539         # Clean PYTHON_VERSION checked below if cross-compiling
9540         PYTHON_VERSION=""
9541         if test "$PYTHON" != ":"; then
9542             PYTHON_FOR_BUILD=$PYTHON
9543         fi
9544     fi
9546 AC_SUBST(PYTHON_FOR_BUILD)
9548 # Checks for Python to use for Pyuno
9549 AC_MSG_CHECKING([which Python to use for Pyuno])
9550 case "$enable_python" in
9551 no|disable)
9552     if test -z $PYTHON_FOR_BUILD; then
9553         # Python is required to build LibreOffice. In theory we could separate the build-time Python
9554         # requirement from the choice whether to include Python stuff in the installer, but why
9555         # bother?
9556         if test "$cross_compiling" = yes; then
9557             enable_python=system
9558         else
9559             AC_MSG_ERROR([Python is required at build time.])
9560         fi
9561     fi
9562     enable_python=no
9563     AC_MSG_RESULT([none])
9564     ;;
9565 ""|yes|auto)
9566     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
9567         AC_MSG_RESULT([no, overridden by --disable-scripting])
9568         enable_python=no
9569     elif test $build_os = cygwin; then
9570         dnl When building on Windows we don't attempt to use any installed
9571         dnl "system"  Python.
9572         AC_MSG_RESULT([fully internal])
9573         enable_python=internal
9574     elif test "$cross_compiling" = yes; then
9575         AC_MSG_RESULT([system])
9576         enable_python=system
9577     else
9578         # Unset variables set by the above AM_PATH_PYTHON so that
9579         # we actually do check anew.
9580         AC_MSG_RESULT([])
9581         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
9582         AM_PATH_PYTHON([3.3],, [:])
9583         AC_MSG_CHECKING([which Python to use for Pyuno])
9584         if test "$PYTHON" = ":"; then
9585             if test -z "$PYTHON_FOR_BUILD"; then
9586                 AC_MSG_RESULT([fully internal])
9587             else
9588                 AC_MSG_RESULT([internal])
9589             fi
9590             enable_python=internal
9591         else
9592             AC_MSG_RESULT([system])
9593             enable_python=system
9594         fi
9595     fi
9596     ;;
9597 internal)
9598     AC_MSG_RESULT([internal])
9599     ;;
9600 fully-internal)
9601     AC_MSG_RESULT([fully internal])
9602     enable_python=internal
9603     ;;
9604 system)
9605     AC_MSG_RESULT([system])
9606     if test "$_os" = Darwin -a -z "$PYTHON"; then
9607         AC_MSG_ERROR([--enable-python=system doesn't work on macOS because the version provided is obsolete])
9608     fi
9609     ;;
9611     AC_MSG_ERROR([Incorrect --enable-python option])
9612     ;;
9613 esac
9615 if test $enable_python != no; then
9616     BUILD_TYPE="$BUILD_TYPE PYUNO"
9619 if test $enable_python = system; then
9620     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
9621         # Fallback: Accept these in the environment, or as set above
9622         # for MacOSX.
9623         :
9624     elif test "$cross_compiling" != yes; then
9625         # Unset variables set by the above AM_PATH_PYTHON so that
9626         # we actually do check anew.
9627         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
9628         # This causes an error if no python command is found
9629         AM_PATH_PYTHON([3.3])
9630         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
9631         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
9632         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
9633         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
9634         if test -z "$PKG_CONFIG"; then
9635             PYTHON_CFLAGS="-I$python_include"
9636             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
9637         elif $PKG_CONFIG --exists python-$python_version-embed; then
9638             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
9639             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
9640         elif $PKG_CONFIG --exists python-$python_version; then
9641             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
9642             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
9643         else
9644             PYTHON_CFLAGS="-I$python_include"
9645             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
9646         fi
9647         FilterLibs "${PYTHON_LIBS}"
9648         PYTHON_LIBS="${filteredlibs}"
9649     else
9650         dnl How to find out the cross-compilation Python installation path?
9651         AC_MSG_CHECKING([for python version])
9652         AS_IF([test -n "$PYTHON_VERSION"],
9653               [AC_MSG_RESULT([$PYTHON_VERSION])],
9654               [AC_MSG_RESULT([not found])
9655                AC_MSG_ERROR([no usable python found])])
9656         test -n "$PYTHON_CFLAGS" && break
9657     fi
9659     dnl Check if the headers really work
9660     save_CPPFLAGS="$CPPFLAGS"
9661     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
9662     AC_CHECK_HEADER(Python.h)
9663     CPPFLAGS="$save_CPPFLAGS"
9665     # let the PYTHON_FOR_BUILD match the same python installation that
9666     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
9667     # better for PythonTests.
9668     PYTHON_FOR_BUILD=$PYTHON
9671 if test "$with_lxml" != no; then
9672     if test -z "$PYTHON_FOR_BUILD"; then
9673         case $build_os in
9674             cygwin)
9675                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
9676                 ;;
9677             *)
9678                 if test "$cross_compiling" != yes ; then
9679                     BUILD_TYPE="$BUILD_TYPE LXML"
9680                 fi
9681                 ;;
9682         esac
9683     else
9684         AC_MSG_CHECKING([for python lxml])
9685         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
9686             AC_MSG_RESULT([yes])
9687         else
9688             case $build_os in
9689                 cygwin)
9690                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
9691                     ;;
9692                 *)
9693                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
9694                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
9695                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
9696                         else
9697                             BUILD_TYPE="$BUILD_TYPE LXML"
9698                             AC_MSG_RESULT([no, using internal lxml])
9699                         fi
9700                     else
9701                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
9702                     fi
9703                     ;;
9704             esac
9705         fi
9706     fi
9709 dnl By now enable_python should be "system", "internal" or "no"
9710 case $enable_python in
9711 system)
9712     SYSTEM_PYTHON=TRUE
9714     if test "x$ac_cv_header_Python_h" != "xyes"; then
9715        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
9716     fi
9718     AC_LANG_PUSH(C)
9719     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
9720     AC_MSG_CHECKING([for correct python library version])
9721        AC_RUN_IFELSE([AC_LANG_SOURCE([[
9722 #include <Python.h>
9724 int main(int argc, char **argv) {
9725    if ((PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
9726    else return 1;
9728        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3])],[AC_MSG_RESULT([skipped; cross-compiling])])
9729     AC_LANG_POP(C)
9731     dnl FIXME Check if the Python library can be linked with, too?
9732     ;;
9734 internal)
9735     SYSTEM_PYTHON=
9736     PYTHON_VERSION_MAJOR=3
9737     PYTHON_VERSION_MINOR=8
9738     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.10
9739     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
9740         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
9741     fi
9742     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
9743     BUILD_TYPE="$BUILD_TYPE PYTHON"
9744     if test "$OS" = LINUX -o "$OS" = WNT ; then
9745         BUILD_TYPE="$BUILD_TYPE LIBFFI"
9746     fi
9747     # Embedded Python dies without Home set
9748     if test "$HOME" = ""; then
9749         export HOME=""
9750     fi
9751     ;;
9753     DISABLE_PYTHON=TRUE
9754     SYSTEM_PYTHON=
9755     ;;
9757     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
9758     ;;
9759 esac
9761 AC_SUBST(DISABLE_PYTHON)
9762 AC_SUBST(SYSTEM_PYTHON)
9763 AC_SUBST(PYTHON_CFLAGS)
9764 AC_SUBST(PYTHON_LIBS)
9765 AC_SUBST(PYTHON_VERSION)
9766 AC_SUBST(PYTHON_VERSION_MAJOR)
9767 AC_SUBST(PYTHON_VERSION_MINOR)
9769 AC_MSG_CHECKING([whether to build LibreLogo])
9770 case "$enable_python" in
9771 no|disable)
9772     AC_MSG_RESULT([no; Python disabled])
9773     ;;
9775     if test "${enable_librelogo}" = "no"; then
9776         AC_MSG_RESULT([no])
9777     else
9778         AC_MSG_RESULT([yes])
9779         BUILD_TYPE="${BUILD_TYPE} LIBRELOGO"
9780         AC_DEFINE([ENABLE_LIBRELOGO],1)
9781     fi
9782     ;;
9783 esac
9784 AC_SUBST(ENABLE_LIBRELOGO)
9786 ENABLE_MARIADBC=
9787 MARIADBC_MAJOR=1
9788 MARIADBC_MINOR=0
9789 MARIADBC_MICRO=2
9790 AC_MSG_CHECKING([whether to build the MariaDB/MySQL SDBC driver])
9791 if test "x$enable_mariadb_sdbc" != "xno" -a "$enable_mpl_subset" != "yes"; then
9792     ENABLE_MARIADBC=TRUE
9793     AC_MSG_RESULT([yes])
9794     BUILD_TYPE="$BUILD_TYPE MARIADBC"
9795 else
9796     AC_MSG_RESULT([no])
9798 AC_SUBST(ENABLE_MARIADBC)
9799 AC_SUBST(MARIADBC_MAJOR)
9800 AC_SUBST(MARIADBC_MINOR)
9801 AC_SUBST(MARIADBC_MICRO)
9803 if test "$ENABLE_MARIADBC" = "TRUE"; then
9804     dnl ===================================================================
9805     dnl Check for system MariaDB
9806     dnl ===================================================================
9807     AC_MSG_CHECKING([which MariaDB to use])
9808     if test "$with_system_mariadb" = "yes"; then
9809         AC_MSG_RESULT([external])
9810         SYSTEM_MARIADB_CONNECTOR_C=TRUE
9811         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
9812         if test -z "$MARIADBCONFIG"; then
9813             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
9814             if test -z "$MARIADBCONFIG"; then
9815                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
9816                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
9817             fi
9818         fi
9819         AC_MSG_CHECKING([MariaDB version])
9820         MARIADB_VERSION=`$MARIADBCONFIG --version`
9821         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
9822         if test "$MARIADB_MAJOR" -ge "5"; then
9823             AC_MSG_RESULT([OK])
9824         else
9825             AC_MSG_ERROR([too old, use 5.0.x or later])
9826         fi
9827         AC_MSG_CHECKING([for MariaDB Client library])
9828         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
9829         if test "$COM_IS_CLANG" = TRUE; then
9830             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
9831         fi
9832         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
9833         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
9834         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
9835         dnl linux32:
9836         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
9837             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
9838             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
9839                 | sed -e 's|/lib64/|/lib/|')
9840         fi
9841         FilterLibs "${MARIADB_LIBS}"
9842         MARIADB_LIBS="${filteredlibs}"
9843         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
9844         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
9845         if test "$enable_bundle_mariadb" = "yes"; then
9846             AC_MSG_RESULT([yes])
9847             BUNDLE_MARIADB_CONNECTOR_C=TRUE
9848             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
9850 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
9852 /g' | grep -E '(mysqlclient|mariadb)')
9853             if test "$_os" = "Darwin"; then
9854                 LIBMARIADB=${LIBMARIADB}.dylib
9855             elif test "$_os" = "WINNT"; then
9856                 LIBMARIADB=${LIBMARIADB}.dll
9857             else
9858                 LIBMARIADB=${LIBMARIADB}.so
9859             fi
9860             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
9861             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
9862             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
9863                 AC_MSG_RESULT([found.])
9864                 PathFormat "$LIBMARIADB_PATH"
9865                 LIBMARIADB_PATH="$formatted_path"
9866             else
9867                 AC_MSG_ERROR([not found.])
9868             fi
9869         else
9870             AC_MSG_RESULT([no])
9871             BUNDLE_MARIADB_CONNECTOR_C=
9872         fi
9873     else
9874         AC_MSG_RESULT([internal])
9875         SYSTEM_MARIADB_CONNECTOR_C=
9876         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
9877         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
9878         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
9879     fi
9881     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
9882     AC_SUBST(MARIADB_CFLAGS)
9883     AC_SUBST(MARIADB_LIBS)
9884     AC_SUBST(LIBMARIADB)
9885     AC_SUBST(LIBMARIADB_PATH)
9886     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
9889 dnl ===================================================================
9890 dnl Check for system hsqldb
9891 dnl ===================================================================
9892 if test "$with_java" != "no" -a "$cross_compiling" != "yes"; then
9893     HSQLDB_USE_JDBC_4_1=
9894     AC_MSG_CHECKING([which hsqldb to use])
9895     if test "$with_system_hsqldb" = "yes"; then
9896         AC_MSG_RESULT([external])
9897         SYSTEM_HSQLDB=TRUE
9898         if test -z $HSQLDB_JAR; then
9899             HSQLDB_JAR=/usr/share/java/hsqldb.jar
9900         fi
9901         if ! test -f $HSQLDB_JAR; then
9902                AC_MSG_ERROR(hsqldb.jar not found.)
9903         fi
9904         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
9905         export HSQLDB_JAR
9906         if $PERL -e \
9907            'use Archive::Zip;
9908             my $file = "$ENV{'HSQLDB_JAR'}";
9909             my $zip = Archive::Zip->new( $file );
9910             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
9911             if ( $mf =~ m/Specification-Version: 1.8.*/ )
9912             {
9913                 push @l, split(/\n/, $mf);
9914                 foreach my $line (@l)
9915                 {
9916                     if ($line =~ m/Specification-Version:/)
9917                     {
9918                         ($t, $version) = split (/:/,$line);
9919                         $version =~ s/^\s//;
9920                         ($a, $b, $c, $d) = split (/\./,$version);
9921                         if ($c == "0" && $d > "8")
9922                         {
9923                             exit 0;
9924                         }
9925                         else
9926                         {
9927                             exit 1;
9928                         }
9929                     }
9930                 }
9931             }
9932             else
9933             {
9934                 exit 1;
9935             }'; then
9936             AC_MSG_RESULT([yes])
9937         else
9938             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
9939         fi
9940     else
9941         AC_MSG_RESULT([internal])
9942         SYSTEM_HSQLDB=
9943         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9944         NEED_ANT=TRUE
9945         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
9946         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
9947         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
9948             AC_MSG_RESULT([yes])
9949             HSQLDB_USE_JDBC_4_1=TRUE
9950         else
9951             AC_MSG_RESULT([no])
9952         fi
9953     fi
9954 else
9955     if test "$with_java" != "no" -a -z "$HSQLDB_JAR"; then
9956         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9957     fi
9959 AC_SUBST(SYSTEM_HSQLDB)
9960 AC_SUBST(HSQLDB_JAR)
9961 AC_SUBST([HSQLDB_USE_JDBC_4_1])
9963 dnl ===================================================================
9964 dnl Check for PostgreSQL stuff
9965 dnl ===================================================================
9966 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
9967 if test "x$enable_postgresql_sdbc" != "xno"; then
9968     AC_MSG_RESULT([yes])
9969     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
9971     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
9972         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
9973     fi
9974     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
9975         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
9976     fi
9978     postgres_interface=""
9979     if test "$with_system_postgresql" = "yes"; then
9980         postgres_interface="external PostgreSQL"
9981         SYSTEM_POSTGRESQL=TRUE
9982         if test "$_os" = Darwin; then
9983             supp_path=''
9984             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
9985                 pg_supp_path="$P_SEP$d$pg_supp_path"
9986             done
9987         fi
9988         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
9989         if test -n "$PGCONFIG"; then
9990             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
9991             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
9992         else
9993             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
9994               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
9995               POSTGRESQL_LIB=$POSTGRESQL_LIBS
9996             ],[
9997               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
9998             ])
9999         fi
10000         FilterLibs "${POSTGRESQL_LIB}"
10001         POSTGRESQL_LIB="${filteredlibs}"
10002     else
10003         # if/when anything else than PostgreSQL uses Kerberos,
10004         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
10005         WITH_KRB5=
10006         WITH_GSSAPI=
10007         case "$_os" in
10008         Darwin)
10009             # macOS has system MIT Kerberos 5 since 10.4
10010             if test "$with_krb5" != "no"; then
10011                 WITH_KRB5=TRUE
10012                 save_LIBS=$LIBS
10013                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
10014                 # that the libraries where these functions are located on macOS will change, is it?
10015                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10016                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10017                 KRB5_LIBS=$LIBS
10018                 LIBS=$save_LIBS
10019                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10020                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10021                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10022                 LIBS=$save_LIBS
10023             fi
10024             if test "$with_gssapi" != "no"; then
10025                 WITH_GSSAPI=TRUE
10026                 save_LIBS=$LIBS
10027                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10028                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10029                 GSSAPI_LIBS=$LIBS
10030                 LIBS=$save_LIBS
10031             fi
10032             ;;
10033         WINNT)
10034             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
10035                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
10036             fi
10037             ;;
10038         Linux|GNU|*BSD|DragonFly)
10039             if test "$with_krb5" != "no"; then
10040                 WITH_KRB5=TRUE
10041                 save_LIBS=$LIBS
10042                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10043                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10044                 KRB5_LIBS=$LIBS
10045                 LIBS=$save_LIBS
10046                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10047                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10048                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10049                 LIBS=$save_LIBS
10050             fi
10051             if test "$with_gssapi" != "no"; then
10052                 WITH_GSSAPI=TRUE
10053                 save_LIBS=$LIBS
10054                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10055                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10056                 GSSAPI_LIBS=$LIBS
10057                 LIBS=$save_LIBS
10058             fi
10059             ;;
10060         *)
10061             if test "$with_krb5" = "yes"; then
10062                 WITH_KRB5=TRUE
10063                 save_LIBS=$LIBS
10064                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10065                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10066                 KRB5_LIBS=$LIBS
10067                 LIBS=$save_LIBS
10068                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10069                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10070                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10071                 LIBS=$save_LIBS
10072             fi
10073             if test "$with_gssapi" = "yes"; then
10074                 WITH_GSSAPI=TRUE
10075                 save_LIBS=$LIBS
10076                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10077                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10078                 LIBS=$save_LIBS
10079                 GSSAPI_LIBS=$LIBS
10080             fi
10081         esac
10083         if test -n "$with_libpq_path"; then
10084             SYSTEM_POSTGRESQL=TRUE
10085             postgres_interface="external libpq"
10086             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
10087             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
10088         else
10089             SYSTEM_POSTGRESQL=
10090             postgres_interface="internal"
10091             POSTGRESQL_LIB=""
10092             POSTGRESQL_INC="%OVERRIDE_ME%"
10093             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
10094         fi
10095     fi
10097     AC_MSG_CHECKING([PostgreSQL C interface])
10098     AC_MSG_RESULT([$postgres_interface])
10100     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
10101         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
10102         save_CFLAGS=$CFLAGS
10103         save_CPPFLAGS=$CPPFLAGS
10104         save_LIBS=$LIBS
10105         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
10106         LIBS="${LIBS} ${POSTGRESQL_LIB}"
10107         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
10108         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
10109             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
10110         CFLAGS=$save_CFLAGS
10111         CPPFLAGS=$save_CPPFLAGS
10112         LIBS=$save_LIBS
10113     fi
10114     BUILD_POSTGRESQL_SDBC=TRUE
10115 else
10116     AC_MSG_RESULT([no])
10118 AC_SUBST(WITH_KRB5)
10119 AC_SUBST(WITH_GSSAPI)
10120 AC_SUBST(GSSAPI_LIBS)
10121 AC_SUBST(KRB5_LIBS)
10122 AC_SUBST(BUILD_POSTGRESQL_SDBC)
10123 AC_SUBST(SYSTEM_POSTGRESQL)
10124 AC_SUBST(POSTGRESQL_INC)
10125 AC_SUBST(POSTGRESQL_LIB)
10127 dnl ===================================================================
10128 dnl Check for Firebird stuff
10129 dnl ===================================================================
10130 ENABLE_FIREBIRD_SDBC=
10131 if test "$enable_firebird_sdbc" = "yes" ; then
10132     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
10134     dnl ===================================================================
10135     dnl Check for system Firebird
10136     dnl ===================================================================
10137     AC_MSG_CHECKING([which Firebird to use])
10138     if test "$with_system_firebird" = "yes"; then
10139         AC_MSG_RESULT([external])
10140         SYSTEM_FIREBIRD=TRUE
10141         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
10142         if test -z "$FIREBIRDCONFIG"; then
10143             AC_MSG_NOTICE([No fb_config -- using pkg-config])
10144             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
10145                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
10146             ])
10147             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
10148         else
10149             AC_MSG_NOTICE([fb_config found])
10150             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
10151             AC_MSG_CHECKING([for Firebird Client library])
10152             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
10153             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
10154             FilterLibs "${FIREBIRD_LIBS}"
10155             FIREBIRD_LIBS="${filteredlibs}"
10156         fi
10157         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
10158         AC_MSG_CHECKING([Firebird version])
10159         if test -n "${FIREBIRD_VERSION}"; then
10160             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
10161             if test "$FIREBIRD_MAJOR" -ge "3"; then
10162                 AC_MSG_RESULT([OK])
10163             else
10164                 AC_MSG_ERROR([Ensure firebird >= 3 is installed])
10165             fi
10166         else
10167             save_CFLAGS="${CFLAGS}"
10168             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
10169             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
10170 #if defined(FB_API_VER) && FB_API_VER == 30
10171 int fb_api_is_30(void) { return 0; }
10172 #else
10173 #error "Wrong Firebird API version"
10174 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
10175             CFLAGS="$save_CFLAGS"
10176         fi
10177         ENABLE_FIREBIRD_SDBC=TRUE
10178         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10179     elif test "$enable_database_connectivity" = no; then
10180         AC_MSG_RESULT([none])
10181     elif test "$cross_compiling" = "yes"; then
10182         AC_MSG_RESULT([none])
10183     else
10184         dnl Embedded Firebird has version 3.0
10185         dnl We need libatomic_ops for any non X86/X64 system
10186         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
10187             dnl ===================================================================
10188             dnl Check for system libatomic_ops
10189             dnl ===================================================================
10190             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[LIBATOMIC_OPS],[atomic_ops >= 0.7.2])
10191             if test "$with_system_libatomic_ops" = "yes"; then
10192                 SYSTEM_LIBATOMIC_OPS=TRUE
10193                 AC_CHECK_HEADERS(atomic_ops.h, [],
10194                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
10195             else
10196                 SYSTEM_LIBATOMIC_OPS=
10197                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
10198                 LIBATOMIC_OPS_LIBS="-latomic_ops"
10199                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
10200             fi
10201         fi
10203         AC_MSG_RESULT([internal])
10204         SYSTEM_FIREBIRD=
10205         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
10206         FIREBIRD_LIBS="-lfbclient"
10208         if test "$with_system_libtommath" = "yes"; then
10209             SYSTEM_LIBTOMMATH=TRUE
10210             dnl check for tommath presence
10211             save_LIBS=$LIBS
10212             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
10213             AC_CHECK_LIB(tommath, mp_init, LIBTOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
10214             LIBS=$save_LIBS
10215         else
10216             SYSTEM_LIBTOMMATH=
10217             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
10218             LIBTOMMATH_LIBS="-ltommath"
10219             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
10220         fi
10222         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
10223         ENABLE_FIREBIRD_SDBC=TRUE
10224         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10225     fi
10227 AC_SUBST(ENABLE_FIREBIRD_SDBC)
10228 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
10229 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
10230 AC_SUBST(LIBATOMIC_OPS_LIBS)
10231 AC_SUBST(SYSTEM_FIREBIRD)
10232 AC_SUBST(FIREBIRD_CFLAGS)
10233 AC_SUBST(FIREBIRD_LIBS)
10234 AC_SUBST(SYSTEM_LIBTOMMATH)
10235 AC_SUBST(LIBTOMMATH_CFLAGS)
10236 AC_SUBST(LIBTOMMATH_LIBS)
10238 dnl ===================================================================
10239 dnl Check for system curl
10240 dnl ===================================================================
10241 AC_MSG_CHECKING([which libcurl to use])
10242 if test "$with_system_curl" = "auto"; then
10243     with_system_curl="$with_system_libs"
10246 if test "$test_curl" = "yes" -a "$enable_curl" = "yes" -a "$with_system_curl" = "yes"; then
10247     AC_MSG_RESULT([external])
10248     SYSTEM_CURL=TRUE
10250     # First try PKGCONFIG and then fall back
10251     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
10253     if test -n "$CURL_PKG_ERRORS"; then
10254         AC_PATH_PROG(CURLCONFIG, curl-config)
10255         if test -z "$CURLCONFIG"; then
10256             AC_MSG_ERROR([curl development files not found])
10257         fi
10258         CURL_LIBS=`$CURLCONFIG --libs`
10259         FilterLibs "${CURL_LIBS}"
10260         CURL_LIBS="${filteredlibs}"
10261         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
10262         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
10264         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
10265         case $curl_version in
10266         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
10267         dnl so they need to be doubled to end up in the configure script
10268         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
10269             AC_MSG_RESULT([yes])
10270             ;;
10271         *)
10272             AC_MSG_ERROR([no, you have $curl_version])
10273             ;;
10274         esac
10275     fi
10277     ENABLE_CURL=TRUE
10278 elif test "$test_curl" = "no"; then
10279     AC_MSG_RESULT([none])
10280 else
10281     AC_MSG_RESULT([internal])
10282     SYSTEM_CURL=
10283     BUILD_TYPE="$BUILD_TYPE CURL"
10284     ENABLE_CURL=TRUE
10286 AC_SUBST(SYSTEM_CURL)
10287 AC_SUBST(CURL_CFLAGS)
10288 AC_SUBST(CURL_LIBS)
10289 AC_SUBST(ENABLE_CURL)
10291 dnl ===================================================================
10292 dnl Check for system boost
10293 dnl ===================================================================
10294 AC_MSG_CHECKING([which boost to use])
10295 if test "$with_system_boost" = "yes"; then
10296     AC_MSG_RESULT([external])
10297     SYSTEM_BOOST=TRUE
10298     AX_BOOST_BASE([1.66],,[AC_MSG_ERROR([no suitable Boost found])])
10299     AX_BOOST_DATE_TIME
10300     AX_BOOST_FILESYSTEM
10301     AX_BOOST_IOSTREAMS
10302     AX_BOOST_LOCALE
10303     AC_LANG_PUSH([C++])
10304     save_CXXFLAGS=$CXXFLAGS
10305     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
10306     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
10307        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
10308     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
10309        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
10310     CXXFLAGS=$save_CXXFLAGS
10311     AC_LANG_POP([C++])
10312     # this is in m4/ax_boost_base.m4
10313     FilterLibs "${BOOST_LDFLAGS}"
10314     BOOST_LDFLAGS="${filteredlibs}"
10315 else
10316     AC_MSG_RESULT([internal])
10317     BUILD_TYPE="$BUILD_TYPE BOOST"
10318     SYSTEM_BOOST=
10319     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
10320         # use warning-suppressing wrapper headers
10321         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
10322     else
10323         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
10324     fi
10326 AC_SUBST(SYSTEM_BOOST)
10328 dnl ===================================================================
10329 dnl Check for system mdds
10330 dnl ===================================================================
10331 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
10333 dnl ===================================================================
10334 dnl Check for system glm
10335 dnl ===================================================================
10336 AC_MSG_CHECKING([which glm to use])
10337 if test "$with_system_glm" = "yes"; then
10338     AC_MSG_RESULT([external])
10339     SYSTEM_GLM=TRUE
10340     AC_LANG_PUSH([C++])
10341     AC_CHECK_HEADER([glm/glm.hpp], [],
10342        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
10343     AC_LANG_POP([C++])
10344 else
10345     AC_MSG_RESULT([internal])
10346     BUILD_TYPE="$BUILD_TYPE GLM"
10347     SYSTEM_GLM=
10348     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
10350 AC_SUBST([GLM_CFLAGS])
10351 AC_SUBST([SYSTEM_GLM])
10353 dnl ===================================================================
10354 dnl Check for system odbc
10355 dnl ===================================================================
10356 AC_MSG_CHECKING([which odbc headers to use])
10357 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
10358     AC_MSG_RESULT([external])
10359     SYSTEM_ODBC_HEADERS=TRUE
10361     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
10362         save_CPPFLAGS=$CPPFLAGS
10363         find_winsdk
10364         PathFormat "$winsdktest"
10365         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"
10366         AC_CHECK_HEADER(sqlext.h, [],
10367             [AC_MSG_ERROR(odbc not found. install odbc)],
10368             [#include <windows.h>])
10369         CPPFLAGS=$save_CPPFLAGS
10370     else
10371         AC_CHECK_HEADER(sqlext.h, [],
10372             [AC_MSG_ERROR(odbc not found. install odbc)],[])
10373     fi
10374 elif test "$enable_database_connectivity" = no; then
10375     AC_MSG_RESULT([none])
10376 else
10377     AC_MSG_RESULT([internal])
10378     SYSTEM_ODBC_HEADERS=
10380 AC_SUBST(SYSTEM_ODBC_HEADERS)
10382 dnl ===================================================================
10383 dnl Check for system NSS
10384 dnl ===================================================================
10385 if test "$enable_fuzzers" != "yes" -a "$enable_nss" = "yes"; then
10386     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
10387     AC_DEFINE(HAVE_FEATURE_NSS)
10388     ENABLE_NSS=TRUE
10389 elif test $_os != iOS ; then
10390     with_tls=openssl
10392 AC_SUBST(ENABLE_NSS)
10394 dnl ===================================================================
10395 dnl Enable LDAP support
10396 dnl ===================================================================
10398 if test "$test_openldap" = yes; then
10399     AC_MSG_CHECKING([whether to enable LDAP support])
10400     if test "$enable_ldap" = yes -a \( "$ENABLE_NSS" = TRUE -o "$with_system_openldap" = yes \); then
10401         AC_MSG_RESULT([yes])
10402         ENABLE_LDAP=TRUE
10403     else
10404         if test "$enable_ldap" != "yes"; then
10405             AC_MSG_RESULT([no])
10406         else
10407             AC_MSG_RESULT([no (needs NSS or system openldap)])
10408         fi
10409     fi
10411 dnl ===================================================================
10412 dnl Check for system openldap
10413 dnl ===================================================================
10415     if test "$ENABLE_LDAP" = TRUE; then
10416         AC_MSG_CHECKING([which openldap library to use])
10417         if test "$with_system_openldap" = yes; then
10418             AC_MSG_RESULT([external])
10419             SYSTEM_OPENLDAP=TRUE
10420             AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
10421             AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10422             AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10423         else
10424             AC_MSG_RESULT([internal])
10425             BUILD_TYPE="$BUILD_TYPE OPENLDAP"
10426         fi
10427     fi
10430 AC_SUBST(ENABLE_LDAP)
10431 AC_SUBST(SYSTEM_OPENLDAP)
10433 dnl ===================================================================
10434 dnl Check for TLS/SSL and cryptographic implementation to use
10435 dnl ===================================================================
10436 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
10437 if test -n "$with_tls"; then
10438     case $with_tls in
10439     openssl)
10440         AC_DEFINE(USE_TLS_OPENSSL)
10441         TLS=OPENSSL
10442         AC_MSG_RESULT([$TLS])
10444         if test "$enable_openssl" != "yes"; then
10445             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
10446         fi
10448         # warn that OpenSSL has been selected but not all TLS code has this option
10449         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
10450         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
10451         ;;
10452     nss)
10453         AC_DEFINE(USE_TLS_NSS)
10454         TLS=NSS
10455         AC_MSG_RESULT([$TLS])
10456         ;;
10457     no)
10458         AC_MSG_RESULT([none])
10459         AC_MSG_WARN([Skipping TLS/SSL])
10460         ;;
10461     *)
10462         AC_MSG_RESULT([])
10463         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
10464 openssl - OpenSSL
10465 nss - Mozilla's Network Security Services (NSS)
10466     ])
10467         ;;
10468     esac
10469 else
10470     # default to using NSS, it results in smaller oox lib
10471     AC_DEFINE(USE_TLS_NSS)
10472     TLS=NSS
10473     AC_MSG_RESULT([$TLS])
10475 AC_SUBST(TLS)
10477 dnl ===================================================================
10478 dnl Check for system sane
10479 dnl ===================================================================
10480 AC_MSG_CHECKING([which sane header to use])
10481 if test "$with_system_sane" = "yes"; then
10482     AC_MSG_RESULT([external])
10483     AC_CHECK_HEADER(sane/sane.h, [],
10484       [AC_MSG_ERROR(sane not found. install sane)], [])
10485 else
10486     AC_MSG_RESULT([internal])
10487     BUILD_TYPE="$BUILD_TYPE SANE"
10490 dnl ===================================================================
10491 dnl Check for system icu
10492 dnl ===================================================================
10493 SYSTEM_GENBRK=
10494 SYSTEM_GENCCODE=
10495 SYSTEM_GENCMN=
10497 ICU_MAJOR=69
10498 ICU_MINOR=1
10499 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
10500 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
10501 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
10502 AC_MSG_CHECKING([which icu to use])
10503 if test "$with_system_icu" = "yes"; then
10504     AC_MSG_RESULT([external])
10505     SYSTEM_ICU=TRUE
10506     AC_LANG_PUSH([C++])
10507     AC_MSG_CHECKING([for unicode/rbbi.h])
10508     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
10509     AC_LANG_POP([C++])
10511     if test "$cross_compiling" != "yes"; then
10512         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
10513         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
10514         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
10515         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
10516     fi
10518     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
10519         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
10520         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
10521         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
10522         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
10523         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
10524             AC_MSG_RESULT([yes])
10525         else
10526             AC_MSG_RESULT([no])
10527             if test "$with_system_icu_for_build" != "force"; then
10528                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
10529 You can use --with-system-icu-for-build=force to use it anyway.])
10530             fi
10531         fi
10532     fi
10534     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
10535         # using the system icu tools can lead to version confusion, use the
10536         # ones from the build environment when cross-compiling
10537         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
10538         if test -z "$SYSTEM_GENBRK"; then
10539             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
10540         fi
10541         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
10542         if test -z "$SYSTEM_GENCCODE"; then
10543             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
10544         fi
10545         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
10546         if test -z "$SYSTEM_GENCMN"; then
10547             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
10548         fi
10549         if test "$ICU_MAJOR" -ge "49"; then
10550             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
10551             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
10552             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
10553         else
10554             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
10555             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
10556             ICU_RECLASSIFIED_HEBREW_LETTER=
10557         fi
10558     fi
10560     if test "$cross_compiling" = "yes"; then
10561         if test "$ICU_MAJOR" -ge "50"; then
10562             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
10563             ICU_MINOR=""
10564         fi
10565     fi
10566 else
10567     AC_MSG_RESULT([internal])
10568     SYSTEM_ICU=
10569     BUILD_TYPE="$BUILD_TYPE ICU"
10570     # surprisingly set these only for "internal" (to be used by various other
10571     # external libs): the system icu-config is quite unhelpful and spits out
10572     # dozens of weird flags and also default path -I/usr/include
10573     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
10574     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
10576 if test "$ICU_MAJOR" -ge "59"; then
10577     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
10578     # with -std=c++11 but not all external libraries can be built with that,
10579     # for those use a bit-compatible typedef uint16_t UChar; see
10580     # icu/source/common/unicode/umachine.h
10581     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
10582 else
10583     ICU_UCHAR_TYPE=""
10585 AC_SUBST(SYSTEM_ICU)
10586 AC_SUBST(SYSTEM_GENBRK)
10587 AC_SUBST(SYSTEM_GENCCODE)
10588 AC_SUBST(SYSTEM_GENCMN)
10589 AC_SUBST(ICU_MAJOR)
10590 AC_SUBST(ICU_MINOR)
10591 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
10592 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
10593 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
10594 AC_SUBST(ICU_CFLAGS)
10595 AC_SUBST(ICU_LIBS)
10596 AC_SUBST(ICU_UCHAR_TYPE)
10598 dnl ==================================================================
10599 dnl Breakpad
10600 dnl ==================================================================
10601 DEFAULT_CRASHDUMP_VALUE="true"
10602 AC_MSG_CHECKING([whether to enable breakpad])
10603 if test "$enable_breakpad" != yes; then
10604     AC_MSG_RESULT([no])
10605 else
10606     AC_MSG_RESULT([yes])
10607     ENABLE_BREAKPAD="TRUE"
10608     AC_DEFINE(ENABLE_BREAKPAD)
10609     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
10610     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
10612     AC_MSG_CHECKING([for disable crash dump])
10613     if test "$enable_crashdump" = no; then
10614         DEFAULT_CRASHDUMP_VALUE="false"
10615         AC_MSG_RESULT([yes])
10616     else
10617        AC_MSG_RESULT([no])
10618     fi
10620     AC_MSG_CHECKING([for crashreport config])
10621     if test "$with_symbol_config" = "no"; then
10622         BREAKPAD_SYMBOL_CONFIG="invalid"
10623         AC_MSG_RESULT([no])
10624     else
10625         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
10626         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
10627         AC_MSG_RESULT([yes])
10628     fi
10629     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
10631 AC_SUBST(ENABLE_BREAKPAD)
10632 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
10634 dnl ==================================================================
10635 dnl libfuzzer
10636 dnl ==================================================================
10637 AC_MSG_CHECKING([whether to enable fuzzers])
10638 if test "$enable_fuzzers" != yes; then
10639     AC_MSG_RESULT([no])
10640 else
10641     if test -z $LIB_FUZZING_ENGINE; then
10642       AC_MSG_ERROR(['LIB_FUZZING_ENGINE' must be set when using --enable-fuzzers. Examples include '-fsanitize=fuzzer'.])
10643     fi
10644     AC_MSG_RESULT([yes])
10645     ENABLE_FUZZERS="TRUE"
10646     AC_DEFINE([ENABLE_FUZZERS],1)
10647     BUILD_TYPE="$BUILD_TYPE FUZZERS"
10649 AC_SUBST(LIB_FUZZING_ENGINE)
10650 AC_SUBST(ENABLE_FUZZERS)
10652 dnl ===================================================================
10653 dnl Orcus
10654 dnl ===================================================================
10655 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.16 >= 0.16.0])
10656 if test "$with_system_orcus" != "yes"; then
10657     if test "$SYSTEM_BOOST" = "TRUE"; then
10658         # ===========================================================
10659         # Determine if we are going to need to link with Boost.System
10660         # ===========================================================
10661         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
10662         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
10663         dnl in documentation has no effect.
10664         AC_MSG_CHECKING([if we need to link with Boost.System])
10665         AC_LANG_PUSH([C++])
10666         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
10667                 @%:@include <boost/version.hpp>
10668             ]],[[
10669                 #if BOOST_VERSION >= 105000
10670                 #   error yes, we need to link with Boost.System
10671                 #endif
10672             ]])],[
10673                 AC_MSG_RESULT([no])
10674             ],[
10675                 AC_MSG_RESULT([yes])
10676                 AX_BOOST_SYSTEM
10677         ])
10678         AC_LANG_POP([C++])
10679     fi
10681 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
10682 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
10683 AC_SUBST([BOOST_SYSTEM_LIB])
10684 AC_SUBST(SYSTEM_LIBORCUS)
10686 dnl ===================================================================
10687 dnl HarfBuzz
10688 dnl ===================================================================
10689 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
10690                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
10691                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
10693 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
10694                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
10695                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
10697 if test "$COM" = "MSC"; then # override the above
10698     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
10699     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
10702 if test "$with_system_harfbuzz" = "yes"; then
10703     if test "$with_system_graphite" = "no"; then
10704         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
10705     fi
10706     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
10707     save_LIBS="$LIBS"
10708     save_CFLAGS="$CFLAGS"
10709     LIBS="$LIBS $HARFBUZZ_LIBS"
10710     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
10711     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
10712     LIBS="$save_LIBS"
10713     CFLAGS="$save_CFLAGS"
10714 else
10715     if test "$with_system_graphite" = "yes"; then
10716         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
10717     fi
10720 if test "$USING_X11" = TRUE; then
10721     AC_PATH_X
10722     AC_PATH_XTRA
10723     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
10725     if test -z "$x_includes"; then
10726         x_includes="default_x_includes"
10727     fi
10728     if test -z "$x_libraries"; then
10729         x_libraries="default_x_libraries"
10730     fi
10731     CFLAGS="$CFLAGS $X_CFLAGS"
10732     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
10733     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
10734 else
10735     x_includes="no_x_includes"
10736     x_libraries="no_x_libraries"
10739 if test "$USING_X11" = TRUE; then
10740     dnl ===================================================================
10741     dnl Check for extension headers
10742     dnl ===================================================================
10743     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
10744      [#include <X11/extensions/shape.h>])
10746     # vcl needs ICE and SM
10747     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
10748     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
10749         [AC_MSG_ERROR(ICE library not found)])
10750     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
10751     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
10752         [AC_MSG_ERROR(SM library not found)])
10755 if test "$USING_X11" = TRUE -a "$ENABLE_JAVA" != ""; then
10756     # bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c needs Xt
10757     AC_CHECK_HEADERS(X11/Intrinsic.h,[],[AC_MSG_ERROR([libXt headers not found])])
10760 dnl ===================================================================
10761 dnl Check for system Xrender
10762 dnl ===================================================================
10763 AC_MSG_CHECKING([whether to use Xrender])
10764 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
10765     AC_MSG_RESULT([yes])
10766     PKG_CHECK_MODULES(XRENDER, xrender)
10767     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10768     FilterLibs "${XRENDER_LIBS}"
10769     XRENDER_LIBS="${filteredlibs}"
10770     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
10771       [AC_MSG_ERROR(libXrender not found or functional)], [])
10772     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
10773       [AC_MSG_ERROR(Xrender not found. install X)], [])
10774 else
10775     AC_MSG_RESULT([no])
10777 AC_SUBST(XRENDER_CFLAGS)
10778 AC_SUBST(XRENDER_LIBS)
10780 dnl ===================================================================
10781 dnl Check for XRandr
10782 dnl ===================================================================
10783 AC_MSG_CHECKING([whether to enable RandR support])
10784 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
10785     AC_MSG_RESULT([yes])
10786     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
10787     if test "$ENABLE_RANDR" != "TRUE"; then
10788         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
10789                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
10790         XRANDR_CFLAGS=" "
10791         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
10792           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
10793         XRANDR_LIBS="-lXrandr "
10794         ENABLE_RANDR="TRUE"
10795     fi
10796     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10797     FilterLibs "${XRANDR_LIBS}"
10798     XRANDR_LIBS="${filteredlibs}"
10799 else
10800     ENABLE_RANDR=""
10801     AC_MSG_RESULT([no])
10803 AC_SUBST(XRANDR_CFLAGS)
10804 AC_SUBST(XRANDR_LIBS)
10805 AC_SUBST(ENABLE_RANDR)
10807 if test "$test_webdav" = yes; then
10808     if test -z "$with_webdav"; then
10809         WITH_WEBDAV=neon
10810         if test "$enable_mpl_subset" = yes; then
10811             WITH_WEBDAV=serf
10812         fi
10813     else
10814         WITH_WEBDAV="$with_webdav"
10815     fi
10818 AC_MSG_CHECKING([for webdav library])
10819 case "$WITH_WEBDAV" in
10820 serf)
10821     AC_MSG_RESULT([serf])
10822     # Check for system apr-util
10823     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
10824                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
10825                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
10826     if test "$COM" = "MSC"; then
10827         APR_LIB_DIR="LibR"
10828         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
10829         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
10830     fi
10832     # Check for system serf
10833     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.3.9])
10834     ;;
10835 neon)
10836     AC_MSG_RESULT([neon])
10837     # Check for system neon
10838     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.31.2])
10839     if test "$with_system_neon" = "yes"; then
10840         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
10841     else
10842         NEON_VERSION=0312
10843     fi
10844     AC_SUBST(NEON_VERSION)
10845     ;;
10847     AC_MSG_RESULT([none, disabled])
10848     WITH_WEBDAV=""
10849     ;;
10850 esac
10851 AC_SUBST(WITH_WEBDAV)
10853 dnl ===================================================================
10854 dnl Check for disabling cve_tests
10855 dnl ===================================================================
10856 AC_MSG_CHECKING([whether to execute CVE tests])
10857 # If not explicitly enabled or disabled, default
10858 if test -z "$enable_cve_tests"; then
10859     case "$OS" in
10860     WNT)
10861         # Default cves off for Windows with its wild and wonderful
10862         # variety of AV software kicking in and panicking
10863         enable_cve_tests=no
10864         ;;
10865     *)
10866         # otherwise yes
10867         enable_cve_tests=yes
10868         ;;
10869     esac
10871 if test "$enable_cve_tests" = "no"; then
10872     AC_MSG_RESULT([no])
10873     DISABLE_CVE_TESTS=TRUE
10874     AC_SUBST(DISABLE_CVE_TESTS)
10875 else
10876     AC_MSG_RESULT([yes])
10879 dnl ===================================================================
10880 dnl Check for enabling chart XShape tests
10881 dnl ===================================================================
10882 AC_MSG_CHECKING([whether to execute chart XShape tests])
10883 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
10884     AC_MSG_RESULT([yes])
10885     ENABLE_CHART_TESTS=TRUE
10886     AC_SUBST(ENABLE_CHART_TESTS)
10887 else
10888     AC_MSG_RESULT([no])
10891 dnl ===================================================================
10892 dnl Check for system openssl
10893 dnl ===================================================================
10894 ENABLE_OPENSSL=
10895 AC_MSG_CHECKING([whether to disable OpenSSL usage])
10896 if test "$enable_openssl" = "yes"; then
10897     AC_MSG_RESULT([no])
10898     ENABLE_OPENSSL=TRUE
10899     if test "$_os" = Darwin ; then
10900         # OpenSSL is deprecated when building for 10.7 or later.
10901         #
10902         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
10903         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
10905         with_system_openssl=no
10906         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10907     elif test "$_os" = "FreeBSD" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
10908             && test "$with_system_openssl" != "no"; then
10909         with_system_openssl=yes
10910         SYSTEM_OPENSSL=TRUE
10911         OPENSSL_CFLAGS=
10912         OPENSSL_LIBS="-lssl -lcrypto"
10913     else
10914         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10915     fi
10916     if test "$with_system_openssl" = "yes"; then
10917         AC_MSG_CHECKING([whether openssl supports SHA512])
10918         AC_LANG_PUSH([C])
10919         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
10920             SHA512_CTX context;
10921 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
10922         AC_LANG_POP(C)
10923     fi
10924 else
10925     AC_MSG_RESULT([yes])
10927     # warn that although OpenSSL is disabled, system libraries may depend on it
10928     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
10929     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
10932 AC_SUBST([ENABLE_OPENSSL])
10934 if test "$enable_cipher_openssl_backend" = yes && test "$ENABLE_OPENSSL" != TRUE; then
10935     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
10936         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
10937         enable_cipher_openssl_backend=no
10938     else
10939         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
10940     fi
10942 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
10943 ENABLE_CIPHER_OPENSSL_BACKEND=
10944 if test "$enable_cipher_openssl_backend" = yes; then
10945     AC_MSG_RESULT([yes])
10946     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
10947 else
10948     AC_MSG_RESULT([no])
10950 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
10952 dnl ===================================================================
10953 dnl Select the crypto backends used by LO
10954 dnl ===================================================================
10956 if test "$build_crypto" = yes; then
10957     if test "$OS" = WNT; then
10958         BUILD_TYPE="$BUILD_TYPE CRYPTO_MSCAPI"
10959         AC_DEFINE([USE_CRYPTO_MSCAPI])
10960     elif test "$ENABLE_NSS" = TRUE; then
10961         BUILD_TYPE="$BUILD_TYPE CRYPTO_NSS"
10962         AC_DEFINE([USE_CRYPTO_NSS])
10963     fi
10966 dnl ===================================================================
10967 dnl Check for building gnutls
10968 dnl ===================================================================
10969 AC_MSG_CHECKING([whether to use gnutls])
10970 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
10971     AC_MSG_RESULT([yes])
10972     AM_PATH_LIBGCRYPT()
10973     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
10974         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
10975                       available in the system to use as replacement.]]))
10976     FilterLibs "${LIBGCRYPT_LIBS}"
10977     LIBGCRYPT_LIBS="${filteredlibs}"
10978 else
10979     AC_MSG_RESULT([no])
10982 AC_SUBST([LIBGCRYPT_CFLAGS])
10983 AC_SUBST([LIBGCRYPT_LIBS])
10985 dnl ===================================================================
10986 dnl Check for system redland
10987 dnl ===================================================================
10988 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
10989 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
10990 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
10991 if test "$with_system_redland" = "yes"; then
10992     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
10993             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
10994 else
10995     RAPTOR_MAJOR="0"
10996     RASQAL_MAJOR="3"
10997     REDLAND_MAJOR="0"
10999 AC_SUBST(RAPTOR_MAJOR)
11000 AC_SUBST(RASQAL_MAJOR)
11001 AC_SUBST(REDLAND_MAJOR)
11003 dnl ===================================================================
11004 dnl Check for system hunspell
11005 dnl ===================================================================
11006 AC_MSG_CHECKING([which libhunspell to use])
11007 if test "$with_system_hunspell" = "yes"; then
11008     AC_MSG_RESULT([external])
11009     SYSTEM_HUNSPELL=TRUE
11010     AC_LANG_PUSH([C++])
11011     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
11012     if test "$HUNSPELL_PC" != "TRUE"; then
11013         AC_CHECK_HEADER(hunspell.hxx, [],
11014             [
11015             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
11016             [AC_MSG_ERROR(hunspell headers not found.)], [])
11017             ], [])
11018         AC_CHECK_LIB([hunspell], [main], [:],
11019            [ AC_MSG_ERROR(hunspell library not found.) ], [])
11020         HUNSPELL_LIBS=-lhunspell
11021     fi
11022     AC_LANG_POP([C++])
11023     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11024     FilterLibs "${HUNSPELL_LIBS}"
11025     HUNSPELL_LIBS="${filteredlibs}"
11026 else
11027     AC_MSG_RESULT([internal])
11028     SYSTEM_HUNSPELL=
11029     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
11030     if test "$COM" = "MSC"; then
11031         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
11032     else
11033         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
11034     fi
11035     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
11037 AC_SUBST(SYSTEM_HUNSPELL)
11038 AC_SUBST(HUNSPELL_CFLAGS)
11039 AC_SUBST(HUNSPELL_LIBS)
11041 dnl ===================================================================
11042 dnl Check for system zxing
11043 dnl ===================================================================
11044 AC_MSG_CHECKING([whether to use zxing])
11045 if test "$enable_zxing" = "no"; then
11046     AC_MSG_RESULT([no])
11047     ENABLE_ZXING=
11048     SYSTEM_ZXING=
11049 else
11050     AC_MSG_RESULT([yes])
11051     ENABLE_ZXING=TRUE
11052     AC_MSG_CHECKING([which libzxing to use])
11053     if test "$with_system_zxing" = "yes"; then
11054         AC_MSG_RESULT([external])
11055         SYSTEM_ZXING=TRUE
11056         AC_LANG_PUSH([C++])
11057         AC_CHECK_HEADER(ZXing/MultiFormatWriter.h, [],
11058             [AC_MSG_ERROR(zxing headers not found.)], [#include <stdexcept>])
11059         ZXING_CFLAGS=-I/usr/include/ZXing
11060         AC_CHECK_LIB([ZXing], [main], [ZXING_LIBS=-lZXing],
11061             [ AC_CHECK_LIB([ZXingCore], [main], [ZXING_LIBS=-lZXingCore],
11062             [ AC_MSG_ERROR(zxing C++ library not found.) ])], [])
11063         AC_LANG_POP([C++])
11064         ZXING_CFLAGS=$(printf '%s' "$ZXING_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11065         FilterLibs "${ZXING_LIBS}"
11066         ZXING_LIBS="${filteredlibs}"
11067     else
11068         AC_MSG_RESULT([internal])
11069         SYSTEM_ZXING=
11070         BUILD_TYPE="$BUILD_TYPE ZXING"
11071     fi
11072     if test "$ENABLE_ZXING" = TRUE; then
11073         AC_DEFINE(ENABLE_ZXING)
11074     fi
11076 AC_SUBST(SYSTEM_ZXING)
11077 AC_SUBST(ENABLE_ZXING)
11078 AC_SUBST(ZXING_CFLAGS)
11079 AC_SUBST(ZXING_LIBS)
11081 dnl ===================================================================
11082 dnl Check for system box2d
11083 dnl ===================================================================
11084 AC_MSG_CHECKING([which box2d to use])
11085 if test "$with_system_box2d" = "yes"; then
11086     AC_MSG_RESULT([external])
11087     SYSTEM_BOX2D=TRUE
11088     AC_LANG_PUSH([C++])
11089     AC_CHECK_HEADER(box2d/box2d.h, [BOX2D_H_FOUND='TRUE'],
11090         [BOX2D_H_FOUND='FALSE'])
11091     if test "$BOX2D_H_FOUND" = "TRUE"; then # 2.4.0+
11092         _BOX2D_LIB=box2d
11093         AC_DEFINE(BOX2D_HEADER,<box2d/box2d.h>)
11094     else
11095         # fail this. there's no other alternative to check when we are here.
11096         AC_CHECK_HEADER([Box2D/Box2D.h], [],
11097             [AC_MSG_ERROR(box2d headers not found.)])
11098         _BOX2D_LIB=Box2D
11099         AC_DEFINE(BOX2D_HEADER,<Box2D/Box2D.h>)
11100     fi
11101     AC_CHECK_LIB([$_BOX2D_LIB], [main], [:],
11102         [ AC_MSG_ERROR(box2d library not found.) ], [])
11103     BOX2D_LIBS=-l$_BOX2D_LIB
11104     AC_LANG_POP([C++])
11105     BOX2D_CFLAGS=$(printf '%s' "$BOX2D_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11106     FilterLibs "${BOX2D_LIBS}"
11107     BOX2D_LIBS="${filteredlibs}"
11108 else
11109     AC_MSG_RESULT([internal])
11110     SYSTEM_BOX2D=
11111     BUILD_TYPE="$BUILD_TYPE BOX2D"
11113 AC_SUBST(SYSTEM_BOX2D)
11114 AC_SUBST(BOX2D_CFLAGS)
11115 AC_SUBST(BOX2D_LIBS)
11117 dnl ===================================================================
11118 dnl Checking for altlinuxhyph
11119 dnl ===================================================================
11120 AC_MSG_CHECKING([which altlinuxhyph to use])
11121 if test "$with_system_altlinuxhyph" = "yes"; then
11122     AC_MSG_RESULT([external])
11123     SYSTEM_HYPH=TRUE
11124     AC_CHECK_HEADER(hyphen.h, [],
11125        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
11126     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
11127        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
11128        [#include <hyphen.h>])
11129     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
11130         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11131     if test -z "$HYPHEN_LIB"; then
11132         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
11133            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11134     fi
11135     if test -z "$HYPHEN_LIB"; then
11136         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
11137            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11138     fi
11139 else
11140     AC_MSG_RESULT([internal])
11141     SYSTEM_HYPH=
11142     BUILD_TYPE="$BUILD_TYPE HYPHEN"
11143     if test "$COM" = "MSC"; then
11144         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
11145     else
11146         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
11147     fi
11149 AC_SUBST(SYSTEM_HYPH)
11150 AC_SUBST(HYPHEN_LIB)
11152 dnl ===================================================================
11153 dnl Checking for mythes
11154 dnl ===================================================================
11155 AC_MSG_CHECKING([which mythes to use])
11156 if test "$with_system_mythes" = "yes"; then
11157     AC_MSG_RESULT([external])
11158     SYSTEM_MYTHES=TRUE
11159     AC_LANG_PUSH([C++])
11160     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
11161     if test "$MYTHES_PKGCONFIG" = "no"; then
11162         AC_CHECK_HEADER(mythes.hxx, [],
11163             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
11164         AC_CHECK_LIB([mythes-1.2], [main], [:],
11165             [ MYTHES_FOUND=no], [])
11166     if test "$MYTHES_FOUND" = "no"; then
11167         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
11168                 [ MYTHES_FOUND=no], [])
11169     fi
11170     if test "$MYTHES_FOUND" = "no"; then
11171         AC_MSG_ERROR([mythes library not found!.])
11172     fi
11173     fi
11174     AC_LANG_POP([C++])
11175     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11176     FilterLibs "${MYTHES_LIBS}"
11177     MYTHES_LIBS="${filteredlibs}"
11178 else
11179     AC_MSG_RESULT([internal])
11180     SYSTEM_MYTHES=
11181     BUILD_TYPE="$BUILD_TYPE MYTHES"
11182     if test "$COM" = "MSC"; then
11183         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
11184     else
11185         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
11186     fi
11188 AC_SUBST(SYSTEM_MYTHES)
11189 AC_SUBST(MYTHES_CFLAGS)
11190 AC_SUBST(MYTHES_LIBS)
11192 dnl ===================================================================
11193 dnl How should we build the linear programming solver ?
11194 dnl ===================================================================
11196 ENABLE_COINMP=
11197 AC_MSG_CHECKING([whether to build with CoinMP])
11198 if test "$enable_coinmp" != "no"; then
11199     ENABLE_COINMP=TRUE
11200     AC_MSG_RESULT([yes])
11201     if test "$with_system_coinmp" = "yes"; then
11202         SYSTEM_COINMP=TRUE
11203         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
11204         FilterLibs "${COINMP_LIBS}"
11205         COINMP_LIBS="${filteredlibs}"
11206     else
11207         BUILD_TYPE="$BUILD_TYPE COINMP"
11208     fi
11209 else
11210     AC_MSG_RESULT([no])
11212 AC_SUBST(ENABLE_COINMP)
11213 AC_SUBST(SYSTEM_COINMP)
11214 AC_SUBST(COINMP_CFLAGS)
11215 AC_SUBST(COINMP_LIBS)
11217 ENABLE_LPSOLVE=
11218 AC_MSG_CHECKING([whether to build with lpsolve])
11219 if test "$enable_lpsolve" != "no"; then
11220     ENABLE_LPSOLVE=TRUE
11221     AC_MSG_RESULT([yes])
11222 else
11223     AC_MSG_RESULT([no])
11225 AC_SUBST(ENABLE_LPSOLVE)
11227 if test "$ENABLE_LPSOLVE" = TRUE; then
11228     AC_MSG_CHECKING([which lpsolve to use])
11229     if test "$with_system_lpsolve" = "yes"; then
11230         AC_MSG_RESULT([external])
11231         SYSTEM_LPSOLVE=TRUE
11232         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
11233            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
11234         save_LIBS=$LIBS
11235         # some systems need this. Like Ubuntu...
11236         AC_CHECK_LIB(m, floor)
11237         AC_CHECK_LIB(dl, dlopen)
11238         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
11239             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
11240         LIBS=$save_LIBS
11241     else
11242         AC_MSG_RESULT([internal])
11243         SYSTEM_LPSOLVE=
11244         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
11245     fi
11247 AC_SUBST(SYSTEM_LPSOLVE)
11249 dnl ===================================================================
11250 dnl Checking for libexttextcat
11251 dnl ===================================================================
11252 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
11253 if test "$with_system_libexttextcat" = "yes"; then
11254     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
11256 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
11258 dnl ===================================================================
11259 dnl Checking for libnumbertext
11260 dnl ===================================================================
11261 libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.6])
11262 if test "$with_system_libnumbertext" = "yes"; then
11263     SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
11264     SYSTEM_LIBNUMBERTEXT=YES
11265 else
11266     SYSTEM_LIBNUMBERTEXT=
11267     AC_LANG_PUSH([C++])
11268     save_CPPFLAGS=$CPPFLAGS
11269     CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
11270     AC_CHECK_HEADERS([codecvt regex])
11271     AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
11272             [ LIBNUMBERTEXT_CFLAGS=''
11273               AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
11274                            Enable libnumbertext fallback (missing number to number name conversion).])
11275             ])
11276     CPPFLAGS=$save_CPPFLAGS
11277     AC_LANG_POP([C++])
11279 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
11280 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
11281 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
11283 dnl ***************************************
11284 dnl testing libc version for Linux...
11285 dnl ***************************************
11286 if test "$_os" = "Linux"; then
11287     AC_MSG_CHECKING([whether libc is >= 2.1.1])
11288     exec 6>/dev/null # no output
11289     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
11290     exec 6>&1 # output on again
11291     if test "$HAVE_LIBC"; then
11292         AC_MSG_RESULT([yes])
11293     else
11294         AC_MSG_ERROR([no, upgrade libc])
11295     fi
11298 dnl =========================================
11299 dnl Check for uuidgen
11300 dnl =========================================
11301 if test "$_os" = "WINNT"; then
11302     # we must use the uuidgen from the Windows SDK, which will be in the LO_PATH, but isn't in
11303     # the PATH for AC_PATH_PROG. It is already tested above in the WINDOWS_SDK_HOME check.
11304     UUIDGEN=uuidgen.exe
11305     AC_SUBST(UUIDGEN)
11306 else
11307     AC_PATH_PROG([UUIDGEN], [uuidgen])
11308     if test -z "$UUIDGEN"; then
11309         AC_MSG_WARN([uuid is needed for building installation sets])
11310     fi
11313 dnl ***************************************
11314 dnl Checking for bison and flex
11315 dnl ***************************************
11316 AC_PATH_PROG(BISON, bison)
11317 if test -z "$BISON"; then
11318     AC_MSG_ERROR([no bison found in \$PATH, install it])
11319 else
11320     AC_MSG_CHECKING([the bison version])
11321     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
11322     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
11323     dnl Accept newer than 2.0; for --enable-compiler-plugins at least 2.3 is known to be bad and
11324     dnl cause
11325     dnl
11326     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]
11327     dnl   typedef union YYSTYPE
11328     dnl           ~~~~~~^~~~~~~
11329     dnl
11330     dnl while at least 3.4.1 is know to be good:
11331     if test "$COMPILER_PLUGINS" = TRUE; then
11332         if test "$_bison_longver" -lt 2004; then
11333             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.4+ for --enable-compiler-plugins)])
11334         fi
11335     else
11336         if test "$_bison_longver" -lt 2000; then
11337             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
11338         fi
11339     fi
11341 AC_SUBST([BISON])
11343 AC_PATH_PROG(FLEX, flex)
11344 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11345     FLEX=`cygpath -m $FLEX`
11347 if test -z "$FLEX"; then
11348     AC_MSG_ERROR([no flex found in \$PATH, install it])
11349 else
11350     AC_MSG_CHECKING([the flex version])
11351     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
11352     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
11353         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
11354     fi
11356 AC_SUBST([FLEX])
11357 dnl ***************************************
11358 dnl Checking for patch
11359 dnl ***************************************
11360 AC_PATH_PROG(PATCH, patch)
11361 if test -z "$PATCH"; then
11362     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
11365 dnl On Solaris or macOS, check if --with-gnu-patch was used
11366 if test "$_os" = "SunOS" -o "$_os" = "Darwin"; then
11367     if test -z "$with_gnu_patch"; then
11368         GNUPATCH=$PATCH
11369     else
11370         if test -x "$with_gnu_patch"; then
11371             GNUPATCH=$with_gnu_patch
11372         else
11373             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
11374         fi
11375     fi
11377     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
11378     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
11379         AC_MSG_RESULT([yes])
11380     else
11381         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
11382     fi
11383 else
11384     GNUPATCH=$PATCH
11387 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11388     GNUPATCH=`cygpath -m $GNUPATCH`
11391 dnl We also need to check for --with-gnu-cp
11393 if test -z "$with_gnu_cp"; then
11394     # check the place where the good stuff is hidden on Solaris...
11395     if test -x /usr/gnu/bin/cp; then
11396         GNUCP=/usr/gnu/bin/cp
11397     else
11398         AC_PATH_PROGS(GNUCP, gnucp cp)
11399     fi
11400     if test -z $GNUCP; then
11401         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
11402     fi
11403 else
11404     if test -x "$with_gnu_cp"; then
11405         GNUCP=$with_gnu_cp
11406     else
11407         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
11408     fi
11411 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11412     GNUCP=`cygpath -m $GNUCP`
11415 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
11416 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
11417     AC_MSG_RESULT([yes])
11418 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
11419     AC_MSG_RESULT([yes])
11420 else
11421     case "$build_os" in
11422     darwin*|macos*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
11423         x_GNUCP=[\#]
11424         GNUCP=''
11425         AC_MSG_RESULT([no gnucp found - using the system's cp command])
11426         ;;
11427     *)
11428         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
11429         ;;
11430     esac
11433 AC_SUBST(GNUPATCH)
11434 AC_SUBST(GNUCP)
11435 AC_SUBST(x_GNUCP)
11437 dnl ***************************************
11438 dnl testing assembler path
11439 dnl ***************************************
11440 ML_EXE=""
11441 if test "$_os" = "WINNT"; then
11442     case "$WIN_HOST_ARCH" in
11443     x86) assembler=ml.exe ;;
11444     x64) assembler=ml64.exe ;;
11445     arm64) assembler=armasm64.exe ;;
11446     esac
11448     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
11449     if test -f "$MSVC_HOST_PATH/$assembler"; then
11450         ML_EXE=`win_short_path_for_make "$MSVC_HOST_PATH/$assembler"`
11451         AC_MSG_RESULT([$ML_EXE])
11452     else
11453         AC_MSG_ERROR([not found in $MSVC_HOST_PATH])
11454     fi
11457 AC_SUBST(ML_EXE)
11459 dnl ===================================================================
11460 dnl We need zip and unzip
11461 dnl ===================================================================
11462 AC_PATH_PROG(ZIP, zip)
11463 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
11464 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
11465     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],,)
11468 AC_PATH_PROG(UNZIP, unzip)
11469 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
11471 dnl ===================================================================
11472 dnl Zip must be a specific type for different build types.
11473 dnl ===================================================================
11474 if test $build_os = cygwin; then
11475     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
11476         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
11477     fi
11480 dnl ===================================================================
11481 dnl We need touch with -h option support.
11482 dnl ===================================================================
11483 AC_PATH_PROG(TOUCH, touch)
11484 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
11485 touch "$WARNINGS_FILE"
11486 if ! "$TOUCH" -h "$WARNINGS_FILE" 2>/dev/null > /dev/null; then
11487     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],,)
11490 dnl ===================================================================
11491 dnl Check for system epoxy
11492 dnl ===================================================================
11493 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
11495 dnl ===================================================================
11496 dnl Set vcl option: coordinate device in double or sal_Int32
11497 dnl ===================================================================
11499 dnl disabled for now, we don't want subtle differences between OSs
11500 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
11501 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
11502 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
11503 dnl     AC_MSG_RESULT([double])
11504 dnl else
11505 dnl     AC_MSG_RESULT([sal_Int32])
11506 dnl fi
11508 dnl ===================================================================
11509 dnl Show which vclplugs will be built.
11510 dnl ===================================================================
11511 R=""
11512 if test "$USING_X11" != TRUE; then
11513     enable_gtk3=no
11516 ENABLE_GTK3=""
11517 if test "x$enable_gtk3" = "xyes"; then
11518     ENABLE_GTK3="TRUE"
11519     AC_DEFINE(ENABLE_GTK3)
11520     R="$R gtk3"
11522 AC_SUBST(ENABLE_GTK3)
11524 ENABLE_GTK3_KDE5=""
11525 if test "x$enable_gtk3_kde5" = "xyes"; then
11526     ENABLE_GTK3_KDE5="TRUE"
11527     AC_DEFINE(ENABLE_GTK3_KDE5)
11528     R="$R gtk3_kde5"
11530 AC_SUBST(ENABLE_GTK3_KDE5)
11532 ENABLE_GTK4=""
11533 if test "x$enable_gtk4" = "xyes"; then
11534     ENABLE_GTK4="TRUE"
11535     AC_DEFINE(ENABLE_GTK4)
11536     R="$R gtk4"
11538 AC_SUBST(ENABLE_GTK4)
11540 ENABLE_QT5=""
11541 if test "x$enable_qt5" = "xyes"; then
11542     ENABLE_QT5="TRUE"
11543     AC_DEFINE(ENABLE_QT5)
11544     R="$R qt5"
11546 AC_SUBST(ENABLE_QT5)
11548 ENABLE_KF5=""
11549 if test "x$enable_kf5" = "xyes"; then
11550     ENABLE_KF5="TRUE"
11551     AC_DEFINE(ENABLE_KF5)
11552     R="$R kf5"
11554 AC_SUBST(ENABLE_KF5)
11556 if test "x$USING_X11" = "xyes"; then
11557     R="$R gen"
11560 if test "$_os" = "WINNT"; then
11561     R="$R win"
11562 elif test "$_os" = "Darwin"; then
11563     R="$R osx"
11564 elif test "$_os" = "iOS"; then
11565     R="ios"
11566 elif test "$_os" = Android; then
11567     R="android"
11570 build_vcl_plugins="$R"
11571 if test -z "$build_vcl_plugins"; then
11572     build_vcl_plugins=" none"
11574 AC_MSG_NOTICE([VCLplugs to be built:${build_vcl_plugins}])
11575 VCL_PLUGIN_INFO=$R
11576 AC_SUBST([VCL_PLUGIN_INFO])
11578 dnl ===================================================================
11579 dnl Check for GTK libraries
11580 dnl ===================================================================
11582 GTK3_CFLAGS=""
11583 GTK3_LIBS=""
11584 if test "$test_gtk3" = yes -a "x$enable_gtk3" = "xyes" -o "x$enable_gtk3_kde5" = "xyes"; then
11585     if test "$with_system_cairo" = no; then
11586         add_warning 'Non-system cairo combined with gtk3 is assumed to cause trouble; proceed at your own risk.'
11587     fi
11588     : ${with_system_cairo:=yes}
11589     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)
11590     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11591     GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
11592     FilterLibs "${GTK3_LIBS}"
11593     GTK3_LIBS="${filteredlibs}"
11595     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
11596     if test "$with_system_epoxy" != "yes"; then
11597         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
11598         AC_CHECK_HEADER(EGL/eglplatform.h, [],
11599                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
11600     fi
11602 AC_SUBST(GTK3_LIBS)
11603 AC_SUBST(GTK3_CFLAGS)
11605 GTK4_CFLAGS=""
11606 GTK4_LIBS=""
11607 if test "$test_gtk4" = yes -a "x$enable_gtk4" = "xyes"; then
11608     if test "$with_system_cairo" = no; then
11609         add_warning 'Non-system cairo combined with gtk4 is assumed to cause trouble; proceed at your own risk.'
11610     fi
11611     : ${with_system_cairo:=yes}
11612     PKG_CHECK_MODULES(GTK4, gtk4 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo atk)
11613     GTK4_CFLAGS=$(printf '%s' "$GTK4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11614     GTK4_CFLAGS="$GTK4_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
11615     FilterLibs "${GTK4_LIBS}"
11616     GTK4_LIBS="${filteredlibs}"
11618     dnl We require egl only for the gtk4 plugin. Otherwise we use glx.
11619     if test "$with_system_epoxy" != "yes"; then
11620         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
11621         AC_CHECK_HEADER(EGL/eglplatform.h, [],
11622                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
11623     fi
11625 AC_SUBST(GTK4_LIBS)
11626 AC_SUBST(GTK4_CFLAGS)
11628 if test "$enable_introspection" = yes; then
11629     if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
11630         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
11631     else
11632         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
11633     fi
11636 dnl ===================================================================
11637 dnl check for dbus support
11638 dnl ===================================================================
11639 ENABLE_DBUS=""
11640 DBUS_CFLAGS=""
11641 DBUS_LIBS=""
11642 DBUS_GLIB_CFLAGS=""
11643 DBUS_GLIB_LIBS=""
11644 DBUS_HAVE_GLIB=""
11646 if test "$enable_dbus" = "no"; then
11647     test_dbus=no
11650 AC_MSG_CHECKING([whether to enable DBUS support])
11651 if test "$test_dbus" = "yes"; then
11652     ENABLE_DBUS="TRUE"
11653     AC_MSG_RESULT([yes])
11654     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
11655     AC_DEFINE(ENABLE_DBUS)
11656     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11657     FilterLibs "${DBUS_LIBS}"
11658     DBUS_LIBS="${filteredlibs}"
11660     # Glib is needed for BluetoothServer
11661     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
11662     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
11663         [
11664             DBUS_HAVE_GLIB="TRUE"
11665             AC_DEFINE(DBUS_HAVE_GLIB,1)
11666         ],
11667         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
11668     )
11669 else
11670     AC_MSG_RESULT([no])
11673 AC_SUBST(ENABLE_DBUS)
11674 AC_SUBST(DBUS_CFLAGS)
11675 AC_SUBST(DBUS_LIBS)
11676 AC_SUBST(DBUS_GLIB_CFLAGS)
11677 AC_SUBST(DBUS_GLIB_LIBS)
11678 AC_SUBST(DBUS_HAVE_GLIB)
11680 AC_MSG_CHECKING([whether to enable Impress remote control])
11681 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
11682     AC_MSG_RESULT([yes])
11683     ENABLE_SDREMOTE=TRUE
11684     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
11686     if test $OS = MACOSX && test "$MACOSX_SDK_VERSION" -ge 101500; then
11687         # The Bluetooth code doesn't compile with macOS SDK 10.15
11688         if test "$enable_sdremote_bluetooth" = yes; then
11689             AC_MSG_ERROR([macOS SDK $with_macosx_sdk does not currently support --enable-sdremote-bluetooth])
11690         fi
11691         enable_sdremote_bluetooth=no
11692     fi
11693     # If not explicitly enabled or disabled, default
11694     if test -z "$enable_sdremote_bluetooth"; then
11695         case "$OS" in
11696         LINUX|MACOSX|WNT)
11697             # Default to yes for these
11698             enable_sdremote_bluetooth=yes
11699             ;;
11700         *)
11701             # otherwise no
11702             enable_sdremote_bluetooth=no
11703             ;;
11704         esac
11705     fi
11706     # $enable_sdremote_bluetooth is guaranteed non-empty now
11708     if test "$enable_sdremote_bluetooth" != "no"; then
11709         if test "$OS" = "LINUX"; then
11710             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
11711                 AC_MSG_RESULT([yes])
11712                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
11713                 dnl ===================================================================
11714                 dnl Check for system bluez
11715                 dnl ===================================================================
11716                 AC_MSG_CHECKING([which Bluetooth header to use])
11717                 if test "$with_system_bluez" = "yes"; then
11718                     AC_MSG_RESULT([external])
11719                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
11720                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
11721                     SYSTEM_BLUEZ=TRUE
11722                 else
11723                     AC_MSG_RESULT([internal])
11724                     SYSTEM_BLUEZ=
11725                 fi
11726             else
11727                 AC_MSG_RESULT([no, dbus disabled])
11728                 ENABLE_SDREMOTE_BLUETOOTH=
11729                 SYSTEM_BLUEZ=
11730             fi
11731         else
11732             AC_MSG_RESULT([yes])
11733             ENABLE_SDREMOTE_BLUETOOTH=TRUE
11734             SYSTEM_BLUEZ=
11735         fi
11736     else
11737         AC_MSG_RESULT([no])
11738         ENABLE_SDREMOTE_BLUETOOTH=
11739         SYSTEM_BLUEZ=
11740     fi
11741 else
11742     ENABLE_SDREMOTE=
11743     SYSTEM_BLUEZ=
11744     AC_MSG_RESULT([no])
11746 AC_SUBST(ENABLE_SDREMOTE)
11747 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
11748 AC_SUBST(SYSTEM_BLUEZ)
11750 dnl ===================================================================
11751 dnl Check whether to enable GIO support
11752 dnl ===================================================================
11753 if test "$ENABLE_GTK4" = "TRUE" -o "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
11754     AC_MSG_CHECKING([whether to enable GIO support])
11755     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
11756         dnl Need at least 2.26 for the dbus support.
11757         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
11758                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
11759         if test "$ENABLE_GIO" = "TRUE"; then
11760             AC_DEFINE(ENABLE_GIO)
11761             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11762             FilterLibs "${GIO_LIBS}"
11763             GIO_LIBS="${filteredlibs}"
11764         fi
11765     else
11766         AC_MSG_RESULT([no])
11767     fi
11769 AC_SUBST(ENABLE_GIO)
11770 AC_SUBST(GIO_CFLAGS)
11771 AC_SUBST(GIO_LIBS)
11774 dnl ===================================================================
11776 SPLIT_APP_MODULES=""
11777 if test "$enable_split_app_modules" = "yes"; then
11778     SPLIT_APP_MODULES="TRUE"
11780 AC_SUBST(SPLIT_APP_MODULES)
11782 SPLIT_OPT_FEATURES=""
11783 if test "$enable_split_opt_features" = "yes"; then
11784     SPLIT_OPT_FEATURES="TRUE"
11786 AC_SUBST(SPLIT_OPT_FEATURES)
11788 dnl ===================================================================
11789 dnl Check whether the GStreamer libraries are available.
11790 dnl ===================================================================
11792 ENABLE_GSTREAMER_1_0=""
11794 if test "$test_gstreamer_1_0" = yes; then
11796     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
11797     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
11798         ENABLE_GSTREAMER_1_0="TRUE"
11799         AC_MSG_RESULT([yes])
11800         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
11801         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11802         FilterLibs "${GSTREAMER_1_0_LIBS}"
11803         GSTREAMER_1_0_LIBS="${filteredlibs}"
11804         AC_DEFINE(ENABLE_GSTREAMER_1_0)
11805     else
11806         AC_MSG_RESULT([no])
11807     fi
11809 AC_SUBST(GSTREAMER_1_0_CFLAGS)
11810 AC_SUBST(GSTREAMER_1_0_LIBS)
11811 AC_SUBST(ENABLE_GSTREAMER_1_0)
11813 ENABLE_OPENGL_TRANSITIONS=
11814 ENABLE_OPENGL_CANVAS=
11815 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
11816    : # disable
11817 elif test "$_os" = "Darwin"; then
11818     # We use frameworks on macOS, no need for detail checks
11819     ENABLE_OPENGL_TRANSITIONS=TRUE
11820     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11821     ENABLE_OPENGL_CANVAS=TRUE
11822 elif test $_os = WINNT; then
11823     ENABLE_OPENGL_TRANSITIONS=TRUE
11824     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11825     ENABLE_OPENGL_CANVAS=TRUE
11826 else
11827     if test "$USING_X11" = TRUE; then
11828         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
11829         ENABLE_OPENGL_TRANSITIONS=TRUE
11830         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11831         ENABLE_OPENGL_CANVAS=TRUE
11832     fi
11835 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
11836 AC_SUBST(ENABLE_OPENGL_CANVAS)
11838 dnl =================================================
11839 dnl Check whether to build with OpenCL support.
11840 dnl =================================================
11842 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE" -a "$enable_opencl" = "yes"; then
11843     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
11844     # platform (optional at run-time, used through clew).
11845     BUILD_TYPE="$BUILD_TYPE OPENCL"
11846     AC_DEFINE(HAVE_FEATURE_OPENCL)
11849 dnl =================================================
11850 dnl Check whether to build with dconf support.
11851 dnl =================================================
11853 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
11854     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
11855         if test "$enable_dconf" = yes; then
11856             AC_MSG_ERROR([dconf not found])
11857         else
11858             enable_dconf=no
11859         fi])
11861 AC_MSG_CHECKING([whether to enable dconf])
11862 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
11863     DCONF_CFLAGS=
11864     DCONF_LIBS=
11865     ENABLE_DCONF=
11866     AC_MSG_RESULT([no])
11867 else
11868     ENABLE_DCONF=TRUE
11869     AC_DEFINE(ENABLE_DCONF)
11870     AC_MSG_RESULT([yes])
11872 AC_SUBST([DCONF_CFLAGS])
11873 AC_SUBST([DCONF_LIBS])
11874 AC_SUBST([ENABLE_DCONF])
11876 # pdf import?
11877 AC_MSG_CHECKING([whether to build the PDF import feature])
11878 ENABLE_PDFIMPORT=
11879 if test -z "$enable_pdfimport" -o "$enable_pdfimport" = yes; then
11880     AC_MSG_RESULT([yes])
11881     ENABLE_PDFIMPORT=TRUE
11882     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
11883 else
11884     AC_MSG_RESULT([no])
11887 # Pdfium?
11888 AC_MSG_CHECKING([whether to build PDFium])
11889 ENABLE_PDFIUM=
11890 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
11891     AC_MSG_RESULT([yes])
11892     ENABLE_PDFIUM=TRUE
11893     BUILD_TYPE="$BUILD_TYPE PDFIUM"
11894 else
11895     AC_MSG_RESULT([no])
11897 AC_SUBST(ENABLE_PDFIUM)
11899 dnl ===================================================================
11900 dnl Check for poppler
11901 dnl ===================================================================
11902 ENABLE_POPPLER=
11903 AC_MSG_CHECKING([whether to build Poppler])
11904 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" -a $_os != Android \) -o "$enable_poppler" = yes; then
11905     AC_MSG_RESULT([yes])
11906     ENABLE_POPPLER=TRUE
11907     AC_DEFINE(HAVE_FEATURE_POPPLER)
11908 else
11909     AC_MSG_RESULT([no])
11911 AC_SUBST(ENABLE_POPPLER)
11913 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
11914     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
11917 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
11918     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
11921 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
11922     dnl ===================================================================
11923     dnl Check for system poppler
11924     dnl ===================================================================
11925     AC_MSG_CHECKING([which PDF import poppler to use])
11926     if test "$with_system_poppler" = "yes"; then
11927         AC_MSG_RESULT([external])
11928         SYSTEM_POPPLER=TRUE
11929         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
11930         AC_LANG_PUSH([C++])
11931         save_CXXFLAGS=$CXXFLAGS
11932         save_CPPFLAGS=$CPPFLAGS
11933         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
11934         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
11935         AC_CHECK_HEADER([cpp/poppler-version.h],
11936             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
11937             [])
11938         CXXFLAGS=$save_CXXFLAGS
11939         CPPFLAGS=$save_CPPFLAGS
11940         AC_LANG_POP([C++])
11941         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11943         FilterLibs "${POPPLER_LIBS}"
11944         POPPLER_LIBS="${filteredlibs}"
11945     else
11946         AC_MSG_RESULT([internal])
11947         SYSTEM_POPPLER=
11948         BUILD_TYPE="$BUILD_TYPE POPPLER"
11949         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
11950     fi
11951     AC_DEFINE([ENABLE_PDFIMPORT],1)
11953 AC_SUBST(ENABLE_PDFIMPORT)
11954 AC_SUBST(SYSTEM_POPPLER)
11955 AC_SUBST(POPPLER_CFLAGS)
11956 AC_SUBST(POPPLER_LIBS)
11958 # Skia?
11959 AC_MSG_CHECKING([whether to build Skia])
11960 ENABLE_SKIA=
11961 if test "$enable_skia" != "no" -a "$build_skia" = "yes" -a -z "$DISABLE_GUI"; then
11962     if test "$enable_skia" = "debug"; then
11963         AC_MSG_RESULT([yes (debug)])
11964         ENABLE_SKIA_DEBUG=TRUE
11965     else
11966         AC_MSG_RESULT([yes])
11967         ENABLE_SKIA_DEBUG=
11968     fi
11969     ENABLE_SKIA=TRUE
11970     AC_DEFINE(HAVE_FEATURE_SKIA)
11971     BUILD_TYPE="$BUILD_TYPE SKIA"
11973     if test -n "$MAC_OS_X_VERSION_MIN_REQUIRED" -a "$MAC_OS_X_VERSION_MIN_REQUIRED" -lt "101200"; then
11974         SKIA_DISABLE_VMA_USE_STL_SHARED_MUTEX=1
11975         AC_SUBST(SKIA_DISABLE_VMA_USE_STL_SHARED_MUTEX)
11976     fi
11978 else
11979     AC_MSG_RESULT([no])
11981 AC_SUBST(ENABLE_SKIA)
11982 AC_SUBST(ENABLE_SKIA_DEBUG)
11984 LO_CLANG_CXXFLAGS_INTRINSICS_SSE2=
11985 LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3=
11986 LO_CLANG_CXXFLAGS_INTRINSICS_SSE41=
11987 LO_CLANG_CXXFLAGS_INTRINSICS_SSE42=
11988 LO_CLANG_CXXFLAGS_INTRINSICS_AVX=
11989 LO_CLANG_CXXFLAGS_INTRINSICS_AVX2=
11990 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512=
11991 LO_CLANG_CXXFLAGS_INTRINSICS_F16C=
11992 LO_CLANG_CXXFLAGS_INTRINSICS_FMA=
11994 if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE -a ! \( "$_os" = "WINNT" -a "$CPUNAME" = "AARCH64" \); then
11995     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
11996         AC_MSG_CHECKING([for Clang])
11997         AC_MSG_RESULT([$LO_CLANG_CC / $LO_CLANG_CXX])
11998     else
11999         if test "$_os" = "WINNT"; then
12000             AC_MSG_CHECKING([for clang-cl])
12001             if test -x "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"; then
12002                 LO_CLANG_CC=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"`
12003                 dnl explicitly set -m32/-m64
12004                 LO_CLANG_CC="$LO_CLANG_CC -m$WIN_HOST_BITS"
12005                 LO_CLANG_CXX="$LO_CLANG_CC"
12006                 AC_MSG_RESULT([$LO_CLANG_CC])
12007             else
12008                 AC_MSG_RESULT([no])
12009             fi
12010         else
12011             AC_CHECK_PROG(LO_CLANG_CC,clang,clang,[])
12012             AC_CHECK_PROG(LO_CLANG_CXX,clang++,clang++,[])
12013         fi
12014     fi
12015     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12016         clang2_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $LO_CLANG_CC -E - | tail -1 | sed 's/ //g'`
12017         clang2_ver=`echo "$clang2_version" | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
12018         if test "$clang2_ver" -lt 50002; then
12019             AC_MSG_WARN(["$clang2_version" is too old or unrecognized, must be at least Clang 5.0.2])
12020             LO_CLANG_CC=
12021             LO_CLANG_CXX=
12022         fi
12023     fi
12024     if test -z "$LO_CLANG_CC" -o -z "$LO_CLANG_CXX"; then
12025         # Skia is the default on Windows, so hard-require Clang.
12026         # Elsewhere it's used just by the 'gen' VCL backend which is rarely used.
12027         if test "$_os" = "WINNT"; then
12028             AC_MSG_ERROR([Clang compiler not found. The Skia library needs to be built using Clang.])
12029         else
12030             AC_MSG_WARN([Clang compiler not found.])
12031         fi
12032     else
12034         save_CXX="$CXX"
12035         CXX="$LO_CLANG_CXX"
12036         # copy&paste (and adjust) of intrinsics checks, since MSVC's -arch doesn't work well for Clang-cl
12037         flag_sse2=-msse2
12038         flag_ssse3=-mssse3
12039         flag_sse41=-msse4.1
12040         flag_sse42=-msse4.2
12041         flag_avx=-mavx
12042         flag_avx2=-mavx2
12043         flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
12044         flag_f16c=-mf16c
12045         flag_fma=-mfma
12047         AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
12048         AC_LANG_PUSH([C++])
12049         save_CXXFLAGS=$CXXFLAGS
12050         CXXFLAGS="$CXXFLAGS $flag_sse2"
12051         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12052             #include <emmintrin.h>
12053             int main () {
12054                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12055                 c = _mm_xor_si128 (a, b);
12056                 return 0;
12057             }
12058             ])],
12059             [can_compile_sse2=yes],
12060             [can_compile_sse2=no])
12061         AC_LANG_POP([C++])
12062         CXXFLAGS=$save_CXXFLAGS
12063         AC_MSG_RESULT([${can_compile_sse2}])
12064         if test "${can_compile_sse2}" = "yes" ; then
12065             LO_CLANG_CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
12066         fi
12068         AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
12069         AC_LANG_PUSH([C++])
12070         save_CXXFLAGS=$CXXFLAGS
12071         CXXFLAGS="$CXXFLAGS $flag_ssse3"
12072         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12073             #include <tmmintrin.h>
12074             int main () {
12075                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12076                 c = _mm_maddubs_epi16 (a, b);
12077                 return 0;
12078             }
12079             ])],
12080             [can_compile_ssse3=yes],
12081             [can_compile_ssse3=no])
12082         AC_LANG_POP([C++])
12083         CXXFLAGS=$save_CXXFLAGS
12084         AC_MSG_RESULT([${can_compile_ssse3}])
12085         if test "${can_compile_ssse3}" = "yes" ; then
12086             LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
12087         fi
12089         AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
12090         AC_LANG_PUSH([C++])
12091         save_CXXFLAGS=$CXXFLAGS
12092         CXXFLAGS="$CXXFLAGS $flag_sse41"
12093         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12094             #include <smmintrin.h>
12095             int main () {
12096                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12097                 c = _mm_cmpeq_epi64 (a, b);
12098                 return 0;
12099             }
12100             ])],
12101             [can_compile_sse41=yes],
12102             [can_compile_sse41=no])
12103         AC_LANG_POP([C++])
12104         CXXFLAGS=$save_CXXFLAGS
12105         AC_MSG_RESULT([${can_compile_sse41}])
12106         if test "${can_compile_sse41}" = "yes" ; then
12107             LO_CLANG_CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
12108         fi
12110         AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
12111         AC_LANG_PUSH([C++])
12112         save_CXXFLAGS=$CXXFLAGS
12113         CXXFLAGS="$CXXFLAGS $flag_sse42"
12114         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12115             #include <nmmintrin.h>
12116             int main () {
12117                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12118                 c = _mm_cmpgt_epi64 (a, b);
12119                 return 0;
12120             }
12121             ])],
12122             [can_compile_sse42=yes],
12123             [can_compile_sse42=no])
12124         AC_LANG_POP([C++])
12125         CXXFLAGS=$save_CXXFLAGS
12126         AC_MSG_RESULT([${can_compile_sse42}])
12127         if test "${can_compile_sse42}" = "yes" ; then
12128             LO_CLANG_CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
12129         fi
12131         AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
12132         AC_LANG_PUSH([C++])
12133         save_CXXFLAGS=$CXXFLAGS
12134         CXXFLAGS="$CXXFLAGS $flag_avx"
12135         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12136             #include <immintrin.h>
12137             int main () {
12138                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
12139                 c = _mm256_xor_ps(a, b);
12140                 return 0;
12141             }
12142             ])],
12143             [can_compile_avx=yes],
12144             [can_compile_avx=no])
12145         AC_LANG_POP([C++])
12146         CXXFLAGS=$save_CXXFLAGS
12147         AC_MSG_RESULT([${can_compile_avx}])
12148         if test "${can_compile_avx}" = "yes" ; then
12149             LO_CLANG_CXXFLAGS_INTRINSICS_AVX="$flag_avx"
12150         fi
12152         AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
12153         AC_LANG_PUSH([C++])
12154         save_CXXFLAGS=$CXXFLAGS
12155         CXXFLAGS="$CXXFLAGS $flag_avx2"
12156         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12157             #include <immintrin.h>
12158             int main () {
12159                 __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
12160                 c = _mm256_maddubs_epi16(a, b);
12161                 return 0;
12162             }
12163             ])],
12164             [can_compile_avx2=yes],
12165             [can_compile_avx2=no])
12166         AC_LANG_POP([C++])
12167         CXXFLAGS=$save_CXXFLAGS
12168         AC_MSG_RESULT([${can_compile_avx2}])
12169         if test "${can_compile_avx2}" = "yes" ; then
12170             LO_CLANG_CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
12171         fi
12173         AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
12174         AC_LANG_PUSH([C++])
12175         save_CXXFLAGS=$CXXFLAGS
12176         CXXFLAGS="$CXXFLAGS $flag_avx512"
12177         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12178             #include <immintrin.h>
12179             int main () {
12180                 __m512i a = _mm512_loadu_si512(0);
12181                 return 0;
12182             }
12183             ])],
12184             [can_compile_avx512=yes],
12185             [can_compile_avx512=no])
12186         AC_LANG_POP([C++])
12187         CXXFLAGS=$save_CXXFLAGS
12188         AC_MSG_RESULT([${can_compile_avx512}])
12189         if test "${can_compile_avx512}" = "yes" ; then
12190             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
12191         fi
12193         AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
12194         AC_LANG_PUSH([C++])
12195         save_CXXFLAGS=$CXXFLAGS
12196         CXXFLAGS="$CXXFLAGS $flag_f16c"
12197         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12198             #include <immintrin.h>
12199             int main () {
12200                 __m128i a = _mm_set1_epi32 (0);
12201                 __m128 c;
12202                 c = _mm_cvtph_ps(a);
12203                 return 0;
12204             }
12205             ])],
12206             [can_compile_f16c=yes],
12207             [can_compile_f16c=no])
12208         AC_LANG_POP([C++])
12209         CXXFLAGS=$save_CXXFLAGS
12210         AC_MSG_RESULT([${can_compile_f16c}])
12211         if test "${can_compile_f16c}" = "yes" ; then
12212             LO_CLANG_CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
12213         fi
12215         AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
12216         AC_LANG_PUSH([C++])
12217         save_CXXFLAGS=$CXXFLAGS
12218         CXXFLAGS="$CXXFLAGS $flag_fma"
12219         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12220             #include <immintrin.h>
12221             int main () {
12222                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
12223                 d = _mm256_fmadd_ps(a, b, c);
12224                 return 0;
12225             }
12226             ])],
12227             [can_compile_fma=yes],
12228             [can_compile_fma=no])
12229         AC_LANG_POP([C++])
12230         CXXFLAGS=$save_CXXFLAGS
12231         AC_MSG_RESULT([${can_compile_fma}])
12232         if test "${can_compile_fma}" = "yes" ; then
12233             LO_CLANG_CXXFLAGS_INTRINSICS_FMA="$flag_fma"
12234         fi
12236         CXX="$save_CXX"
12237     fi
12240 # prefix LO_CLANG_CC/LO_CLANG_CXX with ccache if needed
12242 UNCACHED_CLANG_CC="$LO_CLANG_CC"
12243 UNCACHED_CLANG_CXX="$LO_CLANG_CXX"
12244 if test "$CCACHE" != "" -a -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12245     AC_MSG_CHECKING([whether $LO_CLANG_CC is already ccached])
12246     AC_LANG_PUSH([C])
12247     save_CC="$CC"
12248     CC="$LO_CLANG_CC"
12249     save_CFLAGS=$CFLAGS
12250     CFLAGS="$CFLAGS --ccache-skip -O2"
12251     dnl an empty program will do, we're checking the compiler flags
12252     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12253                       [use_ccache=yes], [use_ccache=no])
12254     CFLAGS=$save_CFLAGS
12255     CC=$save_CC
12256     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12257         AC_MSG_RESULT([yes])
12258     else
12259         LO_CLANG_CC="$CCACHE $LO_CLANG_CC"
12260         AC_MSG_RESULT([no])
12261     fi
12262     AC_LANG_POP([C])
12264     AC_MSG_CHECKING([whether $LO_CLANG_CXX is already ccached])
12265     AC_LANG_PUSH([C++])
12266     save_CXX="$CXX"
12267     CXX="$LO_CLANG_CXX"
12268     save_CXXFLAGS=$CXXFLAGS
12269     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
12270     dnl an empty program will do, we're checking the compiler flags
12271     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12272                       [use_ccache=yes], [use_ccache=no])
12273     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12274         AC_MSG_RESULT([yes])
12275     else
12276         LO_CLANG_CXX="$CCACHE $LO_CLANG_CXX"
12277         AC_MSG_RESULT([no])
12278     fi
12279     CXXFLAGS=$save_CXXFLAGS
12280     CXX=$save_CXX
12281     AC_LANG_POP([C++])
12284 AC_SUBST(UNCACHED_CC)
12285 AC_SUBST(UNCACHED_CXX)
12286 AC_SUBST(LO_CLANG_CC)
12287 AC_SUBST(LO_CLANG_CXX)
12288 AC_SUBST(UNCACHED_CLANG_CC)
12289 AC_SUBST(UNCACHED_CLANG_CXX)
12290 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE2)
12291 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3)
12292 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE41)
12293 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE42)
12294 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX)
12295 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX2)
12296 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512)
12297 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_F16C)
12298 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_FMA)
12299 AC_SUBST(CLANG_USE_LD)
12301 SYSTEM_GPGMEPP=
12303 if test "$enable_gpgmepp" = no; then
12304     AC_MSG_CHECKING([whether to enable gpgmepp])
12305     AC_MSG_RESULT([no])
12306 elif test "$enable_mpl_subset" = "yes"; then
12307     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
12308     AC_MSG_RESULT([yes])
12309 elif test "$enable_fuzzers" = "yes"; then
12310     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
12311     AC_MSG_RESULT([yes])
12312 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
12313     dnl ===================================================================
12314     dnl Check for system gpgme
12315     dnl ===================================================================
12316     AC_MSG_CHECKING([which gpgmepp to use])
12317     if test "$with_system_gpgmepp" = "yes"; then
12318         AC_MSG_RESULT([external])
12319         SYSTEM_GPGMEPP=TRUE
12321         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
12322         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
12323             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
12324         # progress_callback is the only func with plain C linkage
12325         # checking for it also filters out older, KDE-dependent libgpgmepp versions
12326         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
12327             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
12328         AC_CHECK_HEADER(gpgme.h, [],
12329             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
12330     else
12331         AC_MSG_RESULT([internal])
12332         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
12333         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
12335         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
12336         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
12337         if test "$_os" != "WINNT"; then
12338             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
12339             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
12340         fi
12341     fi
12342     ENABLE_GPGMEPP=TRUE
12343     AC_DEFINE([HAVE_FEATURE_GPGME])
12344     AC_PATH_PROG(GPG, gpg)
12345     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
12346     # so let's exclude that manually for the moment
12347     if test -n "$GPG" -a "$_os" != "WINNT"; then
12348         # make sure we not only have a working gpgme, but a full working
12349         # gpg installation to run OpenPGP signature verification
12350         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
12351     fi
12352     if test "$_os" = "Linux"; then
12353       uid=`id -u`
12354       AC_MSG_CHECKING([for /run/user/$uid])
12355       if test -d /run/user/$uid; then
12356         AC_MSG_RESULT([yes])
12357         AC_PATH_PROG(GPGCONF, gpgconf)
12359         # Older versions of gpgconf are not working as expected, since
12360         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
12361         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
12362         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
12363         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
12364         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
12365         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
12366         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
12367           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
12368           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
12369           if $GPGCONF --dump-options > /dev/null ; then
12370             if $GPGCONF --dump-options | grep -q create-socketdir ; then
12371               AC_MSG_RESULT([yes])
12372               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
12373               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
12374             else
12375               AC_MSG_RESULT([no])
12376             fi
12377           else
12378             AC_MSG_RESULT([no. missing or broken gpgconf?])
12379           fi
12380         else
12381           AC_MSG_RESULT([no, $GPGCONF_VERSION])
12382         fi
12383       else
12384         AC_MSG_RESULT([no])
12385      fi
12386    fi
12388 AC_SUBST(ENABLE_GPGMEPP)
12389 AC_SUBST(SYSTEM_GPGMEPP)
12390 AC_SUBST(GPG_ERROR_CFLAGS)
12391 AC_SUBST(GPG_ERROR_LIBS)
12392 AC_SUBST(LIBASSUAN_CFLAGS)
12393 AC_SUBST(LIBASSUAN_LIBS)
12394 AC_SUBST(GPGMEPP_CFLAGS)
12395 AC_SUBST(GPGMEPP_LIBS)
12397 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
12398 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
12399     AC_MSG_RESULT([yes])
12400     ENABLE_MEDIAWIKI=TRUE
12401     BUILD_TYPE="$BUILD_TYPE XSLTML"
12402     if test  "x$with_java" = "xno"; then
12403         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
12404     fi
12405 else
12406     AC_MSG_RESULT([no])
12407     ENABLE_MEDIAWIKI=
12408     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
12410 AC_SUBST(ENABLE_MEDIAWIKI)
12412 AC_MSG_CHECKING([whether to build the Report Builder])
12413 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12414     AC_MSG_RESULT([yes])
12415     ENABLE_REPORTBUILDER=TRUE
12416     AC_MSG_CHECKING([which jfreereport libs to use])
12417     if test "$with_system_jfreereport" = "yes"; then
12418         SYSTEM_JFREEREPORT=TRUE
12419         AC_MSG_RESULT([external])
12420         if test -z $SAC_JAR; then
12421             SAC_JAR=/usr/share/java/sac.jar
12422         fi
12423         if ! test -f $SAC_JAR; then
12424              AC_MSG_ERROR(sac.jar not found.)
12425         fi
12427         if test -z $LIBXML_JAR; then
12428             if test -f /usr/share/java/libxml-1.0.0.jar; then
12429                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
12430             elif test -f /usr/share/java/libxml.jar; then
12431                 LIBXML_JAR=/usr/share/java/libxml.jar
12432             else
12433                 AC_MSG_ERROR(libxml.jar replacement not found.)
12434             fi
12435         elif ! test -f $LIBXML_JAR; then
12436             AC_MSG_ERROR(libxml.jar not found.)
12437         fi
12439         if test -z $FLUTE_JAR; then
12440             if test -f /usr/share/java/flute-1.3.0.jar; then
12441                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
12442             elif test -f /usr/share/java/flute.jar; then
12443                 FLUTE_JAR=/usr/share/java/flute.jar
12444             else
12445                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
12446             fi
12447         elif ! test -f $FLUTE_JAR; then
12448             AC_MSG_ERROR(flute-1.3.0.jar not found.)
12449         fi
12451         if test -z $JFREEREPORT_JAR; then
12452             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
12453                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
12454             elif test -f /usr/share/java/flow-engine.jar; then
12455                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
12456             else
12457                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
12458             fi
12459         elif ! test -f  $JFREEREPORT_JAR; then
12460                 AC_MSG_ERROR(jfreereport.jar not found.)
12461         fi
12463         if test -z $LIBLAYOUT_JAR; then
12464             if test -f /usr/share/java/liblayout-0.2.9.jar; then
12465                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
12466             elif test -f /usr/share/java/liblayout.jar; then
12467                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
12468             else
12469                 AC_MSG_ERROR(liblayout.jar replacement not found.)
12470             fi
12471         elif ! test -f $LIBLAYOUT_JAR; then
12472                 AC_MSG_ERROR(liblayout.jar not found.)
12473         fi
12475         if test -z $LIBLOADER_JAR; then
12476             if test -f /usr/share/java/libloader-1.0.0.jar; then
12477                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
12478             elif test -f /usr/share/java/libloader.jar; then
12479                 LIBLOADER_JAR=/usr/share/java/libloader.jar
12480             else
12481                 AC_MSG_ERROR(libloader.jar replacement not found.)
12482             fi
12483         elif ! test -f  $LIBLOADER_JAR; then
12484             AC_MSG_ERROR(libloader.jar not found.)
12485         fi
12487         if test -z $LIBFORMULA_JAR; then
12488             if test -f /usr/share/java/libformula-0.2.0.jar; then
12489                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
12490             elif test -f /usr/share/java/libformula.jar; then
12491                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
12492             else
12493                 AC_MSG_ERROR(libformula.jar replacement not found.)
12494             fi
12495         elif ! test -f $LIBFORMULA_JAR; then
12496                 AC_MSG_ERROR(libformula.jar not found.)
12497         fi
12499         if test -z $LIBREPOSITORY_JAR; then
12500             if test -f /usr/share/java/librepository-1.0.0.jar; then
12501                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
12502             elif test -f /usr/share/java/librepository.jar; then
12503                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
12504             else
12505                 AC_MSG_ERROR(librepository.jar replacement not found.)
12506             fi
12507         elif ! test -f $LIBREPOSITORY_JAR; then
12508             AC_MSG_ERROR(librepository.jar not found.)
12509         fi
12511         if test -z $LIBFONTS_JAR; then
12512             if test -f /usr/share/java/libfonts-1.0.0.jar; then
12513                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
12514             elif test -f /usr/share/java/libfonts.jar; then
12515                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
12516             else
12517                 AC_MSG_ERROR(libfonts.jar replacement not found.)
12518             fi
12519         elif ! test -f $LIBFONTS_JAR; then
12520                 AC_MSG_ERROR(libfonts.jar not found.)
12521         fi
12523         if test -z $LIBSERIALIZER_JAR; then
12524             if test -f /usr/share/java/libserializer-1.0.0.jar; then
12525                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
12526             elif test -f /usr/share/java/libserializer.jar; then
12527                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
12528             else
12529                 AC_MSG_ERROR(libserializer.jar replacement not found.)
12530             fi
12531         elif ! test -f $LIBSERIALIZER_JAR; then
12532                 AC_MSG_ERROR(libserializer.jar not found.)
12533         fi
12535         if test -z $LIBBASE_JAR; then
12536             if test -f /usr/share/java/libbase-1.0.0.jar; then
12537                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
12538             elif test -f /usr/share/java/libbase.jar; then
12539                 LIBBASE_JAR=/usr/share/java/libbase.jar
12540             else
12541                 AC_MSG_ERROR(libbase.jar replacement not found.)
12542             fi
12543         elif ! test -f $LIBBASE_JAR; then
12544             AC_MSG_ERROR(libbase.jar not found.)
12545         fi
12547     else
12548         AC_MSG_RESULT([internal])
12549         SYSTEM_JFREEREPORT=
12550         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
12551         NEED_ANT=TRUE
12552     fi
12553 else
12554     AC_MSG_RESULT([no])
12555     ENABLE_REPORTBUILDER=
12556     SYSTEM_JFREEREPORT=
12558 AC_SUBST(ENABLE_REPORTBUILDER)
12559 AC_SUBST(SYSTEM_JFREEREPORT)
12560 AC_SUBST(SAC_JAR)
12561 AC_SUBST(LIBXML_JAR)
12562 AC_SUBST(FLUTE_JAR)
12563 AC_SUBST(JFREEREPORT_JAR)
12564 AC_SUBST(LIBBASE_JAR)
12565 AC_SUBST(LIBLAYOUT_JAR)
12566 AC_SUBST(LIBLOADER_JAR)
12567 AC_SUBST(LIBFORMULA_JAR)
12568 AC_SUBST(LIBREPOSITORY_JAR)
12569 AC_SUBST(LIBFONTS_JAR)
12570 AC_SUBST(LIBSERIALIZER_JAR)
12572 # scripting provider for BeanShell?
12573 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
12574 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
12575     AC_MSG_RESULT([yes])
12576     ENABLE_SCRIPTING_BEANSHELL=TRUE
12578     dnl ===================================================================
12579     dnl Check for system beanshell
12580     dnl ===================================================================
12581     AC_MSG_CHECKING([which beanshell to use])
12582     if test "$with_system_beanshell" = "yes"; then
12583         AC_MSG_RESULT([external])
12584         SYSTEM_BSH=TRUE
12585         if test -z $BSH_JAR; then
12586             BSH_JAR=/usr/share/java/bsh.jar
12587         fi
12588         if ! test -f $BSH_JAR; then
12589             AC_MSG_ERROR(bsh.jar not found.)
12590         fi
12591     else
12592         AC_MSG_RESULT([internal])
12593         SYSTEM_BSH=
12594         BUILD_TYPE="$BUILD_TYPE BSH"
12595     fi
12596 else
12597     AC_MSG_RESULT([no])
12598     ENABLE_SCRIPTING_BEANSHELL=
12599     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
12601 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
12602 AC_SUBST(SYSTEM_BSH)
12603 AC_SUBST(BSH_JAR)
12605 # scripting provider for JavaScript?
12606 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
12607 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
12608     AC_MSG_RESULT([yes])
12609     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
12611     dnl ===================================================================
12612     dnl Check for system rhino
12613     dnl ===================================================================
12614     AC_MSG_CHECKING([which rhino to use])
12615     if test "$with_system_rhino" = "yes"; then
12616         AC_MSG_RESULT([external])
12617         SYSTEM_RHINO=TRUE
12618         if test -z $RHINO_JAR; then
12619             RHINO_JAR=/usr/share/java/js.jar
12620         fi
12621         if ! test -f $RHINO_JAR; then
12622             AC_MSG_ERROR(js.jar not found.)
12623         fi
12624     else
12625         AC_MSG_RESULT([internal])
12626         SYSTEM_RHINO=
12627         BUILD_TYPE="$BUILD_TYPE RHINO"
12628         NEED_ANT=TRUE
12629     fi
12630 else
12631     AC_MSG_RESULT([no])
12632     ENABLE_SCRIPTING_JAVASCRIPT=
12633     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
12635 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
12636 AC_SUBST(SYSTEM_RHINO)
12637 AC_SUBST(RHINO_JAR)
12639 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
12640 # paths should be added to library search path. So lets put all 64-bit
12641 # platforms there.
12642 supports_multilib=
12643 case "$host_cpu" in
12644 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
12645     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
12646         supports_multilib="yes"
12647     fi
12648     ;;
12650     ;;
12651 esac
12653 dnl ===================================================================
12654 dnl QT5 Integration
12655 dnl ===================================================================
12657 QT5_CFLAGS=""
12658 QT5_LIBS=""
12659 QMAKE5="qmake"
12660 MOC5="moc"
12661 QT5_GOBJECT_CFLAGS=""
12662 QT5_GOBJECT_LIBS=""
12663 QT5_HAVE_GOBJECT=""
12664 QT5_PLATFORMS_SRCDIR=""
12665 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
12666         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
12667         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
12668 then
12669     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
12670     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
12672     if test -n "$supports_multilib"; then
12673         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
12674     fi
12676     qt5_test_include="QtWidgets/qapplication.h"
12677     if test "$_os" = "Emscripten"; then
12678         qt5_test_library="libQt5Widgets.a"
12679     else
12680         qt5_test_library="libQt5Widgets.so"
12681     fi
12683     dnl Check for qmake5
12684     if test -n "$QT5DIR"; then
12685         AC_PATH_PROG(QMAKE5, [qmake], no, [$QT5DIR/bin])
12686     else
12687         AC_PATH_PROGS(QMAKE5, [qmake-qt5 qmake], no)
12688     fi
12689     if test "$QMAKE5" = "no"; then
12690         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12691     else
12692         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
12693         if test -z "$qmake5_test_ver"; then
12694             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12695         fi
12696         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
12697         qt5_minimal_minor="6"
12698         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
12699             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
12700         else
12701             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
12702         fi
12703     fi
12705     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
12706     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
12707     qt5_platformsdir="`$QMAKE5 -query QT_INSTALL_PLUGINS`/platforms"
12708     QT5_PLATFORMS_SRCDIR="$qt5_platformsdir"
12710     AC_MSG_CHECKING([for Qt5 headers])
12711     qt5_incdir="no"
12712     for inc_dir in $qt5_incdirs; do
12713         if test -r "$inc_dir/$qt5_test_include"; then
12714             qt5_incdir="$inc_dir"
12715             break
12716         fi
12717     done
12718     AC_MSG_RESULT([$qt5_incdir])
12719     if test "x$qt5_incdir" = "xno"; then
12720         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12721     fi
12722     # check for scenario: qt5-qtbase-devel-*.86_64 installed but host is i686
12723     AC_LANG_PUSH([C++])
12724     save_CPPFLAGS=$CPPFLAGS
12725     CPPFLAGS="${CPPFLAGS} -I${qt5_incdir}"
12726     AC_CHECK_HEADER(QtCore/qconfig.h, [],
12727         [AC_MSG_ERROR(qconfig.h header not found.)], [])
12728     CPPFLAGS=$save_CPPFLAGS
12729     AC_LANG_POP([C++])
12731     AC_MSG_CHECKING([for Qt5 libraries])
12732     qt5_libdir="no"
12733     for lib_dir in $qt5_libdirs; do
12734         if test -r "$lib_dir/$qt5_test_library"; then
12735             qt5_libdir="$lib_dir"
12736             break
12737         fi
12738     done
12739     AC_MSG_RESULT([$qt5_libdir])
12740     if test "x$qt5_libdir" = "xno"; then
12741         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12742     fi
12744     if test "$_os" = "Emscripten"; then
12745         if test ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html ; then
12746             QT5_PLATFORMS_SRCDIR="${QT5_PLATFORMS_SRCDIR/plugins/src\/plugins}/wasm"
12747         fi
12748         if test ! -f "${qt5_platformsdir}"/libqwasm.a -o ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html; then
12749             AC_MSG_ERROR([No Qt5 WASM QPA plugin found in ${qt5_platformsdir} or ${QT5_PLATFORMS_SRCDIR}])
12750         fi
12751     fi
12753     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
12754     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12755     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
12756     if test "$_os" = "Emscripten"; then
12757         QT5_LIBS="$QT5_LIBS -lqtpcre2 -lQt5EventDispatcherSupport -lQt5FontDatabaseSupport -L${qt5_platformsdir} -lqwasm"
12758     fi
12760     if test "$USING_X11" = TRUE; then
12761         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
12762         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
12763             QT5_HAVE_XCB_ICCCM=1
12764             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
12765         ],[
12766             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)])
12767             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
12768         ])
12769         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
12770         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
12771         QT5_USING_X11=1
12772         AC_DEFINE(QT5_USING_X11)
12773     fi
12775     dnl Check for Meta Object Compiler
12777     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
12778     if test "$MOC5" = "no"; then
12779         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
12780 the root of your Qt installation by exporting QT5DIR before running "configure".])
12781     fi
12783     if test "$test_gstreamer_1_0" = yes; then
12784         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
12785                 QT5_HAVE_GOBJECT=1
12786                 AC_DEFINE(QT5_HAVE_GOBJECT)
12787             ],
12788             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
12789         )
12790     fi
12792 AC_SUBST(QT5_CFLAGS)
12793 AC_SUBST(QT5_LIBS)
12794 AC_SUBST(MOC5)
12795 AC_SUBST(QT5_GOBJECT_CFLAGS)
12796 AC_SUBST(QT5_GOBJECT_LIBS)
12797 AC_SUBST(QT5_HAVE_GOBJECT)
12798 AC_SUBST(QT5_PLATFORMS_SRCDIR)
12800 dnl ===================================================================
12801 dnl KF5 Integration
12802 dnl ===================================================================
12804 KF5_CFLAGS=""
12805 KF5_LIBS=""
12806 KF5_CONFIG="kf5-config"
12807 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
12808         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
12809 then
12810     if test "$OS" = "HAIKU"; then
12811         haiku_arch="`echo $RTL_ARCH | tr X x`"
12812         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
12813         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
12814     fi
12816     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
12817     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
12818     if test -n "$supports_multilib"; then
12819         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
12820     fi
12822     kf5_test_include="KF5/kcoreaddons_version.h"
12823     kf5_test_library="libKF5CoreAddons.so"
12824     kf5_libdirs="$qt5_libdir $kf5_libdirs"
12826     dnl kf5 KDE4 support compatibility installed
12827     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
12828     if test "$KF5_CONFIG" != "no"; then
12829         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
12830         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
12831     fi
12833     dnl Check for KF5 headers
12834     AC_MSG_CHECKING([for KF5 headers])
12835     kf5_incdir="no"
12836     for kf5_check in $kf5_incdirs; do
12837         if test -r "$kf5_check/$kf5_test_include"; then
12838             kf5_incdir="$kf5_check/KF5"
12839             break
12840         fi
12841     done
12842     AC_MSG_RESULT([$kf5_incdir])
12843     if test "x$kf5_incdir" = "xno"; then
12844         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
12845     fi
12847     dnl Check for KF5 libraries
12848     AC_MSG_CHECKING([for KF5 libraries])
12849     kf5_libdir="no"
12850     for kf5_check in $kf5_libdirs; do
12851         if test -r "$kf5_check/$kf5_test_library"; then
12852             kf5_libdir="$kf5_check"
12853             break
12854         fi
12855     done
12857     AC_MSG_RESULT([$kf5_libdir])
12858     if test "x$kf5_libdir" = "xno"; then
12859         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
12860     fi
12862     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"
12863     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
12864     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12866     if test "$USING_X11" = TRUE; then
12867         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
12868     fi
12870     AC_LANG_PUSH([C++])
12871     save_CXXFLAGS=$CXXFLAGS
12872     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
12873     AC_MSG_CHECKING([whether KDE is >= 5.0])
12874        AC_RUN_IFELSE([AC_LANG_SOURCE([[
12875 #include <kcoreaddons_version.h>
12877 int main(int argc, char **argv) {
12878        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
12879        else return 1;
12881        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
12882     CXXFLAGS=$save_CXXFLAGS
12883     AC_LANG_POP([C++])
12885 AC_SUBST(KF5_CFLAGS)
12886 AC_SUBST(KF5_LIBS)
12888 dnl ===================================================================
12889 dnl Test whether to include Evolution 2 support
12890 dnl ===================================================================
12891 AC_MSG_CHECKING([whether to enable evolution 2 support])
12892 if test "$enable_evolution2" = yes; then
12893     AC_MSG_RESULT([yes])
12894     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
12895     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12896     FilterLibs "${GOBJECT_LIBS}"
12897     GOBJECT_LIBS="${filteredlibs}"
12898     ENABLE_EVOAB2="TRUE"
12899 else
12900     AC_MSG_RESULT([no])
12902 AC_SUBST(ENABLE_EVOAB2)
12903 AC_SUBST(GOBJECT_CFLAGS)
12904 AC_SUBST(GOBJECT_LIBS)
12906 dnl ===================================================================
12907 dnl Test which themes to include
12908 dnl ===================================================================
12909 AC_MSG_CHECKING([which themes to include])
12910 # if none given use default subset of available themes
12911 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
12912     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"
12915 WITH_THEMES=""
12916 if test "x$with_theme" != "xno"; then
12917     for theme in $with_theme; do
12918         case $theme in
12919         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" ;;
12920         default) real_theme=colibre ;;
12921         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
12922         esac
12923         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
12924     done
12926 AC_MSG_RESULT([$WITH_THEMES])
12927 AC_SUBST([WITH_THEMES])
12928 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
12929 for theme in $with_theme; do
12930     case $theme in
12931     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
12932     *) ;;
12933     esac
12934 done
12936 ###############################################################################
12937 # Extensions checking
12938 ###############################################################################
12939 AC_MSG_CHECKING([for extensions integration])
12940 if test "x$enable_extension_integration" != "xno"; then
12941     WITH_EXTENSION_INTEGRATION=TRUE
12942     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
12943     AC_MSG_RESULT([yes, use integration])
12944 else
12945     WITH_EXTENSION_INTEGRATION=
12946     AC_MSG_RESULT([no, do not integrate])
12948 AC_SUBST(WITH_EXTENSION_INTEGRATION)
12950 dnl Should any extra extensions be included?
12951 dnl There are standalone tests for each of these below.
12952 WITH_EXTRA_EXTENSIONS=
12953 AC_SUBST([WITH_EXTRA_EXTENSIONS])
12955 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
12956 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
12957 if test "x$with_java" != "xno"; then
12958     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
12959     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
12962 AC_MSG_CHECKING([whether to build opens___.ttf])
12963 if test "$enable_build_opensymbol" = "yes"; then
12964     AC_MSG_RESULT([yes])
12965     AC_PATH_PROG(FONTFORGE, fontforge)
12966     if test -z "$FONTFORGE"; then
12967         AC_MSG_ERROR([fontforge not installed])
12968     fi
12969 else
12970     AC_MSG_RESULT([no])
12971     OPENSYMBOL_TTF=f543e6e2d7275557a839a164941c0a86e5f2c3f2a0042bfc434c88c6dde9e140-opens___.ttf
12972     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
12974 AC_SUBST(OPENSYMBOL_TTF)
12975 AC_SUBST(FONTFORGE)
12977 dnl ===================================================================
12978 dnl Test whether to include fonts
12979 dnl ===================================================================
12980 AC_MSG_CHECKING([whether to include third-party fonts])
12981 if test "$with_fonts" != "no"; then
12982     AC_MSG_RESULT([yes])
12983     WITH_FONTS=TRUE
12984     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
12985     AC_DEFINE(HAVE_MORE_FONTS)
12986 else
12987     AC_MSG_RESULT([no])
12988     WITH_FONTS=
12989     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
12991 AC_SUBST(WITH_FONTS)
12994 dnl ===================================================================
12995 dnl Test whether to enable online update service
12996 dnl ===================================================================
12997 AC_MSG_CHECKING([whether to enable online update])
12998 ENABLE_ONLINE_UPDATE=
12999 ENABLE_ONLINE_UPDATE_MAR=
13000 UPDATE_CONFIG=
13001 if test "$enable_online_update" = ""; then
13002     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
13003         AC_MSG_RESULT([yes])
13004         ENABLE_ONLINE_UPDATE="TRUE"
13005     else
13006         AC_MSG_RESULT([no])
13007     fi
13008 else
13009     if test "$enable_online_update" = "mar"; then
13010         AC_MSG_RESULT([yes - MAR-based online update])
13011         ENABLE_ONLINE_UPDATE_MAR="TRUE"
13012         if test "$with_update_config" = ""; then
13013             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
13014         fi
13015         UPDATE_CONFIG="$with_update_config"
13016         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
13017     elif test "$enable_online_update" = "yes"; then
13018         AC_MSG_RESULT([yes])
13019         ENABLE_ONLINE_UPDATE="TRUE"
13020     else
13021         AC_MSG_RESULT([no])
13022     fi
13024 AC_SUBST(ENABLE_ONLINE_UPDATE)
13025 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
13026 AC_SUBST(UPDATE_CONFIG)
13029 PRIVACY_POLICY_URL="$with_privacy_policy_url"
13030 if test "$ENABLE_ONLINE_UPDATE" = TRUE -o "$ENABLE_BREAKPAD" = "TRUE"; then
13031     if test "x$with_privacy_policy_url" = "xundefined"; then
13032         AC_MSG_FAILURE([online update or breakpad/crashreporting are enabled, but no --with-privacy-policy-url=... was provided])
13033     fi
13035 AC_SUBST(PRIVACY_POLICY_URL)
13036 dnl ===================================================================
13037 dnl Test whether we need bzip2
13038 dnl ===================================================================
13039 SYSTEM_BZIP2=
13040 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
13041     AC_MSG_CHECKING([whether to use system bzip2])
13042     if test "$with_system_bzip2" = yes; then
13043         SYSTEM_BZIP2=TRUE
13044         AC_MSG_RESULT([yes])
13045         PKG_CHECK_MODULES(BZIP2, bzip2)
13046         FilterLibs "${BZIP2_LIBS}"
13047         BZIP2_LIBS="${filteredlibs}"
13048     else
13049         AC_MSG_RESULT([no])
13050         BUILD_TYPE="$BUILD_TYPE BZIP2"
13051     fi
13053 AC_SUBST(SYSTEM_BZIP2)
13054 AC_SUBST(BZIP2_CFLAGS)
13055 AC_SUBST(BZIP2_LIBS)
13057 dnl ===================================================================
13058 dnl Test whether to enable extension update
13059 dnl ===================================================================
13060 AC_MSG_CHECKING([whether to enable extension update])
13061 ENABLE_EXTENSION_UPDATE=
13062 if test "x$enable_extension_update" = "xno"; then
13063     AC_MSG_RESULT([no])
13064 else
13065     AC_MSG_RESULT([yes])
13066     ENABLE_EXTENSION_UPDATE="TRUE"
13067     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
13068     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
13070 AC_SUBST(ENABLE_EXTENSION_UPDATE)
13073 dnl ===================================================================
13074 dnl Test whether to create MSI with LIMITUI=1 (silent install)
13075 dnl ===================================================================
13076 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
13077 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
13078     AC_MSG_RESULT([no])
13079     ENABLE_SILENT_MSI=
13080 else
13081     AC_MSG_RESULT([yes])
13082     ENABLE_SILENT_MSI=TRUE
13083     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
13085 AC_SUBST(ENABLE_SILENT_MSI)
13087 AC_MSG_CHECKING([whether and how to use Xinerama])
13088 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
13089     if test "$x_libraries" = "default_x_libraries"; then
13090         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
13091         if test "x$XINERAMALIB" = x; then
13092            XINERAMALIB="/usr/lib"
13093         fi
13094     else
13095         XINERAMALIB="$x_libraries"
13096     fi
13097     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
13098         # we have both versions, let the user decide but use the dynamic one
13099         # per default
13100         USE_XINERAMA=TRUE
13101         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
13102             XINERAMA_LINK=dynamic
13103         else
13104             XINERAMA_LINK=static
13105         fi
13106     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
13107         # we have only the dynamic version
13108         USE_XINERAMA=TRUE
13109         XINERAMA_LINK=dynamic
13110     elif test -e "$XINERAMALIB/libXinerama.a"; then
13111         # static version
13112         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
13113             USE_XINERAMA=TRUE
13114             XINERAMA_LINK=static
13115         else
13116             USE_XINERAMA=
13117             XINERAMA_LINK=none
13118         fi
13119     else
13120         # no Xinerama
13121         USE_XINERAMA=
13122         XINERAMA_LINK=none
13123     fi
13124     if test "$USE_XINERAMA" = "TRUE"; then
13125         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
13126         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
13127             [AC_MSG_ERROR(Xinerama header not found.)], [])
13128         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
13129         if test "x$XEXTLIB" = x; then
13130            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
13131         fi
13132         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
13133         if test "$_os" = "FreeBSD"; then
13134             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
13135         fi
13136         if test "$_os" = "Linux"; then
13137             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
13138         fi
13139         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
13140             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
13141     else
13142         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
13143     fi
13144 else
13145     USE_XINERAMA=
13146     XINERAMA_LINK=none
13147     AC_MSG_RESULT([no])
13149 AC_SUBST(USE_XINERAMA)
13150 AC_SUBST(XINERAMA_LINK)
13152 dnl ===================================================================
13153 dnl Test whether to build cairo or rely on the system version
13154 dnl ===================================================================
13156 if test "$test_cairo" = "yes"; then
13157     AC_MSG_CHECKING([whether to use the system cairo])
13159     : ${with_system_cairo:=$with_system_libs}
13160     if test "$with_system_cairo" = "yes"; then
13161         SYSTEM_CAIRO=TRUE
13162         AC_MSG_RESULT([yes])
13164         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
13165         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13166         FilterLibs "${CAIRO_LIBS}"
13167         CAIRO_LIBS="${filteredlibs}"
13169         if test "$test_xrender" = "yes"; then
13170             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
13171             AC_LANG_PUSH([C])
13172             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
13173 #ifdef PictStandardA8
13174 #else
13175       return fail;
13176 #endif
13177 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
13179             AC_LANG_POP([C])
13180         fi
13181     else
13182         AC_MSG_RESULT([no])
13183         BUILD_TYPE="$BUILD_TYPE CAIRO"
13184     fi
13186     if test "$enable_cairo_canvas" != no; then
13187         AC_DEFINE(ENABLE_CAIRO_CANVAS)
13188         ENABLE_CAIRO_CANVAS=TRUE
13189     fi
13192 AC_SUBST(CAIRO_CFLAGS)
13193 AC_SUBST(CAIRO_LIBS)
13194 AC_SUBST(ENABLE_CAIRO_CANVAS)
13195 AC_SUBST(SYSTEM_CAIRO)
13197 dnl ===================================================================
13198 dnl Test whether to use avahi
13199 dnl ===================================================================
13200 if test "$_os" = "WINNT"; then
13201     # Windows uses bundled mDNSResponder
13202     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
13203 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
13204     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
13205                       [ENABLE_AVAHI="TRUE"])
13206     AC_DEFINE(HAVE_FEATURE_AVAHI)
13207     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13208     FilterLibs "${AVAHI_LIBS}"
13209     AVAHI_LIBS="${filteredlibs}"
13212 AC_SUBST(ENABLE_AVAHI)
13213 AC_SUBST(AVAHI_CFLAGS)
13214 AC_SUBST(AVAHI_LIBS)
13216 dnl ===================================================================
13217 dnl Test whether to use liblangtag
13218 dnl ===================================================================
13219 SYSTEM_LIBLANGTAG=
13220 AC_MSG_CHECKING([whether to use system liblangtag])
13221 if test "$with_system_liblangtag" = yes; then
13222     SYSTEM_LIBLANGTAG=TRUE
13223     AC_MSG_RESULT([yes])
13224     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
13225     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
13226     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
13227     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13228     FilterLibs "${LIBLANGTAG_LIBS}"
13229     LIBLANGTAG_LIBS="${filteredlibs}"
13230 else
13231     SYSTEM_LIBLANGTAG=
13232     AC_MSG_RESULT([no])
13233     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
13234     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
13235     if test "$COM" = "MSC"; then
13236         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
13237     else
13238         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
13239     fi
13241 AC_SUBST(SYSTEM_LIBLANGTAG)
13242 AC_SUBST(LIBLANGTAG_CFLAGS)
13243 AC_SUBST(LIBLANGTAG_LIBS)
13245 dnl ===================================================================
13246 dnl Test whether to build libpng or rely on the system version
13247 dnl ===================================================================
13249 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
13251 dnl ===================================================================
13252 dnl Check for runtime JVM search path
13253 dnl ===================================================================
13254 if test "$ENABLE_JAVA" != ""; then
13255     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
13256     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
13257         AC_MSG_RESULT([yes])
13258         if ! test -d "$with_jvm_path"; then
13259             AC_MSG_ERROR(["$with_jvm_path" not a directory])
13260         fi
13261         if ! test -d "$with_jvm_path"jvm; then
13262             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
13263         fi
13264         JVM_ONE_PATH_CHECK="$with_jvm_path"
13265         AC_SUBST(JVM_ONE_PATH_CHECK)
13266     else
13267         AC_MSG_RESULT([no])
13268     fi
13271 dnl ===================================================================
13272 dnl Test for the presence of Ant and that it works
13273 dnl ===================================================================
13275 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE" -a "$cross_compiling" != "yes"; then
13276     ANT_HOME=; export ANT_HOME
13277     WITH_ANT_HOME=; export WITH_ANT_HOME
13278     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
13279         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
13280             if test "$_os" = "WINNT"; then
13281                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
13282             else
13283                 with_ant_home="$LODE_HOME/opt/ant"
13284             fi
13285         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
13286             with_ant_home="$LODE_HOME/opt/ant"
13287         fi
13288     fi
13289     if test -z "$with_ant_home"; then
13290         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
13291     else
13292         if test "$_os" = "WINNT"; then
13293             # AC_PATH_PROGS needs unix path
13294             with_ant_home=`cygpath -u "$with_ant_home"`
13295         fi
13296         AbsolutePath "$with_ant_home"
13297         with_ant_home=$absolute_path
13298         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
13299         WITH_ANT_HOME=$with_ant_home
13300         ANT_HOME=$with_ant_home
13301     fi
13303     if test -z "$ANT"; then
13304         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
13305     else
13306         # resolve relative or absolute symlink
13307         while test -h "$ANT"; do
13308             a_cwd=`pwd`
13309             a_basename=`basename "$ANT"`
13310             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
13311             cd "`dirname "$ANT"`"
13312             cd "`dirname "$a_script"`"
13313             ANT="`pwd`"/"`basename "$a_script"`"
13314             cd "$a_cwd"
13315         done
13317         AC_MSG_CHECKING([if $ANT works])
13318         mkdir -p conftest.dir
13319         a_cwd=$(pwd)
13320         cd conftest.dir
13321         cat > conftest.java << EOF
13322         public class conftest {
13323             int testmethod(int a, int b) {
13324                     return a + b;
13325             }
13326         }
13329         cat > conftest.xml << EOF
13330         <project name="conftest" default="conftest">
13331         <target name="conftest">
13332             <javac srcdir="." includes="conftest.java">
13333             </javac>
13334         </target>
13335         </project>
13338         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
13339         if test $? = 0 -a -f ./conftest.class; then
13340             AC_MSG_RESULT([Ant works])
13341             if test -z "$WITH_ANT_HOME"; then
13342                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
13343                 if test -z "$ANT_HOME"; then
13344                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
13345                 fi
13346             else
13347                 ANT_HOME="$WITH_ANT_HOME"
13348             fi
13349         else
13350             echo "configure: Ant test failed" >&5
13351             cat conftest.java >&5
13352             cat conftest.xml >&5
13353             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
13354         fi
13355         cd "$a_cwd"
13356         rm -fr conftest.dir
13357     fi
13358     if test -z "$ANT_HOME"; then
13359         ANT_HOME="NO_ANT_HOME"
13360     else
13361         PathFormat "$ANT_HOME"
13362         ANT_HOME="$formatted_path"
13363         PathFormat "$ANT"
13364         ANT="$formatted_path"
13365     fi
13367     dnl Checking for ant.jar
13368     if test "$ANT_HOME" != "NO_ANT_HOME"; then
13369         AC_MSG_CHECKING([Ant lib directory])
13370         if test -f $ANT_HOME/lib/ant.jar; then
13371             ANT_LIB="$ANT_HOME/lib"
13372         else
13373             if test -f $ANT_HOME/ant.jar; then
13374                 ANT_LIB="$ANT_HOME"
13375             else
13376                 if test -f /usr/share/java/ant.jar; then
13377                     ANT_LIB=/usr/share/java
13378                 else
13379                     if test -f /usr/share/ant-core/lib/ant.jar; then
13380                         ANT_LIB=/usr/share/ant-core/lib
13381                     else
13382                         if test -f $ANT_HOME/lib/ant/ant.jar; then
13383                             ANT_LIB="$ANT_HOME/lib/ant"
13384                         else
13385                             if test -f /usr/share/lib/ant/ant.jar; then
13386                                 ANT_LIB=/usr/share/lib/ant
13387                             else
13388                                 AC_MSG_ERROR([Ant libraries not found!])
13389                             fi
13390                         fi
13391                     fi
13392                 fi
13393             fi
13394         fi
13395         PathFormat "$ANT_LIB"
13396         ANT_LIB="$formatted_path"
13397         AC_MSG_RESULT([Ant lib directory found.])
13398     fi
13400     ant_minver=1.6.0
13401     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
13403     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
13404     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
13405     ant_version_major=`echo $ant_version | cut -d. -f1`
13406     ant_version_minor=`echo $ant_version | cut -d. -f2`
13407     echo "configure: ant_version $ant_version " >&5
13408     echo "configure: ant_version_major $ant_version_major " >&5
13409     echo "configure: ant_version_minor $ant_version_minor " >&5
13410     if test "$ant_version_major" -ge "2"; then
13411         AC_MSG_RESULT([yes, $ant_version])
13412     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
13413         AC_MSG_RESULT([yes, $ant_version])
13414     else
13415         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
13416     fi
13418     rm -f conftest* core core.* *.core
13420 AC_SUBST(ANT)
13421 AC_SUBST(ANT_HOME)
13422 AC_SUBST(ANT_LIB)
13424 OOO_JUNIT_JAR=
13425 HAMCREST_JAR=
13426 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no" -a "$cross_compiling" != "yes"; then
13427     AC_MSG_CHECKING([for JUnit 4])
13428     if test "$with_junit" = "yes"; then
13429         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
13430             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
13431         elif test -e /usr/share/java/junit4.jar; then
13432             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
13433         else
13434            if test -e /usr/share/lib/java/junit.jar; then
13435               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
13436            else
13437               OOO_JUNIT_JAR=/usr/share/java/junit.jar
13438            fi
13439         fi
13440     else
13441         OOO_JUNIT_JAR=$with_junit
13442     fi
13443     if test "$_os" = "WINNT"; then
13444         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
13445     fi
13446     printf 'import org.junit.Before;' > conftest.java
13447     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
13448         AC_MSG_RESULT([$OOO_JUNIT_JAR])
13449     else
13450         AC_MSG_ERROR(
13451 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
13452  specify its pathname via --with-junit=..., or disable it via --without-junit])
13453     fi
13454     rm -f conftest.class conftest.java
13455     if test $OOO_JUNIT_JAR != ""; then
13456         BUILD_TYPE="$BUILD_TYPE QADEVOOO"
13457     fi
13459     AC_MSG_CHECKING([for included Hamcrest])
13460     printf 'import org.hamcrest.BaseDescription;' > conftest.java
13461     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
13462         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
13463     else
13464         AC_MSG_RESULT([Not included])
13465         AC_MSG_CHECKING([for standalone hamcrest jar.])
13466         if test "$with_hamcrest" = "yes"; then
13467             if test -e /usr/share/lib/java/hamcrest.jar; then
13468                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
13469             elif test -e /usr/share/java/hamcrest/core.jar; then
13470                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
13471             elif test -e /usr/share/java/hamcrest/hamcrest.jar; then
13472                 HAMCREST_JAR=/usr/share/java/hamcrest/hamcrest.jar
13473             else
13474                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
13475             fi
13476         else
13477             HAMCREST_JAR=$with_hamcrest
13478         fi
13479         if test "$_os" = "WINNT"; then
13480             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
13481         fi
13482         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
13483             AC_MSG_RESULT([$HAMCREST_JAR])
13484         else
13485             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),
13486                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
13487         fi
13488     fi
13489     rm -f conftest.class conftest.java
13491 AC_SUBST(OOO_JUNIT_JAR)
13492 AC_SUBST(HAMCREST_JAR)
13495 AC_SUBST(SCPDEFS)
13498 # check for wget and curl
13500 WGET=
13501 CURL=
13503 if test "$enable_fetch_external" != "no"; then
13505 CURL=`which curl 2>/dev/null`
13507 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
13508     # wget new enough?
13509     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
13510     if test $? -eq 0; then
13511         WGET=$i
13512         break
13513     fi
13514 done
13516 if test -z "$WGET" -a -z "$CURL"; then
13517     AC_MSG_ERROR([neither wget nor curl found!])
13522 AC_SUBST(WGET)
13523 AC_SUBST(CURL)
13526 # check for sha256sum
13528 SHA256SUM=
13530 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
13531     eval "$i -a 256 --version" > /dev/null 2>&1
13532     ret=$?
13533     if test $ret -eq 0; then
13534         SHA256SUM="$i -a 256"
13535         break
13536     fi
13537 done
13539 if test -z "$SHA256SUM"; then
13540     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
13541         eval "$i --version" > /dev/null 2>&1
13542         ret=$?
13543         if test $ret -eq 0; then
13544             SHA256SUM=$i
13545             break
13546         fi
13547     done
13550 if test -z "$SHA256SUM"; then
13551     AC_MSG_ERROR([no sha256sum found!])
13554 AC_SUBST(SHA256SUM)
13556 dnl ===================================================================
13557 dnl Dealing with l10n options
13558 dnl ===================================================================
13559 AC_MSG_CHECKING([which languages to be built])
13560 # get list of all languages
13561 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
13562 # the sed command does the following:
13563 #   + if a line ends with a backslash, append the next line to it
13564 #   + adds " on the beginning of the value (after =)
13565 #   + adds " at the end of the value
13566 #   + removes en-US; we want to put it on the beginning
13567 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
13568 [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)]
13569 ALL_LANGS="en-US $completelangiso"
13570 # check the configured localizations
13571 WITH_LANG="$with_lang"
13573 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
13574 # (Norwegian is "nb" and "nn".)
13575 if test "$WITH_LANG" = "no"; then
13576     WITH_LANG=
13579 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
13580     AC_MSG_RESULT([en-US])
13581 else
13582     AC_MSG_RESULT([$WITH_LANG])
13583     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
13584     if test -z "$MSGFMT"; then
13585         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
13586             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
13587         elif test -x "/opt/lo/bin/msgfmt"; then
13588             MSGFMT="/opt/lo/bin/msgfmt"
13589         else
13590             AC_CHECK_PROGS(MSGFMT, [msgfmt])
13591             if test -z "$MSGFMT"; then
13592                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
13593             fi
13594         fi
13595     fi
13596     if test -z "$MSGUNIQ"; then
13597         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
13598             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
13599         elif test -x "/opt/lo/bin/msguniq"; then
13600             MSGUNIQ="/opt/lo/bin/msguniq"
13601         else
13602             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
13603             if test -z "$MSGUNIQ"; then
13604                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
13605             fi
13606         fi
13607     fi
13609 AC_SUBST(MSGFMT)
13610 AC_SUBST(MSGUNIQ)
13611 # check that the list is valid
13612 for lang in $WITH_LANG; do
13613     test "$lang" = "ALL" && continue
13614     # need to check for the exact string, so add space before and after the list of all languages
13615     for vl in $ALL_LANGS; do
13616         if test "$vl" = "$lang"; then
13617            break
13618         fi
13619     done
13620     if test "$vl" != "$lang"; then
13621         # if you're reading this - you prolly quoted your languages remove the quotes ...
13622         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
13623     fi
13624 done
13625 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
13626     echo $WITH_LANG | grep -q en-US
13627     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
13629 # list with substituted ALL
13630 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
13631 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
13632 test "$WITH_LANG" = "en-US" && WITH_LANG=
13633 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
13634     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
13635     ALL_LANGS=`echo $ALL_LANGS qtz`
13637 AC_SUBST(ALL_LANGS)
13638 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
13639 AC_SUBST(WITH_LANG)
13640 AC_SUBST(WITH_LANG_LIST)
13641 AC_SUBST(GIT_NEEDED_SUBMODULES)
13643 WITH_POOR_HELP_LOCALIZATIONS=
13644 if test -d "$SRC_ROOT/translations/source"; then
13645     for l in `ls -1 $SRC_ROOT/translations/source`; do
13646         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
13647             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
13648         fi
13649     done
13651 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
13653 if test -n "$with_locales"; then
13654     WITH_LOCALES="$with_locales"
13656     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
13657     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
13658     # config_host/config_locales.h.in
13659     for locale in $WITH_LOCALES; do
13660         lang=${locale%_*}
13662         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
13664         case $lang in
13665         hi|mr*ne)
13666             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
13667             ;;
13668         bg|ru)
13669             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
13670             ;;
13671         esac
13672     done
13673 else
13674     AC_DEFINE(WITH_LOCALE_ALL)
13676 AC_SUBST(WITH_LOCALES)
13678 dnl git submodule update --reference
13679 dnl ===================================================================
13680 if test -n "${GIT_REFERENCE_SRC}"; then
13681     for repo in ${GIT_NEEDED_SUBMODULES}; do
13682         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
13683             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
13684         fi
13685     done
13687 AC_SUBST(GIT_REFERENCE_SRC)
13689 dnl git submodules linked dirs
13690 dnl ===================================================================
13691 if test -n "${GIT_LINK_SRC}"; then
13692     for repo in ${GIT_NEEDED_SUBMODULES}; do
13693         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
13694             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
13695         fi
13696     done
13698 AC_SUBST(GIT_LINK_SRC)
13700 dnl branding
13701 dnl ===================================================================
13702 AC_MSG_CHECKING([for alternative branding images directory])
13703 # initialize mapped arrays
13704 BRAND_INTRO_IMAGES="intro.png intro-highres.png"
13705 brand_files="$BRAND_INTRO_IMAGES logo.svg logo_inverted.svg logo-sc.svg logo-sc_inverted.svg about.svg"
13707 if test -z "$with_branding" -o "$with_branding" = "no"; then
13708     AC_MSG_RESULT([none])
13709     DEFAULT_BRAND_IMAGES="$brand_files"
13710 else
13711     if ! test -d $with_branding ; then
13712         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
13713     else
13714         AC_MSG_RESULT([$with_branding])
13715         CUSTOM_BRAND_DIR="$with_branding"
13716         for lfile in $brand_files
13717         do
13718             if ! test -f $with_branding/$lfile ; then
13719                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
13720                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
13721             else
13722                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
13723             fi
13724         done
13725         check_for_progress="yes"
13726     fi
13728 AC_SUBST([BRAND_INTRO_IMAGES])
13729 AC_SUBST([CUSTOM_BRAND_DIR])
13730 AC_SUBST([CUSTOM_BRAND_IMAGES])
13731 AC_SUBST([DEFAULT_BRAND_IMAGES])
13734 AC_MSG_CHECKING([for 'intro' progress settings])
13735 PROGRESSBARCOLOR=
13736 PROGRESSSIZE=
13737 PROGRESSPOSITION=
13738 PROGRESSFRAMECOLOR=
13739 PROGRESSTEXTCOLOR=
13740 PROGRESSTEXTBASELINE=
13742 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
13743     source "$with_branding/progress.conf"
13744     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
13745 else
13746     AC_MSG_RESULT([none])
13749 AC_SUBST(PROGRESSBARCOLOR)
13750 AC_SUBST(PROGRESSSIZE)
13751 AC_SUBST(PROGRESSPOSITION)
13752 AC_SUBST(PROGRESSFRAMECOLOR)
13753 AC_SUBST(PROGRESSTEXTCOLOR)
13754 AC_SUBST(PROGRESSTEXTBASELINE)
13757 dnl ===================================================================
13758 dnl Custom build version
13759 dnl ===================================================================
13760 AC_MSG_CHECKING([for extra build ID])
13761 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
13762     EXTRA_BUILDID="$with_extra_buildid"
13764 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
13765 if test -n "$EXTRA_BUILDID" ; then
13766     AC_MSG_RESULT([$EXTRA_BUILDID])
13767 else
13768     AC_MSG_RESULT([not set])
13770 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
13772 OOO_VENDOR=
13773 AC_MSG_CHECKING([for vendor])
13774 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
13775     OOO_VENDOR="$USERNAME"
13777     if test -z "$OOO_VENDOR"; then
13778         OOO_VENDOR="$USER"
13779     fi
13781     if test -z "$OOO_VENDOR"; then
13782         OOO_VENDOR="`id -u -n`"
13783     fi
13785     AC_MSG_RESULT([not set, using $OOO_VENDOR])
13786 else
13787     OOO_VENDOR="$with_vendor"
13788     AC_MSG_RESULT([$OOO_VENDOR])
13790 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
13791 AC_SUBST(OOO_VENDOR)
13793 if test "$_os" = "Android" ; then
13794     ANDROID_PACKAGE_NAME=
13795     AC_MSG_CHECKING([for Android package name])
13796     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
13797         if test -n "$ENABLE_DEBUG"; then
13798             # Default to the package name that makes ndk-gdb happy.
13799             ANDROID_PACKAGE_NAME="org.libreoffice"
13800         else
13801             ANDROID_PACKAGE_NAME="org.example.libreoffice"
13802         fi
13804         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
13805     else
13806         ANDROID_PACKAGE_NAME="$with_android_package_name"
13807         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
13808     fi
13809     AC_SUBST(ANDROID_PACKAGE_NAME)
13812 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
13813 if test "$with_compat_oowrappers" = "yes"; then
13814     WITH_COMPAT_OOWRAPPERS=TRUE
13815     AC_MSG_RESULT(yes)
13816 else
13817     WITH_COMPAT_OOWRAPPERS=
13818     AC_MSG_RESULT(no)
13820 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
13822 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
13823 AC_MSG_CHECKING([for install dirname])
13824 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
13825     INSTALLDIRNAME="$with_install_dirname"
13827 AC_MSG_RESULT([$INSTALLDIRNAME])
13828 AC_SUBST(INSTALLDIRNAME)
13830 AC_MSG_CHECKING([for prefix])
13831 test "x$prefix" = xNONE && prefix=$ac_default_prefix
13832 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
13833 PREFIXDIR="$prefix"
13834 AC_MSG_RESULT([$PREFIXDIR])
13835 AC_SUBST(PREFIXDIR)
13837 LIBDIR=[$(eval echo $(eval echo $libdir))]
13838 AC_SUBST(LIBDIR)
13840 DATADIR=[$(eval echo $(eval echo $datadir))]
13841 AC_SUBST(DATADIR)
13843 MANDIR=[$(eval echo $(eval echo $mandir))]
13844 AC_SUBST(MANDIR)
13846 DOCDIR=[$(eval echo $(eval echo $docdir))]
13847 AC_SUBST(DOCDIR)
13849 BINDIR=[$(eval echo $(eval echo $bindir))]
13850 AC_SUBST(BINDIR)
13852 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
13853 AC_SUBST(INSTALLDIR)
13855 TESTINSTALLDIR="${BUILDDIR}/test-install"
13856 AC_SUBST(TESTINSTALLDIR)
13859 # ===================================================================
13860 # OAuth2 id and secrets
13861 # ===================================================================
13863 AC_MSG_CHECKING([for Google Drive client id and secret])
13864 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
13865     AC_MSG_RESULT([not set])
13866     GDRIVE_CLIENT_ID="\"\""
13867     GDRIVE_CLIENT_SECRET="\"\""
13868 else
13869     AC_MSG_RESULT([set])
13870     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
13871     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
13873 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
13874 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
13876 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
13877 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
13878     AC_MSG_RESULT([not set])
13879     ALFRESCO_CLOUD_CLIENT_ID="\"\""
13880     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
13881 else
13882     AC_MSG_RESULT([set])
13883     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
13884     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
13886 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
13887 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
13889 AC_MSG_CHECKING([for OneDrive client id and secret])
13890 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
13891     AC_MSG_RESULT([not set])
13892     ONEDRIVE_CLIENT_ID="\"\""
13893     ONEDRIVE_CLIENT_SECRET="\"\""
13894 else
13895     AC_MSG_RESULT([set])
13896     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
13897     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
13899 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
13900 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
13903 dnl ===================================================================
13904 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
13905 dnl --enable-dependency-tracking configure option
13906 dnl ===================================================================
13907 AC_MSG_CHECKING([whether to enable dependency tracking])
13908 if test "$enable_dependency_tracking" = "no"; then
13909     nodep=TRUE
13910     AC_MSG_RESULT([no])
13911 else
13912     AC_MSG_RESULT([yes])
13914 AC_SUBST(nodep)
13916 dnl ===================================================================
13917 dnl Number of CPUs to use during the build
13918 dnl ===================================================================
13919 AC_MSG_CHECKING([for number of processors to use])
13920 # plain --with-parallelism is just the default
13921 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
13922     if test "$with_parallelism" = "no"; then
13923         PARALLELISM=0
13924     else
13925         PARALLELISM=$with_parallelism
13926     fi
13927 else
13928     if test "$enable_icecream" = "yes"; then
13929         PARALLELISM="40"
13930     else
13931         case `uname -s` in
13933         Darwin|FreeBSD|NetBSD|OpenBSD)
13934             PARALLELISM=`sysctl -n hw.ncpu`
13935             ;;
13937         Linux)
13938             PARALLELISM=`getconf _NPROCESSORS_ONLN`
13939         ;;
13940         # what else than above does profit here *and* has /proc?
13941         *)
13942             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
13943             ;;
13944         esac
13946         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
13947         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
13948     fi
13951 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
13952     if test -z "$with_parallelism"; then
13953             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
13954             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
13955             PARALLELISM="1"
13956     else
13957         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."
13958     fi
13961 if test $PARALLELISM -eq 0; then
13962     AC_MSG_RESULT([explicit make -j option needed])
13963 else
13964     AC_MSG_RESULT([$PARALLELISM])
13966 AC_SUBST(PARALLELISM)
13968 IWYU_PATH="$with_iwyu"
13969 AC_SUBST(IWYU_PATH)
13970 if test ! -z "$IWYU_PATH"; then
13971     if test ! -f "$IWYU_PATH"; then
13972         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
13973     fi
13977 # Set up ILIB for MSVC build
13979 ILIB1=
13980 if test "$build_os" = "cygwin"; then
13981     ILIB="."
13982     if test -n "$JAVA_HOME"; then
13983         ILIB="$ILIB;$JAVA_HOME/lib"
13984     fi
13985     ILIB1=-link
13986     ILIB="$ILIB;$COMPATH/lib/$WIN_HOST_ARCH"
13987     ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/$WIN_HOST_ARCH"
13988     ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
13989     ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
13990     if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
13991         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
13992         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
13993     fi
13994     PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/$WIN_HOST_ARCH"
13995     ucrtlibpath_formatted=$formatted_path
13996     ILIB="$ILIB;$ucrtlibpath_formatted"
13997     ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
13998     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
13999         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
14000     else
14001         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WIN_HOST_ARCH"
14002     fi
14004     if test "$cross_compiling" != "yes"; then
14005         ILIB_FOR_BUILD="$ILIB"
14006     fi
14008 AC_SUBST(ILIB)
14009 AC_SUBST(ILIB_FOR_BUILD)
14011 # ===================================================================
14012 # Creating bigger shared library to link against
14013 # ===================================================================
14014 AC_MSG_CHECKING([whether to create huge library])
14015 MERGELIBS=
14017 if test $_os = iOS -o $_os = Android; then
14018     # Never any point in mergelibs for these as we build just static
14019     # libraries anyway...
14020     enable_mergelibs=no
14023 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
14024     if test $_os != Linux -a $_os != WINNT; then
14025         add_warning "--enable-mergelibs is not tested for this platform"
14026     fi
14027     MERGELIBS="TRUE"
14028     AC_MSG_RESULT([yes])
14029     AC_DEFINE(ENABLE_MERGELIBS)
14030 else
14031     AC_MSG_RESULT([no])
14033 AC_SUBST([MERGELIBS])
14035 dnl ===================================================================
14036 dnl icerun is a wrapper that stops us spawning tens of processes
14037 dnl locally - for tools that can't be executed on the compile cluster
14038 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
14039 dnl ===================================================================
14040 AC_MSG_CHECKING([whether to use icerun wrapper])
14041 ICECREAM_RUN=
14042 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
14043     ICECREAM_RUN=icerun
14044     AC_MSG_RESULT([yes])
14045 else
14046     AC_MSG_RESULT([no])
14048 AC_SUBST(ICECREAM_RUN)
14050 dnl ===================================================================
14051 dnl Setup the ICECC_VERSION for the build the same way it was set for
14052 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
14053 dnl ===================================================================
14054 x_ICECC_VERSION=[\#]
14055 if test -n "$ICECC_VERSION" ; then
14056     x_ICECC_VERSION=
14058 AC_SUBST(x_ICECC_VERSION)
14059 AC_SUBST(ICECC_VERSION)
14061 dnl ===================================================================
14063 AC_MSG_CHECKING([MPL subset])
14064 MPL_SUBSET=
14066 if test "$enable_mpl_subset" = "yes"; then
14067     warn_report=false
14068     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
14069         warn_report=true
14070     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
14071         warn_report=true
14072     fi
14073     if test "$warn_report" = "true"; then
14074         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
14075     fi
14076     if test "x$enable_postgresql_sdbc" != "xno"; then
14077         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
14078     fi
14079     if test "$enable_lotuswordpro" = "yes"; then
14080         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
14081     fi
14082     if test "$WITH_WEBDAV" = "neon"; then
14083         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
14084     fi
14085     if test -n "$ENABLE_POPPLER"; then
14086         if test "x$SYSTEM_POPPLER" = "x"; then
14087             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
14088         fi
14089     fi
14090     # cf. m4/libo_check_extension.m4
14091     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
14092         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
14093     fi
14094     for theme in $WITH_THEMES; do
14095         case $theme in
14096         breeze|breeze_dark|breeze_dark_svg|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #denylist of icon themes under GPL or LGPL
14097             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=colibre]) ;;
14098         *) : ;;
14099         esac
14100     done
14102     ENABLE_OPENGL_TRANSITIONS=
14104     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
14105         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
14106     fi
14108     MPL_SUBSET="TRUE"
14109     AC_DEFINE(MPL_HAVE_SUBSET)
14110     AC_MSG_RESULT([only])
14111 else
14112     AC_MSG_RESULT([no restrictions])
14114 AC_SUBST(MPL_SUBSET)
14116 dnl ===================================================================
14118 AC_MSG_CHECKING([formula logger])
14119 ENABLE_FORMULA_LOGGER=
14121 if test "x$enable_formula_logger" = "xyes"; then
14122     AC_MSG_RESULT([yes])
14123     AC_DEFINE(ENABLE_FORMULA_LOGGER)
14124     ENABLE_FORMULA_LOGGER=TRUE
14125 elif test -n "$ENABLE_DBGUTIL" ; then
14126     AC_MSG_RESULT([yes])
14127     AC_DEFINE(ENABLE_FORMULA_LOGGER)
14128     ENABLE_FORMULA_LOGGER=TRUE
14129 else
14130     AC_MSG_RESULT([no])
14133 AC_SUBST(ENABLE_FORMULA_LOGGER)
14135 dnl ===================================================================
14136 dnl Checking for active Antivirus software.
14137 dnl ===================================================================
14139 if test $_os = WINNT -a -f "$SRC_ROOT/antivirusDetection.vbs" ; then
14140     AC_MSG_CHECKING([for active Antivirus software])
14141     ANTIVIRUS_LIST=`cscript.exe //Nologo $SRC_ROOT/antivirusDetection.vbs`
14142     if [ [ "$ANTIVIRUS_LIST" != "NULL" ] ]; then
14143         if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then
14144             AC_MSG_RESULT([found])
14145             EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
14146             echo $EICAR_STRING > $SRC_ROOT/eicar
14147             EICAR_TEMP_FILE_CONTENTS=`cat $SRC_ROOT/eicar`
14148             rm $SRC_ROOT/eicar
14149             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
14150                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
14151             fi
14152             echo $EICAR_STRING > $BUILDDIR/eicar
14153             EICAR_TEMP_FILE_CONTENTS=`cat $BUILDDIR/eicar`
14154             rm $BUILDDIR/eicar
14155             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
14156                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
14157             fi
14158             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"
14159         else
14160             AC_MSG_RESULT([not found])
14161         fi
14162     else
14163         AC_MSG_RESULT([n/a])
14164     fi
14167 dnl ===================================================================
14168 dnl Setting up the environment.
14169 dnl ===================================================================
14170 AC_MSG_NOTICE([setting up the build environment variables...])
14172 AC_SUBST(COMPATH)
14174 if test "$build_os" = "cygwin"; then
14175     if test -d "$COMPATH/atlmfc/lib/spectre"; then
14176         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
14177         ATL_INCLUDE="$COMPATH/atlmfc/include"
14178     elif test -d "$COMPATH/atlmfc/lib"; then
14179         ATL_LIB="$COMPATH/atlmfc/lib"
14180         ATL_INCLUDE="$COMPATH/atlmfc/include"
14181     else
14182         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
14183         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
14184     fi
14185     ATL_LIB="$ATL_LIB/$WIN_HOST_ARCH"
14186     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
14187     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
14189     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
14190     PathFormat "/usr/bin/find.exe"
14191     FIND="$formatted_path"
14192     PathFormat "/usr/bin/sort.exe"
14193     SORT="$formatted_path"
14194     PathFormat "/usr/bin/grep.exe"
14195     WIN_GREP="$formatted_path"
14196     PathFormat "/usr/bin/ls.exe"
14197     WIN_LS="$formatted_path"
14198     PathFormat "/usr/bin/touch.exe"
14199     WIN_TOUCH="$formatted_path"
14200 else
14201     FIND=find
14202     SORT=sort
14205 AC_SUBST(ATL_INCLUDE)
14206 AC_SUBST(ATL_LIB)
14207 AC_SUBST(FIND)
14208 AC_SUBST(SORT)
14209 AC_SUBST(WIN_GREP)
14210 AC_SUBST(WIN_LS)
14211 AC_SUBST(WIN_TOUCH)
14213 AC_SUBST(BUILD_TYPE)
14215 AC_SUBST(SOLARINC)
14217 PathFormat "$PERL"
14218 PERL="$formatted_path"
14219 AC_SUBST(PERL)
14221 if test -n "$TMPDIR"; then
14222     TEMP_DIRECTORY="$TMPDIR"
14223 else
14224     TEMP_DIRECTORY="/tmp"
14226 if test "$build_os" = "cygwin"; then
14227     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
14229 AC_SUBST(TEMP_DIRECTORY)
14231 # setup the PATH for the environment
14232 if test -n "$LO_PATH_FOR_BUILD"; then
14233     LO_PATH="$LO_PATH_FOR_BUILD"
14234     case "$host_os" in
14235     cygwin*|wsl*)
14236         pathmunge "$MSVC_HOST_PATH" "before"
14237         ;;
14238     esac
14239 else
14240     LO_PATH="$PATH"
14242     case "$host_os" in
14244     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
14245         if test "$ENABLE_JAVA" != ""; then
14246             pathmunge "$JAVA_HOME/bin" "after"
14247         fi
14248         ;;
14250     cygwin*|wsl*)
14251         # Win32 make needs native paths
14252         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
14253             LO_PATH=`cygpath -p -m "$PATH"`
14254         fi
14255         if test "$WIN_BUILD_ARCH" = "x64"; then
14256             # needed for msi packaging
14257             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
14258         fi
14259         # .NET 4.6 and higher don't have bin directory
14260         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
14261             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
14262         fi
14263         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
14264         pathmunge "$CSC_PATH" "before"
14265         pathmunge "$MIDL_PATH" "before"
14266         pathmunge "$AL_PATH" "before"
14267         pathmunge "$MSVC_MULTI_PATH" "before"
14268         pathmunge "$MSVC_BUILD_PATH" "before"
14269         if test -n "$MSBUILD_PATH" ; then
14270             pathmunge "$MSBUILD_PATH" "before"
14271         fi
14272         pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/$WIN_BUILD_ARCH" "before"
14273         if test "$ENABLE_JAVA" != ""; then
14274             if test -d "$JAVA_HOME/jre/bin/client"; then
14275                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
14276             fi
14277             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
14278                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
14279             fi
14280             pathmunge "$JAVA_HOME/bin" "before"
14281         fi
14282         pathmunge "$MSVC_HOST_PATH" "before"
14283         ;;
14285     solaris*)
14286         pathmunge "/usr/css/bin" "before"
14287         if test "$ENABLE_JAVA" != ""; then
14288             pathmunge "$JAVA_HOME/bin" "after"
14289         fi
14290         ;;
14291     esac
14294 AC_SUBST(LO_PATH)
14296 # Allow to pass LO_ELFCHECK_ALLOWLIST from autogen.input to bin/check-elf-dynamic-objects:
14297 if test "$LO_ELFCHECK_ALLOWLIST" = x || test "${LO_ELFCHECK_ALLOWLIST-x}" != x; then
14298     x_LO_ELFCHECK_ALLOWLIST=
14299 else
14300     x_LO_ELFCHECK_ALLOWLIST=[\#]
14302 AC_SUBST(x_LO_ELFCHECK_ALLOWLIST)
14303 AC_SUBST(LO_ELFCHECK_ALLOWLIST)
14305 libo_FUZZ_SUMMARY
14307 # Generate a configuration sha256 we can use for deps
14308 if test -f config_host.mk; then
14309     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
14311 if test -f config_host_lang.mk; then
14312     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
14315 CFLAGS=$my_original_CFLAGS
14316 CXXFLAGS=$my_original_CXXFLAGS
14317 CPPFLAGS=$my_original_CPPFLAGS
14319 AC_CONFIG_LINKS([include:include])
14321 # Keep in sync with list of files far up, at AC_MSG_CHECKING([for
14322 # BUILD platform configuration] - otherwise breaks cross building
14323 AC_CONFIG_FILES([config_host.mk
14324                  config_host_lang.mk
14325                  Makefile
14326                  bin/bffvalidator.sh
14327                  bin/odfvalidator.sh
14328                  bin/officeotron.sh
14329                  hardened_runtime.xcent
14330                  instsetoo_native/util/openoffice.lst
14331                  sysui/desktop/macosx/Info.plist
14332                  vs-code-template.code-workspace:.vscode/vs-code-template.code-workspace.in])
14333 AC_CONFIG_HEADERS([config_host/config_buildid.h])
14334 AC_CONFIG_HEADERS([config_host/config_box2d.h])
14335 AC_CONFIG_HEADERS([config_host/config_clang.h])
14336 AC_CONFIG_HEADERS([config_host/config_crypto.h])
14337 AC_CONFIG_HEADERS([config_host/config_dconf.h])
14338 AC_CONFIG_HEADERS([config_host/config_eot.h])
14339 AC_CONFIG_HEADERS([config_host/config_extensions.h])
14340 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
14341 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
14342 AC_CONFIG_HEADERS([config_host/config_dbus.h])
14343 AC_CONFIG_HEADERS([config_host/config_features.h])
14344 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
14345 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
14346 AC_CONFIG_HEADERS([config_host/config_firebird.h])
14347 AC_CONFIG_HEADERS([config_host/config_folders.h])
14348 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
14349 AC_CONFIG_HEADERS([config_host/config_gio.h])
14350 AC_CONFIG_HEADERS([config_host/config_global.h])
14351 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
14352 AC_CONFIG_HEADERS([config_host/config_java.h])
14353 AC_CONFIG_HEADERS([config_host/config_langs.h])
14354 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
14355 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
14356 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
14357 AC_CONFIG_HEADERS([config_host/config_locales.h])
14358 AC_CONFIG_HEADERS([config_host/config_mpl.h])
14359 AC_CONFIG_HEADERS([config_host/config_oox.h])
14360 AC_CONFIG_HEADERS([config_host/config_options.h])
14361 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
14362 AC_CONFIG_HEADERS([config_host/config_zxing.h])
14363 AC_CONFIG_HEADERS([config_host/config_skia.h])
14364 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
14365 AC_CONFIG_HEADERS([config_host/config_vendor.h])
14366 AC_CONFIG_HEADERS([config_host/config_vcl.h])
14367 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
14368 AC_CONFIG_HEADERS([config_host/config_version.h])
14369 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
14370 AC_CONFIG_HEADERS([config_host/config_poppler.h])
14371 AC_CONFIG_HEADERS([config_host/config_python.h])
14372 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
14373 AC_OUTPUT
14375 if test "$CROSS_COMPILING" = TRUE; then
14376     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
14379 # touch the config timestamp file
14380 if test ! -f config_host.mk.stamp; then
14381     echo > config_host.mk.stamp
14382 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
14383     echo "Host Configuration unchanged - avoiding scp2 stamp update"
14384 else
14385     echo > config_host.mk.stamp
14388 # touch the config lang timestamp file
14389 if test ! -f config_host_lang.mk.stamp; then
14390     echo > config_host_lang.mk.stamp
14391 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
14392     echo "Language Configuration unchanged - avoiding scp2 stamp update"
14393 else
14394     echo > config_host_lang.mk.stamp
14398 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
14399         -a "$build_os" = "cygwin"; then
14401 cat << _EOS
14402 ****************************************************************************
14403 WARNING:
14404 Your make version is known to be horribly slow, and hard to debug
14405 problems with. To get a reasonably functional make please do:
14407 to install a pre-compiled binary make for Win32
14409  mkdir -p /opt/lo/bin
14410  cd /opt/lo/bin
14411  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
14412  cp make-4.2.1-msvc.exe make
14413  chmod +x make
14415 to install from source:
14416 place yourself in a working directory of you choice.
14418  git clone git://git.savannah.gnu.org/make.git
14420  [go to Start menu, open "Visual Studio 2019", click "x86 Native Tools Command Prompt" or "x64 Native Tools Command Prompt"]
14421  set PATH=%PATH%;C:\Cygwin\bin
14422  [or Cygwin64, if that is what you have]
14423  cd path-to-make-repo-you-cloned-above
14424  build_w32.bat --without-guile
14426 should result in a WinRel/gnumake.exe.
14427 Copy it to the Cygwin /opt/lo/bin directory as make.exe
14429 Then re-run autogen.sh
14431 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
14432 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
14434 _EOS
14435 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
14436     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
14441 cat << _EOF
14442 ****************************************************************************
14444 To build, run:
14445 $GNUMAKE
14447 To view some help, run:
14448 $GNUMAKE help
14450 _EOF
14452 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
14453     cat << _EOF
14454 After the build has finished successfully, you can immediately run what you built using the command:
14455 _EOF
14457     if test $_os = Darwin; then
14458         echo open instdir/$PRODUCTNAME_WITHOUT_SPACES.app
14459     else
14460         echo instdir/program/soffice
14461     fi
14462     cat << _EOF
14464 If you want to run the smoketest, run:
14465 $GNUMAKE check
14467 _EOF
14470 if test -f "$WARNINGS_FILE_FOR_BUILD"; then
14471     echo "BUILD / cross-toolset config, repeated ($WARNINGS_FILE_FOR_BUILD)"
14472     cat "$WARNINGS_FILE_FOR_BUILD"
14473     echo
14476 if test -f "$WARNINGS_FILE"; then
14477     echo "HOST config ($WARNINGS_FILE)"
14478     cat "$WARNINGS_FILE"
14481 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: