Fix typos
[LibreOffice.git] / configure.ac
bloba113ba458e60c71894da7b386945bbc9ae004a0e
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     _os=Linux
889     ;;
891 gnu)
892     using_freetype_fontconfig=yes
893     using_x11=no
894     _os=GNU
895      ;;
897 cygwin*|wsl*)
898     # When building on Windows normally with MSVC under Cygwin,
899     # configure thinks that the host platform (the platform the
900     # built code will run on) is Cygwin, even if it obviously is
901     # Windows, which in Autoconf terminology is called
902     # "mingw32". (Which is misleading as MinGW is the name of the
903     # tool-chain, not an operating system.)
905     # Somewhat confusing, yes. But this configure script doesn't
906     # look at $host etc that much, it mostly uses its own $_os
907     # variable, set here in this case statement.
909     using_freetype_fontconfig=no
910     using_x11=no
911     test_openldap=no
912     build_skia=yes
913     _os=WINNT
915     DLLPOST=".dll"
916     LINKFLAGSNOUNDEFS=
918     if test "$host_cpu" = "aarch64"; then
919         enable_gpgmepp=no
920         enable_coinmp=no
921         enable_firebird_sdbc=no
922     fi
923     ;;
925 darwin*|macos*) # macOS
926     using_freetype_fontconfig=no
927     using_x11=no
928     build_skia=yes
929     if test -n "$LODE_HOME" ; then
930         mac_sanitize_path
931         AC_MSG_NOTICE([sanitized the PATH to $PATH])
932     fi
933     _os=Darwin
934     INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
935     INSTROOTCONTENTSUFFIX=/Contents
936     SDKDIRNAME=${PRODUCTNAME_WITHOUT_SPACES}${PRODUCTVERSION}_SDK
937     # See comment above the case "$host_os"
938     LINKFLAGSSHL="-dynamiclib -single_module"
940     # -fPIC is default
941     PICSWITCH=""
943     DLLPOST=".dylib"
945     # -undefined error is the default
946     LINKFLAGSNOUNDEFS=""
947     case "$host_cpu" in
948     aarch64|arm64)
949         case "$host_os" in
950         macos*)
951             # HOST_PLATFORM is used for external projects and their configury occasionally doesn't like
952             # the "macos" part so be sure to use aarch64-apple-darwin for now.
953             HOST_PLATFORM=aarch64-apple-darwin
954             ;;
955         esac
957         # Apple's Clang uses "arm64"
958         host_cpu_for_clang=arm64
959     esac
962 ios*) # iOS
963     using_freetype_fontconfig=no
964     using_vclplug=no
965     using_x11=no
966     build_crypto=no
967     test_cmis=no
968     test_openldap=no
969     test_webdav=no
970     if test -n "$LODE_HOME" ; then
971         mac_sanitize_path
972         AC_MSG_NOTICE([sanitized the PATH to $PATH])
973     fi
974     enable_gpgmepp=no
975     _os=iOS
976     enable_mpl_subset=yes
977     enable_lotuswordpro=no
978     disable_database_connectivity_dependencies
979     enable_coinmp=no
980     enable_lpsolve=no
981     enable_extension_integration=no
982     enable_xmlhelp=no
983     with_ppds=no
984     if test "$enable_ios_simulator" = "yes"; then
985         host=x86_64-apple-darwin
986     fi
987     # See comment above the case "$host_os"
988     LINKFLAGSSHL="-dynamiclib -single_module"
990     # -fPIC is default
991     PICSWITCH=""
993     DLLPOST=".dylib"
995     # -undefined error is the default
996     LINKFLAGSNOUNDEFS=""
998     # HOST_PLATFORM is used for external projects and their configury typically doesn't like the "ios"
999     # part, so use aarch64-apple-darwin for now.
1000     HOST_PLATFORM=aarch64-apple-darwin
1002     # Apple's Clang uses "arm64"
1003     host_cpu_for_clang=arm64
1006 freebsd*)
1007     using_freetype_fontconfig=yes
1008     using_x11=yes
1009     build_skia=yes
1010     AC_MSG_CHECKING([the FreeBSD operating system release])
1011     if test -n "$with_os_version"; then
1012         OSVERSION="$with_os_version"
1013     else
1014         OSVERSION=`/sbin/sysctl -n kern.osreldate`
1015     fi
1016     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
1017     AC_MSG_CHECKING([which thread library to use])
1018     if test "$OSVERSION" -lt "500016"; then
1019         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1020         PTHREAD_LIBS="-pthread"
1021     elif test "$OSVERSION" -lt "502102"; then
1022         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1023         PTHREAD_LIBS="-lc_r"
1024     else
1025         PTHREAD_CFLAGS=""
1026         PTHREAD_LIBS="-pthread"
1027     fi
1028     AC_MSG_RESULT([$PTHREAD_LIBS])
1029     _os=FreeBSD
1030     ;;
1032 *netbsd*)
1033     using_freetype_fontconfig=yes
1034     using_x11=yes
1035     test_gtk3_kde5=no
1036     build_skia=yes
1037     PTHREAD_LIBS="-pthread -lpthread"
1038     _os=NetBSD
1039     ;;
1041 aix*)
1042     using_freetype_fontconfig=yes
1043     using_x11=yes
1044     test_randr=no
1045     test_gstreamer_1_0=no
1046     PTHREAD_LIBS=-pthread
1047     _os=AIX
1048     ;;
1050 openbsd*)
1051     using_freetype_fontconfig=yes
1052     using_x11=yes
1053     PTHREAD_CFLAGS="-D_THREAD_SAFE"
1054     PTHREAD_LIBS="-pthread"
1055     _os=OpenBSD
1056     ;;
1058 dragonfly*)
1059     using_freetype_fontconfig=yes
1060     using_x11=yes
1061     build_skia=yes
1062     PTHREAD_LIBS="-pthread"
1063     _os=DragonFly
1064     ;;
1066 linux-android*)
1067     using_freetype_fontconfig=yes
1068     using_headless_plugin=no
1069     using_x11=no
1070     build_crypto=no
1071     test_openldap=no
1072     test_system_freetype=no
1073     test_webdav=no
1074     disable_database_connectivity_dependencies
1075     enable_lotuswordpro=no
1076     enable_mpl_subset=yes
1077     enable_cairo_canvas=no
1078     enable_coinmp=yes
1079     enable_lpsolve=no
1080     enable_odk=no
1081     enable_python=no
1082     enable_xmlhelp=no
1083     _os=Android
1085     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
1086     ;;
1088 haiku*)
1089     using_freetype_fontconfig=yes
1090     using_x11=no
1091     test_gtk3_kde5=no
1092     test_kf5=yes
1093     enable_odk=no
1094     enable_coinmp=no
1095     enable_pdfium=no
1096     enable_sdremote=no
1097     enable_postgresql_sdbc=no
1098     enable_firebird_sdbc=no
1099     _os=Haiku
1100     ;;
1102 emscripten)
1103     using_freetype_fontconfig=yes
1104     using_x11=no
1105     test_openldap=no
1106     enable_compiler_plugins=no
1107     test_cmis=no
1108     test_webdav=no
1109     enable_database_connectivity=no
1110     enable_lpsolve=no
1111     enable_xmlhelp=no
1112     with_system_zlib=no
1113     with_theme="breeze"
1114     _os=Emscripten
1115     ;;
1118     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
1119     ;;
1120 esac
1122 AC_SUBST(HOST_PLATFORM)
1124 if test -z "$using_x11" -o -z "$using_freetype_fontconfig"; then
1125     AC_MSG_ERROR([You must set \$using_freetype_fontconfig and \$using_x11 for your platform])
1128 # Set defaults, if not set by platform
1129 test "${test_cups+set}" = set || test_cups="$using_x11"
1130 test "${test_dbus+set}" = set || test_dbus="$using_x11"
1131 test "${test_gstreamer_1_0+set}" = set || test_gstreamer_1_0="$using_x11"
1132 test "${test_gtk3+set}" = set || test_gtk3="$using_x11"
1133 test "${test_gtk4+set}" = set || test_gtk4="$using_x11"
1134 test "${test_kf5+set}" = set || test_kf5="$using_x11"
1135 # don't handle test_qt5, so it can disable test_kf5 later
1136 test "${test_randr+set}" = set || test_randr="$using_x11"
1137 test "${test_xrender+set}" = set || test_xrender="$using_x11"
1138 test "${using_headless_plugin+set}" = set || using_headless_plugin="$using_freetype_fontconfig"
1140 test "${test_gtk3_kde5+set}" != set -a "$test_kf5" = yes -a "$test_gtk3" = yes && test_gtk3_kde5="yes"
1141 test "${test_system_fontconfig+set}" != set -a "${test_system_freetype+set}" = set && test_system_fontconfig="$test_system_freetype"
1142 test "${test_system_freetype+set}" != set -a "${test_system_fontconfig+set}" = set && test_system_freetype="$test_system_fontconfig"
1144 # convenience / platform overriding "fixes"
1145 # Don't sort!
1146 test "$test_kf5" = yes -a "$test_qt5" = no && test_kf5=no
1147 test "$test_kf5" = yes && test_qt5=yes
1148 test "$test_gtk3" != yes -o "$test_kf5" != yes && test_gtk3_kde5=no
1149 test "$using_freetype_fontconfig" = no && using_headless_plugin=no
1150 test "$using_freetype_fontconfig" = yes && test_cairo=yes
1152 # Keep in sync with the above $using_x11 depending test default list
1153 disable_x11_tests()
1155     test_cups=no
1156     test_dbus=no
1157     test_gstreamer_1_0=no
1158     test_gtk3_kde5=no
1159     test_gtk3=no
1160     test_gtk4=no
1161     test_kf5=no
1162     test_qt5=no
1163     test_randr=no
1164     test_xrender=no
1167 test "$using_x11" = yes && USING_X11=TRUE
1169 if test "$using_freetype_fontconfig" = yes; then
1170     if test "$using_headless_plugin" = yes; then
1171         AC_DEFINE(ENABLE_HEADLESS)
1172         ENABLE_HEADLESS=TRUE
1173     fi
1176 AC_SUBST(ENABLE_HEADLESS)
1178 AC_MSG_NOTICE([VCL platform uses freetype+fontconfig: $using_freetype_fontconfig])
1179 AC_MSG_NOTICE([VCL platform uses headless plugin: $using_headless_plugin])
1180 AC_MSG_NOTICE([VCL platform uses vclplug: $using_vclplug])
1181 AC_MSG_NOTICE([VCL platform uses X11: $using_x11])
1183 # ===================================================================
1185 # End initial platform setup
1187 # ===================================================================
1189 if test "$_os" = "Android" ; then
1190     # Verify that the NDK and SDK options are proper
1191     if test -z "$with_android_ndk"; then
1192         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
1193     elif test ! -f "$ANDROID_NDK_HOME/meta/abis.json"; then
1194         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
1195     fi
1197     if test -z "$ANDROID_SDK_HOME"; then
1198         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
1199     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
1200         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
1201     fi
1203     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
1204     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
1205         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
1206                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
1207                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
1208         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
1209         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
1210         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
1211     fi
1212     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
1213         AC_MSG_WARN([android support repository not found - install with
1214                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
1215                      to allow the build to download the specified version of the android support libraries])
1216         add_warning "android support repository not found - install with"
1217         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
1218         add_warning "to allow the build to download the specified version of the android support libraries"
1219     fi
1222 if test "$_os" = "AIX"; then
1223     AC_PATH_PROG(GAWK, gawk)
1224     if test -z "$GAWK"; then
1225         AC_MSG_ERROR([gawk not found in \$PATH])
1226     fi
1229 AC_SUBST(SDKDIRNAME)
1231 AC_SUBST(PTHREAD_CFLAGS)
1232 AC_SUBST(PTHREAD_LIBS)
1234 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
1235 # By default use the ones specified by our build system,
1236 # but explicit override is possible.
1237 AC_MSG_CHECKING(for explicit AFLAGS)
1238 if test -n "$AFLAGS"; then
1239     AC_MSG_RESULT([$AFLAGS])
1240     x_AFLAGS=
1241 else
1242     AC_MSG_RESULT(no)
1243     x_AFLAGS=[\#]
1245 AC_MSG_CHECKING(for explicit CFLAGS)
1246 if test -n "$CFLAGS"; then
1247     AC_MSG_RESULT([$CFLAGS])
1248     x_CFLAGS=
1249 else
1250     AC_MSG_RESULT(no)
1251     x_CFLAGS=[\#]
1253 AC_MSG_CHECKING(for explicit CXXFLAGS)
1254 if test -n "$CXXFLAGS"; then
1255     AC_MSG_RESULT([$CXXFLAGS])
1256     x_CXXFLAGS=
1257 else
1258     AC_MSG_RESULT(no)
1259     x_CXXFLAGS=[\#]
1261 AC_MSG_CHECKING(for explicit OBJCFLAGS)
1262 if test -n "$OBJCFLAGS"; then
1263     AC_MSG_RESULT([$OBJCFLAGS])
1264     x_OBJCFLAGS=
1265 else
1266     AC_MSG_RESULT(no)
1267     x_OBJCFLAGS=[\#]
1269 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
1270 if test -n "$OBJCXXFLAGS"; then
1271     AC_MSG_RESULT([$OBJCXXFLAGS])
1272     x_OBJCXXFLAGS=
1273 else
1274     AC_MSG_RESULT(no)
1275     x_OBJCXXFLAGS=[\#]
1277 AC_MSG_CHECKING(for explicit LDFLAGS)
1278 if test -n "$LDFLAGS"; then
1279     AC_MSG_RESULT([$LDFLAGS])
1280     x_LDFLAGS=
1281 else
1282     AC_MSG_RESULT(no)
1283     x_LDFLAGS=[\#]
1285 AC_SUBST(AFLAGS)
1286 AC_SUBST(CFLAGS)
1287 AC_SUBST(CXXFLAGS)
1288 AC_SUBST(OBJCFLAGS)
1289 AC_SUBST(OBJCXXFLAGS)
1290 AC_SUBST(LDFLAGS)
1291 AC_SUBST(x_AFLAGS)
1292 AC_SUBST(x_CFLAGS)
1293 AC_SUBST(x_CXXFLAGS)
1294 AC_SUBST(x_OBJCFLAGS)
1295 AC_SUBST(x_OBJCXXFLAGS)
1296 AC_SUBST(x_LDFLAGS)
1298 dnl These are potentially set for MSVC, in the code checking for UCRT below:
1299 my_original_CFLAGS=$CFLAGS
1300 my_original_CXXFLAGS=$CXXFLAGS
1301 my_original_CPPFLAGS=$CPPFLAGS
1303 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
1304 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
1305 dnl AC_PROG_CC internally.
1306 if test "$_os" != "WINNT"; then
1307     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
1308     save_CFLAGS=$CFLAGS
1309     AC_PROG_CC
1310     CFLAGS=$save_CFLAGS
1311     if test -z "$CC_BASE"; then
1312         CC_BASE=`first_arg_basename "$CC"`
1313     fi
1316 if test "$_os" != "WINNT"; then
1317     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
1318 else
1319     ENDIANNESS=little
1321 AC_SUBST(ENDIANNESS)
1323 if test $_os != "WINNT"; then
1324     save_LIBS="$LIBS"
1325     AC_SEARCH_LIBS([dlsym], [dl],
1326         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
1327         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
1328     LIBS="$save_LIBS"
1330 AC_SUBST(DLOPEN_LIBS)
1332 dnl ===================================================================
1333 dnl Sanity checks for Emscripten SDK setup
1334 dnl ===================================================================
1336 if test "$_os" = "Emscripten"; then
1337     EMSCRIPTEN_ERROR=0
1338     if ! which emconfigure >/dev/null 2>&1; then
1339         AC_MSG_WARN([emconfigure must be in your \$PATH])
1340         EMSCRIPTEN_ERROR=1
1341     fi
1342     if test -z "$EMMAKEN_JUST_CONFIGURE"; then
1343         AC_MSG_WARN(["\$EMMAKEN_JUST_CONFIGURE wasn't set by emconfigure. Prefix configure or use autogen.sh])
1344         EMSCRIPTEN_ERROR=1
1345     fi
1346     if test $EMSCRIPTEN_ERROR -ne 0; then
1347         AC_MSG_ERROR(["Please fix your EMSDK setup to build with Emscripten!"])
1348     fi
1351 ###############################################################################
1352 # Extensions switches --enable/--disable
1353 ###############################################################################
1354 # By default these should be enabled unless having extra dependencies.
1355 # If there is extra dependency over configure options then the enable should
1356 # be automagic based on whether the requiring feature is enabled or not.
1357 # All this options change anything only with --enable-extension-integration.
1359 # The name of this option and its help string makes it sound as if
1360 # extensions are built anyway, just not integrated in the installer,
1361 # if you use --disable-extension-integration. Is that really the
1362 # case?
1364 AC_ARG_ENABLE(ios-simulator,
1365     AS_HELP_STRING([--enable-ios-simulator],
1366         [build for iOS simulator])
1369 libo_FUZZ_ARG_ENABLE(extension-integration,
1370     AS_HELP_STRING([--disable-extension-integration],
1371         [Disable integration of the built extensions in the installer of the
1372          product. Use this switch to disable the integration.])
1375 AC_ARG_ENABLE(avmedia,
1376     AS_HELP_STRING([--disable-avmedia],
1377         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
1380 AC_ARG_ENABLE(database-connectivity,
1381     AS_HELP_STRING([--disable-database-connectivity],
1382         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1385 # This doesn't mean not building (or "integrating") extensions
1386 # (although it probably should; i.e. it should imply
1387 # --disable-extension-integration I guess), it means not supporting
1388 # any extension mechanism at all
1389 libo_FUZZ_ARG_ENABLE(extensions,
1390     AS_HELP_STRING([--disable-extensions],
1391         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1394 AC_ARG_ENABLE(scripting,
1395     AS_HELP_STRING([--disable-scripting],
1396         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1399 # This is mainly for Android and iOS, but could potentially be used in some
1400 # special case otherwise, too, so factored out as a separate setting
1402 AC_ARG_ENABLE(dynamic-loading,
1403     AS_HELP_STRING([--disable-dynamic-loading],
1404         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1407 libo_FUZZ_ARG_ENABLE(report-builder,
1408     AS_HELP_STRING([--disable-report-builder],
1409         [Disable the Report Builder.])
1412 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1413     AS_HELP_STRING([--enable-ext-wiki-publisher],
1414         [Enable the Wiki Publisher extension.])
1417 libo_FUZZ_ARG_ENABLE(lpsolve,
1418     AS_HELP_STRING([--disable-lpsolve],
1419         [Disable compilation of the lp solve solver ])
1421 libo_FUZZ_ARG_ENABLE(coinmp,
1422     AS_HELP_STRING([--disable-coinmp],
1423         [Disable compilation of the CoinMP solver ])
1426 libo_FUZZ_ARG_ENABLE(pdfimport,
1427     AS_HELP_STRING([--disable-pdfimport],
1428         [Disable building the PDF import feature.])
1431 libo_FUZZ_ARG_ENABLE(pdfium,
1432     AS_HELP_STRING([--disable-pdfium],
1433         [Disable building PDFium. Results in unsecure PDF signature verification.])
1436 libo_FUZZ_ARG_ENABLE(skia,
1437     AS_HELP_STRING([--disable-skia],
1438         [Disable building Skia. Use --enable-skia=debug to build without optimizations.])
1441 ###############################################################################
1443 dnl ---------- *** ----------
1445 libo_FUZZ_ARG_ENABLE(mergelibs,
1446     AS_HELP_STRING([--enable-mergelibs],
1447         [Merge several of the smaller libraries into one big, "merged", one.])
1450 libo_FUZZ_ARG_ENABLE(breakpad,
1451     AS_HELP_STRING([--enable-breakpad],
1452         [Enables breakpad for crash reporting.])
1455 libo_FUZZ_ARG_ENABLE(crashdump,
1456     AS_HELP_STRING([--disable-crashdump],
1457         [Disable dump.ini and dump-file, when --enable-breakpad])
1460 AC_ARG_ENABLE(fetch-external,
1461     AS_HELP_STRING([--disable-fetch-external],
1462         [Disables fetching external tarballs from web sources.])
1465 AC_ARG_ENABLE(fuzzers,
1466     AS_HELP_STRING([--enable-fuzzers],
1467         [Enables building libfuzzer targets for fuzz testing.])
1470 libo_FUZZ_ARG_ENABLE(pch,
1471     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1472         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1473          Using 'system' will include only external headers, 'base' will add also headers
1474          from base modules, 'normal' will also add all headers except from the module built,
1475          'full' will use all suitable headers even from a module itself.])
1478 libo_FUZZ_ARG_ENABLE(epm,
1479     AS_HELP_STRING([--enable-epm],
1480         [LibreOffice includes self-packaging code, that requires epm, however epm is
1481          useless for large scale package building.])
1484 libo_FUZZ_ARG_ENABLE(odk,
1485     AS_HELP_STRING([--enable-odk],
1486         [Enable building the Office Development Kit, the part that extensions need to build against])
1489 AC_ARG_ENABLE(mpl-subset,
1490     AS_HELP_STRING([--enable-mpl-subset],
1491         [Don't compile any pieces which are not MPL or more liberally licensed])
1494 libo_FUZZ_ARG_ENABLE(evolution2,
1495     AS_HELP_STRING([--enable-evolution2],
1496         [Allows the built-in evolution 2 addressbook connectivity build to be
1497          enabled.])
1500 AC_ARG_ENABLE(avahi,
1501     AS_HELP_STRING([--enable-avahi],
1502         [Determines whether to use Avahi to advertise Impress to remote controls.])
1505 libo_FUZZ_ARG_ENABLE(werror,
1506     AS_HELP_STRING([--enable-werror],
1507         [Turn warnings to errors. (Has no effect in modules where the treating
1508          of warnings as errors is disabled explicitly.)]),
1511 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1512     AS_HELP_STRING([--enable-assert-always-abort],
1513         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1516 libo_FUZZ_ARG_ENABLE(dbgutil,
1517     AS_HELP_STRING([--enable-dbgutil],
1518         [Provide debugging support from --enable-debug and include additional debugging
1519          utilities such as object counting or more expensive checks.
1520          This is the recommended option for developers.
1521          Note that this makes the build ABI incompatible, it is not possible to mix object
1522          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1524 libo_FUZZ_ARG_ENABLE(debug,
1525     AS_HELP_STRING([--enable-debug],
1526         [Include debugging information, disable compiler optimization and inlining plus
1527          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1529 libo_FUZZ_ARG_ENABLE(split-debug,
1530     AS_HELP_STRING([--disable-split-debug],
1531         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1532          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1534 libo_FUZZ_ARG_ENABLE(gdb-index,
1535     AS_HELP_STRING([--disable-gdb-index],
1536         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1537          The feature requires the gold or lld linker.]))
1539 libo_FUZZ_ARG_ENABLE(sal-log,
1540     AS_HELP_STRING([--enable-sal-log],
1541         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1543 libo_FUZZ_ARG_ENABLE(symbols,
1544     AS_HELP_STRING([--enable-symbols],
1545         [Generate debug information.
1546          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1547          otherwise. It is possible to explicitly specify gbuild build targets
1548          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1549          everything in the directory; there is no ordering, more specific overrides
1550          more general, and disabling takes precedence).
1551          Example: --enable-symbols="all -sw/ -Library_sc".]))
1553 libo_FUZZ_ARG_ENABLE(optimized,
1554     AS_HELP_STRING([--enable-optimized=<yes/no/debug>],
1555         [Whether to compile with optimization flags.
1556          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1557          otherwise. Using 'debug' will try to use only optimizations that should
1558          not interfere with debugging. For Emscripten we default to optimized (-O1)
1559          debug build, as otherwise binaries become too large.]))
1561 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1562     AS_HELP_STRING([--disable-runtime-optimizations],
1563         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1564          JVM JIT) that are known to interact badly with certain dynamic analysis
1565          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1566          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1567          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1569 AC_ARG_WITH(valgrind,
1570     AS_HELP_STRING([--with-valgrind],
1571         [Make availability of Valgrind headers a hard requirement.]))
1573 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1574     AS_HELP_STRING([--enable-compiler-plugins],
1575         [Enable compiler plugins that will perform additional checks during
1576          building. Enabled automatically by --enable-dbgutil.
1577          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1578 COMPILER_PLUGINS_DEBUG=
1579 if test "$enable_compiler_plugins" = debug; then
1580     enable_compiler_plugins=yes
1581     COMPILER_PLUGINS_DEBUG=TRUE
1584 libo_FUZZ_ARG_ENABLE(compiler-plugins-analyzer-pch,
1585     AS_HELP_STRING([--disable-compiler-plugins-analyzer-pch],
1586         [Disable use of precompiled headers when running the Clang compiler plugin analyzer.  Not
1587          relevant in the --disable-compiler-plugins case.]))
1589 libo_FUZZ_ARG_ENABLE(ooenv,
1590     AS_HELP_STRING([--enable-ooenv],
1591         [Enable ooenv for the instdir installation.]))
1593 AC_ARG_ENABLE(lto,
1594     AS_HELP_STRING([--enable-lto],
1595         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1596          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1597          linker. For MSVC, this option is broken at the moment. This is experimental work
1598          in progress that shouldn't be used unless you are working on it.)]))
1600 AC_ARG_ENABLE(python,
1601     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1602         [Enables or disables Python support at run-time.
1603          Also specifies what Python to use at build-time.
1604          'fully-internal' even forces the internal version for uses of Python
1605          during the build.
1606          On macOS the only choices are
1607          'internal' (default) or 'fully-internal'. Otherwise the default is 'auto'.
1608          ]))
1610 libo_FUZZ_ARG_ENABLE(gtk3,
1611     AS_HELP_STRING([--disable-gtk3],
1612         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1613 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1615 AC_ARG_ENABLE(gtk4,
1616     AS_HELP_STRING([--enable-gtk4],
1617         [Determines whether to use Gtk+ 4.0 vclplug on platforms where Gtk+ 4.0 is available.]))
1619 AC_ARG_ENABLE(introspection,
1620     AS_HELP_STRING([--enable-introspection],
1621         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1622          Linux distributions.)]))
1624 AC_ARG_ENABLE(split-app-modules,
1625     AS_HELP_STRING([--enable-split-app-modules],
1626         [Split file lists for app modules, e.g. base, calc.
1627          Has effect only with make distro-pack-install]),
1630 AC_ARG_ENABLE(split-opt-features,
1631     AS_HELP_STRING([--enable-split-opt-features],
1632         [Split file lists for some optional features, e.g. pyuno, testtool.
1633          Has effect only with make distro-pack-install]),
1636 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1637     AS_HELP_STRING([--disable-cairo-canvas],
1638         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1641 libo_FUZZ_ARG_ENABLE(dbus,
1642     AS_HELP_STRING([--disable-dbus],
1643         [Determines whether to enable features that depend on dbus.
1644          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1645 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1647 libo_FUZZ_ARG_ENABLE(sdremote,
1648     AS_HELP_STRING([--disable-sdremote],
1649         [Determines whether to enable Impress remote control (i.e. the server component).]),
1650 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1652 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1653     AS_HELP_STRING([--disable-sdremote-bluetooth],
1654         [Determines whether to build sdremote with bluetooth support.
1655          Requires dbus on Linux.]))
1657 libo_FUZZ_ARG_ENABLE(gio,
1658     AS_HELP_STRING([--disable-gio],
1659         [Determines whether to use the GIO support.]),
1660 ,test "${enable_gio+set}" = set || enable_gio=yes)
1662 AC_ARG_ENABLE(qt5,
1663     AS_HELP_STRING([--enable-qt5],
1664         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1665          available.]),
1668 AC_ARG_ENABLE(kf5,
1669     AS_HELP_STRING([--enable-kf5],
1670         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1671          KF5 are available.]),
1674 AC_ARG_ENABLE(gtk3_kde5,
1675     AS_HELP_STRING([--enable-gtk3-kde5],
1676         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1677          platforms where Gtk3, Qt5 and Plasma is available.]),
1680 AC_ARG_ENABLE(gui,
1681     AS_HELP_STRING([--disable-gui],
1682         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1683 ,enable_gui=yes)
1685 libo_FUZZ_ARG_ENABLE(randr,
1686     AS_HELP_STRING([--disable-randr],
1687         [Disable RandR support in the vcl project.]),
1688 ,test "${enable_randr+set}" = set || enable_randr=yes)
1690 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1691     AS_HELP_STRING([--disable-gstreamer-1-0],
1692         [Disable building with the gstreamer 1.0 avmedia backend.]),
1693 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1695 libo_FUZZ_ARG_ENABLE([eot],
1696     [AS_HELP_STRING([--enable-eot],
1697         [Enable support for Embedded OpenType fonts.])],
1698 ,test "${enable_eot+set}" = set || enable_eot=no)
1700 libo_FUZZ_ARG_ENABLE(cve-tests,
1701     AS_HELP_STRING([--disable-cve-tests],
1702         [Prevent CVE tests to be executed]),
1705 libo_FUZZ_ARG_ENABLE(chart-tests,
1706     AS_HELP_STRING([--enable-chart-tests],
1707         [Executes chart XShape tests. In a perfect world these tests would be
1708          stable and everyone could run them, in reality it is best to run them
1709          only on a few machines that are known to work and maintained by people
1710          who can judge if a test failure is a regression or not.]),
1713 AC_ARG_ENABLE(build-opensymbol,
1714     AS_HELP_STRING([--enable-build-opensymbol],
1715         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1716          fontforge installed.]),
1719 AC_ARG_ENABLE(dependency-tracking,
1720     AS_HELP_STRING([--enable-dependency-tracking],
1721         [Do not reject slow dependency extractors.])[
1722   --disable-dependency-tracking
1723                           Disables generation of dependency information.
1724                           Speed up one-time builds.],
1727 AC_ARG_ENABLE(icecream,
1728     AS_HELP_STRING([--enable-icecream],
1729         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1730          It defaults to /opt/icecream for the location of the icecream gcc/g++
1731          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1734 AC_ARG_ENABLE(ld,
1735     AS_HELP_STRING([--enable-ld=<linker>],
1736         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1737          By default tries to use the best linker possible, use --disable-ld to use the default linker.
1738          If <linker> contains any ':', the part before the first ':' is used as the value of
1739          -fuse-ld, while the part after the first ':' is used as the value of --ld-path (which is
1740          needed for Clang 12).]),
1743 libo_FUZZ_ARG_ENABLE(cups,
1744     AS_HELP_STRING([--disable-cups],
1745         [Do not build cups support.])
1748 AC_ARG_ENABLE(ccache,
1749     AS_HELP_STRING([--disable-ccache],
1750         [Do not try to use ccache automatically.
1751          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1752          CC/CXX are not yet set, and --enable-icecream is not given, we
1753          attempt to use ccache. --disable-ccache disables ccache completely.
1754          Additionally ccache's depend mode is enabled if possible,
1755          use --enable-ccache=nodepend to enable ccache without depend mode.
1759 libo_FUZZ_ARG_ENABLE(online-update,
1760     AS_HELP_STRING([--enable-online-update],
1761         [Enable the online update service that will check for new versions of
1762          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1763          If the value is "mar", the experimental Mozilla-like update will be
1764          enabled instead of the traditional update mechanism.]),
1767 AC_ARG_WITH(update-config,
1768     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1769                    [Path to the update config ini file]))
1771 libo_FUZZ_ARG_ENABLE(extension-update,
1772     AS_HELP_STRING([--disable-extension-update],
1773         [Disable possibility to update installed extensions.]),
1776 libo_FUZZ_ARG_ENABLE(release-build,
1777     AS_HELP_STRING([--enable-release-build],
1778         [Enable release build. Note that the "release build" choice is orthogonal to
1779          whether symbols are present, debug info is generated, or optimization
1780          is done.
1781          See http://wiki.documentfoundation.org/Development/DevBuild]),
1784 AC_ARG_ENABLE(windows-build-signing,
1785     AS_HELP_STRING([--enable-windows-build-signing],
1786         [Enable signing of windows binaries (*.exe, *.dll)]),
1789 AC_ARG_ENABLE(silent-msi,
1790     AS_HELP_STRING([--enable-silent-msi],
1791         [Enable MSI with LIMITUI=1 (silent install).]),
1794 AC_ARG_ENABLE(macosx-code-signing,
1795     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1796         [Sign executables, dylibs, frameworks and the app bundle. If you
1797          don't provide an identity the first suitable certificate
1798          in your keychain is used.]),
1801 AC_ARG_ENABLE(macosx-package-signing,
1802     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1803         [Create a .pkg suitable for uploading to the Mac App Store and sign
1804          it. If you don't provide an identity the first suitable certificate
1805          in your keychain is used.]),
1808 AC_ARG_ENABLE(macosx-sandbox,
1809     AS_HELP_STRING([--enable-macosx-sandbox],
1810         [Make the app bundle run in a sandbox. Requires code signing.
1811          Is required by apps distributed in the Mac App Store, and implies
1812          adherence to App Store rules.]),
1815 AC_ARG_WITH(macosx-bundle-identifier,
1816     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1817         [Define the macOS bundle identifier. Default is the somewhat weird
1818          org.libreoffice.script ("script", huh?).]),
1819 ,with_macosx_bundle_identifier=org.libreoffice.script)
1821 AC_ARG_WITH(product-name,
1822     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1823         [Define the product name. Default is AC_PACKAGE_NAME.]),
1824 ,with_product_name=$PRODUCTNAME)
1826 libo_FUZZ_ARG_ENABLE(community-flavor,
1827     AS_HELP_STRING([--disable-community-flavor],
1828         [Disable the Community branding.]),
1831 AC_ARG_WITH(package-version,
1832     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1833         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1836 libo_FUZZ_ARG_ENABLE(readonly-installset,
1837     AS_HELP_STRING([--enable-readonly-installset],
1838         [Prevents any attempts by LibreOffice to write into its installation. That means
1839          at least that no "system-wide" extensions can be added. Partly experimental work in
1840          progress, probably not fully implemented. Always enabled for macOS.]),
1843 libo_FUZZ_ARG_ENABLE(mariadb-sdbc,
1844     AS_HELP_STRING([--disable-mariadb-sdbc],
1845         [Disable the build of the MariaDB/MySQL-SDBC driver.])
1848 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1849     AS_HELP_STRING([--disable-postgresql-sdbc],
1850         [Disable the build of the PostgreSQL-SDBC driver.])
1853 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1854     AS_HELP_STRING([--disable-lotuswordpro],
1855         [Disable the build of the Lotus Word Pro filter.]),
1856 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1858 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1859     AS_HELP_STRING([--disable-firebird-sdbc],
1860         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1861 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1863 AC_ARG_ENABLE(bogus-pkg-config,
1864     AS_HELP_STRING([--enable-bogus-pkg-config],
1865         [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.]),
1868 AC_ARG_ENABLE(openssl,
1869     AS_HELP_STRING([--disable-openssl],
1870         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1871          components will either use GNUTLS or NSS. Work in progress,
1872          use only if you are hacking on it.]),
1873 ,enable_openssl=yes)
1875 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1876     AS_HELP_STRING([--enable-cipher-openssl-backend],
1877         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1878          Requires --enable-openssl.]))
1880 AC_ARG_ENABLE(nss,
1881     AS_HELP_STRING([--disable-nss],
1882         [Disable using NSS. If disabled,
1883          components will either use GNUTLS or openssl. Work in progress,
1884          use only if you are hacking on it.]),
1885 ,enable_nss=yes)
1887 AC_ARG_ENABLE(library-bin-tar,
1888     AS_HELP_STRING([--enable-library-bin-tar],
1889         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1890         Some libraries can save their build result in a tarball
1891         stored in TARFILE_LOCATION. That binary tarball is
1892         uniquely identified by the source tarball,
1893         the content of the config_host.mk file and the content
1894         of the top-level directory in core for that library
1895         If this option is enabled, then if such a tarfile exist, it will be untarred
1896         instead of the source tarfile, and the build step will be skipped for that
1897         library.
1898         If a proper tarfile does not exist, then the normal source-based
1899         build is done for that library and a proper binary tarfile is created
1900         for the next time.]),
1903 AC_ARG_ENABLE(dconf,
1904     AS_HELP_STRING([--disable-dconf],
1905         [Disable the dconf configuration backend (enabled by default where
1906          available).]))
1908 libo_FUZZ_ARG_ENABLE(formula-logger,
1909     AS_HELP_STRING(
1910         [--enable-formula-logger],
1911         [Enable formula logger for logging formula calculation flow in Calc.]
1912     )
1915 AC_ARG_ENABLE(ldap,
1916     AS_HELP_STRING([--disable-ldap],
1917         [Disable LDAP support.]),
1918 ,enable_ldap=yes)
1920 AC_ARG_ENABLE(opencl,
1921     AS_HELP_STRING([--disable-opencl],
1922         [Disable OpenCL support.]),
1923 ,enable_opencl=yes)
1925 libo_FUZZ_ARG_ENABLE(librelogo,
1926     AS_HELP_STRING([--disable-librelogo],
1927         [Do not build LibreLogo.]),
1928 ,enable_librelogo=yes)
1930 AC_ARG_ENABLE(cmis,
1931     AS_HELP_STRING([--disable-cmis],
1932         [Disable CMIS support.]),
1933 ,enable_cmis=yes)
1935 AC_ARG_ENABLE(curl,
1936     AS_HELP_STRING([--disable-curl],
1937         [Disable CURL support.]),
1938 ,enable_curl=yes)
1940 AC_ARG_ENABLE(wasm-strip,
1941     AS_HELP_STRING([--enable-wasm-strip],
1942         [Strip the static build like for WASM/emscripten platform.]),
1943 ,enable_wasm_strip=yes)
1945 AC_ARG_ENABLE(xmlhelp,
1946     AS_HELP_STRING([--disable-xmlhelp],
1947         [Disable XML help support]),
1948 ,enable_xmlhelp=yes)
1951 dnl ===================================================================
1952 dnl Optional Packages (--with/without-)
1953 dnl ===================================================================
1955 AC_ARG_WITH(gcc-home,
1956     AS_HELP_STRING([--with-gcc-home],
1957         [Specify the location of gcc/g++ manually. This can be used in conjunction
1958          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1959          non-default path.]),
1962 AC_ARG_WITH(gnu-patch,
1963     AS_HELP_STRING([--with-gnu-patch],
1964         [Specify location of GNU patch on Solaris or FreeBSD.]),
1967 AC_ARG_WITH(build-platform-configure-options,
1968     AS_HELP_STRING([--with-build-platform-configure-options],
1969         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1972 AC_ARG_WITH(gnu-cp,
1973     AS_HELP_STRING([--with-gnu-cp],
1974         [Specify location of GNU cp on Solaris or FreeBSD.]),
1977 AC_ARG_WITH(external-tar,
1978     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1979         [Specify an absolute path of where to find (and store) tarfiles.]),
1980     TARFILE_LOCATION=$withval ,
1983 AC_ARG_WITH(referenced-git,
1984     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1985         [Specify another checkout directory to reference. This makes use of
1986                  git submodule update --reference, and saves a lot of diskspace
1987                  when having multiple trees side-by-side.]),
1988     GIT_REFERENCE_SRC=$withval ,
1991 AC_ARG_WITH(linked-git,
1992     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1993         [Specify a directory where the repositories of submodules are located.
1994          This uses a method similar to git-new-workdir to get submodules.]),
1995     GIT_LINK_SRC=$withval ,
1998 AC_ARG_WITH(galleries,
1999     AS_HELP_STRING([--with-galleries],
2000         [Specify how galleries should be built. It is possible either to
2001          build these internally from source ("build"),
2002          or to disable them ("no")]),
2005 AC_ARG_WITH(theme,
2006     AS_HELP_STRING([--with-theme="theme1 theme2..."],
2007         [Choose which themes to include. By default those themes with an '*' are included.
2008          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg, *colibre, *colibre_svg, *elementary,
2009          *elementary_svg, *karasa_jaga, *karasa_jaga_svg, *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg, *sukapura, *sukapura_svg.]),
2012 libo_FUZZ_ARG_WITH(helppack-integration,
2013     AS_HELP_STRING([--without-helppack-integration],
2014         [It will not integrate the helppacks to the installer
2015          of the product. Please use this switch to use the online help
2016          or separate help packages.]),
2019 libo_FUZZ_ARG_WITH(fonts,
2020     AS_HELP_STRING([--without-fonts],
2021         [LibreOffice includes some third-party fonts to provide a reliable basis for
2022          help content, templates, samples, etc. When these fonts are already
2023          known to be available on the system then you should use this option.]),
2026 AC_ARG_WITH(epm,
2027     AS_HELP_STRING([--with-epm],
2028         [Decides which epm to use. Default is to use the one from the system if
2029          one is built. When either this is not there or you say =internal epm
2030          will be built.]),
2033 AC_ARG_WITH(package-format,
2034     AS_HELP_STRING([--with-package-format],
2035         [Specify package format(s) for LibreOffice installation sets. The
2036          implicit --without-package-format leads to no installation sets being
2037          generated. Possible values: aix, archive, bsd, deb, dmg,
2038          installed, msi, pkg, and rpm.
2039          Example: --with-package-format='deb rpm']),
2042 AC_ARG_WITH(tls,
2043     AS_HELP_STRING([--with-tls],
2044         [Decides which TLS/SSL and cryptographic implementations to use for
2045          LibreOffice's code. Notice that this doesn't apply for depending
2046          libraries like "neon", for example. Default is to use NSS
2047          although OpenSSL is also possible. Notice that selecting NSS restricts
2048          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
2049          restrict by now the usage of NSS in LO's code. Possible values:
2050          openssl, nss. Example: --with-tls="nss"]),
2053 AC_ARG_WITH(system-libs,
2054     AS_HELP_STRING([--with-system-libs],
2055         [Use libraries already on system -- enables all --with-system-* flags.]),
2058 AC_ARG_WITH(system-bzip2,
2059     AS_HELP_STRING([--with-system-bzip2],
2060         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
2061     [with_system_bzip2="$with_system_libs"])
2063 AC_ARG_WITH(system-headers,
2064     AS_HELP_STRING([--with-system-headers],
2065         [Use headers already on system -- enables all --with-system-* flags for
2066          external packages whose headers are the only entities used i.e.
2067          boost/odbc/sane-header(s).]),,
2068     [with_system_headers="$with_system_libs"])
2070 AC_ARG_WITH(system-jars,
2071     AS_HELP_STRING([--without-system-jars],
2072         [When building with --with-system-libs, also the needed jars are expected
2073          on the system. Use this to disable that]),,
2074     [with_system_jars="$with_system_libs"])
2076 AC_ARG_WITH(system-cairo,
2077     AS_HELP_STRING([--with-system-cairo],
2078         [Use cairo libraries already on system.  Happens automatically for
2079          (implicit) --enable-gtk3.]))
2081 AC_ARG_WITH(system-epoxy,
2082     AS_HELP_STRING([--with-system-epoxy],
2083         [Use epoxy libraries already on system.  Happens automatically for
2084          (implicit) --enable-gtk3.]),,
2085        [with_system_epoxy="$with_system_libs"])
2087 AC_ARG_WITH(myspell-dicts,
2088     AS_HELP_STRING([--with-myspell-dicts],
2089         [Adds myspell dictionaries to the LibreOffice installation set]),
2092 AC_ARG_WITH(system-dicts,
2093     AS_HELP_STRING([--without-system-dicts],
2094         [Do not use dictionaries from system paths.]),
2097 AC_ARG_WITH(external-dict-dir,
2098     AS_HELP_STRING([--with-external-dict-dir],
2099         [Specify external dictionary dir.]),
2102 AC_ARG_WITH(external-hyph-dir,
2103     AS_HELP_STRING([--with-external-hyph-dir],
2104         [Specify external hyphenation pattern dir.]),
2107 AC_ARG_WITH(external-thes-dir,
2108     AS_HELP_STRING([--with-external-thes-dir],
2109         [Specify external thesaurus dir.]),
2112 AC_ARG_WITH(system-zlib,
2113     AS_HELP_STRING([--with-system-zlib],
2114         [Use zlib already on system.]),,
2115     [with_system_zlib=auto])
2117 AC_ARG_WITH(system-jpeg,
2118     AS_HELP_STRING([--with-system-jpeg],
2119         [Use jpeg already on system.]),,
2120     [with_system_jpeg="$with_system_libs"])
2122 AC_ARG_WITH(system-clucene,
2123     AS_HELP_STRING([--with-system-clucene],
2124         [Use clucene already on system.]),,
2125     [with_system_clucene="$with_system_libs"])
2127 AC_ARG_WITH(system-expat,
2128     AS_HELP_STRING([--with-system-expat],
2129         [Use expat already on system.]),,
2130     [with_system_expat="$with_system_libs"])
2132 AC_ARG_WITH(system-libxml,
2133     AS_HELP_STRING([--with-system-libxml],
2134         [Use libxml/libxslt already on system.]),,
2135     [with_system_libxml=auto])
2137 AC_ARG_WITH(system-icu,
2138     AS_HELP_STRING([--with-system-icu],
2139         [Use icu already on system.]),,
2140     [with_system_icu="$with_system_libs"])
2142 AC_ARG_WITH(system-ucpp,
2143     AS_HELP_STRING([--with-system-ucpp],
2144         [Use ucpp already on system.]),,
2145     [])
2147 AC_ARG_WITH(system-openldap,
2148     AS_HELP_STRING([--with-system-openldap],
2149         [Use the OpenLDAP LDAP SDK already on system.]),,
2150     [with_system_openldap="$with_system_libs"])
2152 libo_FUZZ_ARG_ENABLE(poppler,
2153     AS_HELP_STRING([--disable-poppler],
2154         [Disable building Poppler.])
2157 AC_ARG_WITH(system-poppler,
2158     AS_HELP_STRING([--with-system-poppler],
2159         [Use system poppler (only needed for PDF import).]),,
2160     [with_system_poppler="$with_system_libs"])
2162 libo_FUZZ_ARG_ENABLE(gpgmepp,
2163     AS_HELP_STRING([--disable-gpgmepp],
2164         [Disable building gpgmepp. Do not use in normal cases unless you want to fix potential problems it causes.])
2167 AC_ARG_WITH(system-gpgmepp,
2168     AS_HELP_STRING([--with-system-gpgmepp],
2169         [Use gpgmepp already on system]),,
2170     [with_system_gpgmepp="$with_system_libs"])
2172 AC_ARG_WITH(system-mariadb,
2173     AS_HELP_STRING([--with-system-mariadb],
2174         [Use MariaDB/MySQL libraries already on system.]),,
2175     [with_system_mariadb="$with_system_libs"])
2177 AC_ARG_ENABLE(bundle-mariadb,
2178     AS_HELP_STRING([--enable-bundle-mariadb],
2179         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
2182 AC_ARG_WITH(system-postgresql,
2183     AS_HELP_STRING([--with-system-postgresql],
2184         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
2185          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
2186     [with_system_postgresql="$with_system_libs"])
2188 AC_ARG_WITH(libpq-path,
2189     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
2190         [Use this PostgreSQL C interface (libpq) installation for building
2191          the PostgreSQL-SDBC extension.]),
2194 AC_ARG_WITH(system-firebird,
2195     AS_HELP_STRING([--with-system-firebird],
2196         [Use Firebird libraries already on system, for building the Firebird-SDBC
2197          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
2198     [with_system_firebird="$with_system_libs"])
2200 AC_ARG_WITH(system-libtommath,
2201             AS_HELP_STRING([--with-system-libtommath],
2202                            [Use libtommath already on system]),,
2203             [with_system_libtommath="$with_system_libs"])
2205 AC_ARG_WITH(system-hsqldb,
2206     AS_HELP_STRING([--with-system-hsqldb],
2207         [Use hsqldb already on system.]))
2209 AC_ARG_WITH(hsqldb-jar,
2210     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
2211         [Specify path to jarfile manually.]),
2212     HSQLDB_JAR=$withval)
2214 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
2215     AS_HELP_STRING([--disable-scripting-beanshell],
2216         [Disable support for scripts in BeanShell.]),
2220 AC_ARG_WITH(system-beanshell,
2221     AS_HELP_STRING([--with-system-beanshell],
2222         [Use beanshell already on system.]),,
2223     [with_system_beanshell="$with_system_jars"])
2225 AC_ARG_WITH(beanshell-jar,
2226     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
2227         [Specify path to jarfile manually.]),
2228     BSH_JAR=$withval)
2230 libo_FUZZ_ARG_ENABLE(scripting-javascript,
2231     AS_HELP_STRING([--disable-scripting-javascript],
2232         [Disable support for scripts in JavaScript.]),
2236 AC_ARG_WITH(system-rhino,
2237     AS_HELP_STRING([--with-system-rhino],
2238         [Use rhino already on system.]),,)
2239 #    [with_system_rhino="$with_system_jars"])
2240 # Above is not used as we have different debug interface
2241 # patched into internal rhino. This code needs to be fixed
2242 # before we can enable it by default.
2244 AC_ARG_WITH(rhino-jar,
2245     AS_HELP_STRING([--with-rhino-jar=JARFILE],
2246         [Specify path to jarfile manually.]),
2247     RHINO_JAR=$withval)
2249 AC_ARG_WITH(system-jfreereport,
2250     AS_HELP_STRING([--with-system-jfreereport],
2251         [Use JFreeReport already on system.]),,
2252     [with_system_jfreereport="$with_system_jars"])
2254 AC_ARG_WITH(sac-jar,
2255     AS_HELP_STRING([--with-sac-jar=JARFILE],
2256         [Specify path to jarfile manually.]),
2257     SAC_JAR=$withval)
2259 AC_ARG_WITH(libxml-jar,
2260     AS_HELP_STRING([--with-libxml-jar=JARFILE],
2261         [Specify path to jarfile manually.]),
2262     LIBXML_JAR=$withval)
2264 AC_ARG_WITH(flute-jar,
2265     AS_HELP_STRING([--with-flute-jar=JARFILE],
2266         [Specify path to jarfile manually.]),
2267     FLUTE_JAR=$withval)
2269 AC_ARG_WITH(jfreereport-jar,
2270     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
2271         [Specify path to jarfile manually.]),
2272     JFREEREPORT_JAR=$withval)
2274 AC_ARG_WITH(liblayout-jar,
2275     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
2276         [Specify path to jarfile manually.]),
2277     LIBLAYOUT_JAR=$withval)
2279 AC_ARG_WITH(libloader-jar,
2280     AS_HELP_STRING([--with-libloader-jar=JARFILE],
2281         [Specify path to jarfile manually.]),
2282     LIBLOADER_JAR=$withval)
2284 AC_ARG_WITH(libformula-jar,
2285     AS_HELP_STRING([--with-libformula-jar=JARFILE],
2286         [Specify path to jarfile manually.]),
2287     LIBFORMULA_JAR=$withval)
2289 AC_ARG_WITH(librepository-jar,
2290     AS_HELP_STRING([--with-librepository-jar=JARFILE],
2291         [Specify path to jarfile manually.]),
2292     LIBREPOSITORY_JAR=$withval)
2294 AC_ARG_WITH(libfonts-jar,
2295     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
2296         [Specify path to jarfile manually.]),
2297     LIBFONTS_JAR=$withval)
2299 AC_ARG_WITH(libserializer-jar,
2300     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
2301         [Specify path to jarfile manually.]),
2302     LIBSERIALIZER_JAR=$withval)
2304 AC_ARG_WITH(libbase-jar,
2305     AS_HELP_STRING([--with-libbase-jar=JARFILE],
2306         [Specify path to jarfile manually.]),
2307     LIBBASE_JAR=$withval)
2309 AC_ARG_WITH(system-odbc,
2310     AS_HELP_STRING([--with-system-odbc],
2311         [Use the odbc headers already on system.]),,
2312     [with_system_odbc="auto"])
2314 AC_ARG_WITH(system-sane,
2315     AS_HELP_STRING([--with-system-sane],
2316         [Use sane.h already on system.]),,
2317     [with_system_sane="$with_system_headers"])
2319 AC_ARG_WITH(system-bluez,
2320     AS_HELP_STRING([--with-system-bluez],
2321         [Use bluetooth.h already on system.]),,
2322     [with_system_bluez="$with_system_headers"])
2324 AC_ARG_WITH(system-curl,
2325     AS_HELP_STRING([--with-system-curl],
2326         [Use curl already on system.]),,
2327     [with_system_curl=auto])
2329 AC_ARG_WITH(system-boost,
2330     AS_HELP_STRING([--with-system-boost],
2331         [Use boost already on system.]),,
2332     [with_system_boost="$with_system_headers"])
2334 AC_ARG_WITH(system-glm,
2335     AS_HELP_STRING([--with-system-glm],
2336         [Use glm already on system.]),,
2337     [with_system_glm="$with_system_headers"])
2339 AC_ARG_WITH(system-hunspell,
2340     AS_HELP_STRING([--with-system-hunspell],
2341         [Use libhunspell already on system.]),,
2342     [with_system_hunspell="$with_system_libs"])
2344 libo_FUZZ_ARG_ENABLE(zxing,
2345     AS_HELP_STRING([--disable-zxing],
2346        [Disable use of zxing external library.]))
2348 AC_ARG_WITH(system-zxing,
2349     AS_HELP_STRING([--with-system-zxing],
2350         [Use libzxing already on system.]),,
2351     [with_system_zxing="$with_system_libs"])
2353 AC_ARG_WITH(system-box2d,
2354     AS_HELP_STRING([--with-system-box2d],
2355         [Use box2d already on system.]),,
2356     [with_system_box2d="$with_system_libs"])
2358 AC_ARG_WITH(system-mythes,
2359     AS_HELP_STRING([--with-system-mythes],
2360         [Use mythes already on system.]),,
2361     [with_system_mythes="$with_system_libs"])
2363 AC_ARG_WITH(system-altlinuxhyph,
2364     AS_HELP_STRING([--with-system-altlinuxhyph],
2365         [Use ALTLinuxhyph already on system.]),,
2366     [with_system_altlinuxhyph="$with_system_libs"])
2368 AC_ARG_WITH(system-lpsolve,
2369     AS_HELP_STRING([--with-system-lpsolve],
2370         [Use lpsolve already on system.]),,
2371     [with_system_lpsolve="$with_system_libs"])
2373 AC_ARG_WITH(system-coinmp,
2374     AS_HELP_STRING([--with-system-coinmp],
2375         [Use CoinMP already on system.]),,
2376     [with_system_coinmp="$with_system_libs"])
2378 AC_ARG_WITH(system-liblangtag,
2379     AS_HELP_STRING([--with-system-liblangtag],
2380         [Use liblangtag library already on system.]),,
2381     [with_system_liblangtag="$with_system_libs"])
2383 AC_ARG_WITH(webdav,
2384     AS_HELP_STRING([--with-webdav],
2385         [Specify which library to use for webdav implementation.
2386          Possible values: "neon", "serf", "no". The default value is "neon".
2387          Example: --with-webdav="serf"]))
2389 AC_ARG_WITH(linker-hash-style,
2390     AS_HELP_STRING([--with-linker-hash-style],
2391         [Use linker with --hash-style=<style> when linking shared objects.
2392          Possible values: "sysv", "gnu", "both". The default value is "gnu"
2393          if supported on the build system, and "sysv" otherwise.]))
2395 AC_ARG_WITH(jdk-home,
2396     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
2397         [If you have installed JDK 9 or later on your system please supply the
2398          path here. Note that this is not the location of the java command but the
2399          location of the entire distribution. In case of cross-compiling, this
2400          is the JDK of the host os. Use --with-build-platform-configure-options
2401          to point to a different build platform JDK.]),
2404 AC_ARG_WITH(help,
2405     AS_HELP_STRING([--with-help],
2406         [Enable the build of help. There is a special parameter "common" that
2407          can be used to bundle only the common part, .e.g help-specific icons.
2408          This is useful when you build the helpcontent separately.])
2409     [
2410                           Usage:     --with-help    build the old local help
2411                                  --without-help     no local help (default)
2412                                  --with-help=html   build the new HTML local help
2413                                  --with-help=online build the new HTML online help
2414     ],
2417 AC_ARG_WITH(omindex,
2418    AS_HELP_STRING([--with-omindex],
2419         [Enable the support of xapian-omega index for online help.])
2420    [
2421                          Usage: --with-omindex=server prepare the pages for omindex
2422                                 but let xapian-omega be built in server.
2423                                 --with-omindex=noxap do not prepare online pages
2424                                 for xapian-omega
2425   ],
2428 libo_FUZZ_ARG_WITH(java,
2429     AS_HELP_STRING([--with-java=<java command>],
2430         [Specify the name of the Java interpreter command. Typically "java"
2431          which is the default.
2433          To build without support for Java components, applets, accessibility
2434          or the XML filters written in Java, use --without-java or --with-java=no.]),
2435     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2436     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2439 AC_ARG_WITH(jvm-path,
2440     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2441         [Use a specific JVM search path at runtime.
2442          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2445 AC_ARG_WITH(ant-home,
2446     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2447         [If you have installed Apache Ant on your system, please supply the path here.
2448          Note that this is not the location of the Ant binary but the location
2449          of the entire distribution.]),
2452 AC_ARG_WITH(symbol-config,
2453     AS_HELP_STRING([--with-symbol-config],
2454         [Configuration for the crashreport symbol upload]),
2455         [],
2456         [with_symbol_config=no])
2458 AC_ARG_WITH(export-validation,
2459     AS_HELP_STRING([--without-export-validation],
2460         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2461 ,with_export_validation=auto)
2463 AC_ARG_WITH(bffvalidator,
2464     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2465         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2466          Requires installed Microsoft Office Binary File Format Validator.
2467          Note: export-validation (--with-export-validation) is required to be turned on.
2468          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2469 ,with_bffvalidator=no)
2471 libo_FUZZ_ARG_WITH(junit,
2472     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2473         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2474          --without-junit disables those tests. Not relevant in the --without-java case.]),
2475 ,with_junit=yes)
2477 AC_ARG_WITH(hamcrest,
2478     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2479         [Specifies the hamcrest jar file to use for JUnit-based tests.
2480          --without-junit disables those tests. Not relevant in the --without-java case.]),
2481 ,with_hamcrest=yes)
2483 AC_ARG_WITH(perl-home,
2484     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2485         [If you have installed Perl 5 Distribution, on your system, please
2486          supply the path here. Note that this is not the location of the Perl
2487          binary but the location of the entire distribution.]),
2490 libo_FUZZ_ARG_WITH(doxygen,
2491     AS_HELP_STRING(
2492         [--with-doxygen=<absolute path to doxygen executable>],
2493         [Specifies the doxygen executable to use when generating ODK C/C++
2494          documentation. --without-doxygen disables generation of ODK C/C++
2495          documentation. Not relevant in the --disable-odk case.]),
2496 ,with_doxygen=yes)
2498 AC_ARG_WITH(visual-studio,
2499     AS_HELP_STRING([--with-visual-studio=<2019>],
2500         [Specify which Visual Studio version to use in case several are
2501          installed. Currently only 2019 (default) is supported.]),
2504 AC_ARG_WITH(windows-sdk,
2505     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10.0>],
2506         [Specify which Windows SDK, or "Windows Kit", version to use
2507          in case the one that came with the selected Visual Studio
2508          is not what you want for some reason. Note that not all compiler/SDK
2509          combinations are supported. The intent is that this option should not
2510          be needed.]),
2513 AC_ARG_WITH(lang,
2514     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2515         [Use this option to build LibreOffice with additional UI language support.
2516          English (US) is always included by default.
2517          Separate multiple languages with space.
2518          For all languages, use --with-lang=ALL.]),
2521 AC_ARG_WITH(locales,
2522     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2523         [Use this option to limit the locale information built in.
2524          Separate multiple locales with space.
2525          Very experimental and might well break stuff.
2526          Just a desperate measure to shrink code and data size.
2527          By default all the locales available is included.
2528          This option is completely unrelated to --with-lang.])
2529     [
2530                           Affects also our character encoding conversion
2531                           tables for encodings mainly targeted for a
2532                           particular locale, like EUC-CN and EUC-TW for
2533                           zh, ISO-2022-JP for ja.
2535                           Affects also our add-on break iterator data for
2536                           some languages.
2538                           For the default, all locales, don't use this switch at all.
2539                           Specifying just the language part of a locale means all matching
2540                           locales will be included.
2541     ],
2544 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2545 libo_FUZZ_ARG_WITH(krb5,
2546     AS_HELP_STRING([--with-krb5],
2547         [Enable MIT Kerberos 5 support in modules that support it.
2548          By default automatically enabled on platforms
2549          where a good system Kerberos 5 is available.]),
2552 libo_FUZZ_ARG_WITH(gssapi,
2553     AS_HELP_STRING([--with-gssapi],
2554         [Enable GSSAPI support in modules that support it.
2555          By default automatically enabled on platforms
2556          where a good system GSSAPI is available.]),
2559 AC_ARG_WITH(iwyu,
2560     AS_HELP_STRING([--with-iwyu],
2561         [Use given IWYU binary path to check unneeded includes instead of building.
2562          Use only if you are hacking on it.]),
2565 libo_FUZZ_ARG_WITH(lxml,
2566     AS_HELP_STRING([--without-lxml],
2567         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2568          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2569          report widget classes and ids.]),
2572 libo_FUZZ_ARG_WITH(latest-c++,
2573     AS_HELP_STRING([--with-latest-c++],
2574         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2575          published standard.]),,
2576         [with_latest_c__=no])
2578 dnl ===================================================================
2579 dnl Branding
2580 dnl ===================================================================
2582 AC_ARG_WITH(branding,
2583     AS_HELP_STRING([--with-branding=/path/to/images],
2584         [Use given path to retrieve branding images set.])
2585     [
2586                           Search for intro.png about.svg and logo.svg.
2587                           If any is missing, default ones will be used instead.
2589                           Search also progress.conf for progress
2590                           settings on intro screen :
2592                           PROGRESSBARCOLOR="255,255,255" Set color of
2593                           progress bar. Comma separated RGB decimal values.
2594                           PROGRESSSIZE="407,6" Set size of progress bar.
2595                           Comma separated decimal values (width, height).
2596                           PROGRESSPOSITION="61,317" Set position of progress
2597                           bar from left,top. Comma separated decimal values.
2598                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2599                           bar frame. Comma separated RGB decimal values.
2600                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2601                           bar text. Comma separated RGB decimal values.
2602                           PROGRESSTEXTBASELINE="287" Set vertical position of
2603                           progress bar text from top. Decimal value.
2605                           Default values will be used if not found.
2606     ],
2610 AC_ARG_WITH(extra-buildid,
2611     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2612         [Show addition build identification in about dialog.]),
2616 AC_ARG_WITH(vendor,
2617     AS_HELP_STRING([--with-vendor="John the Builder"],
2618         [Set vendor of the build.]),
2621 AC_ARG_WITH(privacy-policy-url,
2622     AS_HELP_STRING([--with-privacy-policy-url="https://yourdomain/privacy-policy"],
2623         [The URL to your privacy policy (needed when
2624          enabling online-update or crashreporting via breakpad)]),
2625         [if test "x$with_privacy_policy_url" = "xyes"; then
2626             AC_MSG_FAILURE([you need to specify an argument when using --with-privacy-policy-url])
2627          elif test "x$with_privacy_policy_url" = "xno"; then
2628             with_privacy_policy_url="undefined"
2629          fi]
2630 ,[with_privacy_policy_url="undefined"])
2632 AC_ARG_WITH(android-package-name,
2633     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2634         [Set Android package name of the build.]),
2637 AC_ARG_WITH(compat-oowrappers,
2638     AS_HELP_STRING([--with-compat-oowrappers],
2639         [Install oo* wrappers in parallel with
2640          lo* ones to keep backward compatibility.
2641          Has effect only with make distro-pack-install]),
2644 AC_ARG_WITH(os-version,
2645     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2646         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2649 AC_ARG_WITH(idlc-cpp,
2650     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2651         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2654 AC_ARG_WITH(parallelism,
2655     AS_HELP_STRING([--with-parallelism],
2656         [Number of jobs to run simultaneously during build. Parallel builds can
2657         save a lot of time on multi-cpu machines. Defaults to the number of
2658         CPUs on the machine, unless you configure --enable-icecream - then to
2659         40.]),
2662 AC_ARG_WITH(all-tarballs,
2663     AS_HELP_STRING([--with-all-tarballs],
2664         [Download all external tarballs unconditionally]))
2666 AC_ARG_WITH(gdrive-client-id,
2667     AS_HELP_STRING([--with-gdrive-client-id],
2668         [Provides the client id of the application for OAuth2 authentication
2669         on Google Drive. If either this or --with-gdrive-client-secret is
2670         empty, the feature will be disabled]),
2673 AC_ARG_WITH(gdrive-client-secret,
2674     AS_HELP_STRING([--with-gdrive-client-secret],
2675         [Provides the client secret of the application for OAuth2
2676         authentication on Google Drive. If either this or
2677         --with-gdrive-client-id is empty, the feature will be disabled]),
2680 AC_ARG_WITH(alfresco-cloud-client-id,
2681     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2682         [Provides the client id of the application for OAuth2 authentication
2683         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2684         empty, the feature will be disabled]),
2687 AC_ARG_WITH(alfresco-cloud-client-secret,
2688     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2689         [Provides the client secret of the application for OAuth2
2690         authentication on Alfresco Cloud. If either this or
2691         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2694 AC_ARG_WITH(onedrive-client-id,
2695     AS_HELP_STRING([--with-onedrive-client-id],
2696         [Provides the client id of the application for OAuth2 authentication
2697         on OneDrive. If either this or --with-onedrive-client-secret is
2698         empty, the feature will be disabled]),
2701 AC_ARG_WITH(onedrive-client-secret,
2702     AS_HELP_STRING([--with-onedrive-client-secret],
2703         [Provides the client secret of the application for OAuth2
2704         authentication on OneDrive. If either this or
2705         --with-onedrive-client-id is empty, the feature will be disabled]),
2707 dnl ===================================================================
2708 dnl Do we want to use pre-build binary tarball for recompile
2709 dnl ===================================================================
2711 if test "$enable_library_bin_tar" = "yes" ; then
2712     USE_LIBRARY_BIN_TAR=TRUE
2713 else
2714     USE_LIBRARY_BIN_TAR=
2716 AC_SUBST(USE_LIBRARY_BIN_TAR)
2718 dnl ===================================================================
2719 dnl Test whether build target is Release Build
2720 dnl ===================================================================
2721 AC_MSG_CHECKING([whether build target is Release Build])
2722 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2723     AC_MSG_RESULT([no])
2724     ENABLE_RELEASE_BUILD=
2725     GET_TASK_ALLOW_ENTITLEMENT='
2726         <!-- We want to be able to debug a hardened process when not building for release -->
2727         <key>com.apple.security.get-task-allow</key>
2728         <true/>'
2729 else
2730     AC_MSG_RESULT([yes])
2731     ENABLE_RELEASE_BUILD=TRUE
2732     GET_TASK_ALLOW_ENTITLEMENT=''
2734 AC_SUBST(ENABLE_RELEASE_BUILD)
2735 AC_SUBST(GET_TASK_ALLOW_ENTITLEMENT)
2737 AC_MSG_CHECKING([whether to build a Community flavor])
2738 if test -z "$enable_community_flavor" -o "$enable_community_flavor" = "yes"; then
2739     AC_DEFINE(HAVE_FEATURE_COMMUNITY_FLAVOR)
2740     AC_MSG_RESULT([yes])
2741 else
2742     AC_MSG_RESULT([no])
2745 dnl ===================================================================
2746 dnl Test whether to sign Windows Build
2747 dnl ===================================================================
2748 AC_MSG_CHECKING([whether to sign windows build])
2749 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2750     AC_MSG_RESULT([yes])
2751     WINDOWS_BUILD_SIGNING="TRUE"
2752 else
2753     AC_MSG_RESULT([no])
2754     WINDOWS_BUILD_SIGNING="FALSE"
2756 AC_SUBST(WINDOWS_BUILD_SIGNING)
2758 dnl ===================================================================
2759 dnl MacOSX build and runtime environment options
2760 dnl ===================================================================
2762 AC_ARG_WITH(macosx-sdk,
2763     AS_HELP_STRING([--with-macosx-sdk=<version>],
2764         [Prefer a specific SDK for building.])
2765     [
2766                           If the requested SDK is not available, a search for the oldest one will be done.
2767                           With current Xcode versions, only the latest SDK is included, so this option is
2768                           not terribly useful. It works fine to build with a new SDK and run the result
2769                           on an older OS.
2771                           e. g.: --with-macosx-sdk=10.10
2773                           there are 3 options to control the MacOSX build:
2774                           --with-macosx-sdk (referred as 'sdk' below)
2775                           --with-macosx-version-min-required (referred as 'min' below)
2776                           --with-macosx-version-max-allowed (referred as 'max' below)
2778                           the connection between these value and the default they take is as follow:
2779                           ( ? means not specified on the command line, s means the SDK version found,
2780                           constraint: 8 <= x <= y <= z)
2782                           ==========================================
2783                            command line      || config result
2784                           ==========================================
2785                           min  | max  | sdk  || min   | max  | sdk  |
2786                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2787                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2788                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2789                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2790                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2791                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2792                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2793                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2796                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2797                           for a detailed technical explanation of these variables
2799                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2800     ],
2803 AC_ARG_WITH(macosx-version-min-required,
2804     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2805         [set the minimum OS version needed to run the built LibreOffice])
2806     [
2807                           e. g.: --with-macosx-version-min-required=10.10
2808                           see --with-macosx-sdk for more info
2809     ],
2812 AC_ARG_WITH(macosx-version-max-allowed,
2813     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2814         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2815     [
2816                           e. g.: --with-macosx-version-max-allowed=10.10
2817                           see --with-macosx-sdk for more info
2818     ],
2822 dnl ===================================================================
2823 dnl options for stuff used during cross-compilation build
2824 dnl Not quite superseded by --with-build-platform-configure-options.
2825 dnl TODO: check, if the "force" option is still needed anywhere.
2826 dnl ===================================================================
2828 AC_ARG_WITH(system-icu-for-build,
2829     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2830         [Use icu already on system for build tools (cross-compilation only).]))
2833 dnl ===================================================================
2834 dnl Check for incompatible options set by fuzzing, and reset those
2835 dnl automatically to working combinations
2836 dnl ===================================================================
2838 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2839         "$enable_dbus" != "$enable_avahi"; then
2840     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2841     enable_avahi=$enable_dbus
2844 add_lopath_after ()
2846     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2847         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2848     fi
2851 add_lopath_before ()
2853     local IFS=${P_SEP}
2854     local path_cleanup
2855     local dir
2856     for dir in $LO_PATH ; do
2857         if test "$dir" != "$1" ; then
2858             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2859         fi
2860     done
2861     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2864 dnl ===================================================================
2865 dnl check for required programs (grep, awk, sed, bash)
2866 dnl ===================================================================
2868 pathmunge ()
2870     local new_path
2871     if test -n "$1"; then
2872         if test "$build_os" = "cygwin"; then
2873             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2874                 PathFormat "$1"
2875                 new_path=`cygpath -sm "$formatted_path"`
2876             else
2877                 PathFormat "$1"
2878                 new_path=`cygpath -u "$formatted_path"`
2879             fi
2880         else
2881             new_path="$1"
2882         fi
2883         if test "$2" = "after"; then
2884             add_lopath_after "$new_path"
2885         else
2886             add_lopath_before "$new_path"
2887         fi
2888     fi
2891 AC_PROG_AWK
2892 AC_PATH_PROG( AWK, $AWK)
2893 if test -z "$AWK"; then
2894     AC_MSG_ERROR([install awk to run this script])
2897 AC_PATH_PROG(BASH, bash)
2898 if test -z "$BASH"; then
2899     AC_MSG_ERROR([bash not found in \$PATH])
2901 AC_SUBST(BASH)
2903 AC_MSG_CHECKING([for GNU or BSD tar])
2904 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2905     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2906     if test $? -eq 0;  then
2907         GNUTAR=$a
2908         break
2909     fi
2910 done
2911 AC_MSG_RESULT($GNUTAR)
2912 if test -z "$GNUTAR"; then
2913     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2915 AC_SUBST(GNUTAR)
2917 AC_MSG_CHECKING([for tar's option to strip components])
2918 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2919 if test $? -eq 0; then
2920     STRIP_COMPONENTS="--strip-components"
2921 else
2922     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2923     if test $? -eq 0; then
2924         STRIP_COMPONENTS="--strip-path"
2925     else
2926         STRIP_COMPONENTS="unsupported"
2927     fi
2929 AC_MSG_RESULT($STRIP_COMPONENTS)
2930 if test x$STRIP_COMPONENTS = xunsupported; then
2931     AC_MSG_ERROR([you need a tar that is able to strip components.])
2933 AC_SUBST(STRIP_COMPONENTS)
2935 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2936 dnl desktop OSes from "mobile" ones.
2938 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2939 dnl In other words, that when building for an OS that is not a
2940 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2942 dnl Note the direction of the implication; there is no assumption that
2943 dnl cross-compiling would imply a non-desktop OS.
2945 if test $_os != iOS -a $_os != Android -a $_os != Emscripten -a "$enable_fuzzers" != "yes"; then
2946     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2947     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2948     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2951 # Whether to build "avmedia" functionality or not.
2953 if test -z "$enable_avmedia"; then
2954     enable_avmedia=yes
2957 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2958 if test "$enable_avmedia" = yes; then
2959     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2960 else
2961     USE_AVMEDIA_DUMMY='TRUE'
2963 AC_SUBST(USE_AVMEDIA_DUMMY)
2965 # Decide whether to build database connectivity stuff (including Base) or not.
2966 if test "$enable_database_connectivity" != no; then
2967     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2968     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2969 else
2970     if test "$_os" = iOS; then
2971         AC_MSG_ERROR([Presumly can't disable DB connectivity on iOS.])
2972     fi
2973     disable_database_connectivity_dependencies
2976 if test -z "$enable_extensions"; then
2977     # For iOS and Android Viewer, disable extensions unless specifically overridden with --enable-extensions.
2978     if test $_os != iOS && test $_os != Android -o "$ENABLE_ANDROID_LOK" = TRUE ; then
2979         enable_extensions=yes
2980     fi
2983 if test "$enable_extensions" = yes; then
2984     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2985     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2986 else
2987     enable_extension_integration=no
2988     enable_extension_update=no
2991 if test -z "$enable_scripting"; then
2992     # Disable scripting for iOS unless specifically overridden
2993     # with --enable-scripting.
2994     if test $_os != iOS -o $_os = Emscripten; then
2995         enable_scripting=yes
2996     fi
2999 DISABLE_SCRIPTING=''
3000 if test "$enable_scripting" = yes; then
3001     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
3002     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
3003 else
3004     DISABLE_SCRIPTING='TRUE'
3005     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
3008 if test $_os = iOS -o $_os = Android -o $_os = Emscripten; then
3009     # Disable dynamic_loading always for iOS and Android
3010     enable_dynamic_loading=no
3011 elif test -z "$enable_dynamic_loading"; then
3012     # Otherwise enable it unless specifically disabled
3013     enable_dynamic_loading=yes
3016 DISABLE_DYNLOADING=''
3017 if test "$enable_dynamic_loading" = yes; then
3018     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
3019 else
3020     DISABLE_DYNLOADING='TRUE'
3022 AC_SUBST(DISABLE_DYNLOADING)
3024 # remember SYSBASE value
3025 AC_SUBST(SYSBASE)
3027 dnl ===================================================================
3028 dnl  Sort out various gallery compilation options
3029 dnl ===================================================================
3030 WITH_GALLERY_BUILD=TRUE
3031 AC_MSG_CHECKING([how to build and package galleries])
3032 if test -n "${with_galleries}"; then
3033     if test "$with_galleries" = "build"; then
3034         if test "$enable_database_connectivity" = no; then
3035             AC_MSG_ERROR([DB connectivity is needed for gengal / svx])
3036         fi
3037         AC_MSG_RESULT([build from source images internally])
3038     elif test "$with_galleries" = "no"; then
3039         WITH_GALLERY_BUILD=
3040         AC_MSG_RESULT([disable non-internal gallery build])
3041     else
3042         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
3043     fi
3044 else
3045     if test $_os != iOS -a $_os != Android; then
3046         AC_MSG_RESULT([internal src images for desktop])
3047     else
3048         WITH_GALLERY_BUILD=
3049         AC_MSG_RESULT([disable src image build])
3050     fi
3052 AC_SUBST(WITH_GALLERY_BUILD)
3054 dnl ===================================================================
3055 dnl  Checks if ccache is available
3056 dnl ===================================================================
3057 CCACHE_DEPEND_MODE=
3058 if test "$enable_ccache" = "no"; then
3059     CCACHE=""
3060 elif test "$_os" = "WINNT"; then
3061     # on windows/VC build do not use ccache - but perhaps sccache is around?
3062     case "%$CC%$CXX%" in
3063     # If $CC and/or $CXX already contain "sccache" (possibly suffixed with some version number etc),
3064     # assume that's good then
3065     *%sccache[[-_' ']]*|*/sccache[[-_' ']]*)
3066         AC_MSG_NOTICE([sccache seems to be included in a pre-defined CC and/or CXX])
3067         CCACHE_DEPEND_MODE=1
3068         ;;
3069     *)
3070         # for sharing code below, reuse CCACHE env var
3071         AC_PATH_PROG([CCACHE],[sccache],[not found])
3072         if test "$CCACHE" = "not found"; then
3073             CCACHE=""
3074         else
3075             CCACHE=`win_short_path_for_make "$CCACHE"`
3076             CCACHE_DEPEND_MODE=1
3077         fi
3078         ;;
3079     esac
3080 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
3081     case "%$CC%$CXX%" in
3082     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
3083     # assume that's good then
3084     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
3085         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
3086         CCACHE_DEPEND_MODE=1
3087         ;;
3088     *)
3089         AC_PATH_PROG([CCACHE],[ccache],[not found])
3090         if test "$CCACHE" = "not found"; then
3091             CCACHE=""
3092         else
3093             CCACHE_DEPEND_MODE=1
3094             # Need to check for ccache version: otherwise prevents
3095             # caching of the results (like "-x objective-c++" for Mac)
3096             if test $_os = Darwin -o $_os = iOS; then
3097                 # Check ccache version
3098                 AC_MSG_CHECKING([whether version of ccache is suitable])
3099                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
3100                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3101                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
3102                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
3103                 else
3104                     AC_MSG_RESULT([no, $CCACHE_VERSION])
3105                     CCACHE=""
3106                     CCACHE_DEPEND_MODE=
3107                 fi
3108             fi
3109         fi
3110         ;;
3111     esac
3112 else
3113     CCACHE=""
3115 if test "$enable_ccache" = "nodepend"; then
3116     CCACHE_DEPEND_MODE=""
3118 AC_SUBST(CCACHE_DEPEND_MODE)
3120 # skip on windows - sccache defaults are good enough
3121 if test "$CCACHE" != "" -a "$_os" != "WINNT"; then
3122     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
3123     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
3124     if test "$ccache_size" = ""; then
3125         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
3126         if test "$ccache_size" = ""; then
3127             ccache_size=0
3128         fi
3129         # we could not determine the size or it was less than 1GB -> disable auto-ccache
3130         if test $ccache_size -lt 1024; then
3131             CCACHE=""
3132             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
3133             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
3134         else
3135             # warn that ccache may be too small for debug build
3136             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3137             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3138         fi
3139     else
3140         if test $ccache_size -lt 5; then
3141             #warn that ccache may be too small for debug build
3142             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3143             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3144         fi
3145     fi
3148 dnl ===================================================================
3149 dnl  Checks for C compiler,
3150 dnl  The check for the C++ compiler is later on.
3151 dnl ===================================================================
3152 if test "$_os" != "WINNT"; then
3153     GCC_HOME_SET="true"
3154     AC_MSG_CHECKING([gcc home])
3155     if test -z "$with_gcc_home"; then
3156         if test "$enable_icecream" = "yes"; then
3157             if test -d "/usr/lib/icecc/bin"; then
3158                 GCC_HOME="/usr/lib/icecc/"
3159             elif test -d "/usr/libexec/icecc/bin"; then
3160                 GCC_HOME="/usr/libexec/icecc/"
3161             elif test -d "/opt/icecream/bin"; then
3162                 GCC_HOME="/opt/icecream/"
3163             else
3164                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
3166             fi
3167         else
3168             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
3169             GCC_HOME_SET="false"
3170         fi
3171     else
3172         GCC_HOME="$with_gcc_home"
3173     fi
3174     AC_MSG_RESULT($GCC_HOME)
3175     AC_SUBST(GCC_HOME)
3177     if test "$GCC_HOME_SET" = "true"; then
3178         if test -z "$CC"; then
3179             CC="$GCC_HOME/bin/gcc"
3180             CC_BASE="gcc"
3181         fi
3182         if test -z "$CXX"; then
3183             CXX="$GCC_HOME/bin/g++"
3184             CXX_BASE="g++"
3185         fi
3186     fi
3189 COMPATH=`dirname "$CC"`
3190 if test "$COMPATH" = "."; then
3191     AC_PATH_PROGS(COMPATH, $CC)
3192     dnl double square bracket to get single because of M4 quote...
3193     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
3195 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
3197 dnl ===================================================================
3198 dnl Java support
3199 dnl ===================================================================
3200 AC_MSG_CHECKING([whether to build with Java support])
3201 if test "$with_java" != "no"; then
3202     if test "$DISABLE_SCRIPTING" = TRUE; then
3203         AC_MSG_RESULT([no, overridden by --disable-scripting])
3204         ENABLE_JAVA=""
3205         with_java=no
3206     else
3207         AC_MSG_RESULT([yes])
3208         ENABLE_JAVA="TRUE"
3209         AC_DEFINE(HAVE_FEATURE_JAVA)
3210     fi
3211 else
3212     AC_MSG_RESULT([no])
3213     ENABLE_JAVA=""
3216 AC_SUBST(ENABLE_JAVA)
3218 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
3220 dnl ENABLE_JAVA="" indicate no Java support at all
3222 dnl ===================================================================
3223 dnl Check macOS SDK and compiler
3224 dnl ===================================================================
3226 if test $_os = Darwin; then
3228     # If no --with-macosx-sdk option is given, look for one
3230     # The intent is that for "most" Mac-based developers, a suitable
3231     # SDK will be found automatically without any configure options.
3233     # For developers with a current Xcode, the lowest-numbered SDK
3234     # higher than or equal to the minimum required should be found.
3236     AC_MSG_CHECKING([what macOS SDK to use])
3237     for _macosx_sdk in ${with_macosx_sdk-11.3 11.1 11.0 10.15 10.14 10.13}; do
3238         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
3239         if test -d "$MACOSX_SDK_PATH"; then
3240             with_macosx_sdk="${_macosx_sdk}"
3241             break
3242         else
3243             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
3244             if test -d "$MACOSX_SDK_PATH"; then
3245                 with_macosx_sdk="${_macosx_sdk}"
3246                 break
3247             fi
3248         fi
3249     done
3250     if test ! -d "$MACOSX_SDK_PATH"; then
3251         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
3252     fi
3254     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
3256     case $with_macosx_sdk in
3257     10.13)
3258         MACOSX_SDK_VERSION=101300
3259         ;;
3260     10.14)
3261         MACOSX_SDK_VERSION=101400
3262         ;;
3263     10.15)
3264         MACOSX_SDK_VERSION=101500
3265         ;;
3266     11.0)
3267         MACOSX_SDK_VERSION=110000
3268         ;;
3269     11.1)
3270         MACOSX_SDK_VERSION=110100
3271         ;;
3272     11.3)
3273         MACOSX_SDK_VERSION=110300
3274         ;;
3275     *)
3276         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.13--11.3])
3277         ;;
3278     esac
3280     if test "$host_cpu" = arm64 -a $MACOSX_SDK_VERSION -lt 110000; then
3281         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value for Apple Silicon])
3282     fi
3284     if test "$with_macosx_version_min_required" = "" ; then
3285         if test "$host_cpu" = x86_64; then
3286             with_macosx_version_min_required="10.10";
3287         else
3288             with_macosx_version_min_required="11.0";
3289         fi
3290     fi
3292     if test "$with_macosx_version_max_allowed" = "" ; then
3293         with_macosx_version_max_allowed="$with_macosx_sdk"
3294     fi
3296     # export this so that "xcrun" invocations later return matching values
3297     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
3298     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
3299     export DEVELOPER_DIR
3300     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
3301     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
3303     AC_MSG_CHECKING([whether Xcode is new enough])
3304     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
3305     my_xcode_ver2=${my_xcode_ver1#Xcode }
3306     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
3307     if test "$my_xcode_ver3" -ge 1103; then
3308         AC_MSG_RESULT([yes ($my_xcode_ver2)])
3309     else
3310         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 11.3])
3311     fi
3313     case "$with_macosx_version_min_required" in
3314     10.10)
3315         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
3316         ;;
3317     10.11)
3318         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
3319         ;;
3320     10.12)
3321         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
3322         ;;
3323     10.13)
3324         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
3325         ;;
3326     10.14)
3327         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
3328         ;;
3329     10.15)
3330         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
3331         ;;
3332     10.16)
3333         MAC_OS_X_VERSION_MIN_REQUIRED="101600"
3334         ;;
3335     11.0)
3336         MAC_OS_X_VERSION_MIN_REQUIRED="110000"
3337         ;;
3338     11.1)
3339         MAC_OS_X_VERSION_MIN_REQUIRED="110100"
3340         ;;
3341     11.3)
3342         MAC_OS_X_VERSION_MIN_REQUIRED="110300"
3343         ;;
3344     *)
3345         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])
3346         ;;
3347     esac
3349     LIBTOOL=/usr/bin/libtool
3350     INSTALL_NAME_TOOL=install_name_tool
3351     if test -z "$save_CC"; then
3352         stdlib=-stdlib=libc++
3354         AC_MSG_CHECKING([what C compiler to use])
3355         CC="`xcrun -find clang`"
3356         CC_BASE=`first_arg_basename "$CC"`
3357         if test "$host_cpu" = x86_64; then
3358             CC+=" -target x86_64-apple-macos"
3359         else
3360             CC+=" -target arm64-apple-macos"
3361         fi
3362         CC+=" -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3363         AC_MSG_RESULT([$CC])
3365         AC_MSG_CHECKING([what C++ compiler to use])
3366         CXX="`xcrun -find clang++`"
3367         CXX_BASE=`first_arg_basename "$CXX"`
3368         if test "$host_cpu" = x86_64; then
3369             CXX+=" -target x86_64-apple-macos"
3370         else
3371             CXX+=" -target arm64-apple-macos"
3372         fi
3373         CXX+=" $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3374         AC_MSG_RESULT([$CXX])
3376         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3377         AR=`xcrun -find ar`
3378         NM=`xcrun -find nm`
3379         STRIP=`xcrun -find strip`
3380         LIBTOOL=`xcrun -find libtool`
3381         RANLIB=`xcrun -find ranlib`
3382     fi
3384     case "$with_macosx_version_max_allowed" in
3385     10.10)
3386         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
3387         ;;
3388     10.11)
3389         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
3390         ;;
3391     10.12)
3392         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
3393         ;;
3394     10.13)
3395         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
3396         ;;
3397     10.14)
3398         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
3399         ;;
3400     10.15)
3401         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
3402         ;;
3403     11.0)
3404         MAC_OS_X_VERSION_MAX_ALLOWED="110000"
3405         ;;
3406     11.1)
3407         MAC_OS_X_VERSION_MAX_ALLOWED="110100"
3408         ;;
3409     11.3)
3410         MAC_OS_X_VERSION_MAX_ALLOWED="110300"
3411         ;;
3412     *)
3413         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--11.3])
3414         ;;
3415     esac
3417     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
3418     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
3419         AC_MSG_ERROR([the version minimum required, $MAC_OS_X_VERSION_MIN_REQUIRED, must be <= the version maximum allowed, $MAC_OS_X_VERSION_MAX_ALLOWED])
3420     else
3421         AC_MSG_RESULT([ok])
3422     fi
3424     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
3425     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
3426         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
3427     else
3428         AC_MSG_RESULT([ok])
3429     fi
3430     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
3431     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
3433     AC_MSG_CHECKING([whether to do code signing])
3435     if test "$enable_macosx_code_signing" = yes; then
3436         # By default use the first suitable certificate (?).
3438         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
3439         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
3440         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
3441         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
3442         # "Developer ID Application" one.
3444         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
3445         if test -n "$identity"; then
3446             MACOSX_CODESIGNING_IDENTITY=$identity
3447             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3448             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3449         else
3450             AC_MSG_ERROR([cannot determine identity to use])
3451         fi
3452     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
3453         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
3454         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3455         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3456     else
3457         AC_MSG_RESULT([no])
3458     fi
3460     AC_MSG_CHECKING([whether to create a Mac App Store package])
3462     if test -z "$enable_macosx_package_signing" || test "$enable_macosx_package_signing" == no; then
3463         AC_MSG_RESULT([no])
3464     elif test -z "$MACOSX_CODESIGNING_IDENTITY"; then
3465         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3466     elif test "$enable_macosx_package_signing" = yes; then
3467         # By default use the first suitable certificate.
3468         # It should be a "3rd Party Mac Developer Installer" one
3470         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
3471         if test -n "$identity"; then
3472             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3473             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3474             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3475         else
3476             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3477         fi
3478     else
3479         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
3480         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3481         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3482     fi
3484     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3485         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3486     fi
3488     AC_MSG_CHECKING([whether to sandbox the application])
3490     if test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3491         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3492     elif test "$enable_macosx_sandbox" = yes; then
3493         ENABLE_MACOSX_SANDBOX=TRUE
3494         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3495         AC_MSG_RESULT([yes])
3496     else
3497         AC_MSG_RESULT([no])
3498     fi
3500     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3501     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3502     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3504 AC_SUBST(MACOSX_SDK_PATH)
3505 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3506 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3507 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3508 AC_SUBST(INSTALL_NAME_TOOL)
3509 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3510 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3511 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3512 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3513 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3515 dnl ===================================================================
3516 dnl Check iOS SDK and compiler
3517 dnl ===================================================================
3519 if test $_os = iOS; then
3520     AC_MSG_CHECKING([what iOS SDK to use])
3521     current_sdk_ver=14.5
3522     older_sdk_vers="14.4 14.3 14.2 14.1 14.0 13.7"
3523     if test "$enable_ios_simulator" = "yes"; then
3524         platform=iPhoneSimulator
3525         versionmin=-mios-simulator-version-min=12.2
3526     else
3527         platform=iPhoneOS
3528         versionmin=-miphoneos-version-min=12.2
3529     fi
3530     xcode_developer=`xcode-select -print-path`
3532     for sdkver in $current_sdk_ver $older_sdk_vers; do
3533         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3534         if test -d $t; then
3535             sysroot=$t
3536             break
3537         fi
3538     done
3540     if test -z "$sysroot"; then
3541         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3542     fi
3544     AC_MSG_RESULT($sysroot)
3546     stdlib="-stdlib=libc++"
3548     AC_MSG_CHECKING([what C compiler to use])
3549     CC="`xcrun -find clang`"
3550     CC_BASE=`first_arg_basename "$CC"`
3551     CC+=" -arch $host_cpu_for_clang -isysroot $sysroot $versionmin"
3552     AC_MSG_RESULT([$CC])
3554     AC_MSG_CHECKING([what C++ compiler to use])
3555     CXX="`xcrun -find clang++`"
3556     CXX_BASE=`first_arg_basename "$CXX"`
3557     CXX+=" -arch $host_cpu_for_clang $stdlib -isysroot $sysroot $versionmin"
3558     AC_MSG_RESULT([$CXX])
3560     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3561     AR=`xcrun -find ar`
3562     NM=`xcrun -find nm`
3563     STRIP=`xcrun -find strip`
3564     LIBTOOL=`xcrun -find libtool`
3565     RANLIB=`xcrun -find ranlib`
3568 AC_MSG_CHECKING([whether to treat the installation as read-only])
3570 if test $_os = Darwin; then
3571     enable_readonly_installset=yes
3572 elif test "$enable_extensions" != yes; then
3573     enable_readonly_installset=yes
3575 if test "$enable_readonly_installset" = yes; then
3576     AC_MSG_RESULT([yes])
3577     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3578 else
3579     AC_MSG_RESULT([no])
3582 dnl ===================================================================
3583 dnl Structure of install set
3584 dnl ===================================================================
3586 if test $_os = Darwin; then
3587     LIBO_BIN_FOLDER=MacOS
3588     LIBO_ETC_FOLDER=Resources
3589     LIBO_LIBEXEC_FOLDER=MacOS
3590     LIBO_LIB_FOLDER=Frameworks
3591     LIBO_LIB_PYUNO_FOLDER=Resources
3592     LIBO_SHARE_FOLDER=Resources
3593     LIBO_SHARE_HELP_FOLDER=Resources/help
3594     LIBO_SHARE_JAVA_FOLDER=Resources/java
3595     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3596     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3597     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3598     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3599     LIBO_URE_BIN_FOLDER=MacOS
3600     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3601     LIBO_URE_LIB_FOLDER=Frameworks
3602     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3603     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3604 elif test $_os = WINNT; then
3605     LIBO_BIN_FOLDER=program
3606     LIBO_ETC_FOLDER=program
3607     LIBO_LIBEXEC_FOLDER=program
3608     LIBO_LIB_FOLDER=program
3609     LIBO_LIB_PYUNO_FOLDER=program
3610     LIBO_SHARE_FOLDER=share
3611     LIBO_SHARE_HELP_FOLDER=help
3612     LIBO_SHARE_JAVA_FOLDER=program/classes
3613     LIBO_SHARE_PRESETS_FOLDER=presets
3614     LIBO_SHARE_READMES_FOLDER=readmes
3615     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3616     LIBO_SHARE_SHELL_FOLDER=program/shell
3617     LIBO_URE_BIN_FOLDER=program
3618     LIBO_URE_ETC_FOLDER=program
3619     LIBO_URE_LIB_FOLDER=program
3620     LIBO_URE_MISC_FOLDER=program
3621     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3622 else
3623     LIBO_BIN_FOLDER=program
3624     LIBO_ETC_FOLDER=program
3625     LIBO_LIBEXEC_FOLDER=program
3626     LIBO_LIB_FOLDER=program
3627     LIBO_LIB_PYUNO_FOLDER=program
3628     LIBO_SHARE_FOLDER=share
3629     LIBO_SHARE_HELP_FOLDER=help
3630     LIBO_SHARE_JAVA_FOLDER=program/classes
3631     LIBO_SHARE_PRESETS_FOLDER=presets
3632     LIBO_SHARE_READMES_FOLDER=readmes
3633     if test "$enable_fuzzers" != yes; then
3634         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3635     else
3636         LIBO_SHARE_RESOURCE_FOLDER=resource
3637     fi
3638     LIBO_SHARE_SHELL_FOLDER=program/shell
3639     LIBO_URE_BIN_FOLDER=program
3640     LIBO_URE_ETC_FOLDER=program
3641     LIBO_URE_LIB_FOLDER=program
3642     LIBO_URE_MISC_FOLDER=program
3643     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3645 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3646 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3647 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3648 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3649 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3650 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3651 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3652 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3653 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3654 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3655 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3656 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3657 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3658 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3659 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3660 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3662 # Not all of them needed in config_host.mk, add more if need arises
3663 AC_SUBST(LIBO_BIN_FOLDER)
3664 AC_SUBST(LIBO_ETC_FOLDER)
3665 AC_SUBST(LIBO_LIB_FOLDER)
3666 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3667 AC_SUBST(LIBO_SHARE_FOLDER)
3668 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3669 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3670 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3671 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3672 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3673 AC_SUBST(LIBO_URE_BIN_FOLDER)
3674 AC_SUBST(LIBO_URE_ETC_FOLDER)
3675 AC_SUBST(LIBO_URE_LIB_FOLDER)
3676 AC_SUBST(LIBO_URE_MISC_FOLDER)
3677 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3679 dnl ===================================================================
3680 dnl Windows specific tests and stuff
3681 dnl ===================================================================
3683 reg_get_value()
3685     # Return value: $regvalue
3686     unset regvalue
3688     if test "$build_os" = "wsl"; then
3689         regvalue=$($BUILDDIR/solenv/wsl/wsl-lo-helper.exe --read-registry $1 "$2" 2>/dev/null)
3690         return
3691     fi
3693     local _regentry="/proc/registry${1}/${2}"
3694     if test -f "$_regentry"; then
3695         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3696         # Registry keys read via /proc/registry* are always \0 terminated!
3697         local _regvalue=$(tr -d '\0' < "$_regentry")
3698         if test $? -eq 0; then
3699             regvalue=$_regvalue
3700         fi
3701     fi
3704 # Get a value from the 32-bit side of the Registry
3705 reg_get_value_32()
3707     reg_get_value "32" "$1"
3710 # Get a value from the 64-bit side of the Registry
3711 reg_get_value_64()
3713     reg_get_value "64" "$1"
3716 case "$host_os" in
3717 cygwin*|wsl*)
3718     COM=MSC
3719     OS=WNT
3720     RTL_OS=Windows
3721     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3722         P_SEP=";"
3723     else
3724         P_SEP=:
3725     fi
3726     case "$host_cpu" in
3727     x86_64)
3728         CPUNAME=X86_64
3729         RTL_ARCH=X86_64
3730         PLATFORMID=windows_x86_64
3731         WINDOWS_X64=1
3732         SCPDEFS="$SCPDEFS -DWINDOWS_X64"
3733         WIN_HOST_ARCH="x64"
3734         WIN_MULTI_ARCH="x86"
3735         WIN_HOST_BITS=64
3736         ;;
3737     i*86)
3738         CPUNAME=INTEL
3739         RTL_ARCH=x86
3740         PLATFORMID=windows_x86
3741         WIN_HOST_ARCH="x86"
3742         WIN_HOST_BITS=32
3743         WIN_OTHER_ARCH="x64"
3744         ;;
3745     aarch64)
3746         CPUNAME=AARCH64
3747         RTL_ARCH=AARCH64
3748         PLATFORMID=windows_aarch64
3749         WINDOWS_X64=1
3750         SCPDEFS="$SCPDEFS -DWINDOWS_AARCH64"
3751         WIN_HOST_ARCH="arm64"
3752         WIN_HOST_BITS=64
3753         with_ucrt_dir=no
3754         ;;
3755     *)
3756         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3757         ;;
3758     esac
3760     case "$build_cpu" in
3761     x86_64) WIN_BUILD_ARCH="x64" ;;
3762     i*86) WIN_BUILD_ARCH="x86" ;;
3763     aarch64) WIN_BUILD_ARCH="arm64" ;;
3764     *)
3765         AC_MSG_ERROR([Unsupported build_cpu $build_cpu for host_os $host_os])
3766         ;;
3767     esac
3769     SCPDEFS="$SCPDEFS -D_MSC_VER"
3770     ;;
3771 esac
3773 # multi-arch is an arch, which can execute on the host (x86 on x64), while
3774 # other-arch won't, but wouldn't break the build (x64 on x86).
3775 if test -n "$WIN_MULTI_ARCH" -a -n "$WIN_OTHER_ARCH"; then
3776     AC_MSG_ERROR([Broken configure.ac file: can't have set \$WIN_MULTI_ARCH and $WIN_OTHER_ARCH])
3780 if test "$_os" = "iOS" -o "$build_cpu" != "$host_cpu"; then
3781     # To allow building Windows multi-arch releases without cross-tooling
3782     if test -z "$WIN_MULTI_ARCH" -a -z "$WIN_OTHER_ARCH"; then
3783         cross_compiling="yes"
3784     fi
3787 ENABLE_WASM_STRIP=''
3788 if test "$cross_compiling" = "yes"; then
3789     export CROSS_COMPILING=TRUE
3790     if test "$enable_dynamic_loading" != yes -a "$enable_wasm_strip" = yes; then
3791         ENABLE_WASM_STRIP=TRUE
3792     fi
3793 else
3794     CROSS_COMPILING=
3795     BUILD_TYPE="$BUILD_TYPE NATIVE"
3797 AC_SUBST(CROSS_COMPILING)
3798 AC_SUBST(ENABLE_WASM_STRIP)
3800 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3801 # NOTE: must _not_ be used for bundled external libraries!
3802 ISYSTEM=
3803 if test "$GCC" = "yes"; then
3804     AC_MSG_CHECKING( for -isystem )
3805     save_CFLAGS=$CFLAGS
3806     CFLAGS="$CFLAGS -Werror"
3807     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3808     CFLAGS=$save_CFLAGS
3809     if test -n "$ISYSTEM"; then
3810         AC_MSG_RESULT(yes)
3811     else
3812         AC_MSG_RESULT(no)
3813     fi
3815 if test -z "$ISYSTEM"; then
3816     # fall back to using -I
3817     ISYSTEM=-I
3819 AC_SUBST(ISYSTEM)
3821 dnl ===================================================================
3822 dnl  Check which Visual Studio compiler is used
3823 dnl ===================================================================
3825 map_vs_year_to_version()
3827     # Return value: $vsversion
3829     unset vsversion
3831     case $1 in
3832     2019)
3833         vsversion=16;;
3834     *)
3835         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3836     esac
3839 vs_versions_to_check()
3841     # Args: $1 (optional) : versions to check, in the order of preference
3842     # Return value: $vsversions
3844     unset vsversions
3846     if test -n "$1"; then
3847         map_vs_year_to_version "$1"
3848         vsversions=$vsversion
3849     else
3850         # We accept only 2019
3851         vsversions="16"
3852     fi
3855 win_get_env_from_vsvars32bat()
3857     local WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3858     # Also seems to be located in another directory under the same name: vsvars32.bat
3859     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3860     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3861     # use 'echo.%ENV%' syntax (instead of 'echo %ENV%') to avoid outputting "ECHO is off." in case when ENV is empty or a space
3862     printf '@setlocal\r\n@echo.%%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3863     local result
3864     if test "$build_os" = "wsl"; then
3865         result=$(cd /mnt/c && cmd.exe /c $(wslpath -w $WRAPPERBATCHFILEPATH) | tr -d '\r')
3866     else
3867         chmod +x $WRAPPERBATCHFILEPATH
3868         result=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3869     fi
3870     rm -f $WRAPPERBATCHFILEPATH
3871     printf '%s' "$result"
3874 find_ucrt()
3876     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3877     if test -n "$regvalue"; then
3878         PathFormat "$regvalue"
3879         UCRTSDKDIR=$formatted_path_unix
3880         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3881         UCRTVERSION=$regvalue
3882         # Rest if not exist
3883         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3884           UCRTSDKDIR=
3885         fi
3886     fi
3887     if test -z "$UCRTSDKDIR"; then
3888         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3889         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3890         if test -f "$ide_env_file"; then
3891             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3892             UCRTSDKDIR=$formatted_path
3893             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3894             dnl Hack needed at least by tml:
3895             if test "$UCRTVERSION" = 10.0.15063.0 \
3896                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3897                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3898             then
3899                 UCRTVERSION=10.0.14393.0
3900             fi
3901         else
3902           AC_MSG_ERROR([No UCRT found])
3903         fi
3904     fi
3907 find_msvc()
3909     # Find Visual C++ 2019
3910     # Args: $1 (optional) : The VS version year
3911     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3913     unset vctest vcnum vcnumwithdot vcbuildnumber
3915     vs_versions_to_check "$1"
3916     if test "$build_os" = wsl; then
3917         vswhere="$PROGRAMFILESX86"
3918     else
3919         vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3920     fi
3921     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3922     PathFormat "$vswhere"
3923     vswhere=$formatted_path_unix
3924     for ver in $vsversions; do
3925         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3926         # Fall back to all MS products (this includes VC++ Build Tools)
3927         if ! test -n "$vswhereoutput"; then
3928             AC_MSG_CHECKING([VC++ Build Tools and similar])
3929             vswhereoutput=`$vswhere -products \* -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3930         fi
3931         if test -n "$vswhereoutput"; then
3932             PathFormat "$vswhereoutput"
3933             vctest=$formatted_path_unix
3934             break
3935         fi
3936     done
3938     if test -n "$vctest"; then
3939         vcnumwithdot="$ver.0"
3940         case "$vcnumwithdot" in
3941         16.0)
3942             vcyear=2019
3943             vcnum=160
3944             ;;
3945         esac
3946         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3948     fi
3951 test_cl_exe()
3953     AC_MSG_CHECKING([$1 compiler])
3955     CL_EXE_PATH="$2/cl.exe"
3957     if test ! -f "$CL_EXE_PATH"; then
3958         if test "$1" = "multi-arch"; then
3959             AC_MSG_WARN([no compiler (cl.exe) in $2])
3960             return 1
3961         else
3962             AC_MSG_ERROR([no compiler (cl.exe) in $2])
3963         fi
3964     fi
3966     dnl ===========================================================
3967     dnl  Check for the corresponding mspdb*.dll
3968     dnl ===========================================================
3970     # MSVC 15.0 has libraries from 14.0?
3971     mspdbnum="140"
3973     if test ! -e "$2/mspdb${mspdbnum}.dll"; then
3974         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $2, Visual Studio installation broken?])
3975     fi
3977     # The compiles has to find its shared libraries
3978     OLD_PATH="$PATH"
3979     TEMP_PATH=`cygpath -d "$2"`
3980     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3982     if ! "$CL_EXE_PATH" -? </dev/null >/dev/null 2>&1; then
3983         AC_MSG_ERROR([no compiler (cl.exe) in $2])
3984     fi
3986     PATH="$OLD_PATH"
3988     AC_MSG_RESULT([$CL_EXE_PATH])
3991 SOLARINC=
3992 MSBUILD_PATH=
3993 DEVENV=
3994 if test "$_os" = "WINNT"; then
3995     AC_MSG_CHECKING([Visual C++])
3996     find_msvc "$with_visual_studio"
3997     if test -z "$vctest"; then
3998         if test -n "$with_visual_studio"; then
3999             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
4000         else
4001             AC_MSG_ERROR([no Visual Studio 2019 installation found])
4002         fi
4003     fi
4004     AC_MSG_RESULT([])
4006     VC_PRODUCT_DIR="$vctest/VC"
4007     COMPATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber"
4009     # $WIN_OTHER_ARCH is a hack to test the x64 compiler on x86, even if it's not multi-arch
4010     if test -n "$WIN_MULTI_ARCH" -o -n "$WIN_OTHER_ARCH"; then
4011         MSVC_MULTI_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/${WIN_MULTI_ARCH}${WIN_OTHER_ARCH}"
4012         test_cl_exe "multi-arch" "$MSVC_MULTI_PATH"
4013         if test $? -ne 0; then
4014             WIN_MULTI_ARCH=""
4015             WIN_OTHER_ARCH=""
4016         fi
4017     fi
4019     if test "$WIN_BUILD_ARCH" = "$WIN_HOST_ARCH"; then
4020         MSVC_BUILD_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_BUILD_ARCH"
4021         test_cl_exe "build" "$MSVC_BUILD_PATH"
4022     fi
4024     if test "$WIN_BUILD_ARCH" != "$WIN_HOST_ARCH"; then
4025         MSVC_HOST_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_HOST_ARCH"
4026         test_cl_exe "host" "$MSVC_HOST_PATH"
4027     else
4028         MSVC_HOST_PATH="$MSVC_BUILD_PATH"
4029     fi
4031     AC_MSG_CHECKING([for short pathname of VC product directory])
4032     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
4033     AC_MSG_RESULT([$VC_PRODUCT_DIR])
4035     UCRTSDKDIR=
4036     UCRTVERSION=
4038     AC_MSG_CHECKING([for UCRT location])
4039     find_ucrt
4040     # find_ucrt errors out if it doesn't find it
4041     AC_MSG_RESULT([$UCRTSDKDIR ($UCRTVERSION)])
4042     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
4043     ucrtincpath_formatted=$formatted_path
4044     # SOLARINC is used for external modules and must be set too.
4045     # And no, it's not sufficient to set SOLARINC only, as configure
4046     # itself doesn't honour it.
4047     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
4048     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
4049     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
4050     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
4052     AC_SUBST(UCRTSDKDIR)
4053     AC_SUBST(UCRTVERSION)
4055     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
4056     # Find the proper version of MSBuild.exe to use based on the VS version
4057     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
4058     if test -n "$regvalue" ; then
4059         AC_MSG_RESULT([found: $regvalue])
4060         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
4061     else
4062         if test "$vcnumwithdot" = "16.0"; then
4063             if test "$WIN_BUILD_ARCH" != "x64"; then
4064                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
4065             else
4066                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
4067             fi
4068         else
4069             if test "$WIN_BUILD_ARCH" != "x64"; then
4070                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
4071             else
4072                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
4073             fi
4074         fi
4075         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
4076         AC_MSG_RESULT([$regvalue])
4077     fi
4079     # Find the version of devenv.exe
4080     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
4081     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
4082     DEVENV_unix=$(cygpath -u "$DEVENV")
4083     if test ! -e "$DEVENV_unix"; then
4084         AC_MSG_WARN([No devenv.exe found - this is expected for VC++ Build Tools])
4085     fi
4087     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
4088     dnl needed when building CLR code:
4089     if test -z "$MSVC_CXX"; then
4090         # This gives us a posix path with 8.3 filename restrictions
4091         MSVC_CXX=`win_short_path_for_make "$MSVC_HOST_PATH/cl.exe"`
4092     fi
4094     if test -z "$CC"; then
4095         CC=$MSVC_CXX
4096         CC_BASE=`first_arg_basename "$CC"`
4097     fi
4098     if test -z "$CXX"; then
4099         CXX=$MSVC_CXX
4100         CXX_BASE=`first_arg_basename "$CXX"`
4101     fi
4103     if test -n "$CC"; then
4104         # Remove /cl.exe from CC case insensitive
4105         AC_MSG_NOTICE([found Visual C++ $vcyear])
4107         main_include_dir=`cygpath -d -m "$COMPATH/Include"`
4108         CPPFLAGS="$CPPFLAGS -I$main_include_dir"
4110         PathFormat "$COMPATH"
4111         COMPATH=`win_short_path_for_make "$formatted_path"`
4113         VCVER=$vcnum
4115         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
4116         # are always "better", we list them in reverse chronological order.
4118         case "$vcnum" in
4119         160)
4120             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
4121             ;;
4122         esac
4124         # The expectation is that --with-windows-sdk should not need to be used
4125         if test -n "$with_windows_sdk"; then
4126             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
4127             *" "$with_windows_sdk" "*)
4128                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
4129                 ;;
4130             *)
4131                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $vcyear])
4132                 ;;
4133             esac
4134         fi
4136         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
4137         ac_objext=obj
4138         ac_exeext=exe
4140     else
4141         AC_MSG_ERROR([Visual C++ not found after all, huh])
4142     fi
4144     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.5])
4145     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4146         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
4147         // between Visual Studio versions and _MSC_VER:
4148         #if _MSC_VER < 1925
4149         #error
4150         #endif
4151     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
4153     # Check for 64-bit (cross-)compiler to use to build the 64-bit
4154     # version of the Explorer extension (and maybe other small
4155     # bits, too) needed when installing a 32-bit LibreOffice on a
4156     # 64-bit OS. The 64-bit Explorer extension is a feature that
4157     # has been present since long in OOo. Don't confuse it with
4158     # building LibreOffice itself as 64-bit code.
4160     BUILD_X64=
4161     CXX_X64_BINARY=
4163     if test "$WIN_HOST_ARCH" = "x86" -a -n "$WIN_OTHER_ARCH"; then
4164         AC_MSG_CHECKING([for the libraries to build the 64-bit Explorer extensions])
4165         if test -f "$COMPATH/atlmfc/lib/x64/atls.lib" -o \
4166              -f "$COMPATH/atlmfc/lib/spectre/x64/atls.lib"
4167         then
4168             BUILD_X64=TRUE
4169             CXX_X64_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4170             AC_MSG_RESULT([found])
4171         else
4172             AC_MSG_RESULT([not found])
4173             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
4174         fi
4175     elif test "$WIN_HOST_ARCH" = "x64"; then
4176         CXX_X64_BINARY=$CXX
4177     fi
4178     AC_SUBST(BUILD_X64)
4180     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
4181     AC_SUBST(CXX_X64_BINARY)
4183     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
4184     # needed to support TWAIN scan on both 32- and 64-bit systems
4186     case "$WIN_HOST_ARCH" in
4187     x64)
4188         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
4189         if test -n "$CXX_X86_BINARY"; then
4190             BUILD_X86=TRUE
4191             AC_MSG_RESULT([preset])
4192         elif test -n "$WIN_MULTI_ARCH"; then
4193             BUILD_X86=TRUE
4194             CXX_X86_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4195             CXX_X86_BINARY+=" /arch:SSE"
4196             AC_MSG_RESULT([found])
4197         else
4198             AC_MSG_RESULT([not found])
4199             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
4200         fi
4201         ;;
4202     x86)
4203         BUILD_X86=TRUE
4204         CXX_X86_BINARY=$MSVC_CXX
4205         ;;
4206     esac
4207     AC_SUBST(BUILD_X86)
4208     AC_SUBST(CXX_X86_BINARY)
4210 AC_SUBST(VCVER)
4211 AC_SUBST(DEVENV)
4212 AC_SUBST(MSVC_CXX)
4214 COM_IS_CLANG=
4215 AC_MSG_CHECKING([whether the compiler is actually Clang])
4216 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4217     #ifndef __clang__
4218     you lose
4219     #endif
4220     int foo=42;
4221     ]])],
4222     [AC_MSG_RESULT([yes])
4223      COM_IS_CLANG=TRUE],
4224     [AC_MSG_RESULT([no])])
4225 AC_SUBST(COM_IS_CLANG)
4227 CC_PLAIN=$CC
4228 CLANGVER=
4229 if test "$COM_IS_CLANG" = TRUE; then
4230     AC_MSG_CHECKING([whether Clang is new enough])
4231     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4232         #if !defined __apple_build_version__
4233         #error
4234         #endif
4235         ]])],
4236         [my_apple_clang=yes],[my_apple_clang=])
4237     if test "$my_apple_clang" = yes; then
4238         AC_MSG_RESULT([assumed yes (Apple Clang)])
4239     elif test "$_os" = Emscripten; then
4240         AC_MSG_RESULT([assumed yes (Emscripten Clang)])
4241     else
4242         if test "$_os" = WINNT; then
4243             dnl In which case, assume clang-cl:
4244             my_args="/EP /TC"
4245             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
4246             dnl clang-cl:
4247             CC_PLAIN=
4248             for i in $CC; do
4249                 case $i in
4250                 -FIIntrin.h)
4251                     ;;
4252                 *)
4253                     CC_PLAIN="$CC_PLAIN $i"
4254                     ;;
4255                 esac
4256             done
4257         else
4258             my_args="-E -P"
4259         fi
4260         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
4261         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
4262         CLANGVER=`echo $clang_version \
4263             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
4264         if test "$CLANGVER" -ge 50002; then
4265             AC_MSG_RESULT([yes ($clang_version)])
4266         else
4267             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
4268         fi
4269         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
4270         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
4271     fi
4274 SHOWINCLUDES_PREFIX=
4275 if test "$_os" = WINNT; then
4276     dnl We need to guess the prefix of the -showIncludes output, it can be
4277     dnl localized
4278     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
4279     echo "#include <stdlib.h>" > conftest.c
4280     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
4281         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
4282     rm -f conftest.c conftest.obj
4283     if test -z "$SHOWINCLUDES_PREFIX"; then
4284         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
4285     else
4286         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
4287     fi
4289 AC_SUBST(SHOWINCLUDES_PREFIX)
4292 # prefix C with ccache if needed
4294 UNCACHED_CC="$CC"
4295 if test "$CCACHE" != ""; then
4296     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
4298     AC_LANG_PUSH([C])
4299     save_CFLAGS=$CFLAGS
4300     CFLAGS="$CFLAGS --ccache-skip -O2"
4301     dnl an empty program will do, we're checking the compiler flags
4302     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
4303                       [use_ccache=yes], [use_ccache=no])
4304     CFLAGS=$save_CFLAGS
4305     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
4306         AC_MSG_RESULT([yes])
4307     else
4308         CC="$CCACHE $CC"
4309         CC_BASE="ccache $CC_BASE"
4310         AC_MSG_RESULT([no])
4311     fi
4312     AC_LANG_POP([C])
4315 # ===================================================================
4316 # check various GCC options that Clang does not support now but maybe
4317 # will somewhen in the future, check them even for GCC, so that the
4318 # flags are set
4319 # ===================================================================
4321 HAVE_GCC_GGDB2=
4322 if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4323     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
4324     save_CFLAGS=$CFLAGS
4325     CFLAGS="$CFLAGS -Werror -ggdb2"
4326     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
4327     CFLAGS=$save_CFLAGS
4328     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
4329         AC_MSG_RESULT([yes])
4330     else
4331         AC_MSG_RESULT([no])
4332     fi
4334     if test "$host_cpu" = "m68k"; then
4335         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
4336         save_CFLAGS=$CFLAGS
4337         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
4338         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
4339         CFLAGS=$save_CFLAGS
4340         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
4341             AC_MSG_RESULT([yes])
4342         else
4343             AC_MSG_ERROR([no])
4344         fi
4345     fi
4347 AC_SUBST(HAVE_GCC_GGDB2)
4349 dnl ===================================================================
4350 dnl  Test the gcc version
4351 dnl ===================================================================
4352 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
4353     AC_MSG_CHECKING([the GCC version])
4354     _gcc_version=`$CC -dumpversion`
4355     gcc_full_version=$(printf '%s' "$_gcc_version" | \
4356         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
4357     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
4359     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
4361     if test "$gcc_full_version" -lt 70000; then
4362         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
4363     fi
4364 else
4365     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
4366     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
4367     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
4368     # (which reports itself as GCC 4.2.1).
4369     GCC_VERSION=
4371 AC_SUBST(GCC_VERSION)
4373 dnl Set the ENABLE_DBGUTIL variable
4374 dnl ===================================================================
4375 AC_MSG_CHECKING([whether to build with additional debug utilities])
4376 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
4377     ENABLE_DBGUTIL="TRUE"
4378     # this is an extra var so it can have different default on different MSVC
4379     # versions (in case there are version specific problems with it)
4380     MSVC_USE_DEBUG_RUNTIME="TRUE"
4382     AC_MSG_RESULT([yes])
4383     # cppunit and graphite expose STL in public headers
4384     if test "$with_system_cppunit" = "yes"; then
4385         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
4386     else
4387         with_system_cppunit=no
4388     fi
4389     if test "$with_system_graphite" = "yes"; then
4390         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
4391     else
4392         with_system_graphite=no
4393     fi
4394     if test "$with_system_orcus" = "yes"; then
4395         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
4396     else
4397         with_system_orcus=no
4398     fi
4399     if test "$with_system_libcmis" = "yes"; then
4400         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
4401     else
4402         with_system_libcmis=no
4403     fi
4404     if test "$with_system_hunspell" = "yes"; then
4405         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
4406     else
4407         with_system_hunspell=no
4408     fi
4409     if test "$with_system_gpgmepp" = "yes"; then
4410         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
4411     else
4412         with_system_gpgmepp=no
4413     fi
4414     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
4415     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
4416     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
4417     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
4418     # of those two is using the system variant:
4419     if test "$with_system_libnumbertext" = "yes"; then
4420         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
4421     else
4422         with_system_libnumbertext=no
4423     fi
4424     if test "$with_system_libwps" = "yes"; then
4425         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
4426     else
4427         with_system_libwps=no
4428     fi
4429 else
4430     ENABLE_DBGUTIL=""
4431     MSVC_USE_DEBUG_RUNTIME=""
4432     AC_MSG_RESULT([no])
4434 AC_SUBST(ENABLE_DBGUTIL)
4435 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
4437 dnl Set the ENABLE_DEBUG variable.
4438 dnl ===================================================================
4439 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
4440     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
4442 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
4443     if test -z "$libo_fuzzed_enable_debug"; then
4444         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
4445     else
4446         AC_MSG_NOTICE([Resetting --enable-debug=yes])
4447         enable_debug=yes
4448     fi
4451 AC_MSG_CHECKING([whether to do a debug build])
4452 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
4453     ENABLE_DEBUG="TRUE"
4454     if test -n "$ENABLE_DBGUTIL" ; then
4455         AC_MSG_RESULT([yes (dbgutil)])
4456     else
4457         AC_MSG_RESULT([yes])
4458     fi
4459 else
4460     ENABLE_DEBUG=""
4461     AC_MSG_RESULT([no])
4463 AC_SUBST(ENABLE_DEBUG)
4465 dnl ===================================================================
4466 dnl Select the linker to use (gold/lld/ld.bfd).
4467 dnl This is done only after compiler checks (need to know if Clang is
4468 dnl used, for different defaults) and after checking if a debug build
4469 dnl is wanted (non-debug builds get the default linker if not explicitly
4470 dnl specified otherwise).
4471 dnl All checks for linker features/options should come after this.
4472 dnl ===================================================================
4473 check_use_ld()
4475     use_ld=-fuse-ld=${1%%:*}
4476     use_ld_path=${1#*:}
4477     if test "$use_ld_path" != "$1"; then
4478         use_ld="$use_ld --ld-path=$use_ld_path"
4479     fi
4480     use_ld_fail_if_error=$2
4481     use_ld_ok=
4482     AC_MSG_CHECKING([for $use_ld linker support])
4483     use_ld_ldflags_save="$LDFLAGS"
4484     LDFLAGS="$LDFLAGS $use_ld"
4485     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4486 #include <stdio.h>
4487         ],[
4488 printf ("hello world\n");
4489         ])], USE_LD=$use_ld, [])
4490     if test -n "$USE_LD"; then
4491         AC_MSG_RESULT( yes )
4492         use_ld_ok=yes
4493     else
4494         if test -n "$use_ld_fail_if_error"; then
4495             AC_MSG_ERROR( no )
4496         else
4497             AC_MSG_RESULT( no )
4498         fi
4499     fi
4500     if test -n "$use_ld_ok"; then
4501         dnl keep the value of LDFLAGS
4502         return 0
4503     fi
4504     LDFLAGS="$use_ld_ldflags_save"
4505     return 1
4507 USE_LD=
4508 if test "$enable_ld" != "no"; then
4509     if test "$GCC" = "yes"; then
4510         if test -n "$enable_ld"; then
4511             check_use_ld "$enable_ld" fail_if_error
4512         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4513             dnl non-debug builds default to the default linker
4514             true
4515         elif test -n "$COM_IS_CLANG"; then
4516             check_use_ld lld
4517             if test $? -ne 0; then
4518                 check_use_ld gold
4519             fi
4520         else
4521             # For gcc first try gold, new versions also support lld.
4522             check_use_ld gold
4523             if test $? -ne 0; then
4524                 check_use_ld lld
4525             fi
4526         fi
4527         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4528         rm conftest.out
4529         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4530         if test -z "$ld_used"; then
4531             ld_used="unknown"
4532         fi
4533         AC_MSG_CHECKING([for linker that is used])
4534         AC_MSG_RESULT([$ld_used])
4535         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4536             if echo "$ld_used" | grep -q "^GNU ld"; then
4537                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4538                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4539             fi
4540         fi
4541     else
4542         if test "$enable_ld" = "yes"; then
4543             AC_MSG_ERROR([--enable-ld not supported])
4544         fi
4545     fi
4547 AC_SUBST(USE_LD)
4549 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4550 if test "$GCC" = "yes" -a "$_os" != Emscripten ; then
4551     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4552     bsymbolic_functions_ldflags_save=$LDFLAGS
4553     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4554     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4555 #include <stdio.h>
4556         ],[
4557 printf ("hello world\n");
4558         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4559     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4560         AC_MSG_RESULT( found )
4561     else
4562         AC_MSG_RESULT( not found )
4563     fi
4564     LDFLAGS=$bsymbolic_functions_ldflags_save
4566 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4568 LD_GC_SECTIONS=
4569 if test "$GCC" = "yes"; then
4570     for flag in "--gc-sections" "-dead_strip"; do
4571         AC_MSG_CHECKING([for $flag linker support])
4572         ldflags_save=$LDFLAGS
4573         LDFLAGS="$LDFLAGS -Wl,$flag"
4574         AC_LINK_IFELSE([AC_LANG_PROGRAM([
4575 #include <stdio.h>
4576             ],[
4577 printf ("hello world\n");
4578             ])],[
4579             LD_GC_SECTIONS="-Wl,$flag"
4580             AC_MSG_RESULT( found )
4581             ], [
4582             AC_MSG_RESULT( not found )
4583             ])
4584         LDFLAGS=$ldflags_save
4585         if test -n "$LD_GC_SECTIONS"; then
4586             break
4587         fi
4588     done
4590 AC_SUBST(LD_GC_SECTIONS)
4592 HAVE_GSPLIT_DWARF=
4593 if test "$enable_split_debug" != no; then
4594     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4595     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4596         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4597         save_CFLAGS=$CFLAGS
4598         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4599         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4600         CFLAGS=$save_CFLAGS
4601         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4602             AC_MSG_RESULT([yes])
4603         else
4604             if test "$enable_split_debug" = yes; then
4605                 AC_MSG_ERROR([no])
4606             else
4607                 AC_MSG_RESULT([no])
4608             fi
4609         fi
4610     fi
4611     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4612         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4613         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4614     fi
4616 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4618 HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=
4619 AC_MSG_CHECKING([whether $CC_BASE supports -Xclang -debug-info-kind=constructor])
4620 save_CFLAGS=$CFLAGS
4621 CFLAGS="$CFLAGS -Werror -Xclang -debug-info-kind=constructor"
4622 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=TRUE ],[])
4623 CFLAGS=$save_CFLAGS
4624 if test "$HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR" = "TRUE"; then
4625     AC_MSG_RESULT([yes])
4626 else
4627     AC_MSG_RESULT([no])
4629 AC_SUBST(HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR)
4631 ENABLE_GDB_INDEX=
4632 if test "$enable_gdb_index" != "no"; then
4633     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4634     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4635         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4636         save_CFLAGS=$CFLAGS
4637         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4638         have_ggnu_pubnames=
4639         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4640         if test "$have_ggnu_pubnames" != "TRUE"; then
4641             if test "$enable_gdb_index" = "yes"; then
4642                 AC_MSG_ERROR([no, --enable-gdb-index not supported])
4643             else
4644                 AC_MSG_RESULT( no )
4645             fi
4646         else
4647             AC_MSG_RESULT( yes )
4648             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4649             ldflags_save=$LDFLAGS
4650             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4651             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4652 #include <stdio.h>
4653                 ],[
4654 printf ("hello world\n");
4655                 ])], ENABLE_GDB_INDEX=TRUE, [])
4656             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4657                 AC_MSG_RESULT( yes )
4658             else
4659                 if test "$enable_gdb_index" = "yes"; then
4660                     AC_MSG_ERROR( no )
4661                 else
4662                     AC_MSG_RESULT( no )
4663                 fi
4664             fi
4665             LDFLAGS=$ldflags_save
4666         fi
4667         CFLAGS=$save_CFLAGS
4668         fi
4669     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4670         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4671         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4672     fi
4674 AC_SUBST(ENABLE_GDB_INDEX)
4676 if test -z "$enable_sal_log" && test "$ENABLE_DEBUG" = TRUE; then
4677     enable_sal_log=yes
4679 if test "$enable_sal_log" = yes; then
4680     ENABLE_SAL_LOG=TRUE
4682 AC_SUBST(ENABLE_SAL_LOG)
4684 dnl Check for enable symbols option
4685 dnl ===================================================================
4686 AC_MSG_CHECKING([whether to generate debug information])
4687 if test -z "$enable_symbols"; then
4688     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4689         enable_symbols=yes
4690     else
4691         enable_symbols=no
4692     fi
4694 if test "$enable_symbols" = yes; then
4695     ENABLE_SYMBOLS_FOR=all
4696     AC_MSG_RESULT([yes])
4697 elif test "$enable_symbols" = no; then
4698     ENABLE_SYMBOLS_FOR=
4699     AC_MSG_RESULT([no])
4700 else
4701     # Selective debuginfo.
4702     ENABLE_SYMBOLS_FOR="$enable_symbols"
4703     AC_MSG_RESULT([for "$enable_symbols"])
4705 AC_SUBST(ENABLE_SYMBOLS_FOR)
4707 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4708     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4709     AC_MSG_CHECKING([whether enough memory is available for linking])
4710     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4711     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4712     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4713         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4714     else
4715         AC_MSG_RESULT([yes])
4716     fi
4719 ENABLE_OPTIMIZED=
4720 ENABLE_OPTIMIZED_DEBUG=
4721 AC_MSG_CHECKING([whether to compile with optimization flags])
4722 if test -z "$enable_optimized"; then
4723     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4724         enable_optimized=no
4725     else
4726         enable_optimized=yes
4727     fi
4729 if test "$enable_optimized" = yes; then
4730     ENABLE_OPTIMIZED=TRUE
4731     AC_MSG_RESULT([yes])
4732 elif test "$enable_optimized" = debug; then
4733     ENABLE_OPTIMIZED_DEBUG=TRUE
4734     AC_MSG_RESULT([yes (debug)])
4735     HAVE_GCC_OG=
4736     if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4737         AC_MSG_CHECKING([whether $CC_BASE supports -Og])
4738         save_CFLAGS=$CFLAGS
4739         CFLAGS="$CFLAGS -Werror -Og"
4740         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[])
4741         CFLAGS=$save_CFLAGS
4742         if test "$HAVE_GCC_OG" = "TRUE"; then
4743             AC_MSG_RESULT([yes])
4744         else
4745             AC_MSG_RESULT([no])
4746         fi
4747     fi
4748     if test -z "$HAVE_GCC_OG" -a "$_os" != "Emscripten"; then
4749         AC_MSG_ERROR([The compiler does not support optimizations suitable for debugging.])
4750     fi
4751 else
4752     AC_MSG_RESULT([no])
4754 AC_SUBST(ENABLE_OPTIMIZED)
4755 AC_SUBST(ENABLE_OPTIMIZED_DEBUG)
4758 # determine CPUNAME, OS, ...
4760 case "$host_os" in
4762 aix*)
4763     COM=GCC
4764     CPUNAME=POWERPC
4765     OS=AIX
4766     RTL_OS=AIX
4767     RTL_ARCH=PowerPC
4768     PLATFORMID=aix_powerpc
4769     P_SEP=:
4770     ;;
4772 cygwin*|wsl*)
4773     # Already handled
4774     ;;
4776 darwin*|macos*)
4777     COM=GCC
4778     OS=MACOSX
4779     RTL_OS=MacOSX
4780     P_SEP=:
4782     case "$host_cpu" in
4783     aarch64|arm64)
4784         if test "$enable_ios_simulator" = "yes"; then
4785             OS=iOS
4786         else
4787             CPUNAME=AARCH64
4788             RTL_ARCH=AARCH64
4789             PLATFORMID=macosx_aarch64
4790         fi
4791         ;;
4792     x86_64)
4793         if test "$enable_ios_simulator" = "yes"; then
4794             OS=iOS
4795         fi
4796         CPUNAME=X86_64
4797         RTL_ARCH=X86_64
4798         PLATFORMID=macosx_x86_64
4799         ;;
4800     *)
4801         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4802         ;;
4803     esac
4804     ;;
4806 ios*)
4807     COM=GCC
4808     OS=iOS
4809     RTL_OS=iOS
4810     P_SEP=:
4812     case "$host_cpu" in
4813     aarch64|arm64)
4814         if test "$enable_ios_simulator" = "yes"; then
4815             AC_MSG_ERROR([iOS simulator is only available in macOS not iOS])
4816         fi
4817         ;;
4818     *)
4819         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4820         ;;
4821     esac
4822     CPUNAME=AARCH64
4823     RTL_ARCH=AARCH64
4824     PLATFORMID=ios_arm64
4825     ;;
4827 dragonfly*)
4828     COM=GCC
4829     OS=DRAGONFLY
4830     RTL_OS=DragonFly
4831     P_SEP=:
4833     case "$host_cpu" in
4834     i*86)
4835         CPUNAME=INTEL
4836         RTL_ARCH=x86
4837         PLATFORMID=dragonfly_x86
4838         ;;
4839     x86_64)
4840         CPUNAME=X86_64
4841         RTL_ARCH=X86_64
4842         PLATFORMID=dragonfly_x86_64
4843         ;;
4844     *)
4845         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4846         ;;
4847     esac
4848     ;;
4850 freebsd*)
4851     COM=GCC
4852     RTL_OS=FreeBSD
4853     OS=FREEBSD
4854     P_SEP=:
4856     case "$host_cpu" in
4857     aarch64)
4858         CPUNAME=AARCH64
4859         PLATFORMID=freebsd_aarch64
4860         RTL_ARCH=AARCH64
4861         ;;
4862     i*86)
4863         CPUNAME=INTEL
4864         RTL_ARCH=x86
4865         PLATFORMID=freebsd_x86
4866         ;;
4867     x86_64|amd64)
4868         CPUNAME=X86_64
4869         RTL_ARCH=X86_64
4870         PLATFORMID=freebsd_x86_64
4871         ;;
4872     powerpc64)
4873         CPUNAME=POWERPC64
4874         RTL_ARCH=PowerPC_64
4875         PLATFORMID=freebsd_powerpc64
4876         ;;
4877     powerpc|powerpcspe)
4878         CPUNAME=POWERPC
4879         RTL_ARCH=PowerPC
4880         PLATFORMID=freebsd_powerpc
4881         ;;
4882     *)
4883         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4884         ;;
4885     esac
4886     ;;
4888 haiku*)
4889     COM=GCC
4890     GUIBASE=haiku
4891     RTL_OS=Haiku
4892     OS=HAIKU
4893     P_SEP=:
4895     case "$host_cpu" in
4896     i*86)
4897         CPUNAME=INTEL
4898         RTL_ARCH=x86
4899         PLATFORMID=haiku_x86
4900         ;;
4901     x86_64|amd64)
4902         CPUNAME=X86_64
4903         RTL_ARCH=X86_64
4904         PLATFORMID=haiku_x86_64
4905         ;;
4906     *)
4907         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4908         ;;
4909     esac
4910     ;;
4912 kfreebsd*)
4913     COM=GCC
4914     OS=LINUX
4915     RTL_OS=kFreeBSD
4916     P_SEP=:
4918     case "$host_cpu" in
4920     i*86)
4921         CPUNAME=INTEL
4922         RTL_ARCH=x86
4923         PLATFORMID=kfreebsd_x86
4924         ;;
4925     x86_64)
4926         CPUNAME=X86_64
4927         RTL_ARCH=X86_64
4928         PLATFORMID=kfreebsd_x86_64
4929         ;;
4930     *)
4931         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4932         ;;
4933     esac
4934     ;;
4936 linux-gnu*)
4937     COM=GCC
4938     OS=LINUX
4939     RTL_OS=Linux
4940     P_SEP=:
4942     case "$host_cpu" in
4944     aarch64)
4945         CPUNAME=AARCH64
4946         PLATFORMID=linux_aarch64
4947         RTL_ARCH=AARCH64
4948         EPM_FLAGS="-a arm64"
4949         ;;
4950     alpha)
4951         CPUNAME=AXP
4952         RTL_ARCH=ALPHA
4953         PLATFORMID=linux_alpha
4954         ;;
4955     arm*)
4956         CPUNAME=ARM
4957         EPM_FLAGS="-a arm"
4958         RTL_ARCH=ARM_EABI
4959         PLATFORMID=linux_arm_eabi
4960         case "$host_cpu" in
4961         arm*-linux)
4962             RTL_ARCH=ARM_OABI
4963             PLATFORMID=linux_arm_oabi
4964             ;;
4965         esac
4966         ;;
4967     hppa)
4968         CPUNAME=HPPA
4969         RTL_ARCH=HPPA
4970         EPM_FLAGS="-a hppa"
4971         PLATFORMID=linux_hppa
4972         ;;
4973     i*86)
4974         CPUNAME=INTEL
4975         RTL_ARCH=x86
4976         PLATFORMID=linux_x86
4977         ;;
4978     ia64)
4979         CPUNAME=IA64
4980         RTL_ARCH=IA64
4981         PLATFORMID=linux_ia64
4982         ;;
4983     mips)
4984         CPUNAME=GODSON
4985         RTL_ARCH=MIPS_EB
4986         EPM_FLAGS="-a mips"
4987         PLATFORMID=linux_mips_eb
4988         ;;
4989     mips64)
4990         CPUNAME=GODSON64
4991         RTL_ARCH=MIPS64_EB
4992         EPM_FLAGS="-a mips64"
4993         PLATFORMID=linux_mips64_eb
4994         ;;
4995     mips64el)
4996         CPUNAME=GODSON64
4997         RTL_ARCH=MIPS64_EL
4998         EPM_FLAGS="-a mips64el"
4999         PLATFORMID=linux_mips64_el
5000         ;;
5001     mipsel)
5002         CPUNAME=GODSON
5003         RTL_ARCH=MIPS_EL
5004         EPM_FLAGS="-a mipsel"
5005         PLATFORMID=linux_mips_el
5006         ;;
5007     m68k)
5008         CPUNAME=M68K
5009         RTL_ARCH=M68K
5010         PLATFORMID=linux_m68k
5011         ;;
5012     powerpc)
5013         CPUNAME=POWERPC
5014         RTL_ARCH=PowerPC
5015         PLATFORMID=linux_powerpc
5016         ;;
5017     powerpc64)
5018         CPUNAME=POWERPC64
5019         RTL_ARCH=PowerPC_64
5020         PLATFORMID=linux_powerpc64
5021         ;;
5022     powerpc64le)
5023         CPUNAME=POWERPC64
5024         RTL_ARCH=PowerPC_64_LE
5025         PLATFORMID=linux_powerpc64_le
5026         ;;
5027     sparc)
5028         CPUNAME=SPARC
5029         RTL_ARCH=SPARC
5030         PLATFORMID=linux_sparc
5031         ;;
5032     sparc64)
5033         CPUNAME=SPARC64
5034         RTL_ARCH=SPARC64
5035         PLATFORMID=linux_sparc64
5036         ;;
5037     s390)
5038         CPUNAME=S390
5039         RTL_ARCH=S390
5040         PLATFORMID=linux_s390
5041         ;;
5042     s390x)
5043         CPUNAME=S390X
5044         RTL_ARCH=S390x
5045         PLATFORMID=linux_s390x
5046         ;;
5047     x86_64)
5048         CPUNAME=X86_64
5049         RTL_ARCH=X86_64
5050         PLATFORMID=linux_x86_64
5051         ;;
5052     *)
5053         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5054         ;;
5055     esac
5056     ;;
5058 linux-android*)
5059     COM=GCC
5060     OS=ANDROID
5061     RTL_OS=Android
5062     P_SEP=:
5064     case "$host_cpu" in
5066     arm|armel)
5067         CPUNAME=ARM
5068         RTL_ARCH=ARM_EABI
5069         PLATFORMID=android_arm_eabi
5070         ;;
5071     aarch64)
5072         CPUNAME=AARCH64
5073         RTL_ARCH=AARCH64
5074         PLATFORMID=android_aarch64
5075         ;;
5076     i*86)
5077         CPUNAME=INTEL
5078         RTL_ARCH=x86
5079         PLATFORMID=android_x86
5080         ;;
5081     x86_64)
5082         CPUNAME=X86_64
5083         RTL_ARCH=X86_64
5084         PLATFORMID=android_x86_64
5085         ;;
5086     *)
5087         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5088         ;;
5089     esac
5090     ;;
5092 *netbsd*)
5093     COM=GCC
5094     OS=NETBSD
5095     RTL_OS=NetBSD
5096     P_SEP=:
5098     case "$host_cpu" in
5099     i*86)
5100         CPUNAME=INTEL
5101         RTL_ARCH=x86
5102         PLATFORMID=netbsd_x86
5103         ;;
5104     powerpc)
5105         CPUNAME=POWERPC
5106         RTL_ARCH=PowerPC
5107         PLATFORMID=netbsd_powerpc
5108         ;;
5109     sparc)
5110         CPUNAME=SPARC
5111         RTL_ARCH=SPARC
5112         PLATFORMID=netbsd_sparc
5113         ;;
5114     x86_64)
5115         CPUNAME=X86_64
5116         RTL_ARCH=X86_64
5117         PLATFORMID=netbsd_x86_64
5118         ;;
5119     *)
5120         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5121         ;;
5122     esac
5123     ;;
5125 openbsd*)
5126     COM=GCC
5127     OS=OPENBSD
5128     RTL_OS=OpenBSD
5129     P_SEP=:
5131     case "$host_cpu" in
5132     i*86)
5133         CPUNAME=INTEL
5134         RTL_ARCH=x86
5135         PLATFORMID=openbsd_x86
5136         ;;
5137     x86_64)
5138         CPUNAME=X86_64
5139         RTL_ARCH=X86_64
5140         PLATFORMID=openbsd_x86_64
5141         ;;
5142     *)
5143         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5144         ;;
5145     esac
5146     SOLARINC="$SOLARINC -I/usr/local/include"
5147     ;;
5149 solaris*)
5150     COM=GCC
5151     OS=SOLARIS
5152     RTL_OS=Solaris
5153     P_SEP=:
5155     case "$host_cpu" in
5156     i*86)
5157         CPUNAME=INTEL
5158         RTL_ARCH=x86
5159         PLATFORMID=solaris_x86
5160         ;;
5161     sparc)
5162         CPUNAME=SPARC
5163         RTL_ARCH=SPARC
5164         PLATFORMID=solaris_sparc
5165         ;;
5166     sparc64)
5167         CPUNAME=SPARC64
5168         RTL_ARCH=SPARC64
5169         PLATFORMID=solaris_sparc64
5170         ;;
5171     *)
5172         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5173         ;;
5174     esac
5175     SOLARINC="$SOLARINC -I/usr/local/include"
5176     ;;
5178 emscripten*)
5179     COM=GCC
5180     OS=EMSCRIPTEN
5181     RTL_OS=Emscripten
5182     P_SEP=:
5184     case "$host_cpu" in
5185     wasm32|wasm64)
5186         ;;
5187     *)
5188         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5189         ;;
5190     esac
5191     CPUNAME=INTEL
5192     RTL_ARCH=x86
5193     PLATFORMID=linux_x86
5194     ;;
5197     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
5198     ;;
5199 esac
5201 if test "$with_x" = "no"; then
5202     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
5205 DISABLE_GUI=""
5206 if test "$enable_gui" = "no"; then
5207     if test "$using_x11" != yes; then
5208         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
5209     fi
5210     USING_X11=
5211     DISABLE_GUI=TRUE
5212 else
5213     AC_DEFINE(HAVE_FEATURE_UI)
5215 AC_SUBST(DISABLE_GUI)
5217 if test "$using_x11" = yes; then
5218     if test "$USING_X11" = TRUE; then
5219         AC_DEFINE(USING_X11)
5220     else
5221         disable_x11_tests
5222     fi
5223 else
5224     if test "$USING_X11" = TRUE; then
5225         AC_MSG_ERROR([Platform doesn't support X11 (\$using_x11), but \$USING_X11 is set!])
5226     fi
5229 WORKDIR="${BUILDDIR}/workdir"
5230 INSTDIR="${BUILDDIR}/instdir"
5231 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
5232 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
5233 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
5234 AC_SUBST(COM)
5235 AC_SUBST(CPUNAME)
5236 AC_SUBST(RTL_OS)
5237 AC_SUBST(RTL_ARCH)
5238 AC_SUBST(EPM_FLAGS)
5239 AC_SUBST(USING_X11)
5240 AC_SUBST([INSTDIR])
5241 AC_SUBST([INSTROOT])
5242 AC_SUBST([INSTROOTBASE])
5243 AC_SUBST(OS)
5244 AC_SUBST(P_SEP)
5245 AC_SUBST(WORKDIR)
5246 AC_SUBST(PLATFORMID)
5247 AC_SUBST(WINDOWS_X64)
5248 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
5250 if test "$OS" = WNT -a "$COM" = MSC; then
5251     case "$CPUNAME" in
5252     INTEL) CPPU_ENV=msci ;;
5253     X86_64) CPPU_ENV=mscx ;;
5254     AARCH64) CPPU_ENV=msca ;;
5255     *)
5256         AC_MSG_ERROR([Unknown \$CPUNAME '$CPUNAME' for $OS / $COM"])
5257         ;;
5258     esac
5259 else
5260     CPPU_ENV=gcc3
5262 AC_SUBST(CPPU_ENV)
5264 dnl ===================================================================
5265 dnl Test which package format to use
5266 dnl ===================================================================
5267 AC_MSG_CHECKING([which package format to use])
5268 if test -n "$with_package_format" -a "$with_package_format" != no; then
5269     for i in $with_package_format; do
5270         case "$i" in
5271         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
5272             ;;
5273         *)
5274             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
5275 aix - AIX software distribution
5276 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
5277 deb - Debian software distribution
5278 pkg - Solaris software distribution
5279 rpm - RedHat software distribution
5281 LibreOffice additionally supports:
5282 archive - .tar.gz or .zip
5283 dmg - macOS .dmg
5284 installed - installation tree
5285 msi - Windows .msi
5286         ])
5287             ;;
5288         esac
5289     done
5290     # fakeroot is needed to ensure correct file ownerships/permissions
5291     # inside deb packages and tar archives created on Linux and Solaris.
5292     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
5293         AC_PATH_PROG(FAKEROOT, fakeroot, no)
5294         if test "$FAKEROOT" = "no"; then
5295             AC_MSG_ERROR(
5296                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
5297         fi
5298     fi
5299     PKGFORMAT="$with_package_format"
5300     AC_MSG_RESULT([$PKGFORMAT])
5301 else
5302     PKGFORMAT=
5303     AC_MSG_RESULT([none])
5305 AC_SUBST(PKGFORMAT)
5307 dnl ===================================================================
5308 dnl handle help related options
5310 dnl If you change help related options, please update README.help
5311 dnl ===================================================================
5313 ENABLE_HTMLHELP=
5314 HELP_OMINDEX_PAGE=
5315 HELP_ONLINE=
5316 WITH_HELPPACKS=
5318 AC_MSG_CHECKING([which help to build])
5319 if test -n "$with_help" -a "$with_help" != "no"; then
5320     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5321     BUILD_TYPE="$BUILD_TYPE HELP"
5322     case "$with_help" in
5323     "html")
5324         ENABLE_HTMLHELP=TRUE
5325         WITH_HELPPACKS=TRUE
5326         SCPDEFS="$SCPDEFS -DWITH_HELPPACKS"
5327         AC_MSG_RESULT([HTML (local)])
5328         ;;
5329     "online")
5330         ENABLE_HTMLHELP=TRUE
5331         HELP_ONLINE=TRUE
5332         AC_MSG_RESULT([HTML (online)])
5333         ;;
5334     yes)
5335         WITH_HELPPACKS=TRUE
5336         SCPDEFS="$SCPDEFS -DWITH_HELPPACKS"
5337         AC_MSG_RESULT([XML (local)])
5338         ;;
5339     *)
5340         AC_MSG_ERROR([Unknown --with-help=$with_help])
5341         ;;
5342     esac
5343 else
5344     AC_MSG_RESULT([no])
5347 AC_MSG_CHECKING([if we need to build the help index tooling])
5348 if test "$with_help" = yes -o "$enable_extension_integration" != no; then
5349     BUILD_TYPE="$BUILD_TYPE HELPTOOLS"
5350     AC_MSG_RESULT([yes])
5351 else
5352     AC_MSG_RESULT([no])
5355 AC_MSG_CHECKING([whether to enable xapian-omega support for online help])
5356 if test -n "$with_omindex" -a "$with_omindex" != "no"; then
5357     if test "$HELP_ONLINE" != TRUE; then
5358         AC_MSG_ERROR([Can't build xapian-omega index without --help=online])
5359     fi
5360     case "$with_omindex" in
5361     "server")
5362         HELP_OMINDEX_PAGE=TRUE
5363         AC_MSG_RESULT([SERVER])
5364         ;;
5365     "noxap")
5366         AC_MSG_RESULT([NOXAP])
5367         ;;
5368     *)
5369         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5370         ;;
5371     esac
5372 else
5373     AC_MSG_RESULT([no])
5376 AC_MSG_CHECKING([whether to include the XML-help support])
5377 if test "$enable_xmlhelp" = yes; then
5378     BUILD_TYPE="$BUILD_TYPE XMLHELP"
5379     AC_DEFINE(HAVE_FEATURE_XMLHELP)
5380     AC_MSG_RESULT([yes])
5381 else
5382     if test "$with_help" = yes; then
5383         add_warning "Building the XML help, but LO with disabled xmlhelp support. Generated help can't be accessed from this LO build!"
5384     fi
5385     AC_MSG_RESULT([no])
5388 dnl Test whether to integrate helppacks into the product's installer
5389 AC_MSG_CHECKING([for helppack integration])
5390 if test -z "$WITH_HELPPACKS" -o "$with_helppack_integration" = no; then
5391     AC_MSG_RESULT([no integration])
5392 else
5393     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
5394     AC_MSG_RESULT([integration])
5397 AC_SUBST([ENABLE_HTMLHELP])
5398 AC_SUBST([HELP_OMINDEX_PAGE])
5399 AC_SUBST([HELP_ONLINE])
5400 # WITH_HELPPACKS is used only in configure
5402 dnl ===================================================================
5403 dnl Set up a different compiler to produce tools to run on the build
5404 dnl machine when doing cross-compilation
5405 dnl ===================================================================
5407 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
5408 m4_pattern_allow([PKG_CONFIG_LIBDIR])
5409 if test "$cross_compiling" = "yes"; then
5410     AC_MSG_CHECKING([for BUILD platform configuration])
5411     echo
5412     rm -rf CONF-FOR-BUILD config_build.mk
5413     mkdir CONF-FOR-BUILD
5414     # Here must be listed all files needed when running the configure script. In particular, also
5415     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
5416     # keep them in the same order as there.
5417     (cd $SRC_ROOT && tar cf - \
5418         config.guess \
5419         bin/get_config_variables \
5420         solenv/bin/getcompver.awk \
5421         solenv/inc/langlist.mk \
5422         download.lst \
5423         config_host.mk.in \
5424         config_host_lang.mk.in \
5425         Makefile.in \
5426         bin/bffvalidator.sh.in \
5427         bin/odfvalidator.sh.in \
5428         bin/officeotron.sh.in \
5429         hardened_runtime.xcent.in \
5430         instsetoo_native/util/openoffice.lst.in \
5431         config_host/*.in \
5432         sysui/desktop/macosx/Info.plist.in \
5433         .vscode/vs-code-template.code-workspace.in \
5434         ) \
5435     | (cd CONF-FOR-BUILD && tar xf -)
5436     cp configure CONF-FOR-BUILD
5437     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
5438     (
5439     unset COM USING_X11 OS CPUNAME
5440     unset CC CXX SYSBASE CFLAGS
5441     unset AR LD NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
5442     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
5443     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
5444     unset PKG_CONFIG_LIBDIR PKG_CONFIG_PATH
5445     if test -n "$CC_FOR_BUILD"; then
5446         export CC="$CC_FOR_BUILD"
5447         CC_BASE=`first_arg_basename "$CC"`
5448     fi
5449     if test -n "$CXX_FOR_BUILD"; then
5450         export CXX="$CXX_FOR_BUILD"
5451         CXX_BASE=`first_arg_basename "$CXX"`
5452     fi
5453     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
5454     cd CONF-FOR-BUILD
5456     # Handle host configuration, which affects the cross-toolset too
5457     sub_conf_opts=""
5458     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
5459     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
5460     test "$with_junit" = "no" && sub_conf_opts="$sub_conf_opts --without-junit"
5461     if test -n "$ENABLE_JAVA"; then
5462         case "$_os" in
5463         iOS) sub_conf_opts="$sub_conf_opts --without-java" ;; # force it off, like it used to be
5464         Android)
5465             # Hack for Android - the build doesn't need a host JDK, so just forward to build for convenience
5466             test -n "$with_jdk_home" && sub_conf_opts="$sub_conf_opts --with-jdk-home=$with_jdk_home"
5467             ;;
5468         *)
5469             if test -z "$with_jdk_home"; then
5470                 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.])
5471             fi
5472             ;;
5473         esac
5474     else
5475         sub_conf_opts="$sub_conf_opts --without-java"
5476     fi
5477     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
5478     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
5479     test "$with_galleries" = "no" -o -z "$WITH_GALLERY_BUILD" && sub_conf_opts="$sub_conf_opts --with-galleries=no --disable-database-connectivity"
5480     test -n "$with_help" -a "$with_help" != "no" && sub_conf_opts="$sub_conf_opts --with-help=$with_help"
5481     test "$enable_extensions" = yes || sub_conf_opts="$sub_conf_opts --disable-extensions"
5482     test "$enable_wasm_strip" = "yes" && sub_conf_opts="$sub_conf_opts --enable-wasm-strip"
5483     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
5485     # Don't bother having configure look for stuff not needed for the build platform anyway
5486     ./configure \
5487         --build="$build_alias" \
5488         --disable-cairo-canvas \
5489         --disable-cups \
5490         --disable-firebird-sdbc \
5491         --disable-gpgmepp \
5492         --disable-gstreamer-1-0 \
5493         --disable-gtk3 \
5494         --disable-gtk4 \
5495         --disable-mariadb-sdbc \
5496         --disable-nss \
5497         --disable-online-update \
5498         --disable-opencl \
5499         --disable-pdfimport \
5500         --disable-postgresql-sdbc \
5501         --disable-skia \
5502         --enable-icecream="$enable_icecream" \
5503         --without-doxygen \
5504         --without-webdav \
5505         --with-parallelism="$with_parallelism" \
5506         --with-theme="$with_theme" \
5507         --with-tls=openssl \
5508         $sub_conf_opts \
5509         --srcdir=$srcdir \
5510         2>&1 | sed -e 's/^/    /'
5511     if test [${PIPESTATUS[0]}] -ne 0; then
5512         AC_MSG_ERROR([Running the configure script for BUILD side failed, see CONF-FOR-BUILD/config.log])
5513     fi
5515     # filter permitted build targets
5516     PERMITTED_BUILD_TARGETS="
5517         AVMEDIA
5518         BOOST
5519         CAIRO
5520         CLUCENE
5521         CURL
5522         DBCONNECTIVITY
5523         DESKTOP
5524         DYNLOADING
5525         EPOXY
5526         EXPAT
5527         GLM
5528         GRAPHITE
5529         HARFBUZZ
5530         HELPTOOLS
5531         ICU
5532         LCMS2
5533         LIBJPEG_TURBO
5534         LIBLANGTAG
5535         LibO
5536         LIBFFI
5537         LIBPN
5538         LIBXML2
5539         LIBXSLT
5540         MDDS
5541         NATIVE
5542         OPENSSL
5543         ORCUS
5544         PYTHON
5545         SCRIPTING
5546         ZLIB
5548     # converts BUILD_TYPE and PERMITTED_BUILD_TARGETS into non-whitespace,
5549     # newlined lists, to use grep as a filter
5550     PERMITTED_BUILD_TARGETS=$(echo "$PERMITTED_BUILD_TARGETS" | sed -e '/^ *$/d' -e 's/ *//')
5551     BUILD_TARGETS="$(sed -n -e '/^export BUILD_TYPE=/ s/.*=//p' config_host.mk | tr ' ' '\n')"
5552     BUILD_TARGETS="$(echo "$BUILD_TARGETS" | grep -F "$PERMITTED_BUILD_TARGETS" | tr '\n' ' ')"
5553     sed -i -e "s/ BUILD_TYPE=.*$/ BUILD_TYPE=$BUILD_TARGETS/" config_host.mk
5555     cp config_host.mk ../config_build.mk
5556     cp config_host_lang.mk ../config_build_lang.mk
5557     mv config.log ../config.Build.log
5558     mkdir -p ../config_build
5559     mv config_host/*.h ../config_build
5560     test -f "$WARNINGS_FILE" && mv "$WARNINGS_FILE" "../$WARNINGS_FILE_FOR_BUILD"
5562     # all these will get a _FOR_BUILD postfix
5563     DIRECT_FOR_BUILD_SETTINGS="
5564         CC
5565         CPPU_ENV
5566         CXX
5567         ILIB
5568         JAVA_HOME
5569         JAVAIFLAGS
5570         JDK
5571         LIBO_BIN_FOLDER
5572         LIBO_LIB_FOLDER
5573         LIBO_URE_LIB_FOLDER
5574         LIBO_URE_MISC_FOLDER
5575         OS
5576         SDKDIRNAME
5577         SYSTEM_LIBXML
5578         SYSTEM_LIBXSLT
5580     # these overwrite host config with build config
5581     OVERWRITING_SETTINGS="
5582         ANT
5583         ANT_HOME
5584         ANT_LIB
5585         HSQLDB_USE_JDBC_4_1
5586         JAVA_CLASSPATH_NOT_SET
5587         JAVA_SOURCE_VER
5588         JAVA_TARGET_VER
5589         JAVACFLAGS
5590         JAVACOMPILER
5591         JAVADOC
5592         JAVADOCISGJDOC
5594     # these need some special handling
5595     EXTRA_HANDLED_SETTINGS="
5596         INSTDIR
5597         INSTROOT
5598         PATH
5599         WORKDIR
5601     OLD_PATH=$PATH
5602     . ./bin/get_config_variables $DIRECT_FOR_BUILD_SETTINGS $OVERWRITING_SETTINGS $EXTRA_HANDLED_SETTINGS
5603     BUILD_PATH=$PATH
5604     PATH=$OLD_PATH
5606     line=`echo "LO_PATH_FOR_BUILD='${BUILD_PATH}'" | sed -e 's,/CONF-FOR-BUILD,,g'`
5607     echo "$line" >>build-config
5609     for V in $DIRECT_FOR_BUILD_SETTINGS; do
5610         VV='$'$V
5611         VV=`eval "echo $VV"`
5612         if test -n "$VV"; then
5613             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
5614             echo "$line" >>build-config
5615         fi
5616     done
5618     for V in $OVERWRITING_SETTINGS; do
5619         VV='$'$V
5620         VV=`eval "echo $VV"`
5621         if test -n "$VV"; then
5622             line=${V}='${'${V}:-$VV'}'
5623             echo "$line" >>build-config
5624         fi
5625     done
5627     for V in INSTDIR INSTROOT WORKDIR; do
5628         VV='$'$V
5629         VV=`eval "echo $VV"`
5630         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
5631         if test -n "$VV"; then
5632             line="${V}_FOR_BUILD='$VV'"
5633             echo "$line" >>build-config
5634         fi
5635     done
5637     )
5638     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([setup/configure for BUILD side failed, see CONF-FOR-BUILD/config.log])
5639     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])
5640     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
5641              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
5643     eval `cat CONF-FOR-BUILD/build-config`
5645     AC_MSG_RESULT([checking for BUILD platform configuration... done])
5647     rm -rf CONF-FOR-BUILD
5648 else
5649     OS_FOR_BUILD="$OS"
5650     CC_FOR_BUILD="$CC"
5651     CPPU_ENV_FOR_BUILD="$CPPU_ENV"
5652     CXX_FOR_BUILD="$CXX"
5653     INSTDIR_FOR_BUILD="$INSTDIR"
5654     INSTROOT_FOR_BUILD="$INSTROOT"
5655     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
5656     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
5657     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
5658     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
5659     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
5660     WORKDIR_FOR_BUILD="$WORKDIR"
5662 AC_SUBST(OS_FOR_BUILD)
5663 AC_SUBST(INSTDIR_FOR_BUILD)
5664 AC_SUBST(INSTROOT_FOR_BUILD)
5665 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
5666 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
5667 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
5668 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
5669 AC_SUBST(SDKDIRNAME_FOR_BUILD)
5670 AC_SUBST(WORKDIR_FOR_BUILD)
5671 AC_SUBST(CC_FOR_BUILD)
5672 AC_SUBST(CXX_FOR_BUILD)
5673 AC_SUBST(CPPU_ENV_FOR_BUILD)
5675 dnl ===================================================================
5676 dnl Check for syslog header
5677 dnl ===================================================================
5678 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
5680 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
5681 dnl ===================================================================
5682 AC_MSG_CHECKING([whether to turn warnings to errors])
5683 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
5684     ENABLE_WERROR="TRUE"
5685     PYTHONWARNINGS="error"
5686     AC_MSG_RESULT([yes])
5687 else
5688     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
5689         ENABLE_WERROR="TRUE"
5690         PYTHONWARNINGS="error"
5691         AC_MSG_RESULT([yes])
5692     else
5693         AC_MSG_RESULT([no])
5694     fi
5696 AC_SUBST(ENABLE_WERROR)
5697 AC_SUBST(PYTHONWARNINGS)
5699 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
5700 dnl ===================================================================
5701 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
5702 if test -z "$enable_assert_always_abort"; then
5703    if test "$ENABLE_DEBUG" = TRUE; then
5704        enable_assert_always_abort=yes
5705    else
5706        enable_assert_always_abort=no
5707    fi
5709 if test "$enable_assert_always_abort" = "yes"; then
5710     ASSERT_ALWAYS_ABORT="TRUE"
5711     AC_MSG_RESULT([yes])
5712 else
5713     ASSERT_ALWAYS_ABORT="FALSE"
5714     AC_MSG_RESULT([no])
5716 AC_SUBST(ASSERT_ALWAYS_ABORT)
5718 # Determine whether to use ooenv for the instdir installation
5719 # ===================================================================
5720 if test $_os != "WINNT" -a $_os != "Darwin"; then
5721     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
5722     if test -z "$enable_ooenv"; then
5723         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5724             enable_ooenv=yes
5725         else
5726             enable_ooenv=no
5727         fi
5728     fi
5729     if test "$enable_ooenv" = "no"; then
5730         AC_MSG_RESULT([no])
5731     else
5732         ENABLE_OOENV="TRUE"
5733         AC_MSG_RESULT([yes])
5734     fi
5736 AC_SUBST(ENABLE_OOENV)
5738 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
5739     if test "$enable_qt5" = "no"; then
5740         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
5741     else
5742         enable_qt5=yes
5743     fi
5746 dnl ===================================================================
5747 dnl check for cups support
5748 dnl ===================================================================
5750 AC_MSG_CHECKING([whether to enable CUPS support])
5751 if test "$test_cups" = yes -a "$enable_cups" != no; then
5752     ENABLE_CUPS=TRUE
5753     AC_MSG_RESULT([yes])
5755     AC_MSG_CHECKING([whether cups support is present])
5756     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
5757     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
5758     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
5759         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
5760     fi
5761 else
5762     AC_MSG_RESULT([no])
5765 AC_SUBST(ENABLE_CUPS)
5767 # fontconfig checks
5768 if test "$using_freetype_fontconfig" = yes; then
5769     AC_MSG_CHECKING([which fontconfig to use])
5771 if test "$using_freetype_fontconfig" = yes -a "$test_system_fontconfig" != no; then
5772     AC_MSG_RESULT([external])
5773     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
5774     SYSTEM_FONTCONFIG=TRUE
5775     FilterLibs "${FONTCONFIG_LIBS}"
5776     FONTCONFIG_LIBS="${filteredlibs}"
5777 elif test "$using_freetype_fontconfig" = yes; then
5778     AC_MSG_RESULT([internal])
5779     BUILD_TYPE="$BUILD_TYPE FONTCONFIG"
5781 AC_SUBST(FONTCONFIG_CFLAGS)
5782 AC_SUBST(FONTCONFIG_LIBS)
5783 AC_SUBST([SYSTEM_FONTCONFIG])
5785 dnl whether to find & fetch external tarballs?
5786 dnl ===================================================================
5787 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
5788    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5789        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
5790    else
5791        TARFILE_LOCATION="$LODE_HOME/ext_tar"
5792    fi
5794 if test -z "$TARFILE_LOCATION"; then
5795     if test -d "$SRC_ROOT/src" ; then
5796         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
5797         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
5798     fi
5799     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
5800 else
5801     AbsolutePath "$TARFILE_LOCATION"
5802     PathFormat "${absolute_path}"
5803     TARFILE_LOCATION="${formatted_path}"
5805 AC_SUBST(TARFILE_LOCATION)
5807 AC_MSG_CHECKING([whether we want to fetch tarballs])
5808 if test "$enable_fetch_external" != "no"; then
5809     if test "$with_all_tarballs" = "yes"; then
5810         AC_MSG_RESULT([yes, all of them])
5811         DO_FETCH_TARBALLS="ALL"
5812     else
5813         AC_MSG_RESULT([yes, if we use them])
5814         DO_FETCH_TARBALLS="TRUE"
5815     fi
5816 else
5817     AC_MSG_RESULT([no])
5818     DO_FETCH_TARBALLS=
5820 AC_SUBST(DO_FETCH_TARBALLS)
5822 dnl Test whether to include MySpell dictionaries
5823 dnl ===================================================================
5824 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5825 if test "$with_myspell_dicts" = "yes"; then
5826     AC_MSG_RESULT([yes])
5827     WITH_MYSPELL_DICTS=TRUE
5828     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5829     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5830 else
5831     AC_MSG_RESULT([no])
5832     WITH_MYSPELL_DICTS=
5834 AC_SUBST(WITH_MYSPELL_DICTS)
5836 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5837 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5838     if test "$with_system_dicts" = yes; then
5839         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5840     fi
5841     with_system_dicts=no
5844 AC_MSG_CHECKING([whether to use dicts from external paths])
5845 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5846     AC_MSG_RESULT([yes])
5847     SYSTEM_DICTS=TRUE
5848     AC_MSG_CHECKING([for spelling dictionary directory])
5849     if test -n "$with_external_dict_dir"; then
5850         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5851     else
5852         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5853         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5854             DICT_SYSTEM_DIR=file:///usr/share/myspell
5855         fi
5856     fi
5857     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5858     AC_MSG_CHECKING([for hyphenation patterns directory])
5859     if test -n "$with_external_hyph_dir"; then
5860         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5861     else
5862         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5863     fi
5864     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5865     AC_MSG_CHECKING([for thesaurus directory])
5866     if test -n "$with_external_thes_dir"; then
5867         THES_SYSTEM_DIR=file://$with_external_thes_dir
5868     else
5869         THES_SYSTEM_DIR=file:///usr/share/mythes
5870     fi
5871     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5872 else
5873     AC_MSG_RESULT([no])
5874     SYSTEM_DICTS=
5876 AC_SUBST(SYSTEM_DICTS)
5877 AC_SUBST(DICT_SYSTEM_DIR)
5878 AC_SUBST(HYPH_SYSTEM_DIR)
5879 AC_SUBST(THES_SYSTEM_DIR)
5881 dnl ===================================================================
5882 dnl Precompiled headers.
5883 ENABLE_PCH=""
5884 AC_MSG_CHECKING([whether to enable pch feature])
5885 if test -z "$enable_pch"; then
5886     if test "$_os" = "WINNT"; then
5887         # Enabled by default on Windows.
5888         enable_pch=yes
5889     else
5890         enable_pch=no
5891     fi
5893 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5894     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5896 if test "$enable_pch" = "system"; then
5897     ENABLE_PCH="1"
5898     AC_MSG_RESULT([yes (system headers)])
5899 elif test "$enable_pch" = "base"; then
5900     ENABLE_PCH="2"
5901     AC_MSG_RESULT([yes (system and base headers)])
5902 elif test "$enable_pch" = "normal"; then
5903     ENABLE_PCH="3"
5904     AC_MSG_RESULT([yes (normal)])
5905 elif test "$enable_pch" = "full"; then
5906     ENABLE_PCH="4"
5907     AC_MSG_RESULT([yes (full)])
5908 elif test "$enable_pch" = "yes"; then
5909     # Pick a suitable default.
5910     if test "$GCC" = "yes"; then
5911         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5912         # while making the PCHs larger and rebuilds more likely.
5913         ENABLE_PCH="2"
5914         AC_MSG_RESULT([yes (system and base headers)])
5915     else
5916         # With MSVC the highest level makes a significant difference,
5917         # and it was the default when there used to be no PCH levels.
5918         ENABLE_PCH="4"
5919         AC_MSG_RESULT([yes (full)])
5920     fi
5921 elif test "$enable_pch" = "no"; then
5922     AC_MSG_RESULT([no])
5923 else
5924     AC_MSG_ERROR([Unknown value for --enable-pch])
5926 AC_SUBST(ENABLE_PCH)
5927 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5928 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5929     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5930     if test "$CCACHE_BIN" != "not found"; then
5931         AC_MSG_CHECKING([ccache version])
5932         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5933         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5934         AC_MSG_RESULT([$CCACHE_VERSION])
5935         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5936         if test "$CCACHE_NUMVER" -gt "030701"; then
5937             AC_MSG_RESULT([yes])
5938         else
5939             AC_MSG_RESULT([no (not newer than 3.7.1)])
5940             CCACHE_DEPEND_MODE=
5941         fi
5942     fi
5945 PCH_INSTANTIATE_TEMPLATES=
5946 if test -n "$ENABLE_PCH"; then
5947     AC_MSG_CHECKING([whether $CC supports -fpch-instantiate-templates])
5948     save_CFLAGS=$CFLAGS
5949     CFLAGS="$CFLAGS -Werror -fpch-instantiate-templates"
5950     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_INSTANTIATE_TEMPLATES="-fpch-instantiate-templates" ],[])
5951     CFLAGS=$save_CFLAGS
5952     if test -n "$PCH_INSTANTIATE_TEMPLATES"; then
5953         AC_MSG_RESULT(yes)
5954     else
5955         AC_MSG_RESULT(no)
5956     fi
5958 AC_SUBST(PCH_INSTANTIATE_TEMPLATES)
5960 BUILDING_PCH_WITH_OBJ=
5961 if test -n "$ENABLE_PCH"; then
5962     AC_MSG_CHECKING([whether $CC supports -Xclang -building-pch-with-obj])
5963     save_CFLAGS=$CFLAGS
5964     CFLAGS="$CFLAGS -Werror -Xclang -building-pch-with-obj"
5965     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ BUILDING_PCH_WITH_OBJ="-Xclang -building-pch-with-obj" ],[])
5966     CFLAGS=$save_CFLAGS
5967     if test -n "$BUILDING_PCH_WITH_OBJ"; then
5968         AC_MSG_RESULT(yes)
5969     else
5970         AC_MSG_RESULT(no)
5971     fi
5973 AC_SUBST(BUILDING_PCH_WITH_OBJ)
5975 PCH_CODEGEN=
5976 PCH_NO_CODEGEN=
5977 if test -n "$BUILDING_PCH_WITH_OBJ"; then
5978     AC_MSG_CHECKING([whether $CC supports -fpch-codegen])
5979     save_CFLAGS=$CFLAGS
5980     CFLAGS="$CFLAGS -Werror -fpch-codegen"
5981     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
5982         [
5983         PCH_CODEGEN="-fpch-codegen"
5984         PCH_NO_CODEGEN="-fno-pch-codegen"
5985         ],[])
5986     CFLAGS=$save_CFLAGS
5987     if test -n "$PCH_CODEGEN"; then
5988         AC_MSG_RESULT(yes)
5989     else
5990         AC_MSG_RESULT(no)
5991     fi
5993 AC_SUBST(PCH_CODEGEN)
5994 AC_SUBST(PCH_NO_CODEGEN)
5995 PCH_DEBUGINFO=
5996 if test -n "$BUILDING_PCH_WITH_OBJ"; then
5997     AC_MSG_CHECKING([whether $CC supports -fpch-debuginfo])
5998     save_CFLAGS=$CFLAGS
5999     CFLAGS="$CFLAGS -Werror -fpch-debuginfo"
6000     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_DEBUGINFO="-fpch-debuginfo" ],[])
6001     CFLAGS=$save_CFLAGS
6002     if test -n "$PCH_DEBUGINFO"; then
6003         AC_MSG_RESULT(yes)
6004     else
6005         AC_MSG_RESULT(no)
6006     fi
6008 AC_SUBST(PCH_DEBUGINFO)
6010 TAB=`printf '\t'`
6012 AC_MSG_CHECKING([the GNU Make version])
6013 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
6014 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
6015 if test "$_make_longver" -ge "038200"; then
6016     AC_MSG_RESULT([$GNUMAKE $_make_version])
6018 elif test "$_make_longver" -ge "038100"; then
6019     if test "$build_os" = "cygwin"; then
6020         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
6021     fi
6022     AC_MSG_RESULT([$GNUMAKE $_make_version])
6024     dnl ===================================================================
6025     dnl Search all the common names for sha1sum
6026     dnl ===================================================================
6027     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
6028     if test -z "$SHA1SUM"; then
6029         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
6030     elif test "$SHA1SUM" = "openssl"; then
6031         SHA1SUM="openssl sha1"
6032     fi
6033     AC_MSG_CHECKING([for GNU Make bug 20033])
6034     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
6035     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
6036 A := \$(wildcard *.a)
6038 .PHONY: all
6039 all: \$(A:.a=.b)
6040 <TAB>@echo survived bug20033.
6042 .PHONY: setup
6043 setup:
6044 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
6046 define d1
6047 @echo lala \$(1)
6048 @sleep 1
6049 endef
6051 define d2
6052 @echo tyty \$(1)
6053 @sleep 1
6054 endef
6056 %.b : %.a
6057 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
6058 <TAB>\$(call d1,\$(CHECKSUM)),\
6059 <TAB>\$(call d2,\$(CHECKSUM)))
6061     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
6062         no_parallelism_make="YES"
6063         AC_MSG_RESULT([yes, disable parallelism])
6064     else
6065         AC_MSG_RESULT([no, keep parallelism enabled])
6066     fi
6067     rm -rf $TESTGMAKEBUG20033
6068 else
6069     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
6072 # find if gnumake support file function
6073 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
6074 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
6075 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6076     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
6078 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
6079 \$(file >test.txt,Success )
6081 .PHONY: all
6082 all:
6083 <TAB>@cat test.txt
6086 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
6087 if test -f $TESTGMAKEFILEFUNC/test.txt; then
6088     HAVE_GNUMAKE_FILE_FUNC=TRUE
6089     AC_MSG_RESULT([yes])
6090 else
6091     AC_MSG_RESULT([no])
6093 rm -rf $TESTGMAKEFILEFUNC
6094 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
6096 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
6097 STALE_MAKE=
6098 if test "$_make_ver_check" = ""; then
6099    STALE_MAKE=TRUE
6102 HAVE_LD_HASH_STYLE=FALSE
6103 WITH_LINKER_HASH_STYLE=
6104 AC_MSG_CHECKING([for --hash-style gcc linker support])
6105 if test "$GCC" = "yes"; then
6106     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
6107         hash_styles="gnu sysv"
6108     elif test "$with_linker_hash_style" = "no"; then
6109         hash_styles=
6110     else
6111         hash_styles="$with_linker_hash_style"
6112     fi
6114     for hash_style in $hash_styles; do
6115         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
6116         hash_style_ldflags_save=$LDFLAGS
6117         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
6119         AC_RUN_IFELSE([AC_LANG_PROGRAM(
6120             [
6121 #include <stdio.h>
6122             ],[
6123 printf ("");
6124             ])],
6125             [
6126                   HAVE_LD_HASH_STYLE=TRUE
6127                   WITH_LINKER_HASH_STYLE=$hash_style
6128             ],
6129             [HAVE_LD_HASH_STYLE=FALSE],
6130             [HAVE_LD_HASH_STYLE=FALSE])
6131         LDFLAGS=$hash_style_ldflags_save
6132     done
6134     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
6135         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
6136     else
6137         AC_MSG_RESULT( no )
6138     fi
6139     LDFLAGS=$hash_style_ldflags_save
6140 else
6141     AC_MSG_RESULT( no )
6143 AC_SUBST(HAVE_LD_HASH_STYLE)
6144 AC_SUBST(WITH_LINKER_HASH_STYLE)
6146 dnl ===================================================================
6147 dnl Check whether there's a Perl version available.
6148 dnl ===================================================================
6149 if test -z "$with_perl_home"; then
6150     AC_PATH_PROG(PERL, perl)
6151 else
6152     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
6153     _perl_path="$with_perl_home/bin/perl"
6154     if test -x "$_perl_path"; then
6155         PERL=$_perl_path
6156     else
6157         AC_MSG_ERROR([$_perl_path not found])
6158     fi
6161 dnl ===================================================================
6162 dnl Testing for Perl version 5 or greater.
6163 dnl $] is the Perl version variable, it is returned as an integer
6164 dnl ===================================================================
6165 if test "$PERL"; then
6166     AC_MSG_CHECKING([the Perl version])
6167     ${PERL} -e "exit($]);"
6168     _perl_version=$?
6169     if test "$_perl_version" -lt 5; then
6170         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
6171     fi
6172     AC_MSG_RESULT([Perl $_perl_version])
6173 else
6174     AC_MSG_ERROR([Perl not found, install Perl 5])
6177 dnl ===================================================================
6178 dnl Testing for required Perl modules
6179 dnl ===================================================================
6181 AC_MSG_CHECKING([for required Perl modules])
6182 perl_use_string="use Cwd ; use Digest::MD5"
6183 if test "$_os" = "WINNT"; then
6184     if test -n "$PKGFORMAT"; then
6185         for i in $PKGFORMAT; do
6186             case "$i" in
6187             msi)
6188                 # for getting fonts versions to use in MSI
6189                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
6190                 ;;
6191             esac
6192         done
6193     fi
6195 if test "$with_system_hsqldb" = "yes"; then
6196     perl_use_string="$perl_use_string ; use Archive::Zip"
6198 if test "$enable_openssl" = "yes" -a "$with_system_openssl" != "yes"; then
6199     # OpenSSL needs that to build
6200     perl_use_string="$perl_use_string ; use FindBin"
6202 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
6203     AC_MSG_RESULT([all modules found])
6204 else
6205     AC_MSG_RESULT([failed to find some modules])
6206     # Find out which modules are missing.
6207     for i in $perl_use_string; do
6208         if test "$i" != "use" -a "$i" != ";"; then
6209             if ! $PERL -e "use $i;">/dev/null 2>&1; then
6210                 missing_perl_modules="$missing_perl_modules $i"
6211             fi
6212         fi
6213     done
6214     AC_MSG_ERROR([
6215     The missing Perl modules are: $missing_perl_modules
6216     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
6219 dnl ===================================================================
6220 dnl Check for pkg-config
6221 dnl ===================================================================
6222 if test "$_os" != "WINNT"; then
6223     PKG_PROG_PKG_CONFIG
6226 if test "$_os" != "WINNT"; then
6228     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
6229     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
6230     # explicitly. Or put /path/to/compiler in PATH yourself.
6232     # Use wrappers for LTO
6233     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
6234         AC_CHECK_TOOL(AR,gcc-ar)
6235         AC_CHECK_TOOL(NM,gcc-nm)
6236         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
6237     else
6238         AC_CHECK_TOOL(AR,ar)
6239         AC_CHECK_TOOL(NM,nm)
6240         AC_CHECK_TOOL(RANLIB,ranlib)
6241     fi
6242     AC_CHECK_TOOL(OBJDUMP,objdump)
6243     AC_CHECK_TOOL(READELF,readelf)
6244     AC_CHECK_TOOL(STRIP,strip)
6245     if test "$_os" = "WINNT"; then
6246         AC_CHECK_TOOL(DLLTOOL,dlltool)
6247         AC_CHECK_TOOL(WINDRES,windres)
6248     fi
6250 AC_SUBST(AR)
6251 AC_SUBST(DLLTOOL)
6252 AC_SUBST(LD)
6253 AC_SUBST(NM)
6254 AC_SUBST(OBJDUMP)
6255 AC_SUBST(PKG_CONFIG)
6256 AC_SUBST(PKG_CONFIG_PATH)
6257 AC_SUBST(PKG_CONFIG_LIBDIR)
6258 AC_SUBST(RANLIB)
6259 AC_SUBST(READELF)
6260 AC_SUBST(STRIP)
6261 AC_SUBST(WINDRES)
6263 dnl ===================================================================
6264 dnl pkg-config checks on macOS
6265 dnl ===================================================================
6267 if test $_os = Darwin; then
6268     AC_MSG_CHECKING([for bogus pkg-config])
6269     if test -n "$PKG_CONFIG"; then
6270         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
6271             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
6272         else
6273             if test "$enable_bogus_pkg_config" = "yes"; then
6274                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
6275             else
6276                 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.])
6277             fi
6278         fi
6279     else
6280         AC_MSG_RESULT([no, good])
6281     fi
6284 find_csc()
6286     # Return value: $csctest
6288     unset csctest
6290     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
6291     if test -n "$regvalue"; then
6292         csctest=$regvalue
6293         return
6294     fi
6297 find_al()
6299     # Return value: $altest
6301     unset altest
6303     # We need this check to detect 4.6.1 or above.
6304     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
6305         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
6306         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
6307             altest=$regvalue
6308             return
6309         fi
6310     done
6312     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
6313         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
6314         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
6315             altest=$regvalue
6316             return
6317         fi
6318     done
6321 find_dotnetsdk46()
6323     unset frametest
6325     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
6326         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
6327         if test -n "$regvalue"; then
6328             frametest=$regvalue
6329             return
6330         fi
6331     done
6334 find_winsdk_version()
6336     # Args: $1 : SDK version as in "8.0", "8.1A" etc
6337     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
6339     unset winsdktest winsdkbinsubdir winsdklibsubdir
6341     case "$1" in
6342     8.0|8.0A)
6343         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
6344         if test -n "$regvalue"; then
6345             winsdktest=$regvalue
6346             winsdklibsubdir=win8
6347             return
6348         fi
6349         ;;
6350     8.1|8.1A)
6351         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
6352         if test -n "$regvalue"; then
6353             winsdktest=$regvalue
6354             winsdklibsubdir=winv6.3
6355             return
6356         fi
6357         ;;
6358     10.0)
6359         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
6360         if test -n "$regvalue"; then
6361             winsdktest=$regvalue
6362             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
6363             if test -n "$regvalue"; then
6364                 winsdkbinsubdir="$regvalue".0
6365                 winsdklibsubdir=$winsdkbinsubdir
6366                 local tmppath="$winsdktest\\Include\\$winsdklibsubdir"
6367                 local tmppath_unix=$(cygpath -u "$tmppath")
6368                 # test exist the SDK path
6369                 if test -d "$tmppath_unix"; then
6370                    # when path is convertible to a short path then path is okay
6371                    cygpath -d "$tmppath" >/dev/null 2>&1
6372                    if test $? -ne 0; then
6373                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
6374                    fi
6375                 else
6376                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
6377                 fi
6378             fi
6379             return
6380         fi
6381         ;;
6382     esac
6385 find_winsdk()
6387     # Return value: From find_winsdk_version
6389     unset winsdktest
6391     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
6392         find_winsdk_version $ver
6393         if test -n "$winsdktest"; then
6394             return
6395         fi
6396     done
6399 find_msms()
6401     # Return value: $msmdir
6403     AC_MSG_CHECKING([for MSVC merge modules directory])
6404     local my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
6405     local my_msm_dir
6407     case "$VCVER" in
6408         160)
6409         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
6410         ;;
6411     esac
6412     for f in $my_msm_files; do
6413         echo "$as_me:$LINENO: searching for $f" >&5
6414     done
6416     msmdir=
6417     for ver in 14.0 15.0; do
6418         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
6419         if test -n "$regvalue"; then
6420             for f in ${my_msm_files}; do
6421                 if test -e "$regvalue/${f}"; then
6422                     msmdir=$regvalue
6423                     break
6424                 fi
6425             done
6426         fi
6427     done
6428     dnl Is the following fallback really necessary, or was it added in response
6429     dnl to never having started Visual Studio on a given machine, so the
6430     dnl registry keys checked above had presumably not yet been created?
6431     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
6432     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
6433     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
6434     dnl expanding to "C:\Program Files\Common Files"), which would need
6435     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
6436     dnl obtain its value from cygwin:
6437     if test -z "$msmdir"; then
6438         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
6439         for f in ${my_msm_files}; do
6440             if test -e "$my_msm_dir/${f}"; then
6441                 msmdir=$my_msm_dir
6442             fi
6443         done
6444     fi
6446     dnl Starting from MSVC 15.0, merge modules are located in different directory
6447     case "$VCVER" in
6448     160)
6449         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6450             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
6451             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
6452             for f in ${my_msm_files}; do
6453                 if test -e "$my_msm_dir/${f}"; then
6454                     msmdir=$my_msm_dir
6455                     break
6456                 fi
6457             done
6458         done
6459         ;;
6460     esac
6462     if test -n "$msmdir"; then
6463         msmdir=`cygpath -m "$msmdir"`
6464         AC_MSG_RESULT([$msmdir])
6465     else
6466         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
6467             AC_MSG_FAILURE([not found])
6468         else
6469             AC_MSG_WARN([not found (check config.log)])
6470             add_warning "MSM none of ${my_msm_files} found"
6471         fi
6472     fi
6475 find_msvc_x64_dlls()
6477     # Return value: $msvcdllpath, $msvcdlls
6479     AC_MSG_CHECKING([for MSVC x64 DLL path])
6480     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
6481     case "$VCVER" in
6482     160)
6483         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6484             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
6485             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
6486                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
6487                 break
6488             fi
6489             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
6490             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
6491                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
6492                 break
6493             fi
6494         done
6495         ;;
6496     esac
6497     AC_MSG_RESULT([$msvcdllpath])
6498     AC_MSG_CHECKING([for MSVC x64 DLLs])
6499     msvcdlls="msvcp140.dll vcruntime140.dll"
6500     for dll in $msvcdlls; do
6501         if ! test -f "$msvcdllpath/$dll"; then
6502             AC_MSG_FAILURE([missing $dll])
6503         fi
6504     done
6505     AC_MSG_RESULT([found all ($msvcdlls)])
6508 dnl =========================================
6509 dnl Check for the Windows  SDK.
6510 dnl =========================================
6511 if test "$_os" = "WINNT"; then
6512     AC_MSG_CHECKING([for Windows SDK])
6513     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6514         find_winsdk
6515         WINDOWS_SDK_HOME=$winsdktest
6517         # normalize if found
6518         if test -n "$WINDOWS_SDK_HOME"; then
6519             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
6520             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
6521         fi
6523         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
6524     fi
6526     if test -n "$WINDOWS_SDK_HOME"; then
6527         # Remove a possible trailing backslash
6528         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
6530         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
6531              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
6532              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
6533             have_windows_sdk_headers=yes
6534         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
6535              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
6536              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
6537             have_windows_sdk_headers=yes
6538         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
6539              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
6540              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
6541             have_windows_sdk_headers=yes
6542         else
6543             have_windows_sdk_headers=no
6544         fi
6546         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
6547             have_windows_sdk_libs=yes
6548         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/user32.lib"; then
6549             have_windows_sdk_libs=yes
6550         else
6551             have_windows_sdk_libs=no
6552         fi
6554         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
6555             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
6556 the  Windows SDK are installed.])
6557         fi
6558     fi
6560     if test -z "$WINDOWS_SDK_HOME"; then
6561         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
6562     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
6563         WINDOWS_SDK_VERSION=80
6564         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
6565     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
6566         WINDOWS_SDK_VERSION=81
6567         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
6568     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
6569         WINDOWS_SDK_VERSION=10
6570         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
6571     else
6572         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
6573     fi
6574     PathFormat "$WINDOWS_SDK_HOME"
6575     WINDOWS_SDK_HOME="$formatted_path"
6576     WINDOWS_SDK_HOME_unix="$formatted_path_unix"
6577     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6578         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
6579         if test -d "$WINDOWS_SDK_HOME/include/um"; then
6580             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
6581         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
6582             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
6583         fi
6584     fi
6586     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
6587     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
6588     dnl but not in v8.0), so allow this to be overridden with a
6589     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
6590     dnl and configuration error if no WiLangId.vbs is found would arguably be
6591     dnl better, but I do not know under which conditions exactly it is needed by
6592     dnl msiglobal.pm:
6593     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
6594         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
6595         WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6596         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6597             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WIN_BUILD_ARCH}/WiLangId.vbs"
6598             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6599         fi
6600         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6601             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$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=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WIN_BUILD_ARCH/WiLangId.vbs")
6606             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6607         fi
6608     fi
6609     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
6610         if test -n "$with_package_format" -a "$with_package_format" != no; then
6611             for i in "$with_package_format"; do
6612                 if test "$i" = "msi"; then
6613                     if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6614                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
6615                     fi
6616                 fi
6617             done
6618         fi
6619     fi
6621 AC_SUBST(WINDOWS_SDK_HOME)
6622 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
6623 AC_SUBST(WINDOWS_SDK_VERSION)
6624 AC_SUBST(WINDOWS_SDK_WILANGID)
6626 if test "$build_os" = "cygwin"; then
6627     dnl Check midl.exe; this being the first check for a tool in the SDK bin
6628     dnl dir, it also determines that dir's path w/o an arch segment if any,
6629     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
6630     AC_MSG_CHECKING([for midl.exe])
6632     find_winsdk
6633     if test -n "$winsdkbinsubdir" \
6634         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/midl.exe"
6635     then
6636         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH
6637         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
6638     elif test -f "$winsdktest/Bin/$WIN_BUILD_ARCH/midl.exe"; then
6639         MIDL_PATH=$winsdktest/Bin/$WIN_BUILD_ARCH
6640         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
6641     elif test -f "$winsdktest/Bin/midl.exe"; then
6642         MIDL_PATH=$winsdktest/Bin
6643         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
6644     fi
6645     if test ! -f "$MIDL_PATH/midl.exe"; then
6646         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WIN_BUILD_ARCH, Windows SDK installation broken?])
6647     else
6648         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
6649     fi
6651     # Convert to posix path with 8.3 filename restrictions ( No spaces )
6652     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
6654     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
6655          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
6656          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
6657          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
6658     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
6659          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
6660          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6661          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
6662     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
6663          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
6664          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6665          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
6666     else
6667         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
6668     fi
6670     dnl Check csc.exe
6671     AC_MSG_CHECKING([for csc.exe])
6672     find_csc
6673     if test -f "$csctest/csc.exe"; then
6674         CSC_PATH="$csctest"
6675     fi
6676     if test ! -f "$CSC_PATH/csc.exe"; then
6677         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
6678     else
6679         AC_MSG_RESULT([$CSC_PATH/csc.exe])
6680     fi
6682     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
6684     dnl Check al.exe
6685     AC_MSG_CHECKING([for al.exe])
6686     find_winsdk
6687     if test -n "$winsdkbinsubdir" \
6688         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/al.exe"
6689     then
6690         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH"
6691     elif test -f "$winsdktest/Bin/$WIN_BUILD_ARCH/al.exe"; then
6692         AL_PATH="$winsdktest/Bin/$WIN_BUILD_ARCH"
6693     elif test -f "$winsdktest/Bin/al.exe"; then
6694         AL_PATH="$winsdktest/Bin"
6695     fi
6697     if test -z "$AL_PATH"; then
6698         find_al
6699         if test -f "$altest/bin/al.exe"; then
6700             AL_PATH="$altest/bin"
6701         elif test -f "$altest/al.exe"; then
6702             AL_PATH="$altest"
6703         fi
6704     fi
6705     if test ! -f "$AL_PATH/al.exe"; then
6706         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
6707     else
6708         AC_MSG_RESULT([$AL_PATH/al.exe])
6709     fi
6711     AL_PATH=`win_short_path_for_make "$AL_PATH"`
6713     dnl Check mscoree.lib / .NET Framework dir
6714     AC_MSG_CHECKING(.NET Framework)
6715     find_dotnetsdk46
6716     PathFormat "$frametest"
6717     frametest="$formatted_path"
6718     if test -f "$frametest/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6719         DOTNET_FRAMEWORK_HOME="$frametest"
6720     else
6721         find_winsdk
6722         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6723             DOTNET_FRAMEWORK_HOME="$winsdktest"
6724         fi
6725     fi
6726     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
6727         AC_MSG_ERROR([mscoree.lib not found])
6728     fi
6729     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
6731     PathFormat "$MIDL_PATH"
6732     MIDL_PATH="$formatted_path"
6734     PathFormat "$AL_PATH"
6735     AL_PATH="$formatted_path"
6737     PathFormat "$DOTNET_FRAMEWORK_HOME"
6738     DOTNET_FRAMEWORK_HOME="$formatted_path"
6740     PathFormat "$CSC_PATH"
6741     CSC_PATH="$formatted_path"
6744 dnl ===================================================================
6745 dnl Testing for C++ compiler and version...
6746 dnl ===================================================================
6748 if test "$_os" != "WINNT"; then
6749     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
6750     save_CXXFLAGS=$CXXFLAGS
6751     AC_PROG_CXX
6752     CXXFLAGS=$save_CXXFLAGS
6753     if test -z "$CXX_BASE"; then
6754         CXX_BASE=`first_arg_basename "$CXX"`
6755     fi
6758 dnl check for GNU C++ compiler version
6759 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
6760     AC_MSG_CHECKING([the GNU C++ compiler version])
6762     _gpp_version=`$CXX -dumpversion`
6763     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
6765     if test "$_gpp_majmin" -lt "700"; then
6766         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
6767     else
6768         AC_MSG_RESULT([ok (g++ $_gpp_version)])
6769     fi
6771     dnl see https://code.google.com/p/android/issues/detail?id=41770
6772         glibcxx_threads=no
6773         AC_LANG_PUSH([C++])
6774         AC_REQUIRE_CPP
6775         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
6776         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
6777             #include <bits/c++config.h>]],[[
6778             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
6779             && !defined(_GLIBCXX__PTHREADS) \
6780             && !defined(_GLIBCXX_HAS_GTHREADS)
6781             choke me
6782             #endif
6783         ]])],[AC_MSG_RESULT([yes])
6784         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
6785         AC_LANG_POP([C++])
6786         if test $glibcxx_threads = yes; then
6787             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
6788         fi
6790 AC_SUBST(BOOST_CXXFLAGS)
6793 # prefx CXX with ccache if needed
6795 UNCACHED_CXX="$CXX"
6796 if test "$CCACHE" != ""; then
6797     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
6798     AC_LANG_PUSH([C++])
6799     save_CXXFLAGS=$CXXFLAGS
6800     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
6801     dnl an empty program will do, we're checking the compiler flags
6802     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
6803                       [use_ccache=yes], [use_ccache=no])
6804     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
6805         AC_MSG_RESULT([yes])
6806     else
6807         CXX="$CCACHE $CXX"
6808         CXX_BASE="ccache $CXX_BASE"
6809         AC_MSG_RESULT([no])
6810     fi
6811     CXXFLAGS=$save_CXXFLAGS
6812     AC_LANG_POP([C++])
6815 dnl ===================================================================
6816 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
6817 dnl ===================================================================
6819 if test "$_os" != "WINNT"; then
6820     AC_PROG_CXXCPP
6822     dnl Check whether there's a C pre-processor.
6823     AC_PROG_CPP
6827 dnl ===================================================================
6828 dnl Find integral type sizes and alignments
6829 dnl ===================================================================
6831 if test "$_os" != "WINNT"; then
6833     AC_CHECK_SIZEOF(long)
6834     AC_CHECK_SIZEOF(short)
6835     AC_CHECK_SIZEOF(int)
6836     AC_CHECK_SIZEOF(long long)
6837     AC_CHECK_SIZEOF(double)
6838     AC_CHECK_SIZEOF(void*)
6840     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
6841     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
6842     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
6843     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
6844     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6846     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6847     m4_pattern_allow([AC_CHECK_ALIGNOF])
6848     m4_ifdef([AC_CHECK_ALIGNOF],
6849         [
6850             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6851             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6852             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6853             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6854         ],
6855         [
6856             case "$_os-$host_cpu" in
6857             Linux-i686)
6858                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6859                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6860                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6861                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6862                 ;;
6863             Linux-x86_64)
6864                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6865                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6866                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6867                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6868                 ;;
6869             *)
6870                 if test -z "$ac_cv_alignof_short" -o \
6871                         -z "$ac_cv_alignof_int" -o \
6872                         -z "$ac_cv_alignof_long" -o \
6873                         -z "$ac_cv_alignof_double"; then
6874                    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.])
6875                 fi
6876                 ;;
6877             esac
6878         ])
6880     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6881     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6882     if test $ac_cv_sizeof_long -eq 8; then
6883         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6884     elif test $ac_cv_sizeof_double -eq 8; then
6885         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6886     else
6887         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6888     fi
6890     dnl Check for large file support
6891     AC_SYS_LARGEFILE
6892     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6893         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6894     fi
6895     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6896         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6897     fi
6898 else
6899     # Hardcode for MSVC
6900     SAL_TYPES_SIZEOFSHORT=2
6901     SAL_TYPES_SIZEOFINT=4
6902     SAL_TYPES_SIZEOFLONG=4
6903     SAL_TYPES_SIZEOFLONGLONG=8
6904     if test $WIN_HOST_BITS -eq 32; then
6905         SAL_TYPES_SIZEOFPOINTER=4
6906     else
6907         SAL_TYPES_SIZEOFPOINTER=8
6908     fi
6909     SAL_TYPES_ALIGNMENT2=2
6910     SAL_TYPES_ALIGNMENT4=4
6911     SAL_TYPES_ALIGNMENT8=8
6912     LFS_CFLAGS=''
6914 AC_SUBST(LFS_CFLAGS)
6916 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6917 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6918 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6919 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6920 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6921 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6922 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6923 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6925 dnl ===================================================================
6926 dnl Check whether to enable runtime optimizations
6927 dnl ===================================================================
6928 ENABLE_RUNTIME_OPTIMIZATIONS=
6929 AC_MSG_CHECKING([whether to enable runtime optimizations])
6930 if test -z "$enable_runtime_optimizations"; then
6931     for i in $CC; do
6932         case $i in
6933         -fsanitize=*)
6934             enable_runtime_optimizations=no
6935             break
6936             ;;
6937         esac
6938     done
6940 if test "$enable_runtime_optimizations" != no; then
6941     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6942     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6943     AC_MSG_RESULT([yes])
6944 else
6945     AC_MSG_RESULT([no])
6947 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6949 dnl ===================================================================
6950 dnl Check if valgrind headers are available
6951 dnl ===================================================================
6952 ENABLE_VALGRIND=
6953 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6954     prev_cppflags=$CPPFLAGS
6955     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6956     # or where does it come from?
6957     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6958     AC_CHECK_HEADER([valgrind/valgrind.h],
6959         [ENABLE_VALGRIND=TRUE])
6960     CPPFLAGS=$prev_cppflags
6962 AC_SUBST([ENABLE_VALGRIND])
6963 if test -z "$ENABLE_VALGRIND"; then
6964     if test "$with_valgrind" = yes; then
6965         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6966     fi
6967     VALGRIND_CFLAGS=
6969 AC_SUBST([VALGRIND_CFLAGS])
6972 dnl ===================================================================
6973 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6974 dnl ===================================================================
6976 # We need at least the sys/sdt.h include header.
6977 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6978 if test "$SDT_H_FOUND" = "TRUE"; then
6979     # Found sys/sdt.h header, now make sure the c++ compiler works.
6980     # Old g++ versions had problems with probes in constructors/destructors.
6981     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6982     AC_LANG_PUSH([C++])
6983     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6984     #include <sys/sdt.h>
6985     class ProbeClass
6986     {
6987     private:
6988       int& ref;
6989       const char *name;
6991     public:
6992       ProbeClass(int& v, const char *n) : ref(v), name(n)
6993       {
6994         DTRACE_PROBE2(_test_, cons, name, ref);
6995       }
6997       void method(int min)
6998       {
6999         DTRACE_PROBE3(_test_, meth, name, ref, min);
7000         ref -= min;
7001       }
7003       ~ProbeClass()
7004       {
7005         DTRACE_PROBE2(_test_, dest, name, ref);
7006       }
7007     };
7008     ]],[[
7009     int i = 64;
7010     DTRACE_PROBE1(_test_, call, i);
7011     ProbeClass inst = ProbeClass(i, "call");
7012     inst.method(24);
7013     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
7014           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
7015     AC_LANG_POP([C++])
7017 AC_CONFIG_HEADERS([config_host/config_probes.h])
7019 dnl ===================================================================
7020 dnl GCC features
7021 dnl ===================================================================
7022 HAVE_GCC_STACK_CLASH_PROTECTION=
7023 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7024     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
7025     save_CFLAGS=$CFLAGS
7026     CFLAGS="$CFLAGS -Werror -fstack-clash-protection"
7027     AC_LINK_IFELSE(
7028         [AC_LANG_PROGRAM(, [[return 0;]])],
7029         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
7030         [AC_MSG_RESULT([no])])
7031     CFLAGS=$save_CFLAGS
7033     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
7034     save_CFLAGS=$CFLAGS
7035     CFLAGS="$CFLAGS -Werror -mno-avx"
7036     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
7037     CFLAGS=$save_CFLAGS
7038     if test "$HAVE_GCC_AVX" = "TRUE"; then
7039         AC_MSG_RESULT([yes])
7040     else
7041         AC_MSG_RESULT([no])
7042     fi
7044     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
7045     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
7046     int v = 0;
7047     if (__sync_add_and_fetch(&v, 1) != 1 ||
7048         __sync_sub_and_fetch(&v, 1) != 0)
7049         return 1;
7050     __sync_synchronize();
7051     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
7052         v != 1)
7053         return 1;
7054     return 0;
7055 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
7056     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
7057         AC_MSG_RESULT([yes])
7058         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
7059     else
7060         AC_MSG_RESULT([no])
7061     fi
7063     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
7064     AC_LANG_PUSH([C++])
7065     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7066             #include <cstddef>
7067             #include <cxxabi.h>
7068             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
7069         ])], [
7070             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
7071             AC_MSG_RESULT([yes])
7072         ], [AC_MSG_RESULT([no])])
7073     AC_LANG_POP([C++])
7075     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
7076     AC_LANG_PUSH([C++])
7077     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7078             #include <cstddef>
7079             #include <cxxabi.h>
7080             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
7081         ])], [
7082             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
7083             AC_MSG_RESULT([yes])
7084         ], [AC_MSG_RESULT([no])])
7085     AC_LANG_POP([C++])
7087     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
7088     AC_LANG_PUSH([C++])
7089     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7090             #include <cxxabi.h>
7091             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
7092         ])], [
7093             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
7094             AC_MSG_RESULT([yes])
7095         ], [AC_MSG_RESULT([no])])
7096     AC_LANG_POP([C++])
7098     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
7099     AC_LANG_PUSH([C++])
7100     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7101             #include <cstddef>
7102             #include <cxxabi.h>
7103             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
7104         ])], [
7105             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
7106             AC_MSG_RESULT([yes])
7107         ], [AC_MSG_RESULT([no])])
7108     AC_LANG_POP([C++])
7110     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exception in cxxabi.h])
7111     AC_LANG_PUSH([C++])
7112     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7113             #include <cstddef>
7114             #include <cxxabi.h>
7115             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exception); }
7116         ])], [
7117             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTION],[1])
7118             AC_MSG_RESULT([yes])
7119         ], [AC_MSG_RESULT([no])])
7120     AC_LANG_POP([C++])
7122     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
7123     AC_LANG_PUSH([C++])
7124     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7125             #include <cxxabi.h>
7126             void * f() { return __cxxabiv1::__cxa_get_globals(); }
7127         ])], [
7128             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
7129             AC_MSG_RESULT([yes])
7130         ], [AC_MSG_RESULT([no])])
7131     AC_LANG_POP([C++])
7133     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
7134     AC_LANG_PUSH([C++])
7135     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7136             #include <cxxabi.h>
7137             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
7138         ])], [
7139             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
7140             AC_MSG_RESULT([yes])
7141         ], [AC_MSG_RESULT([no])])
7142     AC_LANG_POP([C++])
7144     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
7145     AC_LANG_PUSH([C++])
7146     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7147             #include <cxxabi.h>
7148             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
7149         ])], [
7150             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
7151             AC_MSG_RESULT([yes])
7152         ], [AC_MSG_RESULT([no])])
7153     AC_LANG_POP([C++])
7155     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
7156     AC_LANG_PUSH([C++])
7157     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7158             #include <cstddef>
7159             #include <cxxabi.h>
7160             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
7161         ])], [
7162             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
7163             AC_MSG_RESULT([yes])
7164         ], [AC_MSG_RESULT([no])])
7165     AC_LANG_POP([C++])
7167     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
7168     AC_LANG_PUSH([C++])
7169     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7170             #include <cstddef>
7171             #include <cxxabi.h>
7172             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
7173         ])], [
7174             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
7175             AC_MSG_RESULT([yes])
7176         ], [AC_MSG_RESULT([no])])
7177     AC_LANG_POP([C++])
7180 AC_SUBST(HAVE_GCC_AVX)
7181 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
7182 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
7184 dnl ===================================================================
7185 dnl Identify the C++ library
7186 dnl ===================================================================
7188 AC_MSG_CHECKING([what the C++ library is])
7189 AC_LANG_PUSH([C++])
7190 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7191 #include <utility>
7192 #ifndef __GLIBCXX__
7193 foo bar
7194 #endif
7195 ]])],
7196     [CPP_LIBRARY=GLIBCXX
7197      cpp_library_name="GNU libstdc++"
7198     ],
7199     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7200 #include <utility>
7201 #ifndef _LIBCPP_VERSION
7202 foo bar
7203 #endif
7204 ]])],
7205     [CPP_LIBRARY=LIBCPP
7206      cpp_library_name="LLVM libc++"
7207      AC_DEFINE([HAVE_LIBCXX])
7208     ],
7209     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7210 #include <utility>
7211 #ifndef _MSC_VER
7212 foo bar
7213 #endif
7214 ]])],
7215     [CPP_LIBRARY=MSVCRT
7216      cpp_library_name="Microsoft"
7217     ],
7218     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
7219 AC_MSG_RESULT([$cpp_library_name])
7220 AC_LANG_POP([C++])
7222 dnl ===================================================================
7223 dnl Check for gperf
7224 dnl ===================================================================
7225 AC_PATH_PROG(GPERF, gperf)
7226 if test -z "$GPERF"; then
7227     AC_MSG_ERROR([gperf not found but needed. Install it.])
7229 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7230     GPERF=`cygpath -m $GPERF`
7232 AC_MSG_CHECKING([whether gperf is new enough])
7233 my_gperf_ver1=$($GPERF --version | head -n 1)
7234 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
7235 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
7236 if test "$my_gperf_ver3" -ge 301; then
7237     AC_MSG_RESULT([yes ($my_gperf_ver2)])
7238 else
7239     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
7241 AC_SUBST(GPERF)
7243 dnl ===================================================================
7244 dnl Check for system libcmis
7245 dnl ===================================================================
7246 # libcmis requires curl and we can't build curl for iOS
7247 if test "$test_cmis" = "yes" -a "$enable_cmis" = "yes"; then
7248     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
7249     ENABLE_LIBCMIS=TRUE
7250 else
7251     ENABLE_LIBCMIS=
7253 AC_SUBST(ENABLE_LIBCMIS)
7255 dnl ===================================================================
7256 dnl C++11
7257 dnl ===================================================================
7259 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
7260 CXXFLAGS_CXX11=
7261 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
7262     if test "$with_latest_c__" = yes; then
7263         CXXFLAGS_CXX11=-std:c++latest
7264     else
7265         CXXFLAGS_CXX11=-std:c++17
7266     fi
7267     CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -permissive- -Zc:__cplusplus"
7268 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7269     my_flags='-std=c++17 -std=c++1z'
7270     if test "$with_latest_c__" = yes; then
7271         my_flags="-std=c++23 -std=c++2b -std=c++20 -std=c++2a $my_flags"
7272     fi
7273     for flag in $my_flags; do
7274         if test "$COM" = MSC; then
7275             flag="-Xclang $flag"
7276         fi
7277         save_CXXFLAGS=$CXXFLAGS
7278         CXXFLAGS="$CXXFLAGS $flag -Werror"
7279         if test "$SYSTEM_LIBCMIS" = TRUE; then
7280             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
7281         fi
7282         AC_LANG_PUSH([C++])
7283         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7284             #include <algorithm>
7285             #include <functional>
7286             #include <vector>
7288             #if defined SYSTEM_LIBCMIS
7289             // See ucb/source/ucp/cmis/auth_provider.hxx:
7290             #if !defined __clang__
7291             #pragma GCC diagnostic push
7292             #pragma GCC diagnostic ignored "-Wdeprecated"
7293             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
7294             #endif
7295             #include <libcmis/libcmis.hxx>
7296             #if !defined __clang__
7297             #pragma GCC diagnostic pop
7298             #endif
7299             #endif
7301             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
7302                 std::sort(v.begin(), v.end(), fn);
7303             }
7304             ]])],[CXXFLAGS_CXX11=$flag])
7305         AC_LANG_POP([C++])
7306         CXXFLAGS=$save_CXXFLAGS
7307         if test -n "$CXXFLAGS_CXX11"; then
7308             break
7309         fi
7310     done
7312 if test -n "$CXXFLAGS_CXX11"; then
7313     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
7314 else
7315     AC_MSG_ERROR(no)
7317 AC_SUBST(CXXFLAGS_CXX11)
7319 if test "$GCC" = "yes"; then
7320     save_CXXFLAGS=$CXXFLAGS
7321     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7322     CHECK_L_ATOMIC
7323     CXXFLAGS=$save_CXXFLAGS
7324     AC_SUBST(ATOMIC_LIB)
7327 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
7328 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
7329 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
7330 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
7331 dnl again towards 4.7.2:
7332 if test $CPP_LIBRARY = GLIBCXX; then
7333     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
7334     AC_LANG_PUSH([C++])
7335     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7336 #include <list>
7337 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
7338     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
7339     //   GCC 4.7.0: 20120322
7340     //   GCC 4.7.1: 20120614
7341     // and using a range check is not possible as the mapping between
7342     // __GLIBCXX__ values and GCC versions is not monotonic
7343 /* ok */
7344 #else
7345 abi broken
7346 #endif
7347         ]])], [AC_MSG_RESULT(no, ok)],
7348         [AC_MSG_ERROR(yes)])
7349     AC_LANG_POP([C++])
7352 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
7353 save_CXXFLAGS=$CXXFLAGS
7354 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7355 AC_LANG_PUSH([C++])
7357 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7358 #include <stddef.h>
7360 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
7362 namespace
7364         struct b
7365         {
7366                 int i;
7367                 int j;
7368         };
7370 ]], [[
7371 struct a
7373         int i;
7374         int j;
7376 a thinga[]={{0,0}, {1,1}};
7377 b thingb[]={{0,0}, {1,1}};
7378 size_t i = sizeof(sal_n_array_size(thinga));
7379 size_t j = sizeof(sal_n_array_size(thingb));
7380 return !(i != 0 && j != 0);
7382     ], [ AC_MSG_RESULT(yes) ],
7383     [ AC_MSG_ERROR(no)])
7384 AC_LANG_POP([C++])
7385 CXXFLAGS=$save_CXXFLAGS
7387 HAVE_GCC_FNO_SIZED_DEALLOCATION=
7388 if test "$GCC" = yes; then
7389     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
7390     AC_LANG_PUSH([C++])
7391     save_CXXFLAGS=$CXXFLAGS
7392     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
7393     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
7394     CXXFLAGS=$save_CXXFLAGS
7395     AC_LANG_POP([C++])
7396     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
7397         AC_MSG_RESULT([yes])
7398     else
7399         AC_MSG_RESULT([no])
7400     fi
7402 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
7404 AC_MSG_CHECKING([whether $CXX_BASE supports a working C++20 consteval])
7405 dnl ...that does not suffer from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96994> "Missing code
7406 dnl from consteval constructor initializing const variable",
7407 dnl <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98752> "wrong 'error: â€˜this’ is not a constant
7408 dnl expression' with consteval constructor", or <https://bugs.llvm.org/show_bug.cgi?id=50063> "code
7409 dnl using consteval: 'clang/lib/CodeGen/Address.h:38: llvm::Value*
7410 dnl clang::CodeGen::Address::getPointer() const: Assertion `isValid()' failed.'":
7411 AC_LANG_PUSH([C++])
7412 save_CXXFLAGS=$CXXFLAGS
7413 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7414 AC_RUN_IFELSE([AC_LANG_PROGRAM([
7415         struct S {
7416             consteval S() { i = 1; }
7417             int i = 0;
7418         };
7419         S const s;
7421         struct S1 { consteval S1(int) {} };
7422         struct S2 {
7423             S1 x;
7424             S2(): x(0) {}
7425         };
7427         struct S3 {
7428             consteval S3() {}
7429             union {
7430                 int a;
7431                 unsigned b = 0;
7432             };
7433         };
7434         void f() { S3(); }
7435     ], [
7436         return (s.i == 1) ? 0 : 1;
7437     ])], [
7438         AC_DEFINE([HAVE_CPP_CONSTEVAL],[1])
7439         AC_MSG_RESULT([yes])
7440     ], [AC_MSG_RESULT([no])], [AC_MSG_RESULT([assumed no (cross compiling)])])
7441 CXXFLAGS=$save_CXXFLAGS
7442 AC_LANG_POP([C++])
7444 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
7445 AC_LANG_PUSH([C++])
7446 save_CXXFLAGS=$CXXFLAGS
7447 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7448 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7449         #include <algorithm>
7450         #include <initializer_list>
7451         #include <vector>
7452         template<typename T> class S {
7453         private:
7454             std::vector<T> v_;
7455         public:
7456             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
7457         };
7458         constinit S<int> s{3, 2, 1};
7459     ])], [
7460         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
7461         AC_MSG_RESULT([yes])
7462     ], [AC_MSG_RESULT([no])])
7463 CXXFLAGS=$save_CXXFLAGS
7464 AC_LANG_POP([C++])
7466 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
7467 AC_LANG_PUSH([C++])
7468 save_CXXFLAGS=$CXXFLAGS
7469 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7470 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7471         #include <span>
7472         #include <type_traits>
7473         // Don't check size_type directly, as it was called index_type before P1872R0:
7474         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
7475     ])], [
7476         AC_DEFINE([HAVE_CPP_SPAN],[1])
7477         AC_MSG_RESULT([yes])
7478     ], [AC_MSG_RESULT([no])])
7479 CXXFLAGS=$save_CXXFLAGS
7480 AC_LANG_POP([C++])
7482 AC_MSG_CHECKING([whether $CXX_BASE implements C++ DR P1155R3])
7483 AC_LANG_PUSH([C++])
7484 save_CXXFLAGS=$CXXFLAGS
7485 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7486 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7487         struct S1 { S1(S1 &&); };
7488         struct S2: S1 {};
7489         S1 f(S2 s) { return s; }
7490     ])], [
7491         AC_DEFINE([HAVE_P1155R3],[1])
7492         AC_MSG_RESULT([yes])
7493     ], [AC_MSG_RESULT([no])])
7494 CXXFLAGS=$save_CXXFLAGS
7495 AC_LANG_POP([C++])
7497 dnl Supported since GCC 9 and Clang 10 (which each also started to support -Wdeprecated-copy, but
7498 dnl which is included in -Wextra anyway):
7499 HAVE_WDEPRECATED_COPY_DTOR=
7500 if test "$GCC" = yes; then
7501     AC_MSG_CHECKING([whether $CXX_BASE supports -Wdeprecated-copy-dtor])
7502     AC_LANG_PUSH([C++])
7503     save_CXXFLAGS=$CXXFLAGS
7504     CXXFLAGS="$CXXFLAGS -Werror -Wdeprecated-copy-dtor"
7505     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
7506             HAVE_WDEPRECATED_COPY_DTOR=TRUE
7507             AC_MSG_RESULT([yes])
7508         ], [AC_MSG_RESULT([no])])
7509     CXXFLAGS=$save_CXXFLAGS
7510     AC_LANG_POP([C++])
7512 AC_SUBST([HAVE_WDEPRECATED_COPY_DTOR])
7514 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
7515 dnl uninitialized warning for code like
7517 dnl   OString f();
7518 dnl   boost::optional<OString> * g(bool b) {
7519 dnl       boost::optional<OString> o;
7520 dnl       if (b) o = f();
7521 dnl       return new boost::optional<OString>(o);
7522 dnl   }
7524 dnl (as is e.g. present, in a slightly more elaborate form, in
7525 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
7526 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
7527 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
7528 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7529     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
7530     AC_LANG_PUSH([C++])
7531     save_CXXFLAGS=$CXXFLAGS
7532     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
7533     if test "$ENABLE_OPTIMIZED" = TRUE; then
7534         CXXFLAGS="$CXXFLAGS -O2"
7535     else
7536         CXXFLAGS="$CXXFLAGS -O0"
7537     fi
7538     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7539             #include <new>
7540             void f1(int);
7541             struct S1 {
7542                 ~S1() { f1(n); }
7543                 int n = 0;
7544             };
7545             struct S2 {
7546                 S2() {}
7547                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
7548                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
7549                 void set(S1 s) {
7550                     new (stg) S1(s);
7551                     init = true;
7552                 }
7553                 bool init = false;
7554                 char stg[sizeof (S1)];
7555             } ;
7556             S1 f2();
7557             S2 * f3(bool b) {
7558                 S2 o;
7559                 if (b) o.set(f2());
7560                 return new S2(o);
7561             }
7562         ]])], [AC_MSG_RESULT([no])], [
7563             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
7564             AC_MSG_RESULT([yes])
7565         ])
7566     CXXFLAGS=$save_CXXFLAGS
7567     AC_LANG_POP([C++])
7569 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
7571 dnl Check for <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c5> "[8/9/10/11 Regression]
7572 dnl -Wstringop-overflow false positive due to using MEM_REF type of &MEM" (fixed in GCC 11), which
7573 dnl hits us e.g. with GCC 10 and --enable-optimized at
7575 dnl   In file included from include/rtl/string.hxx:49,
7576 dnl                    from include/rtl/ustring.hxx:43,
7577 dnl                    from include/osl/file.hxx:35,
7578 dnl                    from include/codemaker/global.hxx:28,
7579 dnl                    from include/codemaker/options.hxx:23,
7580 dnl                    from codemaker/source/commoncpp/commoncpp.cxx:24:
7581 dnl   In function â€˜char* rtl::addDataHelper(char*, const char*, std::size_t)’,
7582 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,
7583 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,
7584 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,
7585 dnl       inlined from â€˜rtl::OString codemaker::cpp::scopedCppName(const rtl::OString&, bool)’ at codemaker/source/commoncpp/commoncpp.cxx:53:55:
7586 dnl   include/rtl/stringconcat.hxx:78:15: error: writing 2 bytes into a region of size 1 [-Werror=stringop-overflow=]
7587 dnl      78 |         memcpy( buffer, data, length );
7588 dnl         |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
7589 HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=
7590 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7591     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=stringop-overflow=])
7592     AC_LANG_PUSH([C++])
7593     save_CXXFLAGS=$CXXFLAGS
7594     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wstringop-overflow"
7595     if test "$ENABLE_OPTIMIZED" = TRUE; then
7596         CXXFLAGS="$CXXFLAGS -O2"
7597     else
7598         CXXFLAGS="$CXXFLAGS -O0"
7599     fi
7600     dnl Test code taken from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c0>:
7601     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7602             void fill(char const * begin, char const * end, char c);
7603             struct q {
7604                 char ids[4];
7605                 char username[6];
7606             };
7607             void test(q & c) {
7608                 fill(c.ids, c.ids + sizeof(c.ids), '\0');
7609                 __builtin_strncpy(c.username, "root", sizeof(c.username));
7610             }
7611         ]])], [AC_MSG_RESULT([no])], [
7612             HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=TRUE
7613             AC_MSG_RESULT([yes])
7614         ])
7615     CXXFLAGS=$save_CXXFLAGS
7616     AC_LANG_POP([C++])
7618 AC_SUBST([HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW])
7620 dnl ===================================================================
7621 dnl CPU Intrinsics support - SSE, AVX
7622 dnl ===================================================================
7624 CXXFLAGS_INTRINSICS_SSE2=
7625 CXXFLAGS_INTRINSICS_SSSE3=
7626 CXXFLAGS_INTRINSICS_SSE41=
7627 CXXFLAGS_INTRINSICS_SSE42=
7628 CXXFLAGS_INTRINSICS_AVX=
7629 CXXFLAGS_INTRINSICS_AVX2=
7630 CXXFLAGS_INTRINSICS_AVX512=
7631 CXXFLAGS_INTRINSICS_F16C=
7632 CXXFLAGS_INTRINSICS_FMA=
7634 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7635     # GCC, Clang or Clang-cl (clang-cl + MSVC's -arch options don't work well together)
7636     flag_sse2=-msse2
7637     flag_ssse3=-mssse3
7638     flag_sse41=-msse4.1
7639     flag_sse42=-msse4.2
7640     flag_avx=-mavx
7641     flag_avx2=-mavx2
7642     flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
7643     flag_f16c=-mf16c
7644     flag_fma=-mfma
7645 else
7646     # https://docs.microsoft.com/en-us/cpp/build/reference/arch-x86
7647     # MSVC seems to differentiate only between SSE and SSE2, where in fact
7648     # SSE2 seems to be SSE2+.
7649     # Even if -arch:SSE2 is the default, set it explicitly, so that the variable
7650     # is not empty (and can be tested in gbuild).
7651     flag_sse2=-arch:SSE2
7652     flag_ssse3=-arch:SSE2
7653     flag_sse41=-arch:SSE2
7654     flag_sse42=-arch:SSE2
7655     flag_avx=-arch:AVX
7656     flag_avx2=-arch:AVX2
7657     flag_avx512=-arch:AVX512
7658     # These are part of -arch:AVX2
7659     flag_f16c=-arch:AVX2
7660     flag_fma=-arch:AVX2
7663 AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
7664 AC_LANG_PUSH([C++])
7665 save_CXXFLAGS=$CXXFLAGS
7666 CXXFLAGS="$CXXFLAGS $flag_sse2"
7667 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7668     #include <emmintrin.h>
7669     int main () {
7670         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7671         c = _mm_xor_si128 (a, b);
7672         return 0;
7673     }
7674     ])],
7675     [can_compile_sse2=yes],
7676     [can_compile_sse2=no])
7677 AC_LANG_POP([C++])
7678 CXXFLAGS=$save_CXXFLAGS
7679 AC_MSG_RESULT([${can_compile_sse2}])
7680 if test "${can_compile_sse2}" = "yes" ; then
7681     CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
7684 AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
7685 AC_LANG_PUSH([C++])
7686 save_CXXFLAGS=$CXXFLAGS
7687 CXXFLAGS="$CXXFLAGS $flag_ssse3"
7688 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7689     #include <tmmintrin.h>
7690     int main () {
7691         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7692         c = _mm_maddubs_epi16 (a, b);
7693         return 0;
7694     }
7695     ])],
7696     [can_compile_ssse3=yes],
7697     [can_compile_ssse3=no])
7698 AC_LANG_POP([C++])
7699 CXXFLAGS=$save_CXXFLAGS
7700 AC_MSG_RESULT([${can_compile_ssse3}])
7701 if test "${can_compile_ssse3}" = "yes" ; then
7702     CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
7705 AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
7706 AC_LANG_PUSH([C++])
7707 save_CXXFLAGS=$CXXFLAGS
7708 CXXFLAGS="$CXXFLAGS $flag_sse41"
7709 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7710     #include <smmintrin.h>
7711     int main () {
7712         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7713         c = _mm_cmpeq_epi64 (a, b);
7714         return 0;
7715     }
7716     ])],
7717     [can_compile_sse41=yes],
7718     [can_compile_sse41=no])
7719 AC_LANG_POP([C++])
7720 CXXFLAGS=$save_CXXFLAGS
7721 AC_MSG_RESULT([${can_compile_sse41}])
7722 if test "${can_compile_sse41}" = "yes" ; then
7723     CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
7726 AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
7727 AC_LANG_PUSH([C++])
7728 save_CXXFLAGS=$CXXFLAGS
7729 CXXFLAGS="$CXXFLAGS $flag_sse42"
7730 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7731     #include <nmmintrin.h>
7732     int main () {
7733         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7734         c = _mm_cmpgt_epi64 (a, b);
7735         return 0;
7736     }
7737     ])],
7738     [can_compile_sse42=yes],
7739     [can_compile_sse42=no])
7740 AC_LANG_POP([C++])
7741 CXXFLAGS=$save_CXXFLAGS
7742 AC_MSG_RESULT([${can_compile_sse42}])
7743 if test "${can_compile_sse42}" = "yes" ; then
7744     CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
7747 AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
7748 AC_LANG_PUSH([C++])
7749 save_CXXFLAGS=$CXXFLAGS
7750 CXXFLAGS="$CXXFLAGS $flag_avx"
7751 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7752     #include <immintrin.h>
7753     int main () {
7754         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
7755         c = _mm256_xor_ps(a, b);
7756         return 0;
7757     }
7758     ])],
7759     [can_compile_avx=yes],
7760     [can_compile_avx=no])
7761 AC_LANG_POP([C++])
7762 CXXFLAGS=$save_CXXFLAGS
7763 AC_MSG_RESULT([${can_compile_avx}])
7764 if test "${can_compile_avx}" = "yes" ; then
7765     CXXFLAGS_INTRINSICS_AVX="$flag_avx"
7768 AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
7769 AC_LANG_PUSH([C++])
7770 save_CXXFLAGS=$CXXFLAGS
7771 CXXFLAGS="$CXXFLAGS $flag_avx2"
7772 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7773     #include <immintrin.h>
7774     int main () {
7775         __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
7776         c = _mm256_maddubs_epi16(a, b);
7777         return 0;
7778     }
7779     ])],
7780     [can_compile_avx2=yes],
7781     [can_compile_avx2=no])
7782 AC_LANG_POP([C++])
7783 CXXFLAGS=$save_CXXFLAGS
7784 AC_MSG_RESULT([${can_compile_avx2}])
7785 if test "${can_compile_avx2}" = "yes" ; then
7786     CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
7789 AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
7790 AC_LANG_PUSH([C++])
7791 save_CXXFLAGS=$CXXFLAGS
7792 CXXFLAGS="$CXXFLAGS $flag_avx512"
7793 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7794     #include <immintrin.h>
7795     int main () {
7796         __m512i a = _mm512_loadu_si512(0);
7797         return 0;
7798     }
7799     ])],
7800     [can_compile_avx512=yes],
7801     [can_compile_avx512=no])
7802 AC_LANG_POP([C++])
7803 CXXFLAGS=$save_CXXFLAGS
7804 AC_MSG_RESULT([${can_compile_avx512}])
7805 if test "${can_compile_avx512}" = "yes" ; then
7806     CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
7809 AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
7810 AC_LANG_PUSH([C++])
7811 save_CXXFLAGS=$CXXFLAGS
7812 CXXFLAGS="$CXXFLAGS $flag_f16c"
7813 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7814     #include <immintrin.h>
7815     int main () {
7816         __m128i a = _mm_set1_epi32 (0);
7817         __m128 c;
7818         c = _mm_cvtph_ps(a);
7819         return 0;
7820     }
7821     ])],
7822     [can_compile_f16c=yes],
7823     [can_compile_f16c=no])
7824 AC_LANG_POP([C++])
7825 CXXFLAGS=$save_CXXFLAGS
7826 AC_MSG_RESULT([${can_compile_f16c}])
7827 if test "${can_compile_f16c}" = "yes" ; then
7828     CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
7831 AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
7832 AC_LANG_PUSH([C++])
7833 save_CXXFLAGS=$CXXFLAGS
7834 CXXFLAGS="$CXXFLAGS $flag_fma"
7835 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7836     #include <immintrin.h>
7837     int main () {
7838         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
7839         d = _mm256_fmadd_ps(a, b, c);
7840         return 0;
7841     }
7842     ])],
7843     [can_compile_fma=yes],
7844     [can_compile_fma=no])
7845 AC_LANG_POP([C++])
7846 CXXFLAGS=$save_CXXFLAGS
7847 AC_MSG_RESULT([${can_compile_fma}])
7848 if test "${can_compile_fma}" = "yes" ; then
7849     CXXFLAGS_INTRINSICS_FMA="$flag_fma"
7852 AC_SUBST([CXXFLAGS_INTRINSICS_SSE2])
7853 AC_SUBST([CXXFLAGS_INTRINSICS_SSSE3])
7854 AC_SUBST([CXXFLAGS_INTRINSICS_SSE41])
7855 AC_SUBST([CXXFLAGS_INTRINSICS_SSE42])
7856 AC_SUBST([CXXFLAGS_INTRINSICS_AVX])
7857 AC_SUBST([CXXFLAGS_INTRINSICS_AVX2])
7858 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512])
7859 AC_SUBST([CXXFLAGS_INTRINSICS_F16C])
7860 AC_SUBST([CXXFLAGS_INTRINSICS_FMA])
7862 dnl ===================================================================
7863 dnl system stl sanity tests
7864 dnl ===================================================================
7865 if test "$_os" != "WINNT"; then
7867     AC_LANG_PUSH([C++])
7869     save_CPPFLAGS="$CPPFLAGS"
7870     if test -n "$MACOSX_SDK_PATH"; then
7871         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
7872     fi
7874     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
7875     # only.
7876     if test "$CPP_LIBRARY" = GLIBCXX; then
7877         dnl gcc#19664, gcc#22482, rhbz#162935
7878         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
7879         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
7880         AC_MSG_RESULT([$stlvisok])
7881         if test "$stlvisok" = "no"; then
7882             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
7883         fi
7884     fi
7886     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
7887     # when we don't make any dynamic libraries?
7888     if test "$DISABLE_DYNLOADING" = ""; then
7889         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
7890         cat > conftestlib1.cc <<_ACEOF
7891 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7892 struct S2: S1<int> { virtual ~S2(); };
7893 S2::~S2() {}
7894 _ACEOF
7895         cat > conftestlib2.cc <<_ACEOF
7896 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7897 struct S2: S1<int> { virtual ~S2(); };
7898 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
7899 _ACEOF
7900         gccvisinlineshiddenok=yes
7901         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
7902             gccvisinlineshiddenok=no
7903         else
7904             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
7905             dnl known to not work with -z defs (unsetting which makes the test
7906             dnl moot, though):
7907             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
7908             if test "$COM_IS_CLANG" = TRUE; then
7909                 for i in $CXX $CXXFLAGS; do
7910                     case $i in
7911                     -fsanitize=*)
7912                         my_linkflagsnoundefs=
7913                         break
7914                         ;;
7915                     esac
7916                 done
7917             fi
7918             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
7919                 gccvisinlineshiddenok=no
7920             fi
7921         fi
7923         rm -fr libconftest*
7924         AC_MSG_RESULT([$gccvisinlineshiddenok])
7925         if test "$gccvisinlineshiddenok" = "no"; then
7926             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
7927         fi
7928     fi
7930    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
7931     cat >visibility.cxx <<_ACEOF
7932 #pragma GCC visibility push(hidden)
7933 struct __attribute__ ((visibility ("default"))) TestStruct {
7934   static void Init();
7936 __attribute__ ((visibility ("default"))) void TestFunc() {
7937   TestStruct::Init();
7939 _ACEOF
7940     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
7941         gccvisbroken=yes
7942     else
7943         case "$host_cpu" in
7944         i?86|x86_64)
7945             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
7946                 gccvisbroken=no
7947             else
7948                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
7949                     gccvisbroken=no
7950                 else
7951                     gccvisbroken=yes
7952                 fi
7953             fi
7954             ;;
7955         *)
7956             gccvisbroken=no
7957             ;;
7958         esac
7959     fi
7960     rm -f visibility.s visibility.cxx
7962     AC_MSG_RESULT([$gccvisbroken])
7963     if test "$gccvisbroken" = "yes"; then
7964         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
7965     fi
7967     CPPFLAGS="$save_CPPFLAGS"
7969     AC_LANG_POP([C++])
7972 dnl ===================================================================
7973 dnl  Clang++ tests
7974 dnl ===================================================================
7976 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
7977 if test "$GCC" = "yes"; then
7978     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
7979     AC_LANG_PUSH([C++])
7980     save_CXXFLAGS=$CXXFLAGS
7981     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
7982     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
7983     CXXFLAGS=$save_CXXFLAGS
7984     AC_LANG_POP([C++])
7985     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
7986         AC_MSG_RESULT([yes])
7987     else
7988         AC_MSG_RESULT([no])
7989     fi
7991 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
7993 dnl ===================================================================
7994 dnl Compiler plugins
7995 dnl ===================================================================
7997 COMPILER_PLUGINS=
7998 # currently only Clang
8000 if test "$COM_IS_CLANG" != "TRUE"; then
8001     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
8002         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
8003         enable_compiler_plugins=no
8004     fi
8007 COMPILER_PLUGINS_COM_IS_CLANG=
8008 if test "$COM_IS_CLANG" = "TRUE"; then
8009     if test -n "$enable_compiler_plugins"; then
8010         compiler_plugins="$enable_compiler_plugins"
8011     elif test -n "$ENABLE_DBGUTIL"; then
8012         compiler_plugins=test
8013     else
8014         compiler_plugins=no
8015     fi
8016     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
8017         if test "$CLANGVER" -lt 50002; then
8018             if test "$compiler_plugins" = yes; then
8019                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
8020             else
8021                 compiler_plugins=no
8022             fi
8023         fi
8024     fi
8025     if test "$compiler_plugins" != "no"; then
8026         dnl The prefix where Clang resides, override to where Clang resides if
8027         dnl using a source build:
8028         if test -z "$CLANGDIR"; then
8029             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $(printf '%s\n' $CXX | grep clang | head -n 1)))))
8030         fi
8031         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
8032         if test -z "$COMPILER_PLUGINS_CXX"; then
8033             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
8034         fi
8035         clangbindir=$CLANGDIR/bin
8036         if test "$build_os" = "cygwin"; then
8037             clangbindir=$(cygpath -u "$clangbindir")
8038         fi
8039         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
8040         if test -n "$LLVM_CONFIG"; then
8041             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
8042             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
8043             if test -z "$CLANGLIBDIR"; then
8044                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
8045             fi
8046             # Try if clang is built from source (in which case its includes are not together with llvm includes).
8047             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
8048             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
8049             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
8050                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
8051             fi
8052             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
8053             clangobjdir=$($LLVM_CONFIG --obj-root)
8054             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
8055                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
8056             fi
8057         fi
8058         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
8059         AC_LANG_PUSH([C++])
8060         save_CXX=$CXX
8061         save_CXXCPP=$CXXCPP
8062         save_CPPFLAGS=$CPPFLAGS
8063         save_CXXFLAGS=$CXXFLAGS
8064         save_LDFLAGS=$LDFLAGS
8065         save_LIBS=$LIBS
8066         CXX=$COMPILER_PLUGINS_CXX
8067         CXXCPP="$COMPILER_PLUGINS_CXX -E"
8068         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
8069         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
8070         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
8071             [COMPILER_PLUGINS=TRUE],
8072             [
8073             if test "$compiler_plugins" = "yes"; then
8074                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
8075             else
8076                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
8077                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
8078             fi
8079             ])
8080         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
8081         dnl comment in compilerplugins/Makefile-clang.mk:
8082         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
8083             LDFLAGS=""
8084             AC_MSG_CHECKING([for clang libraries to use])
8085             if test -z "$CLANGTOOLLIBS"; then
8086                 LIBS="-lclangTooling -lclangFrontend -lclangDriver -lclangParse -lclangSema -lclangEdit \
8087  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
8088                 AC_LINK_IFELSE([
8089                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8090                         [[ clang::FullSourceLoc().dump(); ]])
8091                 ],[CLANGTOOLLIBS="$LIBS"],[])
8092             fi
8093             if test -z "$CLANGTOOLLIBS"; then
8094                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
8095                 AC_LINK_IFELSE([
8096                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8097                         [[ clang::FullSourceLoc().dump(); ]])
8098                 ],[CLANGTOOLLIBS="$LIBS"],[])
8099             fi
8100             AC_MSG_RESULT([$CLANGTOOLLIBS])
8101             if test -z "$CLANGTOOLLIBS"; then
8102                 if test "$compiler_plugins" = "yes"; then
8103                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
8104                 else
8105                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
8106                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
8107                 fi
8108                 COMPILER_PLUGINS=
8109             fi
8110             if test -n "$COMPILER_PLUGINS"; then
8111                 if test -z "$CLANGSYSINCLUDE"; then
8112                     if test -n "$LLVM_CONFIG"; then
8113                         # Path to the clang system headers (no idea if there's a better way to get it).
8114                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/git\|svn//')/include
8115                     fi
8116                 fi
8117             fi
8118         fi
8119         CXX=$save_CXX
8120         CXXCPP=$save_CXXCPP
8121         CPPFLAGS=$save_CPPFLAGS
8122         CXXFLAGS=$save_CXXFLAGS
8123         LDFLAGS=$save_LDFLAGS
8124         LIBS="$save_LIBS"
8125         AC_LANG_POP([C++])
8127         AC_MSG_CHECKING([whether the compiler for building compilerplugins is actually Clang])
8128         AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
8129             #ifndef __clang__
8130             you lose
8131             #endif
8132             int foo=42;
8133             ]])],
8134             [AC_MSG_RESULT([yes])
8135              COMPILER_PLUGINS_COM_IS_CLANG=TRUE],
8136             [AC_MSG_RESULT([no])])
8137         AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8138     fi
8139 else
8140     if test "$enable_compiler_plugins" = "yes"; then
8141         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
8142     fi
8144 COMPILER_PLUGINS_ANALYZER_PCH=
8145 if test "$enable_compiler_plugins_analyzer_pch" != no; then
8146     COMPILER_PLUGINS_ANALYZER_PCH=TRUE
8148 AC_SUBST(COMPILER_PLUGINS)
8149 AC_SUBST(COMPILER_PLUGINS_ANALYZER_PCH)
8150 AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8151 AC_SUBST(COMPILER_PLUGINS_CXX)
8152 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
8153 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
8154 AC_SUBST(COMPILER_PLUGINS_DEBUG)
8155 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
8156 AC_SUBST(CLANGDIR)
8157 AC_SUBST(CLANGLIBDIR)
8158 AC_SUBST(CLANGTOOLLIBS)
8159 AC_SUBST(CLANGSYSINCLUDE)
8161 # Plugin to help linker.
8162 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
8163 # This makes --enable-lto build with clang work.
8164 AC_SUBST(LD_PLUGIN)
8166 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
8167 AC_SUBST(HAVE_POSIX_FALLOCATE)
8169 JITC_PROCESSOR_TYPE=""
8170 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
8171     # IBMs JDK needs this...
8172     JITC_PROCESSOR_TYPE=6
8173     export JITC_PROCESSOR_TYPE
8175 AC_SUBST([JITC_PROCESSOR_TYPE])
8177 # Misc Windows Stuff
8178 AC_ARG_WITH(ucrt-dir,
8179     AS_HELP_STRING([--with-ucrt-dir],
8180         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
8181         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
8182         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
8183             Windows6.1-KB2999226-x64.msu
8184             Windows6.1-KB2999226-x86.msu
8185             Windows8.1-KB2999226-x64.msu
8186             Windows8.1-KB2999226-x86.msu
8187             Windows8-RT-KB2999226-x64.msu
8188             Windows8-RT-KB2999226-x86.msu
8189         A zip archive including those files is available from Microsoft site:
8190         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
8193 UCRT_REDISTDIR="$with_ucrt_dir"
8194 if test $_os = "WINNT"; then
8195     find_msvc_x64_dlls
8196     for i in $PKGFORMAT; do
8197         if test "$i" = msi; then
8198             find_msms
8199             break
8200         fi
8201     done
8202     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
8203     MSVC_DLLS="$msvcdlls"
8204     test -n "$msmdir" && MSM_PATH=`win_short_path_for_make "$msmdir"`
8205     # MSVC 15.3 changed it to VC141
8206     if echo "$msvcdllpath" | grep -q "VC142.CRT$"; then
8207         SCPDEFS="$SCPDEFS -DWITH_VC142_REDIST"
8208     elif echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
8209         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
8210     else
8211         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
8212     fi
8214     if test "$UCRT_REDISTDIR" = "no"; then
8215         dnl explicitly disabled
8216         UCRT_REDISTDIR=""
8217     else
8218         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
8219                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
8220                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
8221                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
8222                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
8223                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
8224             UCRT_REDISTDIR=""
8225             if test -n "$PKGFORMAT"; then
8226                for i in $PKGFORMAT; do
8227                    case "$i" in
8228                    msi)
8229                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
8230                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
8231                        ;;
8232                    esac
8233                done
8234             fi
8235         fi
8236     fi
8239 AC_SUBST(UCRT_REDISTDIR)
8240 AC_SUBST(MSVC_DLL_PATH)
8241 AC_SUBST(MSVC_DLLS)
8242 AC_SUBST(MSM_PATH)
8245 dnl ===================================================================
8246 dnl Checks for Java
8247 dnl ===================================================================
8248 if test "$ENABLE_JAVA" != ""; then
8250     # Windows-specific tests
8251     if test "$build_os" = "cygwin"; then
8252         if test -z "$with_jdk_home"; then
8253             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
8254             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
8255             reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
8256             if test -n "$regvalue"; then
8257                 ver=$regvalue
8258                 reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
8259                 with_jdk_home=$regvalue
8260             fi
8261             howfound="found automatically"
8262         else
8263             with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
8264             howfound="you passed"
8265         fi
8267         if ! test -f "$with_jdk_home/lib/jvm.lib" -a -f "$with_jdk_home/bin/java.exe"; then
8268             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])
8269         fi
8270     fi
8272     # 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.
8273     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
8274     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
8275         with_jdk_home=`/usr/libexec/java_home`
8276     fi
8278     JAVA_HOME=; export JAVA_HOME
8279     if test -z "$with_jdk_home"; then
8280         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
8281     else
8282         _java_path="$with_jdk_home/bin/$with_java"
8283         dnl Check if there is a Java interpreter at all.
8284         if test -x "$_java_path"; then
8285             JAVAINTERPRETER=$_java_path
8286         else
8287             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
8288         fi
8289     fi
8291     dnl Check that the JDK found is correct architecture (at least 2 reasons to
8292     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
8293     dnl loaded by java to run JunitTests:
8294     if test "$build_os" = "cygwin" -a "$cross_compiling" != "yes"; then
8295         shortjdkhome=`cygpath -d "$with_jdk_home"`
8296         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
8297             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
8298             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8299         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
8300             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8301             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8302         fi
8304         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
8305             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
8306         fi
8307         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
8308     elif test "$cross_compiling" != "yes"; then
8309         case $CPUNAME in
8310             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
8311                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
8312                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
8313                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8314                 fi
8315                 ;;
8316             *) # assumption: everything else 32-bit
8317                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
8318                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8319                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8320                 fi
8321                 ;;
8322         esac
8323     fi
8326 dnl ===================================================================
8327 dnl Checks for JDK.
8328 dnl ===================================================================
8330 # Whether all the complexity here actually is needed any more or not, no idea.
8332 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8333     _gij_longver=0
8334     AC_MSG_CHECKING([the installed JDK])
8335     if test -n "$JAVAINTERPRETER"; then
8336         dnl java -version sends output to stderr!
8337         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
8338             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8339         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
8340             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8341         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
8342             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8343         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
8344             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8345         else
8346             JDK=sun
8348             dnl Sun JDK specific tests
8349             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
8350             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
8352             if test "$_jdk_ver" -lt 10900; then
8353                 AC_MSG_ERROR([JDK is too old, you need at least 9 ($_jdk_ver < 10900)])
8354             fi
8355             if test "$_jdk_ver" -gt 10900; then
8356                 JAVA_CLASSPATH_NOT_SET=TRUE
8357             fi
8359             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
8360             if test "$_os" = "WINNT"; then
8361                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
8362             fi
8363             AC_MSG_RESULT([found $JAVA_HOME (JDK $_jdk)])
8365             # set to limit VM usage for JunitTests
8366             JAVAIFLAGS=-Xmx64M
8367             # set to limit VM usage for javac
8368             JAVACFLAGS=-J-Xmx128M
8369         fi
8370     else
8371         AC_MSG_ERROR([Java not found. You need at least JDK 9])
8372     fi
8373 else
8374     if test -z "$ENABLE_JAVA"; then
8375         dnl Java disabled
8376         JAVA_HOME=
8377         export JAVA_HOME
8378     elif test "$cross_compiling" = "yes"; then
8379         # Just assume compatibility of build and host JDK
8380         JDK=$JDK_FOR_BUILD
8381         JAVAIFLAGS=$JAVAIFLAGS_FOR_BUILD
8382     fi
8385 dnl ===================================================================
8386 dnl Checks for javac
8387 dnl ===================================================================
8388 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8389     javacompiler="javac"
8390     : ${JAVA_SOURCE_VER=8}
8391     : ${JAVA_TARGET_VER=8}
8392     if test -z "$with_jdk_home"; then
8393         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
8394     else
8395         _javac_path="$with_jdk_home/bin/$javacompiler"
8396         dnl Check if there is a Java compiler at all.
8397         if test -x "$_javac_path"; then
8398             JAVACOMPILER=$_javac_path
8399         fi
8400     fi
8401     if test -z "$JAVACOMPILER"; then
8402         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
8403     fi
8404     if test "$build_os" = "cygwin"; then
8405         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
8406             JAVACOMPILER="${JAVACOMPILER}.exe"
8407         fi
8408         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
8409     fi
8412 dnl ===================================================================
8413 dnl Checks for javadoc
8414 dnl ===================================================================
8415 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8416     if test -z "$with_jdk_home"; then
8417         AC_PATH_PROG(JAVADOC, javadoc)
8418     else
8419         _javadoc_path="$with_jdk_home/bin/javadoc"
8420         dnl Check if there is a javadoc at all.
8421         if test -x "$_javadoc_path"; then
8422             JAVADOC=$_javadoc_path
8423         else
8424             AC_PATH_PROG(JAVADOC, javadoc)
8425         fi
8426     fi
8427     if test -z "$JAVADOC"; then
8428         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
8429     fi
8430     if test "$build_os" = "cygwin"; then
8431         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
8432             JAVADOC="${JAVADOC}.exe"
8433         fi
8434         JAVADOC=`win_short_path_for_make "$JAVADOC"`
8435     fi
8437     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
8438     JAVADOCISGJDOC="yes"
8439     fi
8441 AC_SUBST(JAVADOC)
8442 AC_SUBST(JAVADOCISGJDOC)
8444 if test "$ENABLE_JAVA" != "" -a \( "$cross_compiling" != "yes" -o -n "$with_jdk_home" \); then
8445     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
8446     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
8447         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
8448            # try to recover first by looking whether we have an alternative
8449            # system as in Debian or newer SuSEs where following /usr/bin/javac
8450            # over /etc/alternatives/javac leads to the right bindir where we
8451            # just need to strip a bit away to get a valid JAVA_HOME
8452            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
8453         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
8454             # maybe only one level of symlink (e.g. on Mac)
8455             JAVA_HOME=$(readlink $JAVACOMPILER)
8456             if test "$(dirname $JAVA_HOME)" = "."; then
8457                 # we've got no path to trim back
8458                 JAVA_HOME=""
8459             fi
8460         else
8461             # else warn
8462             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
8463             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
8464             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
8465             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
8466         fi
8467         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
8468         if test "$JAVA_HOME" != "/usr"; then
8469             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8470                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
8471                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
8472                 dnl Tiger already returns a JDK path...
8473                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
8474             else
8475                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
8476                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
8477                 dnl that checks which version to run
8478                 if test -f "$JAVA_HOME"; then
8479                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
8480                 fi
8481             fi
8482         fi
8483     fi
8484     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
8486     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
8487     if test -z "$JAVA_HOME"; then
8488         if test "x$with_jdk_home" = "x"; then
8489             cat > findhome.java <<_ACEOF
8490 [import java.io.File;
8492 class findhome
8494     public static void main(String args[])
8495     {
8496         String jrelocation = System.getProperty("java.home");
8497         File jre = new File(jrelocation);
8498         System.out.println(jre.getParent());
8499     }
8501 _ACEOF
8502             AC_MSG_CHECKING([if javac works])
8503             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
8504             AC_TRY_EVAL(javac_cmd)
8505             if test $? = 0 -a -f ./findhome.class; then
8506                 AC_MSG_RESULT([javac works])
8507             else
8508                 echo "configure: javac test failed" >&5
8509                 cat findhome.java >&5
8510                 AC_MSG_ERROR([javac does not work - java projects will not build!])
8511             fi
8512             AC_MSG_CHECKING([if gij knows its java.home])
8513             JAVA_HOME=`$JAVAINTERPRETER findhome`
8514             if test $? = 0 -a "$JAVA_HOME" != ""; then
8515                 AC_MSG_RESULT([$JAVA_HOME])
8516             else
8517                 echo "configure: java test failed" >&5
8518                 cat findhome.java >&5
8519                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
8520             fi
8521             # clean-up after ourselves
8522             rm -f ./findhome.java ./findhome.class
8523         else
8524             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
8525         fi
8526     fi
8528     # now check if $JAVA_HOME is really valid
8529     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8530         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
8531             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
8532             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
8533             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
8534             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
8535             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
8536             add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
8537         fi
8538     fi
8539     PathFormat "$JAVA_HOME"
8540     JAVA_HOME="$formatted_path"
8543 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
8544     "$_os" != Darwin
8545 then
8546     AC_MSG_CHECKING([for JAWT lib])
8547     if test "$_os" = WINNT; then
8548         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
8549         JAWTLIB=jawt.lib
8550     else
8551         case "$host_cpu" in
8552         arm*)
8553             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
8554             JAVA_ARCH=$my_java_arch
8555             ;;
8556         i*86)
8557             my_java_arch=i386
8558             ;;
8559         m68k)
8560             my_java_arch=m68k
8561             ;;
8562         powerpc)
8563             my_java_arch=ppc
8564             ;;
8565         powerpc64)
8566             my_java_arch=ppc64
8567             ;;
8568         powerpc64le)
8569             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
8570             JAVA_ARCH=$my_java_arch
8571             ;;
8572         sparc64)
8573             my_java_arch=sparcv9
8574             ;;
8575         x86_64)
8576             my_java_arch=amd64
8577             ;;
8578         *)
8579             my_java_arch=$host_cpu
8580             ;;
8581         esac
8582         # This is where JDK9 puts the library
8583         if test -e "$JAVA_HOME/lib/libjawt.so"; then
8584             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
8585         else
8586             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
8587         fi
8588         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
8589     fi
8590     AC_MSG_RESULT([$JAWTLIB])
8592 AC_SUBST(JAWTLIB)
8594 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
8595     case "$host_os" in
8597     aix*)
8598         JAVAINC="-I$JAVA_HOME/include"
8599         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
8600         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8601         ;;
8603     cygwin*|wsl*)
8604         JAVAINC="-I$JAVA_HOME/include/win32"
8605         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
8606         ;;
8608     darwin*|macos*)
8609         if test -d "$JAVA_HOME/include/darwin"; then
8610             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
8611         else
8612             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
8613         fi
8614         ;;
8616     dragonfly*)
8617         JAVAINC="-I$JAVA_HOME/include"
8618         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8619         ;;
8621     freebsd*)
8622         JAVAINC="-I$JAVA_HOME/include"
8623         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
8624         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
8625         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8626         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8627         ;;
8629     k*bsd*-gnu*)
8630         JAVAINC="-I$JAVA_HOME/include"
8631         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8632         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8633         ;;
8635     linux-gnu*)
8636         JAVAINC="-I$JAVA_HOME/include"
8637         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8638         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8639         ;;
8641     *netbsd*)
8642         JAVAINC="-I$JAVA_HOME/include"
8643         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
8644         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8645        ;;
8647     openbsd*)
8648         JAVAINC="-I$JAVA_HOME/include"
8649         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
8650         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8651         ;;
8653     solaris*)
8654         JAVAINC="-I$JAVA_HOME/include"
8655         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
8656         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8657         ;;
8658     esac
8660 SOLARINC="$SOLARINC $JAVAINC"
8662 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8663     JAVA_HOME_FOR_BUILD=$JAVA_HOME
8664     JAVAIFLAGS_FOR_BUILD=$JAVAIFLAGS
8665     JDK_FOR_BUILD=$JDK
8668 AC_SUBST(JAVACFLAGS)
8669 AC_SUBST(JAVACOMPILER)
8670 AC_SUBST(JAVAINTERPRETER)
8671 AC_SUBST(JAVAIFLAGS)
8672 AC_SUBST(JAVAIFLAGS_FOR_BUILD)
8673 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
8674 AC_SUBST(JAVA_HOME)
8675 AC_SUBST(JAVA_HOME_FOR_BUILD)
8676 AC_SUBST(JDK)
8677 AC_SUBST(JDK_FOR_BUILD)
8678 AC_SUBST(JAVA_SOURCE_VER)
8679 AC_SUBST(JAVA_TARGET_VER)
8682 dnl ===================================================================
8683 dnl Export file validation
8684 dnl ===================================================================
8685 AC_MSG_CHECKING([whether to enable export file validation])
8686 if test "$with_export_validation" != "no"; then
8687     if test -z "$ENABLE_JAVA"; then
8688         if test "$with_export_validation" = "yes"; then
8689             AC_MSG_ERROR([requested, but Java is disabled])
8690         else
8691             AC_MSG_RESULT([no, as Java is disabled])
8692         fi
8693     elif ! test -d "${SRC_ROOT}/schema"; then
8694         if test "$with_export_validation" = "yes"; then
8695             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
8696         else
8697             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
8698         fi
8699     else
8700         AC_MSG_RESULT([yes])
8701         AC_DEFINE(HAVE_EXPORT_VALIDATION)
8703         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
8704         if test -z "$ODFVALIDATOR"; then
8705             # remember to download the ODF toolkit with validator later
8706             AC_MSG_NOTICE([no odfvalidator found, will download it])
8707             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
8708             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
8710             # and fetch name of odfvalidator jar name from download.lst
8711             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
8712             AC_SUBST(ODFVALIDATOR_JAR)
8714             if test -z "$ODFVALIDATOR_JAR"; then
8715                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
8716             fi
8717         fi
8718         if test "$build_os" = "cygwin"; then
8719             # In case of Cygwin it will be executed from Windows,
8720             # so we need to run bash and absolute path to validator
8721             # so instead of "odfvalidator" it will be
8722             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
8723             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
8724         else
8725             ODFVALIDATOR="sh $ODFVALIDATOR"
8726         fi
8727         AC_SUBST(ODFVALIDATOR)
8730         AC_PATH_PROGS(OFFICEOTRON, officeotron)
8731         if test -z "$OFFICEOTRON"; then
8732             # remember to download the officeotron with validator later
8733             AC_MSG_NOTICE([no officeotron found, will download it])
8734             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
8735             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
8737             # and fetch name of officeotron jar name from download.lst
8738             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
8739             AC_SUBST(OFFICEOTRON_JAR)
8741             if test -z "$OFFICEOTRON_JAR"; then
8742                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
8743             fi
8744         else
8745             # check version of existing officeotron
8746             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
8747             if test 0"$OFFICEOTRON_VER" -lt 704; then
8748                 AC_MSG_ERROR([officeotron too old])
8749             fi
8750         fi
8751         if test "$build_os" = "cygwin"; then
8752             # In case of Cygwin it will be executed from Windows,
8753             # so we need to run bash and absolute path to validator
8754             # so instead of "odfvalidator" it will be
8755             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
8756             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
8757         else
8758             OFFICEOTRON="sh $OFFICEOTRON"
8759         fi
8760     fi
8761     AC_SUBST(OFFICEOTRON)
8762 else
8763     AC_MSG_RESULT([no])
8766 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
8767 if test "$with_bffvalidator" != "no"; then
8768     AC_DEFINE(HAVE_BFFVALIDATOR)
8770     if test "$with_export_validation" = "no"; then
8771         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
8772     fi
8774     if test "$with_bffvalidator" = "yes"; then
8775         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
8776     else
8777         BFFVALIDATOR="$with_bffvalidator"
8778     fi
8780     if test "$build_os" = "cygwin"; then
8781         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
8782             AC_MSG_RESULT($BFFVALIDATOR)
8783         else
8784             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8785         fi
8786     elif test -n "$BFFVALIDATOR"; then
8787         # We are not in Cygwin but need to run Windows binary with wine
8788         AC_PATH_PROGS(WINE, wine)
8790         # so swap in a shell wrapper that converts paths transparently
8791         BFFVALIDATOR_EXE="$BFFVALIDATOR"
8792         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
8793         AC_SUBST(BFFVALIDATOR_EXE)
8794         AC_MSG_RESULT($BFFVALIDATOR)
8795     else
8796         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8797     fi
8798     AC_SUBST(BFFVALIDATOR)
8799 else
8800     AC_MSG_RESULT([no])
8803 dnl ===================================================================
8804 dnl Check for C preprocessor to use
8805 dnl ===================================================================
8806 AC_MSG_CHECKING([which C preprocessor to use in idlc])
8807 SYSTEM_UCPP_IS_GCC=
8808 if test -n "$with_idlc_cpp"; then
8809     AC_MSG_RESULT([$with_idlc_cpp])
8810     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
8811     AC_MSG_CHECKING([if $with_idlc_cpp is GCC CPP])
8812     # ucpp will accept -v (to output version), warn about the others as unknown
8813     # and return 1 (due to -v)
8814     # gcc will accept -v (as verbose), --version (to output version) and -nostdinc
8815     # and return 0 (due to --version ) if all options are supported
8816     $SYSTEM_UCPP -v --version -nostdinc >/dev/null 2>/dev/null
8817     if test $? -eq 0;  then
8818         SYSTEM_UCPP_IS_GCC=TRUE
8819         AC_MSG_RESULT([yes])
8820     else
8821         AC_MSG_RESULT([no])
8822     fi
8823 else
8824     AC_MSG_RESULT([ucpp])
8825     AC_MSG_CHECKING([which ucpp tp use])
8826     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
8827         AC_MSG_RESULT([external])
8828         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
8829     else
8830         AC_MSG_RESULT([internal])
8831         BUILD_TYPE="$BUILD_TYPE UCPP"
8832     fi
8834 AC_SUBST(SYSTEM_UCPP)
8835 AC_SUBST(SYSTEM_UCPP_IS_GCC)
8837 dnl ===================================================================
8838 dnl Check for epm (not needed for Windows)
8839 dnl ===================================================================
8840 AC_MSG_CHECKING([whether to enable EPM for packing])
8841 if test "$enable_epm" = "yes"; then
8842     AC_MSG_RESULT([yes])
8843     if test "$_os" != "WINNT"; then
8844         if test $_os = Darwin; then
8845             EPM=internal
8846         elif test -n "$with_epm"; then
8847             EPM=$with_epm
8848         else
8849             AC_PATH_PROG(EPM, epm, no)
8850         fi
8851         if test "$EPM" = "no" -o "$EPM" = "internal"; then
8852             AC_MSG_NOTICE([EPM will be built.])
8853             BUILD_TYPE="$BUILD_TYPE EPM"
8854             EPM=${WORKDIR}/UnpackedTarball/epm/epm
8855         else
8856             # Gentoo has some epm which is something different...
8857             AC_MSG_CHECKING([whether the found epm is the right epm])
8858             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
8859                 AC_MSG_RESULT([yes])
8860             else
8861                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8862             fi
8863             AC_MSG_CHECKING([epm version])
8864             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
8865             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
8866                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
8867                 AC_MSG_RESULT([OK, >= 3.7])
8868             else
8869                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
8870                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8871             fi
8872         fi
8873     fi
8875     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
8876         AC_MSG_CHECKING([for rpm])
8877         for a in "$RPM" rpmbuild rpm; do
8878             $a --usage >/dev/null 2> /dev/null
8879             if test $? -eq 0; then
8880                 RPM=$a
8881                 break
8882             else
8883                 $a --version >/dev/null 2> /dev/null
8884                 if test $? -eq 0; then
8885                     RPM=$a
8886                     break
8887                 fi
8888             fi
8889         done
8890         if test -z "$RPM"; then
8891             AC_MSG_ERROR([not found])
8892         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
8893             RPM_PATH=`which $RPM`
8894             AC_MSG_RESULT([$RPM_PATH])
8895             SCPDEFS="$SCPDEFS -DWITH_RPM"
8896         else
8897             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
8898         fi
8899     fi
8900     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
8901         AC_PATH_PROG(DPKG, dpkg, no)
8902         if test "$DPKG" = "no"; then
8903             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
8904         fi
8905     fi
8906     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
8907        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8908         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
8909             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
8910                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
8911                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
8912                     AC_MSG_RESULT([yes])
8913                 else
8914                     AC_MSG_RESULT([no])
8915                     if echo "$PKGFORMAT" | $GREP -q rpm; then
8916                         _pt="rpm"
8917                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
8918                         add_warning "the rpms will need to be installed with --nodeps"
8919                     else
8920                         _pt="pkg"
8921                     fi
8922                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
8923                     add_warning "the ${_pt}s will not be relocatable"
8924                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
8925                                  relocation will work, you need to patch your epm with the
8926                                  patch in epm/epm-3.7.patch or build with
8927                                  --with-epm=internal which will build a suitable epm])
8928                 fi
8929             fi
8930         fi
8931     fi
8932     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8933         AC_PATH_PROG(PKGMK, pkgmk, no)
8934         if test "$PKGMK" = "no"; then
8935             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
8936         fi
8937     fi
8938     AC_SUBST(RPM)
8939     AC_SUBST(DPKG)
8940     AC_SUBST(PKGMK)
8941 else
8942     for i in $PKGFORMAT; do
8943         case "$i" in
8944         aix | bsd | deb | pkg | rpm | native | portable)
8945             AC_MSG_ERROR(
8946                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
8947             ;;
8948         esac
8949     done
8950     AC_MSG_RESULT([no])
8951     EPM=NO
8953 AC_SUBST(EPM)
8955 ENABLE_LWP=
8956 if test "$enable_lotuswordpro" = "yes"; then
8957     ENABLE_LWP="TRUE"
8959 AC_SUBST(ENABLE_LWP)
8961 dnl ===================================================================
8962 dnl Check for building ODK
8963 dnl ===================================================================
8964 if test "$enable_odk" != yes; then
8965     unset DOXYGEN
8966 else
8967     if test "$with_doxygen" = no; then
8968         AC_MSG_CHECKING([for doxygen])
8969         unset DOXYGEN
8970         AC_MSG_RESULT([no])
8971     else
8972         if test "$with_doxygen" = yes; then
8973             AC_PATH_PROG([DOXYGEN], [doxygen])
8974             if test -z "$DOXYGEN"; then
8975                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
8976             fi
8977             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
8978                 if ! dot -V 2>/dev/null; then
8979                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
8980                 fi
8981             fi
8982         else
8983             AC_MSG_CHECKING([for doxygen])
8984             DOXYGEN=$with_doxygen
8985             AC_MSG_RESULT([$DOXYGEN])
8986         fi
8987         if test -n "$DOXYGEN"; then
8988             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
8989             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
8990             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
8991                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
8992             fi
8993         fi
8994     fi
8996 AC_SUBST([DOXYGEN])
8998 AC_MSG_CHECKING([whether to build the ODK])
8999 if test "$enable_odk" = yes; then
9000     AC_MSG_RESULT([yes])
9001     BUILD_TYPE="$BUILD_TYPE ODK"
9002 else
9003     AC_MSG_RESULT([no])
9006 dnl ===================================================================
9007 dnl Check for system zlib
9008 dnl ===================================================================
9009 if test "$with_system_zlib" = "auto"; then
9010     case "$_os" in
9011     WINNT)
9012         with_system_zlib="$with_system_libs"
9013         ;;
9014     *)
9015         with_system_zlib=yes
9016         ;;
9017     esac
9020 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
9021 dnl and has no pkg-config for it at least on some tinderboxes,
9022 dnl so leaving that out for now
9023 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
9024 AC_MSG_CHECKING([which zlib to use])
9025 if test "$with_system_zlib" = "yes"; then
9026     AC_MSG_RESULT([external])
9027     SYSTEM_ZLIB=TRUE
9028     AC_CHECK_HEADER(zlib.h, [],
9029         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
9030     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
9031         [AC_MSG_ERROR(zlib not found or functional)], [])
9032 else
9033     AC_MSG_RESULT([internal])
9034     SYSTEM_ZLIB=
9035     BUILD_TYPE="$BUILD_TYPE ZLIB"
9036     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
9037     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
9039 AC_SUBST(ZLIB_CFLAGS)
9040 AC_SUBST(ZLIB_LIBS)
9041 AC_SUBST(SYSTEM_ZLIB)
9043 dnl ===================================================================
9044 dnl Check for system jpeg
9045 dnl ===================================================================
9046 AC_MSG_CHECKING([which libjpeg to use])
9047 if test "$with_system_jpeg" = "yes"; then
9048     AC_MSG_RESULT([external])
9049     SYSTEM_LIBJPEG=TRUE
9050     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
9051         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
9052     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
9053         [AC_MSG_ERROR(jpeg library not found or functional)], [])
9054 else
9055     SYSTEM_LIBJPEG=
9056     AC_MSG_RESULT([internal, libjpeg-turbo])
9057     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
9058     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
9059     if test "$COM" = "MSC"; then
9060         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
9061     else
9062         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
9063     fi
9065     case "$host_cpu" in
9066     x86_64 | amd64 | i*86 | x86 | ia32)
9067         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
9068         if test -z "$NASM" -a "$build_os" = "cygwin"; then
9069             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
9070                 NASM="$LODE_HOME/opt/bin/nasm"
9071             elif test -x "/opt/lo/bin/nasm"; then
9072                 NASM="/opt/lo/bin/nasm"
9073             fi
9074         fi
9076         if test -n "$NASM"; then
9077             AC_MSG_CHECKING([for object file format of host system])
9078             case "$host_os" in
9079               cygwin* | mingw* | pw32* | wsl*)
9080                 case "$host_cpu" in
9081                   x86_64)
9082                     objfmt='Win64-COFF'
9083                     ;;
9084                   *)
9085                     objfmt='Win32-COFF'
9086                     ;;
9087                 esac
9088               ;;
9089               msdosdjgpp* | go32*)
9090                 objfmt='COFF'
9091               ;;
9092               os2-emx*) # not tested
9093                 objfmt='MSOMF' # obj
9094               ;;
9095               linux*coff* | linux*oldld*)
9096                 objfmt='COFF' # ???
9097               ;;
9098               linux*aout*)
9099                 objfmt='a.out'
9100               ;;
9101               linux*)
9102                 case "$host_cpu" in
9103                   x86_64)
9104                     objfmt='ELF64'
9105                     ;;
9106                   *)
9107                     objfmt='ELF'
9108                     ;;
9109                 esac
9110               ;;
9111               kfreebsd* | freebsd* | netbsd* | openbsd*)
9112                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
9113                   objfmt='BSD-a.out'
9114                 else
9115                   case "$host_cpu" in
9116                     x86_64 | amd64)
9117                       objfmt='ELF64'
9118                       ;;
9119                     *)
9120                       objfmt='ELF'
9121                       ;;
9122                   esac
9123                 fi
9124               ;;
9125               solaris* | sunos* | sysv* | sco*)
9126                 case "$host_cpu" in
9127                   x86_64)
9128                     objfmt='ELF64'
9129                     ;;
9130                   *)
9131                     objfmt='ELF'
9132                     ;;
9133                 esac
9134               ;;
9135               darwin* | rhapsody* | nextstep* | openstep* | macos*)
9136                 case "$host_cpu" in
9137                   x86_64)
9138                     objfmt='Mach-O64'
9139                     ;;
9140                   *)
9141                     objfmt='Mach-O'
9142                     ;;
9143                 esac
9144               ;;
9145               *)
9146                 objfmt='ELF ?'
9147               ;;
9148             esac
9150             AC_MSG_RESULT([$objfmt])
9151             if test "$objfmt" = 'ELF ?'; then
9152               objfmt='ELF'
9153               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
9154             fi
9156             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
9157             case "$objfmt" in
9158               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
9159               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
9160               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
9161               COFF)       NAFLAGS='-fcoff -DCOFF';;
9162               a.out)      NAFLAGS='-faout -DAOUT';;
9163               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
9164               ELF)        NAFLAGS='-felf -DELF';;
9165               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
9166               RDF)        NAFLAGS='-frdf -DRDF';;
9167               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
9168               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
9169             esac
9170             AC_MSG_RESULT([$NAFLAGS])
9172             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
9173             cat > conftest.asm << EOF
9174             [%line __oline__ "configure"
9175                     section .text
9176                     global  _main,main
9177             _main:
9178             main:   xor     eax,eax
9179                     ret
9180             ]
9182             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
9183             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
9184               AC_MSG_RESULT(yes)
9185             else
9186               echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
9187               cat conftest.asm >&AS_MESSAGE_LOG_FD
9188               rm -rf conftest*
9189               AC_MSG_RESULT(no)
9190               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
9191               NASM=""
9192             fi
9194         fi
9196         if test -z "$NASM"; then
9197 cat << _EOS
9198 ****************************************************************************
9199 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
9200 To get one please:
9202 _EOS
9203             if test "$build_os" = "cygwin"; then
9204 cat << _EOS
9205 install a pre-compiled binary for Win32
9207 mkdir -p /opt/lo/bin
9208 cd /opt/lo/bin
9209 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
9210 chmod +x nasm
9212 or get and install one from http://www.nasm.us/
9214 Then re-run autogen.sh
9216 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
9217 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
9219 _EOS
9220             else
9221 cat << _EOS
9222 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
9224 _EOS
9225             fi
9226             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
9227             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
9228         fi
9229       ;;
9230     esac
9233 AC_SUBST(NASM)
9234 AC_SUBST(LIBJPEG_CFLAGS)
9235 AC_SUBST(LIBJPEG_LIBS)
9236 AC_SUBST(SYSTEM_LIBJPEG)
9238 dnl ===================================================================
9239 dnl Check for system clucene
9240 dnl ===================================================================
9241 dnl we should rather be using
9242 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
9243 dnl but the contribs-lib check seems tricky
9244 if test "$enable_xmlhelp" = yes -o "$enable_extension_integration" = yes; then
9245 AC_MSG_CHECKING([which clucene to use])
9246 if test "$with_system_clucene" = "yes"; then
9247     AC_MSG_RESULT([external])
9248     SYSTEM_CLUCENE=TRUE
9249     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
9250     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
9251     FilterLibs "${CLUCENE_LIBS}"
9252     CLUCENE_LIBS="${filteredlibs}"
9253     AC_LANG_PUSH([C++])
9254     save_CXXFLAGS=$CXXFLAGS
9255     save_CPPFLAGS=$CPPFLAGS
9256     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
9257     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
9258     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
9259     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
9260     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
9261                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
9262     CXXFLAGS=$save_CXXFLAGS
9263     CPPFLAGS=$save_CPPFLAGS
9264     AC_LANG_POP([C++])
9266     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
9267 else
9268     AC_MSG_RESULT([internal])
9269     SYSTEM_CLUCENE=
9270     BUILD_TYPE="$BUILD_TYPE CLUCENE"
9273 AC_SUBST(SYSTEM_CLUCENE)
9274 AC_SUBST(CLUCENE_CFLAGS)
9275 AC_SUBST(CLUCENE_LIBS)
9277 dnl ===================================================================
9278 dnl Check for system expat
9279 dnl ===================================================================
9280 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
9282 dnl ===================================================================
9283 dnl Check for system xmlsec
9284 dnl ===================================================================
9285 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
9287 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
9288 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
9289     ENABLE_EOT="TRUE"
9290     AC_DEFINE([ENABLE_EOT])
9291     AC_MSG_RESULT([yes])
9293     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
9294 else
9295     ENABLE_EOT=
9296     AC_MSG_RESULT([no])
9298 AC_SUBST([ENABLE_EOT])
9300 dnl ===================================================================
9301 dnl Check for DLP libs
9302 dnl ===================================================================
9303 AS_IF([test "$COM" = "MSC"],
9304       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
9305       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
9307 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
9309 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
9311 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
9313 AS_IF([test "$COM" = "MSC"],
9314       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
9315       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
9317 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
9319 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
9321 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
9322 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.12])
9324 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
9326 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
9328 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
9330 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
9331 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.19])
9333 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
9334 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.10])
9336 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
9338 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
9339 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
9341 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
9343 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
9345 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
9347 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
9349 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
9350 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.7])
9352 dnl ===================================================================
9353 dnl Check for system lcms2
9354 dnl ===================================================================
9355 if test "$with_system_lcms2" != "yes"; then
9356     SYSTEM_LCMS2=
9358 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
9359 if test "$GCC" = "yes"; then
9360     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
9362 if test "$COM" = "MSC"; then # override the above
9363     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
9366 dnl ===================================================================
9367 dnl Check for system cppunit
9368 dnl ===================================================================
9369 if test "$_os" != "Android" ; then
9370     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
9373 dnl ===================================================================
9374 dnl Check whether freetype is available
9375 dnl ===================================================================
9376 if test "$using_freetype_fontconfig" = yes; then
9377     AC_MSG_CHECKING([which freetype to use])
9379 if test "$using_freetype_fontconfig" = yes -a "$test_system_freetype" != no; then
9380     AC_MSG_RESULT([external])
9381     # FreeType has 3 different kinds of versions
9382     # * release, like 2.4.10
9383     # * libtool, like 13.0.7 (this what pkg-config returns)
9384     # * soname
9385     # FreeType's docs/VERSION.DLL provides a table mapping between the three
9386     #
9387     # 9.9.3 is 2.2.0
9388     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
9389     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9390     FilterLibs "${FREETYPE_LIBS}"
9391     FREETYPE_LIBS="${filteredlibs}"
9392     SYSTEM_FREETYPE=TRUE
9393 elif test "$using_freetype_fontconfig" = yes; then
9394     AC_MSG_RESULT([internal])
9395     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
9396     if test "x$ac_config_site_64bit_host" = xYES; then
9397         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
9398     else
9399         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
9400     fi
9401     BUILD_TYPE="$BUILD_TYPE FREETYPE"
9403 AC_SUBST(FREETYPE_CFLAGS)
9404 AC_SUBST(FREETYPE_LIBS)
9405 AC_SUBST([SYSTEM_FREETYPE])
9407 # ===================================================================
9408 # Check for system libxslt
9409 # to prevent incompatibilities between internal libxml2 and external libxslt,
9410 # or vice versa, use with_system_libxml here
9411 # ===================================================================
9412 if test "$with_system_libxml" = "auto"; then
9413     case "$_os" in
9414     WINNT|iOS|Android)
9415         with_system_libxml="$with_system_libs"
9416         ;;
9417     Emscripten)
9418         with_system_libxml=no
9419         ;;
9420     *)
9421         if test "$enable_fuzzers" != "yes"; then
9422             with_system_libxml=yes
9423         else
9424             with_system_libxml=no
9425         fi
9426         ;;
9427     esac
9430 AC_MSG_CHECKING([which libxslt to use])
9431 if test "$with_system_libxml" = "yes"; then
9432     AC_MSG_RESULT([external])
9433     SYSTEM_LIBXSLT=TRUE
9434     if test "$_os" = "Darwin"; then
9435         dnl make sure to use SDK path
9436         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9437         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
9438         dnl omit -L/usr/lib
9439         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
9440         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
9441     else
9442         PKG_CHECK_MODULES(LIBXSLT, libxslt)
9443         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9444         FilterLibs "${LIBXSLT_LIBS}"
9445         LIBXSLT_LIBS="${filteredlibs}"
9446         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
9447         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9448         FilterLibs "${LIBEXSLT_LIBS}"
9449         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
9450     fi
9452     dnl Check for xsltproc
9453     AC_PATH_PROG(XSLTPROC, xsltproc, no)
9454     if test "$XSLTPROC" = "no"; then
9455         AC_MSG_ERROR([xsltproc is required])
9456     fi
9457 else
9458     AC_MSG_RESULT([internal])
9459     SYSTEM_LIBXSLT=
9460     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
9462 AC_SUBST(SYSTEM_LIBXSLT)
9463 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
9464     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
9466 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
9468 AC_SUBST(LIBEXSLT_CFLAGS)
9469 AC_SUBST(LIBEXSLT_LIBS)
9470 AC_SUBST(LIBXSLT_CFLAGS)
9471 AC_SUBST(LIBXSLT_LIBS)
9472 AC_SUBST(XSLTPROC)
9474 # ===================================================================
9475 # Check for system libxml
9476 # ===================================================================
9477 AC_MSG_CHECKING([which libxml to use])
9478 if test "$with_system_libxml" = "yes"; then
9479     AC_MSG_RESULT([external])
9480     SYSTEM_LIBXML=TRUE
9481     if test "$_os" = "Darwin"; then
9482         dnl make sure to use SDK path
9483         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9484         dnl omit -L/usr/lib
9485         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
9486     elif test $_os = iOS; then
9487         dnl make sure to use SDK path
9488         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
9489         LIBXML_CFLAGS="-I$usr/include/libxml2"
9490         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
9491     else
9492         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
9493         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9494         FilterLibs "${LIBXML_LIBS}"
9495         LIBXML_LIBS="${filteredlibs}"
9496     fi
9498     dnl Check for xmllint
9499     AC_PATH_PROG(XMLLINT, xmllint, no)
9500     if test "$XMLLINT" = "no"; then
9501         AC_MSG_ERROR([xmllint is required])
9502     fi
9503 else
9504     AC_MSG_RESULT([internal])
9505     SYSTEM_LIBXML=
9506     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
9507     if test "$COM" = "MSC"; then
9508         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9509     fi
9510     if test "$COM" = "MSC"; then
9511         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
9512     else
9513         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
9514         if test "$_os" = Android; then
9515             LIBXML_LIBS="$LIBXML_LIBS -lm"
9516         fi
9517     fi
9518     BUILD_TYPE="$BUILD_TYPE LIBXML2"
9520 AC_SUBST(SYSTEM_LIBXML)
9521 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
9522     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
9524 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
9525 AC_SUBST(LIBXML_CFLAGS)
9526 AC_SUBST(LIBXML_LIBS)
9527 AC_SUBST(XMLLINT)
9529 # =====================================================================
9530 # Checking for a Python interpreter with version >= 3.3.
9531 # Optionally user can pass an option to configure, i. e.
9532 # ./configure PYTHON=/usr/bin/python
9533 # =====================================================================
9534 if test $_os = Darwin -a "$enable_python" != no -a "$enable_python" != fully-internal -a "$enable_python" != internal -a "$enable_python" != system; then
9535     # Only allowed choices for macOS are 'no', 'internal' (default), and 'fully-internal'
9536     # unless PYTHON is defined as above which allows 'system'
9537     enable_python=internal
9539 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
9540     if test -n "$PYTHON"; then
9541         PYTHON_FOR_BUILD=$PYTHON
9542     else
9543         # This allows a lack of system python with no error, we use internal one in that case.
9544         AM_PATH_PYTHON([3.3],, [:])
9545         # Clean PYTHON_VERSION checked below if cross-compiling
9546         PYTHON_VERSION=""
9547         if test "$PYTHON" != ":"; then
9548             PYTHON_FOR_BUILD=$PYTHON
9549         fi
9550     fi
9552 AC_SUBST(PYTHON_FOR_BUILD)
9554 # Checks for Python to use for Pyuno
9555 AC_MSG_CHECKING([which Python to use for Pyuno])
9556 case "$enable_python" in
9557 no|disable)
9558     if test -z $PYTHON_FOR_BUILD; then
9559         # Python is required to build LibreOffice. In theory we could separate the build-time Python
9560         # requirement from the choice whether to include Python stuff in the installer, but why
9561         # bother?
9562         if test "$cross_compiling" = yes; then
9563             enable_python=system
9564         else
9565             AC_MSG_ERROR([Python is required at build time.])
9566         fi
9567     fi
9568     enable_python=no
9569     AC_MSG_RESULT([none])
9570     ;;
9571 ""|yes|auto)
9572     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
9573         AC_MSG_RESULT([no, overridden by --disable-scripting])
9574         enable_python=no
9575     elif test $build_os = cygwin; then
9576         dnl When building on Windows we don't attempt to use any installed
9577         dnl "system"  Python.
9578         AC_MSG_RESULT([fully internal])
9579         enable_python=internal
9580     elif test "$cross_compiling" = yes; then
9581         AC_MSG_RESULT([system])
9582         enable_python=system
9583     else
9584         # Unset variables set by the above AM_PATH_PYTHON so that
9585         # we actually do check anew.
9586         AC_MSG_RESULT([])
9587         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
9588         AM_PATH_PYTHON([3.3],, [:])
9589         AC_MSG_CHECKING([which Python to use for Pyuno])
9590         if test "$PYTHON" = ":"; then
9591             if test -z "$PYTHON_FOR_BUILD"; then
9592                 AC_MSG_RESULT([fully internal])
9593             else
9594                 AC_MSG_RESULT([internal])
9595             fi
9596             enable_python=internal
9597         else
9598             AC_MSG_RESULT([system])
9599             enable_python=system
9600         fi
9601     fi
9602     ;;
9603 internal)
9604     AC_MSG_RESULT([internal])
9605     ;;
9606 fully-internal)
9607     AC_MSG_RESULT([fully internal])
9608     enable_python=internal
9609     ;;
9610 system)
9611     AC_MSG_RESULT([system])
9612     if test "$_os" = Darwin -a -z "$PYTHON"; then
9613         AC_MSG_ERROR([--enable-python=system doesn't work on macOS because the version provided is obsolete])
9614     fi
9615     ;;
9617     AC_MSG_ERROR([Incorrect --enable-python option])
9618     ;;
9619 esac
9621 if test $enable_python != no; then
9622     BUILD_TYPE="$BUILD_TYPE PYUNO"
9625 if test $enable_python = system; then
9626     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
9627         # Fallback: Accept these in the environment, or as set above
9628         # for MacOSX.
9629         :
9630     elif test "$cross_compiling" != yes; then
9631         # Unset variables set by the above AM_PATH_PYTHON so that
9632         # we actually do check anew.
9633         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
9634         # This causes an error if no python command is found
9635         AM_PATH_PYTHON([3.3])
9636         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
9637         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
9638         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
9639         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
9640         if test -z "$PKG_CONFIG"; then
9641             PYTHON_CFLAGS="-I$python_include"
9642             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
9643         elif $PKG_CONFIG --exists python-$python_version-embed; then
9644             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
9645             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
9646         elif $PKG_CONFIG --exists python-$python_version; then
9647             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
9648             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
9649         else
9650             PYTHON_CFLAGS="-I$python_include"
9651             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
9652         fi
9653         FilterLibs "${PYTHON_LIBS}"
9654         PYTHON_LIBS="${filteredlibs}"
9655     else
9656         dnl How to find out the cross-compilation Python installation path?
9657         AC_MSG_CHECKING([for python version])
9658         AS_IF([test -n "$PYTHON_VERSION"],
9659               [AC_MSG_RESULT([$PYTHON_VERSION])],
9660               [AC_MSG_RESULT([not found])
9661                AC_MSG_ERROR([no usable python found])])
9662         test -n "$PYTHON_CFLAGS" && break
9663     fi
9665     dnl Check if the headers really work
9666     save_CPPFLAGS="$CPPFLAGS"
9667     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
9668     AC_CHECK_HEADER(Python.h)
9669     CPPFLAGS="$save_CPPFLAGS"
9671     # let the PYTHON_FOR_BUILD match the same python installation that
9672     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
9673     # better for PythonTests.
9674     PYTHON_FOR_BUILD=$PYTHON
9677 if test "$with_lxml" != no; then
9678     if test -z "$PYTHON_FOR_BUILD"; then
9679         case $build_os in
9680             cygwin)
9681                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
9682                 ;;
9683             *)
9684                 if test "$cross_compiling" != yes ; then
9685                     BUILD_TYPE="$BUILD_TYPE LXML"
9686                 fi
9687                 ;;
9688         esac
9689     else
9690         AC_MSG_CHECKING([for python lxml])
9691         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
9692             AC_MSG_RESULT([yes])
9693         else
9694             case $build_os in
9695                 cygwin)
9696                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
9697                     ;;
9698                 *)
9699                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
9700                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
9701                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
9702                         else
9703                             BUILD_TYPE="$BUILD_TYPE LXML"
9704                             AC_MSG_RESULT([no, using internal lxml])
9705                         fi
9706                     else
9707                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
9708                     fi
9709                     ;;
9710             esac
9711         fi
9712     fi
9715 dnl By now enable_python should be "system", "internal" or "no"
9716 case $enable_python in
9717 system)
9718     SYSTEM_PYTHON=TRUE
9720     if test "x$ac_cv_header_Python_h" != "xyes"; then
9721        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
9722     fi
9724     AC_LANG_PUSH(C)
9725     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
9726     AC_MSG_CHECKING([for correct python library version])
9727        AC_RUN_IFELSE([AC_LANG_SOURCE([[
9728 #include <Python.h>
9730 int main(int argc, char **argv) {
9731    if ((PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
9732    else return 1;
9734        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3])],[AC_MSG_RESULT([skipped; cross-compiling])])
9735     AC_LANG_POP(C)
9737     dnl FIXME Check if the Python library can be linked with, too?
9738     ;;
9740 internal)
9741     SYSTEM_PYTHON=
9742     PYTHON_VERSION_MAJOR=3
9743     PYTHON_VERSION_MINOR=8
9744     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.10
9745     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
9746         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
9747     fi
9748     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
9749     BUILD_TYPE="$BUILD_TYPE PYTHON"
9750     if test "$OS" = LINUX -o "$OS" = WNT ; then
9751         BUILD_TYPE="$BUILD_TYPE LIBFFI"
9752     fi
9753     # Embedded Python dies without Home set
9754     if test "$HOME" = ""; then
9755         export HOME=""
9756     fi
9757     ;;
9759     DISABLE_PYTHON=TRUE
9760     SYSTEM_PYTHON=
9761     ;;
9763     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
9764     ;;
9765 esac
9767 AC_SUBST(DISABLE_PYTHON)
9768 AC_SUBST(SYSTEM_PYTHON)
9769 AC_SUBST(PYTHON_CFLAGS)
9770 AC_SUBST(PYTHON_LIBS)
9771 AC_SUBST(PYTHON_VERSION)
9772 AC_SUBST(PYTHON_VERSION_MAJOR)
9773 AC_SUBST(PYTHON_VERSION_MINOR)
9775 AC_MSG_CHECKING([whether to build LibreLogo])
9776 case "$enable_python" in
9777 no|disable)
9778     AC_MSG_RESULT([no; Python disabled])
9779     ;;
9781     if test "${enable_librelogo}" = "no"; then
9782         AC_MSG_RESULT([no])
9783     else
9784         AC_MSG_RESULT([yes])
9785         BUILD_TYPE="${BUILD_TYPE} LIBRELOGO"
9786         AC_DEFINE([ENABLE_LIBRELOGO],1)
9787     fi
9788     ;;
9789 esac
9790 AC_SUBST(ENABLE_LIBRELOGO)
9792 ENABLE_MARIADBC=
9793 MARIADBC_MAJOR=1
9794 MARIADBC_MINOR=0
9795 MARIADBC_MICRO=2
9796 AC_MSG_CHECKING([whether to build the MariaDB/MySQL SDBC driver])
9797 if test "x$enable_mariadb_sdbc" != "xno" -a "$enable_mpl_subset" != "yes"; then
9798     ENABLE_MARIADBC=TRUE
9799     AC_MSG_RESULT([yes])
9800     BUILD_TYPE="$BUILD_TYPE MARIADBC"
9801 else
9802     AC_MSG_RESULT([no])
9804 AC_SUBST(ENABLE_MARIADBC)
9805 AC_SUBST(MARIADBC_MAJOR)
9806 AC_SUBST(MARIADBC_MINOR)
9807 AC_SUBST(MARIADBC_MICRO)
9809 if test "$ENABLE_MARIADBC" = "TRUE"; then
9810     dnl ===================================================================
9811     dnl Check for system MariaDB
9812     dnl ===================================================================
9813     AC_MSG_CHECKING([which MariaDB to use])
9814     if test "$with_system_mariadb" = "yes"; then
9815         AC_MSG_RESULT([external])
9816         SYSTEM_MARIADB_CONNECTOR_C=TRUE
9817         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
9818         if test -z "$MARIADBCONFIG"; then
9819             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
9820             if test -z "$MARIADBCONFIG"; then
9821                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
9822                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
9823             fi
9824         fi
9825         AC_MSG_CHECKING([MariaDB version])
9826         MARIADB_VERSION=`$MARIADBCONFIG --version`
9827         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
9828         if test "$MARIADB_MAJOR" -ge "5"; then
9829             AC_MSG_RESULT([OK])
9830         else
9831             AC_MSG_ERROR([too old, use 5.0.x or later])
9832         fi
9833         AC_MSG_CHECKING([for MariaDB Client library])
9834         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
9835         if test "$COM_IS_CLANG" = TRUE; then
9836             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
9837         fi
9838         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
9839         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
9840         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
9841         dnl linux32:
9842         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
9843             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
9844             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
9845                 | sed -e 's|/lib64/|/lib/|')
9846         fi
9847         FilterLibs "${MARIADB_LIBS}"
9848         MARIADB_LIBS="${filteredlibs}"
9849         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
9850         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
9851         if test "$enable_bundle_mariadb" = "yes"; then
9852             AC_MSG_RESULT([yes])
9853             BUNDLE_MARIADB_CONNECTOR_C=TRUE
9854             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
9856 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
9858 /g' | grep -E '(mysqlclient|mariadb)')
9859             if test "$_os" = "Darwin"; then
9860                 LIBMARIADB=${LIBMARIADB}.dylib
9861             elif test "$_os" = "WINNT"; then
9862                 LIBMARIADB=${LIBMARIADB}.dll
9863             else
9864                 LIBMARIADB=${LIBMARIADB}.so
9865             fi
9866             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
9867             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
9868             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
9869                 AC_MSG_RESULT([found.])
9870                 PathFormat "$LIBMARIADB_PATH"
9871                 LIBMARIADB_PATH="$formatted_path"
9872             else
9873                 AC_MSG_ERROR([not found.])
9874             fi
9875         else
9876             AC_MSG_RESULT([no])
9877             BUNDLE_MARIADB_CONNECTOR_C=
9878         fi
9879     else
9880         AC_MSG_RESULT([internal])
9881         SYSTEM_MARIADB_CONNECTOR_C=
9882         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
9883         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
9884         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
9885     fi
9887     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
9888     AC_SUBST(MARIADB_CFLAGS)
9889     AC_SUBST(MARIADB_LIBS)
9890     AC_SUBST(LIBMARIADB)
9891     AC_SUBST(LIBMARIADB_PATH)
9892     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
9895 dnl ===================================================================
9896 dnl Check for system hsqldb
9897 dnl ===================================================================
9898 if test "$with_java" != "no" -a "$cross_compiling" != "yes"; then
9899     HSQLDB_USE_JDBC_4_1=
9900     AC_MSG_CHECKING([which hsqldb to use])
9901     if test "$with_system_hsqldb" = "yes"; then
9902         AC_MSG_RESULT([external])
9903         SYSTEM_HSQLDB=TRUE
9904         if test -z $HSQLDB_JAR; then
9905             HSQLDB_JAR=/usr/share/java/hsqldb.jar
9906         fi
9907         if ! test -f $HSQLDB_JAR; then
9908                AC_MSG_ERROR(hsqldb.jar not found.)
9909         fi
9910         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
9911         export HSQLDB_JAR
9912         if $PERL -e \
9913            'use Archive::Zip;
9914             my $file = "$ENV{'HSQLDB_JAR'}";
9915             my $zip = Archive::Zip->new( $file );
9916             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
9917             if ( $mf =~ m/Specification-Version: 1.8.*/ )
9918             {
9919                 push @l, split(/\n/, $mf);
9920                 foreach my $line (@l)
9921                 {
9922                     if ($line =~ m/Specification-Version:/)
9923                     {
9924                         ($t, $version) = split (/:/,$line);
9925                         $version =~ s/^\s//;
9926                         ($a, $b, $c, $d) = split (/\./,$version);
9927                         if ($c == "0" && $d > "8")
9928                         {
9929                             exit 0;
9930                         }
9931                         else
9932                         {
9933                             exit 1;
9934                         }
9935                     }
9936                 }
9937             }
9938             else
9939             {
9940                 exit 1;
9941             }'; then
9942             AC_MSG_RESULT([yes])
9943         else
9944             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
9945         fi
9946     else
9947         AC_MSG_RESULT([internal])
9948         SYSTEM_HSQLDB=
9949         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9950         NEED_ANT=TRUE
9951         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
9952         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
9953         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
9954             AC_MSG_RESULT([yes])
9955             HSQLDB_USE_JDBC_4_1=TRUE
9956         else
9957             AC_MSG_RESULT([no])
9958         fi
9959     fi
9960 else
9961     if test "$with_java" != "no" -a -z "$HSQLDB_JAR"; then
9962         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9963     fi
9965 AC_SUBST(SYSTEM_HSQLDB)
9966 AC_SUBST(HSQLDB_JAR)
9967 AC_SUBST([HSQLDB_USE_JDBC_4_1])
9969 dnl ===================================================================
9970 dnl Check for PostgreSQL stuff
9971 dnl ===================================================================
9972 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
9973 if test "x$enable_postgresql_sdbc" != "xno"; then
9974     AC_MSG_RESULT([yes])
9975     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
9977     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
9978         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
9979     fi
9980     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
9981         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
9982     fi
9984     postgres_interface=""
9985     if test "$with_system_postgresql" = "yes"; then
9986         postgres_interface="external PostgreSQL"
9987         SYSTEM_POSTGRESQL=TRUE
9988         if test "$_os" = Darwin; then
9989             supp_path=''
9990             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
9991                 pg_supp_path="$P_SEP$d$pg_supp_path"
9992             done
9993         fi
9994         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
9995         if test -n "$PGCONFIG"; then
9996             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
9997             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
9998         else
9999             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
10000               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
10001               POSTGRESQL_LIB=$POSTGRESQL_LIBS
10002             ],[
10003               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
10004             ])
10005         fi
10006         FilterLibs "${POSTGRESQL_LIB}"
10007         POSTGRESQL_LIB="${filteredlibs}"
10008     else
10009         # if/when anything else than PostgreSQL uses Kerberos,
10010         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
10011         WITH_KRB5=
10012         WITH_GSSAPI=
10013         case "$_os" in
10014         Darwin)
10015             # macOS has system MIT Kerberos 5 since 10.4
10016             if test "$with_krb5" != "no"; then
10017                 WITH_KRB5=TRUE
10018                 save_LIBS=$LIBS
10019                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
10020                 # that the libraries where these functions are located on macOS will change, is it?
10021                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10022                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10023                 KRB5_LIBS=$LIBS
10024                 LIBS=$save_LIBS
10025                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10026                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10027                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10028                 LIBS=$save_LIBS
10029             fi
10030             if test "$with_gssapi" != "no"; then
10031                 WITH_GSSAPI=TRUE
10032                 save_LIBS=$LIBS
10033                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10034                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10035                 GSSAPI_LIBS=$LIBS
10036                 LIBS=$save_LIBS
10037             fi
10038             ;;
10039         WINNT)
10040             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
10041                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
10042             fi
10043             ;;
10044         Linux|GNU|*BSD|DragonFly)
10045             if test "$with_krb5" != "no"; then
10046                 WITH_KRB5=TRUE
10047                 save_LIBS=$LIBS
10048                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10049                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10050                 KRB5_LIBS=$LIBS
10051                 LIBS=$save_LIBS
10052                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10053                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10054                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10055                 LIBS=$save_LIBS
10056             fi
10057             if test "$with_gssapi" != "no"; then
10058                 WITH_GSSAPI=TRUE
10059                 save_LIBS=$LIBS
10060                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10061                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10062                 GSSAPI_LIBS=$LIBS
10063                 LIBS=$save_LIBS
10064             fi
10065             ;;
10066         *)
10067             if test "$with_krb5" = "yes"; then
10068                 WITH_KRB5=TRUE
10069                 save_LIBS=$LIBS
10070                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10071                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
10072                 KRB5_LIBS=$LIBS
10073                 LIBS=$save_LIBS
10074                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
10075                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
10076                 KRB5_LIBS="$KRB5_LIBS $LIBS"
10077                 LIBS=$save_LIBS
10078             fi
10079             if test "$with_gssapi" = "yes"; then
10080                 WITH_GSSAPI=TRUE
10081                 save_LIBS=$LIBS
10082                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
10083                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
10084                 LIBS=$save_LIBS
10085                 GSSAPI_LIBS=$LIBS
10086             fi
10087         esac
10089         if test -n "$with_libpq_path"; then
10090             SYSTEM_POSTGRESQL=TRUE
10091             postgres_interface="external libpq"
10092             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
10093             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
10094         else
10095             SYSTEM_POSTGRESQL=
10096             postgres_interface="internal"
10097             POSTGRESQL_LIB=""
10098             POSTGRESQL_INC="%OVERRIDE_ME%"
10099             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
10100         fi
10101     fi
10103     AC_MSG_CHECKING([PostgreSQL C interface])
10104     AC_MSG_RESULT([$postgres_interface])
10106     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
10107         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
10108         save_CFLAGS=$CFLAGS
10109         save_CPPFLAGS=$CPPFLAGS
10110         save_LIBS=$LIBS
10111         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
10112         LIBS="${LIBS} ${POSTGRESQL_LIB}"
10113         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
10114         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
10115             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
10116         CFLAGS=$save_CFLAGS
10117         CPPFLAGS=$save_CPPFLAGS
10118         LIBS=$save_LIBS
10119     fi
10120     BUILD_POSTGRESQL_SDBC=TRUE
10121 else
10122     AC_MSG_RESULT([no])
10124 AC_SUBST(WITH_KRB5)
10125 AC_SUBST(WITH_GSSAPI)
10126 AC_SUBST(GSSAPI_LIBS)
10127 AC_SUBST(KRB5_LIBS)
10128 AC_SUBST(BUILD_POSTGRESQL_SDBC)
10129 AC_SUBST(SYSTEM_POSTGRESQL)
10130 AC_SUBST(POSTGRESQL_INC)
10131 AC_SUBST(POSTGRESQL_LIB)
10133 dnl ===================================================================
10134 dnl Check for Firebird stuff
10135 dnl ===================================================================
10136 ENABLE_FIREBIRD_SDBC=
10137 if test "$enable_firebird_sdbc" = "yes" ; then
10138     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
10140     dnl ===================================================================
10141     dnl Check for system Firebird
10142     dnl ===================================================================
10143     AC_MSG_CHECKING([which Firebird to use])
10144     if test "$with_system_firebird" = "yes"; then
10145         AC_MSG_RESULT([external])
10146         SYSTEM_FIREBIRD=TRUE
10147         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
10148         if test -z "$FIREBIRDCONFIG"; then
10149             AC_MSG_NOTICE([No fb_config -- using pkg-config])
10150             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
10151                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
10152             ])
10153             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
10154         else
10155             AC_MSG_NOTICE([fb_config found])
10156             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
10157             AC_MSG_CHECKING([for Firebird Client library])
10158             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
10159             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
10160             FilterLibs "${FIREBIRD_LIBS}"
10161             FIREBIRD_LIBS="${filteredlibs}"
10162         fi
10163         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
10164         AC_MSG_CHECKING([Firebird version])
10165         if test -n "${FIREBIRD_VERSION}"; then
10166             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
10167             if test "$FIREBIRD_MAJOR" -ge "3"; then
10168                 AC_MSG_RESULT([OK])
10169             else
10170                 AC_MSG_ERROR([Ensure firebird >= 3 is installed])
10171             fi
10172         else
10173             save_CFLAGS="${CFLAGS}"
10174             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
10175             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
10176 #if defined(FB_API_VER) && FB_API_VER == 30
10177 int fb_api_is_30(void) { return 0; }
10178 #else
10179 #error "Wrong Firebird API version"
10180 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
10181             CFLAGS="$save_CFLAGS"
10182         fi
10183         ENABLE_FIREBIRD_SDBC=TRUE
10184         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10185     elif test "$enable_database_connectivity" = no; then
10186         AC_MSG_RESULT([none])
10187     elif test "$cross_compiling" = "yes"; then
10188         AC_MSG_RESULT([none])
10189     else
10190         dnl Embedded Firebird has version 3.0
10191         dnl We need libatomic_ops for any non X86/X64 system
10192         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
10193             dnl ===================================================================
10194             dnl Check for system libatomic_ops
10195             dnl ===================================================================
10196             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[LIBATOMIC_OPS],[atomic_ops >= 0.7.2])
10197             if test "$with_system_libatomic_ops" = "yes"; then
10198                 SYSTEM_LIBATOMIC_OPS=TRUE
10199                 AC_CHECK_HEADERS(atomic_ops.h, [],
10200                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
10201             else
10202                 SYSTEM_LIBATOMIC_OPS=
10203                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
10204                 LIBATOMIC_OPS_LIBS="-latomic_ops"
10205                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
10206             fi
10207         fi
10209         AC_MSG_RESULT([internal])
10210         SYSTEM_FIREBIRD=
10211         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
10212         FIREBIRD_LIBS="-lfbclient"
10214         if test "$with_system_libtommath" = "yes"; then
10215             SYSTEM_LIBTOMMATH=TRUE
10216             dnl check for tommath presence
10217             save_LIBS=$LIBS
10218             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
10219             AC_CHECK_LIB(tommath, mp_init, LIBTOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
10220             LIBS=$save_LIBS
10221         else
10222             SYSTEM_LIBTOMMATH=
10223             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
10224             LIBTOMMATH_LIBS="-ltommath"
10225             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
10226         fi
10228         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
10229         ENABLE_FIREBIRD_SDBC=TRUE
10230         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10231     fi
10233 AC_SUBST(ENABLE_FIREBIRD_SDBC)
10234 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
10235 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
10236 AC_SUBST(LIBATOMIC_OPS_LIBS)
10237 AC_SUBST(SYSTEM_FIREBIRD)
10238 AC_SUBST(FIREBIRD_CFLAGS)
10239 AC_SUBST(FIREBIRD_LIBS)
10240 AC_SUBST(SYSTEM_LIBTOMMATH)
10241 AC_SUBST(LIBTOMMATH_CFLAGS)
10242 AC_SUBST(LIBTOMMATH_LIBS)
10244 dnl ===================================================================
10245 dnl Check for system curl
10246 dnl ===================================================================
10247 AC_MSG_CHECKING([which libcurl to use])
10248 if test "$with_system_curl" = "auto"; then
10249     with_system_curl="$with_system_libs"
10252 if test "$test_curl" = "yes" -a "$enable_curl" = "yes" -a "$with_system_curl" = "yes"; then
10253     AC_MSG_RESULT([external])
10254     SYSTEM_CURL=TRUE
10256     # First try PKGCONFIG and then fall back
10257     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
10259     if test -n "$CURL_PKG_ERRORS"; then
10260         AC_PATH_PROG(CURLCONFIG, curl-config)
10261         if test -z "$CURLCONFIG"; then
10262             AC_MSG_ERROR([curl development files not found])
10263         fi
10264         CURL_LIBS=`$CURLCONFIG --libs`
10265         FilterLibs "${CURL_LIBS}"
10266         CURL_LIBS="${filteredlibs}"
10267         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
10268         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
10270         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
10271         case $curl_version in
10272         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
10273         dnl so they need to be doubled to end up in the configure script
10274         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
10275             AC_MSG_RESULT([yes])
10276             ;;
10277         *)
10278             AC_MSG_ERROR([no, you have $curl_version])
10279             ;;
10280         esac
10281     fi
10283     ENABLE_CURL=TRUE
10284 elif test "$test_curl" = "no"; then
10285     AC_MSG_RESULT([none])
10286 else
10287     AC_MSG_RESULT([internal])
10288     SYSTEM_CURL=
10289     BUILD_TYPE="$BUILD_TYPE CURL"
10290     ENABLE_CURL=TRUE
10292 AC_SUBST(SYSTEM_CURL)
10293 AC_SUBST(CURL_CFLAGS)
10294 AC_SUBST(CURL_LIBS)
10295 AC_SUBST(ENABLE_CURL)
10297 dnl ===================================================================
10298 dnl Check for system boost
10299 dnl ===================================================================
10300 AC_MSG_CHECKING([which boost to use])
10301 if test "$with_system_boost" = "yes"; then
10302     AC_MSG_RESULT([external])
10303     SYSTEM_BOOST=TRUE
10304     AX_BOOST_BASE([1.66],,[AC_MSG_ERROR([no suitable Boost found])])
10305     AX_BOOST_DATE_TIME
10306     AX_BOOST_FILESYSTEM
10307     AX_BOOST_IOSTREAMS
10308     AX_BOOST_LOCALE
10309     AC_LANG_PUSH([C++])
10310     save_CXXFLAGS=$CXXFLAGS
10311     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
10312     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
10313        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
10314     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
10315        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
10316     CXXFLAGS=$save_CXXFLAGS
10317     AC_LANG_POP([C++])
10318     # this is in m4/ax_boost_base.m4
10319     FilterLibs "${BOOST_LDFLAGS}"
10320     BOOST_LDFLAGS="${filteredlibs}"
10321 else
10322     AC_MSG_RESULT([internal])
10323     BUILD_TYPE="$BUILD_TYPE BOOST"
10324     SYSTEM_BOOST=
10325     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
10326         # use warning-suppressing wrapper headers
10327         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
10328     else
10329         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
10330     fi
10332 AC_SUBST(SYSTEM_BOOST)
10334 dnl ===================================================================
10335 dnl Check for system mdds
10336 dnl ===================================================================
10337 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
10339 dnl ===================================================================
10340 dnl Check for system glm
10341 dnl ===================================================================
10342 AC_MSG_CHECKING([which glm to use])
10343 if test "$with_system_glm" = "yes"; then
10344     AC_MSG_RESULT([external])
10345     SYSTEM_GLM=TRUE
10346     AC_LANG_PUSH([C++])
10347     AC_CHECK_HEADER([glm/glm.hpp], [],
10348        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
10349     AC_LANG_POP([C++])
10350 else
10351     AC_MSG_RESULT([internal])
10352     BUILD_TYPE="$BUILD_TYPE GLM"
10353     SYSTEM_GLM=
10354     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
10356 AC_SUBST([GLM_CFLAGS])
10357 AC_SUBST([SYSTEM_GLM])
10359 dnl ===================================================================
10360 dnl Check for system odbc
10361 dnl ===================================================================
10362 AC_MSG_CHECKING([which odbc headers to use])
10363 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
10364     AC_MSG_RESULT([external])
10365     SYSTEM_ODBC_HEADERS=TRUE
10367     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
10368         save_CPPFLAGS=$CPPFLAGS
10369         find_winsdk
10370         PathFormat "$winsdktest"
10371         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"
10372         AC_CHECK_HEADER(sqlext.h, [],
10373             [AC_MSG_ERROR(odbc not found. install odbc)],
10374             [#include <windows.h>])
10375         CPPFLAGS=$save_CPPFLAGS
10376     else
10377         AC_CHECK_HEADER(sqlext.h, [],
10378             [AC_MSG_ERROR(odbc not found. install odbc)],[])
10379     fi
10380 elif test "$enable_database_connectivity" = no; then
10381     AC_MSG_RESULT([none])
10382 else
10383     AC_MSG_RESULT([internal])
10384     SYSTEM_ODBC_HEADERS=
10386 AC_SUBST(SYSTEM_ODBC_HEADERS)
10388 dnl ===================================================================
10389 dnl Check for system NSS
10390 dnl ===================================================================
10391 if test "$enable_fuzzers" != "yes" -a "$enable_nss" = "yes"; then
10392     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
10393     AC_DEFINE(HAVE_FEATURE_NSS)
10394     ENABLE_NSS=TRUE
10395 elif test $_os != iOS ; then
10396     with_tls=openssl
10398 AC_SUBST(ENABLE_NSS)
10400 dnl ===================================================================
10401 dnl Enable LDAP support
10402 dnl ===================================================================
10404 if test "$test_openldap" = yes; then
10405     AC_MSG_CHECKING([whether to enable LDAP support])
10406     if test "$enable_ldap" = yes -a \( "$ENABLE_NSS" = TRUE -o "$with_system_openldap" = yes \); then
10407         AC_MSG_RESULT([yes])
10408         ENABLE_LDAP=TRUE
10409     else
10410         if test "$enable_ldap" != "yes"; then
10411             AC_MSG_RESULT([no])
10412         else
10413             AC_MSG_RESULT([no (needs NSS or system openldap)])
10414         fi
10415     fi
10417 dnl ===================================================================
10418 dnl Check for system openldap
10419 dnl ===================================================================
10421     if test "$ENABLE_LDAP" = TRUE; then
10422         AC_MSG_CHECKING([which openldap library to use])
10423         if test "$with_system_openldap" = yes; then
10424             AC_MSG_RESULT([external])
10425             SYSTEM_OPENLDAP=TRUE
10426             AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
10427             AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10428             AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10429         else
10430             AC_MSG_RESULT([internal])
10431             BUILD_TYPE="$BUILD_TYPE OPENLDAP"
10432         fi
10433     fi
10436 AC_SUBST(ENABLE_LDAP)
10437 AC_SUBST(SYSTEM_OPENLDAP)
10439 dnl ===================================================================
10440 dnl Check for TLS/SSL and cryptographic implementation to use
10441 dnl ===================================================================
10442 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
10443 if test -n "$with_tls"; then
10444     case $with_tls in
10445     openssl)
10446         AC_DEFINE(USE_TLS_OPENSSL)
10447         TLS=OPENSSL
10448         AC_MSG_RESULT([$TLS])
10450         if test "$enable_openssl" != "yes"; then
10451             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
10452         fi
10454         # warn that OpenSSL has been selected but not all TLS code has this option
10455         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
10456         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
10457         ;;
10458     nss)
10459         AC_DEFINE(USE_TLS_NSS)
10460         TLS=NSS
10461         AC_MSG_RESULT([$TLS])
10462         ;;
10463     no)
10464         AC_MSG_RESULT([none])
10465         AC_MSG_WARN([Skipping TLS/SSL])
10466         ;;
10467     *)
10468         AC_MSG_RESULT([])
10469         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
10470 openssl - OpenSSL
10471 nss - Mozilla's Network Security Services (NSS)
10472     ])
10473         ;;
10474     esac
10475 else
10476     # default to using NSS, it results in smaller oox lib
10477     AC_DEFINE(USE_TLS_NSS)
10478     TLS=NSS
10479     AC_MSG_RESULT([$TLS])
10481 AC_SUBST(TLS)
10483 dnl ===================================================================
10484 dnl Check for system sane
10485 dnl ===================================================================
10486 AC_MSG_CHECKING([which sane header to use])
10487 if test "$with_system_sane" = "yes"; then
10488     AC_MSG_RESULT([external])
10489     AC_CHECK_HEADER(sane/sane.h, [],
10490       [AC_MSG_ERROR(sane not found. install sane)], [])
10491 else
10492     AC_MSG_RESULT([internal])
10493     BUILD_TYPE="$BUILD_TYPE SANE"
10496 dnl ===================================================================
10497 dnl Check for system icu
10498 dnl ===================================================================
10499 SYSTEM_GENBRK=
10500 SYSTEM_GENCCODE=
10501 SYSTEM_GENCMN=
10503 ICU_MAJOR=69
10504 ICU_MINOR=1
10505 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
10506 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
10507 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
10508 AC_MSG_CHECKING([which icu to use])
10509 if test "$with_system_icu" = "yes"; then
10510     AC_MSG_RESULT([external])
10511     SYSTEM_ICU=TRUE
10512     AC_LANG_PUSH([C++])
10513     AC_MSG_CHECKING([for unicode/rbbi.h])
10514     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
10515     AC_LANG_POP([C++])
10517     if test "$cross_compiling" != "yes"; then
10518         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
10519         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
10520         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
10521         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
10522     fi
10524     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
10525         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
10526         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
10527         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
10528         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
10529         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
10530             AC_MSG_RESULT([yes])
10531         else
10532             AC_MSG_RESULT([no])
10533             if test "$with_system_icu_for_build" != "force"; then
10534                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
10535 You can use --with-system-icu-for-build=force to use it anyway.])
10536             fi
10537         fi
10538     fi
10540     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
10541         # using the system icu tools can lead to version confusion, use the
10542         # ones from the build environment when cross-compiling
10543         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
10544         if test -z "$SYSTEM_GENBRK"; then
10545             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
10546         fi
10547         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
10548         if test -z "$SYSTEM_GENCCODE"; then
10549             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
10550         fi
10551         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
10552         if test -z "$SYSTEM_GENCMN"; then
10553             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
10554         fi
10555         if test "$ICU_MAJOR" -ge "49"; then
10556             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
10557             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
10558             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
10559         else
10560             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
10561             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
10562             ICU_RECLASSIFIED_HEBREW_LETTER=
10563         fi
10564     fi
10566     if test "$cross_compiling" = "yes"; then
10567         if test "$ICU_MAJOR" -ge "50"; then
10568             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
10569             ICU_MINOR=""
10570         fi
10571     fi
10572 else
10573     AC_MSG_RESULT([internal])
10574     SYSTEM_ICU=
10575     BUILD_TYPE="$BUILD_TYPE ICU"
10576     # surprisingly set these only for "internal" (to be used by various other
10577     # external libs): the system icu-config is quite unhelpful and spits out
10578     # dozens of weird flags and also default path -I/usr/include
10579     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
10580     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
10582 if test "$ICU_MAJOR" -ge "59"; then
10583     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
10584     # with -std=c++11 but not all external libraries can be built with that,
10585     # for those use a bit-compatible typedef uint16_t UChar; see
10586     # icu/source/common/unicode/umachine.h
10587     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
10588 else
10589     ICU_UCHAR_TYPE=""
10591 AC_SUBST(SYSTEM_ICU)
10592 AC_SUBST(SYSTEM_GENBRK)
10593 AC_SUBST(SYSTEM_GENCCODE)
10594 AC_SUBST(SYSTEM_GENCMN)
10595 AC_SUBST(ICU_MAJOR)
10596 AC_SUBST(ICU_MINOR)
10597 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
10598 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
10599 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
10600 AC_SUBST(ICU_CFLAGS)
10601 AC_SUBST(ICU_LIBS)
10602 AC_SUBST(ICU_UCHAR_TYPE)
10604 dnl ==================================================================
10605 dnl Breakpad
10606 dnl ==================================================================
10607 DEFAULT_CRASHDUMP_VALUE="true"
10608 AC_MSG_CHECKING([whether to enable breakpad])
10609 if test "$enable_breakpad" != yes; then
10610     AC_MSG_RESULT([no])
10611 else
10612     AC_MSG_RESULT([yes])
10613     ENABLE_BREAKPAD="TRUE"
10614     AC_DEFINE(ENABLE_BREAKPAD)
10615     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
10616     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
10618     AC_MSG_CHECKING([for disable crash dump])
10619     if test "$enable_crashdump" = no; then
10620         DEFAULT_CRASHDUMP_VALUE="false"
10621         AC_MSG_RESULT([yes])
10622     else
10623        AC_MSG_RESULT([no])
10624     fi
10626     AC_MSG_CHECKING([for crashreport config])
10627     if test "$with_symbol_config" = "no"; then
10628         BREAKPAD_SYMBOL_CONFIG="invalid"
10629         AC_MSG_RESULT([no])
10630     else
10631         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
10632         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
10633         AC_MSG_RESULT([yes])
10634     fi
10635     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
10637 AC_SUBST(ENABLE_BREAKPAD)
10638 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
10640 dnl ==================================================================
10641 dnl libfuzzer
10642 dnl ==================================================================
10643 AC_MSG_CHECKING([whether to enable fuzzers])
10644 if test "$enable_fuzzers" != yes; then
10645     AC_MSG_RESULT([no])
10646 else
10647     if test -z $LIB_FUZZING_ENGINE; then
10648       AC_MSG_ERROR(['LIB_FUZZING_ENGINE' must be set when using --enable-fuzzers. Examples include '-fsanitize=fuzzer'.])
10649     fi
10650     AC_MSG_RESULT([yes])
10651     ENABLE_FUZZERS="TRUE"
10652     AC_DEFINE([ENABLE_FUZZERS],1)
10653     BUILD_TYPE="$BUILD_TYPE FUZZERS"
10655 AC_SUBST(LIB_FUZZING_ENGINE)
10656 AC_SUBST(ENABLE_FUZZERS)
10658 dnl ===================================================================
10659 dnl Orcus
10660 dnl ===================================================================
10661 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.16 >= 0.16.0])
10662 if test "$with_system_orcus" != "yes"; then
10663     if test "$SYSTEM_BOOST" = "TRUE"; then
10664         # ===========================================================
10665         # Determine if we are going to need to link with Boost.System
10666         # ===========================================================
10667         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
10668         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
10669         dnl in documentation has no effect.
10670         AC_MSG_CHECKING([if we need to link with Boost.System])
10671         AC_LANG_PUSH([C++])
10672         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
10673                 @%:@include <boost/version.hpp>
10674             ]],[[
10675                 #if BOOST_VERSION >= 105000
10676                 #   error yes, we need to link with Boost.System
10677                 #endif
10678             ]])],[
10679                 AC_MSG_RESULT([no])
10680             ],[
10681                 AC_MSG_RESULT([yes])
10682                 AX_BOOST_SYSTEM
10683         ])
10684         AC_LANG_POP([C++])
10685     fi
10687 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
10688 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
10689 AC_SUBST([BOOST_SYSTEM_LIB])
10690 AC_SUBST(SYSTEM_LIBORCUS)
10692 dnl ===================================================================
10693 dnl HarfBuzz
10694 dnl ===================================================================
10695 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
10696                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
10697                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
10699 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
10700                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
10701                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
10703 if test "$COM" = "MSC"; then # override the above
10704     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
10705     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
10708 if test "$with_system_harfbuzz" = "yes"; then
10709     if test "$with_system_graphite" = "no"; then
10710         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
10711     fi
10712     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
10713     save_LIBS="$LIBS"
10714     save_CFLAGS="$CFLAGS"
10715     LIBS="$LIBS $HARFBUZZ_LIBS"
10716     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
10717     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
10718     LIBS="$save_LIBS"
10719     CFLAGS="$save_CFLAGS"
10720 else
10721     if test "$with_system_graphite" = "yes"; then
10722         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
10723     fi
10726 if test "$USING_X11" = TRUE; then
10727     AC_PATH_X
10728     AC_PATH_XTRA
10729     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
10731     if test -z "$x_includes"; then
10732         x_includes="default_x_includes"
10733     fi
10734     if test -z "$x_libraries"; then
10735         x_libraries="default_x_libraries"
10736     fi
10737     CFLAGS="$CFLAGS $X_CFLAGS"
10738     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
10739     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
10740 else
10741     x_includes="no_x_includes"
10742     x_libraries="no_x_libraries"
10745 if test "$USING_X11" = TRUE; then
10746     dnl ===================================================================
10747     dnl Check for extension headers
10748     dnl ===================================================================
10749     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
10750      [#include <X11/extensions/shape.h>])
10752     # vcl needs ICE and SM
10753     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
10754     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
10755         [AC_MSG_ERROR(ICE library not found)])
10756     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
10757     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
10758         [AC_MSG_ERROR(SM library not found)])
10761 if test "$USING_X11" = TRUE -a "$ENABLE_JAVA" != ""; then
10762     # bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c needs Xt
10763     AC_CHECK_HEADERS(X11/Intrinsic.h,[],[AC_MSG_ERROR([libXt headers not found])])
10766 dnl ===================================================================
10767 dnl Check for system Xrender
10768 dnl ===================================================================
10769 AC_MSG_CHECKING([whether to use Xrender])
10770 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
10771     AC_MSG_RESULT([yes])
10772     PKG_CHECK_MODULES(XRENDER, xrender)
10773     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10774     FilterLibs "${XRENDER_LIBS}"
10775     XRENDER_LIBS="${filteredlibs}"
10776     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
10777       [AC_MSG_ERROR(libXrender not found or functional)], [])
10778     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
10779       [AC_MSG_ERROR(Xrender not found. install X)], [])
10780 else
10781     AC_MSG_RESULT([no])
10783 AC_SUBST(XRENDER_CFLAGS)
10784 AC_SUBST(XRENDER_LIBS)
10786 dnl ===================================================================
10787 dnl Check for XRandr
10788 dnl ===================================================================
10789 AC_MSG_CHECKING([whether to enable RandR support])
10790 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
10791     AC_MSG_RESULT([yes])
10792     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
10793     if test "$ENABLE_RANDR" != "TRUE"; then
10794         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
10795                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
10796         XRANDR_CFLAGS=" "
10797         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
10798           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
10799         XRANDR_LIBS="-lXrandr "
10800         ENABLE_RANDR="TRUE"
10801     fi
10802     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10803     FilterLibs "${XRANDR_LIBS}"
10804     XRANDR_LIBS="${filteredlibs}"
10805 else
10806     ENABLE_RANDR=""
10807     AC_MSG_RESULT([no])
10809 AC_SUBST(XRANDR_CFLAGS)
10810 AC_SUBST(XRANDR_LIBS)
10811 AC_SUBST(ENABLE_RANDR)
10813 if test "$test_webdav" = yes; then
10814     if test -z "$with_webdav"; then
10815         WITH_WEBDAV=neon
10816         if test "$enable_mpl_subset" = yes; then
10817             WITH_WEBDAV=serf
10818         fi
10819     else
10820         WITH_WEBDAV="$with_webdav"
10821     fi
10824 AC_MSG_CHECKING([for webdav library])
10825 case "$WITH_WEBDAV" in
10826 serf)
10827     AC_MSG_RESULT([serf])
10828     # Check for system apr-util
10829     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
10830                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
10831                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
10832     if test "$COM" = "MSC"; then
10833         APR_LIB_DIR="LibR"
10834         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
10835         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
10836     fi
10838     # Check for system serf
10839     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.3.9])
10840     ;;
10841 neon)
10842     AC_MSG_RESULT([neon])
10843     # Check for system neon
10844     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.31.2])
10845     if test "$with_system_neon" = "yes"; then
10846         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
10847     else
10848         NEON_VERSION=0312
10849     fi
10850     AC_SUBST(NEON_VERSION)
10851     ;;
10853     AC_MSG_RESULT([none, disabled])
10854     WITH_WEBDAV=""
10855     ;;
10856 esac
10857 AC_SUBST(WITH_WEBDAV)
10859 dnl ===================================================================
10860 dnl Check for disabling cve_tests
10861 dnl ===================================================================
10862 AC_MSG_CHECKING([whether to execute CVE tests])
10863 # If not explicitly enabled or disabled, default
10864 if test -z "$enable_cve_tests"; then
10865     case "$OS" in
10866     WNT)
10867         # Default cves off for Windows with its wild and wonderful
10868         # variety of AV software kicking in and panicking
10869         enable_cve_tests=no
10870         ;;
10871     *)
10872         # otherwise yes
10873         enable_cve_tests=yes
10874         ;;
10875     esac
10877 if test "$enable_cve_tests" = "no"; then
10878     AC_MSG_RESULT([no])
10879     DISABLE_CVE_TESTS=TRUE
10880     AC_SUBST(DISABLE_CVE_TESTS)
10881 else
10882     AC_MSG_RESULT([yes])
10885 dnl ===================================================================
10886 dnl Check for enabling chart XShape tests
10887 dnl ===================================================================
10888 AC_MSG_CHECKING([whether to execute chart XShape tests])
10889 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
10890     AC_MSG_RESULT([yes])
10891     ENABLE_CHART_TESTS=TRUE
10892     AC_SUBST(ENABLE_CHART_TESTS)
10893 else
10894     AC_MSG_RESULT([no])
10897 dnl ===================================================================
10898 dnl Check for system openssl
10899 dnl ===================================================================
10900 ENABLE_OPENSSL=
10901 AC_MSG_CHECKING([whether to disable OpenSSL usage])
10902 if test "$enable_openssl" = "yes"; then
10903     AC_MSG_RESULT([no])
10904     ENABLE_OPENSSL=TRUE
10905     if test "$_os" = Darwin ; then
10906         # OpenSSL is deprecated when building for 10.7 or later.
10907         #
10908         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
10909         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
10911         with_system_openssl=no
10912         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10913     elif test "$_os" = "FreeBSD" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
10914             && test "$with_system_openssl" != "no"; then
10915         with_system_openssl=yes
10916         SYSTEM_OPENSSL=TRUE
10917         OPENSSL_CFLAGS=
10918         OPENSSL_LIBS="-lssl -lcrypto"
10919     else
10920         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10921     fi
10922     if test "$with_system_openssl" = "yes"; then
10923         AC_MSG_CHECKING([whether openssl supports SHA512])
10924         AC_LANG_PUSH([C])
10925         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
10926             SHA512_CTX context;
10927 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
10928         AC_LANG_POP(C)
10929     fi
10930 else
10931     AC_MSG_RESULT([yes])
10933     # warn that although OpenSSL is disabled, system libraries may depend on it
10934     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
10935     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
10938 AC_SUBST([ENABLE_OPENSSL])
10940 if test "$enable_cipher_openssl_backend" = yes && test "$ENABLE_OPENSSL" != TRUE; then
10941     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
10942         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
10943         enable_cipher_openssl_backend=no
10944     else
10945         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
10946     fi
10948 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
10949 ENABLE_CIPHER_OPENSSL_BACKEND=
10950 if test "$enable_cipher_openssl_backend" = yes; then
10951     AC_MSG_RESULT([yes])
10952     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
10953 else
10954     AC_MSG_RESULT([no])
10956 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
10958 dnl ===================================================================
10959 dnl Select the crypto backends used by LO
10960 dnl ===================================================================
10962 if test "$build_crypto" = yes; then
10963     if test "$OS" = WNT; then
10964         BUILD_TYPE="$BUILD_TYPE CRYPTO_MSCAPI"
10965         AC_DEFINE([USE_CRYPTO_MSCAPI])
10966     elif test "$ENABLE_NSS" = TRUE; then
10967         BUILD_TYPE="$BUILD_TYPE CRYPTO_NSS"
10968         AC_DEFINE([USE_CRYPTO_NSS])
10969     fi
10972 dnl ===================================================================
10973 dnl Check for building gnutls
10974 dnl ===================================================================
10975 AC_MSG_CHECKING([whether to use gnutls])
10976 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
10977     AC_MSG_RESULT([yes])
10978     AM_PATH_LIBGCRYPT()
10979     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
10980         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
10981                       available in the system to use as replacement.]]))
10982     FilterLibs "${LIBGCRYPT_LIBS}"
10983     LIBGCRYPT_LIBS="${filteredlibs}"
10984 else
10985     AC_MSG_RESULT([no])
10988 AC_SUBST([LIBGCRYPT_CFLAGS])
10989 AC_SUBST([LIBGCRYPT_LIBS])
10991 dnl ===================================================================
10992 dnl Check for system redland
10993 dnl ===================================================================
10994 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
10995 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
10996 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
10997 if test "$with_system_redland" = "yes"; then
10998     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
10999             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
11000 else
11001     RAPTOR_MAJOR="0"
11002     RASQAL_MAJOR="3"
11003     REDLAND_MAJOR="0"
11005 AC_SUBST(RAPTOR_MAJOR)
11006 AC_SUBST(RASQAL_MAJOR)
11007 AC_SUBST(REDLAND_MAJOR)
11009 dnl ===================================================================
11010 dnl Check for system hunspell
11011 dnl ===================================================================
11012 AC_MSG_CHECKING([which libhunspell to use])
11013 if test "$with_system_hunspell" = "yes"; then
11014     AC_MSG_RESULT([external])
11015     SYSTEM_HUNSPELL=TRUE
11016     AC_LANG_PUSH([C++])
11017     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
11018     if test "$HUNSPELL_PC" != "TRUE"; then
11019         AC_CHECK_HEADER(hunspell.hxx, [],
11020             [
11021             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
11022             [AC_MSG_ERROR(hunspell headers not found.)], [])
11023             ], [])
11024         AC_CHECK_LIB([hunspell], [main], [:],
11025            [ AC_MSG_ERROR(hunspell library not found.) ], [])
11026         HUNSPELL_LIBS=-lhunspell
11027     fi
11028     AC_LANG_POP([C++])
11029     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11030     FilterLibs "${HUNSPELL_LIBS}"
11031     HUNSPELL_LIBS="${filteredlibs}"
11032 else
11033     AC_MSG_RESULT([internal])
11034     SYSTEM_HUNSPELL=
11035     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
11036     if test "$COM" = "MSC"; then
11037         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
11038     else
11039         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
11040     fi
11041     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
11043 AC_SUBST(SYSTEM_HUNSPELL)
11044 AC_SUBST(HUNSPELL_CFLAGS)
11045 AC_SUBST(HUNSPELL_LIBS)
11047 dnl ===================================================================
11048 dnl Check for system zxing
11049 dnl ===================================================================
11050 AC_MSG_CHECKING([whether to use zxing])
11051 if test "$enable_zxing" = "no"; then
11052     AC_MSG_RESULT([no])
11053     ENABLE_ZXING=
11054     SYSTEM_ZXING=
11055 else
11056     AC_MSG_RESULT([yes])
11057     ENABLE_ZXING=TRUE
11058     AC_MSG_CHECKING([which libzxing to use])
11059     if test "$with_system_zxing" = "yes"; then
11060         AC_MSG_RESULT([external])
11061         SYSTEM_ZXING=TRUE
11062         AC_LANG_PUSH([C++])
11063         AC_CHECK_HEADER(ZXing/MultiFormatWriter.h, [],
11064             [AC_MSG_ERROR(zxing headers not found.)], [#include <stdexcept>])
11065         ZXING_CFLAGS=-I/usr/include/ZXing
11066         AC_CHECK_LIB([ZXing], [main], [ZXING_LIBS=-lZXing],
11067             [ AC_CHECK_LIB([ZXingCore], [main], [ZXING_LIBS=-lZXingCore],
11068             [ AC_MSG_ERROR(zxing C++ library not found.) ])], [])
11069         AC_LANG_POP([C++])
11070         ZXING_CFLAGS=$(printf '%s' "$ZXING_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11071         FilterLibs "${ZXING_LIBS}"
11072         ZXING_LIBS="${filteredlibs}"
11073     else
11074         AC_MSG_RESULT([internal])
11075         SYSTEM_ZXING=
11076         BUILD_TYPE="$BUILD_TYPE ZXING"
11077     fi
11078     if test "$ENABLE_ZXING" = TRUE; then
11079         AC_DEFINE(ENABLE_ZXING)
11080     fi
11082 AC_SUBST(SYSTEM_ZXING)
11083 AC_SUBST(ENABLE_ZXING)
11084 AC_SUBST(ZXING_CFLAGS)
11085 AC_SUBST(ZXING_LIBS)
11087 dnl ===================================================================
11088 dnl Check for system box2d
11089 dnl ===================================================================
11090 AC_MSG_CHECKING([which box2d to use])
11091 if test "$with_system_box2d" = "yes"; then
11092     AC_MSG_RESULT([external])
11093     SYSTEM_BOX2D=TRUE
11094     AC_LANG_PUSH([C++])
11095     AC_CHECK_HEADER(box2d/box2d.h, [BOX2D_H_FOUND='TRUE'],
11096         [BOX2D_H_FOUND='FALSE'])
11097     if test "$BOX2D_H_FOUND" = "TRUE"; then # 2.4.0+
11098         _BOX2D_LIB=box2d
11099         AC_DEFINE(BOX2D_HEADER,<box2d/box2d.h>)
11100     else
11101         # fail this. there's no other alternative to check when we are here.
11102         AC_CHECK_HEADER([Box2D/Box2D.h], [],
11103             [AC_MSG_ERROR(box2d headers not found.)])
11104         _BOX2D_LIB=Box2D
11105         AC_DEFINE(BOX2D_HEADER,<Box2D/Box2D.h>)
11106     fi
11107     AC_CHECK_LIB([$_BOX2D_LIB], [main], [:],
11108         [ AC_MSG_ERROR(box2d library not found.) ], [])
11109     BOX2D_LIBS=-l$_BOX2D_LIB
11110     AC_LANG_POP([C++])
11111     BOX2D_CFLAGS=$(printf '%s' "$BOX2D_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11112     FilterLibs "${BOX2D_LIBS}"
11113     BOX2D_LIBS="${filteredlibs}"
11114 else
11115     AC_MSG_RESULT([internal])
11116     SYSTEM_BOX2D=
11117     BUILD_TYPE="$BUILD_TYPE BOX2D"
11119 AC_SUBST(SYSTEM_BOX2D)
11120 AC_SUBST(BOX2D_CFLAGS)
11121 AC_SUBST(BOX2D_LIBS)
11123 dnl ===================================================================
11124 dnl Checking for altlinuxhyph
11125 dnl ===================================================================
11126 AC_MSG_CHECKING([which altlinuxhyph to use])
11127 if test "$with_system_altlinuxhyph" = "yes"; then
11128     AC_MSG_RESULT([external])
11129     SYSTEM_HYPH=TRUE
11130     AC_CHECK_HEADER(hyphen.h, [],
11131        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
11132     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
11133        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
11134        [#include <hyphen.h>])
11135     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
11136         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11137     if test -z "$HYPHEN_LIB"; then
11138         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
11139            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11140     fi
11141     if test -z "$HYPHEN_LIB"; then
11142         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
11143            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11144     fi
11145 else
11146     AC_MSG_RESULT([internal])
11147     SYSTEM_HYPH=
11148     BUILD_TYPE="$BUILD_TYPE HYPHEN"
11149     if test "$COM" = "MSC"; then
11150         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
11151     else
11152         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
11153     fi
11155 AC_SUBST(SYSTEM_HYPH)
11156 AC_SUBST(HYPHEN_LIB)
11158 dnl ===================================================================
11159 dnl Checking for mythes
11160 dnl ===================================================================
11161 AC_MSG_CHECKING([which mythes to use])
11162 if test "$with_system_mythes" = "yes"; then
11163     AC_MSG_RESULT([external])
11164     SYSTEM_MYTHES=TRUE
11165     AC_LANG_PUSH([C++])
11166     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
11167     if test "$MYTHES_PKGCONFIG" = "no"; then
11168         AC_CHECK_HEADER(mythes.hxx, [],
11169             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
11170         AC_CHECK_LIB([mythes-1.2], [main], [:],
11171             [ MYTHES_FOUND=no], [])
11172     if test "$MYTHES_FOUND" = "no"; then
11173         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
11174                 [ MYTHES_FOUND=no], [])
11175     fi
11176     if test "$MYTHES_FOUND" = "no"; then
11177         AC_MSG_ERROR([mythes library not found!.])
11178     fi
11179     fi
11180     AC_LANG_POP([C++])
11181     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11182     FilterLibs "${MYTHES_LIBS}"
11183     MYTHES_LIBS="${filteredlibs}"
11184 else
11185     AC_MSG_RESULT([internal])
11186     SYSTEM_MYTHES=
11187     BUILD_TYPE="$BUILD_TYPE MYTHES"
11188     if test "$COM" = "MSC"; then
11189         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
11190     else
11191         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
11192     fi
11194 AC_SUBST(SYSTEM_MYTHES)
11195 AC_SUBST(MYTHES_CFLAGS)
11196 AC_SUBST(MYTHES_LIBS)
11198 dnl ===================================================================
11199 dnl How should we build the linear programming solver ?
11200 dnl ===================================================================
11202 ENABLE_COINMP=
11203 AC_MSG_CHECKING([whether to build with CoinMP])
11204 if test "$enable_coinmp" != "no"; then
11205     ENABLE_COINMP=TRUE
11206     AC_MSG_RESULT([yes])
11207     if test "$with_system_coinmp" = "yes"; then
11208         SYSTEM_COINMP=TRUE
11209         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
11210         FilterLibs "${COINMP_LIBS}"
11211         COINMP_LIBS="${filteredlibs}"
11212     else
11213         BUILD_TYPE="$BUILD_TYPE COINMP"
11214     fi
11215 else
11216     AC_MSG_RESULT([no])
11218 AC_SUBST(ENABLE_COINMP)
11219 AC_SUBST(SYSTEM_COINMP)
11220 AC_SUBST(COINMP_CFLAGS)
11221 AC_SUBST(COINMP_LIBS)
11223 ENABLE_LPSOLVE=
11224 AC_MSG_CHECKING([whether to build with lpsolve])
11225 if test "$enable_lpsolve" != "no"; then
11226     ENABLE_LPSOLVE=TRUE
11227     AC_MSG_RESULT([yes])
11228 else
11229     AC_MSG_RESULT([no])
11231 AC_SUBST(ENABLE_LPSOLVE)
11233 if test "$ENABLE_LPSOLVE" = TRUE; then
11234     AC_MSG_CHECKING([which lpsolve to use])
11235     if test "$with_system_lpsolve" = "yes"; then
11236         AC_MSG_RESULT([external])
11237         SYSTEM_LPSOLVE=TRUE
11238         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
11239            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
11240         save_LIBS=$LIBS
11241         # some systems need this. Like Ubuntu...
11242         AC_CHECK_LIB(m, floor)
11243         AC_CHECK_LIB(dl, dlopen)
11244         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
11245             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
11246         LIBS=$save_LIBS
11247     else
11248         AC_MSG_RESULT([internal])
11249         SYSTEM_LPSOLVE=
11250         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
11251     fi
11253 AC_SUBST(SYSTEM_LPSOLVE)
11255 dnl ===================================================================
11256 dnl Checking for libexttextcat
11257 dnl ===================================================================
11258 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
11259 if test "$with_system_libexttextcat" = "yes"; then
11260     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
11262 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
11264 dnl ===================================================================
11265 dnl Checking for libnumbertext
11266 dnl ===================================================================
11267 libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.6])
11268 if test "$with_system_libnumbertext" = "yes"; then
11269     SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
11270     SYSTEM_LIBNUMBERTEXT=YES
11271 else
11272     SYSTEM_LIBNUMBERTEXT=
11273     AC_LANG_PUSH([C++])
11274     save_CPPFLAGS=$CPPFLAGS
11275     CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
11276     AC_CHECK_HEADERS([codecvt regex])
11277     AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
11278             [ LIBNUMBERTEXT_CFLAGS=''
11279               AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
11280                            Enable libnumbertext fallback (missing number to number name conversion).])
11281             ])
11282     CPPFLAGS=$save_CPPFLAGS
11283     AC_LANG_POP([C++])
11285 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
11286 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
11287 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
11289 dnl ***************************************
11290 dnl testing libc version for Linux...
11291 dnl ***************************************
11292 if test "$_os" = "Linux"; then
11293     AC_MSG_CHECKING([whether libc is >= 2.1.1])
11294     exec 6>/dev/null # no output
11295     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
11296     exec 6>&1 # output on again
11297     if test "$HAVE_LIBC"; then
11298         AC_MSG_RESULT([yes])
11299     else
11300         AC_MSG_ERROR([no, upgrade libc])
11301     fi
11304 dnl =========================================
11305 dnl Check for uuidgen
11306 dnl =========================================
11307 if test "$_os" = "WINNT"; then
11308     # we must use the uuidgen from the Windows SDK, which will be in the LO_PATH, but isn't in
11309     # the PATH for AC_PATH_PROG. It is already tested above in the WINDOWS_SDK_HOME check.
11310     UUIDGEN=uuidgen.exe
11311     AC_SUBST(UUIDGEN)
11312 else
11313     AC_PATH_PROG([UUIDGEN], [uuidgen])
11314     if test -z "$UUIDGEN"; then
11315         AC_MSG_WARN([uuid is needed for building installation sets])
11316     fi
11319 dnl ***************************************
11320 dnl Checking for bison and flex
11321 dnl ***************************************
11322 AC_PATH_PROG(BISON, bison)
11323 if test -z "$BISON"; then
11324     AC_MSG_ERROR([no bison found in \$PATH, install it])
11325 else
11326     AC_MSG_CHECKING([the bison version])
11327     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
11328     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
11329     dnl Accept newer than 2.0; for --enable-compiler-plugins at least 2.3 is known to be bad and
11330     dnl cause
11331     dnl
11332     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]
11333     dnl   typedef union YYSTYPE
11334     dnl           ~~~~~~^~~~~~~
11335     dnl
11336     dnl while at least 3.4.1 is know to be good:
11337     if test "$COMPILER_PLUGINS" = TRUE; then
11338         if test "$_bison_longver" -lt 2004; then
11339             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.4+ for --enable-compiler-plugins)])
11340         fi
11341     else
11342         if test "$_bison_longver" -lt 2000; then
11343             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
11344         fi
11345     fi
11347 AC_SUBST([BISON])
11349 AC_PATH_PROG(FLEX, flex)
11350 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11351     FLEX=`cygpath -m $FLEX`
11353 if test -z "$FLEX"; then
11354     AC_MSG_ERROR([no flex found in \$PATH, install it])
11355 else
11356     AC_MSG_CHECKING([the flex version])
11357     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
11358     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
11359         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
11360     fi
11362 AC_SUBST([FLEX])
11363 dnl ***************************************
11364 dnl Checking for patch
11365 dnl ***************************************
11366 AC_PATH_PROG(PATCH, patch)
11367 if test -z "$PATCH"; then
11368     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
11371 dnl On Solaris or macOS, check if --with-gnu-patch was used
11372 if test "$_os" = "SunOS" -o "$_os" = "Darwin"; then
11373     if test -z "$with_gnu_patch"; then
11374         GNUPATCH=$PATCH
11375     else
11376         if test -x "$with_gnu_patch"; then
11377             GNUPATCH=$with_gnu_patch
11378         else
11379             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
11380         fi
11381     fi
11383     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
11384     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
11385         AC_MSG_RESULT([yes])
11386     else
11387         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
11388     fi
11389 else
11390     GNUPATCH=$PATCH
11393 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11394     GNUPATCH=`cygpath -m $GNUPATCH`
11397 dnl We also need to check for --with-gnu-cp
11399 if test -z "$with_gnu_cp"; then
11400     # check the place where the good stuff is hidden on Solaris...
11401     if test -x /usr/gnu/bin/cp; then
11402         GNUCP=/usr/gnu/bin/cp
11403     else
11404         AC_PATH_PROGS(GNUCP, gnucp cp)
11405     fi
11406     if test -z $GNUCP; then
11407         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
11408     fi
11409 else
11410     if test -x "$with_gnu_cp"; then
11411         GNUCP=$with_gnu_cp
11412     else
11413         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
11414     fi
11417 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11418     GNUCP=`cygpath -m $GNUCP`
11421 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
11422 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
11423     AC_MSG_RESULT([yes])
11424 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
11425     AC_MSG_RESULT([yes])
11426 else
11427     case "$build_os" in
11428     darwin*|macos*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
11429         x_GNUCP=[\#]
11430         GNUCP=''
11431         AC_MSG_RESULT([no gnucp found - using the system's cp command])
11432         ;;
11433     *)
11434         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
11435         ;;
11436     esac
11439 AC_SUBST(GNUPATCH)
11440 AC_SUBST(GNUCP)
11441 AC_SUBST(x_GNUCP)
11443 dnl ***************************************
11444 dnl testing assembler path
11445 dnl ***************************************
11446 ML_EXE=""
11447 if test "$_os" = "WINNT"; then
11448     case "$WIN_HOST_ARCH" in
11449     x86) assembler=ml.exe ;;
11450     x64) assembler=ml64.exe ;;
11451     arm64) assembler=armasm64.exe ;;
11452     esac
11454     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
11455     if test -f "$MSVC_HOST_PATH/$assembler"; then
11456         ML_EXE=`win_short_path_for_make "$MSVC_HOST_PATH/$assembler"`
11457         AC_MSG_RESULT([$ML_EXE])
11458     else
11459         AC_MSG_ERROR([not found in $MSVC_HOST_PATH])
11460     fi
11463 AC_SUBST(ML_EXE)
11465 dnl ===================================================================
11466 dnl We need zip and unzip
11467 dnl ===================================================================
11468 AC_PATH_PROG(ZIP, zip)
11469 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
11470 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
11471     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],,)
11474 AC_PATH_PROG(UNZIP, unzip)
11475 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
11477 dnl ===================================================================
11478 dnl Zip must be a specific type for different build types.
11479 dnl ===================================================================
11480 if test $build_os = cygwin; then
11481     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
11482         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
11483     fi
11486 dnl ===================================================================
11487 dnl We need touch with -h option support.
11488 dnl ===================================================================
11489 AC_PATH_PROG(TOUCH, touch)
11490 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
11491 touch "$WARNINGS_FILE"
11492 if ! "$TOUCH" -h "$WARNINGS_FILE" 2>/dev/null > /dev/null; then
11493     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],,)
11496 dnl ===================================================================
11497 dnl Check for system epoxy
11498 dnl ===================================================================
11499 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
11501 dnl ===================================================================
11502 dnl Set vcl option: coordinate device in double or sal_Int32
11503 dnl ===================================================================
11505 dnl disabled for now, we don't want subtle differences between OSs
11506 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
11507 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
11508 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
11509 dnl     AC_MSG_RESULT([double])
11510 dnl else
11511 dnl     AC_MSG_RESULT([sal_Int32])
11512 dnl fi
11514 dnl ===================================================================
11515 dnl Show which vclplugs will be built.
11516 dnl ===================================================================
11517 R=""
11518 if test "$USING_X11" != TRUE; then
11519     enable_gtk3=no
11522 ENABLE_GTK3=""
11523 if test "x$enable_gtk3" = "xyes"; then
11524     ENABLE_GTK3="TRUE"
11525     AC_DEFINE(ENABLE_GTK3)
11526     R="$R gtk3"
11528 AC_SUBST(ENABLE_GTK3)
11530 ENABLE_GTK3_KDE5=""
11531 if test "x$enable_gtk3_kde5" = "xyes"; then
11532     ENABLE_GTK3_KDE5="TRUE"
11533     AC_DEFINE(ENABLE_GTK3_KDE5)
11534     R="$R gtk3_kde5"
11536 AC_SUBST(ENABLE_GTK3_KDE5)
11538 ENABLE_GTK4=""
11539 if test "x$enable_gtk4" = "xyes"; then
11540     ENABLE_GTK4="TRUE"
11541     AC_DEFINE(ENABLE_GTK4)
11542     R="$R gtk4"
11544 AC_SUBST(ENABLE_GTK4)
11546 ENABLE_QT5=""
11547 if test "x$enable_qt5" = "xyes"; then
11548     ENABLE_QT5="TRUE"
11549     AC_DEFINE(ENABLE_QT5)
11550     R="$R qt5"
11552 AC_SUBST(ENABLE_QT5)
11554 ENABLE_KF5=""
11555 if test "x$enable_kf5" = "xyes"; then
11556     ENABLE_KF5="TRUE"
11557     AC_DEFINE(ENABLE_KF5)
11558     R="$R kf5"
11560 AC_SUBST(ENABLE_KF5)
11562 if test "x$USING_X11" = "xyes"; then
11563     R="$R gen"
11566 if test "$_os" = "WINNT"; then
11567     R="$R win"
11568 elif test "$_os" = "Darwin"; then
11569     R="$R osx"
11570 elif test "$_os" = "iOS"; then
11571     R="ios"
11572 elif test "$_os" = Android; then
11573     R="android"
11576 build_vcl_plugins="$R"
11577 if test -z "$build_vcl_plugins"; then
11578     build_vcl_plugins=" none"
11580 AC_MSG_NOTICE([VCLplugs to be built:${build_vcl_plugins}])
11581 VCL_PLUGIN_INFO=$R
11582 AC_SUBST([VCL_PLUGIN_INFO])
11584 dnl ===================================================================
11585 dnl Check for GTK libraries
11586 dnl ===================================================================
11588 GTK3_CFLAGS=""
11589 GTK3_LIBS=""
11590 if test "$test_gtk3" = yes -a "x$enable_gtk3" = "xyes" -o "x$enable_gtk3_kde5" = "xyes"; then
11591     if test "$with_system_cairo" = no; then
11592         add_warning 'Non-system cairo combined with gtk3 is assumed to cause trouble; proceed at your own risk.'
11593     fi
11594     : ${with_system_cairo:=yes}
11595     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)
11596     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11597     GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
11598     FilterLibs "${GTK3_LIBS}"
11599     GTK3_LIBS="${filteredlibs}"
11601     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
11602     if test "$with_system_epoxy" != "yes"; then
11603         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
11604         AC_CHECK_HEADER(EGL/eglplatform.h, [],
11605                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
11606     fi
11608 AC_SUBST(GTK3_LIBS)
11609 AC_SUBST(GTK3_CFLAGS)
11611 GTK4_CFLAGS=""
11612 GTK4_LIBS=""
11613 if test "$test_gtk4" = yes -a "x$enable_gtk4" = "xyes"; then
11614     if test "$with_system_cairo" = no; then
11615         add_warning 'Non-system cairo combined with gtk4 is assumed to cause trouble; proceed at your own risk.'
11616     fi
11617     : ${with_system_cairo:=yes}
11618     PKG_CHECK_MODULES(GTK4, gtk4 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo atk)
11619     GTK4_CFLAGS=$(printf '%s' "$GTK4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11620     GTK4_CFLAGS="$GTK4_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
11621     FilterLibs "${GTK4_LIBS}"
11622     GTK4_LIBS="${filteredlibs}"
11624     dnl We require egl only for the gtk4 plugin. Otherwise we use glx.
11625     if test "$with_system_epoxy" != "yes"; then
11626         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
11627         AC_CHECK_HEADER(EGL/eglplatform.h, [],
11628                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
11629     fi
11631 AC_SUBST(GTK4_LIBS)
11632 AC_SUBST(GTK4_CFLAGS)
11634 if test "$enable_introspection" = yes; then
11635     if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
11636         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
11637     else
11638         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
11639     fi
11642 dnl ===================================================================
11643 dnl check for dbus support
11644 dnl ===================================================================
11645 ENABLE_DBUS=""
11646 DBUS_CFLAGS=""
11647 DBUS_LIBS=""
11648 DBUS_GLIB_CFLAGS=""
11649 DBUS_GLIB_LIBS=""
11650 DBUS_HAVE_GLIB=""
11652 if test "$enable_dbus" = "no"; then
11653     test_dbus=no
11656 AC_MSG_CHECKING([whether to enable DBUS support])
11657 if test "$test_dbus" = "yes"; then
11658     ENABLE_DBUS="TRUE"
11659     AC_MSG_RESULT([yes])
11660     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
11661     AC_DEFINE(ENABLE_DBUS)
11662     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11663     FilterLibs "${DBUS_LIBS}"
11664     DBUS_LIBS="${filteredlibs}"
11666     # Glib is needed for BluetoothServer
11667     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
11668     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
11669         [
11670             DBUS_HAVE_GLIB="TRUE"
11671             AC_DEFINE(DBUS_HAVE_GLIB,1)
11672         ],
11673         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
11674     )
11675 else
11676     AC_MSG_RESULT([no])
11679 AC_SUBST(ENABLE_DBUS)
11680 AC_SUBST(DBUS_CFLAGS)
11681 AC_SUBST(DBUS_LIBS)
11682 AC_SUBST(DBUS_GLIB_CFLAGS)
11683 AC_SUBST(DBUS_GLIB_LIBS)
11684 AC_SUBST(DBUS_HAVE_GLIB)
11686 AC_MSG_CHECKING([whether to enable Impress remote control])
11687 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
11688     AC_MSG_RESULT([yes])
11689     ENABLE_SDREMOTE=TRUE
11690     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
11692     if test $OS = MACOSX && test "$MACOSX_SDK_VERSION" -ge 101500; then
11693         # The Bluetooth code doesn't compile with macOS SDK 10.15
11694         if test "$enable_sdremote_bluetooth" = yes; then
11695             AC_MSG_ERROR([macOS SDK $with_macosx_sdk does not currently support --enable-sdremote-bluetooth])
11696         fi
11697         enable_sdremote_bluetooth=no
11698     fi
11699     # If not explicitly enabled or disabled, default
11700     if test -z "$enable_sdremote_bluetooth"; then
11701         case "$OS" in
11702         LINUX|MACOSX|WNT)
11703             # Default to yes for these
11704             enable_sdremote_bluetooth=yes
11705             ;;
11706         *)
11707             # otherwise no
11708             enable_sdremote_bluetooth=no
11709             ;;
11710         esac
11711     fi
11712     # $enable_sdremote_bluetooth is guaranteed non-empty now
11714     if test "$enable_sdremote_bluetooth" != "no"; then
11715         if test "$OS" = "LINUX"; then
11716             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
11717                 AC_MSG_RESULT([yes])
11718                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
11719                 dnl ===================================================================
11720                 dnl Check for system bluez
11721                 dnl ===================================================================
11722                 AC_MSG_CHECKING([which Bluetooth header to use])
11723                 if test "$with_system_bluez" = "yes"; then
11724                     AC_MSG_RESULT([external])
11725                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
11726                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
11727                     SYSTEM_BLUEZ=TRUE
11728                 else
11729                     AC_MSG_RESULT([internal])
11730                     SYSTEM_BLUEZ=
11731                 fi
11732             else
11733                 AC_MSG_RESULT([no, dbus disabled])
11734                 ENABLE_SDREMOTE_BLUETOOTH=
11735                 SYSTEM_BLUEZ=
11736             fi
11737         else
11738             AC_MSG_RESULT([yes])
11739             ENABLE_SDREMOTE_BLUETOOTH=TRUE
11740             SYSTEM_BLUEZ=
11741         fi
11742     else
11743         AC_MSG_RESULT([no])
11744         ENABLE_SDREMOTE_BLUETOOTH=
11745         SYSTEM_BLUEZ=
11746     fi
11747 else
11748     ENABLE_SDREMOTE=
11749     SYSTEM_BLUEZ=
11750     AC_MSG_RESULT([no])
11752 AC_SUBST(ENABLE_SDREMOTE)
11753 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
11754 AC_SUBST(SYSTEM_BLUEZ)
11756 dnl ===================================================================
11757 dnl Check whether to enable GIO support
11758 dnl ===================================================================
11759 if test "$ENABLE_GTK4" = "TRUE" -o "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
11760     AC_MSG_CHECKING([whether to enable GIO support])
11761     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
11762         dnl Need at least 2.26 for the dbus support.
11763         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
11764                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
11765         if test "$ENABLE_GIO" = "TRUE"; then
11766             AC_DEFINE(ENABLE_GIO)
11767             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11768             FilterLibs "${GIO_LIBS}"
11769             GIO_LIBS="${filteredlibs}"
11770         fi
11771     else
11772         AC_MSG_RESULT([no])
11773     fi
11775 AC_SUBST(ENABLE_GIO)
11776 AC_SUBST(GIO_CFLAGS)
11777 AC_SUBST(GIO_LIBS)
11780 dnl ===================================================================
11782 SPLIT_APP_MODULES=""
11783 if test "$enable_split_app_modules" = "yes"; then
11784     SPLIT_APP_MODULES="TRUE"
11786 AC_SUBST(SPLIT_APP_MODULES)
11788 SPLIT_OPT_FEATURES=""
11789 if test "$enable_split_opt_features" = "yes"; then
11790     SPLIT_OPT_FEATURES="TRUE"
11792 AC_SUBST(SPLIT_OPT_FEATURES)
11794 dnl ===================================================================
11795 dnl Check whether the GStreamer libraries are available.
11796 dnl ===================================================================
11798 ENABLE_GSTREAMER_1_0=""
11800 if test "$test_gstreamer_1_0" = yes; then
11802     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
11803     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
11804         ENABLE_GSTREAMER_1_0="TRUE"
11805         AC_MSG_RESULT([yes])
11806         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
11807         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11808         FilterLibs "${GSTREAMER_1_0_LIBS}"
11809         GSTREAMER_1_0_LIBS="${filteredlibs}"
11810         AC_DEFINE(ENABLE_GSTREAMER_1_0)
11811     else
11812         AC_MSG_RESULT([no])
11813     fi
11815 AC_SUBST(GSTREAMER_1_0_CFLAGS)
11816 AC_SUBST(GSTREAMER_1_0_LIBS)
11817 AC_SUBST(ENABLE_GSTREAMER_1_0)
11819 ENABLE_OPENGL_TRANSITIONS=
11820 ENABLE_OPENGL_CANVAS=
11821 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
11822    : # disable
11823 elif test "$_os" = "Darwin"; then
11824     # We use frameworks on macOS, no need for detail checks
11825     ENABLE_OPENGL_TRANSITIONS=TRUE
11826     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11827     ENABLE_OPENGL_CANVAS=TRUE
11828 elif test $_os = WINNT; then
11829     ENABLE_OPENGL_TRANSITIONS=TRUE
11830     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11831     ENABLE_OPENGL_CANVAS=TRUE
11832 else
11833     if test "$USING_X11" = TRUE; then
11834         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
11835         ENABLE_OPENGL_TRANSITIONS=TRUE
11836         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11837         ENABLE_OPENGL_CANVAS=TRUE
11838     fi
11841 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
11842 AC_SUBST(ENABLE_OPENGL_CANVAS)
11844 dnl =================================================
11845 dnl Check whether to build with OpenCL support.
11846 dnl =================================================
11848 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE" -a "$enable_opencl" = "yes"; then
11849     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
11850     # platform (optional at run-time, used through clew).
11851     BUILD_TYPE="$BUILD_TYPE OPENCL"
11852     AC_DEFINE(HAVE_FEATURE_OPENCL)
11855 dnl =================================================
11856 dnl Check whether to build with dconf support.
11857 dnl =================================================
11859 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
11860     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
11861         if test "$enable_dconf" = yes; then
11862             AC_MSG_ERROR([dconf not found])
11863         else
11864             enable_dconf=no
11865         fi])
11867 AC_MSG_CHECKING([whether to enable dconf])
11868 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
11869     DCONF_CFLAGS=
11870     DCONF_LIBS=
11871     ENABLE_DCONF=
11872     AC_MSG_RESULT([no])
11873 else
11874     ENABLE_DCONF=TRUE
11875     AC_DEFINE(ENABLE_DCONF)
11876     AC_MSG_RESULT([yes])
11878 AC_SUBST([DCONF_CFLAGS])
11879 AC_SUBST([DCONF_LIBS])
11880 AC_SUBST([ENABLE_DCONF])
11882 # pdf import?
11883 AC_MSG_CHECKING([whether to build the PDF import feature])
11884 ENABLE_PDFIMPORT=
11885 if test -z "$enable_pdfimport" -o "$enable_pdfimport" = yes; then
11886     AC_MSG_RESULT([yes])
11887     ENABLE_PDFIMPORT=TRUE
11888     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
11889 else
11890     AC_MSG_RESULT([no])
11893 # Pdfium?
11894 AC_MSG_CHECKING([whether to build PDFium])
11895 ENABLE_PDFIUM=
11896 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
11897     AC_MSG_RESULT([yes])
11898     ENABLE_PDFIUM=TRUE
11899     BUILD_TYPE="$BUILD_TYPE PDFIUM"
11900 else
11901     AC_MSG_RESULT([no])
11903 AC_SUBST(ENABLE_PDFIUM)
11905 dnl ===================================================================
11906 dnl Check for poppler
11907 dnl ===================================================================
11908 ENABLE_POPPLER=
11909 AC_MSG_CHECKING([whether to build Poppler])
11910 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" -a $_os != Android \) -o "$enable_poppler" = yes; then
11911     AC_MSG_RESULT([yes])
11912     ENABLE_POPPLER=TRUE
11913     AC_DEFINE(HAVE_FEATURE_POPPLER)
11914 else
11915     AC_MSG_RESULT([no])
11917 AC_SUBST(ENABLE_POPPLER)
11919 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
11920     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
11923 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
11924     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
11927 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
11928     dnl ===================================================================
11929     dnl Check for system poppler
11930     dnl ===================================================================
11931     AC_MSG_CHECKING([which PDF import poppler to use])
11932     if test "$with_system_poppler" = "yes"; then
11933         AC_MSG_RESULT([external])
11934         SYSTEM_POPPLER=TRUE
11935         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
11936         AC_LANG_PUSH([C++])
11937         save_CXXFLAGS=$CXXFLAGS
11938         save_CPPFLAGS=$CPPFLAGS
11939         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
11940         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
11941         AC_CHECK_HEADER([cpp/poppler-version.h],
11942             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
11943             [])
11944         CXXFLAGS=$save_CXXFLAGS
11945         CPPFLAGS=$save_CPPFLAGS
11946         AC_LANG_POP([C++])
11947         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11949         FilterLibs "${POPPLER_LIBS}"
11950         POPPLER_LIBS="${filteredlibs}"
11951     else
11952         AC_MSG_RESULT([internal])
11953         SYSTEM_POPPLER=
11954         BUILD_TYPE="$BUILD_TYPE POPPLER"
11955         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
11956     fi
11957     AC_DEFINE([ENABLE_PDFIMPORT],1)
11959 AC_SUBST(ENABLE_PDFIMPORT)
11960 AC_SUBST(SYSTEM_POPPLER)
11961 AC_SUBST(POPPLER_CFLAGS)
11962 AC_SUBST(POPPLER_LIBS)
11964 # Skia?
11965 AC_MSG_CHECKING([whether to build Skia])
11966 ENABLE_SKIA=
11967 if test "$enable_skia" != "no" -a "$build_skia" = "yes" -a -z "$DISABLE_GUI"; then
11968     if test "$enable_skia" = "debug"; then
11969         AC_MSG_RESULT([yes (debug)])
11970         ENABLE_SKIA_DEBUG=TRUE
11971     else
11972         AC_MSG_RESULT([yes])
11973         ENABLE_SKIA_DEBUG=
11974     fi
11975     ENABLE_SKIA=TRUE
11976     AC_DEFINE(HAVE_FEATURE_SKIA)
11977     BUILD_TYPE="$BUILD_TYPE SKIA"
11979     if test -n "$MAC_OS_X_VERSION_MIN_REQUIRED" -a "$MAC_OS_X_VERSION_MIN_REQUIRED" -lt "101200"; then
11980         SKIA_DISABLE_VMA_USE_STL_SHARED_MUTEX=1
11981         AC_SUBST(SKIA_DISABLE_VMA_USE_STL_SHARED_MUTEX)
11982     fi
11984 else
11985     AC_MSG_RESULT([no])
11987 AC_SUBST(ENABLE_SKIA)
11988 AC_SUBST(ENABLE_SKIA_DEBUG)
11990 LO_CLANG_CXXFLAGS_INTRINSICS_SSE2=
11991 LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3=
11992 LO_CLANG_CXXFLAGS_INTRINSICS_SSE41=
11993 LO_CLANG_CXXFLAGS_INTRINSICS_SSE42=
11994 LO_CLANG_CXXFLAGS_INTRINSICS_AVX=
11995 LO_CLANG_CXXFLAGS_INTRINSICS_AVX2=
11996 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512=
11997 LO_CLANG_CXXFLAGS_INTRINSICS_F16C=
11998 LO_CLANG_CXXFLAGS_INTRINSICS_FMA=
12000 if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE -a ! \( "$_os" = "WINNT" -a "$CPUNAME" = "AARCH64" \); then
12001     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12002         AC_MSG_CHECKING([for Clang])
12003         AC_MSG_RESULT([$LO_CLANG_CC / $LO_CLANG_CXX])
12004     else
12005         if test "$_os" = "WINNT"; then
12006             AC_MSG_CHECKING([for clang-cl])
12007             if test -x "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"; then
12008                 LO_CLANG_CC=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"`
12009                 dnl explicitly set -m32/-m64
12010                 LO_CLANG_CC="$LO_CLANG_CC -m$WIN_HOST_BITS"
12011                 LO_CLANG_CXX="$LO_CLANG_CC"
12012                 AC_MSG_RESULT([$LO_CLANG_CC])
12013             else
12014                 AC_MSG_RESULT([no])
12015             fi
12016         else
12017             AC_CHECK_PROG(LO_CLANG_CC,clang,clang,[])
12018             AC_CHECK_PROG(LO_CLANG_CXX,clang++,clang++,[])
12019         fi
12020     fi
12021     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12022         clang2_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $LO_CLANG_CC -E - | tail -1 | sed 's/ //g'`
12023         clang2_ver=`echo "$clang2_version" | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
12024         if test "$clang2_ver" -lt 50002; then
12025             AC_MSG_WARN(["$clang2_version" is too old or unrecognized, must be at least Clang 5.0.2])
12026             LO_CLANG_CC=
12027             LO_CLANG_CXX=
12028         fi
12029     fi
12030     if test -z "$LO_CLANG_CC" -o -z "$LO_CLANG_CXX"; then
12031         # Skia is the default on Windows, so hard-require Clang.
12032         # Elsewhere it's used just by the 'gen' VCL backend which is rarely used.
12033         if test "$_os" = "WINNT"; then
12034             AC_MSG_ERROR([Clang compiler not found. The Skia library needs to be built using Clang.])
12035         else
12036             AC_MSG_WARN([Clang compiler not found.])
12037         fi
12038     else
12040         save_CXX="$CXX"
12041         CXX="$LO_CLANG_CXX"
12042         # copy&paste (and adjust) of intrinsics checks, since MSVC's -arch doesn't work well for Clang-cl
12043         flag_sse2=-msse2
12044         flag_ssse3=-mssse3
12045         flag_sse41=-msse4.1
12046         flag_sse42=-msse4.2
12047         flag_avx=-mavx
12048         flag_avx2=-mavx2
12049         flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
12050         flag_f16c=-mf16c
12051         flag_fma=-mfma
12053         AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
12054         AC_LANG_PUSH([C++])
12055         save_CXXFLAGS=$CXXFLAGS
12056         CXXFLAGS="$CXXFLAGS $flag_sse2"
12057         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12058             #include <emmintrin.h>
12059             int main () {
12060                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12061                 c = _mm_xor_si128 (a, b);
12062                 return 0;
12063             }
12064             ])],
12065             [can_compile_sse2=yes],
12066             [can_compile_sse2=no])
12067         AC_LANG_POP([C++])
12068         CXXFLAGS=$save_CXXFLAGS
12069         AC_MSG_RESULT([${can_compile_sse2}])
12070         if test "${can_compile_sse2}" = "yes" ; then
12071             LO_CLANG_CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
12072         fi
12074         AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
12075         AC_LANG_PUSH([C++])
12076         save_CXXFLAGS=$CXXFLAGS
12077         CXXFLAGS="$CXXFLAGS $flag_ssse3"
12078         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12079             #include <tmmintrin.h>
12080             int main () {
12081                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12082                 c = _mm_maddubs_epi16 (a, b);
12083                 return 0;
12084             }
12085             ])],
12086             [can_compile_ssse3=yes],
12087             [can_compile_ssse3=no])
12088         AC_LANG_POP([C++])
12089         CXXFLAGS=$save_CXXFLAGS
12090         AC_MSG_RESULT([${can_compile_ssse3}])
12091         if test "${can_compile_ssse3}" = "yes" ; then
12092             LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
12093         fi
12095         AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
12096         AC_LANG_PUSH([C++])
12097         save_CXXFLAGS=$CXXFLAGS
12098         CXXFLAGS="$CXXFLAGS $flag_sse41"
12099         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12100             #include <smmintrin.h>
12101             int main () {
12102                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12103                 c = _mm_cmpeq_epi64 (a, b);
12104                 return 0;
12105             }
12106             ])],
12107             [can_compile_sse41=yes],
12108             [can_compile_sse41=no])
12109         AC_LANG_POP([C++])
12110         CXXFLAGS=$save_CXXFLAGS
12111         AC_MSG_RESULT([${can_compile_sse41}])
12112         if test "${can_compile_sse41}" = "yes" ; then
12113             LO_CLANG_CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
12114         fi
12116         AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
12117         AC_LANG_PUSH([C++])
12118         save_CXXFLAGS=$CXXFLAGS
12119         CXXFLAGS="$CXXFLAGS $flag_sse42"
12120         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12121             #include <nmmintrin.h>
12122             int main () {
12123                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12124                 c = _mm_cmpgt_epi64 (a, b);
12125                 return 0;
12126             }
12127             ])],
12128             [can_compile_sse42=yes],
12129             [can_compile_sse42=no])
12130         AC_LANG_POP([C++])
12131         CXXFLAGS=$save_CXXFLAGS
12132         AC_MSG_RESULT([${can_compile_sse42}])
12133         if test "${can_compile_sse42}" = "yes" ; then
12134             LO_CLANG_CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
12135         fi
12137         AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
12138         AC_LANG_PUSH([C++])
12139         save_CXXFLAGS=$CXXFLAGS
12140         CXXFLAGS="$CXXFLAGS $flag_avx"
12141         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12142             #include <immintrin.h>
12143             int main () {
12144                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
12145                 c = _mm256_xor_ps(a, b);
12146                 return 0;
12147             }
12148             ])],
12149             [can_compile_avx=yes],
12150             [can_compile_avx=no])
12151         AC_LANG_POP([C++])
12152         CXXFLAGS=$save_CXXFLAGS
12153         AC_MSG_RESULT([${can_compile_avx}])
12154         if test "${can_compile_avx}" = "yes" ; then
12155             LO_CLANG_CXXFLAGS_INTRINSICS_AVX="$flag_avx"
12156         fi
12158         AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
12159         AC_LANG_PUSH([C++])
12160         save_CXXFLAGS=$CXXFLAGS
12161         CXXFLAGS="$CXXFLAGS $flag_avx2"
12162         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12163             #include <immintrin.h>
12164             int main () {
12165                 __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
12166                 c = _mm256_maddubs_epi16(a, b);
12167                 return 0;
12168             }
12169             ])],
12170             [can_compile_avx2=yes],
12171             [can_compile_avx2=no])
12172         AC_LANG_POP([C++])
12173         CXXFLAGS=$save_CXXFLAGS
12174         AC_MSG_RESULT([${can_compile_avx2}])
12175         if test "${can_compile_avx2}" = "yes" ; then
12176             LO_CLANG_CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
12177         fi
12179         AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
12180         AC_LANG_PUSH([C++])
12181         save_CXXFLAGS=$CXXFLAGS
12182         CXXFLAGS="$CXXFLAGS $flag_avx512"
12183         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12184             #include <immintrin.h>
12185             int main () {
12186                 __m512i a = _mm512_loadu_si512(0);
12187                 return 0;
12188             }
12189             ])],
12190             [can_compile_avx512=yes],
12191             [can_compile_avx512=no])
12192         AC_LANG_POP([C++])
12193         CXXFLAGS=$save_CXXFLAGS
12194         AC_MSG_RESULT([${can_compile_avx512}])
12195         if test "${can_compile_avx512}" = "yes" ; then
12196             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
12197         fi
12199         AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
12200         AC_LANG_PUSH([C++])
12201         save_CXXFLAGS=$CXXFLAGS
12202         CXXFLAGS="$CXXFLAGS $flag_f16c"
12203         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12204             #include <immintrin.h>
12205             int main () {
12206                 __m128i a = _mm_set1_epi32 (0);
12207                 __m128 c;
12208                 c = _mm_cvtph_ps(a);
12209                 return 0;
12210             }
12211             ])],
12212             [can_compile_f16c=yes],
12213             [can_compile_f16c=no])
12214         AC_LANG_POP([C++])
12215         CXXFLAGS=$save_CXXFLAGS
12216         AC_MSG_RESULT([${can_compile_f16c}])
12217         if test "${can_compile_f16c}" = "yes" ; then
12218             LO_CLANG_CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
12219         fi
12221         AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
12222         AC_LANG_PUSH([C++])
12223         save_CXXFLAGS=$CXXFLAGS
12224         CXXFLAGS="$CXXFLAGS $flag_fma"
12225         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12226             #include <immintrin.h>
12227             int main () {
12228                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
12229                 d = _mm256_fmadd_ps(a, b, c);
12230                 return 0;
12231             }
12232             ])],
12233             [can_compile_fma=yes],
12234             [can_compile_fma=no])
12235         AC_LANG_POP([C++])
12236         CXXFLAGS=$save_CXXFLAGS
12237         AC_MSG_RESULT([${can_compile_fma}])
12238         if test "${can_compile_fma}" = "yes" ; then
12239             LO_CLANG_CXXFLAGS_INTRINSICS_FMA="$flag_fma"
12240         fi
12242         CXX="$save_CXX"
12243     fi
12246 # prefix LO_CLANG_CC/LO_CLANG_CXX with ccache if needed
12248 UNCACHED_CLANG_CC="$LO_CLANG_CC"
12249 UNCACHED_CLANG_CXX="$LO_CLANG_CXX"
12250 if test "$CCACHE" != "" -a -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12251     AC_MSG_CHECKING([whether $LO_CLANG_CC is already ccached])
12252     AC_LANG_PUSH([C])
12253     save_CC="$CC"
12254     CC="$LO_CLANG_CC"
12255     save_CFLAGS=$CFLAGS
12256     CFLAGS="$CFLAGS --ccache-skip -O2"
12257     dnl an empty program will do, we're checking the compiler flags
12258     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12259                       [use_ccache=yes], [use_ccache=no])
12260     CFLAGS=$save_CFLAGS
12261     CC=$save_CC
12262     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12263         AC_MSG_RESULT([yes])
12264     else
12265         LO_CLANG_CC="$CCACHE $LO_CLANG_CC"
12266         AC_MSG_RESULT([no])
12267     fi
12268     AC_LANG_POP([C])
12270     AC_MSG_CHECKING([whether $LO_CLANG_CXX is already ccached])
12271     AC_LANG_PUSH([C++])
12272     save_CXX="$CXX"
12273     CXX="$LO_CLANG_CXX"
12274     save_CXXFLAGS=$CXXFLAGS
12275     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
12276     dnl an empty program will do, we're checking the compiler flags
12277     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12278                       [use_ccache=yes], [use_ccache=no])
12279     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12280         AC_MSG_RESULT([yes])
12281     else
12282         LO_CLANG_CXX="$CCACHE $LO_CLANG_CXX"
12283         AC_MSG_RESULT([no])
12284     fi
12285     CXXFLAGS=$save_CXXFLAGS
12286     CXX=$save_CXX
12287     AC_LANG_POP([C++])
12290 AC_SUBST(UNCACHED_CC)
12291 AC_SUBST(UNCACHED_CXX)
12292 AC_SUBST(LO_CLANG_CC)
12293 AC_SUBST(LO_CLANG_CXX)
12294 AC_SUBST(UNCACHED_CLANG_CC)
12295 AC_SUBST(UNCACHED_CLANG_CXX)
12296 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE2)
12297 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3)
12298 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE41)
12299 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE42)
12300 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX)
12301 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX2)
12302 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512)
12303 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_F16C)
12304 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_FMA)
12305 AC_SUBST(CLANG_USE_LD)
12307 SYSTEM_GPGMEPP=
12309 if test "$enable_gpgmepp" = no; then
12310     AC_MSG_CHECKING([whether to enable gpgmepp])
12311     AC_MSG_RESULT([no])
12312 elif test "$enable_mpl_subset" = "yes"; then
12313     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
12314     AC_MSG_RESULT([yes])
12315 elif test "$enable_fuzzers" = "yes"; then
12316     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
12317     AC_MSG_RESULT([yes])
12318 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
12319     dnl ===================================================================
12320     dnl Check for system gpgme
12321     dnl ===================================================================
12322     AC_MSG_CHECKING([which gpgmepp to use])
12323     if test "$with_system_gpgmepp" = "yes"; then
12324         AC_MSG_RESULT([external])
12325         SYSTEM_GPGMEPP=TRUE
12327         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
12328         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
12329             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
12330         # progress_callback is the only func with plain C linkage
12331         # checking for it also filters out older, KDE-dependent libgpgmepp versions
12332         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
12333             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
12334         AC_CHECK_HEADER(gpgme.h, [],
12335             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
12336     else
12337         AC_MSG_RESULT([internal])
12338         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
12339         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
12341         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
12342         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
12343         if test "$_os" != "WINNT"; then
12344             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
12345             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
12346         fi
12347     fi
12348     ENABLE_GPGMEPP=TRUE
12349     AC_DEFINE([HAVE_FEATURE_GPGME])
12350     AC_PATH_PROG(GPG, gpg)
12351     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
12352     # so let's exclude that manually for the moment
12353     if test -n "$GPG" -a "$_os" != "WINNT"; then
12354         # make sure we not only have a working gpgme, but a full working
12355         # gpg installation to run OpenPGP signature verification
12356         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
12357     fi
12358     if test "$_os" = "Linux"; then
12359       uid=`id -u`
12360       AC_MSG_CHECKING([for /run/user/$uid])
12361       if test -d /run/user/$uid; then
12362         AC_MSG_RESULT([yes])
12363         AC_PATH_PROG(GPGCONF, gpgconf)
12365         # Older versions of gpgconf are not working as expected, since
12366         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
12367         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
12368         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
12369         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
12370         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
12371         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
12372         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
12373           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
12374           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
12375           if $GPGCONF --dump-options > /dev/null ; then
12376             if $GPGCONF --dump-options | grep -q create-socketdir ; then
12377               AC_MSG_RESULT([yes])
12378               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
12379               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
12380             else
12381               AC_MSG_RESULT([no])
12382             fi
12383           else
12384             AC_MSG_RESULT([no. missing or broken gpgconf?])
12385           fi
12386         else
12387           AC_MSG_RESULT([no, $GPGCONF_VERSION])
12388         fi
12389       else
12390         AC_MSG_RESULT([no])
12391      fi
12392    fi
12394 AC_SUBST(ENABLE_GPGMEPP)
12395 AC_SUBST(SYSTEM_GPGMEPP)
12396 AC_SUBST(GPG_ERROR_CFLAGS)
12397 AC_SUBST(GPG_ERROR_LIBS)
12398 AC_SUBST(LIBASSUAN_CFLAGS)
12399 AC_SUBST(LIBASSUAN_LIBS)
12400 AC_SUBST(GPGMEPP_CFLAGS)
12401 AC_SUBST(GPGMEPP_LIBS)
12403 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
12404 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
12405     AC_MSG_RESULT([yes])
12406     ENABLE_MEDIAWIKI=TRUE
12407     BUILD_TYPE="$BUILD_TYPE XSLTML"
12408     if test  "x$with_java" = "xno"; then
12409         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
12410     fi
12411 else
12412     AC_MSG_RESULT([no])
12413     ENABLE_MEDIAWIKI=
12414     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
12416 AC_SUBST(ENABLE_MEDIAWIKI)
12418 AC_MSG_CHECKING([whether to build the Report Builder])
12419 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12420     AC_MSG_RESULT([yes])
12421     ENABLE_REPORTBUILDER=TRUE
12422     AC_MSG_CHECKING([which jfreereport libs to use])
12423     if test "$with_system_jfreereport" = "yes"; then
12424         SYSTEM_JFREEREPORT=TRUE
12425         AC_MSG_RESULT([external])
12426         if test -z $SAC_JAR; then
12427             SAC_JAR=/usr/share/java/sac.jar
12428         fi
12429         if ! test -f $SAC_JAR; then
12430              AC_MSG_ERROR(sac.jar not found.)
12431         fi
12433         if test -z $LIBXML_JAR; then
12434             if test -f /usr/share/java/libxml-1.0.0.jar; then
12435                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
12436             elif test -f /usr/share/java/libxml.jar; then
12437                 LIBXML_JAR=/usr/share/java/libxml.jar
12438             else
12439                 AC_MSG_ERROR(libxml.jar replacement not found.)
12440             fi
12441         elif ! test -f $LIBXML_JAR; then
12442             AC_MSG_ERROR(libxml.jar not found.)
12443         fi
12445         if test -z $FLUTE_JAR; then
12446             if test -f /usr/share/java/flute-1.3.0.jar; then
12447                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
12448             elif test -f /usr/share/java/flute.jar; then
12449                 FLUTE_JAR=/usr/share/java/flute.jar
12450             else
12451                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
12452             fi
12453         elif ! test -f $FLUTE_JAR; then
12454             AC_MSG_ERROR(flute-1.3.0.jar not found.)
12455         fi
12457         if test -z $JFREEREPORT_JAR; then
12458             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
12459                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
12460             elif test -f /usr/share/java/flow-engine.jar; then
12461                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
12462             else
12463                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
12464             fi
12465         elif ! test -f  $JFREEREPORT_JAR; then
12466                 AC_MSG_ERROR(jfreereport.jar not found.)
12467         fi
12469         if test -z $LIBLAYOUT_JAR; then
12470             if test -f /usr/share/java/liblayout-0.2.9.jar; then
12471                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
12472             elif test -f /usr/share/java/liblayout.jar; then
12473                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
12474             else
12475                 AC_MSG_ERROR(liblayout.jar replacement not found.)
12476             fi
12477         elif ! test -f $LIBLAYOUT_JAR; then
12478                 AC_MSG_ERROR(liblayout.jar not found.)
12479         fi
12481         if test -z $LIBLOADER_JAR; then
12482             if test -f /usr/share/java/libloader-1.0.0.jar; then
12483                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
12484             elif test -f /usr/share/java/libloader.jar; then
12485                 LIBLOADER_JAR=/usr/share/java/libloader.jar
12486             else
12487                 AC_MSG_ERROR(libloader.jar replacement not found.)
12488             fi
12489         elif ! test -f  $LIBLOADER_JAR; then
12490             AC_MSG_ERROR(libloader.jar not found.)
12491         fi
12493         if test -z $LIBFORMULA_JAR; then
12494             if test -f /usr/share/java/libformula-0.2.0.jar; then
12495                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
12496             elif test -f /usr/share/java/libformula.jar; then
12497                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
12498             else
12499                 AC_MSG_ERROR(libformula.jar replacement not found.)
12500             fi
12501         elif ! test -f $LIBFORMULA_JAR; then
12502                 AC_MSG_ERROR(libformula.jar not found.)
12503         fi
12505         if test -z $LIBREPOSITORY_JAR; then
12506             if test -f /usr/share/java/librepository-1.0.0.jar; then
12507                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
12508             elif test -f /usr/share/java/librepository.jar; then
12509                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
12510             else
12511                 AC_MSG_ERROR(librepository.jar replacement not found.)
12512             fi
12513         elif ! test -f $LIBREPOSITORY_JAR; then
12514             AC_MSG_ERROR(librepository.jar not found.)
12515         fi
12517         if test -z $LIBFONTS_JAR; then
12518             if test -f /usr/share/java/libfonts-1.0.0.jar; then
12519                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
12520             elif test -f /usr/share/java/libfonts.jar; then
12521                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
12522             else
12523                 AC_MSG_ERROR(libfonts.jar replacement not found.)
12524             fi
12525         elif ! test -f $LIBFONTS_JAR; then
12526                 AC_MSG_ERROR(libfonts.jar not found.)
12527         fi
12529         if test -z $LIBSERIALIZER_JAR; then
12530             if test -f /usr/share/java/libserializer-1.0.0.jar; then
12531                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
12532             elif test -f /usr/share/java/libserializer.jar; then
12533                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
12534             else
12535                 AC_MSG_ERROR(libserializer.jar replacement not found.)
12536             fi
12537         elif ! test -f $LIBSERIALIZER_JAR; then
12538                 AC_MSG_ERROR(libserializer.jar not found.)
12539         fi
12541         if test -z $LIBBASE_JAR; then
12542             if test -f /usr/share/java/libbase-1.0.0.jar; then
12543                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
12544             elif test -f /usr/share/java/libbase.jar; then
12545                 LIBBASE_JAR=/usr/share/java/libbase.jar
12546             else
12547                 AC_MSG_ERROR(libbase.jar replacement not found.)
12548             fi
12549         elif ! test -f $LIBBASE_JAR; then
12550             AC_MSG_ERROR(libbase.jar not found.)
12551         fi
12553     else
12554         AC_MSG_RESULT([internal])
12555         SYSTEM_JFREEREPORT=
12556         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
12557         NEED_ANT=TRUE
12558     fi
12559 else
12560     AC_MSG_RESULT([no])
12561     ENABLE_REPORTBUILDER=
12562     SYSTEM_JFREEREPORT=
12564 AC_SUBST(ENABLE_REPORTBUILDER)
12565 AC_SUBST(SYSTEM_JFREEREPORT)
12566 AC_SUBST(SAC_JAR)
12567 AC_SUBST(LIBXML_JAR)
12568 AC_SUBST(FLUTE_JAR)
12569 AC_SUBST(JFREEREPORT_JAR)
12570 AC_SUBST(LIBBASE_JAR)
12571 AC_SUBST(LIBLAYOUT_JAR)
12572 AC_SUBST(LIBLOADER_JAR)
12573 AC_SUBST(LIBFORMULA_JAR)
12574 AC_SUBST(LIBREPOSITORY_JAR)
12575 AC_SUBST(LIBFONTS_JAR)
12576 AC_SUBST(LIBSERIALIZER_JAR)
12578 # scripting provider for BeanShell?
12579 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
12580 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
12581     AC_MSG_RESULT([yes])
12582     ENABLE_SCRIPTING_BEANSHELL=TRUE
12584     dnl ===================================================================
12585     dnl Check for system beanshell
12586     dnl ===================================================================
12587     AC_MSG_CHECKING([which beanshell to use])
12588     if test "$with_system_beanshell" = "yes"; then
12589         AC_MSG_RESULT([external])
12590         SYSTEM_BSH=TRUE
12591         if test -z $BSH_JAR; then
12592             BSH_JAR=/usr/share/java/bsh.jar
12593         fi
12594         if ! test -f $BSH_JAR; then
12595             AC_MSG_ERROR(bsh.jar not found.)
12596         fi
12597     else
12598         AC_MSG_RESULT([internal])
12599         SYSTEM_BSH=
12600         BUILD_TYPE="$BUILD_TYPE BSH"
12601     fi
12602 else
12603     AC_MSG_RESULT([no])
12604     ENABLE_SCRIPTING_BEANSHELL=
12605     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
12607 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
12608 AC_SUBST(SYSTEM_BSH)
12609 AC_SUBST(BSH_JAR)
12611 # scripting provider for JavaScript?
12612 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
12613 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
12614     AC_MSG_RESULT([yes])
12615     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
12617     dnl ===================================================================
12618     dnl Check for system rhino
12619     dnl ===================================================================
12620     AC_MSG_CHECKING([which rhino to use])
12621     if test "$with_system_rhino" = "yes"; then
12622         AC_MSG_RESULT([external])
12623         SYSTEM_RHINO=TRUE
12624         if test -z $RHINO_JAR; then
12625             RHINO_JAR=/usr/share/java/js.jar
12626         fi
12627         if ! test -f $RHINO_JAR; then
12628             AC_MSG_ERROR(js.jar not found.)
12629         fi
12630     else
12631         AC_MSG_RESULT([internal])
12632         SYSTEM_RHINO=
12633         BUILD_TYPE="$BUILD_TYPE RHINO"
12634         NEED_ANT=TRUE
12635     fi
12636 else
12637     AC_MSG_RESULT([no])
12638     ENABLE_SCRIPTING_JAVASCRIPT=
12639     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
12641 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
12642 AC_SUBST(SYSTEM_RHINO)
12643 AC_SUBST(RHINO_JAR)
12645 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
12646 # paths should be added to library search path. So lets put all 64-bit
12647 # platforms there.
12648 supports_multilib=
12649 case "$host_cpu" in
12650 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
12651     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
12652         supports_multilib="yes"
12653     fi
12654     ;;
12656     ;;
12657 esac
12659 dnl ===================================================================
12660 dnl QT5 Integration
12661 dnl ===================================================================
12663 QT5_CFLAGS=""
12664 QT5_LIBS=""
12665 QMAKE5="qmake"
12666 MOC5="moc"
12667 QT5_GOBJECT_CFLAGS=""
12668 QT5_GOBJECT_LIBS=""
12669 QT5_HAVE_GOBJECT=""
12670 QT5_PLATFORMS_SRCDIR=""
12671 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
12672         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
12673         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
12674 then
12675     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
12676     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
12678     if test -n "$supports_multilib"; then
12679         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
12680     fi
12682     qt5_test_include="QtWidgets/qapplication.h"
12683     if test "$_os" = "Emscripten"; then
12684         qt5_test_library="libQt5Widgets.a"
12685     else
12686         qt5_test_library="libQt5Widgets.so"
12687     fi
12689     dnl Check for qmake5
12690     if test -n "$QT5DIR"; then
12691         AC_PATH_PROG(QMAKE5, [qmake], no, [$QT5DIR/bin])
12692     else
12693         AC_PATH_PROGS(QMAKE5, [qmake-qt5 qmake], no)
12694     fi
12695     if test "$QMAKE5" = "no"; then
12696         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12697     else
12698         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
12699         if test -z "$qmake5_test_ver"; then
12700             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12701         fi
12702         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
12703         qt5_minimal_minor="6"
12704         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
12705             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
12706         else
12707             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
12708         fi
12709     fi
12711     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
12712     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
12713     qt5_platformsdir="`$QMAKE5 -query QT_INSTALL_PLUGINS`/platforms"
12714     QT5_PLATFORMS_SRCDIR="$qt5_platformsdir"
12716     AC_MSG_CHECKING([for Qt5 headers])
12717     qt5_incdir="no"
12718     for inc_dir in $qt5_incdirs; do
12719         if test -r "$inc_dir/$qt5_test_include"; then
12720             qt5_incdir="$inc_dir"
12721             break
12722         fi
12723     done
12724     AC_MSG_RESULT([$qt5_incdir])
12725     if test "x$qt5_incdir" = "xno"; then
12726         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12727     fi
12728     # check for scenario: qt5-qtbase-devel-*.86_64 installed but host is i686
12729     AC_LANG_PUSH([C++])
12730     save_CPPFLAGS=$CPPFLAGS
12731     CPPFLAGS="${CPPFLAGS} -I${qt5_incdir}"
12732     AC_CHECK_HEADER(QtCore/qconfig.h, [],
12733         [AC_MSG_ERROR(qconfig.h header not found.)], [])
12734     CPPFLAGS=$save_CPPFLAGS
12735     AC_LANG_POP([C++])
12737     AC_MSG_CHECKING([for Qt5 libraries])
12738     qt5_libdir="no"
12739     for lib_dir in $qt5_libdirs; do
12740         if test -r "$lib_dir/$qt5_test_library"; then
12741             qt5_libdir="$lib_dir"
12742             break
12743         fi
12744     done
12745     AC_MSG_RESULT([$qt5_libdir])
12746     if test "x$qt5_libdir" = "xno"; then
12747         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12748     fi
12750     if test "$_os" = "Emscripten"; then
12751         if test ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html ; then
12752             QT5_PLATFORMS_SRCDIR="${QT5_PLATFORMS_SRCDIR/plugins/src\/plugins}/wasm"
12753         fi
12754         if test ! -f "${qt5_platformsdir}"/libqwasm.a -o ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html; then
12755             AC_MSG_ERROR([No Qt5 WASM QPA plugin found in ${qt5_platformsdir} or ${QT5_PLATFORMS_SRCDIR}])
12756         fi
12757     fi
12759     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
12760     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12761     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
12762     if test "$_os" = "Emscripten"; then
12763         QT5_LIBS="$QT5_LIBS -lqtpcre2 -lQt5EventDispatcherSupport -lQt5FontDatabaseSupport -L${qt5_platformsdir} -lqwasm"
12764     fi
12766     if test "$USING_X11" = TRUE; then
12767         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
12768         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
12769             QT5_HAVE_XCB_ICCCM=1
12770             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
12771         ],[
12772             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)])
12773             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
12774         ])
12775         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
12776         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
12777         QT5_USING_X11=1
12778         AC_DEFINE(QT5_USING_X11)
12779     fi
12781     dnl Check for Meta Object Compiler
12783     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
12784     if test "$MOC5" = "no"; then
12785         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
12786 the root of your Qt installation by exporting QT5DIR before running "configure".])
12787     fi
12789     if test "$test_gstreamer_1_0" = yes; then
12790         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
12791                 QT5_HAVE_GOBJECT=1
12792                 AC_DEFINE(QT5_HAVE_GOBJECT)
12793             ],
12794             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
12795         )
12796     fi
12798 AC_SUBST(QT5_CFLAGS)
12799 AC_SUBST(QT5_LIBS)
12800 AC_SUBST(MOC5)
12801 AC_SUBST(QT5_GOBJECT_CFLAGS)
12802 AC_SUBST(QT5_GOBJECT_LIBS)
12803 AC_SUBST(QT5_HAVE_GOBJECT)
12804 AC_SUBST(QT5_PLATFORMS_SRCDIR)
12806 dnl ===================================================================
12807 dnl KF5 Integration
12808 dnl ===================================================================
12810 KF5_CFLAGS=""
12811 KF5_LIBS=""
12812 KF5_CONFIG="kf5-config"
12813 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
12814         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
12815 then
12816     if test "$OS" = "HAIKU"; then
12817         haiku_arch="`echo $RTL_ARCH | tr X x`"
12818         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
12819         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
12820     fi
12822     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
12823     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
12824     if test -n "$supports_multilib"; then
12825         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
12826     fi
12828     kf5_test_include="KF5/kcoreaddons_version.h"
12829     kf5_test_library="libKF5CoreAddons.so"
12830     kf5_libdirs="$qt5_libdir $kf5_libdirs"
12832     dnl kf5 KDE4 support compatibility installed
12833     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
12834     if test "$KF5_CONFIG" != "no"; then
12835         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
12836         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
12837     fi
12839     dnl Check for KF5 headers
12840     AC_MSG_CHECKING([for KF5 headers])
12841     kf5_incdir="no"
12842     for kf5_check in $kf5_incdirs; do
12843         if test -r "$kf5_check/$kf5_test_include"; then
12844             kf5_incdir="$kf5_check/KF5"
12845             break
12846         fi
12847     done
12848     AC_MSG_RESULT([$kf5_incdir])
12849     if test "x$kf5_incdir" = "xno"; then
12850         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
12851     fi
12853     dnl Check for KF5 libraries
12854     AC_MSG_CHECKING([for KF5 libraries])
12855     kf5_libdir="no"
12856     for kf5_check in $kf5_libdirs; do
12857         if test -r "$kf5_check/$kf5_test_library"; then
12858             kf5_libdir="$kf5_check"
12859             break
12860         fi
12861     done
12863     AC_MSG_RESULT([$kf5_libdir])
12864     if test "x$kf5_libdir" = "xno"; then
12865         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
12866     fi
12868     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"
12869     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
12870     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12872     if test "$USING_X11" = TRUE; then
12873         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
12874     fi
12876     AC_LANG_PUSH([C++])
12877     save_CXXFLAGS=$CXXFLAGS
12878     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
12879     AC_MSG_CHECKING([whether KDE is >= 5.0])
12880        AC_RUN_IFELSE([AC_LANG_SOURCE([[
12881 #include <kcoreaddons_version.h>
12883 int main(int argc, char **argv) {
12884        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
12885        else return 1;
12887        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
12888     CXXFLAGS=$save_CXXFLAGS
12889     AC_LANG_POP([C++])
12891 AC_SUBST(KF5_CFLAGS)
12892 AC_SUBST(KF5_LIBS)
12894 dnl ===================================================================
12895 dnl Test whether to include Evolution 2 support
12896 dnl ===================================================================
12897 AC_MSG_CHECKING([whether to enable evolution 2 support])
12898 if test "$enable_evolution2" = yes; then
12899     AC_MSG_RESULT([yes])
12900     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
12901     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12902     FilterLibs "${GOBJECT_LIBS}"
12903     GOBJECT_LIBS="${filteredlibs}"
12904     ENABLE_EVOAB2="TRUE"
12905 else
12906     AC_MSG_RESULT([no])
12908 AC_SUBST(ENABLE_EVOAB2)
12909 AC_SUBST(GOBJECT_CFLAGS)
12910 AC_SUBST(GOBJECT_LIBS)
12912 dnl ===================================================================
12913 dnl Test which themes to include
12914 dnl ===================================================================
12915 AC_MSG_CHECKING([which themes to include])
12916 # if none given use default subset of available themes
12917 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
12918     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"
12921 WITH_THEMES=""
12922 if test "x$with_theme" != "xno"; then
12923     for theme in $with_theme; do
12924         case $theme in
12925         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" ;;
12926         default) real_theme=colibre ;;
12927         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
12928         esac
12929         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
12930     done
12932 AC_MSG_RESULT([$WITH_THEMES])
12933 AC_SUBST([WITH_THEMES])
12934 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
12935 for theme in $with_theme; do
12936     case $theme in
12937     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
12938     *) ;;
12939     esac
12940 done
12942 ###############################################################################
12943 # Extensions checking
12944 ###############################################################################
12945 AC_MSG_CHECKING([for extensions integration])
12946 if test "x$enable_extension_integration" != "xno"; then
12947     WITH_EXTENSION_INTEGRATION=TRUE
12948     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
12949     AC_MSG_RESULT([yes, use integration])
12950 else
12951     WITH_EXTENSION_INTEGRATION=
12952     AC_MSG_RESULT([no, do not integrate])
12954 AC_SUBST(WITH_EXTENSION_INTEGRATION)
12956 dnl Should any extra extensions be included?
12957 dnl There are standalone tests for each of these below.
12958 WITH_EXTRA_EXTENSIONS=
12959 AC_SUBST([WITH_EXTRA_EXTENSIONS])
12961 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
12962 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
12963 if test "x$with_java" != "xno"; then
12964     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
12965     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
12968 AC_MSG_CHECKING([whether to build opens___.ttf])
12969 if test "$enable_build_opensymbol" = "yes"; then
12970     AC_MSG_RESULT([yes])
12971     AC_PATH_PROG(FONTFORGE, fontforge)
12972     if test -z "$FONTFORGE"; then
12973         AC_MSG_ERROR([fontforge not installed])
12974     fi
12975 else
12976     AC_MSG_RESULT([no])
12977     OPENSYMBOL_TTF=f543e6e2d7275557a839a164941c0a86e5f2c3f2a0042bfc434c88c6dde9e140-opens___.ttf
12978     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
12980 AC_SUBST(OPENSYMBOL_TTF)
12981 AC_SUBST(FONTFORGE)
12983 dnl ===================================================================
12984 dnl Test whether to include fonts
12985 dnl ===================================================================
12986 AC_MSG_CHECKING([whether to include third-party fonts])
12987 if test "$with_fonts" != "no"; then
12988     AC_MSG_RESULT([yes])
12989     WITH_FONTS=TRUE
12990     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
12991     AC_DEFINE(HAVE_MORE_FONTS)
12992 else
12993     AC_MSG_RESULT([no])
12994     WITH_FONTS=
12995     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
12997 AC_SUBST(WITH_FONTS)
13000 dnl ===================================================================
13001 dnl Test whether to enable online update service
13002 dnl ===================================================================
13003 AC_MSG_CHECKING([whether to enable online update])
13004 ENABLE_ONLINE_UPDATE=
13005 ENABLE_ONLINE_UPDATE_MAR=
13006 UPDATE_CONFIG=
13007 if test "$enable_online_update" = ""; then
13008     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
13009         AC_MSG_RESULT([yes])
13010         ENABLE_ONLINE_UPDATE="TRUE"
13011     else
13012         AC_MSG_RESULT([no])
13013     fi
13014 else
13015     if test "$enable_online_update" = "mar"; then
13016         AC_MSG_RESULT([yes - MAR-based online update])
13017         ENABLE_ONLINE_UPDATE_MAR="TRUE"
13018         if test "$with_update_config" = ""; then
13019             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
13020         fi
13021         UPDATE_CONFIG="$with_update_config"
13022         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
13023     elif test "$enable_online_update" = "yes"; then
13024         AC_MSG_RESULT([yes])
13025         ENABLE_ONLINE_UPDATE="TRUE"
13026     else
13027         AC_MSG_RESULT([no])
13028     fi
13030 AC_SUBST(ENABLE_ONLINE_UPDATE)
13031 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
13032 AC_SUBST(UPDATE_CONFIG)
13035 PRIVACY_POLICY_URL="$with_privacy_policy_url"
13036 if test "$ENABLE_ONLINE_UPDATE" = TRUE -o "$ENABLE_BREAKPAD" = "TRUE"; then
13037     if test "x$with_privacy_policy_url" = "xundefined"; then
13038         AC_MSG_FAILURE([online update or breakpad/crashreporting are enabled, but no --with-privacy-policy-url=... was provided])
13039     fi
13041 AC_SUBST(PRIVACY_POLICY_URL)
13042 dnl ===================================================================
13043 dnl Test whether we need bzip2
13044 dnl ===================================================================
13045 SYSTEM_BZIP2=
13046 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
13047     AC_MSG_CHECKING([whether to use system bzip2])
13048     if test "$with_system_bzip2" = yes; then
13049         SYSTEM_BZIP2=TRUE
13050         AC_MSG_RESULT([yes])
13051         PKG_CHECK_MODULES(BZIP2, bzip2)
13052         FilterLibs "${BZIP2_LIBS}"
13053         BZIP2_LIBS="${filteredlibs}"
13054     else
13055         AC_MSG_RESULT([no])
13056         BUILD_TYPE="$BUILD_TYPE BZIP2"
13057     fi
13059 AC_SUBST(SYSTEM_BZIP2)
13060 AC_SUBST(BZIP2_CFLAGS)
13061 AC_SUBST(BZIP2_LIBS)
13063 dnl ===================================================================
13064 dnl Test whether to enable extension update
13065 dnl ===================================================================
13066 AC_MSG_CHECKING([whether to enable extension update])
13067 ENABLE_EXTENSION_UPDATE=
13068 if test "x$enable_extension_update" = "xno"; then
13069     AC_MSG_RESULT([no])
13070 else
13071     AC_MSG_RESULT([yes])
13072     ENABLE_EXTENSION_UPDATE="TRUE"
13073     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
13074     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
13076 AC_SUBST(ENABLE_EXTENSION_UPDATE)
13079 dnl ===================================================================
13080 dnl Test whether to create MSI with LIMITUI=1 (silent install)
13081 dnl ===================================================================
13082 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
13083 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
13084     AC_MSG_RESULT([no])
13085     ENABLE_SILENT_MSI=
13086 else
13087     AC_MSG_RESULT([yes])
13088     ENABLE_SILENT_MSI=TRUE
13089     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
13091 AC_SUBST(ENABLE_SILENT_MSI)
13093 AC_MSG_CHECKING([whether and how to use Xinerama])
13094 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
13095     if test "$x_libraries" = "default_x_libraries"; then
13096         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
13097         if test "x$XINERAMALIB" = x; then
13098            XINERAMALIB="/usr/lib"
13099         fi
13100     else
13101         XINERAMALIB="$x_libraries"
13102     fi
13103     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
13104         # we have both versions, let the user decide but use the dynamic one
13105         # per default
13106         USE_XINERAMA=TRUE
13107         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
13108             XINERAMA_LINK=dynamic
13109         else
13110             XINERAMA_LINK=static
13111         fi
13112     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
13113         # we have only the dynamic version
13114         USE_XINERAMA=TRUE
13115         XINERAMA_LINK=dynamic
13116     elif test -e "$XINERAMALIB/libXinerama.a"; then
13117         # static version
13118         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
13119             USE_XINERAMA=TRUE
13120             XINERAMA_LINK=static
13121         else
13122             USE_XINERAMA=
13123             XINERAMA_LINK=none
13124         fi
13125     else
13126         # no Xinerama
13127         USE_XINERAMA=
13128         XINERAMA_LINK=none
13129     fi
13130     if test "$USE_XINERAMA" = "TRUE"; then
13131         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
13132         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
13133             [AC_MSG_ERROR(Xinerama header not found.)], [])
13134         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
13135         if test "x$XEXTLIB" = x; then
13136            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
13137         fi
13138         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
13139         if test "$_os" = "FreeBSD"; then
13140             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
13141         fi
13142         if test "$_os" = "Linux"; then
13143             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
13144         fi
13145         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
13146             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
13147     else
13148         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
13149     fi
13150 else
13151     USE_XINERAMA=
13152     XINERAMA_LINK=none
13153     AC_MSG_RESULT([no])
13155 AC_SUBST(USE_XINERAMA)
13156 AC_SUBST(XINERAMA_LINK)
13158 dnl ===================================================================
13159 dnl Test whether to build cairo or rely on the system version
13160 dnl ===================================================================
13162 if test "$test_cairo" = "yes"; then
13163     AC_MSG_CHECKING([whether to use the system cairo])
13165     : ${with_system_cairo:=$with_system_libs}
13166     if test "$with_system_cairo" = "yes"; then
13167         SYSTEM_CAIRO=TRUE
13168         AC_MSG_RESULT([yes])
13170         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
13171         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13172         FilterLibs "${CAIRO_LIBS}"
13173         CAIRO_LIBS="${filteredlibs}"
13175         if test "$test_xrender" = "yes"; then
13176             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
13177             AC_LANG_PUSH([C])
13178             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
13179 #ifdef PictStandardA8
13180 #else
13181       return fail;
13182 #endif
13183 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
13185             AC_LANG_POP([C])
13186         fi
13187     else
13188         AC_MSG_RESULT([no])
13189         BUILD_TYPE="$BUILD_TYPE CAIRO"
13190     fi
13192     if test "$enable_cairo_canvas" != no; then
13193         AC_DEFINE(ENABLE_CAIRO_CANVAS)
13194         ENABLE_CAIRO_CANVAS=TRUE
13195     fi
13198 AC_SUBST(CAIRO_CFLAGS)
13199 AC_SUBST(CAIRO_LIBS)
13200 AC_SUBST(ENABLE_CAIRO_CANVAS)
13201 AC_SUBST(SYSTEM_CAIRO)
13203 dnl ===================================================================
13204 dnl Test whether to use avahi
13205 dnl ===================================================================
13206 if test "$_os" = "WINNT"; then
13207     # Windows uses bundled mDNSResponder
13208     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
13209 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
13210     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
13211                       [ENABLE_AVAHI="TRUE"])
13212     AC_DEFINE(HAVE_FEATURE_AVAHI)
13213     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13214     FilterLibs "${AVAHI_LIBS}"
13215     AVAHI_LIBS="${filteredlibs}"
13218 AC_SUBST(ENABLE_AVAHI)
13219 AC_SUBST(AVAHI_CFLAGS)
13220 AC_SUBST(AVAHI_LIBS)
13222 dnl ===================================================================
13223 dnl Test whether to use liblangtag
13224 dnl ===================================================================
13225 SYSTEM_LIBLANGTAG=
13226 AC_MSG_CHECKING([whether to use system liblangtag])
13227 if test "$with_system_liblangtag" = yes; then
13228     SYSTEM_LIBLANGTAG=TRUE
13229     AC_MSG_RESULT([yes])
13230     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
13231     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
13232     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
13233     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13234     FilterLibs "${LIBLANGTAG_LIBS}"
13235     LIBLANGTAG_LIBS="${filteredlibs}"
13236 else
13237     SYSTEM_LIBLANGTAG=
13238     AC_MSG_RESULT([no])
13239     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
13240     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
13241     if test "$COM" = "MSC"; then
13242         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
13243     else
13244         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
13245     fi
13247 AC_SUBST(SYSTEM_LIBLANGTAG)
13248 AC_SUBST(LIBLANGTAG_CFLAGS)
13249 AC_SUBST(LIBLANGTAG_LIBS)
13251 dnl ===================================================================
13252 dnl Test whether to build libpng or rely on the system version
13253 dnl ===================================================================
13255 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
13257 dnl ===================================================================
13258 dnl Check for runtime JVM search path
13259 dnl ===================================================================
13260 if test "$ENABLE_JAVA" != ""; then
13261     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
13262     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
13263         AC_MSG_RESULT([yes])
13264         if ! test -d "$with_jvm_path"; then
13265             AC_MSG_ERROR(["$with_jvm_path" not a directory])
13266         fi
13267         if ! test -d "$with_jvm_path"jvm; then
13268             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
13269         fi
13270         JVM_ONE_PATH_CHECK="$with_jvm_path"
13271         AC_SUBST(JVM_ONE_PATH_CHECK)
13272     else
13273         AC_MSG_RESULT([no])
13274     fi
13277 dnl ===================================================================
13278 dnl Test for the presence of Ant and that it works
13279 dnl ===================================================================
13281 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE" -a "$cross_compiling" != "yes"; then
13282     ANT_HOME=; export ANT_HOME
13283     WITH_ANT_HOME=; export WITH_ANT_HOME
13284     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
13285         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
13286             if test "$_os" = "WINNT"; then
13287                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
13288             else
13289                 with_ant_home="$LODE_HOME/opt/ant"
13290             fi
13291         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
13292             with_ant_home="$LODE_HOME/opt/ant"
13293         fi
13294     fi
13295     if test -z "$with_ant_home"; then
13296         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
13297     else
13298         if test "$_os" = "WINNT"; then
13299             # AC_PATH_PROGS needs unix path
13300             with_ant_home=`cygpath -u "$with_ant_home"`
13301         fi
13302         AbsolutePath "$with_ant_home"
13303         with_ant_home=$absolute_path
13304         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
13305         WITH_ANT_HOME=$with_ant_home
13306         ANT_HOME=$with_ant_home
13307     fi
13309     if test -z "$ANT"; then
13310         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
13311     else
13312         # resolve relative or absolute symlink
13313         while test -h "$ANT"; do
13314             a_cwd=`pwd`
13315             a_basename=`basename "$ANT"`
13316             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
13317             cd "`dirname "$ANT"`"
13318             cd "`dirname "$a_script"`"
13319             ANT="`pwd`"/"`basename "$a_script"`"
13320             cd "$a_cwd"
13321         done
13323         AC_MSG_CHECKING([if $ANT works])
13324         mkdir -p conftest.dir
13325         a_cwd=$(pwd)
13326         cd conftest.dir
13327         cat > conftest.java << EOF
13328         public class conftest {
13329             int testmethod(int a, int b) {
13330                     return a + b;
13331             }
13332         }
13335         cat > conftest.xml << EOF
13336         <project name="conftest" default="conftest">
13337         <target name="conftest">
13338             <javac srcdir="." includes="conftest.java">
13339             </javac>
13340         </target>
13341         </project>
13344         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
13345         if test $? = 0 -a -f ./conftest.class; then
13346             AC_MSG_RESULT([Ant works])
13347             if test -z "$WITH_ANT_HOME"; then
13348                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
13349                 if test -z "$ANT_HOME"; then
13350                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
13351                 fi
13352             else
13353                 ANT_HOME="$WITH_ANT_HOME"
13354             fi
13355         else
13356             echo "configure: Ant test failed" >&5
13357             cat conftest.java >&5
13358             cat conftest.xml >&5
13359             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
13360         fi
13361         cd "$a_cwd"
13362         rm -fr conftest.dir
13363     fi
13364     if test -z "$ANT_HOME"; then
13365         ANT_HOME="NO_ANT_HOME"
13366     else
13367         PathFormat "$ANT_HOME"
13368         ANT_HOME="$formatted_path"
13369         PathFormat "$ANT"
13370         ANT="$formatted_path"
13371     fi
13373     dnl Checking for ant.jar
13374     if test "$ANT_HOME" != "NO_ANT_HOME"; then
13375         AC_MSG_CHECKING([Ant lib directory])
13376         if test -f $ANT_HOME/lib/ant.jar; then
13377             ANT_LIB="$ANT_HOME/lib"
13378         else
13379             if test -f $ANT_HOME/ant.jar; then
13380                 ANT_LIB="$ANT_HOME"
13381             else
13382                 if test -f /usr/share/java/ant.jar; then
13383                     ANT_LIB=/usr/share/java
13384                 else
13385                     if test -f /usr/share/ant-core/lib/ant.jar; then
13386                         ANT_LIB=/usr/share/ant-core/lib
13387                     else
13388                         if test -f $ANT_HOME/lib/ant/ant.jar; then
13389                             ANT_LIB="$ANT_HOME/lib/ant"
13390                         else
13391                             if test -f /usr/share/lib/ant/ant.jar; then
13392                                 ANT_LIB=/usr/share/lib/ant
13393                             else
13394                                 AC_MSG_ERROR([Ant libraries not found!])
13395                             fi
13396                         fi
13397                     fi
13398                 fi
13399             fi
13400         fi
13401         PathFormat "$ANT_LIB"
13402         ANT_LIB="$formatted_path"
13403         AC_MSG_RESULT([Ant lib directory found.])
13404     fi
13406     ant_minver=1.6.0
13407     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
13409     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
13410     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
13411     ant_version_major=`echo $ant_version | cut -d. -f1`
13412     ant_version_minor=`echo $ant_version | cut -d. -f2`
13413     echo "configure: ant_version $ant_version " >&5
13414     echo "configure: ant_version_major $ant_version_major " >&5
13415     echo "configure: ant_version_minor $ant_version_minor " >&5
13416     if test "$ant_version_major" -ge "2"; then
13417         AC_MSG_RESULT([yes, $ant_version])
13418     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
13419         AC_MSG_RESULT([yes, $ant_version])
13420     else
13421         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
13422     fi
13424     rm -f conftest* core core.* *.core
13426 AC_SUBST(ANT)
13427 AC_SUBST(ANT_HOME)
13428 AC_SUBST(ANT_LIB)
13430 OOO_JUNIT_JAR=
13431 HAMCREST_JAR=
13432 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no" -a "$cross_compiling" != "yes"; then
13433     AC_MSG_CHECKING([for JUnit 4])
13434     if test "$with_junit" = "yes"; then
13435         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
13436             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
13437         elif test -e /usr/share/java/junit4.jar; then
13438             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
13439         else
13440            if test -e /usr/share/lib/java/junit.jar; then
13441               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
13442            else
13443               OOO_JUNIT_JAR=/usr/share/java/junit.jar
13444            fi
13445         fi
13446     else
13447         OOO_JUNIT_JAR=$with_junit
13448     fi
13449     if test "$_os" = "WINNT"; then
13450         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
13451     fi
13452     printf 'import org.junit.Before;' > conftest.java
13453     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
13454         AC_MSG_RESULT([$OOO_JUNIT_JAR])
13455     else
13456         AC_MSG_ERROR(
13457 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
13458  specify its pathname via --with-junit=..., or disable it via --without-junit])
13459     fi
13460     rm -f conftest.class conftest.java
13461     if test $OOO_JUNIT_JAR != ""; then
13462         BUILD_TYPE="$BUILD_TYPE QADEVOOO"
13463     fi
13465     AC_MSG_CHECKING([for included Hamcrest])
13466     printf 'import org.hamcrest.BaseDescription;' > conftest.java
13467     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
13468         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
13469     else
13470         AC_MSG_RESULT([Not included])
13471         AC_MSG_CHECKING([for standalone hamcrest jar.])
13472         if test "$with_hamcrest" = "yes"; then
13473             if test -e /usr/share/lib/java/hamcrest.jar; then
13474                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
13475             elif test -e /usr/share/java/hamcrest/core.jar; then
13476                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
13477             elif test -e /usr/share/java/hamcrest/hamcrest.jar; then
13478                 HAMCREST_JAR=/usr/share/java/hamcrest/hamcrest.jar
13479             else
13480                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
13481             fi
13482         else
13483             HAMCREST_JAR=$with_hamcrest
13484         fi
13485         if test "$_os" = "WINNT"; then
13486             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
13487         fi
13488         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
13489             AC_MSG_RESULT([$HAMCREST_JAR])
13490         else
13491             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),
13492                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
13493         fi
13494     fi
13495     rm -f conftest.class conftest.java
13497 AC_SUBST(OOO_JUNIT_JAR)
13498 AC_SUBST(HAMCREST_JAR)
13501 AC_SUBST(SCPDEFS)
13504 # check for wget and curl
13506 WGET=
13507 CURL=
13509 if test "$enable_fetch_external" != "no"; then
13511 CURL=`which curl 2>/dev/null`
13513 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
13514     # wget new enough?
13515     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
13516     if test $? -eq 0; then
13517         WGET=$i
13518         break
13519     fi
13520 done
13522 if test -z "$WGET" -a -z "$CURL"; then
13523     AC_MSG_ERROR([neither wget nor curl found!])
13528 AC_SUBST(WGET)
13529 AC_SUBST(CURL)
13532 # check for sha256sum
13534 SHA256SUM=
13536 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
13537     eval "$i -a 256 --version" > /dev/null 2>&1
13538     ret=$?
13539     if test $ret -eq 0; then
13540         SHA256SUM="$i -a 256"
13541         break
13542     fi
13543 done
13545 if test -z "$SHA256SUM"; then
13546     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
13547         eval "$i --version" > /dev/null 2>&1
13548         ret=$?
13549         if test $ret -eq 0; then
13550             SHA256SUM=$i
13551             break
13552         fi
13553     done
13556 if test -z "$SHA256SUM"; then
13557     AC_MSG_ERROR([no sha256sum found!])
13560 AC_SUBST(SHA256SUM)
13562 dnl ===================================================================
13563 dnl Dealing with l10n options
13564 dnl ===================================================================
13565 AC_MSG_CHECKING([which languages to be built])
13566 # get list of all languages
13567 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
13568 # the sed command does the following:
13569 #   + if a line ends with a backslash, append the next line to it
13570 #   + adds " on the beginning of the value (after =)
13571 #   + adds " at the end of the value
13572 #   + removes en-US; we want to put it on the beginning
13573 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
13574 [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)]
13575 ALL_LANGS="en-US $completelangiso"
13576 # check the configured localizations
13577 WITH_LANG="$with_lang"
13579 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
13580 # (Norwegian is "nb" and "nn".)
13581 if test "$WITH_LANG" = "no"; then
13582     WITH_LANG=
13585 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
13586     AC_MSG_RESULT([en-US])
13587 else
13588     AC_MSG_RESULT([$WITH_LANG])
13589     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
13590     if test -z "$MSGFMT"; then
13591         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
13592             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
13593         elif test -x "/opt/lo/bin/msgfmt"; then
13594             MSGFMT="/opt/lo/bin/msgfmt"
13595         else
13596             AC_CHECK_PROGS(MSGFMT, [msgfmt])
13597             if test -z "$MSGFMT"; then
13598                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
13599             fi
13600         fi
13601     fi
13602     if test -z "$MSGUNIQ"; then
13603         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
13604             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
13605         elif test -x "/opt/lo/bin/msguniq"; then
13606             MSGUNIQ="/opt/lo/bin/msguniq"
13607         else
13608             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
13609             if test -z "$MSGUNIQ"; then
13610                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
13611             fi
13612         fi
13613     fi
13615 AC_SUBST(MSGFMT)
13616 AC_SUBST(MSGUNIQ)
13617 # check that the list is valid
13618 for lang in $WITH_LANG; do
13619     test "$lang" = "ALL" && continue
13620     # need to check for the exact string, so add space before and after the list of all languages
13621     for vl in $ALL_LANGS; do
13622         if test "$vl" = "$lang"; then
13623            break
13624         fi
13625     done
13626     if test "$vl" != "$lang"; then
13627         # if you're reading this - you prolly quoted your languages remove the quotes ...
13628         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
13629     fi
13630 done
13631 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
13632     echo $WITH_LANG | grep -q en-US
13633     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
13635 # list with substituted ALL
13636 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
13637 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
13638 test "$WITH_LANG" = "en-US" && WITH_LANG=
13639 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
13640     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
13641     ALL_LANGS=`echo $ALL_LANGS qtz`
13643 AC_SUBST(ALL_LANGS)
13644 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
13645 AC_SUBST(WITH_LANG)
13646 AC_SUBST(WITH_LANG_LIST)
13647 AC_SUBST(GIT_NEEDED_SUBMODULES)
13649 WITH_POOR_HELP_LOCALIZATIONS=
13650 if test -d "$SRC_ROOT/translations/source"; then
13651     for l in `ls -1 $SRC_ROOT/translations/source`; do
13652         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
13653             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
13654         fi
13655     done
13657 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
13659 if test -n "$with_locales"; then
13660     WITH_LOCALES="$with_locales"
13662     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
13663     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
13664     # config_host/config_locales.h.in
13665     for locale in $WITH_LOCALES; do
13666         lang=${locale%_*}
13668         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
13670         case $lang in
13671         hi|mr*ne)
13672             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
13673             ;;
13674         bg|ru)
13675             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
13676             ;;
13677         esac
13678     done
13679 else
13680     AC_DEFINE(WITH_LOCALE_ALL)
13682 AC_SUBST(WITH_LOCALES)
13684 dnl git submodule update --reference
13685 dnl ===================================================================
13686 if test -n "${GIT_REFERENCE_SRC}"; then
13687     for repo in ${GIT_NEEDED_SUBMODULES}; do
13688         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
13689             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
13690         fi
13691     done
13693 AC_SUBST(GIT_REFERENCE_SRC)
13695 dnl git submodules linked dirs
13696 dnl ===================================================================
13697 if test -n "${GIT_LINK_SRC}"; then
13698     for repo in ${GIT_NEEDED_SUBMODULES}; do
13699         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
13700             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
13701         fi
13702     done
13704 AC_SUBST(GIT_LINK_SRC)
13706 dnl branding
13707 dnl ===================================================================
13708 AC_MSG_CHECKING([for alternative branding images directory])
13709 # initialize mapped arrays
13710 BRAND_INTRO_IMAGES="intro.png intro-highres.png"
13711 brand_files="$BRAND_INTRO_IMAGES logo.svg logo_inverted.svg logo-sc.svg logo-sc_inverted.svg about.svg"
13713 if test -z "$with_branding" -o "$with_branding" = "no"; then
13714     AC_MSG_RESULT([none])
13715     DEFAULT_BRAND_IMAGES="$brand_files"
13716 else
13717     if ! test -d $with_branding ; then
13718         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
13719     else
13720         AC_MSG_RESULT([$with_branding])
13721         CUSTOM_BRAND_DIR="$with_branding"
13722         for lfile in $brand_files
13723         do
13724             if ! test -f $with_branding/$lfile ; then
13725                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
13726                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
13727             else
13728                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
13729             fi
13730         done
13731         check_for_progress="yes"
13732     fi
13734 AC_SUBST([BRAND_INTRO_IMAGES])
13735 AC_SUBST([CUSTOM_BRAND_DIR])
13736 AC_SUBST([CUSTOM_BRAND_IMAGES])
13737 AC_SUBST([DEFAULT_BRAND_IMAGES])
13740 AC_MSG_CHECKING([for 'intro' progress settings])
13741 PROGRESSBARCOLOR=
13742 PROGRESSSIZE=
13743 PROGRESSPOSITION=
13744 PROGRESSFRAMECOLOR=
13745 PROGRESSTEXTCOLOR=
13746 PROGRESSTEXTBASELINE=
13748 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
13749     source "$with_branding/progress.conf"
13750     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
13751 else
13752     AC_MSG_RESULT([none])
13755 AC_SUBST(PROGRESSBARCOLOR)
13756 AC_SUBST(PROGRESSSIZE)
13757 AC_SUBST(PROGRESSPOSITION)
13758 AC_SUBST(PROGRESSFRAMECOLOR)
13759 AC_SUBST(PROGRESSTEXTCOLOR)
13760 AC_SUBST(PROGRESSTEXTBASELINE)
13763 dnl ===================================================================
13764 dnl Custom build version
13765 dnl ===================================================================
13766 AC_MSG_CHECKING([for extra build ID])
13767 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
13768     EXTRA_BUILDID="$with_extra_buildid"
13770 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
13771 if test -n "$EXTRA_BUILDID" ; then
13772     AC_MSG_RESULT([$EXTRA_BUILDID])
13773 else
13774     AC_MSG_RESULT([not set])
13776 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
13778 OOO_VENDOR=
13779 AC_MSG_CHECKING([for vendor])
13780 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
13781     OOO_VENDOR="$USERNAME"
13783     if test -z "$OOO_VENDOR"; then
13784         OOO_VENDOR="$USER"
13785     fi
13787     if test -z "$OOO_VENDOR"; then
13788         OOO_VENDOR="`id -u -n`"
13789     fi
13791     AC_MSG_RESULT([not set, using $OOO_VENDOR])
13792 else
13793     OOO_VENDOR="$with_vendor"
13794     AC_MSG_RESULT([$OOO_VENDOR])
13796 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
13797 AC_SUBST(OOO_VENDOR)
13799 if test "$_os" = "Android" ; then
13800     ANDROID_PACKAGE_NAME=
13801     AC_MSG_CHECKING([for Android package name])
13802     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
13803         if test -n "$ENABLE_DEBUG"; then
13804             # Default to the package name that makes ndk-gdb happy.
13805             ANDROID_PACKAGE_NAME="org.libreoffice"
13806         else
13807             ANDROID_PACKAGE_NAME="org.example.libreoffice"
13808         fi
13810         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
13811     else
13812         ANDROID_PACKAGE_NAME="$with_android_package_name"
13813         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
13814     fi
13815     AC_SUBST(ANDROID_PACKAGE_NAME)
13818 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
13819 if test "$with_compat_oowrappers" = "yes"; then
13820     WITH_COMPAT_OOWRAPPERS=TRUE
13821     AC_MSG_RESULT(yes)
13822 else
13823     WITH_COMPAT_OOWRAPPERS=
13824     AC_MSG_RESULT(no)
13826 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
13828 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
13829 AC_MSG_CHECKING([for install dirname])
13830 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
13831     INSTALLDIRNAME="$with_install_dirname"
13833 AC_MSG_RESULT([$INSTALLDIRNAME])
13834 AC_SUBST(INSTALLDIRNAME)
13836 AC_MSG_CHECKING([for prefix])
13837 test "x$prefix" = xNONE && prefix=$ac_default_prefix
13838 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
13839 PREFIXDIR="$prefix"
13840 AC_MSG_RESULT([$PREFIXDIR])
13841 AC_SUBST(PREFIXDIR)
13843 LIBDIR=[$(eval echo $(eval echo $libdir))]
13844 AC_SUBST(LIBDIR)
13846 DATADIR=[$(eval echo $(eval echo $datadir))]
13847 AC_SUBST(DATADIR)
13849 MANDIR=[$(eval echo $(eval echo $mandir))]
13850 AC_SUBST(MANDIR)
13852 DOCDIR=[$(eval echo $(eval echo $docdir))]
13853 AC_SUBST(DOCDIR)
13855 BINDIR=[$(eval echo $(eval echo $bindir))]
13856 AC_SUBST(BINDIR)
13858 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
13859 AC_SUBST(INSTALLDIR)
13861 TESTINSTALLDIR="${BUILDDIR}/test-install"
13862 AC_SUBST(TESTINSTALLDIR)
13865 # ===================================================================
13866 # OAuth2 id and secrets
13867 # ===================================================================
13869 AC_MSG_CHECKING([for Google Drive client id and secret])
13870 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
13871     AC_MSG_RESULT([not set])
13872     GDRIVE_CLIENT_ID="\"\""
13873     GDRIVE_CLIENT_SECRET="\"\""
13874 else
13875     AC_MSG_RESULT([set])
13876     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
13877     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
13879 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
13880 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
13882 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
13883 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
13884     AC_MSG_RESULT([not set])
13885     ALFRESCO_CLOUD_CLIENT_ID="\"\""
13886     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
13887 else
13888     AC_MSG_RESULT([set])
13889     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
13890     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
13892 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
13893 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
13895 AC_MSG_CHECKING([for OneDrive client id and secret])
13896 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
13897     AC_MSG_RESULT([not set])
13898     ONEDRIVE_CLIENT_ID="\"\""
13899     ONEDRIVE_CLIENT_SECRET="\"\""
13900 else
13901     AC_MSG_RESULT([set])
13902     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
13903     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
13905 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
13906 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
13909 dnl ===================================================================
13910 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
13911 dnl --enable-dependency-tracking configure option
13912 dnl ===================================================================
13913 AC_MSG_CHECKING([whether to enable dependency tracking])
13914 if test "$enable_dependency_tracking" = "no"; then
13915     nodep=TRUE
13916     AC_MSG_RESULT([no])
13917 else
13918     AC_MSG_RESULT([yes])
13920 AC_SUBST(nodep)
13922 dnl ===================================================================
13923 dnl Number of CPUs to use during the build
13924 dnl ===================================================================
13925 AC_MSG_CHECKING([for number of processors to use])
13926 # plain --with-parallelism is just the default
13927 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
13928     if test "$with_parallelism" = "no"; then
13929         PARALLELISM=0
13930     else
13931         PARALLELISM=$with_parallelism
13932     fi
13933 else
13934     if test "$enable_icecream" = "yes"; then
13935         PARALLELISM="40"
13936     else
13937         case `uname -s` in
13939         Darwin|FreeBSD|NetBSD|OpenBSD)
13940             PARALLELISM=`sysctl -n hw.ncpu`
13941             ;;
13943         Linux)
13944             PARALLELISM=`getconf _NPROCESSORS_ONLN`
13945         ;;
13946         # what else than above does profit here *and* has /proc?
13947         *)
13948             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
13949             ;;
13950         esac
13952         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
13953         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
13954     fi
13957 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
13958     if test -z "$with_parallelism"; then
13959             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
13960             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
13961             PARALLELISM="1"
13962     else
13963         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."
13964     fi
13967 if test $PARALLELISM -eq 0; then
13968     AC_MSG_RESULT([explicit make -j option needed])
13969 else
13970     AC_MSG_RESULT([$PARALLELISM])
13972 AC_SUBST(PARALLELISM)
13974 IWYU_PATH="$with_iwyu"
13975 AC_SUBST(IWYU_PATH)
13976 if test ! -z "$IWYU_PATH"; then
13977     if test ! -f "$IWYU_PATH"; then
13978         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
13979     fi
13983 # Set up ILIB for MSVC build
13985 ILIB1=
13986 if test "$build_os" = "cygwin"; then
13987     ILIB="."
13988     if test -n "$JAVA_HOME"; then
13989         ILIB="$ILIB;$JAVA_HOME/lib"
13990     fi
13991     ILIB1=-link
13992     ILIB="$ILIB;$COMPATH/lib/$WIN_HOST_ARCH"
13993     ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/$WIN_HOST_ARCH"
13994     ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
13995     ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
13996     if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
13997         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
13998         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
13999     fi
14000     PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/$WIN_HOST_ARCH"
14001     ucrtlibpath_formatted=$formatted_path
14002     ILIB="$ILIB;$ucrtlibpath_formatted"
14003     ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
14004     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
14005         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
14006     else
14007         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WIN_HOST_ARCH"
14008     fi
14010     if test "$cross_compiling" != "yes"; then
14011         ILIB_FOR_BUILD="$ILIB"
14012     fi
14014 AC_SUBST(ILIB)
14015 AC_SUBST(ILIB_FOR_BUILD)
14017 # ===================================================================
14018 # Creating bigger shared library to link against
14019 # ===================================================================
14020 AC_MSG_CHECKING([whether to create huge library])
14021 MERGELIBS=
14023 if test $_os = iOS -o $_os = Android; then
14024     # Never any point in mergelibs for these as we build just static
14025     # libraries anyway...
14026     enable_mergelibs=no
14029 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
14030     if test $_os != Linux -a $_os != WINNT; then
14031         add_warning "--enable-mergelibs is not tested for this platform"
14032     fi
14033     MERGELIBS="TRUE"
14034     AC_MSG_RESULT([yes])
14035     AC_DEFINE(ENABLE_MERGELIBS)
14036 else
14037     AC_MSG_RESULT([no])
14039 AC_SUBST([MERGELIBS])
14041 dnl ===================================================================
14042 dnl icerun is a wrapper that stops us spawning tens of processes
14043 dnl locally - for tools that can't be executed on the compile cluster
14044 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
14045 dnl ===================================================================
14046 AC_MSG_CHECKING([whether to use icerun wrapper])
14047 ICECREAM_RUN=
14048 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
14049     ICECREAM_RUN=icerun
14050     AC_MSG_RESULT([yes])
14051 else
14052     AC_MSG_RESULT([no])
14054 AC_SUBST(ICECREAM_RUN)
14056 dnl ===================================================================
14057 dnl Setup the ICECC_VERSION for the build the same way it was set for
14058 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
14059 dnl ===================================================================
14060 x_ICECC_VERSION=[\#]
14061 if test -n "$ICECC_VERSION" ; then
14062     x_ICECC_VERSION=
14064 AC_SUBST(x_ICECC_VERSION)
14065 AC_SUBST(ICECC_VERSION)
14067 dnl ===================================================================
14069 AC_MSG_CHECKING([MPL subset])
14070 MPL_SUBSET=
14072 if test "$enable_mpl_subset" = "yes"; then
14073     warn_report=false
14074     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
14075         warn_report=true
14076     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
14077         warn_report=true
14078     fi
14079     if test "$warn_report" = "true"; then
14080         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
14081     fi
14082     if test "x$enable_postgresql_sdbc" != "xno"; then
14083         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
14084     fi
14085     if test "$enable_lotuswordpro" = "yes"; then
14086         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
14087     fi
14088     if test "$WITH_WEBDAV" = "neon"; then
14089         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
14090     fi
14091     if test -n "$ENABLE_POPPLER"; then
14092         if test "x$SYSTEM_POPPLER" = "x"; then
14093             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
14094         fi
14095     fi
14096     # cf. m4/libo_check_extension.m4
14097     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
14098         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
14099     fi
14100     for theme in $WITH_THEMES; do
14101         case $theme in
14102         breeze|breeze_dark|breeze_dark_svg|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #denylist of icon themes under GPL or LGPL
14103             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=colibre]) ;;
14104         *) : ;;
14105         esac
14106     done
14108     ENABLE_OPENGL_TRANSITIONS=
14110     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
14111         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
14112     fi
14114     MPL_SUBSET="TRUE"
14115     AC_DEFINE(MPL_HAVE_SUBSET)
14116     AC_MSG_RESULT([only])
14117 else
14118     AC_MSG_RESULT([no restrictions])
14120 AC_SUBST(MPL_SUBSET)
14122 dnl ===================================================================
14124 AC_MSG_CHECKING([formula logger])
14125 ENABLE_FORMULA_LOGGER=
14127 if test "x$enable_formula_logger" = "xyes"; then
14128     AC_MSG_RESULT([yes])
14129     AC_DEFINE(ENABLE_FORMULA_LOGGER)
14130     ENABLE_FORMULA_LOGGER=TRUE
14131 elif test -n "$ENABLE_DBGUTIL" ; then
14132     AC_MSG_RESULT([yes])
14133     AC_DEFINE(ENABLE_FORMULA_LOGGER)
14134     ENABLE_FORMULA_LOGGER=TRUE
14135 else
14136     AC_MSG_RESULT([no])
14139 AC_SUBST(ENABLE_FORMULA_LOGGER)
14141 dnl ===================================================================
14142 dnl Checking for active Antivirus software.
14143 dnl ===================================================================
14145 if test $_os = WINNT -a -f "$SRC_ROOT/antivirusDetection.vbs" ; then
14146     AC_MSG_CHECKING([for active Antivirus software])
14147     ANTIVIRUS_LIST=`cscript.exe //Nologo $SRC_ROOT/antivirusDetection.vbs`
14148     if [ [ "$ANTIVIRUS_LIST" != "NULL" ] ]; then
14149         if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then
14150             AC_MSG_RESULT([found])
14151             EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
14152             echo $EICAR_STRING > $SRC_ROOT/eicar
14153             EICAR_TEMP_FILE_CONTENTS=`cat $SRC_ROOT/eicar`
14154             rm $SRC_ROOT/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             echo $EICAR_STRING > $BUILDDIR/eicar
14159             EICAR_TEMP_FILE_CONTENTS=`cat $BUILDDIR/eicar`
14160             rm $BUILDDIR/eicar
14161             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
14162                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
14163             fi
14164             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"
14165         else
14166             AC_MSG_RESULT([not found])
14167         fi
14168     else
14169         AC_MSG_RESULT([n/a])
14170     fi
14173 dnl ===================================================================
14174 dnl Setting up the environment.
14175 dnl ===================================================================
14176 AC_MSG_NOTICE([setting up the build environment variables...])
14178 AC_SUBST(COMPATH)
14180 if test "$build_os" = "cygwin"; then
14181     if test -d "$COMPATH/atlmfc/lib/spectre"; then
14182         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
14183         ATL_INCLUDE="$COMPATH/atlmfc/include"
14184     elif test -d "$COMPATH/atlmfc/lib"; then
14185         ATL_LIB="$COMPATH/atlmfc/lib"
14186         ATL_INCLUDE="$COMPATH/atlmfc/include"
14187     else
14188         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
14189         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
14190     fi
14191     ATL_LIB="$ATL_LIB/$WIN_HOST_ARCH"
14192     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
14193     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
14195     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
14196     PathFormat "/usr/bin/find.exe"
14197     FIND="$formatted_path"
14198     PathFormat "/usr/bin/sort.exe"
14199     SORT="$formatted_path"
14200     PathFormat "/usr/bin/grep.exe"
14201     WIN_GREP="$formatted_path"
14202     PathFormat "/usr/bin/ls.exe"
14203     WIN_LS="$formatted_path"
14204     PathFormat "/usr/bin/touch.exe"
14205     WIN_TOUCH="$formatted_path"
14206 else
14207     FIND=find
14208     SORT=sort
14211 AC_SUBST(ATL_INCLUDE)
14212 AC_SUBST(ATL_LIB)
14213 AC_SUBST(FIND)
14214 AC_SUBST(SORT)
14215 AC_SUBST(WIN_GREP)
14216 AC_SUBST(WIN_LS)
14217 AC_SUBST(WIN_TOUCH)
14219 AC_SUBST(BUILD_TYPE)
14221 AC_SUBST(SOLARINC)
14223 PathFormat "$PERL"
14224 PERL="$formatted_path"
14225 AC_SUBST(PERL)
14227 if test -n "$TMPDIR"; then
14228     TEMP_DIRECTORY="$TMPDIR"
14229 else
14230     TEMP_DIRECTORY="/tmp"
14232 if test "$build_os" = "cygwin"; then
14233     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
14235 AC_SUBST(TEMP_DIRECTORY)
14237 # setup the PATH for the environment
14238 if test -n "$LO_PATH_FOR_BUILD"; then
14239     LO_PATH="$LO_PATH_FOR_BUILD"
14240     case "$host_os" in
14241     cygwin*|wsl*)
14242         pathmunge "$MSVC_HOST_PATH" "before"
14243         ;;
14244     esac
14245 else
14246     LO_PATH="$PATH"
14248     case "$host_os" in
14250     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
14251         if test "$ENABLE_JAVA" != ""; then
14252             pathmunge "$JAVA_HOME/bin" "after"
14253         fi
14254         ;;
14256     cygwin*|wsl*)
14257         # Win32 make needs native paths
14258         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
14259             LO_PATH=`cygpath -p -m "$PATH"`
14260         fi
14261         if test "$WIN_BUILD_ARCH" = "x64"; then
14262             # needed for msi packaging
14263             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
14264         fi
14265         # .NET 4.6 and higher don't have bin directory
14266         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
14267             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
14268         fi
14269         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
14270         pathmunge "$CSC_PATH" "before"
14271         pathmunge "$MIDL_PATH" "before"
14272         pathmunge "$AL_PATH" "before"
14273         pathmunge "$MSVC_MULTI_PATH" "before"
14274         pathmunge "$MSVC_BUILD_PATH" "before"
14275         if test -n "$MSBUILD_PATH" ; then
14276             pathmunge "$MSBUILD_PATH" "before"
14277         fi
14278         pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/$WIN_BUILD_ARCH" "before"
14279         if test "$ENABLE_JAVA" != ""; then
14280             if test -d "$JAVA_HOME/jre/bin/client"; then
14281                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
14282             fi
14283             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
14284                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
14285             fi
14286             pathmunge "$JAVA_HOME/bin" "before"
14287         fi
14288         pathmunge "$MSVC_HOST_PATH" "before"
14289         ;;
14291     solaris*)
14292         pathmunge "/usr/css/bin" "before"
14293         if test "$ENABLE_JAVA" != ""; then
14294             pathmunge "$JAVA_HOME/bin" "after"
14295         fi
14296         ;;
14297     esac
14300 AC_SUBST(LO_PATH)
14302 # Allow to pass LO_ELFCHECK_ALLOWLIST from autogen.input to bin/check-elf-dynamic-objects:
14303 if test "$LO_ELFCHECK_ALLOWLIST" = x || test "${LO_ELFCHECK_ALLOWLIST-x}" != x; then
14304     x_LO_ELFCHECK_ALLOWLIST=
14305 else
14306     x_LO_ELFCHECK_ALLOWLIST=[\#]
14308 AC_SUBST(x_LO_ELFCHECK_ALLOWLIST)
14309 AC_SUBST(LO_ELFCHECK_ALLOWLIST)
14311 libo_FUZZ_SUMMARY
14313 # Generate a configuration sha256 we can use for deps
14314 if test -f config_host.mk; then
14315     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
14317 if test -f config_host_lang.mk; then
14318     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
14321 CFLAGS=$my_original_CFLAGS
14322 CXXFLAGS=$my_original_CXXFLAGS
14323 CPPFLAGS=$my_original_CPPFLAGS
14325 AC_CONFIG_LINKS([include:include])
14327 # Keep in sync with list of files far up, at AC_MSG_CHECKING([for
14328 # BUILD platform configuration] - otherwise breaks cross building
14329 AC_CONFIG_FILES([config_host.mk
14330                  config_host_lang.mk
14331                  Makefile
14332                  bin/bffvalidator.sh
14333                  bin/odfvalidator.sh
14334                  bin/officeotron.sh
14335                  hardened_runtime.xcent
14336                  instsetoo_native/util/openoffice.lst
14337                  sysui/desktop/macosx/Info.plist
14338                  vs-code-template.code-workspace:.vscode/vs-code-template.code-workspace.in])
14339 AC_CONFIG_HEADERS([config_host/config_buildid.h])
14340 AC_CONFIG_HEADERS([config_host/config_box2d.h])
14341 AC_CONFIG_HEADERS([config_host/config_clang.h])
14342 AC_CONFIG_HEADERS([config_host/config_crypto.h])
14343 AC_CONFIG_HEADERS([config_host/config_dconf.h])
14344 AC_CONFIG_HEADERS([config_host/config_eot.h])
14345 AC_CONFIG_HEADERS([config_host/config_extensions.h])
14346 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
14347 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
14348 AC_CONFIG_HEADERS([config_host/config_dbus.h])
14349 AC_CONFIG_HEADERS([config_host/config_features.h])
14350 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
14351 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
14352 AC_CONFIG_HEADERS([config_host/config_firebird.h])
14353 AC_CONFIG_HEADERS([config_host/config_folders.h])
14354 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
14355 AC_CONFIG_HEADERS([config_host/config_gio.h])
14356 AC_CONFIG_HEADERS([config_host/config_global.h])
14357 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
14358 AC_CONFIG_HEADERS([config_host/config_java.h])
14359 AC_CONFIG_HEADERS([config_host/config_langs.h])
14360 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
14361 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
14362 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
14363 AC_CONFIG_HEADERS([config_host/config_locales.h])
14364 AC_CONFIG_HEADERS([config_host/config_mpl.h])
14365 AC_CONFIG_HEADERS([config_host/config_oox.h])
14366 AC_CONFIG_HEADERS([config_host/config_options.h])
14367 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
14368 AC_CONFIG_HEADERS([config_host/config_zxing.h])
14369 AC_CONFIG_HEADERS([config_host/config_skia.h])
14370 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
14371 AC_CONFIG_HEADERS([config_host/config_vendor.h])
14372 AC_CONFIG_HEADERS([config_host/config_vcl.h])
14373 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
14374 AC_CONFIG_HEADERS([config_host/config_version.h])
14375 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
14376 AC_CONFIG_HEADERS([config_host/config_poppler.h])
14377 AC_CONFIG_HEADERS([config_host/config_python.h])
14378 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
14379 AC_OUTPUT
14381 if test "$CROSS_COMPILING" = TRUE; then
14382     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
14385 # touch the config timestamp file
14386 if test ! -f config_host.mk.stamp; then
14387     echo > config_host.mk.stamp
14388 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
14389     echo "Host Configuration unchanged - avoiding scp2 stamp update"
14390 else
14391     echo > config_host.mk.stamp
14394 # touch the config lang timestamp file
14395 if test ! -f config_host_lang.mk.stamp; then
14396     echo > config_host_lang.mk.stamp
14397 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
14398     echo "Language Configuration unchanged - avoiding scp2 stamp update"
14399 else
14400     echo > config_host_lang.mk.stamp
14404 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
14405         -a "$build_os" = "cygwin"; then
14407 cat << _EOS
14408 ****************************************************************************
14409 WARNING:
14410 Your make version is known to be horribly slow, and hard to debug
14411 problems with. To get a reasonably functional make please do:
14413 to install a pre-compiled binary make for Win32
14415  mkdir -p /opt/lo/bin
14416  cd /opt/lo/bin
14417  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
14418  cp make-4.2.1-msvc.exe make
14419  chmod +x make
14421 to install from source:
14422 place yourself in a working directory of you choice.
14424  git clone git://git.savannah.gnu.org/make.git
14426  [go to Start menu, open "Visual Studio 2019", click "x86 Native Tools Command Prompt" or "x64 Native Tools Command Prompt"]
14427  set PATH=%PATH%;C:\Cygwin\bin
14428  [or Cygwin64, if that is what you have]
14429  cd path-to-make-repo-you-cloned-above
14430  build_w32.bat --without-guile
14432 should result in a WinRel/gnumake.exe.
14433 Copy it to the Cygwin /opt/lo/bin directory as make.exe
14435 Then re-run autogen.sh
14437 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
14438 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
14440 _EOS
14441 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
14442     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
14447 cat << _EOF
14448 ****************************************************************************
14450 To build, run:
14451 $GNUMAKE
14453 To view some help, run:
14454 $GNUMAKE help
14456 _EOF
14458 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
14459     cat << _EOF
14460 After the build has finished successfully, you can immediately run what you built using the command:
14461 _EOF
14463     if test $_os = Darwin; then
14464         echo open instdir/$PRODUCTNAME_WITHOUT_SPACES.app
14465     else
14466         echo instdir/program/soffice
14467     fi
14468     cat << _EOF
14470 If you want to run the smoketest, run:
14471 $GNUMAKE check
14473 _EOF
14476 if test -f "$WARNINGS_FILE_FOR_BUILD"; then
14477     echo "BUILD / cross-toolset config, repeated ($WARNINGS_FILE_FOR_BUILD)"
14478     cat "$WARNINGS_FILE_FOR_BUILD"
14479     echo
14482 if test -f "$WARNINGS_FILE"; then
14483     echo "HOST config ($WARNINGS_FILE)"
14484     cat "$WARNINGS_FILE"
14487 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: