Bump version to 21.06.18.1
[LibreOffice.git] / configure.ac
blob2991ef0b09bf9ede2b99ca6d4cd2e97441e883a1
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([Collabora Office],[21.06.18.1],[],[],[https://collaboraoffice.com/])
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 rm -f warn
206 have_WARNINGS="no"
207 add_warning()
209     if test "$have_WARNINGS" = "no"; then
210         echo "*************************************" > warn
211         have_WARNINGS="yes"
212         if which tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
213             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
214             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
215         else
216             COLORWARN="* WARNING :"
217         fi
218     fi
219     echo "$COLORWARN $@" >> warn
222 dnl Some Mac User have the bad habit of letting a lot of crap
223 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
224 dnl that confuse the build.
225 dnl For the ones that use LODE, let's be nice and protect them
226 dnl from themselves
228 mac_sanitize_path()
230     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
231 dnl a common but nevertheless necessary thing that may be in a fancy
232 dnl path location is git, so make sure we have it
233     mac_git_path=`which git 2>/dev/null`
234     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
235         mac_path="$mac_path:`dirname $mac_git_path`"
236     fi
237 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
238 dnl path location is gpg, so make sure we find it
239     mac_gpg_path=`which gpg 2>/dev/null`
240     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
241         mac_path="$mac_path:`dirname $mac_gpg_path`"
242     fi
243     PATH="$mac_path"
244     unset mac_path
245     unset mac_git_path
246     unset mac_gpg_path
249 echo "********************************************************************"
250 echo "*"
251 echo "*   Running ${PACKAGE_NAME} build configuration."
252 echo "*"
253 echo "********************************************************************"
254 echo ""
256 dnl ===================================================================
257 dnl checks build and host OSes
258 dnl do this before argument processing to allow for platform dependent defaults
259 dnl ===================================================================
261 # Check for WSL (version 2, at least). But if --host is explicitly specified (to really do build for
262 # Linux on WSL) trust that.
263 if test -z "$host" -a -z "$build" -a "`wslsys -v 2>/dev/null`" != ""; then
264     ac_cv_host="x86_64-pc-wsl"
265     ac_cv_host_cpu="x86_64"
266     ac_cv_host_os="wsl"
267     ac_cv_build="$ac_cv_host"
268     ac_cv_build_cpu="$ac_cv_host_cpu"
269     ac_cv_build_os="$ac_cv_host_os"
271     # Emulation of Cygwin's cygpath command for WSL.
272     cygpath()
273     {
274         if test -n "$UNITTEST_WSL_CYGPATH"; then
275             echo -n cygpath "$@" "==> "
276         fi
278         # Cygwin's real cygpath has a plethora of options but we use only a few here.
279         local args="$@"
280         local opt
281         local opt_d opt_m opt_u opt_w opt_l opt_s opt_p
282         OPTIND=1
284         while getopts dmuwlsp opt; do
285             case "$opt" in
286                 \?)
287                     AC_MSG_ERROR([Unimplemented cygpath emulation option in invocation: cygpath $args])
288                     ;;
289                 ?)
290                     eval opt_$opt=yes
291                     ;;
292             esac
293         done
295         shift $((OPTIND-1))
297         if test $# -ne 1; then
298             AC_MSG_ERROR([Invalid cygpath emulation invocation: Pathname missing]);
299         fi
301         local input="$1"
303         local result
305         if test -n "$opt_d" -o -n "$opt_m" -o -n "$opt_w"; then
306             # Print Windows path, possibly in 8.3 form (-d) or with forward slashes (-m)
308             if test -n "$opt_u"; then
309                 AC_MSG_ERROR([Invalid cygpath invocation: Both Windows and Unix path output requested])
310             fi
312             case "$input" in
313                 /mnt/*)
314                     # A Windows file in WSL format
315                     input=$(wslpath -w "$input")
316                     ;;
317                 [[a-zA-Z]]:\\* | \\* | [[a-zA-Z]]:/* | /*)
318                     # Already in Windows format
319                     ;;
320                 /*)
321                     input=$(wslpath -w "$input")
322                     ;;
323                 *)
324                     AC_MSG_ERROR([Invalid cygpath invocation: Path '$input' is not absolute])
325                     ;;
326             esac
327             if test -n "$opt_d" -o -n "$opt_s"; then
328                 input=$($BUILDDIR/solenv/wsl/wsl-lo-helper.exe --8.3 "$input")
329             fi
330             if test -n "$opt_m"; then
331                 input="${input//\\//}"
332             fi
333             echo "$input"
334         else
335             # Print Unix path
337             case "$input" in
338                 [[a-zA-Z]]:\\* | \\* | [[a-zA-Z]]:/* | /*)
339                     wslpath -u "$input"
340                     ;;
341                 /)
342                     echo "$input"
343                     ;;
344                 *)
345                     AC_MSG_ERROR([Invalid cygpath invocation: Path '$input' is not absolute])
346                     ;;
347             esac
348         fi
349     }
351     if test -n "$UNITTEST_WSL_CYGPATH"; then
352         BUILDDIR=.
354         # Nothing special with these file names, just arbitrary ones picked to test with
355         cygpath -d /usr/lib64/ld-linux-x86-64.so.2
356         cygpath -w /usr/lib64/ld-linux-x86-64.so.2
357         cygpath -m /usr/lib64/ld-linux-x86-64.so.2
358         cygpath -m -s /usr/lib64/ld-linux-x86-64.so.2
359         # At least on my machine for instance this file does have an 8.3 name
360         cygpath -d /mnt/c/windows/WindowsUpdate.log
361         # But for instance this one doesn't
362         cygpath -w /mnt/c/windows/system32/AboutSettingsHandlers.dll
363         cygpath -ws /mnt/c/windows/WindowsUpdate.log
364         cygpath -m /mnt/c/windows/system32/AboutSettingsHandlers.dll
365         cygpath -ms /mnt/c/windows/WindowsUpdate.log
367         cygpath -u 'c:\windows\system32\AboutSettingsHandlers.dll'
368         cygpath -u 'c:/windows/system32/AboutSettingsHandlers.dll'
370         exit 0
371     fi
374 AC_CANONICAL_HOST
375 AC_CANONICAL_BUILD
377 if test -n "$UNITTEST_WSL_PATHFORMAT"; then
378     BUILDDIR=.
379     GREP=grep
381     # Use of PathFormat must be after AC_CANONICAL_BUILD above
382     PathFormat /
383     printf "$formatted_path , $formatted_path_unix\n"
385     PathFormat $PWD
386     printf "$formatted_path , $formatted_path_unix\n"
388     PathFormat "$PROGRAMFILESX86"
389     printf "$formatted_path , $formatted_path_unix\n"
391     exit 0
394 AC_MSG_CHECKING([for product name])
395 PRODUCTNAME="AC_PACKAGE_NAME"
396 if test -n "$with_product_name" -a "$with_product_name" != no; then
397     PRODUCTNAME="$with_product_name"
399 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
400     PRODUCTNAME="${PRODUCTNAME}Dev"
401     PRODUCTNAME=AC_PACKAGE_NAME
403 AC_MSG_RESULT([$PRODUCTNAME])
404 AC_SUBST(PRODUCTNAME)
405 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
406 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
408 dnl ===================================================================
409 dnl Our version is defined by the AC_INIT() at the top of this script.
410 dnl ===================================================================
412 AC_MSG_CHECKING([for package version])
413 if test -n "$with_package_version" -a "$with_package_version" != no; then
414     PACKAGE_VERSION="$with_package_version"
416 AC_MSG_RESULT([$PACKAGE_VERSION])
418 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
420 LIBO_VERSION_MAJOR=$1
421 LIBO_VERSION_MINOR=$2
422 LIBO_VERSION_MICRO=$3
423 LIBO_VERSION_PATCH=$4
425 LIBO_VERSION_SUFFIX=$5
427 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
428 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
429 # they get undoubled before actually passed to sed.
430 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
431 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
432 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
433 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
435 # The value for key CFBundleVersion in the Info.plist file must be a period-separated list of at most
436 # three non-negative integers. Please find more information about CFBundleVersion at
437 # https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleversion
439 # The value for key CFBundleShortVersionString in the Info.plist file must be a period-separated list
440 # of at most three non-negative integers. Please find more information about
441 # CFBundleShortVersionString at
442 # https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleshortversionstring
444 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
445 MACOSX_BUNDLE_VERSION=$MACOSX_BUNDLE_SHORTVERSION
447 AC_SUBST(LIBO_VERSION_MAJOR)
448 AC_SUBST(LIBO_VERSION_MINOR)
449 AC_SUBST(LIBO_VERSION_MICRO)
450 AC_SUBST(LIBO_VERSION_PATCH)
451 AC_SUBST(LIBO_VERSION_SUFFIX)
452 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
453 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
454 AC_SUBST(MACOSX_BUNDLE_VERSION)
456 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
457 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
458 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
459 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
461 LIBO_THIS_YEAR=`date +%Y`
462 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
464 dnl ===================================================================
465 dnl Product version
466 dnl ===================================================================
467 AC_MSG_CHECKING([for product version])
468 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
469 AC_MSG_RESULT([$PRODUCTVERSION])
470 AC_SUBST(PRODUCTVERSION)
472 AC_PROG_EGREP
473 # AC_PROG_EGREP doesn't set GREP on all systems as well
474 AC_PATH_PROG(GREP, grep)
476 BUILDDIR=`pwd`
477 cd $srcdir
478 SRC_ROOT=`pwd`
479 cd $BUILDDIR
480 x_Cygwin=[\#]
482 dnl ======================================
483 dnl Required GObject introspection version
484 dnl ======================================
485 INTROSPECTION_REQUIRED_VERSION=1.32.0
487 dnl ===================================================================
488 dnl Search all the common names for GNU Make
489 dnl ===================================================================
490 AC_MSG_CHECKING([for GNU Make])
492 # try to use our own make if it is available and GNUMAKE was not already defined
493 if test -z "$GNUMAKE"; then
494     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
495         GNUMAKE="$LODE_HOME/opt/bin/make"
496     elif test -x "/opt/lo/bin/make"; then
497         GNUMAKE="/opt/lo/bin/make"
498     fi
501 GNUMAKE_WIN_NATIVE=
502 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
503     if test -n "$a"; then
504         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
505         if test $? -eq 0;  then
506             if test "$build_os" = "cygwin"; then
507                 if test -n "$($a -v | grep 'Built for Windows')" ; then
508                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
509                     GNUMAKE_WIN_NATIVE="TRUE"
510                 else
511                     GNUMAKE=`which $a`
512                 fi
513             else
514                 GNUMAKE=`which $a`
515             fi
516             break
517         fi
518     fi
519 done
520 AC_MSG_RESULT($GNUMAKE)
521 if test -z "$GNUMAKE"; then
522     AC_MSG_ERROR([not found. install GNU Make.])
523 else
524     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
525         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
526     fi
529 win_short_path_for_make()
531     local short_path="$1"
532     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
533         cygpath -sm "$short_path"
534     else
535         cygpath -u "$(cygpath -d "$short_path")"
536     fi
540 if test "$build_os" = "cygwin"; then
541     PathFormat "$SRC_ROOT"
542     SRC_ROOT="$formatted_path"
543     PathFormat "$BUILDDIR"
544     BUILDDIR="$formatted_path"
545     x_Cygwin=
546     AC_MSG_CHECKING(for explicit COMSPEC)
547     if test -z "$COMSPEC"; then
548         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
549     else
550         AC_MSG_RESULT([found: $COMSPEC])
551     fi
554 AC_SUBST(SRC_ROOT)
555 AC_SUBST(BUILDDIR)
556 AC_SUBST(x_Cygwin)
557 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
558 AC_DEFINE_UNQUOTED(SRC_ROOT,"$SRC_ROOT")
559 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
561 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
562     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
565 # need sed in os checks...
566 AC_PATH_PROGS(SED, sed)
567 if test -z "$SED"; then
568     AC_MSG_ERROR([install sed to run this script])
571 # Set the ENABLE_LTO variable
572 # ===================================================================
573 AC_MSG_CHECKING([whether to use link-time optimization])
574 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
575     ENABLE_LTO="TRUE"
576     AC_MSG_RESULT([yes])
577 else
578     ENABLE_LTO=""
579     AC_MSG_RESULT([no])
581 AC_SUBST(ENABLE_LTO)
583 AC_ARG_ENABLE(fuzz-options,
584     AS_HELP_STRING([--enable-fuzz-options],
585         [Randomly enable or disable each of those configurable options
586          that are supposed to be freely selectable without interdependencies,
587          or where bad interaction from interdependencies is automatically avoided.])
590 dnl ===================================================================
591 dnl When building for Android, --with-android-ndk,
592 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
593 dnl mandatory
594 dnl ===================================================================
596 AC_ARG_WITH(android-ndk,
597     AS_HELP_STRING([--with-android-ndk],
598         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
601 AC_ARG_WITH(android-ndk-toolchain-version,
602     AS_HELP_STRING([--with-android-ndk-toolchain-version],
603         [Specify which toolchain version to use, of those present in the
604         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
605         with_android_ndk_toolchain_version=clang5.0)
607 AC_ARG_WITH(android-sdk,
608     AS_HELP_STRING([--with-android-sdk],
609         [Specify location of the Android SDK. Mandatory when building for Android.]),
612 AC_ARG_WITH(android-api-level,
613     AS_HELP_STRING([--with-android-api-level],
614         [Specify the API level when building for Android. Defaults to 16 for ARM and x86 and to 21 for ARM64 and x86-64]),
617 ANDROID_NDK_HOME=
618 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
619     with_android_ndk="$SRC_ROOT/external/android-ndk"
621 if test -n "$with_android_ndk"; then
622     eval ANDROID_NDK_HOME=$with_android_ndk
624     # Set up a lot of pre-canned defaults
626     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
627         if test ! -f $ANDROID_NDK_HOME/source.properties; then
628             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
629         fi
630         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
631     else
632         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
633     fi
634     if test -z "$ANDROID_NDK_VERSION";  then
635         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
636     fi
637     case $ANDROID_NDK_VERSION in
638     r9*|r10*)
639         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
640         ;;
641     11.1.*|12.1.*|13.1.*|14.1.*)
642         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
643         ;;
644     16.*|17.*|18.*|19.*|20.*)
645         ;;
646     *)
647         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk.])
648         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk."
649         ;;
650     esac
652     ANDROID_API_LEVEL=16
653     if test -n "$with_android_api_level" ; then
654         ANDROID_API_LEVEL="$with_android_api_level"
655     fi
657     android_cpu=$host_cpu
658     if test $host_cpu = arm; then
659         android_platform_prefix=arm-linux-androideabi
660         android_gnu_prefix=$android_platform_prefix
661         LLVM_TRIPLE=armv7a-linux-androideabi
662         ANDROID_APP_ABI=armeabi-v7a
663         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
664     elif test $host_cpu = aarch64; then
665         android_platform_prefix=aarch64-linux-android
666         android_gnu_prefix=$android_platform_prefix
667         LLVM_TRIPLE=$android_platform_prefix
668         # minimum android version that supports aarch64
669         if test "$ANDROID_API_LEVEL" -lt "21" ; then
670             ANDROID_API_LEVEL=21
671         fi
672         ANDROID_APP_ABI=arm64-v8a
673     elif test $host_cpu = x86_64; then
674         android_platform_prefix=x86_64-linux-android
675         android_gnu_prefix=$android_platform_prefix
676         LLVM_TRIPLE=$android_platform_prefix
677         # minimum android version that supports x86_64
678         ANDROID_API_LEVEL=21
679         ANDROID_APP_ABI=x86_64
680     else
681         # host_cpu is something like "i386" or "i686" I guess, NDK uses
682         # "x86" in some contexts
683         android_cpu=x86
684         android_platform_prefix=$android_cpu
685         android_gnu_prefix=i686-linux-android
686         LLVM_TRIPLE=$android_gnu_prefix
687         ANDROID_APP_ABI=x86
688     fi
690     case "$with_android_ndk_toolchain_version" in
691     clang5.0)
692         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
693         ;;
694     *)
695         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
696     esac
698     AC_MSG_NOTICE([using the Android API level... $ANDROID_API_LEVEL])
700     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
701     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
702     # manage to link the (app-specific) single huge .so that is built for the app in
703     # android/source/ if there is debug information in a significant part of the object files.
704     # (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
705     # all objects have been built with debug information.)
706     case $build_os in
707     linux-gnu*)
708         android_HOST_TAG=linux-x86_64
709         ;;
710     darwin*)
711         android_HOST_TAG=darwin-x86_64
712         ;;
713     *)
714         AC_MSG_ERROR([We only support building for Android from Linux or macOS])
715         # ndk would also support windows and windows-x86_64
716         ;;
717     esac
718     android_TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$android_HOST_TAG
719     ANDROID_COMPILER_BIN=$android_TOOLCHAIN/bin
720     dnl TODO: NSS build uses it...
721     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION/prebuilt/$android_HOST_TAG
722     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
724     test -z "$AR" && AR=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ar
725     test -z "$NM" && NM=$ANDROID_COMPILER_BIN/$android_gnu_prefix-nm
726     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-objdump
727     test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ranlib
728     test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-strip
730     ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
731     ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
732     if test "$ENABLE_LTO" = TRUE; then
733         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
734         # $CC and $CXX when building external libraries
735         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
736     fi
738     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -stdlib=libc++"
740     if test -z "$CC"; then
741         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
742         CC_BASE="clang"
743     fi
744     if test -z "$CXX"; then
745         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
746         CXX_BASE="clang++"
747     fi
749     # remember to download the ownCloud Android library later
750     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
752 AC_SUBST(ANDROID_NDK_HOME)
753 AC_SUBST(ANDROID_APP_ABI)
754 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
756 dnl ===================================================================
757 dnl --with-android-sdk
758 dnl ===================================================================
759 ANDROID_SDK_HOME=
760 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
761     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
763 if test -n "$with_android_sdk"; then
764     eval ANDROID_SDK_HOME=$with_android_sdk
765     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
767 AC_SUBST(ANDROID_SDK_HOME)
769 AC_ARG_ENABLE([android-lok],
770     AS_HELP_STRING([--enable-android-lok],
771         [The Android app from the android/ subdir needs several tweaks all
772          over the place that break the LOK when used in the Online-based
773          Android app.  This switch indicates that the intent of this build is
774          actually the Online-based, non-modified LOK.])
776 ENABLE_ANDROID_LOK=
777 if test -n "$ANDROID_NDK_HOME" ; then
778     if test "$enable_android_lok" = yes; then
779         ENABLE_ANDROID_LOK=TRUE
780         AC_DEFINE(HAVE_FEATURE_ANDROID_LOK)
781         AC_MSG_NOTICE([building the Android version... for the Online-based Android app])
782     else
783         AC_MSG_NOTICE([building the Android version... for the app from the android/ subdir])
784     fi
786 AC_SUBST([ENABLE_ANDROID_LOK])
788 libo_FUZZ_ARG_ENABLE([android-editing],
789     AS_HELP_STRING([--enable-android-editing],
790         [Enable the experimental editing feature on Android.])
792 ENABLE_ANDROID_EDITING=
793 if test "$enable_android_editing" = yes; then
794     ENABLE_ANDROID_EDITING=TRUE
796 AC_SUBST([ENABLE_ANDROID_EDITING])
798 dnl ===================================================================
799 dnl The following is a list of supported systems.
800 dnl Sequential to keep the logic very simple
801 dnl These values may be checked and reset later.
802 dnl ===================================================================
803 #defaults unless the os test overrides this:
804 test_randr=yes
805 test_xrender=yes
806 test_cups=yes
807 test_dbus=yes
808 test_fontconfig=yes
809 test_cairo=no
810 test_gdb_index=no
811 test_split_debug=no
813 # Default values, as such probably valid just for Linux, set
814 # differently below just for Mac OSX, but at least better than
815 # hardcoding these as we used to do. Much of this is duplicated also
816 # in solenv for old build system and for gbuild, ideally we should
817 # perhaps define stuff like this only here in configure.ac?
819 LINKFLAGSSHL="-shared"
820 PICSWITCH="-fpic"
821 DLLPOST=".so"
823 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
825 INSTROOTBASESUFFIX=
826 INSTROOTCONTENTSUFFIX=
827 SDKDIRNAME=sdk
829 HOST_PLATFORM="$host"
831 host_cpu_for_clang="$host_cpu"
833 case "$host_os" in
835 solaris*)
836     build_gstreamer_1_0=yes
837     test_freetype=yes
838     build_skia=yes
839     _os=SunOS
841     dnl ===========================================================
842     dnl Check whether we're using Solaris 10 - SPARC or Intel.
843     dnl ===========================================================
844     AC_MSG_CHECKING([the Solaris operating system release])
845     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
846     if test "$_os_release" -lt "10"; then
847         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
848     else
849         AC_MSG_RESULT([ok ($_os_release)])
850     fi
852     dnl Check whether we're using a SPARC or i386 processor
853     AC_MSG_CHECKING([the processor type])
854     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
855         AC_MSG_RESULT([ok ($host_cpu)])
856     else
857         AC_MSG_ERROR([only SPARC and i386 processors are supported])
858     fi
859     ;;
861 linux-gnu*|k*bsd*-gnu*)
862     build_gstreamer_1_0=yes
863     test_kf5=yes
864     test_gtk3_kde5=yes
865     build_skia=yes
866     test_gdb_index=yes
867     test_split_debug=yes
868     if test "$enable_fuzzers" != yes; then
869         test_freetype=yes
870         test_fontconfig=yes
871     else
872         test_freetype=no
873         test_fontconfig=no
874         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
875     fi
876     _os=Linux
877     ;;
879 gnu)
880     test_randr=no
881     test_xrender=no
882     _os=GNU
883      ;;
885 cygwin*|wsl*)
887     # When building on Windows normally with MSVC under Cygwin,
888     # configure thinks that the host platform (the platform the
889     # built code will run on) is Cygwin, even if it obviously is
890     # Windows, which in Autoconf terminology is called
891     # "mingw32". (Which is misleading as MinGW is the name of the
892     # tool-chain, not an operating system.)
894     # Somewhat confusing, yes. But this configure script doesn't
895     # look at $host etc that much, it mostly uses its own $_os
896     # variable, set here in this case statement.
898     test_cups=no
899     test_dbus=no
900     test_randr=no
901     test_xrender=no
902     test_freetype=no
903     test_fontconfig=no
904     build_skia=yes
905     _os=WINNT
907     DLLPOST=".dll"
908     LINKFLAGSNOUNDEFS=
910     if test "$host_cpu" = "aarch64"; then
911         enable_gpgmepp=no
912         enable_coinmp=no
913         enable_firebird_sdbc=no
914     fi
915     ;;
917 darwin*|macos*) # macOS
918     test_randr=no
919     test_xrender=no
920     test_freetype=no
921     test_fontconfig=no
922     test_dbus=no
923     if test -n "$LODE_HOME" ; then
924         mac_sanitize_path
925         AC_MSG_NOTICE([sanitized the PATH to $PATH])
926     fi
927     _os=Darwin
928     INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
929     INSTROOTCONTENTSUFFIX=/Contents
930     SDKDIRNAME=${PRODUCTNAME_WITHOUT_SPACES}${PRODUCTVERSION}_SDK
931     # See comment above the case "$host_os"
932     LINKFLAGSSHL="-dynamiclib -single_module"
934     # -fPIC is default
935     PICSWITCH=""
937     DLLPOST=".dylib"
939     # -undefined error is the default
940     LINKFLAGSNOUNDEFS=""
941     case "$host_cpu" in
942     aarch64|arm64)
943         case "$host_os" in
944         macos*)
945             # HOST_PLATFORM is used for external projects and their configury occasionally doesn't like
946             # the "macos" part so be sure to use aarch64-apple-darwin for now.
947             HOST_PLATFORM=aarch64-apple-darwin
948             ;;
949         esac
951         # Apple's Clang uses "arm64"
952         host_cpu_for_clang=arm64
953     esac
956 ios*) # iOS
957     test_randr=no
958     test_xrender=no
959     test_freetype=no
960     test_fontconfig=no
961     test_dbus=no
962     if test -n "$LODE_HOME" ; then
963         mac_sanitize_path
964         AC_MSG_NOTICE([sanitized the PATH to $PATH])
965     fi
966     enable_gpgmepp=no
967     _os=iOS
968     test_cups=no
969     enable_mpl_subset=yes
970     enable_lotuswordpro=no
971     enable_coinmp=no
972     enable_lpsolve=no
973     enable_mariadb_sdbc=no
974     enable_postgresql_sdbc=no
975     enable_extension_integration=no
976     enable_report_builder=no
977     with_ppds=no
978     if test "$enable_ios_simulator" = "yes"; then
979         host=x86_64-apple-darwin
980     fi
981     # See comment above the case "$host_os"
982     LINKFLAGSSHL="-dynamiclib -single_module"
984     # -fPIC is default
985     PICSWITCH=""
987     DLLPOST=".dylib"
989     # -undefined error is the default
990     LINKFLAGSNOUNDEFS=""
992     # HOST_PLATFORM is used for external projects and their configury typically doesn't like the "ios"
993     # part, so use aarch64-apple-darwin for now.
994     HOST_PLATFORM=aarch64-apple-darwin
996     # Apple's Clang uses "arm64"
997     host_cpu_for_clang=arm64
1000 freebsd*)
1001     build_gstreamer_1_0=yes
1002     test_kf5=yes
1003     test_gtk3_kde5=yes
1004     test_freetype=yes
1005     build_skia=yes
1006     AC_MSG_CHECKING([the FreeBSD operating system release])
1007     if test -n "$with_os_version"; then
1008         OSVERSION="$with_os_version"
1009     else
1010         OSVERSION=`/sbin/sysctl -n kern.osreldate`
1011     fi
1012     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
1013     AC_MSG_CHECKING([which thread library to use])
1014     if test "$OSVERSION" -lt "500016"; then
1015         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1016         PTHREAD_LIBS="-pthread"
1017     elif test "$OSVERSION" -lt "502102"; then
1018         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1019         PTHREAD_LIBS="-lc_r"
1020     else
1021         PTHREAD_CFLAGS=""
1022         PTHREAD_LIBS="-pthread"
1023     fi
1024     AC_MSG_RESULT([$PTHREAD_LIBS])
1025     _os=FreeBSD
1026     ;;
1028 *netbsd*)
1029     build_gstreamer_1_0=yes
1030     test_kf5=yes
1031     test_gtk3_kde5=yes
1032     test_freetype=yes
1033     build_skia=yes
1034     PTHREAD_LIBS="-pthread -lpthread"
1035     _os=NetBSD
1036     ;;
1038 aix*)
1039     test_randr=no
1040     test_freetype=yes
1041     PTHREAD_LIBS=-pthread
1042     _os=AIX
1043     ;;
1045 openbsd*)
1046     test_freetype=yes
1047     PTHREAD_CFLAGS="-D_THREAD_SAFE"
1048     PTHREAD_LIBS="-pthread"
1049     _os=OpenBSD
1050     ;;
1052 dragonfly*)
1053     build_gstreamer_1_0=yes
1054     test_kf5=yes
1055     test_gtk3_kde5=yes
1056     test_freetype=yes
1057     build_skia=yes
1058     PTHREAD_LIBS="-pthread"
1059     _os=DragonFly
1060     ;;
1062 linux-android*)
1063     build_gstreamer_1_0=no
1064     enable_lotuswordpro=no
1065     enable_mpl_subset=yes
1066     enable_coinmp=yes
1067     enable_lpsolve=no
1068     enable_mariadb_sdbc=no
1069     enable_report_builder=no
1070     enable_odk=no
1071     enable_postgresql_sdbc=no
1072     enable_python=no
1073     test_cups=no
1074     test_dbus=no
1075     test_fontconfig=no
1076     test_freetype=no
1077     test_kf5=no
1078     test_qt5=no
1079     test_gtk3_kde5=no
1080     test_randr=no
1081     test_xrender=no
1082     _os=Android
1084     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
1085     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
1086     ;;
1088 haiku*)
1089     test_cups=no
1090     test_dbus=no
1091     test_randr=no
1092     test_xrender=no
1093     test_freetype=yes
1094     enable_odk=no
1095     enable_gstreamer_1_0=no
1096     enable_vlc=no
1097     enable_coinmp=no
1098     enable_pdfium=no
1099     enable_sdremote=no
1100     enable_postgresql_sdbc=no
1101     enable_firebird_sdbc=no
1102     _os=Haiku
1103     ;;
1106     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
1107     ;;
1108 esac
1110 AC_SUBST(HOST_PLATFORM)
1112 if test "$_os" = "Android" ; then
1113     # Verify that the NDK and SDK options are proper
1114     if test -z "$with_android_ndk"; then
1115         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
1116     elif test ! -f "$ANDROID_NDK_HOME/meta/abis.json"; then
1117         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
1118     fi
1120     if test -z "$ANDROID_SDK_HOME"; then
1121         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
1122     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
1123         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
1124     fi
1126     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
1127     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
1128         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
1129                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
1130                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
1131         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
1132         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
1133         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
1134     fi
1135     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
1136         AC_MSG_WARN([android support repository not found - install with
1137                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
1138                      to allow the build to download the specified version of the android support libraries])
1139         add_warning "android support repository not found - install with"
1140         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
1141         add_warning "to allow the build to download the specified version of the android support libraries"
1142     fi
1145 if test "$_os" = "AIX"; then
1146     AC_PATH_PROG(GAWK, gawk)
1147     if test -z "$GAWK"; then
1148         AC_MSG_ERROR([gawk not found in \$PATH])
1149     fi
1152 AC_SUBST(SDKDIRNAME)
1154 AC_SUBST(PTHREAD_CFLAGS)
1155 AC_SUBST(PTHREAD_LIBS)
1157 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
1158 # By default use the ones specified by our build system,
1159 # but explicit override is possible.
1160 AC_MSG_CHECKING(for explicit AFLAGS)
1161 if test -n "$AFLAGS"; then
1162     AC_MSG_RESULT([$AFLAGS])
1163     x_AFLAGS=
1164 else
1165     AC_MSG_RESULT(no)
1166     x_AFLAGS=[\#]
1168 AC_MSG_CHECKING(for explicit CFLAGS)
1169 if test -n "$CFLAGS"; then
1170     AC_MSG_RESULT([$CFLAGS])
1171     x_CFLAGS=
1172 else
1173     AC_MSG_RESULT(no)
1174     x_CFLAGS=[\#]
1176 AC_MSG_CHECKING(for explicit CXXFLAGS)
1177 if test -n "$CXXFLAGS"; then
1178     AC_MSG_RESULT([$CXXFLAGS])
1179     x_CXXFLAGS=
1180 else
1181     AC_MSG_RESULT(no)
1182     x_CXXFLAGS=[\#]
1184 AC_MSG_CHECKING(for explicit OBJCFLAGS)
1185 if test -n "$OBJCFLAGS"; then
1186     AC_MSG_RESULT([$OBJCFLAGS])
1187     x_OBJCFLAGS=
1188 else
1189     AC_MSG_RESULT(no)
1190     x_OBJCFLAGS=[\#]
1192 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
1193 if test -n "$OBJCXXFLAGS"; then
1194     AC_MSG_RESULT([$OBJCXXFLAGS])
1195     x_OBJCXXFLAGS=
1196 else
1197     AC_MSG_RESULT(no)
1198     x_OBJCXXFLAGS=[\#]
1200 AC_MSG_CHECKING(for explicit LDFLAGS)
1201 if test -n "$LDFLAGS"; then
1202     AC_MSG_RESULT([$LDFLAGS])
1203     x_LDFLAGS=
1204 else
1205     AC_MSG_RESULT(no)
1206     x_LDFLAGS=[\#]
1208 AC_SUBST(AFLAGS)
1209 AC_SUBST(CFLAGS)
1210 AC_SUBST(CXXFLAGS)
1211 AC_SUBST(OBJCFLAGS)
1212 AC_SUBST(OBJCXXFLAGS)
1213 AC_SUBST(LDFLAGS)
1214 AC_SUBST(x_AFLAGS)
1215 AC_SUBST(x_CFLAGS)
1216 AC_SUBST(x_CXXFLAGS)
1217 AC_SUBST(x_OBJCFLAGS)
1218 AC_SUBST(x_OBJCXXFLAGS)
1219 AC_SUBST(x_LDFLAGS)
1221 dnl These are potentially set for MSVC, in the code checking for UCRT below:
1222 my_original_CFLAGS=$CFLAGS
1223 my_original_CXXFLAGS=$CXXFLAGS
1224 my_original_CPPFLAGS=$CPPFLAGS
1226 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
1227 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
1228 dnl AC_PROG_CC internally.
1229 if test "$_os" != "WINNT"; then
1230     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
1231     save_CFLAGS=$CFLAGS
1232     AC_PROG_CC
1233     CFLAGS=$save_CFLAGS
1234     if test -z "$CC_BASE"; then
1235         CC_BASE=`first_arg_basename "$CC"`
1236     fi
1239 if test "$_os" != "WINNT"; then
1240     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
1241 else
1242     ENDIANNESS=little
1244 AC_SUBST(ENDIANNESS)
1246 if test $_os != "WINNT"; then
1247     save_LIBS="$LIBS"
1248     AC_SEARCH_LIBS([dlsym], [dl],
1249         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
1250         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
1251     LIBS="$save_LIBS"
1253 AC_SUBST(DLOPEN_LIBS)
1255 AC_ARG_ENABLE(ios-simulator,
1256     AS_HELP_STRING([--enable-ios-simulator],
1257         [build for iOS simulator])
1260 AC_ARG_ENABLE(ios-libreofficelight-app,
1261     AS_HELP_STRING([--enable-ios-libreofficelight-app],
1262         [When building for iOS, build stuff relevant only for the 'LibreOfficeLight' app
1263          (in ios/LibreOfficeLight). Note that this app is not known to work in any useful manner,
1264          and also that its actual build (in Xcode) requires some obvious modifications to the project.])
1267 ENABLE_IOS_LIBREOFFICELIGHT_APP=
1268 if test "$enable_ios_libreofficelight_app" = yes; then
1269     ENABLE_IOS_LIBREOFFICELIGHT_APP=TRUE
1271 AC_SUBST(ENABLE_IOS_LIBREOFFICELIGHT_APP)
1273 ###############################################################################
1274 # Extensions switches --enable/--disable
1275 ###############################################################################
1276 # By default these should be enabled unless having extra dependencies.
1277 # If there is extra dependency over configure options then the enable should
1278 # be automagic based on whether the requiring feature is enabled or not.
1279 # All this options change anything only with --enable-extension-integration.
1281 # The name of this option and its help string makes it sound as if
1282 # extensions are built anyway, just not integrated in the installer,
1283 # if you use --disable-extension-integration. Is that really the
1284 # case?
1286 libo_FUZZ_ARG_ENABLE(extension-integration,
1287     AS_HELP_STRING([--disable-extension-integration],
1288         [Disable integration of the built extensions in the installer of the
1289          product. Use this switch to disable the integration.])
1292 AC_ARG_ENABLE(avmedia,
1293     AS_HELP_STRING([--disable-avmedia],
1294         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
1297 AC_ARG_ENABLE(database-connectivity,
1298     AS_HELP_STRING([--disable-database-connectivity],
1299         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1302 # This doesn't mean not building (or "integrating") extensions
1303 # (although it probably should; i.e. it should imply
1304 # --disable-extension-integration I guess), it means not supporting
1305 # any extension mechanism at all
1306 libo_FUZZ_ARG_ENABLE(extensions,
1307     AS_HELP_STRING([--disable-extensions],
1308         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1311 AC_ARG_ENABLE(scripting,
1312     AS_HELP_STRING([--disable-scripting],
1313         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1316 # This is mainly for Android and iOS, but could potentially be used in some
1317 # special case otherwise, too, so factored out as a separate setting
1319 AC_ARG_ENABLE(dynamic-loading,
1320     AS_HELP_STRING([--disable-dynamic-loading],
1321         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1324 libo_FUZZ_ARG_ENABLE(report-builder,
1325     AS_HELP_STRING([--disable-report-builder],
1326         [Disable the Report Builder.])
1329 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1330     AS_HELP_STRING([--enable-ext-wiki-publisher],
1331         [Enable the Wiki Publisher extension.])
1334 libo_FUZZ_ARG_ENABLE(lpsolve,
1335     AS_HELP_STRING([--disable-lpsolve],
1336         [Disable compilation of the lp solve solver ])
1338 libo_FUZZ_ARG_ENABLE(coinmp,
1339     AS_HELP_STRING([--disable-coinmp],
1340         [Disable compilation of the CoinMP solver ])
1343 libo_FUZZ_ARG_ENABLE(pdfimport,
1344     AS_HELP_STRING([--disable-pdfimport],
1345         [Disable building the PDF import feature.])
1348 libo_FUZZ_ARG_ENABLE(pdfium,
1349     AS_HELP_STRING([--disable-pdfium],
1350         [Disable building PDFium. Results in unsecure PDF signature verification.])
1353 libo_FUZZ_ARG_ENABLE(skia,
1354     AS_HELP_STRING([--disable-skia],
1355         [Disable building Skia. Use --enable-skia=debug to build without optimizations.])
1358 ###############################################################################
1360 dnl ---------- *** ----------
1362 libo_FUZZ_ARG_ENABLE(mergelibs,
1363     AS_HELP_STRING([--enable-mergelibs],
1364         [Merge several of the smaller libraries into one big, "merged", one.])
1367 libo_FUZZ_ARG_ENABLE(breakpad,
1368     AS_HELP_STRING([--enable-breakpad],
1369         [Enables breakpad for crash reporting.])
1372 libo_FUZZ_ARG_ENABLE(crashdump,
1373     AS_HELP_STRING([--disable-crashdump],
1374         [Disable dump.ini and dump-file, when --enable-breakpad])
1377 AC_ARG_ENABLE(fetch-external,
1378     AS_HELP_STRING([--disable-fetch-external],
1379         [Disables fetching external tarballs from web sources.])
1382 AC_ARG_ENABLE(fuzzers,
1383     AS_HELP_STRING([--enable-fuzzers],
1384         [Enables building libfuzzer targets for fuzz testing.])
1387 libo_FUZZ_ARG_ENABLE(pch,
1388     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1389         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1390          Using 'system' will include only external headers, 'base' will add also headers
1391          from base modules, 'normal' will also add all headers except from the module built,
1392          'full' will use all suitable headers even from a module itself.])
1395 libo_FUZZ_ARG_ENABLE(epm,
1396     AS_HELP_STRING([--enable-epm],
1397         [LibreOffice includes self-packaging code, that requires epm, however epm is
1398          useless for large scale package building.])
1401 libo_FUZZ_ARG_ENABLE(odk,
1402     AS_HELP_STRING([--disable-odk],
1403         [LibreOffice includes an ODK, office development kit which some packagers may
1404          wish to build without.])
1407 AC_ARG_ENABLE(mpl-subset,
1408     AS_HELP_STRING([--enable-mpl-subset],
1409         [Don't compile any pieces which are not MPL or more liberally licensed])
1412 libo_FUZZ_ARG_ENABLE(evolution2,
1413     AS_HELP_STRING([--enable-evolution2],
1414         [Allows the built-in evolution 2 addressbook connectivity build to be
1415          enabled.])
1418 AC_ARG_ENABLE(avahi,
1419     AS_HELP_STRING([--enable-avahi],
1420         [Determines whether to use Avahi to advertise Impress to remote controls.])
1423 libo_FUZZ_ARG_ENABLE(werror,
1424     AS_HELP_STRING([--enable-werror],
1425         [Turn warnings to errors. (Has no effect in modules where the treating
1426          of warnings as errors is disabled explicitly.)]),
1429 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1430     AS_HELP_STRING([--enable-assert-always-abort],
1431         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1434 libo_FUZZ_ARG_ENABLE(dbgutil,
1435     AS_HELP_STRING([--enable-dbgutil],
1436         [Provide debugging support from --enable-debug and include additional debugging
1437          utilities such as object counting or more expensive checks.
1438          This is the recommended option for developers.
1439          Note that this makes the build ABI incompatible, it is not possible to mix object
1440          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1442 libo_FUZZ_ARG_ENABLE(debug,
1443     AS_HELP_STRING([--enable-debug],
1444         [Include debugging information, disable compiler optimization and inlining plus
1445          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1447 libo_FUZZ_ARG_ENABLE(split-debug,
1448     AS_HELP_STRING([--disable-split-debug],
1449         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1450          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1452 libo_FUZZ_ARG_ENABLE(gdb-index,
1453     AS_HELP_STRING([--disable-gdb-index],
1454         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1455          The feature requires the gold or lld linker.]))
1457 libo_FUZZ_ARG_ENABLE(sal-log,
1458     AS_HELP_STRING([--enable-sal-log],
1459         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1461 libo_FUZZ_ARG_ENABLE(symbols,
1462     AS_HELP_STRING([--enable-symbols],
1463         [Generate debug information.
1464          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1465          otherwise. It is possible to explicitly specify gbuild build targets
1466          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1467          everything in the directory; there is no ordering, more specific overrides
1468          more general, and disabling takes precedence).
1469          Example: --enable-symbols="all -sw/ -Library_sc".]))
1471 libo_FUZZ_ARG_ENABLE(optimized,
1472     AS_HELP_STRING([--enable-optimized=<yes/no/debug>],
1473         [Whether to compile with optimization flags.
1474          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1475          otherwise. Using 'debug' will try to use only optimizations that should
1476          not interfere with debugging.]))
1478 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1479     AS_HELP_STRING([--disable-runtime-optimizations],
1480         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1481          JVM JIT) that are known to interact badly with certain dynamic analysis
1482          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1483          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1484          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1486 AC_ARG_WITH(valgrind,
1487     AS_HELP_STRING([--with-valgrind],
1488         [Make availability of Valgrind headers a hard requirement.]))
1490 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1491     AS_HELP_STRING([--enable-compiler-plugins],
1492         [Enable compiler plugins that will perform additional checks during
1493          building. Enabled automatically by --enable-dbgutil.
1494          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1495 COMPILER_PLUGINS_DEBUG=
1496 if test "$enable_compiler_plugins" = debug; then
1497     enable_compiler_plugins=yes
1498     COMPILER_PLUGINS_DEBUG=TRUE
1501 libo_FUZZ_ARG_ENABLE(compiler-plugins-analyzer-pch,
1502     AS_HELP_STRING([--disable-compiler-plugins-analyzer-pch],
1503         [Disable use of precompiled headers when running the Clang compiler plugin analyzer.  Not
1504          relevant in the --disable-compiler-plugins case.]))
1506 libo_FUZZ_ARG_ENABLE(ooenv,
1507     AS_HELP_STRING([--disable-ooenv],
1508         [Disable ooenv for the instdir installation.]))
1510 AC_ARG_ENABLE(lto,
1511     AS_HELP_STRING([--enable-lto],
1512         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1513          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1514          linker. For MSVC, this option is broken at the moment. This is experimental work
1515          in progress that shouldn't be used unless you are working on it.)]))
1517 AC_ARG_ENABLE(python,
1518     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1519         [Enables or disables Python support at run-time.
1520          Also specifies what Python to use at build-time.
1521          'fully-internal' even forces the internal version for uses of Python
1522          during the build.
1523          On macOS the only choices are
1524          'internal' (default) or 'fully-internal'. Otherwise the default is 'auto'.
1525          ]))
1527 libo_FUZZ_ARG_ENABLE(gtk3,
1528     AS_HELP_STRING([--disable-gtk3],
1529         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1530 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1532 AC_ARG_ENABLE(introspection,
1533     AS_HELP_STRING([--enable-introspection],
1534         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1535          Linux distributions.)]))
1537 AC_ARG_ENABLE(split-app-modules,
1538     AS_HELP_STRING([--enable-split-app-modules],
1539         [Split file lists for app modules, e.g. base, calc.
1540          Has effect only with make distro-pack-install]),
1543 AC_ARG_ENABLE(split-opt-features,
1544     AS_HELP_STRING([--enable-split-opt-features],
1545         [Split file lists for some optional features, e.g. pyuno, testtool.
1546          Has effect only with make distro-pack-install]),
1549 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1550     AS_HELP_STRING([--disable-cairo-canvas],
1551         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1554 libo_FUZZ_ARG_ENABLE(dbus,
1555     AS_HELP_STRING([--disable-dbus],
1556         [Determines whether to enable features that depend on dbus.
1557          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1558 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1560 libo_FUZZ_ARG_ENABLE(sdremote,
1561     AS_HELP_STRING([--disable-sdremote],
1562         [Determines whether to enable Impress remote control (i.e. the server component).]),
1563 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1565 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1566     AS_HELP_STRING([--disable-sdremote-bluetooth],
1567         [Determines whether to build sdremote with bluetooth support.
1568          Requires dbus on Linux.]))
1570 libo_FUZZ_ARG_ENABLE(gio,
1571     AS_HELP_STRING([--disable-gio],
1572         [Determines whether to use the GIO support.]),
1573 ,test "${enable_gio+set}" = set || enable_gio=yes)
1575 AC_ARG_ENABLE(qt5,
1576     AS_HELP_STRING([--enable-qt5],
1577         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1578          available.]),
1581 AC_ARG_ENABLE(kf5,
1582     AS_HELP_STRING([--enable-kf5],
1583         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1584          KF5 are available.]),
1587 AC_ARG_ENABLE(kde5,
1588     AS_HELP_STRING([--enable-kde5],
1589         [Compatibility switch for the kde5 => kf5 rename. Use --enable-kf5!])
1592 AC_ARG_ENABLE(gtk3_kde5,
1593     AS_HELP_STRING([--enable-gtk3-kde5],
1594         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1595          platforms where Gtk3, Qt5 and Plasma is available.]),
1598 AC_ARG_ENABLE(gui,
1599     AS_HELP_STRING([--disable-gui],
1600         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1601 ,enable_gui=yes)
1603 libo_FUZZ_ARG_ENABLE(randr,
1604     AS_HELP_STRING([--disable-randr],
1605         [Disable RandR support in the vcl project.]),
1606 ,test "${enable_randr+set}" = set || enable_randr=yes)
1608 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1609     AS_HELP_STRING([--disable-gstreamer-1-0],
1610         [Disable building with the gstreamer 1.0 avmedia backend.]),
1611 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1613 libo_FUZZ_ARG_ENABLE(vlc,
1614     AS_HELP_STRING([--enable-vlc],
1615         [Enable building with the (experimental) VLC avmedia backend.]),
1616 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1618 libo_FUZZ_ARG_ENABLE(neon,
1619     AS_HELP_STRING([--disable-neon],
1620         [Disable neon and the compilation of webdav binding.]),
1623 libo_FUZZ_ARG_ENABLE([eot],
1624     [AS_HELP_STRING([--enable-eot],
1625         [Enable support for Embedded OpenType fonts.])],
1626 ,test "${enable_eot+set}" = set || enable_eot=no)
1628 libo_FUZZ_ARG_ENABLE(cve-tests,
1629     AS_HELP_STRING([--disable-cve-tests],
1630         [Prevent CVE tests to be executed]),
1633 libo_FUZZ_ARG_ENABLE(chart-tests,
1634     AS_HELP_STRING([--enable-chart-tests],
1635         [Executes chart XShape tests. In a perfect world these tests would be
1636          stable and everyone could run them, in reality it is best to run them
1637          only on a few machines that are known to work and maintained by people
1638          who can judge if a test failure is a regression or not.]),
1641 AC_ARG_ENABLE(build-unowinreg,
1642     AS_HELP_STRING([--enable-build-unowinreg],
1643         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1644          compiler is needed on Linux.]),
1647 AC_ARG_ENABLE(build-opensymbol,
1648     AS_HELP_STRING([--enable-build-opensymbol],
1649         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1650          fontforge installed.]),
1653 AC_ARG_ENABLE(dependency-tracking,
1654     AS_HELP_STRING([--enable-dependency-tracking],
1655         [Do not reject slow dependency extractors.])[
1656   --disable-dependency-tracking
1657                           Disables generation of dependency information.
1658                           Speed up one-time builds.],
1661 AC_ARG_ENABLE(icecream,
1662     AS_HELP_STRING([--enable-icecream],
1663         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1664          It defaults to /opt/icecream for the location of the icecream gcc/g++
1665          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1668 AC_ARG_ENABLE(ld,
1669     AS_HELP_STRING([--enable-ld=<linker>],
1670         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1671          By default tries to use the best linker possible, use --disable-ld to use the default linker.
1672          If <linker> contains any ':', the part before the first ':' is used as the value of
1673          -fuse-ld, while the part after the first ':' is used as the value of --ld-path (which is
1674          needed for Clang 12).]),
1677 libo_FUZZ_ARG_ENABLE(cups,
1678     AS_HELP_STRING([--disable-cups],
1679         [Do not build cups support.])
1682 AC_ARG_ENABLE(ccache,
1683     AS_HELP_STRING([--disable-ccache],
1684         [Do not try to use ccache automatically.
1685          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1686          CC/CXX are not yet set, and --enable-icecream is not given, we
1687          attempt to use ccache. --disable-ccache disables ccache completely.
1688          Additionally ccache's depend mode is enabled if possible,
1689          use --enable-ccache=nodepend to enable ccache without depend mode.
1693 libo_FUZZ_ARG_ENABLE(online-update,
1694     AS_HELP_STRING([--enable-online-update],
1695         [Enable the online update service that will check for new versions of
1696          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1697          If the value is "mar", the experimental Mozilla-like update will be
1698          enabled instead of the traditional update mechanism.]),
1701 AC_ARG_WITH(update-config,
1702     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1703                    [Path to the update config ini file]))
1705 libo_FUZZ_ARG_ENABLE(extension-update,
1706     AS_HELP_STRING([--disable-extension-update],
1707         [Disable possibility to update installed extensions.]),
1710 libo_FUZZ_ARG_ENABLE(release-build,
1711     AS_HELP_STRING([--enable-release-build],
1712         [Enable release build. Note that the "release build" choice is orthogonal to
1713          whether symbols are present, debug info is generated, or optimization
1714          is done.
1715          See http://wiki.documentfoundation.org/Development/DevBuild]),
1718 AC_ARG_ENABLE(windows-build-signing,
1719     AS_HELP_STRING([--enable-windows-build-signing],
1720         [Enable signing of windows binaries (*.exe, *.dll)]),
1723 AC_ARG_ENABLE(silent-msi,
1724     AS_HELP_STRING([--enable-silent-msi],
1725         [Enable MSI with LIMITUI=1 (silent install).]),
1728 AC_ARG_ENABLE(macosx-code-signing,
1729     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1730         [Sign executables, dylibs, frameworks and the app bundle. If you
1731          don't provide an identity the first suitable certificate
1732          in your keychain is used.]),
1735 AC_ARG_ENABLE(macosx-package-signing,
1736     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1737         [Create a .pkg suitable for uploading to the Mac App Store and sign
1738          it. If you don't provide an identity the first suitable certificate
1739          in your keychain is used.]),
1742 AC_ARG_ENABLE(macosx-sandbox,
1743     AS_HELP_STRING([--enable-macosx-sandbox],
1744         [Make the app bundle run in a sandbox. Requires code signing.
1745          Is required by apps distributed in the Mac App Store, and implies
1746          adherence to App Store rules.]),
1749 AC_ARG_WITH(macosx-bundle-identifier,
1750     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1751         [Define the macOS bundle identifier. Default is the somewhat weird
1752          org.libreoffice.script ("script", huh?).]),
1753 ,with_macosx_bundle_identifier=org.libreoffice.script)
1755 AC_ARG_WITH(product-name,
1756     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1757         [Define the product name. Default is AC_PACKAGE_NAME.]),
1758 ,with_product_name=$PRODUCTNAME)
1760 libo_FUZZ_ARG_ENABLE(community-flavor,
1761     AS_HELP_STRING([--disable-community-flavor],
1762         [Disable the Community branding.]),
1765 AC_ARG_WITH(package-version,
1766     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1767         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1770 libo_FUZZ_ARG_ENABLE(readonly-installset,
1771     AS_HELP_STRING([--enable-readonly-installset],
1772         [Prevents any attempts by LibreOffice to write into its installation. That means
1773          at least that no "system-wide" extensions can be added. Partly experimental work in
1774          progress, probably not fully implemented. Always enabled for macOS.]),
1777 libo_FUZZ_ARG_ENABLE(mariadb-sdbc,
1778     AS_HELP_STRING([--disable-mariadb-sdbc],
1779         [Disable the build of the MariaDB/MySQL-SDBC driver.])
1782 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1783     AS_HELP_STRING([--disable-postgresql-sdbc],
1784         [Disable the build of the PostgreSQL-SDBC driver.])
1787 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1788     AS_HELP_STRING([--disable-lotuswordpro],
1789         [Disable the build of the Lotus Word Pro filter.]),
1790 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1792 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1793     AS_HELP_STRING([--disable-firebird-sdbc],
1794         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1795 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1797 AC_ARG_ENABLE(bogus-pkg-config,
1798     AS_HELP_STRING([--enable-bogus-pkg-config],
1799         [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.]),
1802 AC_ARG_ENABLE(openssl,
1803     AS_HELP_STRING([--disable-openssl],
1804         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1805          components will either use GNUTLS or NSS. Work in progress,
1806          use only if you are hacking on it.]),
1807 ,enable_openssl=yes)
1809 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1810     AS_HELP_STRING([--enable-cipher-openssl-backend],
1811         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1812          Requires --enable-openssl.]))
1814 AC_ARG_ENABLE(library-bin-tar,
1815     AS_HELP_STRING([--enable-library-bin-tar],
1816         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1817         Some libraries can save their build result in a tarball
1818         stored in TARFILE_LOCATION. That binary tarball is
1819         uniquely identified by the source tarball,
1820         the content of the config_host.mk file and the content
1821         of the top-level directory in core for that library
1822         If this option is enabled, then if such a tarfile exist, it will be untarred
1823         instead of the source tarfile, and the build step will be skipped for that
1824         library.
1825         If a proper tarfile does not exist, then the normal source-based
1826         build is done for that library and a proper binary tarfile is created
1827         for the next time.]),
1830 AC_ARG_ENABLE(dconf,
1831     AS_HELP_STRING([--disable-dconf],
1832         [Disable the dconf configuration backend (enabled by default where
1833          available).]))
1835 libo_FUZZ_ARG_ENABLE(formula-logger,
1836     AS_HELP_STRING(
1837         [--enable-formula-logger],
1838         [Enable formula logger for logging formula calculation flow in Calc.]
1839     )
1842 AC_ARG_ENABLE(ldap,
1843     AS_HELP_STRING([--disable-ldap],
1844         [Disable LDAP support.]),
1845 ,enable_ldap=yes)
1847 AC_ARG_ENABLE(opencl,
1848     AS_HELP_STRING([--disable-opencl],
1849         [Disable OpenCL support.]),
1850 ,enable_opencl=yes)
1852 dnl ===================================================================
1853 dnl Optional Packages (--with/without-)
1854 dnl ===================================================================
1856 AC_ARG_WITH(gcc-home,
1857     AS_HELP_STRING([--with-gcc-home],
1858         [Specify the location of gcc/g++ manually. This can be used in conjunction
1859          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1860          non-default path.]),
1863 AC_ARG_WITH(gnu-patch,
1864     AS_HELP_STRING([--with-gnu-patch],
1865         [Specify location of GNU patch on Solaris or FreeBSD.]),
1868 AC_ARG_WITH(build-platform-configure-options,
1869     AS_HELP_STRING([--with-build-platform-configure-options],
1870         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1873 AC_ARG_WITH(gnu-cp,
1874     AS_HELP_STRING([--with-gnu-cp],
1875         [Specify location of GNU cp on Solaris or FreeBSD.]),
1878 AC_ARG_WITH(external-tar,
1879     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1880         [Specify an absolute path of where to find (and store) tarfiles.]),
1881     TARFILE_LOCATION=$withval ,
1884 AC_ARG_WITH(referenced-git,
1885     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1886         [Specify another checkout directory to reference. This makes use of
1887                  git submodule update --reference, and saves a lot of diskspace
1888                  when having multiple trees side-by-side.]),
1889     GIT_REFERENCE_SRC=$withval ,
1892 AC_ARG_WITH(linked-git,
1893     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1894         [Specify a directory where the repositories of submodules are located.
1895          This uses a method similar to git-new-workdir to get submodules.]),
1896     GIT_LINK_SRC=$withval ,
1899 AC_ARG_WITH(galleries,
1900     AS_HELP_STRING([--with-galleries],
1901         [Specify how galleries should be built. It is possible either to
1902          build these internally from source ("build"),
1903          or to disable them ("no")]),
1906 AC_ARG_WITH(theme,
1907     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1908         [Choose which themes to include. By default those themes with an '*' are included.
1909          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg, *colibre, *colibre_svg, *elementary,
1910          *elementary_svg, *karasa_jaga, *karasa_jaga_svg, *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg, *sukapura, *sukapura_svg.]),
1913 libo_FUZZ_ARG_WITH(helppack-integration,
1914     AS_HELP_STRING([--without-helppack-integration],
1915         [It will not integrate the helppacks to the installer
1916          of the product. Please use this switch to use the online help
1917          or separate help packages.]),
1920 libo_FUZZ_ARG_WITH(fonts,
1921     AS_HELP_STRING([--without-fonts],
1922         [LibreOffice includes some third-party fonts to provide a reliable basis for
1923          help content, templates, samples, etc. When these fonts are already
1924          known to be available on the system then you should use this option.]),
1927 AC_ARG_ENABLE(noto-font,
1928     AS_HELP_STRING([--enable-noto-font],
1929         [Add more Google Noto fonts.]),
1932 AC_ARG_WITH(epm,
1933     AS_HELP_STRING([--with-epm],
1934         [Decides which epm to use. Default is to use the one from the system if
1935          one is built. When either this is not there or you say =internal epm
1936          will be built.]),
1939 AC_ARG_WITH(package-format,
1940     AS_HELP_STRING([--with-package-format],
1941         [Specify package format(s) for LibreOffice installation sets. The
1942          implicit --without-package-format leads to no installation sets being
1943          generated. Possible values: aix, archive, bsd, deb, dmg,
1944          installed, msi, pkg, and rpm.
1945          Example: --with-package-format='deb rpm']),
1948 AC_ARG_WITH(tls,
1949     AS_HELP_STRING([--with-tls],
1950         [Decides which TLS/SSL and cryptographic implementations to use for
1951          LibreOffice's code. Notice that this doesn't apply for depending
1952          libraries like "neon", for example. Default is to use NSS
1953          although OpenSSL is also possible. Notice that selecting NSS restricts
1954          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1955          restrict by now the usage of NSS in LO's code. Possible values:
1956          openssl, nss. Example: --with-tls="nss"]),
1959 AC_ARG_WITH(system-libs,
1960     AS_HELP_STRING([--with-system-libs],
1961         [Use libraries already on system -- enables all --with-system-* flags.]),
1964 AC_ARG_WITH(system-bzip2,
1965     AS_HELP_STRING([--with-system-bzip2],
1966         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1967     [with_system_bzip2="$with_system_libs"])
1969 AC_ARG_WITH(system-headers,
1970     AS_HELP_STRING([--with-system-headers],
1971         [Use headers already on system -- enables all --with-system-* flags for
1972          external packages whose headers are the only entities used i.e.
1973          boost/odbc/sane-header(s).]),,
1974     [with_system_headers="$with_system_libs"])
1976 AC_ARG_WITH(system-jars,
1977     AS_HELP_STRING([--without-system-jars],
1978         [When building with --with-system-libs, also the needed jars are expected
1979          on the system. Use this to disable that]),,
1980     [with_system_jars="$with_system_libs"])
1982 AC_ARG_WITH(system-cairo,
1983     AS_HELP_STRING([--with-system-cairo],
1984         [Use cairo libraries already on system.  Happens automatically for
1985          (implicit) --enable-gtk3.]))
1987 AC_ARG_WITH(system-epoxy,
1988     AS_HELP_STRING([--with-system-epoxy],
1989         [Use epoxy libraries already on system.  Happens automatically for
1990          (implicit) --enable-gtk3.]),,
1991        [with_system_epoxy="$with_system_libs"])
1993 AC_ARG_WITH(myspell-dicts,
1994     AS_HELP_STRING([--with-myspell-dicts],
1995         [Adds myspell dictionaries to the LibreOffice installation set]),
1998 AC_ARG_WITH(system-dicts,
1999     AS_HELP_STRING([--without-system-dicts],
2000         [Do not use dictionaries from system paths.]),
2003 AC_ARG_WITH(external-dict-dir,
2004     AS_HELP_STRING([--with-external-dict-dir],
2005         [Specify external dictionary dir.]),
2008 AC_ARG_WITH(external-hyph-dir,
2009     AS_HELP_STRING([--with-external-hyph-dir],
2010         [Specify external hyphenation pattern dir.]),
2013 AC_ARG_WITH(external-thes-dir,
2014     AS_HELP_STRING([--with-external-thes-dir],
2015         [Specify external thesaurus dir.]),
2018 AC_ARG_WITH(system-zlib,
2019     AS_HELP_STRING([--with-system-zlib],
2020         [Use zlib already on system.]),,
2021     [with_system_zlib=auto])
2023 AC_ARG_WITH(system-jpeg,
2024     AS_HELP_STRING([--with-system-jpeg],
2025         [Use jpeg already on system.]),,
2026     [with_system_jpeg="$with_system_libs"])
2028 AC_ARG_WITH(system-clucene,
2029     AS_HELP_STRING([--with-system-clucene],
2030         [Use clucene already on system.]),,
2031     [with_system_clucene="$with_system_libs"])
2033 AC_ARG_WITH(system-expat,
2034     AS_HELP_STRING([--with-system-expat],
2035         [Use expat already on system.]),,
2036     [with_system_expat="$with_system_libs"])
2038 AC_ARG_WITH(system-libxml,
2039     AS_HELP_STRING([--with-system-libxml],
2040         [Use libxml/libxslt already on system.]),,
2041     [with_system_libxml=auto])
2043 AC_ARG_WITH(system-icu,
2044     AS_HELP_STRING([--with-system-icu],
2045         [Use icu already on system.]),,
2046     [with_system_icu="$with_system_libs"])
2048 AC_ARG_WITH(system-ucpp,
2049     AS_HELP_STRING([--with-system-ucpp],
2050         [Use ucpp already on system.]),,
2051     [])
2053 AC_ARG_WITH(system-openldap,
2054     AS_HELP_STRING([--with-system-openldap],
2055         [Use the OpenLDAP LDAP SDK already on system.]),,
2056     [with_system_openldap="$with_system_libs"])
2058 libo_FUZZ_ARG_ENABLE(poppler,
2059     AS_HELP_STRING([--disable-poppler],
2060         [Disable building Poppler.])
2063 AC_ARG_WITH(system-poppler,
2064     AS_HELP_STRING([--with-system-poppler],
2065         [Use system poppler (only needed for PDF import).]),,
2066     [with_system_poppler="$with_system_libs"])
2068 libo_FUZZ_ARG_ENABLE(gpgmepp,
2069     AS_HELP_STRING([--disable-gpgmepp],
2070         [Disable building gpgmepp. Do not use in normal cases unless you want to fix potential problems it causes.])
2073 AC_ARG_WITH(system-gpgmepp,
2074     AS_HELP_STRING([--with-system-gpgmepp],
2075         [Use gpgmepp already on system]),,
2076     [with_system_gpgmepp="$with_system_libs"])
2078 AC_ARG_WITH(system-apache-commons,
2079     AS_HELP_STRING([--with-system-apache-commons],
2080         [Use Apache commons libraries already on system.]),,
2081     [with_system_apache_commons="$with_system_jars"])
2083 AC_ARG_WITH(system-mariadb,
2084     AS_HELP_STRING([--with-system-mariadb],
2085         [Use MariaDB/MySQL libraries already on system.]),,
2086     [with_system_mariadb="$with_system_libs"])
2088 AC_ARG_ENABLE(bundle-mariadb,
2089     AS_HELP_STRING([--enable-bundle-mariadb],
2090         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
2093 AC_ARG_WITH(system-postgresql,
2094     AS_HELP_STRING([--with-system-postgresql],
2095         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
2096          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
2097     [with_system_postgresql="$with_system_libs"])
2099 AC_ARG_WITH(libpq-path,
2100     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
2101         [Use this PostgreSQL C interface (libpq) installation for building
2102          the PostgreSQL-SDBC extension.]),
2105 AC_ARG_WITH(system-firebird,
2106     AS_HELP_STRING([--with-system-firebird],
2107         [Use Firebird libraries already on system, for building the Firebird-SDBC
2108          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
2109     [with_system_firebird="$with_system_libs"])
2111 AC_ARG_WITH(system-libtommath,
2112             AS_HELP_STRING([--with-system-libtommath],
2113                            [Use libtommath already on system]),,
2114             [with_system_libtommath="$with_system_libs"])
2116 AC_ARG_WITH(system-hsqldb,
2117     AS_HELP_STRING([--with-system-hsqldb],
2118         [Use hsqldb already on system.]))
2120 AC_ARG_WITH(hsqldb-jar,
2121     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
2122         [Specify path to jarfile manually.]),
2123     HSQLDB_JAR=$withval)
2125 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
2126     AS_HELP_STRING([--disable-scripting-beanshell],
2127         [Disable support for scripts in BeanShell.]),
2131 AC_ARG_WITH(system-beanshell,
2132     AS_HELP_STRING([--with-system-beanshell],
2133         [Use beanshell already on system.]),,
2134     [with_system_beanshell="$with_system_jars"])
2136 AC_ARG_WITH(beanshell-jar,
2137     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
2138         [Specify path to jarfile manually.]),
2139     BSH_JAR=$withval)
2141 libo_FUZZ_ARG_ENABLE(scripting-javascript,
2142     AS_HELP_STRING([--disable-scripting-javascript],
2143         [Disable support for scripts in JavaScript.]),
2147 AC_ARG_WITH(system-rhino,
2148     AS_HELP_STRING([--with-system-rhino],
2149         [Use rhino already on system.]),,)
2150 #    [with_system_rhino="$with_system_jars"])
2151 # Above is not used as we have different debug interface
2152 # patched into internal rhino. This code needs to be fixed
2153 # before we can enable it by default.
2155 AC_ARG_WITH(rhino-jar,
2156     AS_HELP_STRING([--with-rhino-jar=JARFILE],
2157         [Specify path to jarfile manually.]),
2158     RHINO_JAR=$withval)
2160 AC_ARG_WITH(commons-logging-jar,
2161     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
2162         [Specify path to jarfile manually.]),
2163     COMMONS_LOGGING_JAR=$withval)
2165 AC_ARG_WITH(system-jfreereport,
2166     AS_HELP_STRING([--with-system-jfreereport],
2167         [Use JFreeReport already on system.]),,
2168     [with_system_jfreereport="$with_system_jars"])
2170 AC_ARG_WITH(sac-jar,
2171     AS_HELP_STRING([--with-sac-jar=JARFILE],
2172         [Specify path to jarfile manually.]),
2173     SAC_JAR=$withval)
2175 AC_ARG_WITH(libxml-jar,
2176     AS_HELP_STRING([--with-libxml-jar=JARFILE],
2177         [Specify path to jarfile manually.]),
2178     LIBXML_JAR=$withval)
2180 AC_ARG_WITH(flute-jar,
2181     AS_HELP_STRING([--with-flute-jar=JARFILE],
2182         [Specify path to jarfile manually.]),
2183     FLUTE_JAR=$withval)
2185 AC_ARG_WITH(jfreereport-jar,
2186     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
2187         [Specify path to jarfile manually.]),
2188     JFREEREPORT_JAR=$withval)
2190 AC_ARG_WITH(liblayout-jar,
2191     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
2192         [Specify path to jarfile manually.]),
2193     LIBLAYOUT_JAR=$withval)
2195 AC_ARG_WITH(libloader-jar,
2196     AS_HELP_STRING([--with-libloader-jar=JARFILE],
2197         [Specify path to jarfile manually.]),
2198     LIBLOADER_JAR=$withval)
2200 AC_ARG_WITH(libformula-jar,
2201     AS_HELP_STRING([--with-libformula-jar=JARFILE],
2202         [Specify path to jarfile manually.]),
2203     LIBFORMULA_JAR=$withval)
2205 AC_ARG_WITH(librepository-jar,
2206     AS_HELP_STRING([--with-librepository-jar=JARFILE],
2207         [Specify path to jarfile manually.]),
2208     LIBREPOSITORY_JAR=$withval)
2210 AC_ARG_WITH(libfonts-jar,
2211     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
2212         [Specify path to jarfile manually.]),
2213     LIBFONTS_JAR=$withval)
2215 AC_ARG_WITH(libserializer-jar,
2216     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
2217         [Specify path to jarfile manually.]),
2218     LIBSERIALIZER_JAR=$withval)
2220 AC_ARG_WITH(libbase-jar,
2221     AS_HELP_STRING([--with-libbase-jar=JARFILE],
2222         [Specify path to jarfile manually.]),
2223     LIBBASE_JAR=$withval)
2225 AC_ARG_WITH(system-odbc,
2226     AS_HELP_STRING([--with-system-odbc],
2227         [Use the odbc headers already on system.]),,
2228     [with_system_odbc="auto"])
2230 AC_ARG_WITH(system-sane,
2231     AS_HELP_STRING([--with-system-sane],
2232         [Use sane.h already on system.]),,
2233     [with_system_sane="$with_system_headers"])
2235 AC_ARG_WITH(system-bluez,
2236     AS_HELP_STRING([--with-system-bluez],
2237         [Use bluetooth.h already on system.]),,
2238     [with_system_bluez="$with_system_headers"])
2240 AC_ARG_WITH(system-curl,
2241     AS_HELP_STRING([--with-system-curl],
2242         [Use curl already on system.]),,
2243     [with_system_curl=auto])
2245 AC_ARG_WITH(system-boost,
2246     AS_HELP_STRING([--with-system-boost],
2247         [Use boost already on system.]),,
2248     [with_system_boost="$with_system_headers"])
2250 AC_ARG_WITH(system-glm,
2251     AS_HELP_STRING([--with-system-glm],
2252         [Use glm already on system.]),,
2253     [with_system_glm="$with_system_headers"])
2255 AC_ARG_WITH(system-hunspell,
2256     AS_HELP_STRING([--with-system-hunspell],
2257         [Use libhunspell already on system.]),,
2258     [with_system_hunspell="$with_system_libs"])
2260 libo_FUZZ_ARG_ENABLE(qrcodegen,
2261     AS_HELP_STRING([--disable-qrcodegen],
2262         [Disable use of qrcodegen external library.]))
2264 AC_ARG_WITH(system-qrcodegen,
2265     AS_HELP_STRING([--with-system-qrcodegen],
2266         [Use libqrcodegen already on system.]),,
2267     [with_system_qrcodegen="$with_system_libs"])
2269 AC_ARG_WITH(system-box2d,
2270     AS_HELP_STRING([--with-system-box2d],
2271         [Use box2d already on system.]),,
2272     [with_system_box2d="$with_system_libs"])
2274 AC_ARG_WITH(system-mythes,
2275     AS_HELP_STRING([--with-system-mythes],
2276         [Use mythes already on system.]),,
2277     [with_system_mythes="$with_system_libs"])
2279 AC_ARG_WITH(system-altlinuxhyph,
2280     AS_HELP_STRING([--with-system-altlinuxhyph],
2281         [Use ALTLinuxhyph already on system.]),,
2282     [with_system_altlinuxhyph="$with_system_libs"])
2284 AC_ARG_WITH(system-lpsolve,
2285     AS_HELP_STRING([--with-system-lpsolve],
2286         [Use lpsolve already on system.]),,
2287     [with_system_lpsolve="$with_system_libs"])
2289 AC_ARG_WITH(system-coinmp,
2290     AS_HELP_STRING([--with-system-coinmp],
2291         [Use CoinMP already on system.]),,
2292     [with_system_coinmp="$with_system_libs"])
2294 AC_ARG_WITH(system-liblangtag,
2295     AS_HELP_STRING([--with-system-liblangtag],
2296         [Use liblangtag library already on system.]),,
2297     [with_system_liblangtag="$with_system_libs"])
2299 AC_ARG_WITH(webdav,
2300     AS_HELP_STRING([--with-webdav],
2301         [Specify which library to use for webdav implementation.
2302          Possible values: "neon", "serf", "no". The default value is "neon".
2303          Example: --with-webdav="serf"]),
2304     WITH_WEBDAV=$withval,
2305     WITH_WEBDAV="neon")
2307 AC_ARG_WITH(linker-hash-style,
2308     AS_HELP_STRING([--with-linker-hash-style],
2309         [Use linker with --hash-style=<style> when linking shared objects.
2310          Possible values: "sysv", "gnu", "both". The default value is "gnu"
2311          if supported on the build system, and "sysv" otherwise.]))
2313 AC_ARG_WITH(jdk-home,
2314     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
2315         [If you have installed JDK 9 or later on your system please supply the
2316          path here. Note that this is not the location of the java command but the
2317          location of the entire distribution. In case of cross-compiling, this
2318          is the JDK of the host os. Use --with-build-platform-configure-options
2319          to point to a different build platform JDK.]),
2322 AC_ARG_WITH(help,
2323     AS_HELP_STRING([--with-help],
2324         [Enable the build of help. There is a special parameter "common" that
2325          can be used to bundle only the common part, .e.g help-specific icons.
2326          This is useful when you build the helpcontent separately.])
2327     [
2328                           Usage:     --with-help    build the old local help
2329                                  --without-help     no local help (default)
2330                                  --with-help=html   build the new HTML local help
2331                                  --with-help=online build the new HTML online help
2332     ],
2335 AC_ARG_WITH(omindex,
2336    AS_HELP_STRING([--with-omindex],
2337         [Enable the support of xapian-omega index for online help.])
2338    [
2339                          Usage: --with-omindex=server prepare the pages for omindex
2340                                 but let xapian-omega be built in server.
2341                                 --with-omindex=noxap do not prepare online pages
2342                                 for xapian-omega
2343   ],
2346 libo_FUZZ_ARG_WITH(java,
2347     AS_HELP_STRING([--with-java=<java command>],
2348         [Specify the name of the Java interpreter command. Typically "java"
2349          which is the default.
2351          To build without support for Java components, applets, accessibility
2352          or the XML filters written in Java, use --without-java or --with-java=no.]),
2353     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2354     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2357 AC_ARG_WITH(jvm-path,
2358     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2359         [Use a specific JVM search path at runtime.
2360          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2363 AC_ARG_WITH(ant-home,
2364     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2365         [If you have installed Apache Ant on your system, please supply the path here.
2366          Note that this is not the location of the Ant binary but the location
2367          of the entire distribution.]),
2370 AC_ARG_WITH(symbol-config,
2371     AS_HELP_STRING([--with-symbol-config],
2372         [Configuration for the crashreport symbol upload]),
2373         [],
2374         [with_symbol_config=no])
2376 AC_ARG_WITH(export-validation,
2377     AS_HELP_STRING([--without-export-validation],
2378         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2379 ,with_export_validation=auto)
2381 AC_ARG_WITH(bffvalidator,
2382     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2383         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2384          Requires installed Microsoft Office Binary File Format Validator.
2385          Note: export-validation (--with-export-validation) is required to be turned on.
2386          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2387 ,with_bffvalidator=no)
2389 libo_FUZZ_ARG_WITH(junit,
2390     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2391         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2392          --without-junit disables those tests. Not relevant in the --without-java case.]),
2393 ,with_junit=yes)
2395 AC_ARG_WITH(hamcrest,
2396     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2397         [Specifies the hamcrest jar file to use for JUnit-based tests.
2398          --without-junit disables those tests. Not relevant in the --without-java case.]),
2399 ,with_hamcrest=yes)
2401 AC_ARG_WITH(perl-home,
2402     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2403         [If you have installed Perl 5 Distribution, on your system, please
2404          supply the path here. Note that this is not the location of the Perl
2405          binary but the location of the entire distribution.]),
2408 libo_FUZZ_ARG_WITH(doxygen,
2409     AS_HELP_STRING(
2410         [--with-doxygen=<absolute path to doxygen executable>],
2411         [Specifies the doxygen executable to use when generating ODK C/C++
2412          documentation. --without-doxygen disables generation of ODK C/C++
2413          documentation. Not relevant in the --disable-odk case.]),
2414 ,with_doxygen=yes)
2416 AC_ARG_WITH(visual-studio,
2417     AS_HELP_STRING([--with-visual-studio=<2019>],
2418         [Specify which Visual Studio version to use in case several are
2419          installed. Currently only 2019 (default) is supported.]),
2422 AC_ARG_WITH(windows-sdk,
2423     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10.0>],
2424         [Specify which Windows SDK, or "Windows Kit", version to use
2425          in case the one that came with the selected Visual Studio
2426          is not what you want for some reason. Note that not all compiler/SDK
2427          combinations are supported. The intent is that this option should not
2428          be needed.]),
2431 AC_ARG_WITH(lang,
2432     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2433         [Use this option to build LibreOffice with additional UI language support.
2434          English (US) is always included by default.
2435          Separate multiple languages with space.
2436          For all languages, use --with-lang=ALL.]),
2439 AC_ARG_WITH(locales,
2440     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2441         [Use this option to limit the locale information built in.
2442          Separate multiple locales with space.
2443          Very experimental and might well break stuff.
2444          Just a desperate measure to shrink code and data size.
2445          By default all the locales available is included.
2446          This option is completely unrelated to --with-lang.])
2447     [
2448                           Affects also our character encoding conversion
2449                           tables for encodings mainly targeted for a
2450                           particular locale, like EUC-CN and EUC-TW for
2451                           zh, ISO-2022-JP for ja.
2453                           Affects also our add-on break iterator data for
2454                           some languages.
2456                           For the default, all locales, don't use this switch at all.
2457                           Specifying just the language part of a locale means all matching
2458                           locales will be included.
2459     ],
2462 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2463 libo_FUZZ_ARG_WITH(krb5,
2464     AS_HELP_STRING([--with-krb5],
2465         [Enable MIT Kerberos 5 support in modules that support it.
2466          By default automatically enabled on platforms
2467          where a good system Kerberos 5 is available.]),
2470 libo_FUZZ_ARG_WITH(gssapi,
2471     AS_HELP_STRING([--with-gssapi],
2472         [Enable GSSAPI support in modules that support it.
2473          By default automatically enabled on platforms
2474          where a good system GSSAPI is available.]),
2477 AC_ARG_WITH(iwyu,
2478     AS_HELP_STRING([--with-iwyu],
2479         [Use given IWYU binary path to check unneeded includes instead of building.
2480          Use only if you are hacking on it.]),
2483 libo_FUZZ_ARG_WITH(lxml,
2484     AS_HELP_STRING([--without-lxml],
2485         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2486          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2487          report widget classes and ids.]),
2490 libo_FUZZ_ARG_WITH(latest-c++,
2491     AS_HELP_STRING([--with-latest-c++],
2492         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2493          published standard.]),,
2494         [with_latest_c__=no])
2496 dnl ===================================================================
2497 dnl Branding
2498 dnl ===================================================================
2500 AC_ARG_WITH(branding,
2501     AS_HELP_STRING([--with-branding=/path/to/images],
2502         [Use given path to retrieve branding images set.])
2503     [
2504                           Search for intro.png about.svg and logo.svg.
2505                           If any is missing, default ones will be used instead.
2507                           Search also progress.conf for progress
2508                           settings on intro screen :
2510                           PROGRESSBARCOLOR="255,255,255" Set color of
2511                           progress bar. Comma separated RGB decimal values.
2512                           PROGRESSSIZE="407,6" Set size of progress bar.
2513                           Comma separated decimal values (width, height).
2514                           PROGRESSPOSITION="61,317" Set position of progress
2515                           bar from left,top. Comma separated decimal values.
2516                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2517                           bar frame. Comma separated RGB decimal values.
2518                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2519                           bar text. Comma separated RGB decimal values.
2520                           PROGRESSTEXTBASELINE="287" Set vertical position of
2521                           progress bar text from top. Decimal value.
2523                           Default values will be used if not found.
2524     ],
2528 AC_ARG_WITH(extra-buildid,
2529     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2530         [Show addition build identification in about dialog.]),
2534 AC_ARG_WITH(vendor,
2535     AS_HELP_STRING([--with-vendor="John the Builder"],
2536         [Set vendor of the build.]),
2539 AC_ARG_WITH(android-package-name,
2540     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2541         [Set Android package name of the build.]),
2544 AC_ARG_WITH(compat-oowrappers,
2545     AS_HELP_STRING([--with-compat-oowrappers],
2546         [Install oo* wrappers in parallel with
2547          lo* ones to keep backward compatibility.
2548          Has effect only with make distro-pack-install]),
2551 AC_ARG_WITH(os-version,
2552     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2553         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2556 AC_ARG_WITH(mingw-cross-compiler,
2557     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2558         [Specify the MinGW cross-compiler to use.
2559          When building on the ODK on Unix and building unowinreg.dll,
2560          specify the MinGW C++ cross-compiler.]),
2563 AC_ARG_WITH(idlc-cpp,
2564     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2565         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2568 AC_ARG_WITH(parallelism,
2569     AS_HELP_STRING([--with-parallelism],
2570         [Number of jobs to run simultaneously during build. Parallel builds can
2571         save a lot of time on multi-cpu machines. Defaults to the number of
2572         CPUs on the machine, unless you configure --enable-icecream - then to
2573         40.]),
2576 AC_ARG_WITH(all-tarballs,
2577     AS_HELP_STRING([--with-all-tarballs],
2578         [Download all external tarballs unconditionally]))
2580 AC_ARG_WITH(gdrive-client-id,
2581     AS_HELP_STRING([--with-gdrive-client-id],
2582         [Provides the client id of the application for OAuth2 authentication
2583         on Google Drive. If either this or --with-gdrive-client-secret is
2584         empty, the feature will be disabled]),
2587 AC_ARG_WITH(gdrive-client-secret,
2588     AS_HELP_STRING([--with-gdrive-client-secret],
2589         [Provides the client secret of the application for OAuth2
2590         authentication on Google Drive. If either this or
2591         --with-gdrive-client-id is empty, the feature will be disabled]),
2594 AC_ARG_WITH(alfresco-cloud-client-id,
2595     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2596         [Provides the client id of the application for OAuth2 authentication
2597         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2598         empty, the feature will be disabled]),
2601 AC_ARG_WITH(alfresco-cloud-client-secret,
2602     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2603         [Provides the client secret of the application for OAuth2
2604         authentication on Alfresco Cloud. If either this or
2605         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2608 AC_ARG_WITH(onedrive-client-id,
2609     AS_HELP_STRING([--with-onedrive-client-id],
2610         [Provides the client id of the application for OAuth2 authentication
2611         on OneDrive. If either this or --with-onedrive-client-secret is
2612         empty, the feature will be disabled]),
2615 AC_ARG_WITH(onedrive-client-secret,
2616     AS_HELP_STRING([--with-onedrive-client-secret],
2617         [Provides the client secret of the application for OAuth2
2618         authentication on OneDrive. If either this or
2619         --with-onedrive-client-id is empty, the feature will be disabled]),
2621 dnl ===================================================================
2622 dnl Do we want to use pre-build binary tarball for recompile
2623 dnl ===================================================================
2625 if test "$enable_library_bin_tar" = "yes" ; then
2626     USE_LIBRARY_BIN_TAR=TRUE
2627 else
2628     USE_LIBRARY_BIN_TAR=
2630 AC_SUBST(USE_LIBRARY_BIN_TAR)
2632 dnl ===================================================================
2633 dnl Test whether build target is Release Build
2634 dnl ===================================================================
2635 AC_MSG_CHECKING([whether build target is Release Build])
2636 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2637     AC_MSG_RESULT([no])
2638     ENABLE_RELEASE_BUILD=
2639     GET_TASK_ALLOW_ENTITLEMENT='
2640         <!-- We want to be able to debug a hardened process when not building for release -->
2641         <key>com.apple.security.get-task-allow</key>
2642         <true/>'
2643 else
2644     AC_MSG_RESULT([yes])
2645     ENABLE_RELEASE_BUILD=TRUE
2646     GET_TASK_ALLOW_ENTITLEMENT=''
2648 AC_SUBST(ENABLE_RELEASE_BUILD)
2649 AC_SUBST(GET_TASK_ALLOW_ENTITLEMENT)
2651 AC_MSG_CHECKING([whether to build a Community flavor])
2652 if test -z "$enable_community_flavor" -o "$enable_community_flavor" == "yes"; then
2653     AC_DEFINE(HAVE_FEATURE_COMMUNITY_FLAVOR)
2654     AC_MSG_RESULT([yes])
2655 else
2656     AC_MSG_RESULT([no])
2659 dnl ===================================================================
2660 dnl Test whether to sign Windows Build
2661 dnl ===================================================================
2662 AC_MSG_CHECKING([whether to sign windows build])
2663 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2664     AC_MSG_RESULT([yes])
2665     WINDOWS_BUILD_SIGNING="TRUE"
2666 else
2667     AC_MSG_RESULT([no])
2668     WINDOWS_BUILD_SIGNING="FALSE"
2670 AC_SUBST(WINDOWS_BUILD_SIGNING)
2672 dnl ===================================================================
2673 dnl MacOSX build and runtime environment options
2674 dnl ===================================================================
2676 AC_ARG_WITH(macosx-sdk,
2677     AS_HELP_STRING([--with-macosx-sdk=<version>],
2678         [Prefer a specific SDK for building.])
2679     [
2680                           If the requested SDK is not available, a search for the oldest one will be done.
2681                           With current Xcode versions, only the latest SDK is included, so this option is
2682                           not terribly useful. It works fine to build with a new SDK and run the result
2683                           on an older OS.
2685                           e. g.: --with-macosx-sdk=10.10
2687                           there are 3 options to control the MacOSX build:
2688                           --with-macosx-sdk (referred as 'sdk' below)
2689                           --with-macosx-version-min-required (referred as 'min' below)
2690                           --with-macosx-version-max-allowed (referred as 'max' below)
2692                           the connection between these value and the default they take is as follow:
2693                           ( ? means not specified on the command line, s means the SDK version found,
2694                           constraint: 8 <= x <= y <= z)
2696                           ==========================================
2697                            command line      || config result
2698                           ==========================================
2699                           min  | max  | sdk  || min   | max  | sdk  |
2700                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2701                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2702                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2703                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2704                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2705                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2706                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2707                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2710                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2711                           for a detailed technical explanation of these variables
2713                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2714     ],
2717 AC_ARG_WITH(macosx-version-min-required,
2718     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2719         [set the minimum OS version needed to run the built LibreOffice])
2720     [
2721                           e. g.: --with-macosx-version-min-required=10.10
2722                           see --with-macosx-sdk for more info
2723     ],
2726 AC_ARG_WITH(macosx-version-max-allowed,
2727     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2728         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2729     [
2730                           e. g.: --with-macosx-version-max-allowed=10.10
2731                           see --with-macosx-sdk for more info
2732     ],
2736 dnl ===================================================================
2737 dnl options for stuff used during cross-compilation build
2738 dnl Not quite superseded by --with-build-platform-configure-options.
2739 dnl TODO: check, if the "force" option is still needed anywhere.
2740 dnl ===================================================================
2742 AC_ARG_WITH(system-icu-for-build,
2743     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2744         [Use icu already on system for build tools (cross-compilation only).]))
2747 dnl ===================================================================
2748 dnl Check for incompatible options set by fuzzing, and reset those
2749 dnl automatically to working combinations
2750 dnl ===================================================================
2752 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2753         "$enable_dbus" != "$enable_avahi"; then
2754     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2755     enable_avahi=$enable_dbus
2758 add_lopath_after ()
2760     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2761         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2762     fi
2765 add_lopath_before ()
2767     local IFS=${P_SEP}
2768     local path_cleanup
2769     local dir
2770     for dir in $LO_PATH ; do
2771         if test "$dir" != "$1" ; then
2772             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2773         fi
2774     done
2775     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2778 dnl ===================================================================
2779 dnl check for required programs (grep, awk, sed, bash)
2780 dnl ===================================================================
2782 pathmunge ()
2784     local new_path
2785     if test -n "$1"; then
2786         if test "$build_os" = "cygwin"; then
2787             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2788                 PathFormat "$1"
2789                 new_path=`cygpath -sm "$formatted_path"`
2790             else
2791                 PathFormat "$1"
2792                 new_path=`cygpath -u "$formatted_path"`
2793             fi
2794         else
2795             new_path="$1"
2796         fi
2797         if test "$2" = "after"; then
2798             add_lopath_after "$new_path"
2799         else
2800             add_lopath_before "$new_path"
2801         fi
2802     fi
2805 AC_PROG_AWK
2806 AC_PATH_PROG( AWK, $AWK)
2807 if test -z "$AWK"; then
2808     AC_MSG_ERROR([install awk to run this script])
2811 AC_PATH_PROG(BASH, bash)
2812 if test -z "$BASH"; then
2813     AC_MSG_ERROR([bash not found in \$PATH])
2815 AC_SUBST(BASH)
2817 # prefer parallel comression tools, if available
2818 AC_PATH_PROG(COMPRESSIONTOOL, pigz)
2819 if test -z "$COMPRESSIONTOOL"; then
2820     AC_PATH_PROG(COMPRESSIONTOOL, gzip)
2821     if test -z "$COMPRESSIONTOOL"; then
2822         AC_MSG_ERROR([gzip not found in \$PATH])
2823     fi
2825 AC_SUBST(COMPRESSIONTOOL)
2827 AC_MSG_CHECKING([for GNU or BSD tar])
2828 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2829     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2830     if test $? -eq 0;  then
2831         GNUTAR=$a
2832         break
2833     fi
2834 done
2835 AC_MSG_RESULT($GNUTAR)
2836 if test -z "$GNUTAR"; then
2837     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2839 AC_SUBST(GNUTAR)
2841 AC_MSG_CHECKING([for tar's option to strip components])
2842 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2843 if test $? -eq 0; then
2844     STRIP_COMPONENTS="--strip-components"
2845 else
2846     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2847     if test $? -eq 0; then
2848         STRIP_COMPONENTS="--strip-path"
2849     else
2850         STRIP_COMPONENTS="unsupported"
2851     fi
2853 AC_MSG_RESULT($STRIP_COMPONENTS)
2854 if test x$STRIP_COMPONENTS = xunsupported; then
2855     AC_MSG_ERROR([you need a tar that is able to strip components.])
2857 AC_SUBST(STRIP_COMPONENTS)
2859 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2860 dnl desktop OSes from "mobile" ones.
2862 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2863 dnl In other words, that when building for an OS that is not a
2864 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2866 dnl Note the direction of the implication; there is no assumption that
2867 dnl cross-compiling would imply a non-desktop OS.
2869 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2870     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2871     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2872     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2875 # Whether to build "avmedia" functionality or not.
2877 if test -z "$enable_avmedia"; then
2878     enable_avmedia=yes
2881 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2882 if test "$enable_avmedia" = yes; then
2883     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2884 else
2885     USE_AVMEDIA_DUMMY='TRUE'
2887 AC_SUBST(USE_AVMEDIA_DUMMY)
2889 # Decide whether to build database connectivity stuff (including
2890 # Base) or not. We probably don't want to on non-desktop OSes.
2891 if test -z "$enable_database_connectivity"; then
2892     # --disable-database-connectivity is unfinished work in progress
2893     # and the iOS test app doesn't link if we actually try to use it.
2894     # if test $_os != iOS -a $_os != Android; then
2895     if test $_os != iOS; then
2896         enable_database_connectivity=yes
2897     fi
2900 if test "$enable_database_connectivity" = yes; then
2901     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2902     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2905 if test -z "$enable_extensions"; then
2906     # For iOS and Android Viewer, disable extensions unless specifically overridden with --enable-extensions.
2907     if test $_os != iOS && test $_os != Android -o "$ENABLE_ANDROID_LOK" = TRUE ; then
2908         enable_extensions=yes
2909     fi
2912 if test "$enable_extensions" = yes; then
2913     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2914     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2917 if test -z "$enable_scripting"; then
2918     enable_scripting=yes
2921 DISABLE_SCRIPTING=''
2922 if test "$enable_scripting" = yes; then
2923     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2924     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2925 else
2926     DISABLE_SCRIPTING='TRUE'
2927     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2930 if test $_os = iOS -o $_os = Android; then
2931     # Disable dynamic_loading always for iOS and Android
2932     enable_dynamic_loading=no
2933 elif test -z "$enable_dynamic_loading"; then
2934     # Otherwise enable it unless specifically disabled
2935     enable_dynamic_loading=yes
2938 DISABLE_DYNLOADING=''
2939 if test "$enable_dynamic_loading" = yes; then
2940     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2941 else
2942     DISABLE_DYNLOADING='TRUE'
2944 AC_SUBST(DISABLE_DYNLOADING)
2946 # remember SYSBASE value
2947 AC_SUBST(SYSBASE)
2949 dnl ===================================================================
2950 dnl  Sort out various gallery compilation options
2951 dnl ===================================================================
2952 AC_MSG_CHECKING([how to build and package galleries])
2953 if test -n "${with_galleries}"; then
2954     if test "$with_galleries" = "build"; then
2955         WITH_GALLERY_BUILD=TRUE
2956         AC_MSG_RESULT([build from source images internally])
2957     elif test "$with_galleries" = "no"; then
2958         WITH_GALLERY_BUILD=
2959         AC_MSG_RESULT([disable non-internal gallery build])
2960     else
2961         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2962     fi
2963 else
2964     if test $_os != iOS -a $_os != Android; then
2965         WITH_GALLERY_BUILD=TRUE
2966         AC_MSG_RESULT([internal src images for desktop])
2967     else
2968         WITH_GALLERY_BUILD=
2969         AC_MSG_RESULT([disable src image build])
2970     fi
2972 AC_SUBST(WITH_GALLERY_BUILD)
2974 dnl ===================================================================
2975 dnl  Checks if ccache is available
2976 dnl ===================================================================
2977 CCACHE_DEPEND_MODE=
2978 if test "$_os" = "WINNT"; then
2979     # on windows/VC build do not use ccache
2980     CCACHE=""
2981 elif test "$enable_ccache" = "no"; then
2982     CCACHE=""
2983 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2984     case "%$CC%$CXX%" in
2985     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2986     # assume that's good then
2987     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2988         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2989         CCACHE_DEPEND_MODE=1
2990         ;;
2991     *)
2992         AC_PATH_PROG([CCACHE],[ccache],[not found])
2993         if test "$CCACHE" = "not found"; then
2994             CCACHE=""
2995         else
2996             CCACHE_DEPEND_MODE=1
2997             # Need to check for ccache version: otherwise prevents
2998             # caching of the results (like "-x objective-c++" for Mac)
2999             if test $_os = Darwin -o $_os = iOS; then
3000                 # Check ccache version
3001                 AC_MSG_CHECKING([whether version of ccache is suitable])
3002                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
3003                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3004                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
3005                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
3006                 else
3007                     AC_MSG_RESULT([no, $CCACHE_VERSION])
3008                     CCACHE=""
3009                     CCACHE_DEPEND_MODE=
3010                 fi
3011             fi
3012         fi
3013         ;;
3014     esac
3015 else
3016     CCACHE=""
3018 if test "$enable_ccache" = "nodepend"; then
3019     CCACHE_DEPEND_MODE=""
3021 AC_SUBST(CCACHE_DEPEND_MODE)
3023 if test "$CCACHE" != ""; then
3024     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
3025     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
3026     if test "$ccache_size" = ""; then
3027         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
3028         if test "$ccache_size" = ""; then
3029             ccache_size=0
3030         fi
3031         # we could not determine the size or it was less than 1GB -> disable auto-ccache
3032         if test $ccache_size -lt 1024; then
3033             CCACHE=""
3034             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
3035             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
3036         else
3037             # warn that ccache may be too small for debug build
3038             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3039             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3040         fi
3041     else
3042         if test $ccache_size -lt 5; then
3043             #warn that ccache may be too small for debug build
3044             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3045             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3046         fi
3047     fi
3050 dnl ===================================================================
3051 dnl  Checks for C compiler,
3052 dnl  The check for the C++ compiler is later on.
3053 dnl ===================================================================
3054 if test "$_os" != "WINNT"; then
3055     GCC_HOME_SET="true"
3056     AC_MSG_CHECKING([gcc home])
3057     if test -z "$with_gcc_home"; then
3058         if test "$enable_icecream" = "yes"; then
3059             if test -d "/usr/lib/icecc/bin"; then
3060                 GCC_HOME="/usr/lib/icecc/"
3061             elif test -d "/usr/libexec/icecc/bin"; then
3062                 GCC_HOME="/usr/libexec/icecc/"
3063             elif test -d "/opt/icecream/bin"; then
3064                 GCC_HOME="/opt/icecream/"
3065             else
3066                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
3068             fi
3069         else
3070             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
3071             GCC_HOME_SET="false"
3072         fi
3073     else
3074         GCC_HOME="$with_gcc_home"
3075     fi
3076     AC_MSG_RESULT($GCC_HOME)
3077     AC_SUBST(GCC_HOME)
3079     if test "$GCC_HOME_SET" = "true"; then
3080         if test -z "$CC"; then
3081             CC="$GCC_HOME/bin/gcc"
3082             CC_BASE="gcc"
3083         fi
3084         if test -z "$CXX"; then
3085             CXX="$GCC_HOME/bin/g++"
3086             CXX_BASE="g++"
3087         fi
3088     fi
3091 COMPATH=`dirname "$CC"`
3092 if test "$COMPATH" = "."; then
3093     AC_PATH_PROGS(COMPATH, $CC)
3094     dnl double square bracket to get single because of M4 quote...
3095     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
3097 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
3099 dnl ===================================================================
3100 dnl Java support
3101 dnl ===================================================================
3102 AC_MSG_CHECKING([whether to build with Java support])
3103 if test "$with_java" != "no"; then
3104     if test "$DISABLE_SCRIPTING" = TRUE; then
3105         AC_MSG_RESULT([no, overridden by --disable-scripting])
3106         ENABLE_JAVA=""
3107         with_java=no
3108     else
3109         AC_MSG_RESULT([yes])
3110         ENABLE_JAVA="TRUE"
3111         AC_DEFINE(HAVE_FEATURE_JAVA)
3112     fi
3113 else
3114     AC_MSG_RESULT([no])
3115     ENABLE_JAVA=""
3118 AC_SUBST(ENABLE_JAVA)
3120 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
3122 dnl ENABLE_JAVA="" indicate no Java support at all
3124 dnl ===================================================================
3125 dnl Check macOS SDK and compiler
3126 dnl ===================================================================
3128 if test $_os = Darwin; then
3130     # If no --with-macosx-sdk option is given, look for one
3132     # The intent is that for "most" Mac-based developers, a suitable
3133     # SDK will be found automatically without any configure options.
3135     # For developers with a current Xcode, the lowest-numbered SDK
3136     # higher than or equal to the minimum required should be found.
3138     AC_MSG_CHECKING([what macOS SDK to use])
3139     for _macosx_sdk in ${with_macosx_sdk-12.1 12.0 11.3 11.1 11.0 10.15 10.14 10.13}; do
3140         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
3141         if test -d "$MACOSX_SDK_PATH"; then
3142             with_macosx_sdk="${_macosx_sdk}"
3143             break
3144         else
3145             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
3146             if test -d "$MACOSX_SDK_PATH"; then
3147                 with_macosx_sdk="${_macosx_sdk}"
3148                 break
3149             fi
3150         fi
3151     done
3152     if test ! -d "$MACOSX_SDK_PATH"; then
3153         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
3154     fi
3156     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
3158     case $with_macosx_sdk in
3159     10.13)
3160         MACOSX_SDK_VERSION=101300
3161         ;;
3162     10.14)
3163         MACOSX_SDK_VERSION=101400
3164         ;;
3165     10.15)
3166         MACOSX_SDK_VERSION=101500
3167         ;;
3168     11.0)
3169         MACOSX_SDK_VERSION=110000
3170         ;;
3171     11.1)
3172         MACOSX_SDK_VERSION=110100
3173         ;;
3174     11.3)
3175         MACOSX_SDK_VERSION=110300
3176         ;;
3177     12.0)
3178         MACOSX_SDK_VERSION=120000
3179         ;;
3180     12.1)
3181         MACOSX_SDK_VERSION=120100
3182         ;;
3183     *)
3184         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.13--12.1])
3185         ;;
3186     esac
3188     if test "$host_cpu" = arm64 -a $MACOSX_SDK_VERSION -lt 110000; then
3189         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value for Apple Silicon])
3190     fi
3192     if test "$with_macosx_version_min_required" = "" ; then
3193         if test "$host_cpu" = x86_64; then
3194             with_macosx_version_min_required="10.10";
3195         else
3196             with_macosx_version_min_required="11.0";
3197         fi
3198     fi
3200     if test "$with_macosx_version_max_allowed" = "" ; then
3201         with_macosx_version_max_allowed="$with_macosx_sdk"
3202     fi
3204     # export this so that "xcrun" invocations later return matching values
3205     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
3206     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
3207     export DEVELOPER_DIR
3208     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
3209     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
3211     AC_MSG_CHECKING([whether Xcode is new enough])
3212     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
3213     my_xcode_ver2=${my_xcode_ver1#Xcode }
3214     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
3215     if test "$my_xcode_ver3" -ge 1103; then
3216         AC_MSG_RESULT([yes ($my_xcode_ver2)])
3217     else
3218         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 11.3])
3219     fi
3221     case "$with_macosx_version_min_required" in
3222     10.10)
3223         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
3224         ;;
3225     10.11)
3226         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
3227         ;;
3228     10.12)
3229         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
3230         ;;
3231     10.13)
3232         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
3233         ;;
3234     10.14)
3235         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
3236         ;;
3237     10.15)
3238         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
3239         ;;
3240     10.16)
3241         MAC_OS_X_VERSION_MIN_REQUIRED="101600"
3242         ;;
3243     11.0)
3244         MAC_OS_X_VERSION_MIN_REQUIRED="110000"
3245         ;;
3246     11.1)
3247         MAC_OS_X_VERSION_MIN_REQUIRED="110100"
3248         ;;
3249     11.3)
3250         MAC_OS_X_VERSION_MIN_REQUIRED="110300"
3251         ;;
3252     12.0)
3253         MAC_OS_X_VERSION_MIN_REQUIRED="120000"
3254         ;;
3255     12.1)
3256         MAC_OS_X_VERSION_MIN_REQUIRED="120100"
3257         ;;
3258     *)
3259         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--12.1])
3260         ;;
3261     esac
3263     LIBTOOL=/usr/bin/libtool
3264     INSTALL_NAME_TOOL=install_name_tool
3265     if test -z "$save_CC"; then
3266         stdlib=-stdlib=libc++
3268         AC_MSG_CHECKING([what C compiler to use])
3269         CC="`xcrun -find clang`"
3270         CC_BASE=`first_arg_basename "$CC"`
3271         if test "$host_cpu" = x86_64; then
3272             CC+=" -target x86_64-apple-macos"
3273         else
3274             CC+=" -target arm64-apple-macos"
3275         fi
3276         CC+=" -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3277         AC_MSG_RESULT([$CC])
3279         AC_MSG_CHECKING([what C++ compiler to use])
3280         CXX="`xcrun -find clang++`"
3281         CXX_BASE=`first_arg_basename "$CXX"`
3282         if test "$host_cpu" = x86_64; then
3283             CXX+=" -target x86_64-apple-macos"
3284         else
3285             CXX+=" -target arm64-apple-macos"
3286         fi
3287         CXX+=" $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3288         AC_MSG_RESULT([$CXX])
3290         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3291         AR=`xcrun -find ar`
3292         NM=`xcrun -find nm`
3293         STRIP=`xcrun -find strip`
3294         LIBTOOL=`xcrun -find libtool`
3295         RANLIB=`xcrun -find ranlib`
3296     fi
3298     case "$with_macosx_version_max_allowed" in
3299     10.10)
3300         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
3301         ;;
3302     10.11)
3303         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
3304         ;;
3305     10.12)
3306         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
3307         ;;
3308     10.13)
3309         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
3310         ;;
3311     10.14)
3312         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
3313         ;;
3314     10.15)
3315         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
3316         ;;
3317     11.0)
3318         MAC_OS_X_VERSION_MAX_ALLOWED="110000"
3319         ;;
3320     11.1)
3321         MAC_OS_X_VERSION_MAX_ALLOWED="110100"
3322         ;;
3323     11.3)
3324         MAC_OS_X_VERSION_MAX_ALLOWED="110300"
3325         ;;
3326     12.0)
3327         MAC_OS_X_VERSION_MAX_ALLOWED="120000"
3328         ;;
3329     12.1)
3330         MAC_OS_X_VERSION_MAX_ALLOWED="120100"
3331         ;;
3332     *)
3333         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--12.1])
3334         ;;
3335     esac
3337     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
3338     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
3339         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])
3340     else
3341         AC_MSG_RESULT([ok])
3342     fi
3344     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
3345     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
3346         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
3347     else
3348         AC_MSG_RESULT([ok])
3349     fi
3350     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
3351     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
3353     AC_MSG_CHECKING([whether to do code signing])
3355     if test "$enable_macosx_code_signing" = yes; then
3356         # By default use the first suitable certificate (?).
3358         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
3359         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
3360         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
3361         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
3362         # "Developer ID Application" one.
3364         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
3365         if test -n "$identity"; then
3366             MACOSX_CODESIGNING_IDENTITY=$identity
3367             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3368             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3369         else
3370             AC_MSG_ERROR([cannot determine identity to use])
3371         fi
3372     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
3373         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
3374         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3375         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3376     else
3377         AC_MSG_RESULT([no])
3378     fi
3380     AC_MSG_CHECKING([whether to create a Mac App Store package])
3382     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
3383         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3384     elif test "$enable_macosx_package_signing" = yes; then
3385         # By default use the first suitable certificate.
3386         # It should be a "3rd Party Mac Developer Installer" one
3388         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
3389         if test -n "$identity"; then
3390             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3391             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3392             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3393         else
3394             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3395         fi
3396     elif test -n "$enable_macosx_package_signing"; then
3397         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
3398         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3399         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3400     else
3401         AC_MSG_RESULT([no])
3402     fi
3404     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3405         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3406     fi
3408     AC_MSG_CHECKING([whether to sandbox the application])
3410     if test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3411         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3412     elif test "$enable_macosx_sandbox" = yes; then
3413         ENABLE_MACOSX_SANDBOX=TRUE
3414         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3415         AC_MSG_RESULT([yes])
3416     else
3417         AC_MSG_RESULT([no])
3418     fi
3420     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3421     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3422     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3424 AC_SUBST(MACOSX_SDK_PATH)
3425 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3426 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3427 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3428 AC_SUBST(INSTALL_NAME_TOOL)
3429 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3430 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3431 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3432 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3433 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3435 dnl ===================================================================
3436 dnl Check iOS SDK and compiler
3437 dnl ===================================================================
3439 if test $_os = iOS; then
3440     AC_MSG_CHECKING([what iOS SDK to use])
3441     current_sdk_ver=15.2
3442     older_sdk_vers="15.0 14.5 14.0"
3443     if test "$enable_ios_simulator" = "yes"; then
3444         platform=iPhoneSimulator
3445         versionmin=-mios-simulator-version-min=12.2
3446     else
3447         platform=iPhoneOS
3448         versionmin=-miphoneos-version-min=12.2
3449     fi
3450     xcode_developer=`xcode-select -print-path`
3452     for sdkver in $current_sdk_ver $older_sdk_vers; do
3453         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3454         if test -d $t; then
3455             sysroot=$t
3456             break
3457         fi
3458     done
3460     if test -z "$sysroot"; then
3461         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3462     fi
3464     AC_MSG_RESULT($sysroot)
3466     stdlib="-stdlib=libc++"
3468     AC_MSG_CHECKING([what C compiler to use])
3469     CC="`xcrun -find clang`"
3470     CC_BASE=`first_arg_basename "$CC"`
3471     CC+=" -arch $host_cpu_for_clang -isysroot $sysroot $versionmin"
3472     AC_MSG_RESULT([$CC])
3474     AC_MSG_CHECKING([what C++ compiler to use])
3475     CXX="`xcrun -find clang++`"
3476     CXX_BASE=`first_arg_basename "$CXX"`
3477     CXX+=" -arch $host_cpu_for_clang $stdlib -isysroot $sysroot $versionmin"
3478     AC_MSG_RESULT([$CXX])
3480     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3481     AR=`xcrun -find ar`
3482     NM=`xcrun -find nm`
3483     STRIP=`xcrun -find strip`
3484     LIBTOOL=`xcrun -find libtool`
3485     RANLIB=`xcrun -find ranlib`
3488 AC_MSG_CHECKING([whether to treat the installation as read-only])
3490 if test $_os = Darwin; then
3491     enable_readonly_installset=yes
3492 elif test "$enable_extensions" != yes; then
3493     enable_readonly_installset=yes
3495 if test "$enable_readonly_installset" = yes; then
3496     AC_MSG_RESULT([yes])
3497     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3498 else
3499     AC_MSG_RESULT([no])
3502 dnl ===================================================================
3503 dnl Structure of install set
3504 dnl ===================================================================
3506 if test $_os = Darwin; then
3507     LIBO_BIN_FOLDER=MacOS
3508     LIBO_ETC_FOLDER=Resources
3509     LIBO_LIBEXEC_FOLDER=MacOS
3510     LIBO_LIB_FOLDER=Frameworks
3511     LIBO_LIB_PYUNO_FOLDER=Resources
3512     LIBO_SHARE_FOLDER=Resources
3513     LIBO_SHARE_HELP_FOLDER=Resources/help
3514     LIBO_SHARE_JAVA_FOLDER=Resources/java
3515     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3516     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3517     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3518     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3519     LIBO_URE_BIN_FOLDER=MacOS
3520     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3521     LIBO_URE_LIB_FOLDER=Frameworks
3522     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3523     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3524 elif test $_os = WINNT; then
3525     LIBO_BIN_FOLDER=program
3526     LIBO_ETC_FOLDER=program
3527     LIBO_LIBEXEC_FOLDER=program
3528     LIBO_LIB_FOLDER=program
3529     LIBO_LIB_PYUNO_FOLDER=program
3530     LIBO_SHARE_FOLDER=share
3531     LIBO_SHARE_HELP_FOLDER=help
3532     LIBO_SHARE_JAVA_FOLDER=program/classes
3533     LIBO_SHARE_PRESETS_FOLDER=presets
3534     LIBO_SHARE_READMES_FOLDER=readmes
3535     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3536     LIBO_SHARE_SHELL_FOLDER=program/shell
3537     LIBO_URE_BIN_FOLDER=program
3538     LIBO_URE_ETC_FOLDER=program
3539     LIBO_URE_LIB_FOLDER=program
3540     LIBO_URE_MISC_FOLDER=program
3541     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3542 else
3543     LIBO_BIN_FOLDER=program
3544     LIBO_ETC_FOLDER=program
3545     LIBO_LIBEXEC_FOLDER=program
3546     LIBO_LIB_FOLDER=program
3547     LIBO_LIB_PYUNO_FOLDER=program
3548     LIBO_SHARE_FOLDER=share
3549     LIBO_SHARE_HELP_FOLDER=help
3550     LIBO_SHARE_JAVA_FOLDER=program/classes
3551     LIBO_SHARE_PRESETS_FOLDER=presets
3552     LIBO_SHARE_READMES_FOLDER=readmes
3553     if test "$enable_fuzzers" != yes; then
3554         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3555     else
3556         LIBO_SHARE_RESOURCE_FOLDER=resource
3557     fi
3558     LIBO_SHARE_SHELL_FOLDER=program/shell
3559     LIBO_URE_BIN_FOLDER=program
3560     LIBO_URE_ETC_FOLDER=program
3561     LIBO_URE_LIB_FOLDER=program
3562     LIBO_URE_MISC_FOLDER=program
3563     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3565 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3566 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3567 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3568 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3569 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3570 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3571 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3572 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3573 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3574 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3575 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3576 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3577 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3578 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3579 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3580 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3582 # Not all of them needed in config_host.mk, add more if need arises
3583 AC_SUBST(LIBO_BIN_FOLDER)
3584 AC_SUBST(LIBO_ETC_FOLDER)
3585 AC_SUBST(LIBO_LIB_FOLDER)
3586 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3587 AC_SUBST(LIBO_SHARE_FOLDER)
3588 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3589 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3590 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3591 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3592 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3593 AC_SUBST(LIBO_URE_BIN_FOLDER)
3594 AC_SUBST(LIBO_URE_ETC_FOLDER)
3595 AC_SUBST(LIBO_URE_LIB_FOLDER)
3596 AC_SUBST(LIBO_URE_MISC_FOLDER)
3597 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3599 dnl ===================================================================
3600 dnl Windows specific tests and stuff
3601 dnl ===================================================================
3603 reg_get_value()
3605     # Return value: $regvalue
3606     unset regvalue
3608     if test "$build_os" = "wsl"; then
3609         regvalue=$($BUILDDIR/solenv/wsl/wsl-lo-helper.exe --read-registry $1 "$2" 2>/dev/null)
3610         return
3611     fi
3613     local _regentry="/proc/registry${1}/${2}"
3614     if test -f "$_regentry"; then
3615         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3616         # Registry keys read via /proc/registry* are always \0 terminated!
3617         local _regvalue=$(tr -d '\0' < "$_regentry")
3618         if test $? -eq 0; then
3619             regvalue=$_regvalue
3620         fi
3621     fi
3624 # Get a value from the 32-bit side of the Registry
3625 reg_get_value_32()
3627     reg_get_value "32" "$1"
3630 # Get a value from the 64-bit side of the Registry
3631 reg_get_value_64()
3633     reg_get_value "64" "$1"
3636 case "$host_os" in
3637 cygwin*|wsl*)
3638     COM=MSC
3639     USING_X11=
3640     OS=WNT
3641     RTL_OS=Windows
3642     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3643         P_SEP=";"
3644     else
3645         P_SEP=:
3646     fi
3647     case "$host_cpu" in
3648     x86_64)
3649         CPUNAME=X86_64
3650         RTL_ARCH=X86_64
3651         PLATFORMID=windows_x86_64
3652         WINDOWS_X64=1
3653         SCPDEFS="$SCPDEFS -DWINDOWS_X64"
3654         WIN_HOST_ARCH="x64"
3655         WIN_MULTI_ARCH="x86"
3656         WIN_HOST_BITS=64
3657         ;;
3658     i*86)
3659         CPUNAME=INTEL
3660         RTL_ARCH=x86
3661         PLATFORMID=windows_x86
3662         WIN_HOST_ARCH="x86"
3663         WIN_HOST_BITS=32
3664         WIN_OTHER_ARCH="x64"
3665         ;;
3666     aarch64)
3667         CPUNAME=ARM64
3668         RTL_ARCH=arm64
3669         PLATFORMID=windows_arm64
3670         WINDOWS_X64=1
3671         SCPDEFS="$SCPDEFS -DWINDOWS_ARM64"
3672         WIN_HOST_ARCH="arm64"
3673         WIN_HOST_BITS=64
3674         with_ucrt_dir=no
3675         ;;
3676     *)
3677         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3678         ;;
3679     esac
3681     case "$build_cpu" in
3682     x86_64) WIN_BUILD_ARCH="x64" ;;
3683     i*86) WIN_BUILD_ARCH="x86" ;;
3684     aarch64) WIN_BUILD_ARCH="arm64" ;;
3685     *)
3686         AC_MSG_ERROR([Unsupported build_cpu $build_cpu for host_os $host_os])
3687         ;;
3688     esac
3690     SCPDEFS="$SCPDEFS -D_MSC_VER"
3691     AC_SUBST(WIN_HOST_ARCH)
3692     ;;
3693 esac
3695 # multi-arch is an arch, which can execute on the host (x86 on x64), while
3696 # other-arch won't, but wouldn't break the build (x64 on x86).
3697 if test -n "$WIN_MULTI_ARCH" -a -n "$WIN_OTHER_ARCH"; then
3698     AC_MSG_ERROR([Broken configure.ac file: can't have set \$WIN_MULTI_ARCH and $WIN_OTHER_ARCH])
3702 if test "$_os" = "iOS" -o "$build_cpu" != "$host_cpu"; then
3703     # To allow building Windows multi-arch releases without cross-tooling
3704     if test -z "$WIN_MULTI_ARCH" -a -z "$WIN_OTHER_ARCH"; then
3705         cross_compiling="yes"
3706     fi
3708 if test "$cross_compiling" = "yes"; then
3709     export CROSS_COMPILING=TRUE
3710 else
3711     CROSS_COMPILING=
3712     BUILD_TYPE="$BUILD_TYPE NATIVE"
3714 AC_SUBST(CROSS_COMPILING)
3716 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3717 # NOTE: must _not_ be used for bundled external libraries!
3718 ISYSTEM=
3719 if test "$GCC" = "yes"; then
3720     AC_MSG_CHECKING( for -isystem )
3721     save_CFLAGS=$CFLAGS
3722     CFLAGS="$CFLAGS -Werror"
3723     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3724     CFLAGS=$save_CFLAGS
3725     if test -n "$ISYSTEM"; then
3726         AC_MSG_RESULT(yes)
3727     else
3728         AC_MSG_RESULT(no)
3729     fi
3731 if test -z "$ISYSTEM"; then
3732     # fall back to using -I
3733     ISYSTEM=-I
3735 AC_SUBST(ISYSTEM)
3737 dnl ===================================================================
3738 dnl  Check which Visual Studio compiler is used
3739 dnl ===================================================================
3741 map_vs_year_to_version()
3743     # Return value: $vsversion
3745     unset vsversion
3747     case $1 in
3748     2019)
3749         vsversion=16;;
3750     *)
3751         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3752     esac
3755 vs_versions_to_check()
3757     # Args: $1 (optional) : versions to check, in the order of preference
3758     # Return value: $vsversions
3760     unset vsversions
3762     if test -n "$1"; then
3763         map_vs_year_to_version "$1"
3764         vsversions=$vsversion
3765     else
3766         # We accept only 2019
3767         vsversions="16"
3768     fi
3771 win_get_env_from_vsvars32bat()
3773     local WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3774     # Also seems to be located in another directory under the same name: vsvars32.bat
3775     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3776     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3777     # use 'echo.%ENV%' syntax (instead of 'echo %ENV%') to avoid outputting "ECHO is off." in case when ENV is empty or a space
3778     printf '@setlocal\r\n@echo.%%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3779     local result
3780     if test "$build_os" = "wsl"; then
3781         result=$(cd /mnt/c && cmd.exe /c $(wslpath -w $WRAPPERBATCHFILEPATH) | tr -d '\r')
3782     else
3783         chmod +x $WRAPPERBATCHFILEPATH
3784         result=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3785     fi
3786     rm -f $WRAPPERBATCHFILEPATH
3787     printf '%s' "$result"
3790 find_ucrt()
3792     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3793     if test -n "$regvalue"; then
3794         PathFormat "$regvalue"
3795         UCRTSDKDIR=$formatted_path_unix
3796         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3797         UCRTVERSION=$regvalue
3798         # Rest if not exist
3799         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3800           UCRTSDKDIR=
3801         fi
3802     fi
3803     if test -z "$UCRTSDKDIR"; then
3804         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3805         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3806         if test -f "$ide_env_file"; then
3807             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3808             UCRTSDKDIR=$formatted_path
3809             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3810             dnl Hack needed at least by tml:
3811             if test "$UCRTVERSION" = 10.0.15063.0 \
3812                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3813                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3814             then
3815                 UCRTVERSION=10.0.14393.0
3816             fi
3817         else
3818           AC_MSG_ERROR([No UCRT found])
3819         fi
3820     fi
3823 find_msvc()
3825     # Find Visual C++ 2019
3826     # Args: $1 (optional) : The VS version year
3827     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3829     unset vctest vcnum vcnumwithdot vcbuildnumber
3831     vs_versions_to_check "$1"
3832     if test "$build_os" = wsl; then
3833         vswhere="$PROGRAMFILESX86"
3834     else
3835         vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3836     fi
3837     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3838     PathFormat "$vswhere"
3839     vswhere=$formatted_path_unix
3840     for ver in $vsversions; do
3841         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3842         # Fall back to all MS products (this includes VC++ Build Tools)
3843         if ! test -n "$vswhereoutput"; then
3844             AC_MSG_CHECKING([VC++ Build Tools and similar])
3845             vswhereoutput=`$vswhere -products \* -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3846         fi
3847         if test -n "$vswhereoutput"; then
3848             PathFormat "$vswhereoutput"
3849             vctest=$formatted_path_unix
3850             break
3851         fi
3852     done
3854     if test -n "$vctest"; then
3855         vcnumwithdot="$ver.0"
3856         case "$vcnumwithdot" in
3857         16.0)
3858             vcyear=2019
3859             vcnum=160
3860             ;;
3861         esac
3862         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3864     fi
3867 test_cl_exe()
3869     AC_MSG_CHECKING([$1 compiler])
3871     CL_EXE_PATH="$2/cl.exe"
3873     if test ! -f "$CL_EXE_PATH"; then
3874         if test "$1" = "multi-arch"; then
3875             AC_MSG_WARN([no compiler (cl.exe) in $2])
3876             return 1
3877         else
3878             AC_MSG_ERROR([no compiler (cl.exe) in $2])
3879         fi
3880     fi
3882     dnl ===========================================================
3883     dnl  Check for the corresponding mspdb*.dll
3884     dnl ===========================================================
3886     # MSVC 15.0 has libraries from 14.0?
3887     mspdbnum="140"
3889     if test ! -e "$2/mspdb${mspdbnum}.dll"; then
3890         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $2, Visual Studio installation broken?])
3891     fi
3893     # The compiles has to find its shared libraries
3894     OLD_PATH="$PATH"
3895     TEMP_PATH=`cygpath -d "$2"`
3896     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3898     if ! "$CL_EXE_PATH" -? </dev/null >/dev/null 2>&1; then
3899         AC_MSG_ERROR([no compiler (cl.exe) in $2])
3900     fi
3902     PATH="$OLD_PATH"
3904     AC_MSG_RESULT([$CL_EXE_PATH])
3907 SOLARINC=
3908 MSBUILD_PATH=
3909 DEVENV=
3910 if test "$_os" = "WINNT"; then
3911     AC_MSG_CHECKING([Visual C++])
3912     find_msvc "$with_visual_studio"
3913     if test -z "$vctest"; then
3914         if test -n "$with_visual_studio"; then
3915             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
3916         else
3917             AC_MSG_ERROR([no Visual Studio 2019 installation found])
3918         fi
3919     fi
3920     AC_MSG_RESULT([])
3922     VC_PRODUCT_DIR="$vctest/VC"
3923     COMPATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber"
3925     # $WIN_OTHER_ARCH is a hack to test the x64 compiler on x86, even if it's not multi-arch
3926     if test -n "$WIN_MULTI_ARCH" -o -n "$WIN_OTHER_ARCH"; then
3927         MSVC_MULTI_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/${WIN_MULTI_ARCH}${WIN_OTHER_ARCH}"
3928         test_cl_exe "multi-arch" "$MSVC_MULTI_PATH"
3929         if test $? -ne 0; then
3930             WIN_MULTI_ARCH=""
3931             WIN_OTHER_ARCH=""
3932         fi
3933     fi
3935     if test "$WIN_BUILD_ARCH" = "$WIN_HOST_ARCH"; then
3936         MSVC_BUILD_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_BUILD_ARCH"
3937         test_cl_exe "build" "$MSVC_BUILD_PATH"
3938     fi
3940     if test "$WIN_BUILD_ARCH" != "$WIN_HOST_ARCH"; then
3941         MSVC_HOST_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_HOST_ARCH"
3942         test_cl_exe "host" "$MSVC_HOST_PATH"
3943     else
3944         MSVC_HOST_PATH="$MSVC_BUILD_PATH"
3945     fi
3947     AC_MSG_CHECKING([for short pathname of VC product directory])
3948     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3949     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3951     UCRTSDKDIR=
3952     UCRTVERSION=
3954     AC_MSG_CHECKING([for UCRT location])
3955     find_ucrt
3956     # find_ucrt errors out if it doesn't find it
3957     AC_MSG_RESULT([$UCRTSDKDIR ($UCRTVERSION)])
3958     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3959     ucrtincpath_formatted=$formatted_path
3960     # SOLARINC is used for external modules and must be set too.
3961     # And no, it's not sufficient to set SOLARINC only, as configure
3962     # itself doesn't honour it.
3963     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3964     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3965     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3966     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3968     AC_SUBST(UCRTSDKDIR)
3969     AC_SUBST(UCRTVERSION)
3971     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3972     # Find the proper version of MSBuild.exe to use based on the VS version
3973     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3974     if test -n "$regvalue" ; then
3975         AC_MSG_RESULT([found: $regvalue])
3976         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3977     else
3978         if test "$vcnumwithdot" = "16.0"; then
3979             if test "$WIN_BUILD_ARCH" != "x64"; then
3980                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3981             else
3982                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3983             fi
3984         else
3985             if test "$WIN_BUILD_ARCH" != "x64"; then
3986                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3987             else
3988                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3989             fi
3990         fi
3991         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3992         AC_MSG_RESULT([$regvalue])
3993     fi
3995     # Find the version of devenv.exe
3996     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3997     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3998     DEVENV_unix=$(cygpath -u "$DEVENV")
3999     if test ! -e "$DEVENV_unix"; then
4000         AC_MSG_WARN([No devenv.exe found - this is expected for VC++ Build Tools])
4001     fi
4003     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
4004     dnl needed when building CLR code:
4005     if test -z "$MSVC_CXX"; then
4006         # This gives us a posix path with 8.3 filename restrictions
4007         MSVC_CXX=`win_short_path_for_make "$MSVC_HOST_PATH/cl.exe"`
4008     fi
4010     if test -z "$CC"; then
4011         CC=$MSVC_CXX
4012         CC_BASE=`first_arg_basename "$CC"`
4013     fi
4014     if test -z "$CXX"; then
4015         CXX=$MSVC_CXX
4016         CXX_BASE=`first_arg_basename "$CXX"`
4017     fi
4019     if test -n "$CC"; then
4020         # Remove /cl.exe from CC case insensitive
4021         AC_MSG_NOTICE([found Visual C++ $vcyear])
4023         main_include_dir=`cygpath -d -m "$COMPATH/Include"`
4024         CPPFLAGS="$CPPFLAGS -I$main_include_dir"
4026         PathFormat "$COMPATH"
4027         COMPATH=`win_short_path_for_make "$formatted_path"`
4029         VCVER=$vcnum
4031         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
4032         # are always "better", we list them in reverse chronological order.
4034         case "$vcnum" in
4035         160)
4036             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
4037             ;;
4038         esac
4040         # The expectation is that --with-windows-sdk should not need to be used
4041         if test -n "$with_windows_sdk"; then
4042             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
4043             *" "$with_windows_sdk" "*)
4044                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
4045                 ;;
4046             *)
4047                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $vcyear])
4048                 ;;
4049             esac
4050         fi
4052         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
4053         ac_objext=obj
4054         ac_exeext=exe
4056     else
4057         AC_MSG_ERROR([Visual C++ not found after all, huh])
4058     fi
4060     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.4])
4061     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4062         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
4063         // between Visual Studio versions and _MSC_VER:
4064         #if _MSC_VER < 1924
4065         #error
4066         #endif
4067     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
4069     # Check for 64-bit (cross-)compiler to use to build the 64-bit
4070     # version of the Explorer extension (and maybe other small
4071     # bits, too) needed when installing a 32-bit LibreOffice on a
4072     # 64-bit OS. The 64-bit Explorer extension is a feature that
4073     # has been present since long in OOo. Don't confuse it with
4074     # building LibreOffice itself as 64-bit code.
4076     BUILD_X64=
4077     CXX_X64_BINARY=
4079     if test "$WIN_HOST_ARCH" = "x86" -a -n "$WIN_OTHER_ARCH"; then
4080         AC_MSG_CHECKING([for the libraries to build the 64-bit Explorer extensions])
4081         if test -f "$COMPATH/atlmfc/lib/x64/atls.lib" -o \
4082              -f "$COMPATH/atlmfc/lib/spectre/x64/atls.lib"
4083         then
4084             BUILD_X64=TRUE
4085             CXX_X64_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4086             AC_MSG_RESULT([found])
4087         else
4088             AC_MSG_RESULT([not found])
4089             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
4090         fi
4091     elif test "$WIN_HOST_ARCH" = "x64"; then
4092         CXX_X64_BINARY=$CXX
4093     fi
4094     AC_SUBST(BUILD_X64)
4096     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
4097     AC_SUBST(CXX_X64_BINARY)
4099     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
4100     # needed to support TWAIN scan on both 32- and 64-bit systems
4102     case "$WIN_HOST_ARCH" in
4103     x64)
4104         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
4105         if test -n "$CXX_X86_BINARY"; then
4106             BUILD_X86=TRUE
4107             AC_MSG_RESULT([preset])
4108         elif test -n "$WIN_MULTI_ARCH"; then
4109             BUILD_X86=TRUE
4110             CXX_X86_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4111             CXX_X86_BINARY+=" /arch:SSE"
4112             AC_MSG_RESULT([found])
4113         else
4114             AC_MSG_RESULT([not found])
4115             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
4116         fi
4117         ;;
4118     x86)
4119         BUILD_X86=TRUE
4120         CXX_X86_BINARY=$MSVC_CXX
4121         ;;
4122     esac
4123     AC_SUBST(BUILD_X86)
4124     AC_SUBST(CXX_X86_BINARY)
4126 AC_SUBST(VCVER)
4127 AC_SUBST(DEVENV)
4128 AC_SUBST(MSVC_CXX)
4131 # unowinreg.dll
4133 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
4134 AC_SUBST(UNOWINREG_DLL)
4136 COM_IS_CLANG=
4137 AC_MSG_CHECKING([whether the compiler is actually Clang])
4138 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4139     #ifndef __clang__
4140     you lose
4141     #endif
4142     int foo=42;
4143     ]])],
4144     [AC_MSG_RESULT([yes])
4145      COM_IS_CLANG=TRUE],
4146     [AC_MSG_RESULT([no])])
4147 AC_SUBST(COM_IS_CLANG)
4149 CC_PLAIN=$CC
4150 CLANGVER=
4151 if test "$COM_IS_CLANG" = TRUE; then
4152     AC_MSG_CHECKING([whether Clang is new enough])
4153     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4154         #if !defined __apple_build_version__
4155         #error
4156         #endif
4157         ]])],
4158         [my_apple_clang=yes],[my_apple_clang=])
4159     if test "$my_apple_clang" = yes; then
4160         AC_MSG_RESULT([assumed yes (Apple Clang)])
4161     else
4162         if test "$_os" = WINNT; then
4163             dnl In which case, assume clang-cl:
4164             my_args="/EP /TC"
4165             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
4166             dnl clang-cl:
4167             CC_PLAIN=
4168             for i in $CC; do
4169                 case $i in
4170                 -FIIntrin.h)
4171                     ;;
4172                 *)
4173                     CC_PLAIN="$CC_PLAIN $i"
4174                     ;;
4175                 esac
4176             done
4177         else
4178             my_args="-E -P"
4179         fi
4180         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
4181         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
4182         CLANGVER=`echo $clang_version \
4183             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
4184         if test "$CLANGVER" -ge 50002; then
4185             AC_MSG_RESULT([yes ($clang_version)])
4186         else
4187             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
4188         fi
4189         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
4190         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
4191     fi
4194 SHOWINCLUDES_PREFIX=
4195 if test "$_os" = WINNT; then
4196     dnl We need to guess the prefix of the -showIncludes output, it can be
4197     dnl localized
4198     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
4199     echo "#include <stdlib.h>" > conftest.c
4200     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
4201         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
4202     rm -f conftest.c conftest.obj
4203     if test -z "$SHOWINCLUDES_PREFIX"; then
4204         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
4205     else
4206         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
4207     fi
4209 AC_SUBST(SHOWINCLUDES_PREFIX)
4212 # prefix C with ccache if needed
4214 if test "$CCACHE" != ""; then
4215     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
4217     AC_LANG_PUSH([C])
4218     save_CFLAGS=$CFLAGS
4219     CFLAGS="$CFLAGS --ccache-skip -O2"
4220     dnl an empty program will do, we're checking the compiler flags
4221     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
4222                       [use_ccache=yes], [use_ccache=no])
4223     CFLAGS=$save_CFLAGS
4224     if test $use_ccache = yes; then
4225         AC_MSG_RESULT([yes])
4226     else
4227         CC="$CCACHE $CC"
4228         CC_BASE="ccache $CC_BASE"
4229         AC_MSG_RESULT([no])
4230     fi
4231     AC_LANG_POP([C])
4234 # ===================================================================
4235 # check various GCC options that Clang does not support now but maybe
4236 # will somewhen in the future, check them even for GCC, so that the
4237 # flags are set
4238 # ===================================================================
4240 HAVE_GCC_GGDB2=
4241 if test "$GCC" = "yes"; then
4242     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
4243     save_CFLAGS=$CFLAGS
4244     CFLAGS="$CFLAGS -Werror -ggdb2"
4245     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
4246     CFLAGS=$save_CFLAGS
4247     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
4248         AC_MSG_RESULT([yes])
4249     else
4250         AC_MSG_RESULT([no])
4251     fi
4253     if test "$host_cpu" = "m68k"; then
4254         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
4255         save_CFLAGS=$CFLAGS
4256         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
4257         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
4258         CFLAGS=$save_CFLAGS
4259         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
4260             AC_MSG_RESULT([yes])
4261         else
4262             AC_MSG_ERROR([no])
4263         fi
4264     fi
4266 AC_SUBST(HAVE_GCC_GGDB2)
4268 dnl ===================================================================
4269 dnl  Test the gcc version
4270 dnl ===================================================================
4271 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
4272     AC_MSG_CHECKING([the GCC version])
4273     _gcc_version=`$CC -dumpversion`
4274     gcc_full_version=$(printf '%s' "$_gcc_version" | \
4275         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
4276     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
4278     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
4280     if test "$gcc_full_version" -lt 70000; then
4281         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
4282     fi
4283 else
4284     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
4285     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
4286     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
4287     # (which reports itself as GCC 4.2.1).
4288     GCC_VERSION=
4290 AC_SUBST(GCC_VERSION)
4292 dnl Set the ENABLE_DBGUTIL variable
4293 dnl ===================================================================
4294 AC_MSG_CHECKING([whether to build with additional debug utilities])
4295 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
4296     ENABLE_DBGUTIL="TRUE"
4297     # this is an extra var so it can have different default on different MSVC
4298     # versions (in case there are version specific problems with it)
4299     MSVC_USE_DEBUG_RUNTIME="TRUE"
4301     AC_MSG_RESULT([yes])
4302     # cppunit and graphite expose STL in public headers
4303     if test "$with_system_cppunit" = "yes"; then
4304         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
4305     else
4306         with_system_cppunit=no
4307     fi
4308     if test "$with_system_graphite" = "yes"; then
4309         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
4310     else
4311         with_system_graphite=no
4312     fi
4313     if test "$with_system_orcus" = "yes"; then
4314         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
4315     else
4316         with_system_orcus=no
4317     fi
4318     if test "$with_system_libcmis" = "yes"; then
4319         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
4320     else
4321         with_system_libcmis=no
4322     fi
4323     if test "$with_system_hunspell" = "yes"; then
4324         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
4325     else
4326         with_system_hunspell=no
4327     fi
4328     if test "$with_system_gpgmepp" = "yes"; then
4329         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
4330     else
4331         with_system_gpgmepp=no
4332     fi
4333     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
4334     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
4335     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
4336     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
4337     # of those two is using the system variant:
4338     if test "$with_system_libnumbertext" = "yes"; then
4339         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
4340     else
4341         with_system_libnumbertext=no
4342     fi
4343     if test "$with_system_libwps" = "yes"; then
4344         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
4345     else
4346         with_system_libwps=no
4347     fi
4348 else
4349     ENABLE_DBGUTIL=""
4350     MSVC_USE_DEBUG_RUNTIME=""
4351     AC_MSG_RESULT([no])
4353 AC_SUBST(ENABLE_DBGUTIL)
4354 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
4356 dnl Set the ENABLE_DEBUG variable.
4357 dnl ===================================================================
4358 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
4359     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
4361 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
4362     if test -z "$libo_fuzzed_enable_debug"; then
4363         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
4364     else
4365         AC_MSG_NOTICE([Resetting --enable-debug=yes])
4366         enable_debug=yes
4367     fi
4370 AC_MSG_CHECKING([whether to do a debug build])
4371 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
4372     ENABLE_DEBUG="TRUE"
4373     if test -n "$ENABLE_DBGUTIL" ; then
4374         AC_MSG_RESULT([yes (dbgutil)])
4375     else
4376         AC_MSG_RESULT([yes])
4377     fi
4378 else
4379     ENABLE_DEBUG=""
4380     AC_MSG_RESULT([no])
4382 AC_SUBST(ENABLE_DEBUG)
4384 dnl ===================================================================
4385 dnl Select the linker to use (gold/lld/ld.bfd).
4386 dnl This is done only after compiler checks (need to know if Clang is
4387 dnl used, for different defaults) and after checking if a debug build
4388 dnl is wanted (non-debug builds get the default linker if not explicitly
4389 dnl specified otherwise).
4390 dnl All checks for linker features/options should come after this.
4391 dnl ===================================================================
4392 check_use_ld()
4394     use_ld=-fuse-ld=${1%%:*}
4395     use_ld_path=${1#*:}
4396     if test "$use_ld_path" != "$1"; then
4397         use_ld="$use_ld --ld-path=$use_ld_path"
4398     fi
4399     use_ld_fail_if_error=$2
4400     use_ld_ok=
4401     AC_MSG_CHECKING([for $use_ld linker support])
4402     use_ld_ldflags_save="$LDFLAGS"
4403     LDFLAGS="$LDFLAGS $use_ld"
4404     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4405 #include <stdio.h>
4406         ],[
4407 printf ("hello world\n");
4408         ])], USE_LD=$use_ld, [])
4409     if test -n "$USE_LD"; then
4410         AC_MSG_RESULT( yes )
4411         use_ld_ok=yes
4412     else
4413         if test -n "$use_ld_fail_if_error"; then
4414             AC_MSG_ERROR( no )
4415         else
4416             AC_MSG_RESULT( no )
4417         fi
4418     fi
4419     if test -n "$use_ld_ok"; then
4420         dnl keep the value of LDFLAGS
4421         return 0
4422     fi
4423     LDFLAGS="$use_ld_ldflags_save"
4424     return 1
4426 USE_LD=
4427 if test "$enable_ld" != "no"; then
4428     if test "$GCC" = "yes"; then
4429         if test -n "$enable_ld"; then
4430             check_use_ld "$enable_ld" fail_if_error
4431         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4432             dnl non-debug builds default to the default linker
4433             true
4434         elif test -n "$COM_IS_CLANG"; then
4435             check_use_ld lld
4436             if test $? -ne 0; then
4437                 check_use_ld gold
4438             fi
4439         else
4440             # For gcc first try gold, new versions also support lld.
4441             check_use_ld gold
4442             if test $? -ne 0; then
4443                 check_use_ld lld
4444             fi
4445         fi
4446         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4447         rm conftest.out
4448         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4449         if test -z "$ld_used"; then
4450             ld_used="unknown"
4451         fi
4452         AC_MSG_CHECKING([for linker that is used])
4453         AC_MSG_RESULT([$ld_used])
4454         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4455             if echo "$ld_used" | grep -q "^GNU ld"; then
4456                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4457                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4458             fi
4459         fi
4460     else
4461         if test "$enable_ld" = "yes"; then
4462             AC_MSG_ERROR([--enable-ld not supported])
4463         fi
4464     fi
4466 AC_SUBST(USE_LD)
4468 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4469 if test "$GCC" = "yes"; then
4470     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4471     bsymbolic_functions_ldflags_save=$LDFLAGS
4472     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4473     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4474 #include <stdio.h>
4475         ],[
4476 printf ("hello world\n");
4477         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4478     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4479         AC_MSG_RESULT( found )
4480     else
4481         AC_MSG_RESULT( not found )
4482     fi
4483     LDFLAGS=$bsymbolic_functions_ldflags_save
4485 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4487 LD_GC_SECTIONS=
4488 if test "$GCC" = "yes"; then
4489     for flag in "--gc-sections" "-dead_strip"; do
4490         AC_MSG_CHECKING([for $flag linker support])
4491         ldflags_save=$LDFLAGS
4492         LDFLAGS="$LDFLAGS -Wl,$flag"
4493         AC_LINK_IFELSE([AC_LANG_PROGRAM([
4494 #include <stdio.h>
4495             ],[
4496 printf ("hello world\n");
4497             ])],[
4498             LD_GC_SECTIONS="-Wl,$flag"
4499             AC_MSG_RESULT( found )
4500             ], [
4501             AC_MSG_RESULT( not found )
4502             ])
4503         LDFLAGS=$ldflags_save
4504         if test -n "$LD_GC_SECTIONS"; then
4505             break
4506         fi
4507     done
4509 AC_SUBST(LD_GC_SECTIONS)
4511 HAVE_GSPLIT_DWARF=
4512 if test "$enable_split_debug" != no; then
4513     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4514     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4515         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4516         save_CFLAGS=$CFLAGS
4517         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4518         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4519         CFLAGS=$save_CFLAGS
4520         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4521             AC_MSG_RESULT([yes])
4522         else
4523             if test "$enable_split_debug" = yes; then
4524                 AC_MSG_ERROR([no])
4525             else
4526                 AC_MSG_RESULT([no])
4527             fi
4528         fi
4529     fi
4530     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4531         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4532         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4533     fi
4535 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4537 HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=
4538 AC_MSG_CHECKING([whether $CC_BASE supports -Xclang -debug-info-kind=constructor])
4539 save_CFLAGS=$CFLAGS
4540 CFLAGS="$CFLAGS -Werror -Xclang -debug-info-kind=constructor"
4541 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=TRUE ],[])
4542 CFLAGS=$save_CFLAGS
4543 if test "$HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR" = "TRUE"; then
4544     AC_MSG_RESULT([yes])
4545 else
4546     AC_MSG_RESULT([no])
4548 AC_SUBST(HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR)
4550 ENABLE_GDB_INDEX=
4551 if test "$enable_gdb_index" != "no"; then
4552     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4553     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4554         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4555         save_CFLAGS=$CFLAGS
4556         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4557         have_ggnu_pubnames=
4558         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4559         if test "$have_ggnu_pubnames" != "TRUE"; then
4560             if test "$enable_gdb_index" = "yes"; then
4561                 AC_MSG_ERROR([no, --enable-gdb-index not supported])
4562             else
4563                 AC_MSG_RESULT( no )
4564             fi
4565         else
4566             AC_MSG_RESULT( yes )
4567             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4568             ldflags_save=$LDFLAGS
4569             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4570             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4571 #include <stdio.h>
4572                 ],[
4573 printf ("hello world\n");
4574                 ])], ENABLE_GDB_INDEX=TRUE, [])
4575             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4576                 AC_MSG_RESULT( yes )
4577             else
4578                 if test "$enable_gdb_index" = "yes"; then
4579                     AC_MSG_ERROR( no )
4580                 else
4581                     AC_MSG_RESULT( no )
4582                 fi
4583             fi
4584             LDFLAGS=$ldflags_save
4585         fi
4586         CFLAGS=$save_CFLAGS
4587         fi
4588     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4589         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4590         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4591     fi
4593 AC_SUBST(ENABLE_GDB_INDEX)
4595 if test -z "$enable_sal_log" && test "$ENABLE_DEBUG" = TRUE; then
4596     enable_sal_log=yes
4598 if test "$enable_sal_log" = yes; then
4599     ENABLE_SAL_LOG=TRUE
4601 AC_SUBST(ENABLE_SAL_LOG)
4603 dnl Check for enable symbols option
4604 dnl ===================================================================
4605 AC_MSG_CHECKING([whether to generate debug information])
4606 if test -z "$enable_symbols"; then
4607     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4608         enable_symbols=yes
4609     else
4610         enable_symbols=no
4611     fi
4613 if test "$enable_symbols" = yes; then
4614     ENABLE_SYMBOLS_FOR=all
4615     AC_MSG_RESULT([yes])
4616 elif test "$enable_symbols" = no; then
4617     ENABLE_SYMBOLS_FOR=
4618     AC_MSG_RESULT([no])
4619 else
4620     # Selective debuginfo.
4621     ENABLE_SYMBOLS_FOR="$enable_symbols"
4622     AC_MSG_RESULT([for "$enable_symbols"])
4624 AC_SUBST(ENABLE_SYMBOLS_FOR)
4625 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4626     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4627     AC_MSG_CHECKING([whether enough memory is available for linking])
4628     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4629     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4630     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4631         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4632     else
4633         AC_MSG_RESULT([yes])
4634     fi
4637 ENABLE_OPTIMIZED=
4638 ENABLE_OPTIMIZED_DEBUG=
4639 AC_MSG_CHECKING([whether to compile with optimization flags])
4640 if test -z "$enable_optimized"; then
4641     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4642         enable_optimized=no
4643     else
4644         enable_optimized=yes
4645     fi
4647 if test "$enable_optimized" = yes; then
4648     ENABLE_OPTIMIZED=TRUE
4649     AC_MSG_RESULT([yes])
4650 elif test "$enable_optimized" = debug; then
4651     ENABLE_OPTIMIZED_DEBUG=TRUE
4652     AC_MSG_RESULT([yes (debug)])
4653     HAVE_GCC_OG=
4654     if test "$GCC" = "yes"; then
4655         AC_MSG_CHECKING([whether $CC_BASE supports -Og])
4656         save_CFLAGS=$CFLAGS
4657         CFLAGS="$CFLAGS -Werror -Og"
4658         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[])
4659         CFLAGS=$save_CFLAGS
4660         if test "$HAVE_GCC_OG" = "TRUE"; then
4661             AC_MSG_RESULT([yes])
4662         else
4663             AC_MSG_RESULT([no])
4664         fi
4665     fi
4666     if test -z "$HAVE_GCC_OG"; then
4667         AC_MSG_ERROR([The compiler does not support optimizations suitable for debugging.])
4668     fi
4669 else
4670     AC_MSG_RESULT([no])
4672 AC_SUBST(ENABLE_OPTIMIZED)
4673 AC_SUBST(ENABLE_OPTIMIZED_DEBUG)
4676 # determine CPUNAME, OS, ...
4677 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4679 case "$host_os" in
4681 aix*)
4682     COM=GCC
4683     CPUNAME=POWERPC
4684     USING_X11=TRUE
4685     OS=AIX
4686     RTL_OS=AIX
4687     RTL_ARCH=PowerPC
4688     PLATFORMID=aix_powerpc
4689     P_SEP=:
4690     ;;
4692 cygwin*|wsl*)
4693     # Already handled
4694     ;;
4696 darwin*|macos*)
4697     COM=GCC
4698     USING_X11=
4699     OS=MACOSX
4700     RTL_OS=MacOSX
4701     P_SEP=:
4703     case "$host_cpu" in
4704     aarch64|arm64)
4705         if test "$enable_ios_simulator" = "yes"; then
4706             OS=iOS
4707         else
4708             CPUNAME=AARCH64
4709             RTL_ARCH=AARCH64
4710             PLATFORMID=macosx_arm64
4711         fi
4712         ;;
4713     x86_64)
4714         if test "$enable_ios_simulator" = "yes"; then
4715             OS=iOS
4716         fi
4717         CPUNAME=X86_64
4718         RTL_ARCH=X86_64
4719         PLATFORMID=macosx_x86_64
4720         ;;
4721     *)
4722         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4723         ;;
4724     esac
4725     ;;
4727 ios*)
4728     COM=GCC
4729     USING_X11=
4730     OS=iOS
4731     RTL_OS=iOS
4732     P_SEP=:
4734     case "$host_cpu" in
4735     aarch64|arm64)
4736         if test "$enable_ios_simulator" = "yes"; then
4737             AC_MSG_ERROR([iOS simulator is only available in macOS not iOS])
4738         fi
4739         ;;
4740     *)
4741         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4742         ;;
4743     esac
4744     CPUNAME=AARCH64
4745     RTL_ARCH=AARCH64
4746     PLATFORMID=ios_arm64
4747     ;;
4749 dragonfly*)
4750     COM=GCC
4751     USING_X11=TRUE
4752     OS=DRAGONFLY
4753     RTL_OS=DragonFly
4754     P_SEP=:
4756     case "$host_cpu" in
4757     i*86)
4758         CPUNAME=INTEL
4759         RTL_ARCH=x86
4760         PLATFORMID=dragonfly_x86
4761         ;;
4762     x86_64)
4763         CPUNAME=X86_64
4764         RTL_ARCH=X86_64
4765         PLATFORMID=dragonfly_x86_64
4766         ;;
4767     *)
4768         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4769         ;;
4770     esac
4771     ;;
4773 freebsd*)
4774     COM=GCC
4775     USING_X11=TRUE
4776     RTL_OS=FreeBSD
4777     OS=FREEBSD
4778     P_SEP=:
4780     case "$host_cpu" in
4781     aarch64)
4782         CPUNAME=AARCH64
4783         PLATFORMID=freebsd_aarch64
4784         RTL_ARCH=AARCH64
4785         ;;
4786     i*86)
4787         CPUNAME=INTEL
4788         RTL_ARCH=x86
4789         PLATFORMID=freebsd_x86
4790         ;;
4791     x86_64|amd64)
4792         CPUNAME=X86_64
4793         RTL_ARCH=X86_64
4794         PLATFORMID=freebsd_x86_64
4795         ;;
4796     powerpc64)
4797         CPUNAME=POWERPC64
4798         RTL_ARCH=PowerPC_64
4799         PLATFORMID=freebsd_powerpc64
4800         ;;
4801     powerpc|powerpcspe)
4802         CPUNAME=POWERPC
4803         RTL_ARCH=PowerPC
4804         PLATFORMID=freebsd_powerpc
4805         ;;
4806     *)
4807         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4808         ;;
4809     esac
4810     ;;
4812 haiku*)
4813     COM=GCC
4814     USING_X11=
4815     GUIBASE=haiku
4816     RTL_OS=Haiku
4817     OS=HAIKU
4818     P_SEP=:
4820     case "$host_cpu" in
4821     i*86)
4822         CPUNAME=INTEL
4823         RTL_ARCH=x86
4824         PLATFORMID=haiku_x86
4825         ;;
4826     x86_64|amd64)
4827         CPUNAME=X86_64
4828         RTL_ARCH=X86_64
4829         PLATFORMID=haiku_x86_64
4830         ;;
4831     *)
4832         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4833         ;;
4834     esac
4835     ;;
4837 kfreebsd*)
4838     COM=GCC
4839     USING_X11=TRUE
4840     OS=LINUX
4841     RTL_OS=kFreeBSD
4842     P_SEP=:
4844     case "$host_cpu" in
4846     i*86)
4847         CPUNAME=INTEL
4848         RTL_ARCH=x86
4849         PLATFORMID=kfreebsd_x86
4850         ;;
4851     x86_64)
4852         CPUNAME=X86_64
4853         RTL_ARCH=X86_64
4854         PLATFORMID=kfreebsd_x86_64
4855         ;;
4856     *)
4857         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4858         ;;
4859     esac
4860     ;;
4862 linux-gnu*)
4863     COM=GCC
4864     USING_X11=TRUE
4865     OS=LINUX
4866     RTL_OS=Linux
4867     P_SEP=:
4869     case "$host_cpu" in
4871     aarch64)
4872         CPUNAME=AARCH64
4873         PLATFORMID=linux_aarch64
4874         RTL_ARCH=AARCH64
4875         EPM_FLAGS="-a arm64"
4876         ;;
4877     alpha)
4878         CPUNAME=AXP
4879         RTL_ARCH=ALPHA
4880         PLATFORMID=linux_alpha
4881         ;;
4882     arm*)
4883         CPUNAME=ARM
4884         EPM_FLAGS="-a arm"
4885         RTL_ARCH=ARM_EABI
4886         PLATFORMID=linux_arm_eabi
4887         case "$host_cpu" in
4888         arm*-linux)
4889             RTL_ARCH=ARM_OABI
4890             PLATFORMID=linux_arm_oabi
4891             ;;
4892         esac
4893         ;;
4894     hppa)
4895         CPUNAME=HPPA
4896         RTL_ARCH=HPPA
4897         EPM_FLAGS="-a hppa"
4898         PLATFORMID=linux_hppa
4899         ;;
4900     i*86)
4901         CPUNAME=INTEL
4902         RTL_ARCH=x86
4903         PLATFORMID=linux_x86
4904         ;;
4905     ia64)
4906         CPUNAME=IA64
4907         RTL_ARCH=IA64
4908         PLATFORMID=linux_ia64
4909         ;;
4910     mips)
4911         CPUNAME=GODSON
4912         RTL_ARCH=MIPS_EB
4913         EPM_FLAGS="-a mips"
4914         PLATFORMID=linux_mips_eb
4915         ;;
4916     mips64)
4917         CPUNAME=GODSON64
4918         RTL_ARCH=MIPS64_EB
4919         EPM_FLAGS="-a mips64"
4920         PLATFORMID=linux_mips64_eb
4921         ;;
4922     mips64el)
4923         CPUNAME=GODSON64
4924         RTL_ARCH=MIPS64_EL
4925         EPM_FLAGS="-a mips64el"
4926         PLATFORMID=linux_mips64_el
4927         ;;
4928     mipsel)
4929         CPUNAME=GODSON
4930         RTL_ARCH=MIPS_EL
4931         EPM_FLAGS="-a mipsel"
4932         PLATFORMID=linux_mips_el
4933         ;;
4934     m68k)
4935         CPUNAME=M68K
4936         RTL_ARCH=M68K
4937         PLATFORMID=linux_m68k
4938         ;;
4939     powerpc)
4940         CPUNAME=POWERPC
4941         RTL_ARCH=PowerPC
4942         PLATFORMID=linux_powerpc
4943         ;;
4944     powerpc64)
4945         CPUNAME=POWERPC64
4946         RTL_ARCH=PowerPC_64
4947         PLATFORMID=linux_powerpc64
4948         ;;
4949     powerpc64le)
4950         CPUNAME=POWERPC64
4951         RTL_ARCH=PowerPC_64_LE
4952         PLATFORMID=linux_powerpc64_le
4953         ;;
4954     sparc)
4955         CPUNAME=SPARC
4956         RTL_ARCH=SPARC
4957         PLATFORMID=linux_sparc
4958         ;;
4959     sparc64)
4960         CPUNAME=SPARC64
4961         RTL_ARCH=SPARC64
4962         PLATFORMID=linux_sparc64
4963         ;;
4964     s390)
4965         CPUNAME=S390
4966         RTL_ARCH=S390
4967         PLATFORMID=linux_s390
4968         ;;
4969     s390x)
4970         CPUNAME=S390X
4971         RTL_ARCH=S390x
4972         PLATFORMID=linux_s390x
4973         ;;
4974     x86_64)
4975         CPUNAME=X86_64
4976         RTL_ARCH=X86_64
4977         PLATFORMID=linux_x86_64
4978         ;;
4979     *)
4980         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4981         ;;
4982     esac
4983     ;;
4985 linux-android*)
4986     COM=GCC
4987     USING_X11=
4988     OS=ANDROID
4989     RTL_OS=Android
4990     P_SEP=:
4992     case "$host_cpu" in
4994     arm|armel)
4995         CPUNAME=ARM
4996         RTL_ARCH=ARM_EABI
4997         PLATFORMID=android_arm_eabi
4998         ;;
4999     aarch64)
5000         CPUNAME=AARCH64
5001         RTL_ARCH=AARCH64
5002         PLATFORMID=android_aarch64
5003         ;;
5004     i*86)
5005         CPUNAME=INTEL
5006         RTL_ARCH=x86
5007         PLATFORMID=android_x86
5008         ;;
5009     x86_64)
5010         CPUNAME=X86_64
5011         RTL_ARCH=X86_64
5012         PLATFORMID=android_x86_64
5013         ;;
5014     *)
5015         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5016         ;;
5017     esac
5018     ;;
5020 *netbsd*)
5021     COM=GCC
5022     USING_X11=TRUE
5023     OS=NETBSD
5024     RTL_OS=NetBSD
5025     P_SEP=:
5027     case "$host_cpu" in
5028     i*86)
5029         CPUNAME=INTEL
5030         RTL_ARCH=x86
5031         PLATFORMID=netbsd_x86
5032         ;;
5033     powerpc)
5034         CPUNAME=POWERPC
5035         RTL_ARCH=PowerPC
5036         PLATFORMID=netbsd_powerpc
5037         ;;
5038     sparc)
5039         CPUNAME=SPARC
5040         RTL_ARCH=SPARC
5041         PLATFORMID=netbsd_sparc
5042         ;;
5043     x86_64)
5044         CPUNAME=X86_64
5045         RTL_ARCH=X86_64
5046         PLATFORMID=netbsd_x86_64
5047         ;;
5048     *)
5049         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5050         ;;
5051     esac
5052     ;;
5054 openbsd*)
5055     COM=GCC
5056     USING_X11=TRUE
5057     OS=OPENBSD
5058     RTL_OS=OpenBSD
5059     P_SEP=:
5061     case "$host_cpu" in
5062     i*86)
5063         CPUNAME=INTEL
5064         RTL_ARCH=x86
5065         PLATFORMID=openbsd_x86
5066         ;;
5067     x86_64)
5068         CPUNAME=X86_64
5069         RTL_ARCH=X86_64
5070         PLATFORMID=openbsd_x86_64
5071         ;;
5072     *)
5073         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5074         ;;
5075     esac
5076     SOLARINC="$SOLARINC -I/usr/local/include"
5077     ;;
5079 solaris*)
5080     COM=GCC
5081     USING_X11=TRUE
5082     OS=SOLARIS
5083     RTL_OS=Solaris
5084     P_SEP=:
5086     case "$host_cpu" in
5087     i*86)
5088         CPUNAME=INTEL
5089         RTL_ARCH=x86
5090         PLATFORMID=solaris_x86
5091         ;;
5092     sparc)
5093         CPUNAME=SPARC
5094         RTL_ARCH=SPARC
5095         PLATFORMID=solaris_sparc
5096         ;;
5097     sparc64)
5098         CPUNAME=SPARC64
5099         RTL_ARCH=SPARC64
5100         PLATFORMID=solaris_sparc64
5101         ;;
5102     *)
5103         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5104         ;;
5105     esac
5106     SOLARINC="$SOLARINC -I/usr/local/include"
5107     ;;
5110     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
5111     ;;
5112 esac
5114 if test "$with_x" = "no"; then
5115     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
5118 DISABLE_GUI=""
5119 if test "$enable_gui" = "no"; then
5120     if test "$USING_X11" != TRUE; then
5121         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
5122     fi
5123     USING_X11=
5124     DISABLE_GUI=TRUE
5125     AC_DEFINE(HAVE_FEATURE_UI,0)
5126     test_cairo=yes
5128 AC_SUBST(DISABLE_GUI)
5130 WORKDIR="${BUILDDIR}/workdir"
5131 INSTDIR="${BUILDDIR}/instdir"
5132 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
5133 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
5134 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
5135 AC_SUBST(COM)
5136 AC_SUBST(CPUNAME)
5137 AC_SUBST(RTL_OS)
5138 AC_SUBST(RTL_ARCH)
5139 AC_SUBST(EPM_FLAGS)
5140 AC_SUBST(USING_X11)
5141 AC_SUBST([INSTDIR])
5142 AC_SUBST([INSTROOT])
5143 AC_SUBST([INSTROOTBASE])
5144 AC_SUBST(OS)
5145 AC_SUBST(P_SEP)
5146 AC_SUBST(WORKDIR)
5147 AC_SUBST(PLATFORMID)
5148 AC_SUBST(WINDOWS_X64)
5149 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
5151 dnl ===================================================================
5152 dnl Test which package format to use
5153 dnl ===================================================================
5154 AC_MSG_CHECKING([which package format to use])
5155 if test -n "$with_package_format" -a "$with_package_format" != no; then
5156     for i in $with_package_format; do
5157         case "$i" in
5158         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
5159             ;;
5160         *)
5161             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
5162 aix - AIX software distribution
5163 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
5164 deb - Debian software distribution
5165 pkg - Solaris software distribution
5166 rpm - RedHat software distribution
5168 LibreOffice additionally supports:
5169 archive - .tar.gz or .zip
5170 dmg - macOS .dmg
5171 installed - installation tree
5172 msi - Windows .msi
5173         ])
5174             ;;
5175         esac
5176     done
5177     # fakeroot is needed to ensure correct file ownerships/permissions
5178     # inside deb packages and tar archives created on Linux and Solaris.
5179     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
5180         AC_PATH_PROG(FAKEROOT, fakeroot, no)
5181         if test "$FAKEROOT" = "no"; then
5182             AC_MSG_ERROR(
5183                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
5184         fi
5185     fi
5186     PKGFORMAT="$with_package_format"
5187     AC_MSG_RESULT([$PKGFORMAT])
5188 else
5189     PKGFORMAT=
5190     AC_MSG_RESULT([none])
5192 AC_SUBST(PKGFORMAT)
5194 dnl ===================================================================
5195 dnl Set up a different compiler to produce tools to run on the build
5196 dnl machine when doing cross-compilation
5197 dnl ===================================================================
5199 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
5200 m4_pattern_allow([PKG_CONFIG_LIBDIR])
5201 if test "$cross_compiling" = "yes"; then
5202     AC_MSG_CHECKING([for BUILD platform configuration])
5203     echo
5204     rm -rf CONF-FOR-BUILD config_build.mk
5205     mkdir CONF-FOR-BUILD
5206     # Here must be listed all files needed when running the configure script. In particular, also
5207     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
5208     # keep them in the same order as there.
5209     (cd $SRC_ROOT && tar cf - \
5210         config.guess \
5211         bin/get_config_variables \
5212         solenv/bin/getcompver.awk \
5213         solenv/inc/langlist.mk \
5214         download.lst \
5215         config_host.mk.in \
5216         config_host_lang.mk.in \
5217         Makefile.in \
5218         bin/bffvalidator.sh.in \
5219         bin/odfvalidator.sh.in \
5220         bin/officeotron.sh.in \
5221         hardened_runtime.xcent.in \
5222         instsetoo_native/util/openoffice.lst.in \
5223         setup_native/source/packinfo/finals_instsetoo.txt.in \
5224         config_host/*.in \
5225         sysui/desktop/macosx/Info.plist.in) \
5226     | (cd CONF-FOR-BUILD && tar xf -)
5227     cp configure CONF-FOR-BUILD
5228     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
5229     (
5230     unset COM USING_X11 OS CPUNAME
5231     unset CC CXX SYSBASE CFLAGS
5232     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
5233     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
5234     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
5235     if test -n "$CC_FOR_BUILD"; then
5236         export CC="$CC_FOR_BUILD"
5237         CC_BASE=`first_arg_basename "$CC"`
5238     fi
5239     if test -n "$CXX_FOR_BUILD"; then
5240         export CXX="$CXX_FOR_BUILD"
5241         CXX_BASE=`first_arg_basename "$CXX"`
5242     fi
5243     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
5244     cd CONF-FOR-BUILD
5246     sub_conf_opts=""
5247     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
5248     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
5249     test "$with_junit" = "no" && sub_conf_opts="$sub_conf_opts --without-junit"
5250     if test -n "$ENABLE_JAVA"; then
5251         case "$_os" in
5252         iOS) sub_conf_opts="$sub_conf_opts --without-java" ;; # force it off, like it used to be
5253         Android)
5254             # Hack for Android - the build doesn't need a host JDK, so just forward to build for convenience
5255             test -n "$with_jdk_home" && sub_conf_opts="$sub_conf_opts --with-jdk-home=$with_jdk_home"
5256             ;;
5257         *)
5258             if test -z "$with_jdk_home"; then
5259                 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.])
5260             fi
5261             ;;
5262         esac
5263     else
5264         sub_conf_opts="$sub_conf_opts --without-java"
5265     fi
5266     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
5267     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
5268     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
5270     # Don't bother having configure look for stuff not needed for the build platform anyway
5271     ./configure \
5272         --build="$build_alias" \
5273         --disable-cups \
5274         --disable-firebird-sdbc \
5275         --disable-gpgmepp \
5276         --disable-gstreamer-1-0 \
5277         --disable-gtk3 \
5278         --disable-mariadb-sdbc \
5279         --disable-online-update \
5280         --disable-opencl \
5281         --disable-pdfimport \
5282         --disable-postgresql-sdbc \
5283         --disable-skia \
5284         --enable-icecream="$enable_icecream" \
5285         --without-doxygen \
5286         --without-webdav \
5287         --with-parallelism="$with_parallelism" \
5288         --with-theme="$with_theme" \
5289         --with-tls=openssl \
5290         $sub_conf_opts \
5291         --srcdir=$srcdir \
5292         2>&1 | sed -e 's/^/    /'
5293     test -f ./config_host.mk 2>/dev/null || exit
5295     # filter permitted build targets
5296     PERMITTED_BUILD_TARGETS="
5297         AVMEDIA
5298         BOOST
5299         CLUCENE
5300         DBCONNECTIVITY
5301         DESKTOP
5302         DYNLOADING
5303         EPOXY
5304         EXPAT
5305         GLM
5306         GRAPHITE
5307         HARFBUZZ
5308         ICU
5309         LCMS2
5310         LIBJPEG_TURBO
5311         LIBLANGTAG
5312         LibO
5313         LIBFFI
5314         LIBPN
5315         LIBXML2
5316         LIBXSLT
5317         MDDS
5318         NATIVE
5319         OPENSSL
5320         ORCUS
5321         PYTHON
5322         SCRIPTING
5323         ZLIB
5325     # converts BUILD_TYPE and PERMITTED_BUILD_TARGETS into non-whitespace,
5326     # newlined lists, to use grep as a filter
5327     PERMITTED_BUILD_TARGETS=$(echo "$PERMITTED_BUILD_TARGETS" | sed -e '/^ *$/d' -e 's/ *//')
5328     BUILD_TARGETS="$(sed -n -e '/^export BUILD_TYPE=/ s/.*=//p' config_host.mk | tr ' ' '\n')"
5329     BUILD_TARGETS="$(echo "$BUILD_TARGETS" | grep -F "$PERMITTED_BUILD_TARGETS" | tr '\n' ' ')"
5330     sed -i -e "s/ BUILD_TYPE=.*$/ BUILD_TYPE=$BUILD_TARGETS/" config_host.mk
5332     cp config_host.mk ../config_build.mk
5333     cp config_host_lang.mk ../config_build_lang.mk
5334     mv config.log ../config.Build.log
5335     mkdir -p ../config_build
5336     mv config_host/*.h ../config_build
5338     # all these will get a _FOR_BUILD postfix
5339     DIRECT_FOR_BUILD_SETTINGS="
5340         CC
5341         CXX
5342         ILIB
5343         JAVA_HOME
5344         JAVAIFLAGS
5345         JDK
5346         LIBO_BIN_FOLDER
5347         LIBO_LIB_FOLDER
5348         LIBO_URE_LIB_FOLDER
5349         LIBO_URE_MISC_FOLDER
5350         OS
5351         SDKDIRNAME
5352         SYSTEM_LIBXML
5353         SYSTEM_LIBXSLT
5355     # these overwrite host config with build config
5356     OVERWRITING_SETTINGS="
5357         ANT
5358         ANT_HOME
5359         ANT_LIB
5360         HSQLDB_USE_JDBC_4_1
5361         JAVA_CLASSPATH_NOT_SET
5362         JAVA_SOURCE_VER
5363         JAVA_TARGET_VER
5364         JAVACFLAGS
5365         JAVACOMPILER
5366         JAVADOC
5367         JAVADOCISGJDOC
5369     # these need some special handling
5370     EXTRA_HANDLED_SETTINGS="
5371         INSTDIR
5372         INSTROOT
5373         PATH
5374         WORKDIR
5376     OLD_PATH=$PATH
5377     . ./bin/get_config_variables $DIRECT_FOR_BUILD_SETTINGS $OVERWRITING_SETTINGS $EXTRA_HANDLED_SETTINGS
5378     BUILD_PATH=$PATH
5379     PATH=$OLD_PATH
5381     line=`echo "LO_PATH_FOR_BUILD='${BUILD_PATH}'" | sed -e 's,/CONF-FOR-BUILD,,g'`
5382     echo "$line" >>build-config
5384     for V in $DIRECT_FOR_BUILD_SETTINGS; do
5385         VV='$'$V
5386         VV=`eval "echo $VV"`
5387         if test -n "$VV"; then
5388             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
5389             echo "$line" >>build-config
5390         fi
5391     done
5393     for V in $OVERWRITING_SETTINGS; do
5394         VV='$'$V
5395         VV=`eval "echo $VV"`
5396         if test -n "$VV"; then
5397             line=${V}='${'${V}:-$VV'}'
5398             echo "$line" >>build-config
5399         fi
5400     done
5402     for V in INSTDIR INSTROOT WORKDIR; do
5403         VV='$'$V
5404         VV=`eval "echo $VV"`
5405         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
5406         if test -n "$VV"; then
5407             line="${V}_FOR_BUILD='$VV'"
5408             echo "$line" >>build-config
5409         fi
5410     done
5412     )
5413     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
5414     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])
5415     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
5416              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
5418     eval `cat CONF-FOR-BUILD/build-config`
5420     AC_MSG_RESULT([checking for BUILD platform configuration... done])
5422     rm -rf CONF-FOR-BUILD
5423 else
5424     OS_FOR_BUILD="$OS"
5425     CC_FOR_BUILD="$CC"
5426     CXX_FOR_BUILD="$CXX"
5427     INSTDIR_FOR_BUILD="$INSTDIR"
5428     INSTROOT_FOR_BUILD="$INSTROOT"
5429     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
5430     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
5431     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
5432     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
5433     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
5434     WORKDIR_FOR_BUILD="$WORKDIR"
5436 AC_SUBST(OS_FOR_BUILD)
5437 AC_SUBST(INSTDIR_FOR_BUILD)
5438 AC_SUBST(INSTROOT_FOR_BUILD)
5439 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
5440 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
5441 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
5442 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
5443 AC_SUBST(SDKDIRNAME_FOR_BUILD)
5444 AC_SUBST(WORKDIR_FOR_BUILD)
5445 AC_SUBST(CC_FOR_BUILD)
5446 AC_SUBST(CXX_FOR_BUILD)
5448 dnl ===================================================================
5449 dnl Check for syslog header
5450 dnl ===================================================================
5451 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
5453 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
5454 dnl ===================================================================
5455 AC_MSG_CHECKING([whether to turn warnings to errors])
5456 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
5457     ENABLE_WERROR="TRUE"
5458     PYTHONWARNINGS="error"
5459     AC_MSG_RESULT([yes])
5460 else
5461     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
5462         ENABLE_WERROR="TRUE"
5463         PYTHONWARNINGS="error"
5464         AC_MSG_RESULT([yes])
5465     else
5466         AC_MSG_RESULT([no])
5467     fi
5469 AC_SUBST(ENABLE_WERROR)
5470 AC_SUBST(PYTHONWARNINGS)
5472 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
5473 dnl ===================================================================
5474 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
5475 if test -z "$enable_assert_always_abort"; then
5476    if test "$ENABLE_DEBUG" = TRUE; then
5477        enable_assert_always_abort=yes
5478    else
5479        enable_assert_always_abort=no
5480    fi
5482 if test "$enable_assert_always_abort" = "yes"; then
5483     ASSERT_ALWAYS_ABORT="TRUE"
5484     AC_MSG_RESULT([yes])
5485 else
5486     ASSERT_ALWAYS_ABORT="FALSE"
5487     AC_MSG_RESULT([no])
5489 AC_SUBST(ASSERT_ALWAYS_ABORT)
5491 # Determine whether to use ooenv for the instdir installation
5492 # ===================================================================
5493 if test $_os != "WINNT" -a $_os != "Darwin"; then
5494     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
5495     if test "$enable_ooenv" = "no"; then
5496         AC_MSG_RESULT([no])
5497     else
5498         ENABLE_OOENV="TRUE"
5499         AC_MSG_RESULT([yes])
5500     fi
5502 AC_SUBST(ENABLE_OOENV)
5504 if test "$USING_X11" != TRUE; then
5505     # be sure to do not mess with unneeded stuff
5506     test_randr=no
5507     test_xrender=no
5508     test_cups=no
5509     test_dbus=no
5510     build_gstreamer_1_0=no
5511     test_kf5=no
5512     test_qt5=no
5513     test_gtk3_kde5=no
5514     enable_cairo_canvas=no
5517 if test "$OS" = "HAIKU"; then
5518     enable_cairo_canvas=yes
5519     test_kf5=yes
5522 if test "$test_kf5" = "yes" -a "$enable_kde5" = "yes"; then
5523     AC_MSG_WARN([The kde5 VCL plugin was renamed to kf5. Please update your configuration to use --enable-kf5, as --enable-kde5 will be removed after the next major release!])
5524     add_warning "The kde5 VCL plugin was renamed to kf5. Please update your configuration to use --enable-kf5, as --enable-kde5 will be removed after the next major release!"
5525     enable_kf5=yes
5528 if test "$test_kf5" = "yes"; then
5529     test_qt5=yes
5532 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
5533     if test "$enable_qt5" = "no"; then
5534         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
5535     else
5536         enable_qt5=yes
5537     fi
5540 dnl ===================================================================
5541 dnl check for cups support
5542 dnl ===================================================================
5543 ENABLE_CUPS=""
5545 if test "$enable_cups" = "no"; then
5546     test_cups=no
5549 AC_MSG_CHECKING([whether to enable CUPS support])
5550 if test "$test_cups" = "yes"; then
5551     ENABLE_CUPS="TRUE"
5552     AC_MSG_RESULT([yes])
5554     AC_MSG_CHECKING([whether cups support is present])
5555     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
5556     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
5557     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
5558         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
5559     fi
5561 else
5562     AC_MSG_RESULT([no])
5565 AC_SUBST(ENABLE_CUPS)
5567 # fontconfig checks
5568 if test "$test_fontconfig" = "yes"; then
5569     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
5570     SYSTEM_FONTCONFIG=TRUE
5571     FilterLibs "${FONTCONFIG_LIBS}"
5572     FONTCONFIG_LIBS="${filteredlibs}"
5574 AC_SUBST(FONTCONFIG_CFLAGS)
5575 AC_SUBST(FONTCONFIG_LIBS)
5576 AC_SUBST([SYSTEM_FONTCONFIG])
5578 dnl whether to find & fetch external tarballs?
5579 dnl ===================================================================
5580 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
5581    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5582        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
5583    else
5584        TARFILE_LOCATION="$LODE_HOME/ext_tar"
5585    fi
5587 if test -z "$TARFILE_LOCATION"; then
5588     if test -d "$SRC_ROOT/src" ; then
5589         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
5590         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
5591     fi
5592     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
5593 else
5594     AbsolutePath "$TARFILE_LOCATION"
5595     PathFormat "${absolute_path}"
5596     TARFILE_LOCATION="${formatted_path}"
5598 AC_SUBST(TARFILE_LOCATION)
5600 AC_MSG_CHECKING([whether we want to fetch tarballs])
5601 if test "$enable_fetch_external" != "no"; then
5602     if test "$with_all_tarballs" = "yes"; then
5603         AC_MSG_RESULT([yes, all of them])
5604         DO_FETCH_TARBALLS="ALL"
5605     else
5606         AC_MSG_RESULT([yes, if we use them])
5607         DO_FETCH_TARBALLS="TRUE"
5608     fi
5609 else
5610     AC_MSG_RESULT([no])
5611     DO_FETCH_TARBALLS=
5613 AC_SUBST(DO_FETCH_TARBALLS)
5615 AC_MSG_CHECKING([whether to build help])
5616 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
5617     BUILD_TYPE="$BUILD_TYPE HELP"
5618     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5619     case "$with_help" in
5620     "html")
5621         ENABLE_HTMLHELP=TRUE
5622         SCPDEFS="$SCPDEFS -DWITH_HELP"
5623         AC_MSG_RESULT([HTML])
5624         ;;
5625     "online")
5626         ENABLE_HTMLHELP=TRUE
5627         HELP_ONLINE=TRUE
5628         AC_MSG_RESULT([HTML])
5629         ;;
5630     yes)
5631         SCPDEFS="$SCPDEFS -DWITH_HELP"
5632         AC_MSG_RESULT([yes])
5633         ;;
5634     *)
5635         AC_MSG_ERROR([Unknown --with-help=$with_help])
5636         ;;
5637     esac
5638 else
5639     AC_MSG_RESULT([no])
5641 AC_SUBST([ENABLE_HTMLHELP])
5642 AC_SUBST([HELP_ONLINE])
5644 AC_MSG_CHECKING([whether to enable xapian-omega support for help])
5645 if test -n "$with_omindex" -a "$with_omindex" != "no" -a $_os != iOS -a $_os != Android; then
5646     BUILD_TYPE="$BUILD_TYPE HELP"
5647     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5648     case "$with_omindex" in
5649     "server")
5650         ENABLE_HTMLHELP=TRUE
5651         HELP_ONLINE=TRUE
5652         HELP_OMINDEX_PAGE=TRUE
5653         AC_MSG_RESULT([SERVER])
5654         ;;
5655     "noxap")
5656         ENABLE_HTMLHELP=TRUE
5657         HELP_ONLINE=TRUE
5658         HELP_OMINDEX_PAGE=FALSE
5659         AC_MSG_RESULT([NOXAP])
5660         ;;
5661     *)
5662         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5663         ;;
5664     esac
5665 else
5666     HELP_OMINDEX_PAGE=FALSE
5667     AC_MSG_RESULT([no])
5669 AC_SUBST([ENABLE_HTMLHELP])
5670 AC_SUBST([HELP_OMINDEX_PAGE])
5671 AC_SUBST([HELP_ONLINE])
5674 dnl Test whether to include MySpell dictionaries
5675 dnl ===================================================================
5676 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5677 if test "$with_myspell_dicts" = "yes"; then
5678     AC_MSG_RESULT([yes])
5679     WITH_MYSPELL_DICTS=TRUE
5680     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5681     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5682 else
5683     AC_MSG_RESULT([no])
5684     WITH_MYSPELL_DICTS=
5686 AC_SUBST(WITH_MYSPELL_DICTS)
5688 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5689 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5690     if test "$with_system_dicts" = yes; then
5691         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5692     fi
5693     with_system_dicts=no
5696 AC_MSG_CHECKING([whether to use dicts from external paths])
5697 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5698     AC_MSG_RESULT([yes])
5699     SYSTEM_DICTS=TRUE
5700     AC_MSG_CHECKING([for spelling dictionary directory])
5701     if test -n "$with_external_dict_dir"; then
5702         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5703     else
5704         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5705         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5706             DICT_SYSTEM_DIR=file:///usr/share/myspell
5707         fi
5708     fi
5709     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5710     AC_MSG_CHECKING([for hyphenation patterns directory])
5711     if test -n "$with_external_hyph_dir"; then
5712         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5713     else
5714         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5715     fi
5716     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5717     AC_MSG_CHECKING([for thesaurus directory])
5718     if test -n "$with_external_thes_dir"; then
5719         THES_SYSTEM_DIR=file://$with_external_thes_dir
5720     else
5721         THES_SYSTEM_DIR=file:///usr/share/mythes
5722     fi
5723     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5724 else
5725     AC_MSG_RESULT([no])
5726     SYSTEM_DICTS=
5728 AC_SUBST(SYSTEM_DICTS)
5729 AC_SUBST(DICT_SYSTEM_DIR)
5730 AC_SUBST(HYPH_SYSTEM_DIR)
5731 AC_SUBST(THES_SYSTEM_DIR)
5733 dnl ===================================================================
5734 dnl Precompiled headers.
5735 ENABLE_PCH=""
5736 AC_MSG_CHECKING([whether to enable pch feature])
5737 if test -z "$enable_pch"; then
5738     if test "$_os" = "WINNT"; then
5739         # Enabled by default on Windows.
5740         enable_pch=yes
5741     else
5742         enable_pch=no
5743     fi
5745 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5746     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5748 if test "$enable_pch" = "system"; then
5749     ENABLE_PCH="1"
5750     AC_MSG_RESULT([yes (system headers)])
5751 elif test "$enable_pch" = "base"; then
5752     ENABLE_PCH="2"
5753     AC_MSG_RESULT([yes (system and base headers)])
5754 elif test "$enable_pch" = "normal"; then
5755     ENABLE_PCH="3"
5756     AC_MSG_RESULT([yes (normal)])
5757 elif test "$enable_pch" = "full"; then
5758     ENABLE_PCH="4"
5759     AC_MSG_RESULT([yes (full)])
5760 elif test "$enable_pch" = "yes"; then
5761     # Pick a suitable default.
5762     if test "$GCC" = "yes"; then
5763         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5764         # while making the PCHs larger and rebuilds more likely.
5765         ENABLE_PCH="2"
5766         AC_MSG_RESULT([yes (system and base headers)])
5767     else
5768         # With MSVC the highest level makes a significant difference,
5769         # and it was the default when there used to be no PCH levels.
5770         ENABLE_PCH="4"
5771         AC_MSG_RESULT([yes (full)])
5772     fi
5773 elif test "$enable_pch" = "no"; then
5774     AC_MSG_RESULT([no])
5775 else
5776     AC_MSG_ERROR([Unknown value for --enable-pch])
5778 AC_SUBST(ENABLE_PCH)
5779 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5780 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5781     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5782     if test "$CCACHE_BIN" != "not found"; then
5783         AC_MSG_CHECKING([ccache version])
5784         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5785         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5786         AC_MSG_RESULT([$CCACHE_VERSION])
5787         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5788         if test "$CCACHE_NUMVER" -gt "030701"; then
5789             AC_MSG_RESULT([yes])
5790         else
5791             AC_MSG_RESULT([no (not newer than 3.7.1)])
5792             CCACHE_DEPEND_MODE=
5793         fi
5794     fi
5797 PCH_INSTANTIATE_TEMPLATES=
5798 if test -n "$ENABLE_PCH"; then
5799     AC_MSG_CHECKING([whether $CC supports -fpch-instantiate-templates])
5800     save_CFLAGS=$CFLAGS
5801     CFLAGS="$CFLAGS -Werror -fpch-instantiate-templates"
5802     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_INSTANTIATE_TEMPLATES="-fpch-instantiate-templates" ],[])
5803     CFLAGS=$save_CFLAGS
5804     if test -n "$PCH_INSTANTIATE_TEMPLATES"; then
5805         AC_MSG_RESULT(yes)
5806     else
5807         AC_MSG_RESULT(no)
5808     fi
5810 AC_SUBST(PCH_INSTANTIATE_TEMPLATES)
5812 BUILDING_PCH_WITH_OBJ=
5813 if test -n "$ENABLE_PCH"; then
5814     AC_MSG_CHECKING([whether $CC supports -Xclang -building-pch-with-obj])
5815     save_CFLAGS=$CFLAGS
5816     CFLAGS="$CFLAGS -Werror -Xclang -building-pch-with-obj"
5817     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ BUILDING_PCH_WITH_OBJ="-Xclang -building-pch-with-obj" ],[])
5818     CFLAGS=$save_CFLAGS
5819     if test -n "$BUILDING_PCH_WITH_OBJ"; then
5820         AC_MSG_RESULT(yes)
5821     else
5822         AC_MSG_RESULT(no)
5823     fi
5825 AC_SUBST(BUILDING_PCH_WITH_OBJ)
5827 PCH_CODEGEN=
5828 PCH_NO_CODEGEN=
5829 if test -n "$BUILDING_PCH_WITH_OBJ"; then
5830     AC_MSG_CHECKING([whether $CC supports -fpch-codegen])
5831     save_CFLAGS=$CFLAGS
5832     CFLAGS="$CFLAGS -Werror -fpch-codegen"
5833     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
5834         [
5835         PCH_CODEGEN="-fpch-codegen"
5836         PCH_NO_CODEGEN="-fno-pch-codegen"
5837         ],[])
5838     CFLAGS=$save_CFLAGS
5839     if test -n "$PCH_CODEGEN"; then
5840         AC_MSG_RESULT(yes)
5841     else
5842         AC_MSG_RESULT(no)
5843     fi
5845 AC_SUBST(PCH_CODEGEN)
5846 AC_SUBST(PCH_NO_CODEGEN)
5847 PCH_DEBUGINFO=
5848 if test -n "$BUILDING_PCH_WITH_OBJ"; then
5849     AC_MSG_CHECKING([whether $CC supports -fpch-debuginfo])
5850     save_CFLAGS=$CFLAGS
5851     CFLAGS="$CFLAGS -Werror -fpch-debuginfo"
5852     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_DEBUGINFO="-fpch-debuginfo" ],[])
5853     CFLAGS=$save_CFLAGS
5854     if test -n "$PCH_DEBUGINFO"; then
5855         AC_MSG_RESULT(yes)
5856     else
5857         AC_MSG_RESULT(no)
5858     fi
5860 AC_SUBST(PCH_DEBUGINFO)
5862 TAB=`printf '\t'`
5864 AC_MSG_CHECKING([the GNU Make version])
5865 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5866 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5867 if test "$_make_longver" -ge "038200"; then
5868     AC_MSG_RESULT([$GNUMAKE $_make_version])
5870 elif test "$_make_longver" -ge "038100"; then
5871     if test "$build_os" = "cygwin"; then
5872         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5873     fi
5874     AC_MSG_RESULT([$GNUMAKE $_make_version])
5876     dnl ===================================================================
5877     dnl Search all the common names for sha1sum
5878     dnl ===================================================================
5879     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5880     if test -z "$SHA1SUM"; then
5881         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5882     elif test "$SHA1SUM" = "openssl"; then
5883         SHA1SUM="openssl sha1"
5884     fi
5885     AC_MSG_CHECKING([for GNU Make bug 20033])
5886     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5887     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5888 A := \$(wildcard *.a)
5890 .PHONY: all
5891 all: \$(A:.a=.b)
5892 <TAB>@echo survived bug20033.
5894 .PHONY: setup
5895 setup:
5896 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5898 define d1
5899 @echo lala \$(1)
5900 @sleep 1
5901 endef
5903 define d2
5904 @echo tyty \$(1)
5905 @sleep 1
5906 endef
5908 %.b : %.a
5909 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5910 <TAB>\$(call d1,\$(CHECKSUM)),\
5911 <TAB>\$(call d2,\$(CHECKSUM)))
5913     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5914         no_parallelism_make="YES"
5915         AC_MSG_RESULT([yes, disable parallelism])
5916     else
5917         AC_MSG_RESULT([no, keep parallelism enabled])
5918     fi
5919     rm -rf $TESTGMAKEBUG20033
5920 else
5921     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5924 # find if gnumake support file function
5925 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5926 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5927 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5928     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5930 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5931 \$(file >test.txt,Success )
5933 .PHONY: all
5934 all:
5935 <TAB>@cat test.txt
5938 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5939 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5940     HAVE_GNUMAKE_FILE_FUNC=TRUE
5941     AC_MSG_RESULT([yes])
5942 else
5943     AC_MSG_RESULT([no])
5945 rm -rf $TESTGMAKEFILEFUNC
5946 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5948 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5949 STALE_MAKE=
5950 if test "$_make_ver_check" = ""; then
5951    STALE_MAKE=TRUE
5954 HAVE_LD_HASH_STYLE=FALSE
5955 WITH_LINKER_HASH_STYLE=
5956 AC_MSG_CHECKING([for --hash-style gcc linker support])
5957 if test "$GCC" = "yes"; then
5958     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5959         hash_styles="gnu sysv"
5960     elif test "$with_linker_hash_style" = "no"; then
5961         hash_styles=
5962     else
5963         hash_styles="$with_linker_hash_style"
5964     fi
5966     for hash_style in $hash_styles; do
5967         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5968         hash_style_ldflags_save=$LDFLAGS
5969         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5971         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5972             [
5973 #include <stdio.h>
5974             ],[
5975 printf ("");
5976             ])],
5977             [
5978                   HAVE_LD_HASH_STYLE=TRUE
5979                   WITH_LINKER_HASH_STYLE=$hash_style
5980             ],
5981             [HAVE_LD_HASH_STYLE=FALSE],
5982             [HAVE_LD_HASH_STYLE=FALSE])
5983         LDFLAGS=$hash_style_ldflags_save
5984     done
5986     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5987         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5988     else
5989         AC_MSG_RESULT( no )
5990     fi
5991     LDFLAGS=$hash_style_ldflags_save
5992 else
5993     AC_MSG_RESULT( no )
5995 AC_SUBST(HAVE_LD_HASH_STYLE)
5996 AC_SUBST(WITH_LINKER_HASH_STYLE)
5998 dnl ===================================================================
5999 dnl Check whether there's a Perl version available.
6000 dnl ===================================================================
6001 if test -z "$with_perl_home"; then
6002     AC_PATH_PROG(PERL, perl)
6003 else
6004     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
6005     _perl_path="$with_perl_home/bin/perl"
6006     if test -x "$_perl_path"; then
6007         PERL=$_perl_path
6008     else
6009         AC_MSG_ERROR([$_perl_path not found])
6010     fi
6013 dnl ===================================================================
6014 dnl Testing for Perl version 5 or greater.
6015 dnl $] is the Perl version variable, it is returned as an integer
6016 dnl ===================================================================
6017 if test "$PERL"; then
6018     AC_MSG_CHECKING([the Perl version])
6019     ${PERL} -e "exit($]);"
6020     _perl_version=$?
6021     if test "$_perl_version" -lt 5; then
6022         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
6023     fi
6024     AC_MSG_RESULT([Perl $_perl_version])
6025 else
6026     AC_MSG_ERROR([Perl not found, install Perl 5])
6029 dnl ===================================================================
6030 dnl Testing for required Perl modules
6031 dnl ===================================================================
6033 AC_MSG_CHECKING([for required Perl modules])
6034 perl_use_string="use Cwd ; use Digest::MD5"
6035 if test "$_os" = "WINNT"; then
6036     if test -n "$PKGFORMAT"; then
6037         for i in $PKGFORMAT; do
6038             case "$i" in
6039             msi)
6040                 # for getting fonts versions to use in MSI
6041                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
6042                 ;;
6043             esac
6044         done
6045     fi
6047 if test "$with_system_hsqldb" = "yes"; then
6048     perl_use_string="$perl_use_string ; use Archive::Zip"
6050 if test "$enable_openssl" = "yes" -a "$with_system_openssl" != "yes"; then
6051     # OpenSSL needs that to build
6052     perl_use_string="$perl_use_string ; use FindBin"
6054 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
6055     AC_MSG_RESULT([all modules found])
6056 else
6057     AC_MSG_RESULT([failed to find some modules])
6058     # Find out which modules are missing.
6059     for i in $perl_use_string; do
6060         if test "$i" != "use" -a "$i" != ";"; then
6061             if ! $PERL -e "use $i;">/dev/null 2>&1; then
6062                 missing_perl_modules="$missing_perl_modules $i"
6063             fi
6064         fi
6065     done
6066     AC_MSG_ERROR([
6067     The missing Perl modules are: $missing_perl_modules
6068     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
6071 dnl ===================================================================
6072 dnl Check for pkg-config
6073 dnl ===================================================================
6074 if test "$_os" != "WINNT"; then
6075     PKG_PROG_PKG_CONFIG
6078 if test "$_os" != "WINNT"; then
6080     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
6081     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
6082     # explicitly. Or put /path/to/compiler in PATH yourself.
6084     # Use wrappers for LTO
6085     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
6086         AC_CHECK_TOOL(AR,gcc-ar)
6087         AC_CHECK_TOOL(NM,gcc-nm)
6088         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
6089     else
6090         AC_CHECK_TOOL(AR,ar)
6091         AC_CHECK_TOOL(NM,nm)
6092         AC_CHECK_TOOL(RANLIB,ranlib)
6093     fi
6094     AC_CHECK_TOOL(OBJDUMP,objdump)
6095     AC_CHECK_TOOL(READELF,readelf)
6096     AC_CHECK_TOOL(STRIP,strip)
6097     if test "$_os" = "WINNT"; then
6098         AC_CHECK_TOOL(DLLTOOL,dlltool)
6099         AC_CHECK_TOOL(WINDRES,windres)
6100     fi
6102 AC_SUBST(AR)
6103 AC_SUBST(DLLTOOL)
6104 AC_SUBST(NM)
6105 AC_SUBST(OBJDUMP)
6106 AC_SUBST(PKG_CONFIG)
6107 AC_SUBST(RANLIB)
6108 AC_SUBST(READELF)
6109 AC_SUBST(STRIP)
6110 AC_SUBST(WINDRES)
6112 dnl ===================================================================
6113 dnl pkg-config checks on macOS
6114 dnl ===================================================================
6116 if test $_os = Darwin; then
6117     AC_MSG_CHECKING([for bogus pkg-config])
6118     if test -n "$PKG_CONFIG"; then
6119         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
6120             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
6121         else
6122             if test "$enable_bogus_pkg_config" = "yes"; then
6123                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
6124             else
6125                 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.])
6126             fi
6127         fi
6128     else
6129         AC_MSG_RESULT([no, good])
6130     fi
6133 find_csc()
6135     # Return value: $csctest
6137     unset csctest
6139     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
6140     if test -n "$regvalue"; then
6141         csctest=$regvalue
6142         return
6143     fi
6146 find_al()
6148     # Return value: $altest
6150     unset altest
6152     # We need this check to detect 4.6.1 or above.
6153     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
6154         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
6155         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
6156             altest=$regvalue
6157             return
6158         fi
6159     done
6161     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
6162         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
6163         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
6164             altest=$regvalue
6165             return
6166         fi
6167     done
6170 find_dotnetsdk46()
6172     unset frametest
6174     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
6175         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
6176         if test -n "$regvalue"; then
6177             frametest=$regvalue
6178             return
6179         fi
6180     done
6183 find_winsdk_version()
6185     # Args: $1 : SDK version as in "8.0", "8.1A" etc
6186     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
6188     unset winsdktest winsdkbinsubdir winsdklibsubdir
6190     case "$1" in
6191     8.0|8.0A)
6192         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
6193         if test -n "$regvalue"; then
6194             winsdktest=$regvalue
6195             winsdklibsubdir=win8
6196             return
6197         fi
6198         ;;
6199     8.1|8.1A)
6200         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
6201         if test -n "$regvalue"; then
6202             winsdktest=$regvalue
6203             winsdklibsubdir=winv6.3
6204             return
6205         fi
6206         ;;
6207     10.0)
6208         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
6209         if test -n "$regvalue"; then
6210             winsdktest=$regvalue
6211             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
6212             if test -n "$regvalue"; then
6213                 winsdkbinsubdir="$regvalue".0
6214                 winsdklibsubdir=$winsdkbinsubdir
6215                 local tmppath="$winsdktest\\Include\\$winsdklibsubdir"
6216                 local tmppath_unix=$(cygpath -u "$tmppath")
6217                 # test exist the SDK path
6218                 if test -d "$tmppath_unix"; then
6219                    # when path is convertible to a short path then path is okay
6220                    cygpath -d "$tmppath" >/dev/null 2>&1
6221                    if test $? -ne 0; then
6222                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
6223                    fi
6224                 else
6225                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
6226                 fi
6227             fi
6228             return
6229         fi
6230         ;;
6231     esac
6234 find_winsdk()
6236     # Return value: From find_winsdk_version
6238     unset winsdktest
6240     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
6241         find_winsdk_version $ver
6242         if test -n "$winsdktest"; then
6243             return
6244         fi
6245     done
6248 find_msms()
6250     # Return value: $msmdir
6252     AC_MSG_CHECKING([for MSVC merge modules directory])
6253     local my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
6254     local my_msm_dir
6256     case "$VCVER" in
6257         160)
6258         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
6259         ;;
6260     esac
6261     for f in $my_msm_files; do
6262         echo "$as_me:$LINENO: searching for $f" >&5
6263     done
6265     msmdir=
6266     for ver in 14.0 15.0; do
6267         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
6268         if test -n "$regvalue"; then
6269             for f in ${my_msm_files}; do
6270                 if test -e "$regvalue/${f}"; then
6271                     msmdir=$regvalue
6272                     break
6273                 fi
6274             done
6275         fi
6276     done
6277     dnl Is the following fallback really necessary, or was it added in response
6278     dnl to never having started Visual Studio on a given machine, so the
6279     dnl registry keys checked above had presumably not yet been created?
6280     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
6281     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
6282     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
6283     dnl expanding to "C:\Program Files\Common Files"), which would need
6284     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
6285     dnl obtain its value from cygwin:
6286     if test -z "$msmdir"; then
6287         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
6288         for f in ${my_msm_files}; do
6289             if test -e "$my_msm_dir/${f}"; then
6290                 msmdir=$my_msm_dir
6291             fi
6292         done
6293     fi
6295     dnl Starting from MSVC 15.0, merge modules are located in different directory
6296     case "$VCVER" in
6297     160)
6298         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6299             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
6300             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
6301             for f in ${my_msm_files}; do
6302                 if test -e "$my_msm_dir/${f}"; then
6303                     msmdir=$my_msm_dir
6304                     break
6305                 fi
6306             done
6307         done
6308         ;;
6309     esac
6311     if test -n "$msmdir"; then
6312         msmdir=`cygpath -m "$msmdir"`
6313         AC_MSG_RESULT([$msmdir])
6314     else
6315         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
6316             AC_MSG_FAILURE([not found])
6317         else
6318             AC_MSG_WARN([not found (check config.log)])
6319             add_warning "MSM none of ${my_msm_files} found"
6320         fi
6321     fi
6324 find_msvc_x64_dlls()
6326     # Return value: $msvcdllpath, $msvcdlls
6328     AC_MSG_CHECKING([for MSVC x64 DLL path])
6329     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
6330     case "$VCVER" in
6331     160)
6332         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6333             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
6334             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
6335                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
6336                 break
6337             fi
6338             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
6339             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
6340                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
6341                 break
6342             fi
6343         done
6344         ;;
6345     esac
6346     AC_MSG_RESULT([$msvcdllpath])
6347     AC_MSG_CHECKING([for MSVC x64 DLLs])
6348     msvcdlls="msvcp140.dll vcruntime140.dll"
6349     for dll in $msvcdlls; do
6350         if ! test -f "$msvcdllpath/$dll"; then
6351             AC_MSG_FAILURE([missing $dll])
6352         fi
6353     done
6354     AC_MSG_RESULT([found all ($msvcdlls)])
6357 dnl =========================================
6358 dnl Check for the Windows  SDK.
6359 dnl =========================================
6360 if test "$_os" = "WINNT"; then
6361     AC_MSG_CHECKING([for Windows SDK])
6362     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6363         find_winsdk
6364         WINDOWS_SDK_HOME=$winsdktest
6366         # normalize if found
6367         if test -n "$WINDOWS_SDK_HOME"; then
6368             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
6369             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
6370         fi
6372         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
6373     fi
6375     if test -n "$WINDOWS_SDK_HOME"; then
6376         # Remove a possible trailing backslash
6377         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
6379         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
6380              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
6381              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
6382             have_windows_sdk_headers=yes
6383         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
6384              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
6385              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
6386             have_windows_sdk_headers=yes
6387         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
6388              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
6389              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
6390             have_windows_sdk_headers=yes
6391         else
6392             have_windows_sdk_headers=no
6393         fi
6395         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
6396             have_windows_sdk_libs=yes
6397         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/user32.lib"; then
6398             have_windows_sdk_libs=yes
6399         else
6400             have_windows_sdk_libs=no
6401         fi
6403         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
6404             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
6405 the  Windows SDK are installed.])
6406         fi
6407     fi
6409     if test -z "$WINDOWS_SDK_HOME"; then
6410         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
6411     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
6412         WINDOWS_SDK_VERSION=80
6413         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
6414     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
6415         WINDOWS_SDK_VERSION=81
6416         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
6417     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
6418         WINDOWS_SDK_VERSION=10
6419         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
6420     else
6421         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
6422     fi
6423     PathFormat "$WINDOWS_SDK_HOME"
6424     WINDOWS_SDK_HOME="$formatted_path"
6425     WINDOWS_SDK_HOME_unix="$formatted_path_unix"
6426     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6427         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
6428         if test -d "$WINDOWS_SDK_HOME/include/um"; then
6429             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
6430         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
6431             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
6432         fi
6433     fi
6435     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
6436     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
6437     dnl but not in v8.0), so allow this to be overridden with a
6438     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
6439     dnl and configuration error if no WiLangId.vbs is found would arguably be
6440     dnl better, but I do not know under which conditions exactly it is needed by
6441     dnl msiglobal.pm:
6442     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
6443         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
6444         WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6445         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6446             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WIN_BUILD_ARCH}/WiLangId.vbs"
6447             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6448         fi
6449         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6450             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WIN_BUILD_ARCH/WiLangId.vbs
6451             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6452         fi
6453         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6454             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WIN_BUILD_ARCH/WiLangId.vbs")
6455             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6456         fi
6457     fi
6458     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
6459         if test -n "$with_package_format" -a "$with_package_format" != no; then
6460             for i in "$with_package_format"; do
6461                 if test "$i" = "msi"; then
6462                     if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6463                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
6464                     fi
6465                 fi
6466             done
6467         fi
6468     fi
6470 AC_SUBST(WINDOWS_SDK_HOME)
6471 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
6472 AC_SUBST(WINDOWS_SDK_VERSION)
6473 AC_SUBST(WINDOWS_SDK_WILANGID)
6475 if test "$build_os" = "cygwin"; then
6476     dnl Check midl.exe; this being the first check for a tool in the SDK bin
6477     dnl dir, it also determines that dir's path w/o an arch segment if any,
6478     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
6479     AC_MSG_CHECKING([for midl.exe])
6481     find_winsdk
6482     if test -n "$winsdkbinsubdir" \
6483         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/midl.exe"
6484     then
6485         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH
6486         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
6487     elif test -f "$winsdktest/Bin/$WIN_BUILD_ARCH/midl.exe"; then
6488         MIDL_PATH=$winsdktest/Bin/$WIN_BUILD_ARCH
6489         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
6490     elif test -f "$winsdktest/Bin/midl.exe"; then
6491         MIDL_PATH=$winsdktest/Bin
6492         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
6493     fi
6494     if test ! -f "$MIDL_PATH/midl.exe"; then
6495         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WIN_BUILD_ARCH, Windows SDK installation broken?])
6496     else
6497         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
6498     fi
6500     # Convert to posix path with 8.3 filename restrictions ( No spaces )
6501     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
6503     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
6504          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
6505          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
6506          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
6507     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
6508          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
6509          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6510          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
6511     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
6512          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
6513          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6514          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
6515     else
6516         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
6517     fi
6519     dnl Check csc.exe
6520     AC_MSG_CHECKING([for csc.exe])
6521     find_csc
6522     if test -f "$csctest/csc.exe"; then
6523         CSC_PATH="$csctest"
6524     fi
6525     if test ! -f "$CSC_PATH/csc.exe"; then
6526         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
6527     else
6528         AC_MSG_RESULT([$CSC_PATH/csc.exe])
6529     fi
6531     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
6533     dnl Check al.exe
6534     AC_MSG_CHECKING([for al.exe])
6535     find_winsdk
6536     if test -n "$winsdkbinsubdir" \
6537         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/al.exe"
6538     then
6539         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH"
6540     elif test -f "$winsdktest/Bin/$WIN_BUILD_ARCH/al.exe"; then
6541         AL_PATH="$winsdktest/Bin/$WIN_BUILD_ARCH"
6542     elif test -f "$winsdktest/Bin/al.exe"; then
6543         AL_PATH="$winsdktest/Bin"
6544     fi
6546     if test -z "$AL_PATH"; then
6547         find_al
6548         if test -f "$altest/bin/al.exe"; then
6549             AL_PATH="$altest/bin"
6550         elif test -f "$altest/al.exe"; then
6551             AL_PATH="$altest"
6552         fi
6553     fi
6554     if test ! -f "$AL_PATH/al.exe"; then
6555         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
6556     else
6557         AC_MSG_RESULT([$AL_PATH/al.exe])
6558     fi
6560     AL_PATH=`win_short_path_for_make "$AL_PATH"`
6562     dnl Check mscoree.lib / .NET Framework dir
6563     AC_MSG_CHECKING(.NET Framework)
6564     find_dotnetsdk46
6565     PathFormat "$frametest"
6566     frametest="$formatted_path"
6567     if test -f "$frametest/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6568         DOTNET_FRAMEWORK_HOME="$frametest"
6569     else
6570         find_winsdk
6571         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6572             DOTNET_FRAMEWORK_HOME="$winsdktest"
6573         fi
6574     fi
6575     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
6576         AC_MSG_ERROR([mscoree.lib not found])
6577     fi
6578     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
6580     PathFormat "$MIDL_PATH"
6581     MIDL_PATH="$formatted_path"
6583     PathFormat "$AL_PATH"
6584     AL_PATH="$formatted_path"
6586     PathFormat "$DOTNET_FRAMEWORK_HOME"
6587     DOTNET_FRAMEWORK_HOME="$formatted_path"
6589     PathFormat "$CSC_PATH"
6590     CSC_PATH="$formatted_path"
6593 dnl ===================================================================
6594 dnl Testing for C++ compiler and version...
6595 dnl ===================================================================
6597 if test "$_os" != "WINNT"; then
6598     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
6599     save_CXXFLAGS=$CXXFLAGS
6600     AC_PROG_CXX
6601     CXXFLAGS=$save_CXXFLAGS
6602     if test -z "$CXX_BASE"; then
6603         CXX_BASE=`first_arg_basename "$CXX"`
6604     fi
6607 dnl check for GNU C++ compiler version
6608 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
6609     AC_MSG_CHECKING([the GNU C++ compiler version])
6611     _gpp_version=`$CXX -dumpversion`
6612     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
6614     if test "$_gpp_majmin" -lt "700"; then
6615         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
6616     else
6617         AC_MSG_RESULT([ok (g++ $_gpp_version)])
6618     fi
6620     dnl see https://code.google.com/p/android/issues/detail?id=41770
6621         glibcxx_threads=no
6622         AC_LANG_PUSH([C++])
6623         AC_REQUIRE_CPP
6624         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
6625         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
6626             #include <bits/c++config.h>]],[[
6627             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
6628             && !defined(_GLIBCXX__PTHREADS) \
6629             && !defined(_GLIBCXX_HAS_GTHREADS)
6630             choke me
6631             #endif
6632         ]])],[AC_MSG_RESULT([yes])
6633         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
6634         AC_LANG_POP([C++])
6635         if test $glibcxx_threads = yes; then
6636             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
6637         fi
6639 AC_SUBST(BOOST_CXXFLAGS)
6642 # prefx CXX with ccache if needed
6644 if test "$CCACHE" != ""; then
6645     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
6646     AC_LANG_PUSH([C++])
6647     save_CXXFLAGS=$CXXFLAGS
6648     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
6649     dnl an empty program will do, we're checking the compiler flags
6650     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
6651                       [use_ccache=yes], [use_ccache=no])
6652     if test $use_ccache = yes; then
6653         AC_MSG_RESULT([yes])
6654     else
6655         CXX="$CCACHE $CXX"
6656         CXX_BASE="ccache $CXX_BASE"
6657         AC_MSG_RESULT([no])
6658     fi
6659     CXXFLAGS=$save_CXXFLAGS
6660     AC_LANG_POP([C++])
6663 dnl ===================================================================
6664 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
6665 dnl ===================================================================
6667 if test "$_os" != "WINNT"; then
6668     AC_PROG_CXXCPP
6670     dnl Check whether there's a C pre-processor.
6671     AC_PROG_CPP
6675 dnl ===================================================================
6676 dnl Find integral type sizes and alignments
6677 dnl ===================================================================
6679 if test "$_os" != "WINNT"; then
6681     AC_CHECK_SIZEOF(long)
6682     AC_CHECK_SIZEOF(short)
6683     AC_CHECK_SIZEOF(int)
6684     AC_CHECK_SIZEOF(long long)
6685     AC_CHECK_SIZEOF(double)
6686     AC_CHECK_SIZEOF(void*)
6688     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
6689     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
6690     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
6691     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
6692     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6694     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6695     m4_pattern_allow([AC_CHECK_ALIGNOF])
6696     m4_ifdef([AC_CHECK_ALIGNOF],
6697         [
6698             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6699             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6700             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6701             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6702         ],
6703         [
6704             case "$_os-$host_cpu" in
6705             Linux-i686)
6706                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6707                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6708                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6709                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6710                 ;;
6711             Linux-x86_64)
6712                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6713                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6714                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6715                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6716                 ;;
6717             *)
6718                 if test -z "$ac_cv_alignof_short" -o \
6719                         -z "$ac_cv_alignof_int" -o \
6720                         -z "$ac_cv_alignof_long" -o \
6721                         -z "$ac_cv_alignof_double"; then
6722                    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.])
6723                 fi
6724                 ;;
6725             esac
6726         ])
6728     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6729     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6730     if test $ac_cv_sizeof_long -eq 8; then
6731         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6732     elif test $ac_cv_sizeof_double -eq 8; then
6733         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6734     else
6735         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6736     fi
6738     dnl Check for large file support
6739     AC_SYS_LARGEFILE
6740     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6741         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6742     fi
6743     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6744         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6745     fi
6746 else
6747     # Hardcode for MSVC
6748     SAL_TYPES_SIZEOFSHORT=2
6749     SAL_TYPES_SIZEOFINT=4
6750     SAL_TYPES_SIZEOFLONG=4
6751     SAL_TYPES_SIZEOFLONGLONG=8
6752     if test $WIN_HOST_BITS -eq 32; then
6753         SAL_TYPES_SIZEOFPOINTER=4
6754     else
6755         SAL_TYPES_SIZEOFPOINTER=8
6756     fi
6757     SAL_TYPES_ALIGNMENT2=2
6758     SAL_TYPES_ALIGNMENT4=4
6759     SAL_TYPES_ALIGNMENT8=8
6760     LFS_CFLAGS=''
6762 AC_SUBST(LFS_CFLAGS)
6764 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6765 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6766 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6767 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6768 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6769 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6770 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6771 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6773 dnl ===================================================================
6774 dnl Check whether to enable runtime optimizations
6775 dnl ===================================================================
6776 ENABLE_RUNTIME_OPTIMIZATIONS=
6777 AC_MSG_CHECKING([whether to enable runtime optimizations])
6778 if test -z "$enable_runtime_optimizations"; then
6779     for i in $CC; do
6780         case $i in
6781         -fsanitize=*)
6782             enable_runtime_optimizations=no
6783             break
6784             ;;
6785         esac
6786     done
6788 if test "$enable_runtime_optimizations" != no; then
6789     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6790     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6791     AC_MSG_RESULT([yes])
6792 else
6793     AC_MSG_RESULT([no])
6795 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6797 dnl ===================================================================
6798 dnl Check if valgrind headers are available
6799 dnl ===================================================================
6800 ENABLE_VALGRIND=
6801 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6802     prev_cppflags=$CPPFLAGS
6803     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6804     # or where does it come from?
6805     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6806     AC_CHECK_HEADER([valgrind/valgrind.h],
6807         [ENABLE_VALGRIND=TRUE])
6808     CPPFLAGS=$prev_cppflags
6810 AC_SUBST([ENABLE_VALGRIND])
6811 if test -z "$ENABLE_VALGRIND"; then
6812     if test "$with_valgrind" = yes; then
6813         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6814     fi
6815     VALGRIND_CFLAGS=
6817 AC_SUBST([VALGRIND_CFLAGS])
6820 dnl ===================================================================
6821 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6822 dnl ===================================================================
6824 # We need at least the sys/sdt.h include header.
6825 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6826 if test "$SDT_H_FOUND" = "TRUE"; then
6827     # Found sys/sdt.h header, now make sure the c++ compiler works.
6828     # Old g++ versions had problems with probes in constructors/destructors.
6829     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6830     AC_LANG_PUSH([C++])
6831     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6832     #include <sys/sdt.h>
6833     class ProbeClass
6834     {
6835     private:
6836       int& ref;
6837       const char *name;
6839     public:
6840       ProbeClass(int& v, const char *n) : ref(v), name(n)
6841       {
6842         DTRACE_PROBE2(_test_, cons, name, ref);
6843       }
6845       void method(int min)
6846       {
6847         DTRACE_PROBE3(_test_, meth, name, ref, min);
6848         ref -= min;
6849       }
6851       ~ProbeClass()
6852       {
6853         DTRACE_PROBE2(_test_, dest, name, ref);
6854       }
6855     };
6856     ]],[[
6857     int i = 64;
6858     DTRACE_PROBE1(_test_, call, i);
6859     ProbeClass inst = ProbeClass(i, "call");
6860     inst.method(24);
6861     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6862           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6863     AC_LANG_POP([C++])
6865 AC_CONFIG_HEADERS([config_host/config_probes.h])
6867 dnl ===================================================================
6868 dnl GCC features
6869 dnl ===================================================================
6870 HAVE_GCC_STACK_CLASH_PROTECTION=
6871 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6872     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
6873     save_CFLAGS=$CFLAGS
6874     CFLAGS="$CFLAGS -Werror -fstack-clash-protection"
6875     AC_LINK_IFELSE(
6876         [AC_LANG_PROGRAM(, [[return 0;]])],
6877         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
6878         [AC_MSG_RESULT([no])])
6879     CFLAGS=$save_CFLAGS
6881     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6882     save_CFLAGS=$CFLAGS
6883     CFLAGS="$CFLAGS -Werror -mno-avx"
6884     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6885     CFLAGS=$save_CFLAGS
6886     if test "$HAVE_GCC_AVX" = "TRUE"; then
6887         AC_MSG_RESULT([yes])
6888     else
6889         AC_MSG_RESULT([no])
6890     fi
6892     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
6893     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6894     int v = 0;
6895     if (__sync_add_and_fetch(&v, 1) != 1 ||
6896         __sync_sub_and_fetch(&v, 1) != 0)
6897         return 1;
6898     __sync_synchronize();
6899     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6900         v != 1)
6901         return 1;
6902     return 0;
6903 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6904     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6905         AC_MSG_RESULT([yes])
6906         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6907     else
6908         AC_MSG_RESULT([no])
6909     fi
6911     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
6912     AC_LANG_PUSH([C++])
6913     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6914             #include <cstddef>
6915             #include <cxxabi.h>
6916             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6917         ])], [
6918             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6919             AC_MSG_RESULT([yes])
6920         ], [AC_MSG_RESULT([no])])
6921     AC_LANG_POP([C++])
6923     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
6924     AC_LANG_PUSH([C++])
6925     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6926             #include <cstddef>
6927             #include <cxxabi.h>
6928             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6929         ])], [
6930             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6931             AC_MSG_RESULT([yes])
6932         ], [AC_MSG_RESULT([no])])
6933     AC_LANG_POP([C++])
6935     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
6936     AC_LANG_PUSH([C++])
6937     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6938             #include <cxxabi.h>
6939             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6940         ])], [
6941             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6942             AC_MSG_RESULT([yes])
6943         ], [AC_MSG_RESULT([no])])
6944     AC_LANG_POP([C++])
6946     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
6947     AC_LANG_PUSH([C++])
6948     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6949             #include <cstddef>
6950             #include <cxxabi.h>
6951             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6952         ])], [
6953             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6954             AC_MSG_RESULT([yes])
6955         ], [AC_MSG_RESULT([no])])
6956     AC_LANG_POP([C++])
6958     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exception in cxxabi.h])
6959     AC_LANG_PUSH([C++])
6960     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6961             #include <cstddef>
6962             #include <cxxabi.h>
6963             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exception); }
6964         ])], [
6965             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTION],[1])
6966             AC_MSG_RESULT([yes])
6967         ], [AC_MSG_RESULT([no])])
6968     AC_LANG_POP([C++])
6970     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
6971     AC_LANG_PUSH([C++])
6972     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6973             #include <cxxabi.h>
6974             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6975         ])], [
6976             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6977             AC_MSG_RESULT([yes])
6978         ], [AC_MSG_RESULT([no])])
6979     AC_LANG_POP([C++])
6981     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
6982     AC_LANG_PUSH([C++])
6983     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6984             #include <cxxabi.h>
6985             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6986         ])], [
6987             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6988             AC_MSG_RESULT([yes])
6989         ], [AC_MSG_RESULT([no])])
6990     AC_LANG_POP([C++])
6992     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
6993     AC_LANG_PUSH([C++])
6994     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6995             #include <cxxabi.h>
6996             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6997         ])], [
6998             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6999             AC_MSG_RESULT([yes])
7000         ], [AC_MSG_RESULT([no])])
7001     AC_LANG_POP([C++])
7003     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
7004     AC_LANG_PUSH([C++])
7005     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7006             #include <cstddef>
7007             #include <cxxabi.h>
7008             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
7009         ])], [
7010             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
7011             AC_MSG_RESULT([yes])
7012         ], [AC_MSG_RESULT([no])])
7013     AC_LANG_POP([C++])
7015     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
7016     AC_LANG_PUSH([C++])
7017     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7018             #include <cstddef>
7019             #include <cxxabi.h>
7020             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
7021         ])], [
7022             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
7023             AC_MSG_RESULT([yes])
7024         ], [AC_MSG_RESULT([no])])
7025     AC_LANG_POP([C++])
7028 AC_SUBST(HAVE_GCC_AVX)
7029 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
7030 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
7032 dnl ===================================================================
7033 dnl Identify the C++ library
7034 dnl ===================================================================
7036 AC_MSG_CHECKING([what the C++ library is])
7037 AC_LANG_PUSH([C++])
7038 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7039 #include <utility>
7040 #ifndef __GLIBCXX__
7041 foo bar
7042 #endif
7043 ]])],
7044     [CPP_LIBRARY=GLIBCXX
7045      cpp_library_name="GNU libstdc++"
7046     ],
7047     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7048 #include <utility>
7049 #ifndef _LIBCPP_VERSION
7050 foo bar
7051 #endif
7052 ]])],
7053     [CPP_LIBRARY=LIBCPP
7054      cpp_library_name="LLVM libc++"
7055      AC_DEFINE([HAVE_LIBCXX])
7056     ],
7057     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7058 #include <utility>
7059 #ifndef _MSC_VER
7060 foo bar
7061 #endif
7062 ]])],
7063     [CPP_LIBRARY=MSVCRT
7064      cpp_library_name="Microsoft"
7065     ],
7066     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
7067 AC_MSG_RESULT([$cpp_library_name])
7068 AC_LANG_POP([C++])
7070 dnl ===================================================================
7071 dnl Check for gperf
7072 dnl ===================================================================
7073 AC_PATH_PROG(GPERF, gperf)
7074 if test -z "$GPERF"; then
7075     AC_MSG_ERROR([gperf not found but needed. Install it.])
7077 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7078     GPERF=`cygpath -m $GPERF`
7080 AC_MSG_CHECKING([whether gperf is new enough])
7081 my_gperf_ver1=$($GPERF --version | head -n 1)
7082 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
7083 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
7084 if test "$my_gperf_ver3" -ge 301; then
7085     AC_MSG_RESULT([yes ($my_gperf_ver2)])
7086 else
7087     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
7089 AC_SUBST(GPERF)
7091 dnl ===================================================================
7092 dnl Check for system libcmis
7093 dnl ===================================================================
7094 # libcmis requires curl and we can't build curl for iOS
7095 if test $_os != iOS; then
7096     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
7097     ENABLE_LIBCMIS=TRUE
7098 else
7099     ENABLE_LIBCMIS=
7101 AC_SUBST(ENABLE_LIBCMIS)
7103 dnl ===================================================================
7104 dnl C++11
7105 dnl ===================================================================
7107 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
7108 CXXFLAGS_CXX11=
7109 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
7110     if test "$with_latest_c__" = yes; then
7111         CXXFLAGS_CXX11=-std:c++latest
7112     else
7113         CXXFLAGS_CXX11=-std:c++17
7114     fi
7115     CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -Zc:__cplusplus"
7116 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7117     my_flags='-std=c++17 -std=c++1z'
7118     if test "$with_latest_c__" = yes; then
7119         my_flags="-std=c++20 -std=c++2a $my_flags"
7120     fi
7121     for flag in $my_flags; do
7122         if test "$COM" = MSC; then
7123             flag="-Xclang $flag"
7124         fi
7125         save_CXXFLAGS=$CXXFLAGS
7126         CXXFLAGS="$CXXFLAGS $flag -Werror"
7127         if test "$SYSTEM_LIBCMIS" = TRUE; then
7128             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
7129         fi
7130         AC_LANG_PUSH([C++])
7131         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7132             #include <algorithm>
7133             #include <functional>
7134             #include <vector>
7136             #if defined SYSTEM_LIBCMIS
7137             // See ucb/source/ucp/cmis/auth_provider.hxx:
7138             #if !defined __clang__
7139             #pragma GCC diagnostic push
7140             #pragma GCC diagnostic ignored "-Wdeprecated"
7141             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
7142             #endif
7143             #include <libcmis/libcmis.hxx>
7144             #if !defined __clang__
7145             #pragma GCC diagnostic pop
7146             #endif
7147             #endif
7149             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
7150                 std::sort(v.begin(), v.end(), fn);
7151             }
7152             ]])],[CXXFLAGS_CXX11=$flag])
7153         AC_LANG_POP([C++])
7154         CXXFLAGS=$save_CXXFLAGS
7155         if test -n "$CXXFLAGS_CXX11"; then
7156             break
7157         fi
7158     done
7160 if test -n "$CXXFLAGS_CXX11"; then
7161     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
7162 else
7163     AC_MSG_ERROR(no)
7165 AC_SUBST(CXXFLAGS_CXX11)
7167 if test "$GCC" = "yes"; then
7168     save_CXXFLAGS=$CXXFLAGS
7169     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7170     CHECK_L_ATOMIC
7171     CXXFLAGS=$save_CXXFLAGS
7172     AC_SUBST(ATOMIC_LIB)
7175 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
7176 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
7177 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
7178 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
7179 dnl again towards 4.7.2:
7180 if test $CPP_LIBRARY = GLIBCXX; then
7181     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
7182     AC_LANG_PUSH([C++])
7183     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7184 #include <list>
7185 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
7186     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
7187     //   GCC 4.7.0: 20120322
7188     //   GCC 4.7.1: 20120614
7189     // and using a range check is not possible as the mapping between
7190     // __GLIBCXX__ values and GCC versions is not monotonic
7191 /* ok */
7192 #else
7193 abi broken
7194 #endif
7195         ]])], [AC_MSG_RESULT(no, ok)],
7196         [AC_MSG_ERROR(yes)])
7197     AC_LANG_POP([C++])
7200 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
7201 save_CXXFLAGS=$CXXFLAGS
7202 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7203 AC_LANG_PUSH([C++])
7205 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7206 #include <stddef.h>
7208 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
7210 namespace
7212         struct b
7213         {
7214                 int i;
7215                 int j;
7216         };
7218 ]], [[
7219 struct a
7221         int i;
7222         int j;
7224 a thinga[]={{0,0}, {1,1}};
7225 b thingb[]={{0,0}, {1,1}};
7226 size_t i = sizeof(sal_n_array_size(thinga));
7227 size_t j = sizeof(sal_n_array_size(thingb));
7228 return !(i != 0 && j != 0);
7230     ], [ AC_MSG_RESULT(yes) ],
7231     [ AC_MSG_ERROR(no)])
7232 AC_LANG_POP([C++])
7233 CXXFLAGS=$save_CXXFLAGS
7235 HAVE_GCC_FNO_SIZED_DEALLOCATION=
7236 if test "$GCC" = yes; then
7237     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
7238     AC_LANG_PUSH([C++])
7239     save_CXXFLAGS=$CXXFLAGS
7240     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
7241     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
7242     CXXFLAGS=$save_CXXFLAGS
7243     AC_LANG_POP([C++])
7244     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
7245         AC_MSG_RESULT([yes])
7246     else
7247         AC_MSG_RESULT([no])
7248     fi
7250 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
7252 AC_MSG_CHECKING([whether $CXX_BASE supports a working C++20 consteval])
7253 dnl ...that does not suffer from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96994> "Missing code
7254 dnl from consteval constructor initializing const variable":
7255 AC_LANG_PUSH([C++])
7256 save_CXXFLAGS=$CXXFLAGS
7257 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7258 AC_RUN_IFELSE([AC_LANG_PROGRAM([
7259         struct S {
7260             consteval S() { i = 1; }
7261             int i = 0;
7262         };
7263         S const s;
7264     ], [
7265         return (s.i == 1) ? 0 : 1;
7266     ])], [
7267         AC_DEFINE([HAVE_CPP_CONSTEVAL],[1])
7268         AC_MSG_RESULT([yes])
7269     ], [AC_MSG_RESULT([no])], [AC_MSG_RESULT([assumed no (cross compiling)])])
7270 CXXFLAGS=$save_CXXFLAGS
7271 AC_LANG_POP([C++])
7273 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
7274 AC_LANG_PUSH([C++])
7275 save_CXXFLAGS=$CXXFLAGS
7276 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7277 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7278         #include <algorithm>
7279         #include <initializer_list>
7280         #include <vector>
7281         template<typename T> class S {
7282         private:
7283             std::vector<T> v_;
7284         public:
7285             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
7286         };
7287         constinit S<int> s{3, 2, 1};
7288     ])], [
7289         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
7290         AC_MSG_RESULT([yes])
7291     ], [AC_MSG_RESULT([no])])
7292 CXXFLAGS=$save_CXXFLAGS
7293 AC_LANG_POP([C++])
7295 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
7296 AC_LANG_PUSH([C++])
7297 save_CXXFLAGS=$CXXFLAGS
7298 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7299 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7300         #include <span>
7301         #include <type_traits>
7302         // Don't check size_type directly, as it was called index_type before P1872R0:
7303         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
7304     ])], [
7305         AC_DEFINE([HAVE_CPP_SPAN],[1])
7306         AC_MSG_RESULT([yes])
7307     ], [AC_MSG_RESULT([no])])
7308 CXXFLAGS=$save_CXXFLAGS
7309 AC_LANG_POP([C++])
7311 AC_MSG_CHECKING([whether $CXX_BASE implements C++ DR P1155R3])
7312 AC_LANG_PUSH([C++])
7313 save_CXXFLAGS=$CXXFLAGS
7314 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7315 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7316         struct S1 { S1(S1 &&); };
7317         struct S2: S1 {};
7318         S1 f(S2 s) { return s; }
7319     ])], [
7320         AC_DEFINE([HAVE_P1155R3],[1])
7321         AC_MSG_RESULT([yes])
7322     ], [AC_MSG_RESULT([no])])
7323 CXXFLAGS=$save_CXXFLAGS
7324 AC_LANG_POP([C++])
7326 dnl Supported since GCC 9 and Clang 10 (which each also started to support -Wdeprecated-copy, but
7327 dnl which is included in -Wextra anyway):
7328 HAVE_WDEPRECATED_COPY_DTOR=
7329 if test "$GCC" = yes; then
7330     AC_MSG_CHECKING([whether $CXX_BASE supports -Wdeprecated-copy-dtor])
7331     AC_LANG_PUSH([C++])
7332     save_CXXFLAGS=$CXXFLAGS
7333     CXXFLAGS="$CXXFLAGS -Werror -Wdeprecated-copy-dtor"
7334     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
7335             HAVE_WDEPRECATED_COPY_DTOR=TRUE
7336             AC_MSG_RESULT([yes])
7337         ], [AC_MSG_RESULT([no])])
7338     CXXFLAGS=$save_CXXFLAGS
7339     AC_LANG_POP([C++])
7341 AC_SUBST([HAVE_WDEPRECATED_COPY_DTOR])
7343 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
7344 dnl uninitialized warning for code like
7346 dnl   OString f();
7347 dnl   boost::optional<OString> * g(bool b) {
7348 dnl       boost::optional<OString> o;
7349 dnl       if (b) o = f();
7350 dnl       return new boost::optional<OString>(o);
7351 dnl   }
7353 dnl (as is e.g. present, in a slightly more elaborate form, in
7354 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
7355 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
7356 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
7357 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7358     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
7359     AC_LANG_PUSH([C++])
7360     save_CXXFLAGS=$CXXFLAGS
7361     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
7362     if test "$ENABLE_OPTIMIZED" = TRUE; then
7363         CXXFLAGS="$CXXFLAGS -O2"
7364     else
7365         CXXFLAGS="$CXXFLAGS -O0"
7366     fi
7367     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7368             #include <new>
7369             void f1(int);
7370             struct S1 {
7371                 ~S1() { f1(n); }
7372                 int n = 0;
7373             };
7374             struct S2 {
7375                 S2() {}
7376                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
7377                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
7378                 void set(S1 s) {
7379                     new (stg) S1(s);
7380                     init = true;
7381                 }
7382                 bool init = false;
7383                 char stg[sizeof (S1)];
7384             } ;
7385             S1 f2();
7386             S2 * f3(bool b) {
7387                 S2 o;
7388                 if (b) o.set(f2());
7389                 return new S2(o);
7390             }
7391         ]])], [AC_MSG_RESULT([no])], [
7392             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
7393             AC_MSG_RESULT([yes])
7394         ])
7395     CXXFLAGS=$save_CXXFLAGS
7396     AC_LANG_POP([C++])
7398 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
7400 dnl Check for <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c5> "[8/9/10/11 Regression]
7401 dnl -Wstringop-overflow false positive due to using MEM_REF type of &MEM" (fixed in GCC 11), which
7402 dnl hits us e.g. with GCC 10 and --enable-optimized at
7404 dnl   In file included from include/rtl/string.hxx:49,
7405 dnl                    from include/rtl/ustring.hxx:43,
7406 dnl                    from include/osl/file.hxx:35,
7407 dnl                    from include/codemaker/global.hxx:28,
7408 dnl                    from include/codemaker/options.hxx:23,
7409 dnl                    from codemaker/source/commoncpp/commoncpp.cxx:24:
7410 dnl   In function â€˜char* rtl::addDataHelper(char*, const char*, std::size_t)’,
7411 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,
7412 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,
7413 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,
7414 dnl       inlined from â€˜rtl::OString codemaker::cpp::scopedCppName(const rtl::OString&, bool)’ at codemaker/source/commoncpp/commoncpp.cxx:53:55:
7415 dnl   include/rtl/stringconcat.hxx:78:15: error: writing 2 bytes into a region of size 1 [-Werror=stringop-overflow=]
7416 dnl      78 |         memcpy( buffer, data, length );
7417 dnl         |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
7418 HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=
7419 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7420     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=stringop-overflow=])
7421     AC_LANG_PUSH([C++])
7422     save_CXXFLAGS=$CXXFLAGS
7423     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wstringop-overflow"
7424     if test "$ENABLE_OPTIMIZED" = TRUE; then
7425         CXXFLAGS="$CXXFLAGS -O2"
7426     else
7427         CXXFLAGS="$CXXFLAGS -O0"
7428     fi
7429     dnl Test code taken from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c0>:
7430     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7431             void fill(char const * begin, char const * end, char c);
7432             struct q {
7433                 char ids[4];
7434                 char username[6];
7435             };
7436             void test(q & c) {
7437                 fill(c.ids, c.ids + sizeof(c.ids), '\0');
7438                 __builtin_strncpy(c.username, "root", sizeof(c.username));
7439             }
7440         ]])], [AC_MSG_RESULT([no])], [
7441             HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=TRUE
7442             AC_MSG_RESULT([yes])
7443         ])
7444     CXXFLAGS=$save_CXXFLAGS
7445     AC_LANG_POP([C++])
7447 AC_SUBST([HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW])
7449 dnl ===================================================================
7450 dnl CPU Intrinsics support - SSE, AVX
7451 dnl ===================================================================
7453 CXXFLAGS_INTRINSICS_SSE2=
7454 CXXFLAGS_INTRINSICS_SSSE3=
7455 CXXFLAGS_INTRINSICS_SSE41=
7456 CXXFLAGS_INTRINSICS_SSE42=
7457 CXXFLAGS_INTRINSICS_AVX=
7458 CXXFLAGS_INTRINSICS_AVX2=
7459 CXXFLAGS_INTRINSICS_AVX512=
7460 CXXFLAGS_INTRINSICS_F16C=
7461 CXXFLAGS_INTRINSICS_FMA=
7463 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7464     # GCC, Clang or Clang-cl (clang-cl + MSVC's -arch options don't work well together)
7465     flag_sse2=-msse2
7466     flag_ssse3=-mssse3
7467     flag_sse41=-msse4.1
7468     flag_sse42=-msse4.2
7469     flag_avx=-mavx
7470     flag_avx2=-mavx2
7471     flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
7472     flag_f16c=-mf16c
7473     flag_fma=-mfma
7474 else
7475     # https://docs.microsoft.com/en-us/cpp/build/reference/arch-x86
7476     # MSVC seems to differentiate only between SSE and SSE2, where in fact
7477     # SSE2 seems to be SSE2+.
7478     # Even if -arch:SSE2 is the default, set it explicitly, so that the variable
7479     # is not empty (and can be tested in gbuild).
7480     flag_sse2=-arch:SSE2
7481     flag_ssse3=-arch:SSE2
7482     flag_sse41=-arch:SSE2
7483     flag_sse42=-arch:SSE2
7484     flag_avx=-arch:AVX
7485     flag_avx2=-arch:AVX2
7486     flag_avx512=-arch:AVX512
7487     # These are part of -arch:AVX2
7488     flag_f16c=-arch:AVX2
7489     flag_fma=-arch:AVX2
7492 AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
7493 AC_LANG_PUSH([C++])
7494 save_CXXFLAGS=$CXXFLAGS
7495 CXXFLAGS="$CXXFLAGS $flag_sse2"
7496 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7497     #include <emmintrin.h>
7498     int main () {
7499         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7500         c = _mm_xor_si128 (a, b);
7501         return 0;
7502     }
7503     ])],
7504     [can_compile_sse2=yes],
7505     [can_compile_sse2=no])
7506 AC_LANG_POP([C++])
7507 CXXFLAGS=$save_CXXFLAGS
7508 AC_MSG_RESULT([${can_compile_sse2}])
7509 if test "${can_compile_sse2}" = "yes" ; then
7510     CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
7513 AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
7514 AC_LANG_PUSH([C++])
7515 save_CXXFLAGS=$CXXFLAGS
7516 CXXFLAGS="$CXXFLAGS $flag_ssse3"
7517 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7518     #include <tmmintrin.h>
7519     int main () {
7520         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7521         c = _mm_maddubs_epi16 (a, b);
7522         return 0;
7523     }
7524     ])],
7525     [can_compile_ssse3=yes],
7526     [can_compile_ssse3=no])
7527 AC_LANG_POP([C++])
7528 CXXFLAGS=$save_CXXFLAGS
7529 AC_MSG_RESULT([${can_compile_ssse3}])
7530 if test "${can_compile_ssse3}" = "yes" ; then
7531     CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
7534 AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
7535 AC_LANG_PUSH([C++])
7536 save_CXXFLAGS=$CXXFLAGS
7537 CXXFLAGS="$CXXFLAGS $flag_sse41"
7538 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7539     #include <smmintrin.h>
7540     int main () {
7541         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7542         c = _mm_cmpeq_epi64 (a, b);
7543         return 0;
7544     }
7545     ])],
7546     [can_compile_sse41=yes],
7547     [can_compile_sse41=no])
7548 AC_LANG_POP([C++])
7549 CXXFLAGS=$save_CXXFLAGS
7550 AC_MSG_RESULT([${can_compile_sse41}])
7551 if test "${can_compile_sse41}" = "yes" ; then
7552     CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
7555 AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
7556 AC_LANG_PUSH([C++])
7557 save_CXXFLAGS=$CXXFLAGS
7558 CXXFLAGS="$CXXFLAGS $flag_sse42"
7559 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7560     #include <nmmintrin.h>
7561     int main () {
7562         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7563         c = _mm_cmpgt_epi64 (a, b);
7564         return 0;
7565     }
7566     ])],
7567     [can_compile_sse42=yes],
7568     [can_compile_sse42=no])
7569 AC_LANG_POP([C++])
7570 CXXFLAGS=$save_CXXFLAGS
7571 AC_MSG_RESULT([${can_compile_sse42}])
7572 if test "${can_compile_sse42}" = "yes" ; then
7573     CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
7576 AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
7577 AC_LANG_PUSH([C++])
7578 save_CXXFLAGS=$CXXFLAGS
7579 CXXFLAGS="$CXXFLAGS $flag_avx"
7580 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7581     #include <immintrin.h>
7582     int main () {
7583         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
7584         c = _mm256_xor_ps(a, b);
7585         return 0;
7586     }
7587     ])],
7588     [can_compile_avx=yes],
7589     [can_compile_avx=no])
7590 AC_LANG_POP([C++])
7591 CXXFLAGS=$save_CXXFLAGS
7592 AC_MSG_RESULT([${can_compile_avx}])
7593 if test "${can_compile_avx}" = "yes" ; then
7594     CXXFLAGS_INTRINSICS_AVX="$flag_avx"
7597 AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
7598 AC_LANG_PUSH([C++])
7599 save_CXXFLAGS=$CXXFLAGS
7600 CXXFLAGS="$CXXFLAGS $flag_avx2"
7601 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7602     #include <immintrin.h>
7603     int main () {
7604         __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
7605         c = _mm256_maddubs_epi16(a, b);
7606         return 0;
7607     }
7608     ])],
7609     [can_compile_avx2=yes],
7610     [can_compile_avx2=no])
7611 AC_LANG_POP([C++])
7612 CXXFLAGS=$save_CXXFLAGS
7613 AC_MSG_RESULT([${can_compile_avx2}])
7614 if test "${can_compile_avx2}" = "yes" ; then
7615     CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
7618 AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
7619 AC_LANG_PUSH([C++])
7620 save_CXXFLAGS=$CXXFLAGS
7621 CXXFLAGS="$CXXFLAGS $flag_avx512"
7622 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7623     #include <immintrin.h>
7624     int main () {
7625         __m512i a = _mm512_loadu_si512(0);
7626         return 0;
7627     }
7628     ])],
7629     [can_compile_avx512=yes],
7630     [can_compile_avx512=no])
7631 AC_LANG_POP([C++])
7632 CXXFLAGS=$save_CXXFLAGS
7633 AC_MSG_RESULT([${can_compile_avx512}])
7634 if test "${can_compile_avx512}" = "yes" ; then
7635     CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
7638 AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
7639 AC_LANG_PUSH([C++])
7640 save_CXXFLAGS=$CXXFLAGS
7641 CXXFLAGS="$CXXFLAGS $flag_f16c"
7642 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7643     #include <immintrin.h>
7644     int main () {
7645         __m128i a = _mm_set1_epi32 (0);
7646         __m128 c;
7647         c = _mm_cvtph_ps(a);
7648         return 0;
7649     }
7650     ])],
7651     [can_compile_f16c=yes],
7652     [can_compile_f16c=no])
7653 AC_LANG_POP([C++])
7654 CXXFLAGS=$save_CXXFLAGS
7655 AC_MSG_RESULT([${can_compile_f16c}])
7656 if test "${can_compile_f16c}" = "yes" ; then
7657     CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
7660 AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
7661 AC_LANG_PUSH([C++])
7662 save_CXXFLAGS=$CXXFLAGS
7663 CXXFLAGS="$CXXFLAGS $flag_fma"
7664 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7665     #include <immintrin.h>
7666     int main () {
7667         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
7668         d = _mm256_fmadd_ps(a, b, c);
7669         return 0;
7670     }
7671     ])],
7672     [can_compile_fma=yes],
7673     [can_compile_fma=no])
7674 AC_LANG_POP([C++])
7675 CXXFLAGS=$save_CXXFLAGS
7676 AC_MSG_RESULT([${can_compile_fma}])
7677 if test "${can_compile_fma}" = "yes" ; then
7678     CXXFLAGS_INTRINSICS_FMA="$flag_fma"
7681 AC_SUBST([CXXFLAGS_INTRINSICS_SSE2])
7682 AC_SUBST([CXXFLAGS_INTRINSICS_SSSE3])
7683 AC_SUBST([CXXFLAGS_INTRINSICS_SSE41])
7684 AC_SUBST([CXXFLAGS_INTRINSICS_SSE42])
7685 AC_SUBST([CXXFLAGS_INTRINSICS_AVX])
7686 AC_SUBST([CXXFLAGS_INTRINSICS_AVX2])
7687 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512])
7688 AC_SUBST([CXXFLAGS_INTRINSICS_F16C])
7689 AC_SUBST([CXXFLAGS_INTRINSICS_FMA])
7691 dnl ===================================================================
7692 dnl system stl sanity tests
7693 dnl ===================================================================
7694 if test "$_os" != "WINNT"; then
7696     AC_LANG_PUSH([C++])
7698     save_CPPFLAGS="$CPPFLAGS"
7699     if test -n "$MACOSX_SDK_PATH"; then
7700         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
7701     fi
7703     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
7704     # only.
7705     if test "$CPP_LIBRARY" = GLIBCXX; then
7706         dnl gcc#19664, gcc#22482, rhbz#162935
7707         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
7708         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
7709         AC_MSG_RESULT([$stlvisok])
7710         if test "$stlvisok" = "no"; then
7711             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
7712         fi
7713     fi
7715     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
7716     # when we don't make any dynamic libraries?
7717     if test "$DISABLE_DYNLOADING" = ""; then
7718         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
7719         cat > conftestlib1.cc <<_ACEOF
7720 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7721 struct S2: S1<int> { virtual ~S2(); };
7722 S2::~S2() {}
7723 _ACEOF
7724         cat > conftestlib2.cc <<_ACEOF
7725 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7726 struct S2: S1<int> { virtual ~S2(); };
7727 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
7728 _ACEOF
7729         gccvisinlineshiddenok=yes
7730         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
7731             gccvisinlineshiddenok=no
7732         else
7733             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
7734             dnl known to not work with -z defs (unsetting which makes the test
7735             dnl moot, though):
7736             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
7737             if test "$COM_IS_CLANG" = TRUE; then
7738                 for i in $CXX $CXXFLAGS; do
7739                     case $i in
7740                     -fsanitize=*)
7741                         my_linkflagsnoundefs=
7742                         break
7743                         ;;
7744                     esac
7745                 done
7746             fi
7747             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
7748                 gccvisinlineshiddenok=no
7749             fi
7750         fi
7752         rm -fr libconftest*
7753         AC_MSG_RESULT([$gccvisinlineshiddenok])
7754         if test "$gccvisinlineshiddenok" = "no"; then
7755             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
7756         fi
7757     fi
7759    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
7760     cat >visibility.cxx <<_ACEOF
7761 #pragma GCC visibility push(hidden)
7762 struct __attribute__ ((visibility ("default"))) TestStruct {
7763   static void Init();
7765 __attribute__ ((visibility ("default"))) void TestFunc() {
7766   TestStruct::Init();
7768 _ACEOF
7769     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
7770         gccvisbroken=yes
7771     else
7772         case "$host_cpu" in
7773         i?86|x86_64)
7774             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
7775                 gccvisbroken=no
7776             else
7777                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
7778                     gccvisbroken=no
7779                 else
7780                     gccvisbroken=yes
7781                 fi
7782             fi
7783             ;;
7784         *)
7785             gccvisbroken=no
7786             ;;
7787         esac
7788     fi
7789     rm -f visibility.s visibility.cxx
7791     AC_MSG_RESULT([$gccvisbroken])
7792     if test "$gccvisbroken" = "yes"; then
7793         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
7794     fi
7796     CPPFLAGS="$save_CPPFLAGS"
7798     AC_LANG_POP([C++])
7801 dnl ===================================================================
7802 dnl  Clang++ tests
7803 dnl ===================================================================
7805 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
7806 if test "$GCC" = "yes"; then
7807     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
7808     AC_LANG_PUSH([C++])
7809     save_CXXFLAGS=$CXXFLAGS
7810     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
7811     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
7812     CXXFLAGS=$save_CXXFLAGS
7813     AC_LANG_POP([C++])
7814     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
7815         AC_MSG_RESULT([yes])
7816     else
7817         AC_MSG_RESULT([no])
7818     fi
7820 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
7822 dnl ===================================================================
7823 dnl Compiler plugins
7824 dnl ===================================================================
7826 COMPILER_PLUGINS=
7827 # currently only Clang
7829 if test "$COM_IS_CLANG" != "TRUE"; then
7830     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
7831         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
7832         enable_compiler_plugins=no
7833     fi
7836 COMPILER_PLUGINS_COM_IS_CLANG=
7837 if test "$COM_IS_CLANG" = "TRUE"; then
7838     if test -n "$enable_compiler_plugins"; then
7839         compiler_plugins="$enable_compiler_plugins"
7840     elif test -n "$ENABLE_DBGUTIL"; then
7841         compiler_plugins=test
7842     else
7843         compiler_plugins=no
7844     fi
7845     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
7846         if test "$CLANGVER" -lt 50002; then
7847             if test "$compiler_plugins" = yes; then
7848                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
7849             else
7850                 compiler_plugins=no
7851             fi
7852         fi
7853     fi
7854     if test "$compiler_plugins" != "no"; then
7855         dnl The prefix where Clang resides, override to where Clang resides if
7856         dnl using a source build:
7857         if test -z "$CLANGDIR"; then
7858             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $(printf '%s\n' $CXX | head -n 1)))))
7859         fi
7860         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
7861         if test -z "$COMPILER_PLUGINS_CXX"; then
7862             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
7863         fi
7864         clangbindir=$CLANGDIR/bin
7865         if test "$build_os" = "cygwin"; then
7866             clangbindir=$(cygpath -u "$clangbindir")
7867         fi
7868         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
7869         if test -n "$LLVM_CONFIG"; then
7870             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
7871             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
7872             if test -z "$CLANGLIBDIR"; then
7873                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
7874             fi
7875             # Try if clang is built from source (in which case its includes are not together with llvm includes).
7876             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
7877             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
7878             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
7879                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
7880             fi
7881             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
7882             clangobjdir=$($LLVM_CONFIG --obj-root)
7883             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
7884                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
7885             fi
7886         fi
7887         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
7888         AC_LANG_PUSH([C++])
7889         save_CXX=$CXX
7890         save_CXXCPP=$CXXCPP
7891         save_CPPFLAGS=$CPPFLAGS
7892         save_CXXFLAGS=$CXXFLAGS
7893         save_LDFLAGS=$LDFLAGS
7894         save_LIBS=$LIBS
7895         CXX=$COMPILER_PLUGINS_CXX
7896         CXXCPP="$COMPILER_PLUGINS_CXX -E"
7897         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7898         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7899         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
7900             [COMPILER_PLUGINS=TRUE],
7901             [
7902             if test "$compiler_plugins" = "yes"; then
7903                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
7904             else
7905                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
7906                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
7907             fi
7908             ])
7909         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
7910         dnl comment in compilerplugins/Makefile-clang.mk:
7911         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
7912             LDFLAGS=""
7913             AC_MSG_CHECKING([for clang libraries to use])
7914             if test -z "$CLANGTOOLLIBS"; then
7915                 LIBS="-lclangTooling -lclangFrontend -lclangDriver -lclangParse -lclangSema -lclangEdit \
7916  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
7917                 AC_LINK_IFELSE([
7918                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7919                         [[ clang::FullSourceLoc().dump(); ]])
7920                 ],[CLANGTOOLLIBS="$LIBS"],[])
7921             fi
7922             if test -z "$CLANGTOOLLIBS"; then
7923                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
7924                 AC_LINK_IFELSE([
7925                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7926                         [[ clang::FullSourceLoc().dump(); ]])
7927                 ],[CLANGTOOLLIBS="$LIBS"],[])
7928             fi
7929             AC_MSG_RESULT([$CLANGTOOLLIBS])
7930             if test -z "$CLANGTOOLLIBS"; then
7931                 if test "$compiler_plugins" = "yes"; then
7932                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
7933                 else
7934                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
7935                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
7936                 fi
7937                 COMPILER_PLUGINS=
7938             fi
7939             if test -n "$COMPILER_PLUGINS"; then
7940                 if test -z "$CLANGSYSINCLUDE"; then
7941                     if test -n "$LLVM_CONFIG"; then
7942                         # Path to the clang system headers (no idea if there's a better way to get it).
7943                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/git\|svn//')/include
7944                     fi
7945                 fi
7946             fi
7947         fi
7948         CXX=$save_CXX
7949         CXXCPP=$save_CXXCPP
7950         CPPFLAGS=$save_CPPFLAGS
7951         CXXFLAGS=$save_CXXFLAGS
7952         LDFLAGS=$save_LDFLAGS
7953         LIBS="$save_LIBS"
7954         AC_LANG_POP([C++])
7956         AC_MSG_CHECKING([whether the compiler for building compilerplugins is actually Clang])
7957         AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7958             #ifndef __clang__
7959             you lose
7960             #endif
7961             int foo=42;
7962             ]])],
7963             [AC_MSG_RESULT([yes])
7964              COMPILER_PLUGINS_COM_IS_CLANG=TRUE],
7965             [AC_MSG_RESULT([no])])
7966         AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
7967     fi
7968 else
7969     if test "$enable_compiler_plugins" = "yes"; then
7970         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
7971     fi
7973 COMPILER_PLUGINS_ANALYZER_PCH=
7974 if test "$enable_compiler_plugins_analyzer_pch" != no; then
7975     COMPILER_PLUGINS_ANALYZER_PCH=TRUE
7977 AC_SUBST(COMPILER_PLUGINS)
7978 AC_SUBST(COMPILER_PLUGINS_ANALYZER_PCH)
7979 AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
7980 AC_SUBST(COMPILER_PLUGINS_CXX)
7981 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
7982 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
7983 AC_SUBST(COMPILER_PLUGINS_DEBUG)
7984 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
7985 AC_SUBST(CLANGDIR)
7986 AC_SUBST(CLANGLIBDIR)
7987 AC_SUBST(CLANGTOOLLIBS)
7988 AC_SUBST(CLANGSYSINCLUDE)
7990 # Plugin to help linker.
7991 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
7992 # This makes --enable-lto build with clang work.
7993 AC_SUBST(LD_PLUGIN)
7995 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
7996 AC_SUBST(HAVE_POSIX_FALLOCATE)
7998 JITC_PROCESSOR_TYPE=""
7999 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
8000     # IBMs JDK needs this...
8001     JITC_PROCESSOR_TYPE=6
8002     export JITC_PROCESSOR_TYPE
8004 AC_SUBST([JITC_PROCESSOR_TYPE])
8006 # Misc Windows Stuff
8007 AC_ARG_WITH(ucrt-dir,
8008     AS_HELP_STRING([--with-ucrt-dir],
8009         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
8010         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
8011         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
8012             Windows6.1-KB2999226-x64.msu
8013             Windows6.1-KB2999226-x86.msu
8014             Windows8.1-KB2999226-x64.msu
8015             Windows8.1-KB2999226-x86.msu
8016             Windows8-RT-KB2999226-x64.msu
8017             Windows8-RT-KB2999226-x86.msu
8018         A zip archive including those files is available from Microsoft site:
8019         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
8022 UCRT_REDISTDIR="$with_ucrt_dir"
8023 if test $_os = "WINNT"; then
8024     find_msvc_x64_dlls
8025     for i in $PKGFORMAT; do
8026         if test "$i" = msi; then
8027             find_msms
8028             break
8029         fi
8030     done
8031     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
8032     MSVC_DLLS="$msvcdlls"
8033     test -n "$msmdir" && MSM_PATH=`win_short_path_for_make "$msmdir"`
8034     # MSVC 15.3 changed it to VC141
8035     if echo "$msvcdllpath" | grep -q "VC142.CRT$"; then
8036         SCPDEFS="$SCPDEFS -DWITH_VC142_REDIST"
8037     elif echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
8038         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
8039     else
8040         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
8041     fi
8043     if test "$UCRT_REDISTDIR" = "no"; then
8044         dnl explicitly disabled
8045         UCRT_REDISTDIR=""
8046     else
8047         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
8048                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
8049                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
8050                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
8051                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
8052                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
8053             UCRT_REDISTDIR=""
8054             if test -n "$PKGFORMAT"; then
8055                for i in $PKGFORMAT; do
8056                    case "$i" in
8057                    msi)
8058                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
8059                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
8060                        ;;
8061                    esac
8062                done
8063             fi
8064         fi
8065     fi
8068 AC_SUBST(UCRT_REDISTDIR)
8069 AC_SUBST(MSVC_DLL_PATH)
8070 AC_SUBST(MSVC_DLLS)
8071 AC_SUBST(MSM_PATH)
8073 dnl ===================================================================
8074 dnl Checks for Java
8075 dnl ===================================================================
8076 if test "$ENABLE_JAVA" != ""; then
8078     # Windows-specific tests
8079     if test "$build_os" = "cygwin"; then
8080         if test -z "$with_jdk_home"; then
8081             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
8082             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
8083             reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
8084             if test -n "$regvalue"; then
8085                 ver=$regvalue
8086                 reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
8087                 reg_jdk_home=$regvalue
8088             fi
8090             if test -f "$reg_jdk_home/lib/jvm.lib" -a -f "$reg_jdk_home/bin/java.exe"; then
8091                 with_jdk_home="$reg_jdk_home"
8092                 howfound="found automatically"
8093             else
8094                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $WIN_HOST_BITS-bit JDK >= 9])
8095             fi
8096         else
8097             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
8098             howfound="you passed"
8099         fi
8100     fi
8102     # 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.
8103     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
8104     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
8105         with_jdk_home=`/usr/libexec/java_home`
8106     fi
8108     JAVA_HOME=; export JAVA_HOME
8109     if test -z "$with_jdk_home"; then
8110         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
8111     else
8112         _java_path="$with_jdk_home/bin/$with_java"
8113         dnl Check if there is a Java interpreter at all.
8114         if test -x "$_java_path"; then
8115             JAVAINTERPRETER=$_java_path
8116         else
8117             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
8118         fi
8119     fi
8121     dnl Check that the JDK found is correct architecture (at least 2 reasons to
8122     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
8123     dnl loaded by java to run JunitTests:
8124     if test "$build_os" = "cygwin" -a "$cross_compiling" != "yes"; then
8125         shortjdkhome=`cygpath -d "$with_jdk_home"`
8126         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
8127             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
8128             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8129         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
8130             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8131             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8132         fi
8134         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
8135             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
8136         fi
8137         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
8138     elif test "$cross_compiling" != "yes"; then
8139         case $CPUNAME in
8140             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
8141                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
8142                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
8143                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8144                 fi
8145                 ;;
8146             *) # assumption: everything else 32-bit
8147                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
8148                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8149                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8150                 fi
8151                 ;;
8152         esac
8153     fi
8156 dnl ===================================================================
8157 dnl Checks for JDK.
8158 dnl ===================================================================
8160 # Whether all the complexity here actually is needed any more or not, no idea.
8162 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8163     _gij_longver=0
8164     AC_MSG_CHECKING([the installed JDK])
8165     if test -n "$JAVAINTERPRETER"; then
8166         dnl java -version sends output to stderr!
8167         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
8168             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8169         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
8170             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8171         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
8172             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8173         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
8174             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8175         else
8176             JDK=sun
8178             dnl Sun JDK specific tests
8179             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
8180             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
8182             if test "$_jdk_ver" -lt 10900; then
8183                 AC_MSG_ERROR([JDK is too old, you need at least 9 ($_jdk_ver < 10900)])
8184             fi
8185             if test "$_jdk_ver" -gt 10900; then
8186                 JAVA_CLASSPATH_NOT_SET=TRUE
8187             fi
8189             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
8190             if test "$_os" = "WINNT"; then
8191                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
8192             fi
8193             AC_MSG_RESULT([found $JAVA_HOME (JDK $_jdk)])
8195             # set to limit VM usage for JunitTests
8196             JAVAIFLAGS=-Xmx64M
8197             # set to limit VM usage for javac
8198             JAVACFLAGS=-J-Xmx128M
8199         fi
8200     else
8201         AC_MSG_ERROR([Java not found. You need at least JDK 9])
8202     fi
8203 else
8204     if test -z "$ENABLE_JAVA"; then
8205         dnl Java disabled
8206         JAVA_HOME=
8207         export JAVA_HOME
8208     elif test "$cross_compiling" = "yes"; then
8209         # Just assume compatibility of build and host JDK
8210         JDK=$JDK_FOR_BUILD
8211         JAVAIFLAGS=$JAVAIFLAGS_FOR_BUILD
8212     fi
8215 dnl ===================================================================
8216 dnl Checks for javac
8217 dnl ===================================================================
8218 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8219     javacompiler="javac"
8220     : ${JAVA_SOURCE_VER=8}
8221     : ${JAVA_TARGET_VER=8}
8222     if test -z "$with_jdk_home"; then
8223         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
8224     else
8225         _javac_path="$with_jdk_home/bin/$javacompiler"
8226         dnl Check if there is a Java compiler at all.
8227         if test -x "$_javac_path"; then
8228             JAVACOMPILER=$_javac_path
8229         fi
8230     fi
8231     if test -z "$JAVACOMPILER"; then
8232         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
8233     fi
8234     if test "$build_os" = "cygwin"; then
8235         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
8236             JAVACOMPILER="${JAVACOMPILER}.exe"
8237         fi
8238         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
8239     fi
8242 dnl ===================================================================
8243 dnl Checks for javadoc
8244 dnl ===================================================================
8245 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8246     if test -z "$with_jdk_home"; then
8247         AC_PATH_PROG(JAVADOC, javadoc)
8248     else
8249         _javadoc_path="$with_jdk_home/bin/javadoc"
8250         dnl Check if there is a javadoc at all.
8251         if test -x "$_javadoc_path"; then
8252             JAVADOC=$_javadoc_path
8253         else
8254             AC_PATH_PROG(JAVADOC, javadoc)
8255         fi
8256     fi
8257     if test -z "$JAVADOC"; then
8258         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
8259     fi
8260     if test "$build_os" = "cygwin"; then
8261         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
8262             JAVADOC="${JAVADOC}.exe"
8263         fi
8264         JAVADOC=`win_short_path_for_make "$JAVADOC"`
8265     fi
8267     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
8268     JAVADOCISGJDOC="yes"
8269     fi
8271 AC_SUBST(JAVADOC)
8272 AC_SUBST(JAVADOCISGJDOC)
8274 if test "$ENABLE_JAVA" != "" -a \( "$cross_compiling" != "yes" -o -n "$with_jdk_home" \); then
8275     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
8276     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
8277         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
8278            # try to recover first by looking whether we have an alternative
8279            # system as in Debian or newer SuSEs where following /usr/bin/javac
8280            # over /etc/alternatives/javac leads to the right bindir where we
8281            # just need to strip a bit away to get a valid JAVA_HOME
8282            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
8283         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
8284             # maybe only one level of symlink (e.g. on Mac)
8285             JAVA_HOME=$(readlink $JAVACOMPILER)
8286             if test "$(dirname $JAVA_HOME)" = "."; then
8287                 # we've got no path to trim back
8288                 JAVA_HOME=""
8289             fi
8290         else
8291             # else warn
8292             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
8293             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
8294             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
8295             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
8296         fi
8297         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
8298         if test "$JAVA_HOME" != "/usr"; then
8299             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8300                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
8301                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
8302                 dnl Tiger already returns a JDK path...
8303                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
8304             else
8305                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
8306                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
8307                 dnl that checks which version to run
8308                 if test -f "$JAVA_HOME"; then
8309                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
8310                 fi
8311             fi
8312         fi
8313     fi
8314     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
8316     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
8317     if test -z "$JAVA_HOME"; then
8318         if test "x$with_jdk_home" = "x"; then
8319             cat > findhome.java <<_ACEOF
8320 [import java.io.File;
8322 class findhome
8324     public static void main(String args[])
8325     {
8326         String jrelocation = System.getProperty("java.home");
8327         File jre = new File(jrelocation);
8328         System.out.println(jre.getParent());
8329     }
8331 _ACEOF
8332             AC_MSG_CHECKING([if javac works])
8333             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
8334             AC_TRY_EVAL(javac_cmd)
8335             if test $? = 0 -a -f ./findhome.class; then
8336                 AC_MSG_RESULT([javac works])
8337             else
8338                 echo "configure: javac test failed" >&5
8339                 cat findhome.java >&5
8340                 AC_MSG_ERROR([javac does not work - java projects will not build!])
8341             fi
8342             AC_MSG_CHECKING([if gij knows its java.home])
8343             JAVA_HOME=`$JAVAINTERPRETER findhome`
8344             if test $? = 0 -a "$JAVA_HOME" != ""; then
8345                 AC_MSG_RESULT([$JAVA_HOME])
8346             else
8347                 echo "configure: java test failed" >&5
8348                 cat findhome.java >&5
8349                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
8350             fi
8351             # clean-up after ourselves
8352             rm -f ./findhome.java ./findhome.class
8353         else
8354             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
8355         fi
8356     fi
8358     # now check if $JAVA_HOME is really valid
8359     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8360         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
8361             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
8362             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
8363             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
8364             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
8365             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
8366             add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
8367         fi
8368     fi
8369     PathFormat "$JAVA_HOME"
8370     JAVA_HOME="$formatted_path"
8373 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
8374     "$_os" != Darwin
8375 then
8376     AC_MSG_CHECKING([for JAWT lib])
8377     if test "$_os" = WINNT; then
8378         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
8379         JAWTLIB=jawt.lib
8380     else
8381         case "$host_cpu" in
8382         arm*)
8383             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
8384             JAVA_ARCH=$my_java_arch
8385             ;;
8386         i*86)
8387             my_java_arch=i386
8388             ;;
8389         m68k)
8390             my_java_arch=m68k
8391             ;;
8392         powerpc)
8393             my_java_arch=ppc
8394             ;;
8395         powerpc64)
8396             my_java_arch=ppc64
8397             ;;
8398         powerpc64le)
8399             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
8400             JAVA_ARCH=$my_java_arch
8401             ;;
8402         sparc64)
8403             my_java_arch=sparcv9
8404             ;;
8405         x86_64)
8406             my_java_arch=amd64
8407             ;;
8408         *)
8409             my_java_arch=$host_cpu
8410             ;;
8411         esac
8412         # This is where JDK9 puts the library
8413         if test -e "$JAVA_HOME/lib/libjawt.so"; then
8414             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
8415         else
8416             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
8417         fi
8418         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
8419     fi
8420     AC_MSG_RESULT([$JAWTLIB])
8422 AC_SUBST(JAWTLIB)
8424 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
8425     case "$host_os" in
8427     aix*)
8428         JAVAINC="-I$JAVA_HOME/include"
8429         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
8430         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8431         ;;
8433     cygwin*|wsl*)
8434         JAVAINC="-I$JAVA_HOME/include/win32"
8435         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
8436         ;;
8438     darwin*|macos*)
8439         if test -d "$JAVA_HOME/include/darwin"; then
8440             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
8441         else
8442             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
8443         fi
8444         ;;
8446     dragonfly*)
8447         JAVAINC="-I$JAVA_HOME/include"
8448         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8449         ;;
8451     freebsd*)
8452         JAVAINC="-I$JAVA_HOME/include"
8453         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
8454         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
8455         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8456         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8457         ;;
8459     k*bsd*-gnu*)
8460         JAVAINC="-I$JAVA_HOME/include"
8461         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8462         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8463         ;;
8465     linux-gnu*)
8466         JAVAINC="-I$JAVA_HOME/include"
8467         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8468         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8469         ;;
8471     *netbsd*)
8472         JAVAINC="-I$JAVA_HOME/include"
8473         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
8474         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8475        ;;
8477     openbsd*)
8478         JAVAINC="-I$JAVA_HOME/include"
8479         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
8480         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8481         ;;
8483     solaris*)
8484         JAVAINC="-I$JAVA_HOME/include"
8485         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
8486         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8487         ;;
8488     esac
8490 SOLARINC="$SOLARINC $JAVAINC"
8492 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8493     JAVA_HOME_FOR_BUILD=$JAVA_HOME
8494     JAVAIFLAGS_FOR_BUILD=$JAVAIFLAGS
8495     JDK_FOR_BUILD=$JDK
8498 AC_SUBST(JAVACFLAGS)
8499 AC_SUBST(JAVACOMPILER)
8500 AC_SUBST(JAVAINTERPRETER)
8501 AC_SUBST(JAVAIFLAGS)
8502 AC_SUBST(JAVAIFLAGS_FOR_BUILD)
8503 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
8504 AC_SUBST(JAVA_HOME)
8505 AC_SUBST(JAVA_HOME_FOR_BUILD)
8506 AC_SUBST(JDK)
8507 AC_SUBST(JDK_FOR_BUILD)
8508 AC_SUBST(JAVA_SOURCE_VER)
8509 AC_SUBST(JAVA_TARGET_VER)
8512 dnl ===================================================================
8513 dnl Export file validation
8514 dnl ===================================================================
8515 AC_MSG_CHECKING([whether to enable export file validation])
8516 if test "$with_export_validation" != "no"; then
8517     if test -z "$ENABLE_JAVA"; then
8518         if test "$with_export_validation" = "yes"; then
8519             AC_MSG_ERROR([requested, but Java is disabled])
8520         else
8521             AC_MSG_RESULT([no, as Java is disabled])
8522         fi
8523     elif ! test -d "${SRC_ROOT}/schema"; then
8524         if test "$with_export_validation" = "yes"; then
8525             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
8526         else
8527             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
8528         fi
8529     else
8530         AC_MSG_RESULT([yes])
8531         AC_DEFINE(HAVE_EXPORT_VALIDATION)
8533         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
8534         if test -z "$ODFVALIDATOR"; then
8535             # remember to download the ODF toolkit with validator later
8536             AC_MSG_NOTICE([no odfvalidator found, will download it])
8537             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
8538             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
8540             # and fetch name of odfvalidator jar name from download.lst
8541             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
8542             AC_SUBST(ODFVALIDATOR_JAR)
8544             if test -z "$ODFVALIDATOR_JAR"; then
8545                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
8546             fi
8547         fi
8548         if test "$build_os" = "cygwin"; then
8549             # In case of Cygwin it will be executed from Windows,
8550             # so we need to run bash and absolute path to validator
8551             # so instead of "odfvalidator" it will be
8552             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
8553             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
8554         else
8555             ODFVALIDATOR="sh $ODFVALIDATOR"
8556         fi
8557         AC_SUBST(ODFVALIDATOR)
8560         AC_PATH_PROGS(OFFICEOTRON, officeotron)
8561         if test -z "$OFFICEOTRON"; then
8562             # remember to download the officeotron with validator later
8563             AC_MSG_NOTICE([no officeotron found, will download it])
8564             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
8565             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
8567             # and fetch name of officeotron jar name from download.lst
8568             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
8569             AC_SUBST(OFFICEOTRON_JAR)
8571             if test -z "$OFFICEOTRON_JAR"; then
8572                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
8573             fi
8574         else
8575             # check version of existing officeotron
8576             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
8577             if test 0"$OFFICEOTRON_VER" -lt 704; then
8578                 AC_MSG_ERROR([officeotron too old])
8579             fi
8580         fi
8581         if test "$build_os" = "cygwin"; then
8582             # In case of Cygwin it will be executed from Windows,
8583             # so we need to run bash and absolute path to validator
8584             # so instead of "odfvalidator" it will be
8585             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
8586             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
8587         else
8588             OFFICEOTRON="sh $OFFICEOTRON"
8589         fi
8590     fi
8591     AC_SUBST(OFFICEOTRON)
8592 else
8593     AC_MSG_RESULT([no])
8596 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
8597 if test "$with_bffvalidator" != "no"; then
8598     AC_DEFINE(HAVE_BFFVALIDATOR)
8600     if test "$with_export_validation" = "no"; then
8601         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
8602     fi
8604     if test "$with_bffvalidator" = "yes"; then
8605         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
8606     else
8607         BFFVALIDATOR="$with_bffvalidator"
8608     fi
8610     if test "$build_os" = "cygwin"; then
8611         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
8612             AC_MSG_RESULT($BFFVALIDATOR)
8613         else
8614             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8615         fi
8616     elif test -n "$BFFVALIDATOR"; then
8617         # We are not in Cygwin but need to run Windows binary with wine
8618         AC_PATH_PROGS(WINE, wine)
8620         # so swap in a shell wrapper that converts paths transparently
8621         BFFVALIDATOR_EXE="$BFFVALIDATOR"
8622         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
8623         AC_SUBST(BFFVALIDATOR_EXE)
8624         AC_MSG_RESULT($BFFVALIDATOR)
8625     else
8626         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8627     fi
8628     AC_SUBST(BFFVALIDATOR)
8629 else
8630     AC_MSG_RESULT([no])
8633 dnl ===================================================================
8634 dnl Check for C preprocessor to use
8635 dnl ===================================================================
8636 AC_MSG_CHECKING([which C preprocessor to use in idlc])
8637 if test -n "$with_idlc_cpp"; then
8638     AC_MSG_RESULT([$with_idlc_cpp])
8639     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
8640 else
8641     AC_MSG_RESULT([ucpp])
8642     AC_MSG_CHECKING([which ucpp tp use])
8643     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
8644         AC_MSG_RESULT([external])
8645         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
8646     else
8647         AC_MSG_RESULT([internal])
8648         BUILD_TYPE="$BUILD_TYPE UCPP"
8649     fi
8651 AC_SUBST(SYSTEM_UCPP)
8653 dnl ===================================================================
8654 dnl Check for epm (not needed for Windows)
8655 dnl ===================================================================
8656 AC_MSG_CHECKING([whether to enable EPM for packing])
8657 if test "$enable_epm" = "yes"; then
8658     AC_MSG_RESULT([yes])
8659     if test "$_os" != "WINNT"; then
8660         if test $_os = Darwin; then
8661             EPM=internal
8662         elif test -n "$with_epm"; then
8663             EPM=$with_epm
8664         else
8665             AC_PATH_PROG(EPM, epm, no)
8666         fi
8667         if test "$EPM" = "no" -o "$EPM" = "internal"; then
8668             AC_MSG_NOTICE([EPM will be built.])
8669             BUILD_TYPE="$BUILD_TYPE EPM"
8670             EPM=${WORKDIR}/UnpackedTarball/epm/epm
8671         else
8672             # Gentoo has some epm which is something different...
8673             AC_MSG_CHECKING([whether the found epm is the right epm])
8674             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
8675                 AC_MSG_RESULT([yes])
8676             else
8677                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8678             fi
8679             AC_MSG_CHECKING([epm version])
8680             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
8681             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
8682                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
8683                 AC_MSG_RESULT([OK, >= 3.7])
8684             else
8685                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
8686                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8687             fi
8688         fi
8689     fi
8691     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
8692         AC_MSG_CHECKING([for rpm])
8693         for a in "$RPM" rpmbuild rpm; do
8694             $a --usage >/dev/null 2> /dev/null
8695             if test $? -eq 0; then
8696                 RPM=$a
8697                 break
8698             else
8699                 $a --version >/dev/null 2> /dev/null
8700                 if test $? -eq 0; then
8701                     RPM=$a
8702                     break
8703                 fi
8704             fi
8705         done
8706         if test -z "$RPM"; then
8707             AC_MSG_ERROR([not found])
8708         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
8709             RPM_PATH=`which $RPM`
8710             AC_MSG_RESULT([$RPM_PATH])
8711             SCPDEFS="$SCPDEFS -DWITH_RPM"
8712         else
8713             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
8714         fi
8715     fi
8716     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
8717         AC_PATH_PROG(DPKG, dpkg, no)
8718         if test "$DPKG" = "no"; then
8719             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
8720         fi
8721     fi
8722     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
8723        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8724         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
8725             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
8726                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
8727                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
8728                     AC_MSG_RESULT([yes])
8729                 else
8730                     AC_MSG_RESULT([no])
8731                     if echo "$PKGFORMAT" | $GREP -q rpm; then
8732                         _pt="rpm"
8733                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
8734                         add_warning "the rpms will need to be installed with --nodeps"
8735                     else
8736                         _pt="pkg"
8737                     fi
8738                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
8739                     add_warning "the ${_pt}s will not be relocatable"
8740                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
8741                                  relocation will work, you need to patch your epm with the
8742                                  patch in epm/epm-3.7.patch or build with
8743                                  --with-epm=internal which will build a suitable epm])
8744                 fi
8745             fi
8746         fi
8747     fi
8748     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8749         AC_PATH_PROG(PKGMK, pkgmk, no)
8750         if test "$PKGMK" = "no"; then
8751             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
8752         fi
8753     fi
8754     AC_SUBST(RPM)
8755     AC_SUBST(DPKG)
8756     AC_SUBST(PKGMK)
8757 else
8758     for i in $PKGFORMAT; do
8759         case "$i" in
8760         aix | bsd | deb | pkg | rpm | native | portable)
8761             AC_MSG_ERROR(
8762                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
8763             ;;
8764         esac
8765     done
8766     AC_MSG_RESULT([no])
8767     EPM=NO
8769 AC_SUBST(EPM)
8771 ENABLE_LWP=
8772 if test "$enable_lotuswordpro" = "yes"; then
8773     ENABLE_LWP="TRUE"
8775 AC_SUBST(ENABLE_LWP)
8777 dnl ===================================================================
8778 dnl Check for building ODK
8779 dnl ===================================================================
8780 if test "$enable_odk" = no; then
8781     unset DOXYGEN
8782 else
8783     if test "$with_doxygen" = no; then
8784         AC_MSG_CHECKING([for doxygen])
8785         unset DOXYGEN
8786         AC_MSG_RESULT([no])
8787     else
8788         if test "$with_doxygen" = yes; then
8789             AC_PATH_PROG([DOXYGEN], [doxygen])
8790             if test -z "$DOXYGEN"; then
8791                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
8792             fi
8793             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
8794                 if ! dot -V 2>/dev/null; then
8795                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
8796                 fi
8797             fi
8798         else
8799             AC_MSG_CHECKING([for doxygen])
8800             DOXYGEN=$with_doxygen
8801             AC_MSG_RESULT([$DOXYGEN])
8802         fi
8803         if test -n "$DOXYGEN"; then
8804             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
8805             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
8806             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
8807                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
8808             fi
8809         fi
8810     fi
8812 AC_SUBST([DOXYGEN])
8814 AC_MSG_CHECKING([whether to build the ODK])
8815 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
8816     AC_MSG_RESULT([yes])
8818     if test "$with_java" != "no"; then
8819         AC_MSG_CHECKING([whether to build unowinreg.dll])
8820         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
8821             # build on Win by default
8822             enable_build_unowinreg=yes
8823         fi
8824         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
8825             AC_MSG_RESULT([no])
8826             BUILD_UNOWINREG=
8827         else
8828             AC_MSG_RESULT([yes])
8829             BUILD_UNOWINREG=TRUE
8830         fi
8831         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
8832             if test -z "$with_mingw_cross_compiler"; then
8833                 dnl Guess...
8834                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
8835             elif test -x "$with_mingw_cross_compiler"; then
8836                  MINGWCXX="$with_mingw_cross_compiler"
8837             else
8838                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
8839             fi
8841             if test "$MINGWCXX" = "false"; then
8842                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
8843             fi
8845             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
8846             if test -x "$mingwstrip_test"; then
8847                 MINGWSTRIP="$mingwstrip_test"
8848             else
8849                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
8850             fi
8852             if test "$MINGWSTRIP" = "false"; then
8853                 AC_MSG_ERROR(MinGW32 binutils not found.)
8854             fi
8855         fi
8856     fi
8857     BUILD_TYPE="$BUILD_TYPE ODK"
8858 else
8859     AC_MSG_RESULT([no])
8860     BUILD_UNOWINREG=
8862 AC_SUBST(BUILD_UNOWINREG)
8863 AC_SUBST(MINGWCXX)
8864 AC_SUBST(MINGWSTRIP)
8866 dnl ===================================================================
8867 dnl Check for system zlib
8868 dnl ===================================================================
8869 if test "$with_system_zlib" = "auto"; then
8870     case "$_os" in
8871     WINNT)
8872         with_system_zlib="$with_system_libs"
8873         ;;
8874     *)
8875         if test "$enable_fuzzers" != "yes"; then
8876             with_system_zlib=yes
8877         else
8878             with_system_zlib=no
8879         fi
8880         ;;
8881     esac
8884 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8885 dnl and has no pkg-config for it at least on some tinderboxes,
8886 dnl so leaving that out for now
8887 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8888 AC_MSG_CHECKING([which zlib to use])
8889 if test "$with_system_zlib" = "yes"; then
8890     AC_MSG_RESULT([external])
8891     SYSTEM_ZLIB=TRUE
8892     AC_CHECK_HEADER(zlib.h, [],
8893         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8894     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8895         [AC_MSG_ERROR(zlib not found or functional)], [])
8896 else
8897     AC_MSG_RESULT([internal])
8898     SYSTEM_ZLIB=
8899     BUILD_TYPE="$BUILD_TYPE ZLIB"
8900     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8901     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8903 AC_SUBST(ZLIB_CFLAGS)
8904 AC_SUBST(ZLIB_LIBS)
8905 AC_SUBST(SYSTEM_ZLIB)
8907 dnl ===================================================================
8908 dnl Check for system jpeg
8909 dnl ===================================================================
8910 AC_MSG_CHECKING([which libjpeg to use])
8911 if test "$with_system_jpeg" = "yes"; then
8912     AC_MSG_RESULT([external])
8913     SYSTEM_LIBJPEG=TRUE
8914     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8915         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8916     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8917         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8918 else
8919     SYSTEM_LIBJPEG=
8920     AC_MSG_RESULT([internal, libjpeg-turbo])
8921     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8922     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
8923     if test "$COM" = "MSC"; then
8924         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
8925     else
8926         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
8927     fi
8929     case "$host_cpu" in
8930     x86_64 | amd64 | i*86 | x86 | ia32)
8931         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8932         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8933             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8934                 NASM="$LODE_HOME/opt/bin/nasm"
8935             elif test -x "/opt/lo/bin/nasm"; then
8936                 NASM="/opt/lo/bin/nasm"
8937             fi
8938         fi
8940         if test -n "$NASM"; then
8941             AC_MSG_CHECKING([for object file format of host system])
8942             case "$host_os" in
8943               cygwin* | mingw* | pw32* | wsl*)
8944                 case "$host_cpu" in
8945                   x86_64)
8946                     objfmt='Win64-COFF'
8947                     ;;
8948                   *)
8949                     objfmt='Win32-COFF'
8950                     ;;
8951                 esac
8952               ;;
8953               msdosdjgpp* | go32*)
8954                 objfmt='COFF'
8955               ;;
8956               os2-emx*) # not tested
8957                 objfmt='MSOMF' # obj
8958               ;;
8959               linux*coff* | linux*oldld*)
8960                 objfmt='COFF' # ???
8961               ;;
8962               linux*aout*)
8963                 objfmt='a.out'
8964               ;;
8965               linux*)
8966                 case "$host_cpu" in
8967                   x86_64)
8968                     objfmt='ELF64'
8969                     ;;
8970                   *)
8971                     objfmt='ELF'
8972                     ;;
8973                 esac
8974               ;;
8975               kfreebsd* | freebsd* | netbsd* | openbsd*)
8976                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
8977                   objfmt='BSD-a.out'
8978                 else
8979                   case "$host_cpu" in
8980                     x86_64 | amd64)
8981                       objfmt='ELF64'
8982                       ;;
8983                     *)
8984                       objfmt='ELF'
8985                       ;;
8986                   esac
8987                 fi
8988               ;;
8989               solaris* | sunos* | sysv* | sco*)
8990                 case "$host_cpu" in
8991                   x86_64)
8992                     objfmt='ELF64'
8993                     ;;
8994                   *)
8995                     objfmt='ELF'
8996                     ;;
8997                 esac
8998               ;;
8999               darwin* | rhapsody* | nextstep* | openstep* | macos*)
9000                 case "$host_cpu" in
9001                   x86_64)
9002                     objfmt='Mach-O64'
9003                     ;;
9004                   *)
9005                     objfmt='Mach-O'
9006                     ;;
9007                 esac
9008               ;;
9009               *)
9010                 objfmt='ELF ?'
9011               ;;
9012             esac
9014             AC_MSG_RESULT([$objfmt])
9015             if test "$objfmt" = 'ELF ?'; then
9016               objfmt='ELF'
9017               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
9018             fi
9020             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
9021             case "$objfmt" in
9022               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
9023               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
9024               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
9025               COFF)       NAFLAGS='-fcoff -DCOFF';;
9026               a.out)      NAFLAGS='-faout -DAOUT';;
9027               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
9028               ELF)        NAFLAGS='-felf -DELF';;
9029               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
9030               RDF)        NAFLAGS='-frdf -DRDF';;
9031               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
9032               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
9033             esac
9034             AC_MSG_RESULT([$NAFLAGS])
9036             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
9037             cat > conftest.asm << EOF
9038             [%line __oline__ "configure"
9039                     section .text
9040                     global  _main,main
9041             _main:
9042             main:   xor     eax,eax
9043                     ret
9044             ]
9046             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
9047             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
9048               AC_MSG_RESULT(yes)
9049             else
9050               echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
9051               cat conftest.asm >&AS_MESSAGE_LOG_FD
9052               rm -rf conftest*
9053               AC_MSG_RESULT(no)
9054               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
9055               NASM=""
9056             fi
9058         fi
9060         if test -z "$NASM"; then
9061 cat << _EOS
9062 ****************************************************************************
9063 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
9064 To get one please:
9066 _EOS
9067             if test "$build_os" = "cygwin"; then
9068 cat << _EOS
9069 install a pre-compiled binary for Win32
9071 mkdir -p /opt/lo/bin
9072 cd /opt/lo/bin
9073 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
9074 chmod +x nasm
9076 or get and install one from http://www.nasm.us/
9078 Then re-run autogen.sh
9080 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
9081 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
9083 _EOS
9084             else
9085 cat << _EOS
9086 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
9088 _EOS
9089             fi
9090             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
9091             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
9092         fi
9093       ;;
9094     esac
9097 AC_SUBST(NASM)
9098 AC_SUBST(LIBJPEG_CFLAGS)
9099 AC_SUBST(LIBJPEG_LIBS)
9100 AC_SUBST(SYSTEM_LIBJPEG)
9102 dnl ===================================================================
9103 dnl Check for system clucene
9104 dnl ===================================================================
9105 dnl we should rather be using
9106 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
9107 dnl but the contribs-lib check seems tricky
9108 AC_MSG_CHECKING([which clucene to use])
9109 if test "$with_system_clucene" = "yes"; then
9110     AC_MSG_RESULT([external])
9111     SYSTEM_CLUCENE=TRUE
9112     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
9113     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
9114     FilterLibs "${CLUCENE_LIBS}"
9115     CLUCENE_LIBS="${filteredlibs}"
9116     AC_LANG_PUSH([C++])
9117     save_CXXFLAGS=$CXXFLAGS
9118     save_CPPFLAGS=$CPPFLAGS
9119     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
9120     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
9121     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
9122     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
9123     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
9124                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
9125     CXXFLAGS=$save_CXXFLAGS
9126     CPPFLAGS=$save_CPPFLAGS
9127     AC_LANG_POP([C++])
9129     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
9130 else
9131     AC_MSG_RESULT([internal])
9132     SYSTEM_CLUCENE=
9133     BUILD_TYPE="$BUILD_TYPE CLUCENE"
9135 AC_SUBST(SYSTEM_CLUCENE)
9136 AC_SUBST(CLUCENE_CFLAGS)
9137 AC_SUBST(CLUCENE_LIBS)
9139 dnl ===================================================================
9140 dnl Check for system expat
9141 dnl ===================================================================
9142 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
9144 dnl ===================================================================
9145 dnl Check for system xmlsec
9146 dnl ===================================================================
9147 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
9149 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
9150 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
9151     ENABLE_EOT="TRUE"
9152     AC_DEFINE([ENABLE_EOT])
9153     AC_MSG_RESULT([yes])
9155     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
9156 else
9157     ENABLE_EOT=
9158     AC_MSG_RESULT([no])
9160 AC_SUBST([ENABLE_EOT])
9162 dnl ===================================================================
9163 dnl Check for DLP libs
9164 dnl ===================================================================
9165 AS_IF([test "$COM" = "MSC"],
9166       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
9167       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
9169 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
9171 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
9173 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
9175 AS_IF([test "$COM" = "MSC"],
9176       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
9177       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
9179 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
9181 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
9183 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
9184 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.12])
9186 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
9188 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
9190 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
9192 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
9193 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.17])
9195 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
9196 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.10])
9198 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
9200 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
9201 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
9203 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
9205 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
9207 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
9209 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
9211 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
9212 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.7])
9214 dnl ===================================================================
9215 dnl Check for system lcms2
9216 dnl ===================================================================
9217 if test "$with_system_lcms2" != "yes"; then
9218     SYSTEM_LCMS2=
9220 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
9221 if test "$GCC" = "yes"; then
9222     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
9224 if test "$COM" = "MSC"; then # override the above
9225     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
9228 dnl ===================================================================
9229 dnl Check for system cppunit
9230 dnl ===================================================================
9231 if test "$_os" != "Android" ; then
9232     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
9235 dnl ===================================================================
9236 dnl Check whether freetype is available
9237 dnl ===================================================================
9238 if test  "$test_freetype" = "yes"; then
9239     AC_MSG_CHECKING([whether freetype is available])
9240     # FreeType has 3 different kinds of versions
9241     # * release, like 2.4.10
9242     # * libtool, like 13.0.7 (this what pkg-config returns)
9243     # * soname
9244     # FreeType's docs/VERSION.DLL provides a table mapping between the three
9245     #
9246     # 9.9.3 is 2.2.0
9247     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
9248     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9249     FilterLibs "${FREETYPE_LIBS}"
9250     FREETYPE_LIBS="${filteredlibs}"
9251     SYSTEM_FREETYPE=TRUE
9252 else
9253     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
9254     if test "x$ac_config_site_64bit_host" = xYES; then
9255         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
9256     else
9257         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
9258     fi
9260 AC_SUBST(FREETYPE_CFLAGS)
9261 AC_SUBST(FREETYPE_LIBS)
9262 AC_SUBST([SYSTEM_FREETYPE])
9264 # ===================================================================
9265 # Check for system libxslt
9266 # to prevent incompatibilities between internal libxml2 and external libxslt,
9267 # or vice versa, use with_system_libxml here
9268 # ===================================================================
9269 if test "$with_system_libxml" = "auto"; then
9270     case "$_os" in
9271     WINNT|iOS|Android)
9272         with_system_libxml="$with_system_libs"
9273         ;;
9274     *)
9275         if test "$enable_fuzzers" != "yes"; then
9276             with_system_libxml=yes
9277         else
9278             with_system_libxml=no
9279         fi
9280         ;;
9281     esac
9284 AC_MSG_CHECKING([which libxslt to use])
9285 if test "$with_system_libxml" = "yes"; then
9286     AC_MSG_RESULT([external])
9287     SYSTEM_LIBXSLT=TRUE
9288     if test "$_os" = "Darwin"; then
9289         dnl make sure to use SDK path
9290         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9291         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
9292         dnl omit -L/usr/lib
9293         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
9294         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
9295     else
9296         PKG_CHECK_MODULES(LIBXSLT, libxslt)
9297         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9298         FilterLibs "${LIBXSLT_LIBS}"
9299         LIBXSLT_LIBS="${filteredlibs}"
9300         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
9301         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9302         FilterLibs "${LIBEXSLT_LIBS}"
9303         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
9304     fi
9306     dnl Check for xsltproc
9307     AC_PATH_PROG(XSLTPROC, xsltproc, no)
9308     if test "$XSLTPROC" = "no"; then
9309         AC_MSG_ERROR([xsltproc is required])
9310     fi
9311 else
9312     AC_MSG_RESULT([internal])
9313     SYSTEM_LIBXSLT=
9314     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
9316 AC_SUBST(SYSTEM_LIBXSLT)
9317 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
9318     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
9320 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
9322 AC_SUBST(LIBEXSLT_CFLAGS)
9323 AC_SUBST(LIBEXSLT_LIBS)
9324 AC_SUBST(LIBXSLT_CFLAGS)
9325 AC_SUBST(LIBXSLT_LIBS)
9326 AC_SUBST(XSLTPROC)
9328 # ===================================================================
9329 # Check for system libxml
9330 # ===================================================================
9331 AC_MSG_CHECKING([which libxml to use])
9332 if test "$with_system_libxml" = "yes"; then
9333     AC_MSG_RESULT([external])
9334     SYSTEM_LIBXML=TRUE
9335     if test "$_os" = "Darwin"; then
9336         dnl make sure to use SDK path
9337         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9338         dnl omit -L/usr/lib
9339         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
9340     elif test $_os = iOS; then
9341         dnl make sure to use SDK path
9342         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
9343         LIBXML_CFLAGS="-I$usr/include/libxml2"
9344         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
9345     else
9346         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
9347         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9348         FilterLibs "${LIBXML_LIBS}"
9349         LIBXML_LIBS="${filteredlibs}"
9350     fi
9352     dnl Check for xmllint
9353     AC_PATH_PROG(XMLLINT, xmllint, no)
9354     if test "$XMLLINT" = "no"; then
9355         AC_MSG_ERROR([xmllint is required])
9356     fi
9357 else
9358     AC_MSG_RESULT([internal])
9359     SYSTEM_LIBXML=
9360     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
9361     if test "$COM" = "MSC"; then
9362         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9363     fi
9364     if test "$COM" = "MSC"; then
9365         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
9366     else
9367         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
9368         if test "$_os" = Android; then
9369             LIBXML_LIBS="$LIBXML_LIBS -lm"
9370         fi
9371     fi
9372     BUILD_TYPE="$BUILD_TYPE LIBXML2"
9374 AC_SUBST(SYSTEM_LIBXML)
9375 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
9376     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
9378 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
9379 AC_SUBST(LIBXML_CFLAGS)
9380 AC_SUBST(LIBXML_LIBS)
9381 AC_SUBST(XMLLINT)
9383 # =====================================================================
9384 # Checking for a Python interpreter with version >= 3.3.
9385 # Optionally user can pass an option to configure, i. e.
9386 # ./configure PYTHON=/usr/bin/python
9387 # =====================================================================
9388 if test $_os = Darwin -a "$enable_python" != no -a "$enable_python" != fully-internal -a "$enable_python" != internal; then
9389     # Only allowed choices for macOS are 'no', 'internal' (default), and 'fully-internal'
9390     enable_python=internal
9392 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
9393     if test -n "$PYTHON"; then
9394         PYTHON_FOR_BUILD=$PYTHON
9395     else
9396         # This allows a lack of system python with no error, we use internal one in that case.
9397         AM_PATH_PYTHON([3.3],, [:])
9398         # Clean PYTHON_VERSION checked below if cross-compiling
9399         PYTHON_VERSION=""
9400         if test "$PYTHON" != ":"; then
9401             PYTHON_FOR_BUILD=$PYTHON
9402         fi
9403     fi
9405 AC_SUBST(PYTHON_FOR_BUILD)
9407 # Checks for Python to use for Pyuno
9408 AC_MSG_CHECKING([which Python to use for Pyuno])
9409 case "$enable_python" in
9410 no|disable)
9411     if test -z $PYTHON_FOR_BUILD; then
9412         # Python is required to build LibreOffice. In theory we could separate the build-time Python
9413         # requirement from the choice whether to include Python stuff in the installer, but why
9414         # bother?
9415         AC_MSG_ERROR([Python is required at build time.])
9416     fi
9417     enable_python=no
9418     AC_MSG_RESULT([none])
9419     ;;
9420 ""|yes|auto)
9421     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
9422         AC_MSG_RESULT([no, overridden by --disable-scripting])
9423         enable_python=no
9424     elif test $build_os = cygwin; then
9425         dnl When building on Windows we don't attempt to use any installed
9426         dnl "system"  Python.
9427         AC_MSG_RESULT([fully internal])
9428         enable_python=internal
9429     elif test "$cross_compiling" = yes; then
9430         AC_MSG_RESULT([system])
9431         enable_python=system
9432     else
9433         # Unset variables set by the above AM_PATH_PYTHON so that
9434         # we actually do check anew.
9435         AC_MSG_RESULT([])
9436         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
9437         AM_PATH_PYTHON([3.3],, [:])
9438         AC_MSG_CHECKING([which Python to use for Pyuno])
9439         if test "$PYTHON" = ":"; then
9440             if test -z "$PYTHON_FOR_BUILD"; then
9441                 AC_MSG_RESULT([fully internal])
9442             else
9443                 AC_MSG_RESULT([internal])
9444             fi
9445             enable_python=internal
9446         else
9447             AC_MSG_RESULT([system])
9448             enable_python=system
9449         fi
9450     fi
9451     ;;
9452 internal)
9453     AC_MSG_RESULT([internal])
9454     ;;
9455 fully-internal)
9456     AC_MSG_RESULT([fully internal])
9457     enable_python=internal
9458     ;;
9459 system)
9460     AC_MSG_RESULT([system])
9461     if test "$_os" = Darwin; then
9462         AC_MSG_ERROR([--enable-python=system doesn't work on macOS because the version provided is obsolete])
9463     fi
9464     ;;
9466     AC_MSG_ERROR([Incorrect --enable-python option])
9467     ;;
9468 esac
9470 if test $enable_python != no; then
9471     BUILD_TYPE="$BUILD_TYPE PYUNO"
9474 if test $enable_python = system; then
9475     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
9476         # Fallback: Accept these in the environment, or as set above
9477         # for MacOSX.
9478         :
9479     elif test "$cross_compiling" != yes; then
9480         # Unset variables set by the above AM_PATH_PYTHON so that
9481         # we actually do check anew.
9482         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
9483         # This causes an error if no python command is found
9484         AM_PATH_PYTHON([3.3])
9485         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
9486         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
9487         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
9488         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
9489         if test -z "$PKG_CONFIG"; then
9490             PYTHON_CFLAGS="-I$python_include"
9491             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
9492         elif $PKG_CONFIG --exists python-$python_version-embed; then
9493             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
9494             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
9495         elif $PKG_CONFIG --exists python-$python_version; then
9496             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
9497             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
9498         else
9499             PYTHON_CFLAGS="-I$python_include"
9500             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
9501         fi
9502         FilterLibs "${PYTHON_LIBS}"
9503         PYTHON_LIBS="${filteredlibs}"
9504     else
9505         dnl How to find out the cross-compilation Python installation path?
9506         AC_MSG_CHECKING([for python version])
9507         AS_IF([test -n "$PYTHON_VERSION"],
9508               [AC_MSG_RESULT([$PYTHON_VERSION])],
9509               [AC_MSG_RESULT([not found])
9510                AC_MSG_ERROR([no usable python found])])
9511         test -n "$PYTHON_CFLAGS" && break
9512     fi
9514     dnl Check if the headers really work
9515     save_CPPFLAGS="$CPPFLAGS"
9516     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
9517     AC_CHECK_HEADER(Python.h)
9518     CPPFLAGS="$save_CPPFLAGS"
9520     # let the PYTHON_FOR_BUILD match the same python installation that
9521     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
9522     # better for PythonTests.
9523     PYTHON_FOR_BUILD=$PYTHON
9526 if test "$with_lxml" != no; then
9527     if test -z "$PYTHON_FOR_BUILD"; then
9528         case $build_os in
9529             cygwin)
9530                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
9531                 ;;
9532             *)
9533                 if test "$cross_compiling" != yes ; then
9534                     BUILD_TYPE="$BUILD_TYPE LXML"
9535                 fi
9536                 ;;
9537         esac
9538     else
9539         AC_MSG_CHECKING([for python lxml])
9540         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
9541             AC_MSG_RESULT([yes])
9542         else
9543             case $build_os in
9544                 cygwin)
9545                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
9546                     ;;
9547                 *)
9548                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
9549                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
9550                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
9551                         else
9552                             BUILD_TYPE="$BUILD_TYPE LXML"
9553                             AC_MSG_RESULT([no, using internal lxml])
9554                         fi
9555                     else
9556                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
9557                     fi
9558                     ;;
9559             esac
9560         fi
9561     fi
9564 dnl By now enable_python should be "system", "internal" or "no"
9565 case $enable_python in
9566 system)
9567     SYSTEM_PYTHON=TRUE
9569     if test "x$ac_cv_header_Python_h" != "xyes"; then
9570        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
9571     fi
9573     AC_LANG_PUSH(C)
9574     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
9575     AC_MSG_CHECKING([for correct python library version])
9576        AC_RUN_IFELSE([AC_LANG_SOURCE([[
9577 #include <Python.h>
9579 int main(int argc, char **argv) {
9580    if ((PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
9581    else return 1;
9583        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3])],[AC_MSG_RESULT([skipped; cross-compiling])])
9584     AC_LANG_POP(C)
9586     dnl FIXME Check if the Python library can be linked with, too?
9587     ;;
9589 internal)
9590     SYSTEM_PYTHON=
9591     PYTHON_VERSION_MAJOR=3
9592     PYTHON_VERSION_MINOR=8
9593     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.8
9594     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
9595         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
9596     fi
9597     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
9598     BUILD_TYPE="$BUILD_TYPE PYTHON"
9599     if test "$OS" = LINUX -o "$OS" = WNT ; then
9600         BUILD_TYPE="$BUILD_TYPE LIBFFI"
9601     fi
9602     # Embedded Python dies without Home set
9603     if test "$HOME" = ""; then
9604         export HOME=""
9605     fi
9606     ;;
9608     DISABLE_PYTHON=TRUE
9609     SYSTEM_PYTHON=
9610     ;;
9612     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
9613     ;;
9614 esac
9616 AC_SUBST(DISABLE_PYTHON)
9617 AC_SUBST(SYSTEM_PYTHON)
9618 AC_SUBST(PYTHON_CFLAGS)
9619 AC_SUBST(PYTHON_LIBS)
9620 AC_SUBST(PYTHON_VERSION)
9621 AC_SUBST(PYTHON_VERSION_MAJOR)
9622 AC_SUBST(PYTHON_VERSION_MINOR)
9624 ENABLE_MARIADBC=
9625 MARIADBC_MAJOR=1
9626 MARIADBC_MINOR=0
9627 MARIADBC_MICRO=2
9628 AC_MSG_CHECKING([whether to build the MariaDB/MySQL SDBC driver])
9629 if test "x$enable_mariadb_sdbc" != "xno" -a "$enable_mpl_subset" != "yes"; then
9630     ENABLE_MARIADBC=TRUE
9631     AC_MSG_RESULT([yes])
9632     BUILD_TYPE="$BUILD_TYPE MARIADBC"
9633 else
9634     AC_MSG_RESULT([no])
9636 AC_SUBST(ENABLE_MARIADBC)
9637 AC_SUBST(MARIADBC_MAJOR)
9638 AC_SUBST(MARIADBC_MINOR)
9639 AC_SUBST(MARIADBC_MICRO)
9641 if test "$ENABLE_MARIADBC" = "TRUE"; then
9642     dnl ===================================================================
9643     dnl Check for system MariaDB
9644     dnl ===================================================================
9645     AC_MSG_CHECKING([which MariaDB to use])
9646     if test "$with_system_mariadb" = "yes"; then
9647         AC_MSG_RESULT([external])
9648         SYSTEM_MARIADB_CONNECTOR_C=TRUE
9649         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
9650         if test -z "$MARIADBCONFIG"; then
9651             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
9652             if test -z "$MARIADBCONFIG"; then
9653                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
9654                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
9655             fi
9656         fi
9657         AC_MSG_CHECKING([MariaDB version])
9658         MARIADB_VERSION=`$MARIADBCONFIG --version`
9659         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
9660         if test "$MARIADB_MAJOR" -ge "5"; then
9661             AC_MSG_RESULT([OK])
9662         else
9663             AC_MSG_ERROR([too old, use 5.0.x or later])
9664         fi
9665         AC_MSG_CHECKING([for MariaDB Client library])
9666         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
9667         if test "$COM_IS_CLANG" = TRUE; then
9668             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
9669         fi
9670         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
9671         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
9672         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
9673         dnl linux32:
9674         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
9675             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
9676             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
9677                 | sed -e 's|/lib64/|/lib/|')
9678         fi
9679         FilterLibs "${MARIADB_LIBS}"
9680         MARIADB_LIBS="${filteredlibs}"
9681         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
9682         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
9683         if test "$enable_bundle_mariadb" = "yes"; then
9684             AC_MSG_RESULT([yes])
9685             BUNDLE_MARIADB_CONNECTOR_C=TRUE
9686             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
9688 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
9690 /g' | grep -E '(mysqlclient|mariadb)')
9691             if test "$_os" = "Darwin"; then
9692                 LIBMARIADB=${LIBMARIADB}.dylib
9693             elif test "$_os" = "WINNT"; then
9694                 LIBMARIADB=${LIBMARIADB}.dll
9695             else
9696                 LIBMARIADB=${LIBMARIADB}.so
9697             fi
9698             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
9699             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
9700             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
9701                 AC_MSG_RESULT([found.])
9702                 PathFormat "$LIBMARIADB_PATH"
9703                 LIBMARIADB_PATH="$formatted_path"
9704             else
9705                 AC_MSG_ERROR([not found.])
9706             fi
9707         else
9708             AC_MSG_RESULT([no])
9709             BUNDLE_MARIADB_CONNECTOR_C=
9710         fi
9711     else
9712         AC_MSG_RESULT([internal])
9713         SYSTEM_MARIADB_CONNECTOR_C=
9714         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
9715         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
9716         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
9717     fi
9719     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
9720     AC_SUBST(MARIADB_CFLAGS)
9721     AC_SUBST(MARIADB_LIBS)
9722     AC_SUBST(LIBMARIADB)
9723     AC_SUBST(LIBMARIADB_PATH)
9724     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
9727 dnl ===================================================================
9728 dnl Check for system hsqldb
9729 dnl ===================================================================
9730 if test "$with_java" != "no" -a "$cross_compiling" != "yes"; then
9731     HSQLDB_USE_JDBC_4_1=
9732     AC_MSG_CHECKING([which hsqldb to use])
9733     if test "$with_system_hsqldb" = "yes"; then
9734         AC_MSG_RESULT([external])
9735         SYSTEM_HSQLDB=TRUE
9736         if test -z $HSQLDB_JAR; then
9737             HSQLDB_JAR=/usr/share/java/hsqldb.jar
9738         fi
9739         if ! test -f $HSQLDB_JAR; then
9740                AC_MSG_ERROR(hsqldb.jar not found.)
9741         fi
9742         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
9743         export HSQLDB_JAR
9744         if $PERL -e \
9745            'use Archive::Zip;
9746             my $file = "$ENV{'HSQLDB_JAR'}";
9747             my $zip = Archive::Zip->new( $file );
9748             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
9749             if ( $mf =~ m/Specification-Version: 1.8.*/ )
9750             {
9751                 push @l, split(/\n/, $mf);
9752                 foreach my $line (@l)
9753                 {
9754                     if ($line =~ m/Specification-Version:/)
9755                     {
9756                         ($t, $version) = split (/:/,$line);
9757                         $version =~ s/^\s//;
9758                         ($a, $b, $c, $d) = split (/\./,$version);
9759                         if ($c == "0" && $d > "8")
9760                         {
9761                             exit 0;
9762                         }
9763                         else
9764                         {
9765                             exit 1;
9766                         }
9767                     }
9768                 }
9769             }
9770             else
9771             {
9772                 exit 1;
9773             }'; then
9774             AC_MSG_RESULT([yes])
9775         else
9776             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
9777         fi
9778     else
9779         AC_MSG_RESULT([internal])
9780         SYSTEM_HSQLDB=
9781         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9782         NEED_ANT=TRUE
9783         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
9784         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
9785         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
9786             AC_MSG_RESULT([yes])
9787             HSQLDB_USE_JDBC_4_1=TRUE
9788         else
9789             AC_MSG_RESULT([no])
9790         fi
9791     fi
9792 else
9793     if test "$with_java" != "no" -a -z "$HSQLDB_JAR"; then
9794         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9795     fi
9797 AC_SUBST(SYSTEM_HSQLDB)
9798 AC_SUBST(HSQLDB_JAR)
9799 AC_SUBST([HSQLDB_USE_JDBC_4_1])
9801 dnl ===================================================================
9802 dnl Check for PostgreSQL stuff
9803 dnl ===================================================================
9804 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
9805 if test "x$enable_postgresql_sdbc" != "xno"; then
9806     AC_MSG_RESULT([yes])
9807     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
9809     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
9810         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
9811     fi
9812     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
9813         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
9814     fi
9816     postgres_interface=""
9817     if test "$with_system_postgresql" = "yes"; then
9818         postgres_interface="external PostgreSQL"
9819         SYSTEM_POSTGRESQL=TRUE
9820         if test "$_os" = Darwin; then
9821             supp_path=''
9822             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
9823                 pg_supp_path="$P_SEP$d$pg_supp_path"
9824             done
9825         fi
9826         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
9827         if test -n "$PGCONFIG"; then
9828             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
9829             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
9830         else
9831             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
9832               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
9833               POSTGRESQL_LIB=$POSTGRESQL_LIBS
9834             ],[
9835               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
9836             ])
9837         fi
9838         FilterLibs "${POSTGRESQL_LIB}"
9839         POSTGRESQL_LIB="${filteredlibs}"
9840     else
9841         # if/when anything else than PostgreSQL uses Kerberos,
9842         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
9843         WITH_KRB5=
9844         WITH_GSSAPI=
9845         case "$_os" in
9846         Darwin)
9847             # macOS has system MIT Kerberos 5 since 10.4
9848             if test "$with_krb5" != "no"; then
9849                 WITH_KRB5=TRUE
9850                 save_LIBS=$LIBS
9851                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
9852                 # that the libraries where these functions are located on macOS will change, is it?
9853                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9854                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9855                 KRB5_LIBS=$LIBS
9856                 LIBS=$save_LIBS
9857                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9858                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9859                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9860                 LIBS=$save_LIBS
9861             fi
9862             if test "$with_gssapi" != "no"; then
9863                 WITH_GSSAPI=TRUE
9864                 save_LIBS=$LIBS
9865                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9866                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9867                 GSSAPI_LIBS=$LIBS
9868                 LIBS=$save_LIBS
9869             fi
9870             ;;
9871         WINNT)
9872             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
9873                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
9874             fi
9875             ;;
9876         Linux|GNU|*BSD|DragonFly)
9877             if test "$with_krb5" != "no"; then
9878                 WITH_KRB5=TRUE
9879                 save_LIBS=$LIBS
9880                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9881                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9882                 KRB5_LIBS=$LIBS
9883                 LIBS=$save_LIBS
9884                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9885                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9886                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9887                 LIBS=$save_LIBS
9888             fi
9889             if test "$with_gssapi" != "no"; then
9890                 WITH_GSSAPI=TRUE
9891                 save_LIBS=$LIBS
9892                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9893                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9894                 GSSAPI_LIBS=$LIBS
9895                 LIBS=$save_LIBS
9896             fi
9897             ;;
9898         *)
9899             if test "$with_krb5" = "yes"; then
9900                 WITH_KRB5=TRUE
9901                 save_LIBS=$LIBS
9902                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9903                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9904                 KRB5_LIBS=$LIBS
9905                 LIBS=$save_LIBS
9906                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9907                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9908                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9909                 LIBS=$save_LIBS
9910             fi
9911             if test "$with_gssapi" = "yes"; then
9912                 WITH_GSSAPI=TRUE
9913                 save_LIBS=$LIBS
9914                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9915                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9916                 LIBS=$save_LIBS
9917                 GSSAPI_LIBS=$LIBS
9918             fi
9919         esac
9921         if test -n "$with_libpq_path"; then
9922             SYSTEM_POSTGRESQL=TRUE
9923             postgres_interface="external libpq"
9924             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
9925             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
9926         else
9927             SYSTEM_POSTGRESQL=
9928             postgres_interface="internal"
9929             POSTGRESQL_LIB=""
9930             POSTGRESQL_INC="%OVERRIDE_ME%"
9931             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
9932         fi
9933     fi
9935     AC_MSG_CHECKING([PostgreSQL C interface])
9936     AC_MSG_RESULT([$postgres_interface])
9938     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
9939         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
9940         save_CFLAGS=$CFLAGS
9941         save_CPPFLAGS=$CPPFLAGS
9942         save_LIBS=$LIBS
9943         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
9944         LIBS="${LIBS} ${POSTGRESQL_LIB}"
9945         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
9946         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
9947             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
9948         CFLAGS=$save_CFLAGS
9949         CPPFLAGS=$save_CPPFLAGS
9950         LIBS=$save_LIBS
9951     fi
9952     BUILD_POSTGRESQL_SDBC=TRUE
9953 else
9954     AC_MSG_RESULT([no])
9956 AC_SUBST(WITH_KRB5)
9957 AC_SUBST(WITH_GSSAPI)
9958 AC_SUBST(GSSAPI_LIBS)
9959 AC_SUBST(KRB5_LIBS)
9960 AC_SUBST(BUILD_POSTGRESQL_SDBC)
9961 AC_SUBST(SYSTEM_POSTGRESQL)
9962 AC_SUBST(POSTGRESQL_INC)
9963 AC_SUBST(POSTGRESQL_LIB)
9965 dnl ===================================================================
9966 dnl Check for Firebird stuff
9967 dnl ===================================================================
9968 ENABLE_FIREBIRD_SDBC=
9969 if test "$enable_firebird_sdbc" = "yes" ; then
9970     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
9972     dnl ===================================================================
9973     dnl Check for system Firebird
9974     dnl ===================================================================
9975     AC_MSG_CHECKING([which Firebird to use])
9976     if test "$with_system_firebird" = "yes"; then
9977         AC_MSG_RESULT([external])
9978         SYSTEM_FIREBIRD=TRUE
9979         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
9980         if test -z "$FIREBIRDCONFIG"; then
9981             AC_MSG_NOTICE([No fb_config -- using pkg-config])
9982             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
9983                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
9984             ])
9985             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
9986         else
9987             AC_MSG_NOTICE([fb_config found])
9988             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
9989             AC_MSG_CHECKING([for Firebird Client library])
9990             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
9991             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
9992             FilterLibs "${FIREBIRD_LIBS}"
9993             FIREBIRD_LIBS="${filteredlibs}"
9994         fi
9995         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
9996         AC_MSG_CHECKING([Firebird version])
9997         if test -n "${FIREBIRD_VERSION}"; then
9998             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
9999             if test "$FIREBIRD_MAJOR" -ge "3"; then
10000                 AC_MSG_RESULT([OK])
10001             else
10002                 AC_MSG_ERROR([Ensure firebird >= 3 is installed])
10003             fi
10004         else
10005             save_CFLAGS="${CFLAGS}"
10006             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
10007             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
10008 #if defined(FB_API_VER) && FB_API_VER == 30
10009 int fb_api_is_30(void) { return 0; }
10010 #else
10011 #error "Wrong Firebird API version"
10012 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
10013             CFLAGS="$save_CFLAGS"
10014         fi
10015         ENABLE_FIREBIRD_SDBC=TRUE
10016         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10017     elif test "$enable_database_connectivity" != yes; then
10018         AC_MSG_RESULT([none])
10019     elif test "$cross_compiling" = "yes"; then
10020         AC_MSG_RESULT([none])
10021     else
10022         dnl Embedded Firebird has version 3.0
10023         dnl We need libatomic_ops for any non X86/X64 system
10024         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
10025             dnl ===================================================================
10026             dnl Check for system libatomic_ops
10027             dnl ===================================================================
10028             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[LIBATOMIC_OPS],[atomic_ops >= 0.7.2])
10029             if test "$with_system_libatomic_ops" = "yes"; then
10030                 SYSTEM_LIBATOMIC_OPS=TRUE
10031                 AC_CHECK_HEADERS(atomic_ops.h, [],
10032                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
10033             else
10034                 SYSTEM_LIBATOMIC_OPS=
10035                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
10036                 LIBATOMIC_OPS_LIBS="-latomic_ops"
10037                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
10038             fi
10039         fi
10041         AC_MSG_RESULT([internal])
10042         SYSTEM_FIREBIRD=
10043         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
10044         FIREBIRD_LIBS="-lfbclient"
10046         if test "$with_system_libtommath" = "yes"; then
10047             SYSTEM_LIBTOMMATH=TRUE
10048             dnl check for tommath presence
10049             save_LIBS=$LIBS
10050             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
10051             AC_CHECK_LIB(tommath, mp_init, LIBTOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
10052             LIBS=$save_LIBS
10053         else
10054             SYSTEM_LIBTOMMATH=
10055             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
10056             LIBTOMMATH_LIBS="-ltommath"
10057             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
10058         fi
10060         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
10061         ENABLE_FIREBIRD_SDBC=TRUE
10062         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10063     fi
10065 AC_SUBST(ENABLE_FIREBIRD_SDBC)
10066 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
10067 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
10068 AC_SUBST(LIBATOMIC_OPS_LIBS)
10069 AC_SUBST(SYSTEM_FIREBIRD)
10070 AC_SUBST(FIREBIRD_CFLAGS)
10071 AC_SUBST(FIREBIRD_LIBS)
10072 AC_SUBST(SYSTEM_LIBTOMMATH)
10073 AC_SUBST(LIBTOMMATH_CFLAGS)
10074 AC_SUBST(LIBTOMMATH_LIBS)
10076 dnl ===================================================================
10077 dnl Check for system curl
10078 dnl ===================================================================
10079 AC_MSG_CHECKING([which libcurl to use])
10080 if test "$with_system_curl" = "auto"; then
10081     with_system_curl="$with_system_libs"
10084 if test "$with_system_curl" = "yes"; then
10085     AC_MSG_RESULT([external])
10086     SYSTEM_CURL=TRUE
10088     # First try PKGCONFIG and then fall back
10089     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
10091     if test -n "$CURL_PKG_ERRORS"; then
10092         AC_PATH_PROG(CURLCONFIG, curl-config)
10093         if test -z "$CURLCONFIG"; then
10094             AC_MSG_ERROR([curl development files not found])
10095         fi
10096         CURL_LIBS=`$CURLCONFIG --libs`
10097         FilterLibs "${CURL_LIBS}"
10098         CURL_LIBS="${filteredlibs}"
10099         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
10100         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
10102         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
10103         case $curl_version in
10104         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
10105         dnl so they need to be doubled to end up in the configure script
10106         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
10107             AC_MSG_RESULT([yes])
10108             ;;
10109         *)
10110             AC_MSG_ERROR([no, you have $curl_version])
10111             ;;
10112         esac
10113     fi
10115     ENABLE_CURL=TRUE
10116 else
10117     AC_MSG_RESULT([internal])
10118     SYSTEM_CURL=
10119     BUILD_TYPE="$BUILD_TYPE CURL"
10120     ENABLE_CURL=TRUE
10122 AC_SUBST(SYSTEM_CURL)
10123 AC_SUBST(CURL_CFLAGS)
10124 AC_SUBST(CURL_LIBS)
10125 AC_SUBST(ENABLE_CURL)
10127 dnl ===================================================================
10128 dnl Check for system boost
10129 dnl ===================================================================
10130 AC_MSG_CHECKING([which boost to use])
10131 if test "$with_system_boost" = "yes"; then
10132     AC_MSG_RESULT([external])
10133     SYSTEM_BOOST=TRUE
10134     AX_BOOST_BASE([1.66],,[AC_MSG_ERROR([no suitable Boost found])])
10135     AX_BOOST_DATE_TIME
10136     AX_BOOST_FILESYSTEM
10137     AX_BOOST_IOSTREAMS
10138     AX_BOOST_LOCALE
10139     AC_LANG_PUSH([C++])
10140     save_CXXFLAGS=$CXXFLAGS
10141     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
10142     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
10143        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
10144     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
10145        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
10146     CXXFLAGS=$save_CXXFLAGS
10147     AC_LANG_POP([C++])
10148     # this is in m4/ax_boost_base.m4
10149     FilterLibs "${BOOST_LDFLAGS}"
10150     BOOST_LDFLAGS="${filteredlibs}"
10151 else
10152     AC_MSG_RESULT([internal])
10153     BUILD_TYPE="$BUILD_TYPE BOOST"
10154     SYSTEM_BOOST=
10155     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
10156         # use warning-suppressing wrapper headers
10157         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
10158     else
10159         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
10160     fi
10162 AC_SUBST(SYSTEM_BOOST)
10164 dnl ===================================================================
10165 dnl Check for system mdds
10166 dnl ===================================================================
10167 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
10169 dnl ===================================================================
10170 dnl Check for system glm
10171 dnl ===================================================================
10172 AC_MSG_CHECKING([which glm to use])
10173 if test "$with_system_glm" = "yes"; then
10174     AC_MSG_RESULT([external])
10175     SYSTEM_GLM=TRUE
10176     AC_LANG_PUSH([C++])
10177     AC_CHECK_HEADER([glm/glm.hpp], [],
10178        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
10179     AC_LANG_POP([C++])
10180 else
10181     AC_MSG_RESULT([internal])
10182     BUILD_TYPE="$BUILD_TYPE GLM"
10183     SYSTEM_GLM=
10184     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
10186 AC_SUBST([GLM_CFLAGS])
10187 AC_SUBST([SYSTEM_GLM])
10189 dnl ===================================================================
10190 dnl Check for system odbc
10191 dnl ===================================================================
10192 AC_MSG_CHECKING([which odbc headers to use])
10193 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
10194     AC_MSG_RESULT([external])
10195     SYSTEM_ODBC_HEADERS=TRUE
10197     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
10198         save_CPPFLAGS=$CPPFLAGS
10199         find_winsdk
10200         PathFormat "$winsdktest"
10201         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"
10202         AC_CHECK_HEADER(sqlext.h, [],
10203             [AC_MSG_ERROR(odbc not found. install odbc)],
10204             [#include <windows.h>])
10205         CPPFLAGS=$save_CPPFLAGS
10206     else
10207         AC_CHECK_HEADER(sqlext.h, [],
10208             [AC_MSG_ERROR(odbc not found. install odbc)],[])
10209     fi
10210 elif test "$enable_database_connectivity" != yes; then
10211     AC_MSG_RESULT([none])
10212 else
10213     AC_MSG_RESULT([internal])
10214     SYSTEM_ODBC_HEADERS=
10215     BUILD_TYPE="$BUILD_TYPE IODBC"
10217 AC_SUBST(SYSTEM_ODBC_HEADERS)
10219 dnl ===================================================================
10220 dnl Enable LDAP support
10221 dnl ===================================================================
10223 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
10224 AC_MSG_CHECKING([whether to enable LDAP support])
10225     if test "$enable_ldap" != "yes"; then
10226         AC_MSG_RESULT([no])
10227         ENABLE_LDAP=""
10228         enable_ldap=no
10229     else
10230         AC_MSG_RESULT([yes])
10231         ENABLE_LDAP="TRUE"
10232     fi
10234 AC_SUBST(ENABLE_LDAP)
10236 dnl ===================================================================
10237 dnl Check for system openldap
10238 dnl ===================================================================
10240 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
10241 AC_MSG_CHECKING([which openldap library to use])
10242 if test "$with_system_openldap" = "yes"; then
10243     AC_MSG_RESULT([external])
10244     SYSTEM_OPENLDAP=TRUE
10245     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
10246     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10247     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10248 else
10249     AC_MSG_RESULT([internal])
10250     SYSTEM_OPENLDAP=
10251     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
10254 AC_SUBST(SYSTEM_OPENLDAP)
10256 dnl ===================================================================
10257 dnl Check for system NSS
10258 dnl ===================================================================
10259 if test "$enable_fuzzers" != "yes"; then
10260     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
10261     AC_DEFINE(HAVE_FEATURE_NSS)
10262     ENABLE_NSS="TRUE"
10263     AC_DEFINE(ENABLE_NSS)
10264 elif test $_os != iOS ; then
10265     with_tls=openssl
10267 AC_SUBST(ENABLE_NSS)
10269 dnl ===================================================================
10270 dnl Check for TLS/SSL and cryptographic implementation to use
10271 dnl ===================================================================
10272 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
10273 if test -n "$with_tls"; then
10274     case $with_tls in
10275     openssl)
10276         AC_DEFINE(USE_TLS_OPENSSL)
10277         TLS=OPENSSL
10278         AC_MSG_RESULT([$TLS])
10280         if test "$enable_openssl" != "yes"; then
10281             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
10282         fi
10284         # warn that OpenSSL has been selected but not all TLS code has this option
10285         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
10286         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
10287         ;;
10288     nss)
10289         AC_DEFINE(USE_TLS_NSS)
10290         TLS=NSS
10291         AC_MSG_RESULT([$TLS])
10292         ;;
10293     no)
10294         AC_MSG_RESULT([none])
10295         AC_MSG_WARN([Skipping TLS/SSL])
10296         ;;
10297     *)
10298         AC_MSG_RESULT([])
10299         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
10300 openssl - OpenSSL
10301 nss - Mozilla's Network Security Services (NSS)
10302     ])
10303         ;;
10304     esac
10305 else
10306     # default to using NSS, it results in smaller oox lib
10307     AC_DEFINE(USE_TLS_NSS)
10308     TLS=NSS
10309     AC_MSG_RESULT([$TLS])
10311 AC_SUBST(TLS)
10313 dnl ===================================================================
10314 dnl Check for system sane
10315 dnl ===================================================================
10316 AC_MSG_CHECKING([which sane header to use])
10317 if test "$with_system_sane" = "yes"; then
10318     AC_MSG_RESULT([external])
10319     AC_CHECK_HEADER(sane/sane.h, [],
10320       [AC_MSG_ERROR(sane not found. install sane)], [])
10321 else
10322     AC_MSG_RESULT([internal])
10323     BUILD_TYPE="$BUILD_TYPE SANE"
10326 dnl ===================================================================
10327 dnl Check for system icu
10328 dnl ===================================================================
10329 SYSTEM_GENBRK=
10330 SYSTEM_GENCCODE=
10331 SYSTEM_GENCMN=
10333 ICU_MAJOR=68
10334 ICU_MINOR=1
10335 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
10336 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
10337 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
10338 AC_MSG_CHECKING([which icu to use])
10339 if test "$with_system_icu" = "yes"; then
10340     AC_MSG_RESULT([external])
10341     SYSTEM_ICU=TRUE
10342     AC_LANG_PUSH([C++])
10343     AC_MSG_CHECKING([for unicode/rbbi.h])
10344     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
10345     AC_LANG_POP([C++])
10347     if test "$cross_compiling" != "yes"; then
10348         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
10349         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
10350         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
10351         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
10352     fi
10354     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
10355         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
10356         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
10357         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
10358         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
10359         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
10360             AC_MSG_RESULT([yes])
10361         else
10362             AC_MSG_RESULT([no])
10363             if test "$with_system_icu_for_build" != "force"; then
10364                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
10365 You can use --with-system-icu-for-build=force to use it anyway.])
10366             fi
10367         fi
10368     fi
10370     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
10371         # using the system icu tools can lead to version confusion, use the
10372         # ones from the build environment when cross-compiling
10373         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
10374         if test -z "$SYSTEM_GENBRK"; then
10375             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
10376         fi
10377         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
10378         if test -z "$SYSTEM_GENCCODE"; then
10379             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
10380         fi
10381         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
10382         if test -z "$SYSTEM_GENCMN"; then
10383             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
10384         fi
10385         if test "$ICU_MAJOR" -ge "49"; then
10386             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
10387             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
10388             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
10389         else
10390             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
10391             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
10392             ICU_RECLASSIFIED_HEBREW_LETTER=
10393         fi
10394     fi
10396     if test "$cross_compiling" = "yes"; then
10397         if test "$ICU_MAJOR" -ge "50"; then
10398             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
10399             ICU_MINOR=""
10400         fi
10401     fi
10402 else
10403     AC_MSG_RESULT([internal])
10404     SYSTEM_ICU=
10405     BUILD_TYPE="$BUILD_TYPE ICU"
10406     # surprisingly set these only for "internal" (to be used by various other
10407     # external libs): the system icu-config is quite unhelpful and spits out
10408     # dozens of weird flags and also default path -I/usr/include
10409     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
10410     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
10412 if test "$ICU_MAJOR" -ge "59"; then
10413     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
10414     # with -std=c++11 but not all external libraries can be built with that,
10415     # for those use a bit-compatible typedef uint16_t UChar; see
10416     # icu/source/common/unicode/umachine.h
10417     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
10418 else
10419     ICU_UCHAR_TYPE=""
10421 AC_SUBST(SYSTEM_ICU)
10422 AC_SUBST(SYSTEM_GENBRK)
10423 AC_SUBST(SYSTEM_GENCCODE)
10424 AC_SUBST(SYSTEM_GENCMN)
10425 AC_SUBST(ICU_MAJOR)
10426 AC_SUBST(ICU_MINOR)
10427 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
10428 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
10429 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
10430 AC_SUBST(ICU_CFLAGS)
10431 AC_SUBST(ICU_LIBS)
10432 AC_SUBST(ICU_UCHAR_TYPE)
10434 dnl ==================================================================
10435 dnl Breakpad
10436 dnl ==================================================================
10437 DEFAULT_CRASHDUMP_VALUE="true"
10438 AC_MSG_CHECKING([whether to enable breakpad])
10439 if test "$enable_breakpad" != yes; then
10440     AC_MSG_RESULT([no])
10441 else
10442     AC_MSG_RESULT([yes])
10443     ENABLE_BREAKPAD="TRUE"
10444     AC_DEFINE(ENABLE_BREAKPAD)
10445     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
10446     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
10448     AC_MSG_CHECKING([for disable crash dump])
10449     if test "$enable_crashdump" = no; then
10450         DEFAULT_CRASHDUMP_VALUE="false"
10451         AC_MSG_RESULT([yes])
10452     else
10453        AC_MSG_RESULT([no])
10454     fi
10456     AC_MSG_CHECKING([for crashreport config])
10457     if test "$with_symbol_config" = "no"; then
10458         BREAKPAD_SYMBOL_CONFIG="invalid"
10459         AC_MSG_RESULT([no])
10460     else
10461         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
10462         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
10463         AC_MSG_RESULT([yes])
10464     fi
10465     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
10467 AC_SUBST(ENABLE_BREAKPAD)
10468 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
10470 dnl ==================================================================
10471 dnl libfuzzer
10472 dnl ==================================================================
10473 AC_MSG_CHECKING([whether to enable fuzzers])
10474 if test "$enable_fuzzers" != yes; then
10475     AC_MSG_RESULT([no])
10476 else
10477     AC_MSG_RESULT([yes])
10478     ENABLE_FUZZERS="TRUE"
10479     AC_DEFINE([ENABLE_FUZZERS],1)
10480     BUILD_TYPE="$BUILD_TYPE FUZZERS"
10482 AC_SUBST(ENABLE_FUZZERS)
10484 dnl ===================================================================
10485 dnl Orcus
10486 dnl ===================================================================
10487 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.16 >= 0.16.0])
10488 if test "$with_system_orcus" != "yes"; then
10489     if test "$SYSTEM_BOOST" = "TRUE"; then
10490         # ===========================================================
10491         # Determine if we are going to need to link with Boost.System
10492         # ===========================================================
10493         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
10494         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
10495         dnl in documentation has no effect.
10496         AC_MSG_CHECKING([if we need to link with Boost.System])
10497         AC_LANG_PUSH([C++])
10498         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
10499                 @%:@include <boost/version.hpp>
10500             ]],[[
10501                 #if BOOST_VERSION >= 105000
10502                 #   error yes, we need to link with Boost.System
10503                 #endif
10504             ]])],[
10505                 AC_MSG_RESULT([no])
10506             ],[
10507                 AC_MSG_RESULT([yes])
10508                 AX_BOOST_SYSTEM
10509         ])
10510         AC_LANG_POP([C++])
10511     fi
10513 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
10514 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
10515 AC_SUBST([BOOST_SYSTEM_LIB])
10516 AC_SUBST(SYSTEM_LIBORCUS)
10518 dnl ===================================================================
10519 dnl HarfBuzz
10520 dnl ===================================================================
10521 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
10522                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
10523                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
10525 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
10526                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
10527                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
10529 if test "$COM" = "MSC"; then # override the above
10530     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
10531     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
10534 if test "$with_system_harfbuzz" = "yes"; then
10535     if test "$with_system_graphite" = "no"; then
10536         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
10537     fi
10538     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
10539     save_LIBS="$LIBS"
10540     save_CFLAGS="$CFLAGS"
10541     LIBS="$LIBS $HARFBUZZ_LIBS"
10542     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
10543     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
10544     LIBS="$save_LIBS"
10545     CFLAGS="$save_CFLAGS"
10546 else
10547     if test "$with_system_graphite" = "yes"; then
10548         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
10549     fi
10552 AC_MSG_CHECKING([whether to use X11])
10553 dnl ***************************************
10554 dnl testing for X libraries and includes...
10555 dnl ***************************************
10556 if test "$USING_X11" = TRUE; then
10557     AC_DEFINE(HAVE_FEATURE_X11)
10559 AC_MSG_RESULT([$USING_X11])
10561 if test "$USING_X11" = TRUE; then
10562     AC_PATH_X
10563     AC_PATH_XTRA
10564     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
10566     if test -z "$x_includes"; then
10567         x_includes="default_x_includes"
10568     fi
10569     if test -z "$x_libraries"; then
10570         x_libraries="default_x_libraries"
10571     fi
10572     CFLAGS="$CFLAGS $X_CFLAGS"
10573     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
10574     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
10575 else
10576     x_includes="no_x_includes"
10577     x_libraries="no_x_libraries"
10580 if test "$USING_X11" = TRUE; then
10581     dnl ===================================================================
10582     dnl Check for extension headers
10583     dnl ===================================================================
10584     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
10585      [#include <X11/extensions/shape.h>])
10587     # vcl needs ICE and SM
10588     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
10589     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
10590         [AC_MSG_ERROR(ICE library not found)])
10591     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
10592     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
10593         [AC_MSG_ERROR(SM library not found)])
10596 if test "$USING_X11" = TRUE -a "$ENABLE_JAVA" != ""; then
10597     # bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c needs Xt
10598     AC_CHECK_HEADERS(X11/Intrinsic.h,[],[AC_MSG_ERROR([libXt headers not found])])
10601 dnl ===================================================================
10602 dnl Check for system Xrender
10603 dnl ===================================================================
10604 AC_MSG_CHECKING([whether to use Xrender])
10605 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
10606     AC_MSG_RESULT([yes])
10607     PKG_CHECK_MODULES(XRENDER, xrender)
10608     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10609     FilterLibs "${XRENDER_LIBS}"
10610     XRENDER_LIBS="${filteredlibs}"
10611     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
10612       [AC_MSG_ERROR(libXrender not found or functional)], [])
10613     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
10614       [AC_MSG_ERROR(Xrender not found. install X)], [])
10615 else
10616     AC_MSG_RESULT([no])
10618 AC_SUBST(XRENDER_CFLAGS)
10619 AC_SUBST(XRENDER_LIBS)
10621 dnl ===================================================================
10622 dnl Check for XRandr
10623 dnl ===================================================================
10624 AC_MSG_CHECKING([whether to enable RandR support])
10625 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
10626     AC_MSG_RESULT([yes])
10627     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
10628     if test "$ENABLE_RANDR" != "TRUE"; then
10629         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
10630                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
10631         XRANDR_CFLAGS=" "
10632         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
10633           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
10634         XRANDR_LIBS="-lXrandr "
10635         ENABLE_RANDR="TRUE"
10636     fi
10637     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10638     FilterLibs "${XRANDR_LIBS}"
10639     XRANDR_LIBS="${filteredlibs}"
10640 else
10641     ENABLE_RANDR=""
10642     AC_MSG_RESULT([no])
10644 AC_SUBST(XRANDR_CFLAGS)
10645 AC_SUBST(XRANDR_LIBS)
10646 AC_SUBST(ENABLE_RANDR)
10648 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
10649     if test -z "$WITH_WEBDAV"; then
10650         WITH_WEBDAV="serf"
10651     fi
10653 if test $_os = iOS -o $_os = Android; then
10654     WITH_WEBDAV="no"
10656 AC_MSG_CHECKING([for webdav library])
10657 case "$WITH_WEBDAV" in
10658 serf)
10659     AC_MSG_RESULT([serf])
10660     # Check for system apr-util
10661     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
10662                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
10663                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
10664     if test "$COM" = "MSC"; then
10665         APR_LIB_DIR="LibR"
10666         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
10667         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
10668     fi
10670     # Check for system serf
10671     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.3.9])
10672     ;;
10673 neon)
10674     AC_MSG_RESULT([neon])
10675     # Check for system neon
10676     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.31.2])
10677     if test "$with_system_neon" = "yes"; then
10678         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
10679     else
10680         NEON_VERSION=0312
10681     fi
10682     AC_SUBST(NEON_VERSION)
10683     ;;
10685     AC_MSG_RESULT([none, disabled])
10686     WITH_WEBDAV=""
10687     ;;
10688 esac
10689 AC_SUBST(WITH_WEBDAV)
10691 dnl ===================================================================
10692 dnl Check for disabling cve_tests
10693 dnl ===================================================================
10694 AC_MSG_CHECKING([whether to execute CVE tests])
10695 # If not explicitly enabled or disabled, default
10696 if test -z "$enable_cve_tests"; then
10697     case "$OS" in
10698     WNT)
10699         # Default cves off for Windows with its wild and wonderful
10700         # variety of AV software kicking in and panicking
10701         enable_cve_tests=no
10702         ;;
10703     *)
10704         # otherwise yes
10705         enable_cve_tests=yes
10706         ;;
10707     esac
10709 if test "$enable_cve_tests" = "no"; then
10710     AC_MSG_RESULT([no])
10711     DISABLE_CVE_TESTS=TRUE
10712     AC_SUBST(DISABLE_CVE_TESTS)
10713 else
10714     AC_MSG_RESULT([yes])
10717 dnl ===================================================================
10718 dnl Check for enabling chart XShape tests
10719 dnl ===================================================================
10720 AC_MSG_CHECKING([whether to execute chart XShape tests])
10721 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
10722     AC_MSG_RESULT([yes])
10723     ENABLE_CHART_TESTS=TRUE
10724     AC_SUBST(ENABLE_CHART_TESTS)
10725 else
10726     AC_MSG_RESULT([no])
10729 dnl ===================================================================
10730 dnl Check for system openssl
10731 dnl ===================================================================
10732 DISABLE_OPENSSL=
10733 AC_MSG_CHECKING([whether to disable OpenSSL usage])
10734 if test "$enable_openssl" = "yes"; then
10735     AC_MSG_RESULT([no])
10736     if test "$_os" = Darwin ; then
10737         # OpenSSL is deprecated when building for 10.7 or later.
10738         #
10739         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
10740         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
10742         with_system_openssl=no
10743         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10744     elif test "$_os" = "FreeBSD" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
10745             && test "$with_system_openssl" != "no"; then
10746         with_system_openssl=yes
10747         SYSTEM_OPENSSL=TRUE
10748         OPENSSL_CFLAGS=
10749         OPENSSL_LIBS="-lssl -lcrypto"
10750     else
10751         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10752     fi
10753     if test "$with_system_openssl" = "yes"; then
10754         AC_MSG_CHECKING([whether openssl supports SHA512])
10755         AC_LANG_PUSH([C])
10756         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
10757             SHA512_CTX context;
10758 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
10759         AC_LANG_POP(C)
10760     fi
10761 else
10762     AC_MSG_RESULT([yes])
10763     DISABLE_OPENSSL=TRUE
10765     # warn that although OpenSSL is disabled, system libraries may depend on it
10766     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
10767     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
10770 AC_SUBST([DISABLE_OPENSSL])
10772 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
10773     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
10774         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
10775         enable_cipher_openssl_backend=no
10776     else
10777         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
10778     fi
10780 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
10781 ENABLE_CIPHER_OPENSSL_BACKEND=
10782 if test "$enable_cipher_openssl_backend" = yes; then
10783     AC_MSG_RESULT([yes])
10784     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
10785 else
10786     AC_MSG_RESULT([no])
10788 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
10790 dnl ===================================================================
10791 dnl Check for building gnutls
10792 dnl ===================================================================
10793 AC_MSG_CHECKING([whether to use gnutls])
10794 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
10795     AC_MSG_RESULT([yes])
10796     AM_PATH_LIBGCRYPT()
10797     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
10798         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
10799                       available in the system to use as replacement.]]))
10800     FilterLibs "${LIBGCRYPT_LIBS}"
10801     LIBGCRYPT_LIBS="${filteredlibs}"
10802 else
10803     AC_MSG_RESULT([no])
10806 AC_SUBST([LIBGCRYPT_CFLAGS])
10807 AC_SUBST([LIBGCRYPT_LIBS])
10809 dnl ===================================================================
10810 dnl Check for system redland
10811 dnl ===================================================================
10812 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
10813 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
10814 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
10815 if test "$with_system_redland" = "yes"; then
10816     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
10817             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
10818 else
10819     RAPTOR_MAJOR="0"
10820     RASQAL_MAJOR="3"
10821     REDLAND_MAJOR="0"
10823 AC_SUBST(RAPTOR_MAJOR)
10824 AC_SUBST(RASQAL_MAJOR)
10825 AC_SUBST(REDLAND_MAJOR)
10827 dnl ===================================================================
10828 dnl Check for system hunspell
10829 dnl ===================================================================
10830 AC_MSG_CHECKING([which libhunspell to use])
10831 if test "$with_system_hunspell" = "yes"; then
10832     AC_MSG_RESULT([external])
10833     SYSTEM_HUNSPELL=TRUE
10834     AC_LANG_PUSH([C++])
10835     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
10836     if test "$HUNSPELL_PC" != "TRUE"; then
10837         AC_CHECK_HEADER(hunspell.hxx, [],
10838             [
10839             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
10840             [AC_MSG_ERROR(hunspell headers not found.)], [])
10841             ], [])
10842         AC_CHECK_LIB([hunspell], [main], [:],
10843            [ AC_MSG_ERROR(hunspell library not found.) ], [])
10844         HUNSPELL_LIBS=-lhunspell
10845     fi
10846     AC_LANG_POP([C++])
10847     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10848     FilterLibs "${HUNSPELL_LIBS}"
10849     HUNSPELL_LIBS="${filteredlibs}"
10850 else
10851     AC_MSG_RESULT([internal])
10852     SYSTEM_HUNSPELL=
10853     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
10854     if test "$COM" = "MSC"; then
10855         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
10856     else
10857         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
10858     fi
10859     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
10861 AC_SUBST(SYSTEM_HUNSPELL)
10862 AC_SUBST(HUNSPELL_CFLAGS)
10863 AC_SUBST(HUNSPELL_LIBS)
10865 dnl ===================================================================
10866 dnl Check for system qrcodegen
10867 dnl ===================================================================
10868 AC_MSG_CHECKING([whether to use libqrcodegen])
10869 if test "$enable_qrcodegen" = "no"; then
10870     AC_MSG_RESULT([no])
10871     ENABLE_QRCODEGEN=
10872     SYSTEM_QRCODEGEN=
10873 else
10874     AC_MSG_RESULT([yes])
10875     ENABLE_QRCODEGEN=TRUE
10876     AC_MSG_CHECKING([which libqrcodegen to use])
10877     if test "$with_system_qrcodegen" = "yes"; then
10878         AC_MSG_RESULT([external])
10879         SYSTEM_QRCODEGEN=TRUE
10880         AC_LANG_PUSH([C++])
10881         AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [],
10882             [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>])
10883         AC_CHECK_LIB([qrcodegencpp], [main], [:],
10884             [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], [])
10885         QRCODEGEN_LIBS=-lqrcodegencpp
10886         AC_LANG_POP([C++])
10887         QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10888         FilterLibs "${QRCODEGEN_LIBS}"
10889         QRCODEGEN_LIBS="${filteredlibs}"
10890     else
10891         AC_MSG_RESULT([internal])
10892         SYSTEM_QRCODEGEN=
10893         BUILD_TYPE="$BUILD_TYPE QRCODEGEN"
10894     fi
10895     if test "$ENABLE_QRCODEGEN" = TRUE; then
10896         AC_DEFINE(ENABLE_QRCODEGEN)
10897     fi
10899 AC_SUBST(SYSTEM_QRCODEGEN)
10900 AC_SUBST(ENABLE_QRCODEGEN)
10901 AC_SUBST(QRCODEGEN_CFLAGS)
10902 AC_SUBST(QRCODEGEN_LIBS)
10904 dnl ===================================================================
10905 dnl Check for system box2d
10906 dnl ===================================================================
10907 AC_MSG_CHECKING([which box2d to use])
10908 if test "$with_system_box2d" = "yes"; then
10909     AC_MSG_RESULT([external])
10910     SYSTEM_BOX2D=TRUE
10911     AC_LANG_PUSH([C++])
10912     AC_CHECK_HEADER(box2d/box2d.h, [BOX2D_H_FOUND='TRUE'],
10913         [BOX2D_H_FOUND='FALSE'])
10914     if test "$BOX2D_H_FOUND" = "TRUE"; then # 2.4.0+
10915         _BOX2D_LIB=box2d
10916         AC_DEFINE(BOX2D_HEADER,<box2d/box2d.h>)
10917     else
10918         # fail this. there's no other alternative to check when we are here.
10919         AC_CHECK_HEADER([Box2D/Box2D.h], [],
10920                 [AC_MSG_ERROR(box2d headers not found.)])
10921         _BOX2D_LIB=Box2D
10922         AC_DEFINE(BOX2D_HEADER,<Box2D/Box2D.h>)
10923     fi
10924     AC_CHECK_LIB([$_BOX2D_LIB], [main], [:],
10925         [ AC_MSG_ERROR(box2d library not found.) ], [])
10926     BOX2D_LIBS=-l$_BOX2D_LIB
10927     AC_LANG_POP([C++])
10928     BOX2D_CFLAGS=$(printf '%s' "$BOX2D_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10929     FilterLibs "${BOX2D_LIBS}"
10930     BOX2D_LIBS="${filteredlibs}"
10931 else
10932     AC_MSG_RESULT([internal])
10933     SYSTEM_BOX2D=
10934     BUILD_TYPE="$BUILD_TYPE BOX2D"
10936 AC_SUBST(SYSTEM_BOX2D)
10937 AC_SUBST(BOX2D_CFLAGS)
10938 AC_SUBST(BOX2D_LIBS)
10940 dnl ===================================================================
10941 dnl Checking for altlinuxhyph
10942 dnl ===================================================================
10943 AC_MSG_CHECKING([which altlinuxhyph to use])
10944 if test "$with_system_altlinuxhyph" = "yes"; then
10945     AC_MSG_RESULT([external])
10946     SYSTEM_HYPH=TRUE
10947     AC_CHECK_HEADER(hyphen.h, [],
10948        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
10949     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
10950        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
10951        [#include <hyphen.h>])
10952     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
10953         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10954     if test -z "$HYPHEN_LIB"; then
10955         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
10956            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10957     fi
10958     if test -z "$HYPHEN_LIB"; then
10959         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
10960            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10961     fi
10962 else
10963     AC_MSG_RESULT([internal])
10964     SYSTEM_HYPH=
10965     BUILD_TYPE="$BUILD_TYPE HYPHEN"
10966     if test "$COM" = "MSC"; then
10967         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
10968     else
10969         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
10970     fi
10972 AC_SUBST(SYSTEM_HYPH)
10973 AC_SUBST(HYPHEN_LIB)
10975 dnl ===================================================================
10976 dnl Checking for mythes
10977 dnl ===================================================================
10978 AC_MSG_CHECKING([which mythes to use])
10979 if test "$with_system_mythes" = "yes"; then
10980     AC_MSG_RESULT([external])
10981     SYSTEM_MYTHES=TRUE
10982     AC_LANG_PUSH([C++])
10983     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
10984     if test "$MYTHES_PKGCONFIG" = "no"; then
10985         AC_CHECK_HEADER(mythes.hxx, [],
10986             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
10987         AC_CHECK_LIB([mythes-1.2], [main], [:],
10988             [ MYTHES_FOUND=no], [])
10989     if test "$MYTHES_FOUND" = "no"; then
10990         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
10991                 [ MYTHES_FOUND=no], [])
10992     fi
10993     if test "$MYTHES_FOUND" = "no"; then
10994         AC_MSG_ERROR([mythes library not found!.])
10995     fi
10996     fi
10997     AC_LANG_POP([C++])
10998     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10999     FilterLibs "${MYTHES_LIBS}"
11000     MYTHES_LIBS="${filteredlibs}"
11001 else
11002     AC_MSG_RESULT([internal])
11003     SYSTEM_MYTHES=
11004     BUILD_TYPE="$BUILD_TYPE MYTHES"
11005     if test "$COM" = "MSC"; then
11006         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
11007     else
11008         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
11009     fi
11011 AC_SUBST(SYSTEM_MYTHES)
11012 AC_SUBST(MYTHES_CFLAGS)
11013 AC_SUBST(MYTHES_LIBS)
11015 dnl ===================================================================
11016 dnl How should we build the linear programming solver ?
11017 dnl ===================================================================
11019 ENABLE_COINMP=
11020 AC_MSG_CHECKING([whether to build with CoinMP])
11021 if test "$enable_coinmp" != "no"; then
11022     ENABLE_COINMP=TRUE
11023     AC_MSG_RESULT([yes])
11024     if test "$with_system_coinmp" = "yes"; then
11025         SYSTEM_COINMP=TRUE
11026         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
11027         FilterLibs "${COINMP_LIBS}"
11028         COINMP_LIBS="${filteredlibs}"
11029     else
11030         BUILD_TYPE="$BUILD_TYPE COINMP"
11031     fi
11032 else
11033     AC_MSG_RESULT([no])
11035 AC_SUBST(ENABLE_COINMP)
11036 AC_SUBST(SYSTEM_COINMP)
11037 AC_SUBST(COINMP_CFLAGS)
11038 AC_SUBST(COINMP_LIBS)
11040 ENABLE_LPSOLVE=
11041 AC_MSG_CHECKING([whether to build with lpsolve])
11042 if test "$enable_lpsolve" != "no"; then
11043     ENABLE_LPSOLVE=TRUE
11044     AC_MSG_RESULT([yes])
11045 else
11046     AC_MSG_RESULT([no])
11048 AC_SUBST(ENABLE_LPSOLVE)
11050 if test "$ENABLE_LPSOLVE" = TRUE; then
11051     AC_MSG_CHECKING([which lpsolve to use])
11052     if test "$with_system_lpsolve" = "yes"; then
11053         AC_MSG_RESULT([external])
11054         SYSTEM_LPSOLVE=TRUE
11055         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
11056            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
11057         save_LIBS=$LIBS
11058         # some systems need this. Like Ubuntu...
11059         AC_CHECK_LIB(m, floor)
11060         AC_CHECK_LIB(dl, dlopen)
11061         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
11062             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
11063         LIBS=$save_LIBS
11064     else
11065         AC_MSG_RESULT([internal])
11066         SYSTEM_LPSOLVE=
11067         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
11068     fi
11070 AC_SUBST(SYSTEM_LPSOLVE)
11072 dnl ===================================================================
11073 dnl Checking for libexttextcat
11074 dnl ===================================================================
11075 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
11076 if test "$with_system_libexttextcat" = "yes"; then
11077     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
11079 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
11081 dnl ===================================================================
11082 dnl Checking for libnumbertext
11083 dnl ===================================================================
11084 libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.6])
11085 if test "$with_system_libnumbertext" = "yes"; then
11086     SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
11087     SYSTEM_LIBNUMBERTEXT=YES
11088 else
11089     SYSTEM_LIBNUMBERTEXT=
11090     AC_LANG_PUSH([C++])
11091     save_CPPFLAGS=$CPPFLAGS
11092     CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
11093     AC_CHECK_HEADERS([codecvt regex])
11094     AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
11095             [ LIBNUMBERTEXT_CFLAGS=''
11096               AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
11097                            Enable libnumbertext fallback (missing number to number name conversion).])
11098             ])
11099     CPPFLAGS=$save_CPPFLAGS
11100     AC_LANG_POP([C++])
11102 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
11103 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
11104 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
11106 dnl ***************************************
11107 dnl testing libc version for Linux...
11108 dnl ***************************************
11109 if test "$_os" = "Linux"; then
11110     AC_MSG_CHECKING([whether libc is >= 2.1.1])
11111     exec 6>/dev/null # no output
11112     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
11113     exec 6>&1 # output on again
11114     if test "$HAVE_LIBC"; then
11115         AC_MSG_RESULT([yes])
11116     else
11117         AC_MSG_ERROR([no, upgrade libc])
11118     fi
11121 dnl =========================================
11122 dnl Check for uuidgen
11123 dnl =========================================
11124 if test "$_os" = "WINNT"; then
11125     # we must use the uuidgen from the Windows SDK, which will be in the LO_PATH, but isn't in
11126     # the PATH for AC_PATH_PROG. It is already tested above in the WINDOWS_SDK_HOME check.
11127     UUIDGEN=uuidgen.exe
11128     AC_SUBST(UUIDGEN)
11129 else
11130     AC_PATH_PROG([UUIDGEN], [uuidgen])
11131     if test -z "$UUIDGEN"; then
11132         AC_MSG_WARN([uuid is needed for building installation sets])
11133     fi
11136 dnl ***************************************
11137 dnl Checking for bison and flex
11138 dnl ***************************************
11139 AC_PATH_PROG(BISON, bison)
11140 if test -z "$BISON"; then
11141     AC_MSG_ERROR([no bison found in \$PATH, install it])
11142 else
11143     AC_MSG_CHECKING([the bison version])
11144     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
11145     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
11146     dnl Accept newer than 2.0; for --enable-compiler-plugins at least 2.3 is known to be bad and
11147     dnl cause
11148     dnl
11149     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]
11150     dnl   typedef union YYSTYPE
11151     dnl           ~~~~~~^~~~~~~
11152     dnl
11153     dnl while at least 3.4.1 is know to be good:
11154     if test "$COMPILER_PLUGINS" = TRUE; then
11155         if test "$_bison_longver" -lt 2004; then
11156             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.4+ for --enable-compiler-plugins)])
11157         fi
11158     else
11159         if test "$_bison_longver" -lt 2000; then
11160             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
11161         fi
11162     fi
11164 AC_SUBST([BISON])
11166 AC_PATH_PROG(FLEX, flex)
11167 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11168     FLEX=`cygpath -m $FLEX`
11170 if test -z "$FLEX"; then
11171     AC_MSG_ERROR([no flex found in \$PATH, install it])
11172 else
11173     AC_MSG_CHECKING([the flex version])
11174     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
11175     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
11176         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
11177     fi
11179 AC_SUBST([FLEX])
11180 dnl ***************************************
11181 dnl Checking for patch
11182 dnl ***************************************
11183 AC_PATH_PROG(PATCH, patch)
11184 if test -z "$PATCH"; then
11185     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
11188 dnl On Solaris or macOS, check if --with-gnu-patch was used
11189 if test "$_os" = "SunOS" -o "$_os" = "Darwin" -o "$_os" = "FreeBSD"; then
11190     if test -z "$with_gnu_patch"; then
11191         GNUPATCH=$PATCH
11192     else
11193         if test -x "$with_gnu_patch"; then
11194             GNUPATCH=$with_gnu_patch
11195         else
11196             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
11197         fi
11198     fi
11200     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
11201     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
11202         AC_MSG_RESULT([yes])
11203     else
11204         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
11205     fi
11206 else
11207     GNUPATCH=$PATCH
11210 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11211     GNUPATCH=`cygpath -m $GNUPATCH`
11214 dnl We also need to check for --with-gnu-cp
11216 if test -z "$with_gnu_cp"; then
11217     # check the place where the good stuff is hidden on Solaris...
11218     if test -x /usr/gnu/bin/cp; then
11219         GNUCP=/usr/gnu/bin/cp
11220     else
11221         AC_PATH_PROGS(GNUCP, gnucp cp)
11222     fi
11223     if test -z $GNUCP; then
11224         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
11225     fi
11226 else
11227     if test -x "$with_gnu_cp"; then
11228         GNUCP=$with_gnu_cp
11229     else
11230         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
11231     fi
11234 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11235     GNUCP=`cygpath -m $GNUCP`
11238 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
11239 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
11240     AC_MSG_RESULT([yes])
11241 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
11242     AC_MSG_RESULT([yes])
11243 else
11244     case "$build_os" in
11245     darwin*|macos*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
11246         x_GNUCP=[\#]
11247         GNUCP=''
11248         AC_MSG_RESULT([no gnucp found - using the system's cp command])
11249         ;;
11250     *)
11251         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
11252         ;;
11253     esac
11256 AC_SUBST(GNUPATCH)
11257 AC_SUBST(GNUCP)
11258 AC_SUBST(x_GNUCP)
11260 dnl ***************************************
11261 dnl testing assembler path
11262 dnl ***************************************
11263 ML_EXE=""
11264 if test "$_os" = "WINNT"; then
11265     case "$WIN_HOST_ARCH" in
11266     x86) assembler=ml.exe ;;
11267     x64) assembler=ml64.exe ;;
11268     arm64) assembler=armasm64.exe ;;
11269     esac
11271     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
11272     if test -f "$MSVC_HOST_PATH/$assembler"; then
11273         ML_EXE=`win_short_path_for_make "$MSVC_HOST_PATH/$assembler"`
11274         AC_MSG_RESULT([$ML_EXE])
11275     else
11276         AC_MSG_ERROR([not found in $MSVC_HOST_PATH])
11277     fi
11280 AC_SUBST(ML_EXE)
11282 dnl ===================================================================
11283 dnl We need zip and unzip
11284 dnl ===================================================================
11285 AC_PATH_PROG(ZIP, zip)
11286 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
11287 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
11288     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],,)
11291 AC_PATH_PROG(UNZIP, unzip)
11292 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
11294 dnl ===================================================================
11295 dnl Zip must be a specific type for different build types.
11296 dnl ===================================================================
11297 if test $build_os = cygwin; then
11298     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
11299         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
11300     fi
11303 dnl ===================================================================
11304 dnl We need touch with -h option support.
11305 dnl ===================================================================
11306 AC_PATH_PROG(TOUCH, touch)
11307 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
11308 touch warn
11309 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
11310     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],,)
11313 dnl ===================================================================
11314 dnl Check for system epoxy
11315 dnl ===================================================================
11316 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
11318 dnl ===================================================================
11319 dnl Set vcl option: coordinate device in double or sal_Int32
11320 dnl ===================================================================
11322 dnl disabled for now, we don't want subtle differences between OSs
11323 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
11324 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
11325 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
11326 dnl     AC_MSG_RESULT([double])
11327 dnl else
11328 dnl     AC_MSG_RESULT([sal_Int32])
11329 dnl fi
11331 dnl ===================================================================
11332 dnl Test which vclplugs have to be built.
11333 dnl ===================================================================
11334 R=""
11335 if test "$USING_X11" != TRUE; then
11336     enable_gtk3=no
11339 ENABLE_GTK3=""
11340 if test "x$enable_gtk3" = "xyes"; then
11341     ENABLE_GTK3="TRUE"
11342     AC_DEFINE(ENABLE_GTK3)
11343     R="$R gtk3"
11345 AC_SUBST(ENABLE_GTK3)
11347 ENABLE_GTK3_KDE5=""
11348 if test "x$enable_gtk3_kde5" = "xyes"; then
11349     ENABLE_GTK3_KDE5="TRUE"
11350     AC_DEFINE(ENABLE_GTK3_KDE5)
11351     R="$R gtk3_kde5"
11353 AC_SUBST(ENABLE_GTK3_KDE5)
11355 ENABLE_QT5=""
11356 if test "x$enable_qt5" = "xyes"; then
11357     ENABLE_QT5="TRUE"
11358     AC_DEFINE(ENABLE_QT5)
11359     R="$R qt5"
11361 AC_SUBST(ENABLE_QT5)
11363 ENABLE_KF5=""
11364 if test "x$enable_kf5" = "xyes"; then
11365     ENABLE_KF5="TRUE"
11366     AC_DEFINE(ENABLE_KF5)
11367     R="$R kf5"
11369 AC_SUBST(ENABLE_KF5)
11371 GTK3_CFLAGS=""
11372 GTK3_LIBS=""
11373 if test "x$enable_gtk3" = "xyes" -o "x$enable_gtk3_kde5" = "xyes"; then
11374     if test "$with_system_cairo" = no; then
11375         add_warning 'Non-system cairo combined with gtk3 is assumed to cause trouble; proceed at your own risk.'
11376     fi
11377     : ${with_system_cairo:=yes}
11378     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)
11379     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11380     FilterLibs "${GTK3_LIBS}"
11381     GTK3_LIBS="${filteredlibs}"
11383     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
11384     if test "$with_system_epoxy" != "yes"; then
11385         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
11386         AC_CHECK_HEADER(EGL/eglplatform.h, [],
11387                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
11388     fi
11390 AC_SUBST(GTK3_LIBS)
11391 AC_SUBST(GTK3_CFLAGS)
11393 if test "$enable_introspection" = yes; then
11394     if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
11395         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
11396     else
11397         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
11398     fi
11401 if test "$_os" = "WINNT"; then
11402     R="$R win"
11403 elif test "$_os" = "Darwin"; then
11404     R="$R osx"
11405 elif test "$_os" = "iOS"; then
11406     R="ios (builtin)"
11409 build_vcl_plugins="$R"
11410 if test -z "$build_vcl_plugins"; then
11411     build_vcl_plugins="none"
11413 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
11415 dnl ===================================================================
11416 dnl check for dbus support
11417 dnl ===================================================================
11418 ENABLE_DBUS=""
11419 DBUS_CFLAGS=""
11420 DBUS_LIBS=""
11421 DBUS_GLIB_CFLAGS=""
11422 DBUS_GLIB_LIBS=""
11423 DBUS_HAVE_GLIB=""
11425 if test "$enable_dbus" = "no"; then
11426     test_dbus=no
11429 AC_MSG_CHECKING([whether to enable DBUS support])
11430 if test "$test_dbus" = "yes"; then
11431     ENABLE_DBUS="TRUE"
11432     AC_MSG_RESULT([yes])
11433     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
11434     AC_DEFINE(ENABLE_DBUS)
11435     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11436     FilterLibs "${DBUS_LIBS}"
11437     DBUS_LIBS="${filteredlibs}"
11439     # Glib is needed for BluetoothServer
11440     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
11441     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
11442         [
11443             DBUS_HAVE_GLIB="TRUE"
11444             AC_DEFINE(DBUS_HAVE_GLIB,1)
11445         ],
11446         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
11447     )
11448 else
11449     AC_MSG_RESULT([no])
11452 AC_SUBST(ENABLE_DBUS)
11453 AC_SUBST(DBUS_CFLAGS)
11454 AC_SUBST(DBUS_LIBS)
11455 AC_SUBST(DBUS_GLIB_CFLAGS)
11456 AC_SUBST(DBUS_GLIB_LIBS)
11457 AC_SUBST(DBUS_HAVE_GLIB)
11459 AC_MSG_CHECKING([whether to enable Impress remote control])
11460 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
11461     AC_MSG_RESULT([yes])
11462     ENABLE_SDREMOTE=TRUE
11463     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
11465     if test $OS = MACOSX && test "$MACOSX_SDK_VERSION" -ge 101500; then
11466         # The Bluetooth code doesn't compile with macOS SDK 10.15
11467         if test "$enable_sdremote_bluetooth" = yes; then
11468             AC_MSG_ERROR([macOS SDK $with_macosx_sdk does not currently support --enable-sdremote-bluetooth])
11469         fi
11470         enable_sdremote_bluetooth=no
11471     fi
11472     # If not explicitly enabled or disabled, default
11473     if test -z "$enable_sdremote_bluetooth"; then
11474         case "$OS" in
11475         LINUX|MACOSX|WNT)
11476             # Default to yes for these
11477             enable_sdremote_bluetooth=yes
11478             ;;
11479         *)
11480             # otherwise no
11481             enable_sdremote_bluetooth=no
11482             ;;
11483         esac
11484     fi
11485     # $enable_sdremote_bluetooth is guaranteed non-empty now
11487     if test "$enable_sdremote_bluetooth" != "no"; then
11488         if test "$OS" = "LINUX"; then
11489             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
11490                 AC_MSG_RESULT([yes])
11491                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
11492                 dnl ===================================================================
11493                 dnl Check for system bluez
11494                 dnl ===================================================================
11495                 AC_MSG_CHECKING([which Bluetooth header to use])
11496                 if test "$with_system_bluez" = "yes"; then
11497                     AC_MSG_RESULT([external])
11498                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
11499                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
11500                     SYSTEM_BLUEZ=TRUE
11501                 else
11502                     AC_MSG_RESULT([internal])
11503                     SYSTEM_BLUEZ=
11504                 fi
11505             else
11506                 AC_MSG_RESULT([no, dbus disabled])
11507                 ENABLE_SDREMOTE_BLUETOOTH=
11508                 SYSTEM_BLUEZ=
11509             fi
11510         else
11511             AC_MSG_RESULT([yes])
11512             ENABLE_SDREMOTE_BLUETOOTH=TRUE
11513             SYSTEM_BLUEZ=
11514         fi
11515     else
11516         AC_MSG_RESULT([no])
11517         ENABLE_SDREMOTE_BLUETOOTH=
11518         SYSTEM_BLUEZ=
11519     fi
11520 else
11521     ENABLE_SDREMOTE=
11522     SYSTEM_BLUEZ=
11523     AC_MSG_RESULT([no])
11525 AC_SUBST(ENABLE_SDREMOTE)
11526 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
11527 AC_SUBST(SYSTEM_BLUEZ)
11529 dnl ===================================================================
11530 dnl Check whether to enable GIO support
11531 dnl ===================================================================
11532 if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
11533     AC_MSG_CHECKING([whether to enable GIO support])
11534     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
11535         dnl Need at least 2.26 for the dbus support.
11536         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
11537                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
11538         if test "$ENABLE_GIO" = "TRUE"; then
11539             AC_DEFINE(ENABLE_GIO)
11540             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11541             FilterLibs "${GIO_LIBS}"
11542             GIO_LIBS="${filteredlibs}"
11543         fi
11544     else
11545         AC_MSG_RESULT([no])
11546     fi
11548 AC_SUBST(ENABLE_GIO)
11549 AC_SUBST(GIO_CFLAGS)
11550 AC_SUBST(GIO_LIBS)
11553 dnl ===================================================================
11555 SPLIT_APP_MODULES=""
11556 if test "$enable_split_app_modules" = "yes"; then
11557     SPLIT_APP_MODULES="TRUE"
11559 AC_SUBST(SPLIT_APP_MODULES)
11561 SPLIT_OPT_FEATURES=""
11562 if test "$enable_split_opt_features" = "yes"; then
11563     SPLIT_OPT_FEATURES="TRUE"
11565 AC_SUBST(SPLIT_OPT_FEATURES)
11567 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
11568     if test "$enable_cairo_canvas" = yes; then
11569         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
11570     fi
11571     enable_cairo_canvas=no
11572 elif test -z "$enable_cairo_canvas"; then
11573     enable_cairo_canvas=yes
11576 ENABLE_CAIRO_CANVAS=""
11577 if test "$enable_cairo_canvas" = "yes"; then
11578     test_cairo=yes
11579     ENABLE_CAIRO_CANVAS="TRUE"
11580     AC_DEFINE(ENABLE_CAIRO_CANVAS)
11582 AC_SUBST(ENABLE_CAIRO_CANVAS)
11584 dnl ===================================================================
11585 dnl Check whether the GStreamer libraries are available.
11586 dnl ===================================================================
11588 ENABLE_GSTREAMER_1_0=""
11590 if test "$build_gstreamer_1_0" = "yes"; then
11592     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
11593     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
11594         ENABLE_GSTREAMER_1_0="TRUE"
11595         AC_MSG_RESULT([yes])
11596         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
11597         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11598         FilterLibs "${GSTREAMER_1_0_LIBS}"
11599         GSTREAMER_1_0_LIBS="${filteredlibs}"
11600         AC_DEFINE(ENABLE_GSTREAMER_1_0)
11601     else
11602         AC_MSG_RESULT([no])
11603     fi
11605 AC_SUBST(GSTREAMER_1_0_CFLAGS)
11606 AC_SUBST(GSTREAMER_1_0_LIBS)
11607 AC_SUBST(ENABLE_GSTREAMER_1_0)
11609 dnl ===================================================================
11610 dnl Check whether to build the VLC avmedia backend
11611 dnl ===================================================================
11613 ENABLE_VLC=""
11615 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
11616 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
11617     ENABLE_VLC="TRUE"
11618     AC_MSG_RESULT([yes])
11619 else
11620     AC_MSG_RESULT([no])
11622 AC_SUBST(ENABLE_VLC)
11624 ENABLE_OPENGL_TRANSITIONS=
11625 ENABLE_OPENGL_CANVAS=
11626 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
11627    : # disable
11628 elif test "$_os" = "Darwin"; then
11629     # We use frameworks on macOS, no need for detail checks
11630     ENABLE_OPENGL_TRANSITIONS=TRUE
11631     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11632     ENABLE_OPENGL_CANVAS=TRUE
11633 elif test $_os = WINNT; then
11634     ENABLE_OPENGL_TRANSITIONS=TRUE
11635     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11636     ENABLE_OPENGL_CANVAS=TRUE
11637 else
11638     if test "$USING_X11" = TRUE; then
11639         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
11640         ENABLE_OPENGL_TRANSITIONS=TRUE
11641         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11642         ENABLE_OPENGL_CANVAS=TRUE
11643     fi
11646 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
11647 AC_SUBST(ENABLE_OPENGL_CANVAS)
11649 dnl =================================================
11650 dnl Check whether to build with OpenCL support.
11651 dnl =================================================
11653 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE" -a "$enable_opencl" = "yes"; then
11654     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
11655     # platform (optional at run-time, used through clew).
11656     BUILD_TYPE="$BUILD_TYPE OPENCL"
11657     AC_DEFINE(HAVE_FEATURE_OPENCL)
11660 dnl =================================================
11661 dnl Check whether to build with dconf support.
11662 dnl =================================================
11664 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
11665     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
11666         if test "$enable_dconf" = yes; then
11667             AC_MSG_ERROR([dconf not found])
11668         else
11669             enable_dconf=no
11670         fi])
11672 AC_MSG_CHECKING([whether to enable dconf])
11673 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
11674     DCONF_CFLAGS=
11675     DCONF_LIBS=
11676     ENABLE_DCONF=
11677     AC_MSG_RESULT([no])
11678 else
11679     ENABLE_DCONF=TRUE
11680     AC_DEFINE(ENABLE_DCONF)
11681     AC_MSG_RESULT([yes])
11683 AC_SUBST([DCONF_CFLAGS])
11684 AC_SUBST([DCONF_LIBS])
11685 AC_SUBST([ENABLE_DCONF])
11687 # pdf import?
11688 AC_MSG_CHECKING([whether to build the PDF import feature])
11689 ENABLE_PDFIMPORT=
11690 if test -z "$enable_pdfimport" -o "$enable_pdfimport" = yes; then
11691     AC_MSG_RESULT([yes])
11692     ENABLE_PDFIMPORT=TRUE
11693     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
11694 else
11695     AC_MSG_RESULT([no])
11698 # Pdfium?
11699 AC_MSG_CHECKING([whether to build PDFium])
11700 ENABLE_PDFIUM=
11701 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
11702     AC_MSG_RESULT([yes])
11703     ENABLE_PDFIUM=TRUE
11704     AC_DEFINE(HAVE_FEATURE_PDFIUM)
11705     BUILD_TYPE="$BUILD_TYPE PDFIUM"
11706 else
11707     AC_MSG_RESULT([no])
11709 AC_SUBST(ENABLE_PDFIUM)
11711 dnl ===================================================================
11712 dnl Check for poppler
11713 dnl ===================================================================
11714 ENABLE_POPPLER=
11715 AC_MSG_CHECKING([whether to build Poppler])
11716 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" -a $_os != Android \) -o "$enable_poppler" = yes; then
11717     AC_MSG_RESULT([yes])
11718     ENABLE_POPPLER=TRUE
11719     AC_DEFINE(HAVE_FEATURE_POPPLER)
11720 else
11721     AC_MSG_RESULT([no])
11723 AC_SUBST(ENABLE_POPPLER)
11725 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
11726     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
11729 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
11730     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
11733 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
11734     dnl ===================================================================
11735     dnl Check for system poppler
11736     dnl ===================================================================
11737     AC_MSG_CHECKING([which PDF import poppler to use])
11738     if test "$with_system_poppler" = "yes"; then
11739         AC_MSG_RESULT([external])
11740         SYSTEM_POPPLER=TRUE
11741         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
11742         AC_LANG_PUSH([C++])
11743         save_CXXFLAGS=$CXXFLAGS
11744         save_CPPFLAGS=$CPPFLAGS
11745         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
11746         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
11747         AC_CHECK_HEADER([cpp/poppler-version.h],
11748             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
11749             [])
11750         CXXFLAGS=$save_CXXFLAGS
11751         CPPFLAGS=$save_CPPFLAGS
11752         AC_LANG_POP([C++])
11753         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11755         FilterLibs "${POPPLER_LIBS}"
11756         POPPLER_LIBS="${filteredlibs}"
11757     else
11758         AC_MSG_RESULT([internal])
11759         SYSTEM_POPPLER=
11760         BUILD_TYPE="$BUILD_TYPE POPPLER"
11761         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
11762     fi
11763     AC_DEFINE([ENABLE_PDFIMPORT],1)
11765 AC_SUBST(ENABLE_PDFIMPORT)
11766 AC_SUBST(SYSTEM_POPPLER)
11767 AC_SUBST(POPPLER_CFLAGS)
11768 AC_SUBST(POPPLER_LIBS)
11770 # Skia?
11771 AC_MSG_CHECKING([whether to build Skia])
11772 ENABLE_SKIA=
11773 if test "$enable_skia" != "no" -a "$build_skia" = "yes" -a -z "$DISABLE_GUI"; then
11774     if test "$enable_skia" = "debug"; then
11775         AC_MSG_RESULT([yes (debug)])
11776         ENABLE_SKIA_DEBUG=TRUE
11777     else
11778         AC_MSG_RESULT([yes])
11779         ENABLE_SKIA_DEBUG=
11780     fi
11781     ENABLE_SKIA=TRUE
11782     AC_DEFINE(HAVE_FEATURE_SKIA)
11783     BUILD_TYPE="$BUILD_TYPE SKIA"
11784 else
11785     AC_MSG_RESULT([no])
11787 AC_SUBST(ENABLE_SKIA)
11788 AC_SUBST(ENABLE_SKIA_DEBUG)
11790 LO_CLANG_CXXFLAGS_INTRINSICS_SSE2=
11791 LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3=
11792 LO_CLANG_CXXFLAGS_INTRINSICS_SSE41=
11793 LO_CLANG_CXXFLAGS_INTRINSICS_SSE42=
11794 LO_CLANG_CXXFLAGS_INTRINSICS_AVX=
11795 LO_CLANG_CXXFLAGS_INTRINSICS_AVX2=
11796 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512=
11797 LO_CLANG_CXXFLAGS_INTRINSICS_F16C=
11798 LO_CLANG_CXXFLAGS_INTRINSICS_FMA=
11799 HAVE_LO_CLANG_DLLEXPORTINLINES=
11801 if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE -a ! \( "$_os" = "WINNT" -a "$CPUNAME" = "ARM64" \); then
11802     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
11803         AC_MSG_CHECKING([for Clang])
11804         AC_MSG_RESULT([$LO_CLANG_CC / $LO_CLANG_CXX])
11805     else
11806         if test "$_os" = "WINNT"; then
11807             AC_MSG_CHECKING([for clang-cl])
11808             if test -x "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"; then
11809                 LO_CLANG_CC=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"`
11810                 dnl explicitly set -m32/-m64
11811                 LO_CLANG_CC="$LO_CLANG_CC -m$WIN_HOST_BITS"
11812                 LO_CLANG_CXX="$LO_CLANG_CC"
11813                 AC_MSG_RESULT([$LO_CLANG_CC])
11814             else
11815                 AC_MSG_RESULT([no])
11816             fi
11817         else
11818             AC_CHECK_PROG(LO_CLANG_CC,clang,clang,[])
11819             AC_CHECK_PROG(LO_CLANG_CXX,clang++,clang++,[])
11820         fi
11821     fi
11822     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
11823         clang2_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $LO_CLANG_CC -E - | tail -1 | sed 's/ //g'`
11824         clang2_ver=`echo "$clang2_version" | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
11825         if test "$clang2_ver" -lt 50002; then
11826             AC_MSG_WARN(["$clang2_version" is too old or unrecognized, must be at least Clang 5.0.2])
11827             LO_CLANG_CC=
11828             LO_CLANG_CXX=
11829         fi
11830     fi
11831     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX" -a "$_os" = "WINNT"; then
11832         save_CXX="$CXX"
11833         CXX="$LO_CLANG_CXX"
11834         AC_MSG_CHECKING([whether $CXX supports -Zc:dllexportInlines-])
11835         AC_LANG_PUSH([C++])
11836         save_CXXFLAGS=$CXXFLAGS
11837         CXXFLAGS="$CXXFLAGS -Werror -Zc:dllexportInlines-"
11838         AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
11839                 HAVE_LO_CLANG_DLLEXPORTINLINES=TRUE
11840                 AC_MSG_RESULT([yes])
11841             ], [AC_MSG_RESULT([no])])
11842         CXXFLAGS=$save_CXXFLAGS
11843         AC_LANG_POP([C++])
11844         CXX="$save_CXX"
11845         if test -z "$HAVE_LO_CLANG_DLLEXPORTINLINES"; then
11846             AC_MSG_ERROR([Clang compiler does not support -Zc:dllexportInlines-. The Skia library needs to be built using a newer Clang version, or use --disable-skia.])
11847         fi
11848     fi
11849     if test -z "$LO_CLANG_CC" -o -z "$LO_CLANG_CXX"; then
11850         # Skia is the default on Windows, so hard-require Clang.
11851         # Elsewhere it's used just by the 'gen' VCL backend which is rarely used.
11852         if test "$_os" = "WINNT"; then
11853             AC_MSG_ERROR([Clang compiler not found. The Skia library needs to be built using Clang.])
11854         else
11855             AC_MSG_WARN([Clang compiler not found.])
11856         fi
11857     else
11859         save_CXX="$CXX"
11860         CXX="$LO_CLANG_CXX"
11861         # copy&paste (and adjust) of intrinsics checks, since MSVC's -arch doesn't work well for Clang-cl
11862         flag_sse2=-msse2
11863         flag_ssse3=-mssse3
11864         flag_sse41=-msse4.1
11865         flag_sse42=-msse4.2
11866         flag_avx=-mavx
11867         flag_avx2=-mavx2
11868         flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
11869         flag_f16c=-mf16c
11870         flag_fma=-mfma
11872         AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
11873         AC_LANG_PUSH([C++])
11874         save_CXXFLAGS=$CXXFLAGS
11875         CXXFLAGS="$CXXFLAGS $flag_sse2"
11876         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11877             #include <emmintrin.h>
11878             int main () {
11879                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11880                 c = _mm_xor_si128 (a, b);
11881                 return 0;
11882             }
11883             ])],
11884             [can_compile_sse2=yes],
11885             [can_compile_sse2=no])
11886         AC_LANG_POP([C++])
11887         CXXFLAGS=$save_CXXFLAGS
11888         AC_MSG_RESULT([${can_compile_sse2}])
11889         if test "${can_compile_sse2}" = "yes" ; then
11890             LO_CLANG_CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
11891         fi
11893         AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
11894         AC_LANG_PUSH([C++])
11895         save_CXXFLAGS=$CXXFLAGS
11896         CXXFLAGS="$CXXFLAGS $flag_ssse3"
11897         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11898             #include <tmmintrin.h>
11899             int main () {
11900                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11901                 c = _mm_maddubs_epi16 (a, b);
11902                 return 0;
11903             }
11904             ])],
11905             [can_compile_ssse3=yes],
11906             [can_compile_ssse3=no])
11907         AC_LANG_POP([C++])
11908         CXXFLAGS=$save_CXXFLAGS
11909         AC_MSG_RESULT([${can_compile_ssse3}])
11910         if test "${can_compile_ssse3}" = "yes" ; then
11911             LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
11912         fi
11914         AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
11915         AC_LANG_PUSH([C++])
11916         save_CXXFLAGS=$CXXFLAGS
11917         CXXFLAGS="$CXXFLAGS $flag_sse41"
11918         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11919             #include <smmintrin.h>
11920             int main () {
11921                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11922                 c = _mm_cmpeq_epi64 (a, b);
11923                 return 0;
11924             }
11925             ])],
11926             [can_compile_sse41=yes],
11927             [can_compile_sse41=no])
11928         AC_LANG_POP([C++])
11929         CXXFLAGS=$save_CXXFLAGS
11930         AC_MSG_RESULT([${can_compile_sse41}])
11931         if test "${can_compile_sse41}" = "yes" ; then
11932             LO_CLANG_CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
11933         fi
11935         AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
11936         AC_LANG_PUSH([C++])
11937         save_CXXFLAGS=$CXXFLAGS
11938         CXXFLAGS="$CXXFLAGS $flag_sse42"
11939         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11940             #include <nmmintrin.h>
11941             int main () {
11942                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11943                 c = _mm_cmpgt_epi64 (a, b);
11944                 return 0;
11945             }
11946             ])],
11947             [can_compile_sse42=yes],
11948             [can_compile_sse42=no])
11949         AC_LANG_POP([C++])
11950         CXXFLAGS=$save_CXXFLAGS
11951         AC_MSG_RESULT([${can_compile_sse42}])
11952         if test "${can_compile_sse42}" = "yes" ; then
11953             LO_CLANG_CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
11954         fi
11956         AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
11957         AC_LANG_PUSH([C++])
11958         save_CXXFLAGS=$CXXFLAGS
11959         CXXFLAGS="$CXXFLAGS $flag_avx"
11960         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11961             #include <immintrin.h>
11962             int main () {
11963                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
11964                 c = _mm256_xor_ps(a, b);
11965                 return 0;
11966             }
11967             ])],
11968             [can_compile_avx=yes],
11969             [can_compile_avx=no])
11970         AC_LANG_POP([C++])
11971         CXXFLAGS=$save_CXXFLAGS
11972         AC_MSG_RESULT([${can_compile_avx}])
11973         if test "${can_compile_avx}" = "yes" ; then
11974             LO_CLANG_CXXFLAGS_INTRINSICS_AVX="$flag_avx"
11975         fi
11977         AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
11978         AC_LANG_PUSH([C++])
11979         save_CXXFLAGS=$CXXFLAGS
11980         CXXFLAGS="$CXXFLAGS $flag_avx2"
11981         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11982             #include <immintrin.h>
11983             int main () {
11984                 __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
11985                 c = _mm256_maddubs_epi16(a, b);
11986                 return 0;
11987             }
11988             ])],
11989             [can_compile_avx2=yes],
11990             [can_compile_avx2=no])
11991         AC_LANG_POP([C++])
11992         CXXFLAGS=$save_CXXFLAGS
11993         AC_MSG_RESULT([${can_compile_avx2}])
11994         if test "${can_compile_avx2}" = "yes" ; then
11995             LO_CLANG_CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
11996         fi
11998         AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
11999         AC_LANG_PUSH([C++])
12000         save_CXXFLAGS=$CXXFLAGS
12001         CXXFLAGS="$CXXFLAGS $flag_avx512"
12002         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12003             #include <immintrin.h>
12004             int main () {
12005                 __m512i a = _mm512_loadu_si512(0);
12006                 return 0;
12007             }
12008             ])],
12009             [can_compile_avx512=yes],
12010             [can_compile_avx512=no])
12011         AC_LANG_POP([C++])
12012         CXXFLAGS=$save_CXXFLAGS
12013         AC_MSG_RESULT([${can_compile_avx512}])
12014         if test "${can_compile_avx512}" = "yes" ; then
12015             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
12016         fi
12018         AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
12019         AC_LANG_PUSH([C++])
12020         save_CXXFLAGS=$CXXFLAGS
12021         CXXFLAGS="$CXXFLAGS $flag_f16c"
12022         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12023             #include <immintrin.h>
12024             int main () {
12025                 __m128i a = _mm_set1_epi32 (0);
12026                 __m128 c;
12027                 c = _mm_cvtph_ps(a);
12028                 return 0;
12029             }
12030             ])],
12031             [can_compile_f16c=yes],
12032             [can_compile_f16c=no])
12033         AC_LANG_POP([C++])
12034         CXXFLAGS=$save_CXXFLAGS
12035         AC_MSG_RESULT([${can_compile_f16c}])
12036         if test "${can_compile_f16c}" = "yes" ; then
12037             LO_CLANG_CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
12038         fi
12040         AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
12041         AC_LANG_PUSH([C++])
12042         save_CXXFLAGS=$CXXFLAGS
12043         CXXFLAGS="$CXXFLAGS $flag_fma"
12044         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12045             #include <immintrin.h>
12046             int main () {
12047                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
12048                 d = _mm256_fmadd_ps(a, b, c);
12049                 return 0;
12050             }
12051             ])],
12052             [can_compile_fma=yes],
12053             [can_compile_fma=no])
12054         AC_LANG_POP([C++])
12055         CXXFLAGS=$save_CXXFLAGS
12056         AC_MSG_RESULT([${can_compile_fma}])
12057         if test "${can_compile_fma}" = "yes" ; then
12058             LO_CLANG_CXXFLAGS_INTRINSICS_FMA="$flag_fma"
12059         fi
12061         CXX="$save_CXX"
12062     fi
12065 # prefix LO_CLANG_CC/LO_CLANG_CXX with ccache if needed
12067 if test "$CCACHE" != "" -a -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12068     AC_MSG_CHECKING([whether $LO_CLANG_CC is already ccached])
12069     AC_LANG_PUSH([C])
12070     save_CC="$CC"
12071     CC="$LO_CLANG_CC"
12072     save_CFLAGS=$CFLAGS
12073     CFLAGS="$CFLAGS --ccache-skip -O2"
12074     dnl an empty program will do, we're checking the compiler flags
12075     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12076                       [use_ccache=yes], [use_ccache=no])
12077     CFLAGS=$save_CFLAGS
12078     CC=$save_CC
12079     if test $use_ccache = yes; then
12080         AC_MSG_RESULT([yes])
12081     else
12082         LO_CLANG_CC="$CCACHE $LO_CLANG_CC"
12083         AC_MSG_RESULT([no])
12084     fi
12085     AC_LANG_POP([C])
12087     AC_MSG_CHECKING([whether $LO_CLANG_CXX is already ccached])
12088     AC_LANG_PUSH([C++])
12089     save_CXX="$CXX"
12090     CXX="$LO_CLANG_CXX"
12091     save_CXXFLAGS=$CXXFLAGS
12092     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
12093     dnl an empty program will do, we're checking the compiler flags
12094     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12095                       [use_ccache=yes], [use_ccache=no])
12096     if test $use_ccache = yes; then
12097         AC_MSG_RESULT([yes])
12098     else
12099         LO_CLANG_CXX="$CCACHE $LO_CLANG_CXX"
12100         AC_MSG_RESULT([no])
12101     fi
12102     CXXFLAGS=$save_CXXFLAGS
12103     CXX=$save_CXX
12104     AC_LANG_POP([C++])
12107 AC_SUBST(LO_CLANG_CC)
12108 AC_SUBST(LO_CLANG_CXX)
12109 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE2)
12110 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3)
12111 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE41)
12112 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE42)
12113 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX)
12114 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX2)
12115 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512)
12116 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_F16C)
12117 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_FMA)
12118 AC_SUBST(CLANG_USE_LD)
12119 AC_SUBST([HAVE_LO_CLANG_DLLEXPORTINLINES])
12121 SYSTEM_GPGMEPP=
12123 if test "$enable_gpgmepp" = no; then
12124     AC_MSG_CHECKING([whether to enable gpgmepp])
12125     AC_MSG_RESULT([no])
12126 elif test "$enable_mpl_subset" = "yes"; then
12127     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
12128     AC_MSG_RESULT([yes])
12129 elif test "$enable_fuzzers" = "yes"; then
12130     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
12131     AC_MSG_RESULT([yes])
12132 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
12133     dnl ===================================================================
12134     dnl Check for system gpgme
12135     dnl ===================================================================
12136     AC_MSG_CHECKING([which gpgmepp to use])
12137     if test "$with_system_gpgmepp" = "yes"; then
12138         AC_MSG_RESULT([external])
12139         SYSTEM_GPGMEPP=TRUE
12141         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
12142         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
12143             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
12144         # progress_callback is the only func with plain C linkage
12145         # checking for it also filters out older, KDE-dependent libgpgmepp versions
12146         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
12147             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
12148         AC_CHECK_HEADER(gpgme.h, [],
12149             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
12150     else
12151         AC_MSG_RESULT([internal])
12152         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
12153         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
12155         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
12156         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
12157         if test "$_os" != "WINNT"; then
12158             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
12159             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
12160         fi
12161     fi
12162     ENABLE_GPGMEPP=TRUE
12163     AC_DEFINE([HAVE_FEATURE_GPGME])
12164     AC_PATH_PROG(GPG, gpg)
12165     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
12166     # so let's exclude that manually for the moment
12167     if test -n "$GPG" -a "$_os" != "WINNT"; then
12168         # make sure we not only have a working gpgme, but a full working
12169         # gpg installation to run OpenPGP signature verification
12170         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
12171     fi
12172     if test "$_os" = "Linux"; then
12173       uid=`id -u`
12174       AC_MSG_CHECKING([for /run/user/$uid])
12175       if test -d /run/user/$uid; then
12176         AC_MSG_RESULT([yes])
12177         AC_PATH_PROG(GPGCONF, gpgconf)
12179         # Older versions of gpgconf are not working as expected, since
12180         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
12181         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
12182         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
12183         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
12184         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
12185         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
12186         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
12187           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
12188           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
12189           if $GPGCONF --dump-options > /dev/null ; then
12190             if $GPGCONF --dump-options | grep -q create-socketdir ; then
12191               AC_MSG_RESULT([yes])
12192               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
12193               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
12194             else
12195               AC_MSG_RESULT([no])
12196             fi
12197           else
12198             AC_MSG_RESULT([no. missing or broken gpgconf?])
12199           fi
12200         else
12201           AC_MSG_RESULT([no, $GPGCONF_VERSION])
12202         fi
12203       else
12204         AC_MSG_RESULT([no])
12205      fi
12206    fi
12208 AC_SUBST(ENABLE_GPGMEPP)
12209 AC_SUBST(SYSTEM_GPGMEPP)
12210 AC_SUBST(GPG_ERROR_CFLAGS)
12211 AC_SUBST(GPG_ERROR_LIBS)
12212 AC_SUBST(LIBASSUAN_CFLAGS)
12213 AC_SUBST(LIBASSUAN_LIBS)
12214 AC_SUBST(GPGMEPP_CFLAGS)
12215 AC_SUBST(GPGMEPP_LIBS)
12217 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
12218 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
12219     AC_MSG_RESULT([yes])
12220     ENABLE_MEDIAWIKI=TRUE
12221     BUILD_TYPE="$BUILD_TYPE XSLTML"
12222     if test  "x$with_java" = "xno"; then
12223         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
12224     fi
12225 else
12226     AC_MSG_RESULT([no])
12227     ENABLE_MEDIAWIKI=
12228     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
12230 AC_SUBST(ENABLE_MEDIAWIKI)
12232 AC_MSG_CHECKING([whether to build the Report Builder])
12233 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12234     AC_MSG_RESULT([yes])
12235     ENABLE_REPORTBUILDER=TRUE
12236     AC_MSG_CHECKING([which jfreereport libs to use])
12237     if test "$with_system_jfreereport" = "yes"; then
12238         SYSTEM_JFREEREPORT=TRUE
12239         AC_MSG_RESULT([external])
12240         if test -z $SAC_JAR; then
12241             SAC_JAR=/usr/share/java/sac.jar
12242         fi
12243         if ! test -f $SAC_JAR; then
12244              AC_MSG_ERROR(sac.jar not found.)
12245         fi
12247         if test -z $LIBXML_JAR; then
12248             if test -f /usr/share/java/libxml-1.0.0.jar; then
12249                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
12250             elif test -f /usr/share/java/libxml.jar; then
12251                 LIBXML_JAR=/usr/share/java/libxml.jar
12252             else
12253                 AC_MSG_ERROR(libxml.jar replacement not found.)
12254             fi
12255         elif ! test -f $LIBXML_JAR; then
12256             AC_MSG_ERROR(libxml.jar not found.)
12257         fi
12259         if test -z $FLUTE_JAR; then
12260             if test -f /usr/share/java/flute-1.3.0.jar; then
12261                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
12262             elif test -f /usr/share/java/flute.jar; then
12263                 FLUTE_JAR=/usr/share/java/flute.jar
12264             else
12265                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
12266             fi
12267         elif ! test -f $FLUTE_JAR; then
12268             AC_MSG_ERROR(flute-1.3.0.jar not found.)
12269         fi
12271         if test -z $JFREEREPORT_JAR; then
12272             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
12273                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
12274             elif test -f /usr/share/java/flow-engine.jar; then
12275                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
12276             else
12277                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
12278             fi
12279         elif ! test -f  $JFREEREPORT_JAR; then
12280                 AC_MSG_ERROR(jfreereport.jar not found.)
12281         fi
12283         if test -z $LIBLAYOUT_JAR; then
12284             if test -f /usr/share/java/liblayout-0.2.9.jar; then
12285                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
12286             elif test -f /usr/share/java/liblayout.jar; then
12287                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
12288             else
12289                 AC_MSG_ERROR(liblayout.jar replacement not found.)
12290             fi
12291         elif ! test -f $LIBLAYOUT_JAR; then
12292                 AC_MSG_ERROR(liblayout.jar not found.)
12293         fi
12295         if test -z $LIBLOADER_JAR; then
12296             if test -f /usr/share/java/libloader-1.0.0.jar; then
12297                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
12298             elif test -f /usr/share/java/libloader.jar; then
12299                 LIBLOADER_JAR=/usr/share/java/libloader.jar
12300             else
12301                 AC_MSG_ERROR(libloader.jar replacement not found.)
12302             fi
12303         elif ! test -f  $LIBLOADER_JAR; then
12304             AC_MSG_ERROR(libloader.jar not found.)
12305         fi
12307         if test -z $LIBFORMULA_JAR; then
12308             if test -f /usr/share/java/libformula-0.2.0.jar; then
12309                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
12310             elif test -f /usr/share/java/libformula.jar; then
12311                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
12312             else
12313                 AC_MSG_ERROR(libformula.jar replacement not found.)
12314             fi
12315         elif ! test -f $LIBFORMULA_JAR; then
12316                 AC_MSG_ERROR(libformula.jar not found.)
12317         fi
12319         if test -z $LIBREPOSITORY_JAR; then
12320             if test -f /usr/share/java/librepository-1.0.0.jar; then
12321                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
12322             elif test -f /usr/share/java/librepository.jar; then
12323                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
12324             else
12325                 AC_MSG_ERROR(librepository.jar replacement not found.)
12326             fi
12327         elif ! test -f $LIBREPOSITORY_JAR; then
12328             AC_MSG_ERROR(librepository.jar not found.)
12329         fi
12331         if test -z $LIBFONTS_JAR; then
12332             if test -f /usr/share/java/libfonts-1.0.0.jar; then
12333                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
12334             elif test -f /usr/share/java/libfonts.jar; then
12335                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
12336             else
12337                 AC_MSG_ERROR(libfonts.jar replacement not found.)
12338             fi
12339         elif ! test -f $LIBFONTS_JAR; then
12340                 AC_MSG_ERROR(libfonts.jar not found.)
12341         fi
12343         if test -z $LIBSERIALIZER_JAR; then
12344             if test -f /usr/share/java/libserializer-1.0.0.jar; then
12345                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
12346             elif test -f /usr/share/java/libserializer.jar; then
12347                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
12348             else
12349                 AC_MSG_ERROR(libserializer.jar replacement not found.)
12350             fi
12351         elif ! test -f $LIBSERIALIZER_JAR; then
12352                 AC_MSG_ERROR(libserializer.jar not found.)
12353         fi
12355         if test -z $LIBBASE_JAR; then
12356             if test -f /usr/share/java/libbase-1.0.0.jar; then
12357                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
12358             elif test -f /usr/share/java/libbase.jar; then
12359                 LIBBASE_JAR=/usr/share/java/libbase.jar
12360             else
12361                 AC_MSG_ERROR(libbase.jar replacement not found.)
12362             fi
12363         elif ! test -f $LIBBASE_JAR; then
12364             AC_MSG_ERROR(libbase.jar not found.)
12365         fi
12367     else
12368         AC_MSG_RESULT([internal])
12369         SYSTEM_JFREEREPORT=
12370         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
12371         NEED_ANT=TRUE
12372     fi
12373 else
12374     AC_MSG_RESULT([no])
12375     ENABLE_REPORTBUILDER=
12376     SYSTEM_JFREEREPORT=
12378 AC_SUBST(ENABLE_REPORTBUILDER)
12379 AC_SUBST(SYSTEM_JFREEREPORT)
12380 AC_SUBST(SAC_JAR)
12381 AC_SUBST(LIBXML_JAR)
12382 AC_SUBST(FLUTE_JAR)
12383 AC_SUBST(JFREEREPORT_JAR)
12384 AC_SUBST(LIBBASE_JAR)
12385 AC_SUBST(LIBLAYOUT_JAR)
12386 AC_SUBST(LIBLOADER_JAR)
12387 AC_SUBST(LIBFORMULA_JAR)
12388 AC_SUBST(LIBREPOSITORY_JAR)
12389 AC_SUBST(LIBFONTS_JAR)
12390 AC_SUBST(LIBSERIALIZER_JAR)
12392 # this has to be here because both the Wiki Publisher and the SRB use
12393 # commons-logging
12394 COMMONS_LOGGING_VERSION=1.2
12395 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12396     AC_MSG_CHECKING([which Apache commons-* libs to use])
12397     if test "$with_system_apache_commons" = "yes"; then
12398         SYSTEM_APACHE_COMMONS=TRUE
12399         AC_MSG_RESULT([external])
12400         if test -z $COMMONS_LOGGING_JAR; then
12401             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
12402                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
12403            elif test -f /usr/share/java/commons-logging.jar; then
12404                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
12405             else
12406                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
12407             fi
12408         elif ! test -f $COMMONS_LOGGING_JAR; then
12409             AC_MSG_ERROR(commons-logging.jar not found.)
12410         fi
12411     else
12412         AC_MSG_RESULT([internal])
12413         SYSTEM_APACHE_COMMONS=
12414         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
12415         NEED_ANT=TRUE
12416     fi
12418 AC_SUBST(SYSTEM_APACHE_COMMONS)
12419 AC_SUBST(COMMONS_LOGGING_JAR)
12420 AC_SUBST(COMMONS_LOGGING_VERSION)
12422 # scripting provider for BeanShell?
12423 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
12424 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
12425     AC_MSG_RESULT([yes])
12426     ENABLE_SCRIPTING_BEANSHELL=TRUE
12428     dnl ===================================================================
12429     dnl Check for system beanshell
12430     dnl ===================================================================
12431     AC_MSG_CHECKING([which beanshell to use])
12432     if test "$with_system_beanshell" = "yes"; then
12433         AC_MSG_RESULT([external])
12434         SYSTEM_BSH=TRUE
12435         if test -z $BSH_JAR; then
12436             BSH_JAR=/usr/share/java/bsh.jar
12437         fi
12438         if ! test -f $BSH_JAR; then
12439             AC_MSG_ERROR(bsh.jar not found.)
12440         fi
12441     else
12442         AC_MSG_RESULT([internal])
12443         SYSTEM_BSH=
12444         BUILD_TYPE="$BUILD_TYPE BSH"
12445     fi
12446 else
12447     AC_MSG_RESULT([no])
12448     ENABLE_SCRIPTING_BEANSHELL=
12449     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
12451 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
12452 AC_SUBST(SYSTEM_BSH)
12453 AC_SUBST(BSH_JAR)
12455 # scripting provider for JavaScript?
12456 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
12457 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
12458     AC_MSG_RESULT([yes])
12459     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
12461     dnl ===================================================================
12462     dnl Check for system rhino
12463     dnl ===================================================================
12464     AC_MSG_CHECKING([which rhino to use])
12465     if test "$with_system_rhino" = "yes"; then
12466         AC_MSG_RESULT([external])
12467         SYSTEM_RHINO=TRUE
12468         if test -z $RHINO_JAR; then
12469             RHINO_JAR=/usr/share/java/js.jar
12470         fi
12471         if ! test -f $RHINO_JAR; then
12472             AC_MSG_ERROR(js.jar not found.)
12473         fi
12474     else
12475         AC_MSG_RESULT([internal])
12476         SYSTEM_RHINO=
12477         BUILD_TYPE="$BUILD_TYPE RHINO"
12478         NEED_ANT=TRUE
12479     fi
12480 else
12481     AC_MSG_RESULT([no])
12482     ENABLE_SCRIPTING_JAVASCRIPT=
12483     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
12485 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
12486 AC_SUBST(SYSTEM_RHINO)
12487 AC_SUBST(RHINO_JAR)
12489 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
12490 # paths should be added to library search path. So lets put all 64-bit
12491 # platforms there.
12492 supports_multilib=
12493 case "$host_cpu" in
12494 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
12495     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
12496         supports_multilib="yes"
12497     fi
12498     ;;
12500     ;;
12501 esac
12503 dnl ===================================================================
12504 dnl QT5 Integration
12505 dnl ===================================================================
12507 QT5_CFLAGS=""
12508 QT5_LIBS=""
12509 QMAKE5="qmake"
12510 MOC5="moc"
12511 QT5_GOBJECT_CFLAGS=""
12512 QT5_GOBJECT_LIBS=""
12513 QT5_HAVE_GOBJECT=""
12514 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
12515         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
12516         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
12517 then
12518     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
12519     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
12521     if test -n "$supports_multilib"; then
12522         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
12523     fi
12525     qt5_test_include="QtWidgets/qapplication.h"
12526     qt5_test_library="libQt5Widgets.so"
12528     dnl Check for qmake5
12529     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH])
12530     if test "$QMAKE5" = "no"; then
12531         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12532     else
12533         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
12534         if test -z "$qmake5_test_ver"; then
12535             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12536         fi
12537         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
12538         qt5_minimal_minor="6"
12539         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
12540             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
12541         else
12542             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
12543         fi
12544     fi
12546     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
12547     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
12549     AC_MSG_CHECKING([for Qt5 headers])
12550     qt5_incdir="no"
12551     for inc_dir in $qt5_incdirs; do
12552         if test -r "$inc_dir/$qt5_test_include"; then
12553             qt5_incdir="$inc_dir"
12554             break
12555         fi
12556     done
12557     AC_MSG_RESULT([$qt5_incdir])
12558     if test "x$qt5_incdir" = "xno"; then
12559         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12560     fi
12561     # check for scenario: qt5-qtbase-devel-*.86_64 installed but host is i686
12562     AC_LANG_PUSH([C++])
12563     save_CPPFLAGS=$CPPFLAGS
12564     CPPFLAGS="${CPPFLAGS} -I${qt5_incdir}"
12565     AC_CHECK_HEADER(QtCore/qconfig.h, [],
12566         [AC_MSG_ERROR(qconfig.h header not found.)], [])
12567     CPPFLAGS=$save_CPPFLAGS
12568     AC_LANG_POP([C++])
12570     AC_MSG_CHECKING([for Qt5 libraries])
12571     qt5_libdir="no"
12572     for lib_dir in $qt5_libdirs; do
12573         if test -r "$lib_dir/$qt5_test_library"; then
12574             qt5_libdir="$lib_dir"
12575             break
12576         fi
12577     done
12578     AC_MSG_RESULT([$qt5_libdir])
12579     if test "x$qt5_libdir" = "xno"; then
12580         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12581     fi
12583     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
12584     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12585     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
12587     if test "$USING_X11" = TRUE; then
12588         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
12589         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
12590             QT5_HAVE_XCB_ICCCM=1
12591             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
12592         ],[
12593             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)])
12594             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
12595         ])
12596         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
12597         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
12598         QT5_USING_X11=1
12599         AC_DEFINE(QT5_USING_X11)
12600     fi
12602     dnl Check for Meta Object Compiler
12604     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
12605     if test "$MOC5" = "no"; then
12606         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
12607 the root of your Qt installation by exporting QT5DIR before running "configure".])
12608     fi
12610     if test "$build_gstreamer_1_0" = "yes"; then
12611         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
12612                 QT5_HAVE_GOBJECT=1
12613                 AC_DEFINE(QT5_HAVE_GOBJECT)
12614             ],
12615             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
12616         )
12617     fi
12619 AC_SUBST(QT5_CFLAGS)
12620 AC_SUBST(QT5_LIBS)
12621 AC_SUBST(MOC5)
12622 AC_SUBST(QT5_GOBJECT_CFLAGS)
12623 AC_SUBST(QT5_GOBJECT_LIBS)
12624 AC_SUBST(QT5_HAVE_GOBJECT)
12626 dnl ===================================================================
12627 dnl KF5 Integration
12628 dnl ===================================================================
12630 KF5_CFLAGS=""
12631 KF5_LIBS=""
12632 KF5_CONFIG="kf5-config"
12633 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
12634         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
12635 then
12636     if test "$OS" = "HAIKU"; then
12637         haiku_arch="`echo $RTL_ARCH | tr X x`"
12638         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
12639         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
12640     fi
12642     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
12643     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
12644     if test -n "$supports_multilib"; then
12645         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
12646     fi
12648     kf5_test_include="KF5/kcoreaddons_version.h"
12649     kf5_test_library="libKF5CoreAddons.so"
12650     kf5_libdirs="$qt5_libdir $kf5_libdirs"
12652     dnl kf5 KDE4 support compatibility installed
12653     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
12654     if test "$KF5_CONFIG" != "no"; then
12655         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
12656         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
12657     fi
12659     dnl Check for KF5 headers
12660     AC_MSG_CHECKING([for KF5 headers])
12661     kf5_incdir="no"
12662     for kf5_check in $kf5_incdirs; do
12663         if test -r "$kf5_check/$kf5_test_include"; then
12664             kf5_incdir="$kf5_check/KF5"
12665             break
12666         fi
12667     done
12668     AC_MSG_RESULT([$kf5_incdir])
12669     if test "x$kf5_incdir" = "xno"; then
12670         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
12671     fi
12673     dnl Check for KF5 libraries
12674     AC_MSG_CHECKING([for KF5 libraries])
12675     kf5_libdir="no"
12676     for kf5_check in $kf5_libdirs; do
12677         if test -r "$kf5_check/$kf5_test_library"; then
12678             kf5_libdir="$kf5_check"
12679             break
12680         fi
12681     done
12683     AC_MSG_RESULT([$kf5_libdir])
12684     if test "x$kf5_libdir" = "xno"; then
12685         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
12686     fi
12688     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"
12689     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
12690     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12692     if test "$USING_X11" = TRUE; then
12693         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
12694     fi
12696     AC_LANG_PUSH([C++])
12697     save_CXXFLAGS=$CXXFLAGS
12698     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
12699     AC_MSG_CHECKING([whether KDE is >= 5.0])
12700        AC_RUN_IFELSE([AC_LANG_SOURCE([[
12701 #include <kcoreaddons_version.h>
12703 int main(int argc, char **argv) {
12704        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
12705        else return 1;
12707        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
12708     CXXFLAGS=$save_CXXFLAGS
12709     AC_LANG_POP([C++])
12711 AC_SUBST(KF5_CFLAGS)
12712 AC_SUBST(KF5_LIBS)
12714 dnl ===================================================================
12715 dnl Test whether to include Evolution 2 support
12716 dnl ===================================================================
12717 AC_MSG_CHECKING([whether to enable evolution 2 support])
12718 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
12719     AC_MSG_RESULT([yes])
12720     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
12721     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12722     FilterLibs "${GOBJECT_LIBS}"
12723     GOBJECT_LIBS="${filteredlibs}"
12724     ENABLE_EVOAB2="TRUE"
12725 else
12726     ENABLE_EVOAB2=""
12727     AC_MSG_RESULT([no])
12729 AC_SUBST(ENABLE_EVOAB2)
12730 AC_SUBST(GOBJECT_CFLAGS)
12731 AC_SUBST(GOBJECT_LIBS)
12733 dnl ===================================================================
12734 dnl Test which themes to include
12735 dnl ===================================================================
12736 AC_MSG_CHECKING([which themes to include])
12737 # if none given use default subset of available themes
12738 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
12739     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"
12742 WITH_THEMES=""
12743 if test "x$with_theme" != "xno"; then
12744     for theme in $with_theme; do
12745         case $theme in
12746         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" ;;
12747         default) real_theme=colibre ;;
12748         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
12749         esac
12750         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
12751     done
12753 AC_MSG_RESULT([$WITH_THEMES])
12754 AC_SUBST([WITH_THEMES])
12755 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
12756 for theme in $with_theme; do
12757     case $theme in
12758     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
12759     *) ;;
12760     esac
12761 done
12763 dnl ===================================================================
12764 dnl Test whether to integrate helppacks into the product's installer
12765 dnl ===================================================================
12766 AC_MSG_CHECKING([for helppack integration])
12767 if test "$with_helppack_integration" = "no"; then
12768     AC_MSG_RESULT([no integration])
12769 else
12770     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
12771     AC_MSG_RESULT([integration])
12774 ###############################################################################
12775 # Extensions checking
12776 ###############################################################################
12777 AC_MSG_CHECKING([for extensions integration])
12778 if test "x$enable_extension_integration" != "xno"; then
12779     WITH_EXTENSION_INTEGRATION=TRUE
12780     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
12781     AC_MSG_RESULT([yes, use integration])
12782 else
12783     WITH_EXTENSION_INTEGRATION=
12784     AC_MSG_RESULT([no, do not integrate])
12786 AC_SUBST(WITH_EXTENSION_INTEGRATION)
12788 dnl Should any extra extensions be included?
12789 dnl There are standalone tests for each of these below.
12790 WITH_EXTRA_EXTENSIONS=
12791 AC_SUBST([WITH_EXTRA_EXTENSIONS])
12793 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
12794 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
12795 if test "x$with_java" != "xno"; then
12796     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
12797     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
12800 AC_MSG_CHECKING([whether to build opens___.ttf])
12801 if test "$enable_build_opensymbol" = "yes"; then
12802     AC_MSG_RESULT([yes])
12803     AC_PATH_PROG(FONTFORGE, fontforge)
12804     if test -z "$FONTFORGE"; then
12805         AC_MSG_ERROR([fontforge not installed])
12806     fi
12807 else
12808     AC_MSG_RESULT([no])
12809     OPENSYMBOL_TTF=f543e6e2d7275557a839a164941c0a86e5f2c3f2a0042bfc434c88c6dde9e140-opens___.ttf
12810     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
12812 AC_SUBST(OPENSYMBOL_TTF)
12813 AC_SUBST(FONTFORGE)
12815 dnl ===================================================================
12816 dnl Test whether to include fonts
12817 dnl ===================================================================
12818 AC_MSG_CHECKING([whether to include third-party fonts])
12819 if test "$with_fonts" != "no"; then
12820     AC_MSG_RESULT([yes])
12821     WITH_FONTS=TRUE
12822     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
12823     AC_DEFINE(HAVE_MORE_FONTS)
12824 else
12825     AC_MSG_RESULT([no])
12826     WITH_FONTS=
12827     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
12829 AC_SUBST(WITH_FONTS)
12831 dnl Test whether to include more Google Noto fonts
12832 dnl ===================================================================
12833 AC_MSG_CHECKING([whether to include more Google Noto fonts])
12834 if test "$enable_noto_font" = "" -o "$enable_noto_font" = "no" -o "$with_fonts" = "no"; then
12835     AC_MSG_RESULT([no])
12836     WITH_NOTO_FONT=
12837 else
12838     AC_MSG_RESULT([yes])
12839     WITH_NOTO_FONT=TRUE
12840     BUILD_TYPE="$BUILD_TYPE NOTO_FONT"
12841     SCPDEFS="$SCPDEFS -DWITH_NOTO_FONT"
12843 AC_SUBST(WITH_NOTO_FONT)
12845 dnl ===================================================================
12846 dnl Test whether to enable online update service
12847 dnl ===================================================================
12848 AC_MSG_CHECKING([whether to enable online update])
12849 ENABLE_ONLINE_UPDATE=
12850 ENABLE_ONLINE_UPDATE_MAR=
12851 UPDATE_CONFIG=
12852 if test "$enable_online_update" = ""; then
12853     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
12854         AC_MSG_RESULT([yes])
12855         ENABLE_ONLINE_UPDATE="TRUE"
12856     else
12857         AC_MSG_RESULT([no])
12858     fi
12859 else
12860     if test "$enable_online_update" = "mar"; then
12861         AC_MSG_RESULT([yes - MAR-based online update])
12862         ENABLE_ONLINE_UPDATE_MAR="TRUE"
12863         if test "$with_update_config" = ""; then
12864             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
12865         fi
12866         UPDATE_CONFIG="$with_update_config"
12867         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
12868     elif test "$enable_online_update" = "yes"; then
12869         AC_MSG_RESULT([yes])
12870         ENABLE_ONLINE_UPDATE="TRUE"
12871     else
12872         AC_MSG_RESULT([no])
12873     fi
12875 AC_SUBST(ENABLE_ONLINE_UPDATE)
12876 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
12877 AC_SUBST(UPDATE_CONFIG)
12879 dnl ===================================================================
12880 dnl Test whether we need bzip2
12881 dnl ===================================================================
12882 SYSTEM_BZIP2=
12883 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
12884     AC_MSG_CHECKING([whether to use system bzip2])
12885     if test "$with_system_bzip2" = yes; then
12886         SYSTEM_BZIP2=TRUE
12887         AC_MSG_RESULT([yes])
12888         PKG_CHECK_MODULES(BZIP2, bzip2)
12889         FilterLibs "${BZIP2_LIBS}"
12890         BZIP2_LIBS="${filteredlibs}"
12891     else
12892         AC_MSG_RESULT([no])
12893         BUILD_TYPE="$BUILD_TYPE BZIP2"
12894     fi
12896 AC_SUBST(SYSTEM_BZIP2)
12897 AC_SUBST(BZIP2_CFLAGS)
12898 AC_SUBST(BZIP2_LIBS)
12900 dnl ===================================================================
12901 dnl Test whether to enable extension update
12902 dnl ===================================================================
12903 AC_MSG_CHECKING([whether to enable extension update])
12904 ENABLE_EXTENSION_UPDATE=
12905 if test "x$enable_extension_update" = "xno"; then
12906     AC_MSG_RESULT([no])
12907 else
12908     AC_MSG_RESULT([yes])
12909     ENABLE_EXTENSION_UPDATE="TRUE"
12910     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
12911     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
12913 AC_SUBST(ENABLE_EXTENSION_UPDATE)
12916 dnl ===================================================================
12917 dnl Test whether to create MSI with LIMITUI=1 (silent install)
12918 dnl ===================================================================
12919 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
12920 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
12921     AC_MSG_RESULT([no])
12922     ENABLE_SILENT_MSI=
12923 else
12924     AC_MSG_RESULT([yes])
12925     ENABLE_SILENT_MSI=TRUE
12926     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
12928 AC_SUBST(ENABLE_SILENT_MSI)
12930 AC_MSG_CHECKING([whether and how to use Xinerama])
12931 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
12932     if test "$x_libraries" = "default_x_libraries"; then
12933         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
12934         if test "x$XINERAMALIB" = x; then
12935            XINERAMALIB="/usr/lib"
12936         fi
12937     else
12938         XINERAMALIB="$x_libraries"
12939     fi
12940     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
12941         # we have both versions, let the user decide but use the dynamic one
12942         # per default
12943         USE_XINERAMA=TRUE
12944         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
12945             XINERAMA_LINK=dynamic
12946         else
12947             XINERAMA_LINK=static
12948         fi
12949     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
12950         # we have only the dynamic version
12951         USE_XINERAMA=TRUE
12952         XINERAMA_LINK=dynamic
12953     elif test -e "$XINERAMALIB/libXinerama.a"; then
12954         # static version
12955         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
12956             USE_XINERAMA=TRUE
12957             XINERAMA_LINK=static
12958         else
12959             USE_XINERAMA=
12960             XINERAMA_LINK=none
12961         fi
12962     else
12963         # no Xinerama
12964         USE_XINERAMA=
12965         XINERAMA_LINK=none
12966     fi
12967     if test "$USE_XINERAMA" = "TRUE"; then
12968         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
12969         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
12970             [AC_MSG_ERROR(Xinerama header not found.)], [])
12971         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
12972         if test "x$XEXTLIB" = x; then
12973            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
12974         fi
12975         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
12976         if test "$_os" = "FreeBSD"; then
12977             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
12978         fi
12979         if test "$_os" = "Linux"; then
12980             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
12981         fi
12982         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
12983             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
12984     else
12985         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
12986     fi
12987 else
12988     USE_XINERAMA=
12989     XINERAMA_LINK=none
12990     AC_MSG_RESULT([no])
12992 AC_SUBST(USE_XINERAMA)
12993 AC_SUBST(XINERAMA_LINK)
12995 dnl ===================================================================
12996 dnl Test whether to build cairo or rely on the system version
12997 dnl ===================================================================
12999 if test "$USING_X11" = TRUE; then
13000     # Used in vcl/Library_vclplug_gen.mk
13001     test_cairo=yes
13004 if test "$test_cairo" = "yes"; then
13005     AC_MSG_CHECKING([whether to use the system cairo])
13007     : ${with_system_cairo:=$with_system_libs}
13008     if test "$with_system_cairo" = "yes"; then
13009         SYSTEM_CAIRO=TRUE
13010         AC_MSG_RESULT([yes])
13012         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
13013         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13014         FilterLibs "${CAIRO_LIBS}"
13015         CAIRO_LIBS="${filteredlibs}"
13017         if test "$test_xrender" = "yes"; then
13018             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
13019             AC_LANG_PUSH([C])
13020             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
13021 #ifdef PictStandardA8
13022 #else
13023       return fail;
13024 #endif
13025 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
13027             AC_LANG_POP([C])
13028         fi
13029     else
13030         SYSTEM_CAIRO=
13031         AC_MSG_RESULT([no])
13033         BUILD_TYPE="$BUILD_TYPE CAIRO"
13034     fi
13037 AC_SUBST(SYSTEM_CAIRO)
13038 AC_SUBST(CAIRO_CFLAGS)
13039 AC_SUBST(CAIRO_LIBS)
13041 dnl ===================================================================
13042 dnl Test whether to use avahi
13043 dnl ===================================================================
13044 if test "$_os" = "WINNT"; then
13045     # Windows uses bundled mDNSResponder
13046     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
13047 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
13048     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
13049                       [ENABLE_AVAHI="TRUE"])
13050     AC_DEFINE(HAVE_FEATURE_AVAHI)
13051     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13052     FilterLibs "${AVAHI_LIBS}"
13053     AVAHI_LIBS="${filteredlibs}"
13056 AC_SUBST(ENABLE_AVAHI)
13057 AC_SUBST(AVAHI_CFLAGS)
13058 AC_SUBST(AVAHI_LIBS)
13060 dnl ===================================================================
13061 dnl Test whether to use liblangtag
13062 dnl ===================================================================
13063 SYSTEM_LIBLANGTAG=
13064 AC_MSG_CHECKING([whether to use system liblangtag])
13065 if test "$with_system_liblangtag" = yes; then
13066     SYSTEM_LIBLANGTAG=TRUE
13067     AC_MSG_RESULT([yes])
13068     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
13069     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
13070     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
13071     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13072     FilterLibs "${LIBLANGTAG_LIBS}"
13073     LIBLANGTAG_LIBS="${filteredlibs}"
13074 else
13075     SYSTEM_LIBLANGTAG=
13076     AC_MSG_RESULT([no])
13077     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
13078     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
13079     if test "$COM" = "MSC"; then
13080         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
13081     else
13082         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
13083     fi
13085 AC_SUBST(SYSTEM_LIBLANGTAG)
13086 AC_SUBST(LIBLANGTAG_CFLAGS)
13087 AC_SUBST(LIBLANGTAG_LIBS)
13089 dnl ===================================================================
13090 dnl Test whether to build libpng or rely on the system version
13091 dnl ===================================================================
13093 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
13095 dnl ===================================================================
13096 dnl Test whether to build libwebp or rely on the system version
13097 dnl ===================================================================
13099 libo_CHECK_SYSTEM_MODULE([libwebp],[LIBWEBP],[libwebp])
13101 dnl ===================================================================
13102 dnl Check for runtime JVM search path
13103 dnl ===================================================================
13104 if test "$ENABLE_JAVA" != ""; then
13105     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
13106     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
13107         AC_MSG_RESULT([yes])
13108         if ! test -d "$with_jvm_path"; then
13109             AC_MSG_ERROR(["$with_jvm_path" not a directory])
13110         fi
13111         if ! test -d "$with_jvm_path"jvm; then
13112             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
13113         fi
13114         JVM_ONE_PATH_CHECK="$with_jvm_path"
13115         AC_SUBST(JVM_ONE_PATH_CHECK)
13116     else
13117         AC_MSG_RESULT([no])
13118     fi
13121 dnl ===================================================================
13122 dnl Test for the presence of Ant and that it works
13123 dnl ===================================================================
13125 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE" -a "$cross_compiling" != "yes"; then
13126     ANT_HOME=; export ANT_HOME
13127     WITH_ANT_HOME=; export WITH_ANT_HOME
13128     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
13129         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
13130             if test "$_os" = "WINNT"; then
13131                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
13132             else
13133                 with_ant_home="$LODE_HOME/opt/ant"
13134             fi
13135         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
13136             with_ant_home="$LODE_HOME/opt/ant"
13137         fi
13138     fi
13139     if test -z "$with_ant_home"; then
13140         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
13141     else
13142         if test "$_os" = "WINNT"; then
13143             # AC_PATH_PROGS needs unix path
13144             with_ant_home=`cygpath -u "$with_ant_home"`
13145         fi
13146         AbsolutePath "$with_ant_home"
13147         with_ant_home=$absolute_path
13148         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
13149         WITH_ANT_HOME=$with_ant_home
13150         ANT_HOME=$with_ant_home
13151     fi
13153     if test -z "$ANT"; then
13154         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
13155     else
13156         # resolve relative or absolute symlink
13157         while test -h "$ANT"; do
13158             a_cwd=`pwd`
13159             a_basename=`basename "$ANT"`
13160             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
13161             cd "`dirname "$ANT"`"
13162             cd "`dirname "$a_script"`"
13163             ANT="`pwd`"/"`basename "$a_script"`"
13164             cd "$a_cwd"
13165         done
13167         AC_MSG_CHECKING([if $ANT works])
13168         mkdir -p conftest.dir
13169         a_cwd=$(pwd)
13170         cd conftest.dir
13171         cat > conftest.java << EOF
13172         public class conftest {
13173             int testmethod(int a, int b) {
13174                     return a + b;
13175             }
13176         }
13179         cat > conftest.xml << EOF
13180         <project name="conftest" default="conftest">
13181         <target name="conftest">
13182             <javac srcdir="." includes="conftest.java">
13183             </javac>
13184         </target>
13185         </project>
13188         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
13189         if test $? = 0 -a -f ./conftest.class; then
13190             AC_MSG_RESULT([Ant works])
13191             if test -z "$WITH_ANT_HOME"; then
13192                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
13193                 if test -z "$ANT_HOME"; then
13194                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
13195                 fi
13196             else
13197                 ANT_HOME="$WITH_ANT_HOME"
13198             fi
13199         else
13200             echo "configure: Ant test failed" >&5
13201             cat conftest.java >&5
13202             cat conftest.xml >&5
13203             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
13204         fi
13205         cd "$a_cwd"
13206         rm -fr conftest.dir
13207     fi
13208     if test -z "$ANT_HOME"; then
13209         ANT_HOME="NO_ANT_HOME"
13210     else
13211         PathFormat "$ANT_HOME"
13212         ANT_HOME="$formatted_path"
13213         PathFormat "$ANT"
13214         ANT="$formatted_path"
13215     fi
13217     dnl Checking for ant.jar
13218     if test "$ANT_HOME" != "NO_ANT_HOME"; then
13219         AC_MSG_CHECKING([Ant lib directory])
13220         if test -f $ANT_HOME/lib/ant.jar; then
13221             ANT_LIB="$ANT_HOME/lib"
13222         else
13223             if test -f $ANT_HOME/ant.jar; then
13224                 ANT_LIB="$ANT_HOME"
13225             else
13226                 if test -f /usr/share/java/ant.jar; then
13227                     ANT_LIB=/usr/share/java
13228                 else
13229                     if test -f /usr/share/ant-core/lib/ant.jar; then
13230                         ANT_LIB=/usr/share/ant-core/lib
13231                     else
13232                         if test -f $ANT_HOME/lib/ant/ant.jar; then
13233                             ANT_LIB="$ANT_HOME/lib/ant"
13234                         else
13235                             if test -f /usr/share/lib/ant/ant.jar; then
13236                                 ANT_LIB=/usr/share/lib/ant
13237                             else
13238                                 AC_MSG_ERROR([Ant libraries not found!])
13239                             fi
13240                         fi
13241                     fi
13242                 fi
13243             fi
13244         fi
13245         PathFormat "$ANT_LIB"
13246         ANT_LIB="$formatted_path"
13247         AC_MSG_RESULT([Ant lib directory found.])
13248     fi
13250     ant_minver=1.6.0
13251     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
13253     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
13254     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
13255     ant_version_major=`echo $ant_version | cut -d. -f1`
13256     ant_version_minor=`echo $ant_version | cut -d. -f2`
13257     echo "configure: ant_version $ant_version " >&5
13258     echo "configure: ant_version_major $ant_version_major " >&5
13259     echo "configure: ant_version_minor $ant_version_minor " >&5
13260     if test "$ant_version_major" -ge "2"; then
13261         AC_MSG_RESULT([yes, $ant_version])
13262     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
13263         AC_MSG_RESULT([yes, $ant_version])
13264     else
13265         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
13266     fi
13268     rm -f conftest* core core.* *.core
13270 AC_SUBST(ANT)
13271 AC_SUBST(ANT_HOME)
13272 AC_SUBST(ANT_LIB)
13274 OOO_JUNIT_JAR=
13275 HAMCREST_JAR=
13276 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no" -a "$cross_compiling" != "yes"; then
13277     AC_MSG_CHECKING([for JUnit 4])
13278     if test "$with_junit" = "yes"; then
13279         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
13280             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
13281         elif test -e /usr/share/java/junit4.jar; then
13282             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
13283         else
13284            if test -e /usr/share/lib/java/junit.jar; then
13285               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
13286            else
13287               OOO_JUNIT_JAR=/usr/share/java/junit.jar
13288            fi
13289         fi
13290     else
13291         OOO_JUNIT_JAR=$with_junit
13292     fi
13293     if test "$_os" = "WINNT"; then
13294         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
13295     fi
13296     printf 'import org.junit.Before;' > conftest.java
13297     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
13298         AC_MSG_RESULT([$OOO_JUNIT_JAR])
13299     else
13300         AC_MSG_ERROR(
13301 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
13302  specify its pathname via --with-junit=..., or disable it via --without-junit])
13303     fi
13304     rm -f conftest.class conftest.java
13305     if test $OOO_JUNIT_JAR != ""; then
13306         BUILD_TYPE="$BUILD_TYPE QADEVOOO"
13307     fi
13309     AC_MSG_CHECKING([for included Hamcrest])
13310     printf 'import org.hamcrest.BaseDescription;' > conftest.java
13311     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
13312         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
13313     else
13314         AC_MSG_RESULT([Not included])
13315         AC_MSG_CHECKING([for standalone hamcrest jar.])
13316         if test "$with_hamcrest" = "yes"; then
13317             if test -e /usr/share/lib/java/hamcrest.jar; then
13318                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
13319             elif test -e /usr/share/java/hamcrest/core.jar; then
13320                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
13321             elif test -e /usr/share/java/hamcrest/hamcrest.jar; then
13322                 HAMCREST_JAR=/usr/share/java/hamcrest/hamcrest.jar
13323             else
13324                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
13325             fi
13326         else
13327             HAMCREST_JAR=$with_hamcrest
13328         fi
13329         if test "$_os" = "WINNT"; then
13330             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
13331         fi
13332         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
13333             AC_MSG_RESULT([$HAMCREST_JAR])
13334         else
13335             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),
13336                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
13337         fi
13338     fi
13339     rm -f conftest.class conftest.java
13341 AC_SUBST(OOO_JUNIT_JAR)
13342 AC_SUBST(HAMCREST_JAR)
13345 AC_SUBST(SCPDEFS)
13348 # check for wget and curl
13350 WGET=
13351 CURL=
13353 if test "$enable_fetch_external" != "no"; then
13355 CURL=`which curl 2>/dev/null`
13357 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
13358     # wget new enough?
13359     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
13360     if test $? -eq 0; then
13361         WGET=$i
13362         break
13363     fi
13364 done
13366 if test -z "$WGET" -a -z "$CURL"; then
13367     AC_MSG_ERROR([neither wget nor curl found!])
13372 AC_SUBST(WGET)
13373 AC_SUBST(CURL)
13376 # check for sha256sum
13378 SHA256SUM=
13380 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
13381     eval "$i -a 256 --version" > /dev/null 2>&1
13382     ret=$?
13383     if test $ret -eq 0; then
13384         SHA256SUM="$i -a 256"
13385         break
13386     fi
13387 done
13389 if test -z "$SHA256SUM"; then
13390     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
13391         eval "$i --version" > /dev/null 2>&1
13392         ret=$?
13393         if test $ret -eq 0; then
13394             SHA256SUM=$i
13395             break
13396         fi
13397     done
13400 if test -z "$SHA256SUM"; then
13401     AC_MSG_ERROR([no sha256sum found!])
13404 AC_SUBST(SHA256SUM)
13406 dnl ===================================================================
13407 dnl Dealing with l10n options
13408 dnl ===================================================================
13409 AC_MSG_CHECKING([which languages to be built])
13410 # get list of all languages
13411 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
13412 # the sed command does the following:
13413 #   + if a line ends with a backslash, append the next line to it
13414 #   + adds " on the beginning of the value (after =)
13415 #   + adds " at the end of the value
13416 #   + removes en-US; we want to put it on the beginning
13417 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
13418 [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)]
13419 ALL_LANGS="en-US $completelangiso"
13420 # check the configured localizations
13421 WITH_LANG="$with_lang"
13423 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
13424 # (Norwegian is "nb" and "nn".)
13425 if test "$WITH_LANG" = "no"; then
13426     WITH_LANG=
13429 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
13430     AC_MSG_RESULT([en-US])
13431 else
13432     AC_MSG_RESULT([$WITH_LANG])
13433     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
13434     if test -z "$MSGFMT"; then
13435         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
13436             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
13437         elif test -x "/opt/lo/bin/msgfmt"; then
13438             MSGFMT="/opt/lo/bin/msgfmt"
13439         else
13440             AC_CHECK_PROGS(MSGFMT, [msgfmt])
13441             if test -z "$MSGFMT"; then
13442                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
13443             fi
13444         fi
13445     fi
13446     if test -z "$MSGUNIQ"; then
13447         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
13448             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
13449         elif test -x "/opt/lo/bin/msguniq"; then
13450             MSGUNIQ="/opt/lo/bin/msguniq"
13451         else
13452             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
13453             if test -z "$MSGUNIQ"; then
13454                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
13455             fi
13456         fi
13457     fi
13459 AC_SUBST(MSGFMT)
13460 AC_SUBST(MSGUNIQ)
13461 # check that the list is valid
13462 for lang in $WITH_LANG; do
13463     test "$lang" = "ALL" && continue
13464     # need to check for the exact string, so add space before and after the list of all languages
13465     for vl in $ALL_LANGS; do
13466         if test "$vl" = "$lang"; then
13467            break
13468         fi
13469     done
13470     if test "$vl" != "$lang"; then
13471         # if you're reading this - you prolly quoted your languages remove the quotes ...
13472         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
13473     fi
13474 done
13475 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
13476     echo $WITH_LANG | grep -q en-US
13477     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
13479 # list with substituted ALL
13480 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
13481 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
13482 test "$WITH_LANG" = "en-US" && WITH_LANG=
13483 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
13484     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
13485     ALL_LANGS=`echo $ALL_LANGS qtz`
13487 AC_SUBST(ALL_LANGS)
13488 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
13489 AC_SUBST(WITH_LANG)
13490 AC_SUBST(WITH_LANG_LIST)
13491 AC_SUBST(GIT_NEEDED_SUBMODULES)
13493 WITH_POOR_HELP_LOCALIZATIONS=
13494 if test -d "$SRC_ROOT/translations/source"; then
13495     for l in `ls -1 $SRC_ROOT/translations/source`; do
13496         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
13497             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
13498         fi
13499     done
13501 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
13503 if test -n "$with_locales"; then
13504     WITH_LOCALES="$with_locales"
13506     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
13507     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
13508     # config_host/config_locales.h.in
13509     for locale in $WITH_LOCALES; do
13510         lang=${locale%_*}
13512         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
13514         case $lang in
13515         hi|mr*ne)
13516             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
13517             ;;
13518         bg|ru)
13519             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
13520             ;;
13521         esac
13522     done
13523 else
13524     AC_DEFINE(WITH_LOCALE_ALL)
13526 AC_SUBST(WITH_LOCALES)
13528 dnl git submodule update --reference
13529 dnl ===================================================================
13530 if test -n "${GIT_REFERENCE_SRC}"; then
13531     for repo in ${GIT_NEEDED_SUBMODULES}; do
13532         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
13533             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
13534         fi
13535     done
13537 AC_SUBST(GIT_REFERENCE_SRC)
13539 dnl git submodules linked dirs
13540 dnl ===================================================================
13541 if test -n "${GIT_LINK_SRC}"; then
13542     for repo in ${GIT_NEEDED_SUBMODULES}; do
13543         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
13544             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
13545         fi
13546     done
13548 AC_SUBST(GIT_LINK_SRC)
13550 dnl branding
13551 dnl ===================================================================
13552 AC_MSG_CHECKING([for alternative branding images directory])
13553 # initialize mapped arrays
13554 BRAND_INTRO_IMAGES="intro.png intro-highres.png"
13555 brand_files="$BRAND_INTRO_IMAGES logo.svg logo_inverted.svg logo-sc.svg logo-sc_inverted.svg about.svg"
13557 if test -z "$with_branding" -o "$with_branding" = "no"; then
13558     AC_MSG_RESULT([none])
13559     DEFAULT_BRAND_IMAGES="$brand_files"
13560 else
13561     if ! test -d $with_branding ; then
13562         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
13563     else
13564         AC_MSG_RESULT([$with_branding])
13565         CUSTOM_BRAND_DIR="$with_branding"
13566         for lfile in $brand_files
13567         do
13568             if ! test -f $with_branding/$lfile ; then
13569                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
13570                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
13571             else
13572                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
13573             fi
13574         done
13575         check_for_progress="yes"
13576     fi
13578 AC_SUBST([BRAND_INTRO_IMAGES])
13579 AC_SUBST([CUSTOM_BRAND_DIR])
13580 AC_SUBST([CUSTOM_BRAND_IMAGES])
13581 AC_SUBST([DEFAULT_BRAND_IMAGES])
13584 AC_MSG_CHECKING([for 'intro' progress settings])
13585 PROGRESSBARCOLOR=
13586 PROGRESSSIZE=
13587 PROGRESSPOSITION=
13588 PROGRESSFRAMECOLOR=
13589 PROGRESSTEXTCOLOR=
13590 PROGRESSTEXTBASELINE=
13592 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
13593     source "$with_branding/progress.conf"
13594     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
13595 else
13596     AC_MSG_RESULT([none])
13599 AC_SUBST(PROGRESSBARCOLOR)
13600 AC_SUBST(PROGRESSSIZE)
13601 AC_SUBST(PROGRESSPOSITION)
13602 AC_SUBST(PROGRESSFRAMECOLOR)
13603 AC_SUBST(PROGRESSTEXTCOLOR)
13604 AC_SUBST(PROGRESSTEXTBASELINE)
13607 dnl ===================================================================
13608 dnl Custom build version
13609 dnl ===================================================================
13610 AC_MSG_CHECKING([for extra build ID])
13611 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
13612     EXTRA_BUILDID="$with_extra_buildid"
13614 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
13615 if test -n "$EXTRA_BUILDID" ; then
13616     AC_MSG_RESULT([$EXTRA_BUILDID])
13617 else
13618     AC_MSG_RESULT([not set])
13620 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
13622 OOO_VENDOR=
13623 AC_MSG_CHECKING([for vendor])
13624 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
13625     OOO_VENDOR="$USERNAME"
13627     if test -z "$OOO_VENDOR"; then
13628         OOO_VENDOR="$USER"
13629     fi
13631     if test -z "$OOO_VENDOR"; then
13632         OOO_VENDOR="`id -u -n`"
13633     fi
13635     AC_MSG_RESULT([not set, using $OOO_VENDOR])
13636 else
13637     OOO_VENDOR="$with_vendor"
13638     AC_MSG_RESULT([$OOO_VENDOR])
13640 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
13641 AC_SUBST(OOO_VENDOR)
13643 if test "$_os" = "Android" ; then
13644     ANDROID_PACKAGE_NAME=
13645     AC_MSG_CHECKING([for Android package name])
13646     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
13647         if test -n "$ENABLE_DEBUG"; then
13648             # Default to the package name that makes ndk-gdb happy.
13649             ANDROID_PACKAGE_NAME="org.libreoffice"
13650         else
13651             ANDROID_PACKAGE_NAME="org.example.libreoffice"
13652         fi
13654         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
13655     else
13656         ANDROID_PACKAGE_NAME="$with_android_package_name"
13657         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
13658     fi
13659     AC_SUBST(ANDROID_PACKAGE_NAME)
13662 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
13663 if test "$with_compat_oowrappers" = "yes"; then
13664     WITH_COMPAT_OOWRAPPERS=TRUE
13665     AC_MSG_RESULT(yes)
13666 else
13667     WITH_COMPAT_OOWRAPPERS=
13668     AC_MSG_RESULT(no)
13670 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
13672 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{gsub(" ", "", $0);print tolower($0)}'`
13673 AC_MSG_CHECKING([for install dirname])
13674 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
13675     INSTALLDIRNAME="$with_install_dirname"
13677 AC_MSG_RESULT([$INSTALLDIRNAME])
13678 AC_SUBST(INSTALLDIRNAME)
13680 AC_MSG_CHECKING([for prefix])
13681 test "x$prefix" = xNONE && prefix=$ac_default_prefix
13682 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
13683 PREFIXDIR="$prefix"
13684 AC_MSG_RESULT([$PREFIXDIR])
13685 AC_SUBST(PREFIXDIR)
13687 LIBDIR=[$(eval echo $(eval echo $libdir))]
13688 AC_SUBST(LIBDIR)
13690 DATADIR=[$(eval echo $(eval echo $datadir))]
13691 AC_SUBST(DATADIR)
13693 MANDIR=[$(eval echo $(eval echo $mandir))]
13694 AC_SUBST(MANDIR)
13696 DOCDIR=[$(eval echo $(eval echo $docdir))]
13697 AC_SUBST(DOCDIR)
13699 BINDIR=[$(eval echo $(eval echo $bindir))]
13700 AC_SUBST(BINDIR)
13702 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
13703 AC_SUBST(INSTALLDIR)
13705 TESTINSTALLDIR="${BUILDDIR}/test-install"
13706 AC_SUBST(TESTINSTALLDIR)
13709 # ===================================================================
13710 # OAuth2 id and secrets
13711 # ===================================================================
13713 AC_MSG_CHECKING([for Google Drive client id and secret])
13714 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
13715     AC_MSG_RESULT([not set])
13716     GDRIVE_CLIENT_ID="\"\""
13717     GDRIVE_CLIENT_SECRET="\"\""
13718 else
13719     AC_MSG_RESULT([set])
13720     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
13721     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
13723 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
13724 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
13726 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
13727 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
13728     AC_MSG_RESULT([not set])
13729     ALFRESCO_CLOUD_CLIENT_ID="\"\""
13730     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
13731 else
13732     AC_MSG_RESULT([set])
13733     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
13734     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
13736 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
13737 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
13739 AC_MSG_CHECKING([for OneDrive client id and secret])
13740 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
13741     AC_MSG_RESULT([not set])
13742     ONEDRIVE_CLIENT_ID="\"\""
13743     ONEDRIVE_CLIENT_SECRET="\"\""
13744 else
13745     AC_MSG_RESULT([set])
13746     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
13747     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
13749 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
13750 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
13753 dnl ===================================================================
13754 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
13755 dnl --enable-dependency-tracking configure option
13756 dnl ===================================================================
13757 AC_MSG_CHECKING([whether to enable dependency tracking])
13758 if test "$enable_dependency_tracking" = "no"; then
13759     nodep=TRUE
13760     AC_MSG_RESULT([no])
13761 else
13762     AC_MSG_RESULT([yes])
13764 AC_SUBST(nodep)
13766 dnl ===================================================================
13767 dnl Number of CPUs to use during the build
13768 dnl ===================================================================
13769 AC_MSG_CHECKING([for number of processors to use])
13770 # plain --with-parallelism is just the default
13771 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
13772     if test "$with_parallelism" = "no"; then
13773         PARALLELISM=0
13774     else
13775         PARALLELISM=$with_parallelism
13776     fi
13777 else
13778     if test "$enable_icecream" = "yes"; then
13779         PARALLELISM="40"
13780     else
13781         case `uname -s` in
13783         Darwin|FreeBSD|NetBSD|OpenBSD)
13784             PARALLELISM=`sysctl -n hw.ncpu`
13785             ;;
13787         Linux)
13788             PARALLELISM=`getconf _NPROCESSORS_ONLN`
13789         ;;
13790         # what else than above does profit here *and* has /proc?
13791         *)
13792             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
13793             ;;
13794         esac
13796         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
13797         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
13798     fi
13801 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
13802     if test -z "$with_parallelism"; then
13803             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
13804             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
13805             PARALLELISM="1"
13806     else
13807         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."
13808     fi
13811 if test $PARALLELISM -eq 0; then
13812     AC_MSG_RESULT([explicit make -j option needed])
13813 else
13814     AC_MSG_RESULT([$PARALLELISM])
13816 AC_SUBST(PARALLELISM)
13818 IWYU_PATH="$with_iwyu"
13819 AC_SUBST(IWYU_PATH)
13820 if test ! -z "$IWYU_PATH"; then
13821     if test ! -f "$IWYU_PATH"; then
13822         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
13823     fi
13827 # Set up ILIB for MSVC build
13829 ILIB1=
13830 if test "$build_os" = "cygwin"; then
13831     ILIB="."
13832     if test -n "$JAVA_HOME"; then
13833         ILIB="$ILIB;$JAVA_HOME/lib"
13834     fi
13835     ILIB1=-link
13836     ILIB="$ILIB;$COMPATH/lib/$WIN_HOST_ARCH"
13837     ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/$WIN_HOST_ARCH"
13838     ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
13839     ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
13840     if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
13841         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
13842         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
13843     fi
13844     PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/$WIN_HOST_ARCH"
13845     ucrtlibpath_formatted=$formatted_path
13846     ILIB="$ILIB;$ucrtlibpath_formatted"
13847     ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
13848     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
13849         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
13850     else
13851         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WIN_HOST_ARCH"
13852     fi
13854     if test "$cross_compiling" != "yes"; then
13855         ILIB_FOR_BUILD="$ILIB"
13856     fi
13858 AC_SUBST(ILIB)
13859 AC_SUBST(ILIB_FOR_BUILD)
13861 # ===================================================================
13862 # Creating bigger shared library to link against
13863 # ===================================================================
13864 AC_MSG_CHECKING([whether to create huge library])
13865 MERGELIBS=
13867 if test $_os = iOS -o $_os = Android; then
13868     # Never any point in mergelibs for these as we build just static
13869     # libraries anyway...
13870     enable_mergelibs=no
13873 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
13874     if test $_os != Linux -a $_os != WINNT; then
13875         add_warning "--enable-mergelibs is not tested for this platform"
13876     fi
13877     MERGELIBS="TRUE"
13878     AC_MSG_RESULT([yes])
13879     AC_DEFINE(ENABLE_MERGELIBS)
13880 else
13881     AC_MSG_RESULT([no])
13883 AC_SUBST([MERGELIBS])
13885 dnl ===================================================================
13886 dnl icerun is a wrapper that stops us spawning tens of processes
13887 dnl locally - for tools that can't be executed on the compile cluster
13888 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
13889 dnl ===================================================================
13890 AC_MSG_CHECKING([whether to use icerun wrapper])
13891 ICECREAM_RUN=
13892 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
13893     ICECREAM_RUN=icerun
13894     AC_MSG_RESULT([yes])
13895 else
13896     AC_MSG_RESULT([no])
13898 AC_SUBST(ICECREAM_RUN)
13900 dnl ===================================================================
13901 dnl Setup the ICECC_VERSION for the build the same way it was set for
13902 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
13903 dnl ===================================================================
13904 x_ICECC_VERSION=[\#]
13905 if test -n "$ICECC_VERSION" ; then
13906     x_ICECC_VERSION=
13908 AC_SUBST(x_ICECC_VERSION)
13909 AC_SUBST(ICECC_VERSION)
13911 dnl ===================================================================
13913 AC_MSG_CHECKING([MPL subset])
13914 MPL_SUBSET=
13916 if test "$enable_mpl_subset" = "yes"; then
13917     warn_report=false
13918     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
13919         warn_report=true
13920     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
13921         warn_report=true
13922     fi
13923     if test "$warn_report" = "true"; then
13924         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
13925     fi
13926     if test "x$enable_postgresql_sdbc" != "xno"; then
13927         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
13928     fi
13929     if test "$enable_lotuswordpro" = "yes"; then
13930         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
13931     fi
13932     if test "$WITH_WEBDAV" = "neon"; then
13933         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
13934     fi
13935     if test -n "$ENABLE_POPPLER"; then
13936         if test "x$SYSTEM_POPPLER" = "x"; then
13937             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
13938         fi
13939     fi
13940     # cf. m4/libo_check_extension.m4
13941     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
13942         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
13943     fi
13944     for theme in $WITH_THEMES; do
13945         case $theme in
13946         breeze|breeze_dark|breeze_dark_svg|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #denylist of icon themes under GPL or LGPL
13947             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=colibre]) ;;
13948         *) : ;;
13949         esac
13950     done
13952     ENABLE_OPENGL_TRANSITIONS=
13954     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
13955         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
13956     fi
13958     MPL_SUBSET="TRUE"
13959     AC_DEFINE(MPL_HAVE_SUBSET)
13960     AC_MSG_RESULT([only])
13961 else
13962     AC_MSG_RESULT([no restrictions])
13964 AC_SUBST(MPL_SUBSET)
13966 dnl ===================================================================
13968 AC_MSG_CHECKING([formula logger])
13969 ENABLE_FORMULA_LOGGER=
13971 if test "x$enable_formula_logger" = "xyes"; then
13972     AC_MSG_RESULT([yes])
13973     AC_DEFINE(ENABLE_FORMULA_LOGGER)
13974     ENABLE_FORMULA_LOGGER=TRUE
13975 elif test -n "$ENABLE_DBGUTIL" ; then
13976     AC_MSG_RESULT([yes])
13977     AC_DEFINE(ENABLE_FORMULA_LOGGER)
13978     ENABLE_FORMULA_LOGGER=TRUE
13979 else
13980     AC_MSG_RESULT([no])
13983 AC_SUBST(ENABLE_FORMULA_LOGGER)
13985 dnl ===================================================================
13986 dnl Checking for active Antivirus software.
13987 dnl ===================================================================
13989 if test $_os = WINNT -a -f "$SRC_ROOT/antivirusDetection.vbs" ; then
13990     AC_MSG_CHECKING([for active Antivirus software])
13991     ANTIVIRUS_LIST=`cscript.exe //Nologo $SRC_ROOT/antivirusDetection.vbs`
13992     if [ [ "$ANTIVIRUS_LIST" != "NULL" ] ]; then
13993         if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then
13994             AC_MSG_RESULT([found])
13995             EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
13996             echo $EICAR_STRING > $SRC_ROOT/eicar
13997             EICAR_TEMP_FILE_CONTENTS=`cat $SRC_ROOT/eicar`
13998             rm $SRC_ROOT/eicar
13999             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
14000                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
14001             fi
14002             echo $EICAR_STRING > $BUILDDIR/eicar
14003             EICAR_TEMP_FILE_CONTENTS=`cat $BUILDDIR/eicar`
14004             rm $BUILDDIR/eicar
14005             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
14006                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
14007             fi
14008             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"
14009         else
14010             AC_MSG_RESULT([not found])
14011         fi
14012     else
14013         AC_MSG_RESULT([n/a])
14014     fi
14017 dnl ===================================================================
14018 dnl Setting up the environment.
14019 dnl ===================================================================
14020 AC_MSG_NOTICE([setting up the build environment variables...])
14022 AC_SUBST(COMPATH)
14024 if test "$build_os" = "cygwin"; then
14025     if test -d "$COMPATH/atlmfc/lib/spectre"; then
14026         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
14027         ATL_INCLUDE="$COMPATH/atlmfc/include"
14028     elif test -d "$COMPATH/atlmfc/lib"; then
14029         ATL_LIB="$COMPATH/atlmfc/lib"
14030         ATL_INCLUDE="$COMPATH/atlmfc/include"
14031     else
14032         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
14033         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
14034     fi
14035     ATL_LIB="$ATL_LIB/$WIN_HOST_ARCH"
14036     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
14037     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
14039     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
14040     PathFormat "/usr/bin/find.exe"
14041     FIND="$formatted_path"
14042     PathFormat "/usr/bin/sort.exe"
14043     SORT="$formatted_path"
14044     PathFormat "/usr/bin/grep.exe"
14045     WIN_GREP="$formatted_path"
14046     PathFormat "/usr/bin/ls.exe"
14047     WIN_LS="$formatted_path"
14048     PathFormat "/usr/bin/touch.exe"
14049     WIN_TOUCH="$formatted_path"
14050 else
14051     FIND=find
14052     SORT=sort
14055 AC_SUBST(ATL_INCLUDE)
14056 AC_SUBST(ATL_LIB)
14057 AC_SUBST(FIND)
14058 AC_SUBST(SORT)
14059 AC_SUBST(WIN_GREP)
14060 AC_SUBST(WIN_LS)
14061 AC_SUBST(WIN_TOUCH)
14063 AC_SUBST(BUILD_TYPE)
14065 AC_SUBST(SOLARINC)
14067 PathFormat "$PERL"
14068 PERL="$formatted_path"
14069 AC_SUBST(PERL)
14071 if test -n "$TMPDIR"; then
14072     TEMP_DIRECTORY="$TMPDIR"
14073 else
14074     TEMP_DIRECTORY="/tmp"
14076 if test "$build_os" = "cygwin"; then
14077     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
14079 AC_SUBST(TEMP_DIRECTORY)
14081 # setup the PATH for the environment
14082 if test -n "$LO_PATH_FOR_BUILD"; then
14083     LO_PATH="$LO_PATH_FOR_BUILD"
14084     case "$host_os" in
14085     cygwin*|wsl*)
14086         pathmunge "$MSVC_HOST_PATH" "before"
14087         ;;
14088     esac
14089 else
14090     LO_PATH="$PATH"
14092     case "$host_os" in
14094     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
14095         if test "$ENABLE_JAVA" != ""; then
14096             pathmunge "$JAVA_HOME/bin" "after"
14097         fi
14098         ;;
14100     cygwin*|wsl*)
14101         # Win32 make needs native paths
14102         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
14103             LO_PATH=`cygpath -p -m "$PATH"`
14104         fi
14105         if test "$WIN_BUILD_ARCH" = "x64"; then
14106             # needed for msi packaging
14107             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
14108         fi
14109         # .NET 4.6 and higher don't have bin directory
14110         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
14111             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
14112         fi
14113         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
14114         pathmunge "$CSC_PATH" "before"
14115         pathmunge "$MIDL_PATH" "before"
14116         pathmunge "$AL_PATH" "before"
14117         pathmunge "$MSVC_MULTI_PATH" "before"
14118         pathmunge "$MSVC_BUILD_PATH" "before"
14119         if test -n "$MSBUILD_PATH" ; then
14120             pathmunge "$MSBUILD_PATH" "before"
14121         fi
14122         pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/$WIN_BUILD_ARCH" "before"
14123         if test "$ENABLE_JAVA" != ""; then
14124             if test -d "$JAVA_HOME/jre/bin/client"; then
14125                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
14126             fi
14127             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
14128                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
14129             fi
14130             pathmunge "$JAVA_HOME/bin" "before"
14131         fi
14132         pathmunge "$MSVC_HOST_PATH" "before"
14133         ;;
14135     solaris*)
14136         pathmunge "/usr/css/bin" "before"
14137         if test "$ENABLE_JAVA" != ""; then
14138             pathmunge "$JAVA_HOME/bin" "after"
14139         fi
14140         ;;
14141     esac
14144 AC_SUBST(LO_PATH)
14146 # Allow to pass LO_ELFCHECK_ALLOWLIST from autogen.input to bin/check-elf-dynamic-objects:
14147 if test "$LO_ELFCHECK_ALLOWLIST" = x || test "${LO_ELFCHECK_ALLOWLIST-x}" != x; then
14148     x_LO_ELFCHECK_ALLOWLIST=
14149 else
14150     x_LO_ELFCHECK_ALLOWLIST=[\#]
14152 AC_SUBST(x_LO_ELFCHECK_ALLOWLIST)
14153 AC_SUBST(LO_ELFCHECK_ALLOWLIST)
14155 libo_FUZZ_SUMMARY
14157 # Generate a configuration sha256 we can use for deps
14158 if test -f config_host.mk; then
14159     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
14161 if test -f config_host_lang.mk; then
14162     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
14165 CFLAGS=$my_original_CFLAGS
14166 CXXFLAGS=$my_original_CXXFLAGS
14167 CPPFLAGS=$my_original_CPPFLAGS
14169 AC_CONFIG_LINKS([include:include])
14171 # Keep in sync with list of files far up, at AC_MSG_CHECKING([for
14172 # BUILD platform configuration] - otherwise breaks cross building
14173 AC_CONFIG_FILES([config_host.mk
14174                  config_host_lang.mk
14175                  Makefile
14176                  bin/bffvalidator.sh
14177                  bin/odfvalidator.sh
14178                  bin/officeotron.sh
14179                  hardened_runtime.xcent
14180                  instsetoo_native/util/openoffice.lst
14181                  setup_native/source/packinfo/finals_instsetoo.txt
14182                  sysui/desktop/macosx/Info.plist])
14183 AC_CONFIG_HEADERS([config_host/config_buildid.h])
14184 AC_CONFIG_HEADERS([config_host/config_box2d.h])
14185 AC_CONFIG_HEADERS([config_host/config_clang.h])
14186 AC_CONFIG_HEADERS([config_host/config_dconf.h])
14187 AC_CONFIG_HEADERS([config_host/config_eot.h])
14188 AC_CONFIG_HEADERS([config_host/config_extensions.h])
14189 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
14190 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
14191 AC_CONFIG_HEADERS([config_host/config_dbus.h])
14192 AC_CONFIG_HEADERS([config_host/config_features.h])
14193 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
14194 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
14195 AC_CONFIG_HEADERS([config_host/config_firebird.h])
14196 AC_CONFIG_HEADERS([config_host/config_folders.h])
14197 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
14198 AC_CONFIG_HEADERS([config_host/config_gio.h])
14199 AC_CONFIG_HEADERS([config_host/config_global.h])
14200 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
14201 AC_CONFIG_HEADERS([config_host/config_java.h])
14202 AC_CONFIG_HEADERS([config_host/config_langs.h])
14203 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
14204 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
14205 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
14206 AC_CONFIG_HEADERS([config_host/config_locales.h])
14207 AC_CONFIG_HEADERS([config_host/config_mpl.h])
14208 AC_CONFIG_HEADERS([config_host/config_oox.h])
14209 AC_CONFIG_HEADERS([config_host/config_options.h])
14210 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
14211 AC_CONFIG_HEADERS([config_host/config_qrcodegen.h])
14212 AC_CONFIG_HEADERS([config_host/config_skia.h])
14213 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
14214 AC_CONFIG_HEADERS([config_host/config_vendor.h])
14215 AC_CONFIG_HEADERS([config_host/config_vcl.h])
14216 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
14217 AC_CONFIG_HEADERS([config_host/config_version.h])
14218 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
14219 AC_CONFIG_HEADERS([config_host/config_poppler.h])
14220 AC_CONFIG_HEADERS([config_host/config_python.h])
14221 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
14222 AC_OUTPUT
14224 if test "$CROSS_COMPILING" = TRUE; then
14225     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
14228 # touch the config timestamp file
14229 if test ! -f config_host.mk.stamp; then
14230     echo > config_host.mk.stamp
14231 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
14232     echo "Host Configuration unchanged - avoiding scp2 stamp update"
14233 else
14234     echo > config_host.mk.stamp
14237 # touch the config lang timestamp file
14238 if test ! -f config_host_lang.mk.stamp; then
14239     echo > config_host_lang.mk.stamp
14240 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
14241     echo "Language Configuration unchanged - avoiding scp2 stamp update"
14242 else
14243     echo > config_host_lang.mk.stamp
14247 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
14248         -a "$build_os" = "cygwin"; then
14250 cat << _EOS
14251 ****************************************************************************
14252 WARNING:
14253 Your make version is known to be horribly slow, and hard to debug
14254 problems with. To get a reasonably functional make please do:
14256 to install a pre-compiled binary make for Win32
14258  mkdir -p /opt/lo/bin
14259  cd /opt/lo/bin
14260  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
14261  cp make-4.2.1-msvc.exe make
14262  chmod +x make
14264 to install from source:
14265 place yourself in a working directory of you choice.
14267  git clone git://git.savannah.gnu.org/make.git
14269  [go to Start menu, open "Visual Studio 2019", click "x86 Native Tools Command Prompt" or "x64 Native Tools Command Prompt"]
14270  set PATH=%PATH%;C:\Cygwin\bin
14271  [or Cygwin64, if that is what you have]
14272  cd path-to-make-repo-you-cloned-above
14273  build_w32.bat --without-guile
14275 should result in a WinRel/gnumake.exe.
14276 Copy it to the Cygwin /opt/lo/bin directory as make.exe
14278 Then re-run autogen.sh
14280 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
14281 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
14283 _EOS
14284 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
14285     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
14290 cat << _EOF
14291 ****************************************************************************
14293 To build, run:
14294 $GNUMAKE
14296 To view some help, run:
14297 $GNUMAKE help
14299 _EOF
14301 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
14302     cat << _EOF
14303 After the build has finished successfully, you can immediately run what you built using the command:
14304 _EOF
14306     if test $_os = Darwin; then
14307         echo open instdir/$PRODUCTNAME_WITHOUT_SPACES.app
14308     else
14309         echo instdir/program/soffice
14310     fi
14311     cat << _EOF
14313 If you want to run the smoketest, run:
14314 $GNUMAKE check
14316 _EOF
14319 if test -f warn; then
14320     cat warn
14321     rm warn
14324 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: