OInterfaceContainerHelper3 needs to be thread-safe
[LibreOffice.git] / configure.ac
blobaa4b3c62157e14484f928f0a49d5b37daea28660
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.9.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 AC_MSG_CHECKING([for GNU or BSD tar])
2818 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2819     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2820     if test $? -eq 0;  then
2821         GNUTAR=$a
2822         break
2823     fi
2824 done
2825 AC_MSG_RESULT($GNUTAR)
2826 if test -z "$GNUTAR"; then
2827     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2829 AC_SUBST(GNUTAR)
2831 AC_MSG_CHECKING([for tar's option to strip components])
2832 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2833 if test $? -eq 0; then
2834     STRIP_COMPONENTS="--strip-components"
2835 else
2836     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2837     if test $? -eq 0; then
2838         STRIP_COMPONENTS="--strip-path"
2839     else
2840         STRIP_COMPONENTS="unsupported"
2841     fi
2843 AC_MSG_RESULT($STRIP_COMPONENTS)
2844 if test x$STRIP_COMPONENTS = xunsupported; then
2845     AC_MSG_ERROR([you need a tar that is able to strip components.])
2847 AC_SUBST(STRIP_COMPONENTS)
2849 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2850 dnl desktop OSes from "mobile" ones.
2852 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2853 dnl In other words, that when building for an OS that is not a
2854 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2856 dnl Note the direction of the implication; there is no assumption that
2857 dnl cross-compiling would imply a non-desktop OS.
2859 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2860     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2861     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2862     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2865 # Whether to build "avmedia" functionality or not.
2867 if test -z "$enable_avmedia"; then
2868     enable_avmedia=yes
2871 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2872 if test "$enable_avmedia" = yes; then
2873     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2874 else
2875     USE_AVMEDIA_DUMMY='TRUE'
2877 AC_SUBST(USE_AVMEDIA_DUMMY)
2879 # Decide whether to build database connectivity stuff (including
2880 # Base) or not. We probably don't want to on non-desktop OSes.
2881 if test -z "$enable_database_connectivity"; then
2882     # --disable-database-connectivity is unfinished work in progress
2883     # and the iOS test app doesn't link if we actually try to use it.
2884     # if test $_os != iOS -a $_os != Android; then
2885     if test $_os != iOS; then
2886         enable_database_connectivity=yes
2887     fi
2890 if test "$enable_database_connectivity" = yes; then
2891     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2892     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2895 if test -z "$enable_extensions"; then
2896     # For iOS and Android Viewer, disable extensions unless specifically overridden with --enable-extensions.
2897     if test $_os != iOS && test $_os != Android -o "$ENABLE_ANDROID_LOK" = TRUE ; then
2898         enable_extensions=yes
2899     fi
2902 if test "$enable_extensions" = yes; then
2903     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2904     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2907 if test -z "$enable_scripting"; then
2908     enable_scripting=yes
2911 DISABLE_SCRIPTING=''
2912 if test "$enable_scripting" = yes; then
2913     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2914     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2915 else
2916     DISABLE_SCRIPTING='TRUE'
2917     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2920 if test $_os = iOS -o $_os = Android; then
2921     # Disable dynamic_loading always for iOS and Android
2922     enable_dynamic_loading=no
2923 elif test -z "$enable_dynamic_loading"; then
2924     # Otherwise enable it unless specifically disabled
2925     enable_dynamic_loading=yes
2928 DISABLE_DYNLOADING=''
2929 if test "$enable_dynamic_loading" = yes; then
2930     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2931 else
2932     DISABLE_DYNLOADING='TRUE'
2934 AC_SUBST(DISABLE_DYNLOADING)
2936 # remember SYSBASE value
2937 AC_SUBST(SYSBASE)
2939 dnl ===================================================================
2940 dnl  Sort out various gallery compilation options
2941 dnl ===================================================================
2942 AC_MSG_CHECKING([how to build and package galleries])
2943 if test -n "${with_galleries}"; then
2944     if test "$with_galleries" = "build"; then
2945         WITH_GALLERY_BUILD=TRUE
2946         AC_MSG_RESULT([build from source images internally])
2947     elif test "$with_galleries" = "no"; then
2948         WITH_GALLERY_BUILD=
2949         AC_MSG_RESULT([disable non-internal gallery build])
2950     else
2951         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2952     fi
2953 else
2954     if test $_os != iOS -a $_os != Android; then
2955         WITH_GALLERY_BUILD=TRUE
2956         AC_MSG_RESULT([internal src images for desktop])
2957     else
2958         WITH_GALLERY_BUILD=
2959         AC_MSG_RESULT([disable src image build])
2960     fi
2962 AC_SUBST(WITH_GALLERY_BUILD)
2964 dnl ===================================================================
2965 dnl  Checks if ccache is available
2966 dnl ===================================================================
2967 CCACHE_DEPEND_MODE=
2968 if test "$_os" = "WINNT"; then
2969     # on windows/VC build do not use ccache
2970     CCACHE=""
2971 elif test "$enable_ccache" = "no"; then
2972     CCACHE=""
2973 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2974     case "%$CC%$CXX%" in
2975     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2976     # assume that's good then
2977     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2978         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2979         CCACHE_DEPEND_MODE=1
2980         ;;
2981     *)
2982         AC_PATH_PROG([CCACHE],[ccache],[not found])
2983         if test "$CCACHE" = "not found"; then
2984             CCACHE=""
2985         else
2986             CCACHE_DEPEND_MODE=1
2987             # Need to check for ccache version: otherwise prevents
2988             # caching of the results (like "-x objective-c++" for Mac)
2989             if test $_os = Darwin -o $_os = iOS; then
2990                 # Check ccache version
2991                 AC_MSG_CHECKING([whether version of ccache is suitable])
2992                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2993                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2994                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2995                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2996                 else
2997                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2998                     CCACHE=""
2999                     CCACHE_DEPEND_MODE=
3000                 fi
3001             fi
3002         fi
3003         ;;
3004     esac
3005 else
3006     CCACHE=""
3008 if test "$enable_ccache" = "nodepend"; then
3009     CCACHE_DEPEND_MODE=""
3011 AC_SUBST(CCACHE_DEPEND_MODE)
3013 if test "$CCACHE" != ""; then
3014     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
3015     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
3016     if test "$ccache_size" = ""; then
3017         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
3018         if test "$ccache_size" = ""; then
3019             ccache_size=0
3020         fi
3021         # we could not determine the size or it was less than 1GB -> disable auto-ccache
3022         if test $ccache_size -lt 1024; then
3023             CCACHE=""
3024             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
3025             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
3026         else
3027             # warn that ccache may be too small for debug build
3028             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3029             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3030         fi
3031     else
3032         if test $ccache_size -lt 5; then
3033             #warn that ccache may be too small for debug build
3034             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3035             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3036         fi
3037     fi
3040 dnl ===================================================================
3041 dnl  Checks for C compiler,
3042 dnl  The check for the C++ compiler is later on.
3043 dnl ===================================================================
3044 if test "$_os" != "WINNT"; then
3045     GCC_HOME_SET="true"
3046     AC_MSG_CHECKING([gcc home])
3047     if test -z "$with_gcc_home"; then
3048         if test "$enable_icecream" = "yes"; then
3049             if test -d "/usr/lib/icecc/bin"; then
3050                 GCC_HOME="/usr/lib/icecc/"
3051             elif test -d "/usr/libexec/icecc/bin"; then
3052                 GCC_HOME="/usr/libexec/icecc/"
3053             elif test -d "/opt/icecream/bin"; then
3054                 GCC_HOME="/opt/icecream/"
3055             else
3056                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
3058             fi
3059         else
3060             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
3061             GCC_HOME_SET="false"
3062         fi
3063     else
3064         GCC_HOME="$with_gcc_home"
3065     fi
3066     AC_MSG_RESULT($GCC_HOME)
3067     AC_SUBST(GCC_HOME)
3069     if test "$GCC_HOME_SET" = "true"; then
3070         if test -z "$CC"; then
3071             CC="$GCC_HOME/bin/gcc"
3072             CC_BASE="gcc"
3073         fi
3074         if test -z "$CXX"; then
3075             CXX="$GCC_HOME/bin/g++"
3076             CXX_BASE="g++"
3077         fi
3078     fi
3081 COMPATH=`dirname "$CC"`
3082 if test "$COMPATH" = "."; then
3083     AC_PATH_PROGS(COMPATH, $CC)
3084     dnl double square bracket to get single because of M4 quote...
3085     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
3087 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
3089 dnl ===================================================================
3090 dnl Java support
3091 dnl ===================================================================
3092 AC_MSG_CHECKING([whether to build with Java support])
3093 if test "$with_java" != "no"; then
3094     if test "$DISABLE_SCRIPTING" = TRUE; then
3095         AC_MSG_RESULT([no, overridden by --disable-scripting])
3096         ENABLE_JAVA=""
3097         with_java=no
3098     else
3099         AC_MSG_RESULT([yes])
3100         ENABLE_JAVA="TRUE"
3101         AC_DEFINE(HAVE_FEATURE_JAVA)
3102     fi
3103 else
3104     AC_MSG_RESULT([no])
3105     ENABLE_JAVA=""
3108 AC_SUBST(ENABLE_JAVA)
3110 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
3112 dnl ENABLE_JAVA="" indicate no Java support at all
3114 dnl ===================================================================
3115 dnl Check macOS SDK and compiler
3116 dnl ===================================================================
3118 if test $_os = Darwin; then
3120     # If no --with-macosx-sdk option is given, look for one
3122     # The intent is that for "most" Mac-based developers, a suitable
3123     # SDK will be found automatically without any configure options.
3125     # For developers with a current Xcode, the lowest-numbered SDK
3126     # higher than or equal to the minimum required should be found.
3128     AC_MSG_CHECKING([what macOS SDK to use])
3129     for _macosx_sdk in ${with_macosx_sdk-12.0 11.3 11.1 11.0 10.15 10.14 10.13}; do
3130         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
3131         if test -d "$MACOSX_SDK_PATH"; then
3132             with_macosx_sdk="${_macosx_sdk}"
3133             break
3134         else
3135             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
3136             if test -d "$MACOSX_SDK_PATH"; then
3137                 with_macosx_sdk="${_macosx_sdk}"
3138                 break
3139             fi
3140         fi
3141     done
3142     if test ! -d "$MACOSX_SDK_PATH"; then
3143         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
3144     fi
3146     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
3148     case $with_macosx_sdk in
3149     10.13)
3150         MACOSX_SDK_VERSION=101300
3151         ;;
3152     10.14)
3153         MACOSX_SDK_VERSION=101400
3154         ;;
3155     10.15)
3156         MACOSX_SDK_VERSION=101500
3157         ;;
3158     11.0)
3159         MACOSX_SDK_VERSION=110000
3160         ;;
3161     11.1)
3162         MACOSX_SDK_VERSION=110100
3163         ;;
3164     11.3)
3165         MACOSX_SDK_VERSION=110300
3166         ;;
3167     12.0)
3168         MACOSX_SDK_VERSION=120000
3169         ;;
3170     *)
3171         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.13--12.0])
3172         ;;
3173     esac
3175     if test "$host_cpu" = arm64 -a $MACOSX_SDK_VERSION -lt 110000; then
3176         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value for Apple Silicon])
3177     fi
3179     if test "$with_macosx_version_min_required" = "" ; then
3180         if test "$host_cpu" = x86_64; then
3181             with_macosx_version_min_required="10.10";
3182         else
3183             with_macosx_version_min_required="11.0";
3184         fi
3185     fi
3187     if test "$with_macosx_version_max_allowed" = "" ; then
3188         with_macosx_version_max_allowed="$with_macosx_sdk"
3189     fi
3191     # export this so that "xcrun" invocations later return matching values
3192     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
3193     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
3194     export DEVELOPER_DIR
3195     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
3196     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
3198     AC_MSG_CHECKING([whether Xcode is new enough])
3199     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
3200     my_xcode_ver2=${my_xcode_ver1#Xcode }
3201     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
3202     if test "$my_xcode_ver3" -ge 1103; then
3203         AC_MSG_RESULT([yes ($my_xcode_ver2)])
3204     else
3205         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 11.3])
3206     fi
3208     case "$with_macosx_version_min_required" in
3209     10.10)
3210         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
3211         ;;
3212     10.11)
3213         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
3214         ;;
3215     10.12)
3216         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
3217         ;;
3218     10.13)
3219         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
3220         ;;
3221     10.14)
3222         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
3223         ;;
3224     10.15)
3225         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
3226         ;;
3227     10.16)
3228         MAC_OS_X_VERSION_MIN_REQUIRED="101600"
3229         ;;
3230     11.0)
3231         MAC_OS_X_VERSION_MIN_REQUIRED="110000"
3232         ;;
3233     11.1)
3234         MAC_OS_X_VERSION_MIN_REQUIRED="110100"
3235         ;;
3236     11.3)
3237         MAC_OS_X_VERSION_MIN_REQUIRED="110300"
3238         ;;
3239     12.0)
3240         MAC_OS_X_VERSION_MIN_REQUIRED="120000"
3241         ;;
3242     *)
3243         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--12.0])
3244         ;;
3245     esac
3247     LIBTOOL=/usr/bin/libtool
3248     INSTALL_NAME_TOOL=install_name_tool
3249     if test -z "$save_CC"; then
3250         stdlib=-stdlib=libc++
3252         AC_MSG_CHECKING([what C compiler to use])
3253         CC="`xcrun -find clang`"
3254         CC_BASE=`first_arg_basename "$CC"`
3255         if test "$host_cpu" = x86_64; then
3256             CC+=" -target x86_64-apple-macos"
3257         else
3258             CC+=" -target arm64-apple-macos"
3259         fi
3260         CC+=" -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3261         AC_MSG_RESULT([$CC])
3263         AC_MSG_CHECKING([what C++ compiler to use])
3264         CXX="`xcrun -find clang++`"
3265         CXX_BASE=`first_arg_basename "$CXX"`
3266         if test "$host_cpu" = x86_64; then
3267             CXX+=" -target x86_64-apple-macos"
3268         else
3269             CXX+=" -target arm64-apple-macos"
3270         fi
3271         CXX+=" $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3272         AC_MSG_RESULT([$CXX])
3274         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3275         AR=`xcrun -find ar`
3276         NM=`xcrun -find nm`
3277         STRIP=`xcrun -find strip`
3278         LIBTOOL=`xcrun -find libtool`
3279         RANLIB=`xcrun -find ranlib`
3280     fi
3282     case "$with_macosx_version_max_allowed" in
3283     10.10)
3284         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
3285         ;;
3286     10.11)
3287         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
3288         ;;
3289     10.12)
3290         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
3291         ;;
3292     10.13)
3293         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
3294         ;;
3295     10.14)
3296         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
3297         ;;
3298     10.15)
3299         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
3300         ;;
3301     11.0)
3302         MAC_OS_X_VERSION_MAX_ALLOWED="110000"
3303         ;;
3304     11.1)
3305         MAC_OS_X_VERSION_MAX_ALLOWED="110100"
3306         ;;
3307     11.3)
3308         MAC_OS_X_VERSION_MAX_ALLOWED="110300"
3309         ;;
3310     12.0)
3311         MAC_OS_X_VERSION_MAX_ALLOWED="120000"
3312         ;;
3313     *)
3314         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--12.0])
3315         ;;
3316     esac
3318     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
3319     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
3320         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])
3321     else
3322         AC_MSG_RESULT([ok])
3323     fi
3325     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
3326     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
3327         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
3328     else
3329         AC_MSG_RESULT([ok])
3330     fi
3331     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
3332     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
3334     AC_MSG_CHECKING([whether to do code signing])
3336     if test "$enable_macosx_code_signing" = yes; then
3337         # By default use the first suitable certificate (?).
3339         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
3340         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
3341         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
3342         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
3343         # "Developer ID Application" one.
3345         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
3346         if test -n "$identity"; then
3347             MACOSX_CODESIGNING_IDENTITY=$identity
3348             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3349             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3350         else
3351             AC_MSG_ERROR([cannot determine identity to use])
3352         fi
3353     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
3354         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
3355         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3356         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3357     else
3358         AC_MSG_RESULT([no])
3359     fi
3361     AC_MSG_CHECKING([whether to create a Mac App Store package])
3363     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
3364         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3365     elif test "$enable_macosx_package_signing" = yes; then
3366         # By default use the first suitable certificate.
3367         # It should be a "3rd Party Mac Developer Installer" one
3369         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
3370         if test -n "$identity"; then
3371             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3372             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3373             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3374         else
3375             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3376         fi
3377     elif test -n "$enable_macosx_package_signing"; then
3378         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
3379         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3380         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3381     else
3382         AC_MSG_RESULT([no])
3383     fi
3385     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3386         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3387     fi
3389     AC_MSG_CHECKING([whether to sandbox the application])
3391     if test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3392         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3393     elif test "$enable_macosx_sandbox" = yes; then
3394         ENABLE_MACOSX_SANDBOX=TRUE
3395         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3396         AC_MSG_RESULT([yes])
3397     else
3398         AC_MSG_RESULT([no])
3399     fi
3401     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3402     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3403     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3405 AC_SUBST(MACOSX_SDK_PATH)
3406 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3407 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3408 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3409 AC_SUBST(INSTALL_NAME_TOOL)
3410 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3411 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3412 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3413 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3414 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3416 dnl ===================================================================
3417 dnl Check iOS SDK and compiler
3418 dnl ===================================================================
3420 if test $_os = iOS; then
3421     AC_MSG_CHECKING([what iOS SDK to use])
3422     current_sdk_ver=15.0
3423     older_sdk_vers="14.5 14.0"
3424     if test "$enable_ios_simulator" = "yes"; then
3425         platform=iPhoneSimulator
3426         versionmin=-mios-simulator-version-min=12.2
3427     else
3428         platform=iPhoneOS
3429         versionmin=-miphoneos-version-min=12.2
3430     fi
3431     xcode_developer=`xcode-select -print-path`
3433     for sdkver in $current_sdk_ver $older_sdk_vers; do
3434         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3435         if test -d $t; then
3436             sysroot=$t
3437             break
3438         fi
3439     done
3441     if test -z "$sysroot"; then
3442         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3443     fi
3445     AC_MSG_RESULT($sysroot)
3447     stdlib="-stdlib=libc++"
3449     AC_MSG_CHECKING([what C compiler to use])
3450     CC="`xcrun -find clang`"
3451     CC_BASE=`first_arg_basename "$CC"`
3452     CC+=" -arch $host_cpu_for_clang -isysroot $sysroot $versionmin"
3453     AC_MSG_RESULT([$CC])
3455     AC_MSG_CHECKING([what C++ compiler to use])
3456     CXX="`xcrun -find clang++`"
3457     CXX_BASE=`first_arg_basename "$CXX"`
3458     CXX+=" -arch $host_cpu_for_clang $stdlib -isysroot $sysroot $versionmin"
3459     AC_MSG_RESULT([$CXX])
3461     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3462     AR=`xcrun -find ar`
3463     NM=`xcrun -find nm`
3464     STRIP=`xcrun -find strip`
3465     LIBTOOL=`xcrun -find libtool`
3466     RANLIB=`xcrun -find ranlib`
3469 AC_MSG_CHECKING([whether to treat the installation as read-only])
3471 if test $_os = Darwin; then
3472     enable_readonly_installset=yes
3473 elif test "$enable_extensions" != yes; then
3474     enable_readonly_installset=yes
3476 if test "$enable_readonly_installset" = yes; then
3477     AC_MSG_RESULT([yes])
3478     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3479 else
3480     AC_MSG_RESULT([no])
3483 dnl ===================================================================
3484 dnl Structure of install set
3485 dnl ===================================================================
3487 if test $_os = Darwin; then
3488     LIBO_BIN_FOLDER=MacOS
3489     LIBO_ETC_FOLDER=Resources
3490     LIBO_LIBEXEC_FOLDER=MacOS
3491     LIBO_LIB_FOLDER=Frameworks
3492     LIBO_LIB_PYUNO_FOLDER=Resources
3493     LIBO_SHARE_FOLDER=Resources
3494     LIBO_SHARE_HELP_FOLDER=Resources/help
3495     LIBO_SHARE_JAVA_FOLDER=Resources/java
3496     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3497     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3498     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3499     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3500     LIBO_URE_BIN_FOLDER=MacOS
3501     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3502     LIBO_URE_LIB_FOLDER=Frameworks
3503     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3504     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3505 elif test $_os = WINNT; then
3506     LIBO_BIN_FOLDER=program
3507     LIBO_ETC_FOLDER=program
3508     LIBO_LIBEXEC_FOLDER=program
3509     LIBO_LIB_FOLDER=program
3510     LIBO_LIB_PYUNO_FOLDER=program
3511     LIBO_SHARE_FOLDER=share
3512     LIBO_SHARE_HELP_FOLDER=help
3513     LIBO_SHARE_JAVA_FOLDER=program/classes
3514     LIBO_SHARE_PRESETS_FOLDER=presets
3515     LIBO_SHARE_READMES_FOLDER=readmes
3516     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3517     LIBO_SHARE_SHELL_FOLDER=program/shell
3518     LIBO_URE_BIN_FOLDER=program
3519     LIBO_URE_ETC_FOLDER=program
3520     LIBO_URE_LIB_FOLDER=program
3521     LIBO_URE_MISC_FOLDER=program
3522     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3523 else
3524     LIBO_BIN_FOLDER=program
3525     LIBO_ETC_FOLDER=program
3526     LIBO_LIBEXEC_FOLDER=program
3527     LIBO_LIB_FOLDER=program
3528     LIBO_LIB_PYUNO_FOLDER=program
3529     LIBO_SHARE_FOLDER=share
3530     LIBO_SHARE_HELP_FOLDER=help
3531     LIBO_SHARE_JAVA_FOLDER=program/classes
3532     LIBO_SHARE_PRESETS_FOLDER=presets
3533     LIBO_SHARE_READMES_FOLDER=readmes
3534     if test "$enable_fuzzers" != yes; then
3535         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3536     else
3537         LIBO_SHARE_RESOURCE_FOLDER=resource
3538     fi
3539     LIBO_SHARE_SHELL_FOLDER=program/shell
3540     LIBO_URE_BIN_FOLDER=program
3541     LIBO_URE_ETC_FOLDER=program
3542     LIBO_URE_LIB_FOLDER=program
3543     LIBO_URE_MISC_FOLDER=program
3544     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3546 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3547 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3548 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3549 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3550 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3551 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3552 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3553 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3554 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3555 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3556 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3557 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3558 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3559 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3560 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3561 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3563 # Not all of them needed in config_host.mk, add more if need arises
3564 AC_SUBST(LIBO_BIN_FOLDER)
3565 AC_SUBST(LIBO_ETC_FOLDER)
3566 AC_SUBST(LIBO_LIB_FOLDER)
3567 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3568 AC_SUBST(LIBO_SHARE_FOLDER)
3569 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3570 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3571 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3572 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3573 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3574 AC_SUBST(LIBO_URE_BIN_FOLDER)
3575 AC_SUBST(LIBO_URE_ETC_FOLDER)
3576 AC_SUBST(LIBO_URE_LIB_FOLDER)
3577 AC_SUBST(LIBO_URE_MISC_FOLDER)
3578 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3580 dnl ===================================================================
3581 dnl Windows specific tests and stuff
3582 dnl ===================================================================
3584 reg_get_value()
3586     # Return value: $regvalue
3587     unset regvalue
3589     if test "$build_os" = "wsl"; then
3590         regvalue=$($BUILDDIR/solenv/wsl/wsl-lo-helper.exe --read-registry $1 "$2" 2>/dev/null)
3591         return
3592     fi
3594     local _regentry="/proc/registry${1}/${2}"
3595     if test -f "$_regentry"; then
3596         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3597         # Registry keys read via /proc/registry* are always \0 terminated!
3598         local _regvalue=$(tr -d '\0' < "$_regentry")
3599         if test $? -eq 0; then
3600             regvalue=$_regvalue
3601         fi
3602     fi
3605 # Get a value from the 32-bit side of the Registry
3606 reg_get_value_32()
3608     reg_get_value "32" "$1"
3611 # Get a value from the 64-bit side of the Registry
3612 reg_get_value_64()
3614     reg_get_value "64" "$1"
3617 case "$host_os" in
3618 cygwin*|wsl*)
3619     COM=MSC
3620     USING_X11=
3621     OS=WNT
3622     RTL_OS=Windows
3623     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3624         P_SEP=";"
3625     else
3626         P_SEP=:
3627     fi
3628     case "$host_cpu" in
3629     x86_64)
3630         CPUNAME=X86_64
3631         RTL_ARCH=X86_64
3632         PLATFORMID=windows_x86_64
3633         WINDOWS_X64=1
3634         SCPDEFS="$SCPDEFS -DWINDOWS_X64"
3635         WIN_HOST_ARCH="x64"
3636         WIN_MULTI_ARCH="x86"
3637         WIN_HOST_BITS=64
3638         ;;
3639     i*86)
3640         CPUNAME=INTEL
3641         RTL_ARCH=x86
3642         PLATFORMID=windows_x86
3643         WIN_HOST_ARCH="x86"
3644         WIN_HOST_BITS=32
3645         WIN_OTHER_ARCH="x64"
3646         ;;
3647     aarch64)
3648         CPUNAME=ARM64
3649         RTL_ARCH=arm64
3650         PLATFORMID=windows_arm64
3651         WINDOWS_X64=1
3652         SCPDEFS="$SCPDEFS -DWINDOWS_ARM64"
3653         WIN_HOST_ARCH="arm64"
3654         WIN_HOST_BITS=64
3655         with_ucrt_dir=no
3656         ;;
3657     *)
3658         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3659         ;;
3660     esac
3662     case "$build_cpu" in
3663     x86_64) WIN_BUILD_ARCH="x64" ;;
3664     i*86) WIN_BUILD_ARCH="x86" ;;
3665     aarch64) WIN_BUILD_ARCH="arm64" ;;
3666     *)
3667         AC_MSG_ERROR([Unsupported build_cpu $build_cpu for host_os $host_os])
3668         ;;
3669     esac
3671     SCPDEFS="$SCPDEFS -D_MSC_VER"
3672     AC_SUBST(WIN_HOST_ARCH)
3673     ;;
3674 esac
3676 # multi-arch is an arch, which can execute on the host (x86 on x64), while
3677 # other-arch won't, but wouldn't break the build (x64 on x86).
3678 if test -n "$WIN_MULTI_ARCH" -a -n "$WIN_OTHER_ARCH"; then
3679     AC_MSG_ERROR([Broken configure.ac file: can't have set \$WIN_MULTI_ARCH and $WIN_OTHER_ARCH])
3683 if test "$_os" = "iOS" -o "$build_cpu" != "$host_cpu"; then
3684     # To allow building Windows multi-arch releases without cross-tooling
3685     if test -z "$WIN_MULTI_ARCH" -a -z "$WIN_OTHER_ARCH"; then
3686         cross_compiling="yes"
3687     fi
3689 if test "$cross_compiling" = "yes"; then
3690     export CROSS_COMPILING=TRUE
3691 else
3692     CROSS_COMPILING=
3693     BUILD_TYPE="$BUILD_TYPE NATIVE"
3695 AC_SUBST(CROSS_COMPILING)
3697 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3698 # NOTE: must _not_ be used for bundled external libraries!
3699 ISYSTEM=
3700 if test "$GCC" = "yes"; then
3701     AC_MSG_CHECKING( for -isystem )
3702     save_CFLAGS=$CFLAGS
3703     CFLAGS="$CFLAGS -Werror"
3704     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3705     CFLAGS=$save_CFLAGS
3706     if test -n "$ISYSTEM"; then
3707         AC_MSG_RESULT(yes)
3708     else
3709         AC_MSG_RESULT(no)
3710     fi
3712 if test -z "$ISYSTEM"; then
3713     # fall back to using -I
3714     ISYSTEM=-I
3716 AC_SUBST(ISYSTEM)
3718 dnl ===================================================================
3719 dnl  Check which Visual Studio compiler is used
3720 dnl ===================================================================
3722 map_vs_year_to_version()
3724     # Return value: $vsversion
3726     unset vsversion
3728     case $1 in
3729     2019)
3730         vsversion=16;;
3731     *)
3732         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3733     esac
3736 vs_versions_to_check()
3738     # Args: $1 (optional) : versions to check, in the order of preference
3739     # Return value: $vsversions
3741     unset vsversions
3743     if test -n "$1"; then
3744         map_vs_year_to_version "$1"
3745         vsversions=$vsversion
3746     else
3747         # We accept only 2019
3748         vsversions="16"
3749     fi
3752 win_get_env_from_vsvars32bat()
3754     local WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3755     # Also seems to be located in another directory under the same name: vsvars32.bat
3756     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3757     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3758     # use 'echo.%ENV%' syntax (instead of 'echo %ENV%') to avoid outputting "ECHO is off." in case when ENV is empty or a space
3759     printf '@setlocal\r\n@echo.%%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3760     local result
3761     if test "$build_os" = "wsl"; then
3762         result=$(cd /mnt/c && cmd.exe /c $(wslpath -w $WRAPPERBATCHFILEPATH) | tr -d '\r')
3763     else
3764         chmod +x $WRAPPERBATCHFILEPATH
3765         result=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3766     fi
3767     rm -f $WRAPPERBATCHFILEPATH
3768     printf '%s' "$result"
3771 find_ucrt()
3773     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3774     if test -n "$regvalue"; then
3775         PathFormat "$regvalue"
3776         UCRTSDKDIR=$formatted_path_unix
3777         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3778         UCRTVERSION=$regvalue
3779         # Rest if not exist
3780         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3781           UCRTSDKDIR=
3782         fi
3783     fi
3784     if test -z "$UCRTSDKDIR"; then
3785         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3786         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3787         if test -f "$ide_env_file"; then
3788             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3789             UCRTSDKDIR=$formatted_path
3790             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3791             dnl Hack needed at least by tml:
3792             if test "$UCRTVERSION" = 10.0.15063.0 \
3793                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3794                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3795             then
3796                 UCRTVERSION=10.0.14393.0
3797             fi
3798         else
3799           AC_MSG_ERROR([No UCRT found])
3800         fi
3801     fi
3804 find_msvc()
3806     # Find Visual C++ 2019
3807     # Args: $1 (optional) : The VS version year
3808     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3810     unset vctest vcnum vcnumwithdot vcbuildnumber
3812     vs_versions_to_check "$1"
3813     if test "$build_os" = wsl; then
3814         vswhere="$PROGRAMFILESX86"
3815     else
3816         vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3817     fi
3818     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3819     PathFormat "$vswhere"
3820     vswhere=$formatted_path_unix
3821     for ver in $vsversions; do
3822         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3823         # Fall back to all MS products (this includes VC++ Build Tools)
3824         if ! test -n "$vswhereoutput"; then
3825             AC_MSG_CHECKING([VC++ Build Tools and similar])
3826             vswhereoutput=`$vswhere -products \* -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3827         fi
3828         if test -n "$vswhereoutput"; then
3829             PathFormat "$vswhereoutput"
3830             vctest=$formatted_path_unix
3831             break
3832         fi
3833     done
3835     if test -n "$vctest"; then
3836         vcnumwithdot="$ver.0"
3837         case "$vcnumwithdot" in
3838         16.0)
3839             vcyear=2019
3840             vcnum=160
3841             ;;
3842         esac
3843         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3845     fi
3848 test_cl_exe()
3850     AC_MSG_CHECKING([$1 compiler])
3852     CL_EXE_PATH="$2/cl.exe"
3854     if test ! -f "$CL_EXE_PATH"; then
3855         if test "$1" = "multi-arch"; then
3856             AC_MSG_WARN([no compiler (cl.exe) in $2])
3857             return 1
3858         else
3859             AC_MSG_ERROR([no compiler (cl.exe) in $2])
3860         fi
3861     fi
3863     dnl ===========================================================
3864     dnl  Check for the corresponding mspdb*.dll
3865     dnl ===========================================================
3867     # MSVC 15.0 has libraries from 14.0?
3868     mspdbnum="140"
3870     if test ! -e "$2/mspdb${mspdbnum}.dll"; then
3871         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $2, Visual Studio installation broken?])
3872     fi
3874     # The compiles has to find its shared libraries
3875     OLD_PATH="$PATH"
3876     TEMP_PATH=`cygpath -d "$2"`
3877     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3879     if ! "$CL_EXE_PATH" -? </dev/null >/dev/null 2>&1; then
3880         AC_MSG_ERROR([no compiler (cl.exe) in $2])
3881     fi
3883     PATH="$OLD_PATH"
3885     AC_MSG_RESULT([$CL_EXE_PATH])
3888 SOLARINC=
3889 MSBUILD_PATH=
3890 DEVENV=
3891 if test "$_os" = "WINNT"; then
3892     AC_MSG_CHECKING([Visual C++])
3893     find_msvc "$with_visual_studio"
3894     if test -z "$vctest"; then
3895         if test -n "$with_visual_studio"; then
3896             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
3897         else
3898             AC_MSG_ERROR([no Visual Studio 2019 installation found])
3899         fi
3900     fi
3901     AC_MSG_RESULT([])
3903     VC_PRODUCT_DIR="$vctest/VC"
3904     COMPATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber"
3906     # $WIN_OTHER_ARCH is a hack to test the x64 compiler on x86, even if it's not multi-arch
3907     if test -n "$WIN_MULTI_ARCH" -o -n "$WIN_OTHER_ARCH"; then
3908         MSVC_MULTI_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/${WIN_MULTI_ARCH}${WIN_OTHER_ARCH}"
3909         test_cl_exe "multi-arch" "$MSVC_MULTI_PATH"
3910         if test $? -ne 0; then
3911             WIN_MULTI_ARCH=""
3912             WIN_OTHER_ARCH=""
3913         fi
3914     fi
3916     if test "$WIN_BUILD_ARCH" = "$WIN_HOST_ARCH"; then
3917         MSVC_BUILD_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_BUILD_ARCH"
3918         test_cl_exe "build" "$MSVC_BUILD_PATH"
3919     fi
3921     if test "$WIN_BUILD_ARCH" != "$WIN_HOST_ARCH"; then
3922         MSVC_HOST_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_HOST_ARCH"
3923         test_cl_exe "host" "$MSVC_HOST_PATH"
3924     else
3925         MSVC_HOST_PATH="$MSVC_BUILD_PATH"
3926     fi
3928     AC_MSG_CHECKING([for short pathname of VC product directory])
3929     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3930     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3932     UCRTSDKDIR=
3933     UCRTVERSION=
3935     AC_MSG_CHECKING([for UCRT location])
3936     find_ucrt
3937     # find_ucrt errors out if it doesn't find it
3938     AC_MSG_RESULT([$UCRTSDKDIR ($UCRTVERSION)])
3939     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3940     ucrtincpath_formatted=$formatted_path
3941     # SOLARINC is used for external modules and must be set too.
3942     # And no, it's not sufficient to set SOLARINC only, as configure
3943     # itself doesn't honour it.
3944     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3945     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3946     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3947     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3949     AC_SUBST(UCRTSDKDIR)
3950     AC_SUBST(UCRTVERSION)
3952     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3953     # Find the proper version of MSBuild.exe to use based on the VS version
3954     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3955     if test -n "$regvalue" ; then
3956         AC_MSG_RESULT([found: $regvalue])
3957         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3958     else
3959         if test "$vcnumwithdot" = "16.0"; then
3960             if test "$WIN_BUILD_ARCH" != "x64"; then
3961                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3962             else
3963                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3964             fi
3965         else
3966             if test "$WIN_BUILD_ARCH" != "x64"; then
3967                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3968             else
3969                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3970             fi
3971         fi
3972         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3973         AC_MSG_RESULT([$regvalue])
3974     fi
3976     # Find the version of devenv.exe
3977     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3978     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3979     DEVENV_unix=$(cygpath -u "$DEVENV")
3980     if test ! -e "$DEVENV_unix"; then
3981         AC_MSG_WARN([No devenv.exe found - this is expected for VC++ Build Tools])
3982     fi
3984     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3985     dnl needed when building CLR code:
3986     if test -z "$MSVC_CXX"; then
3987         # This gives us a posix path with 8.3 filename restrictions
3988         MSVC_CXX=`win_short_path_for_make "$MSVC_HOST_PATH/cl.exe"`
3989     fi
3991     if test -z "$CC"; then
3992         CC=$MSVC_CXX
3993         CC_BASE=`first_arg_basename "$CC"`
3994     fi
3995     if test -z "$CXX"; then
3996         CXX=$MSVC_CXX
3997         CXX_BASE=`first_arg_basename "$CXX"`
3998     fi
4000     if test -n "$CC"; then
4001         # Remove /cl.exe from CC case insensitive
4002         AC_MSG_NOTICE([found Visual C++ $vcyear])
4004         main_include_dir=`cygpath -d -m "$COMPATH/Include"`
4005         CPPFLAGS="$CPPFLAGS -I$main_include_dir"
4007         PathFormat "$COMPATH"
4008         COMPATH=`win_short_path_for_make "$formatted_path"`
4010         VCVER=$vcnum
4012         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
4013         # are always "better", we list them in reverse chronological order.
4015         case "$vcnum" in
4016         160)
4017             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
4018             ;;
4019         esac
4021         # The expectation is that --with-windows-sdk should not need to be used
4022         if test -n "$with_windows_sdk"; then
4023             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
4024             *" "$with_windows_sdk" "*)
4025                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
4026                 ;;
4027             *)
4028                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $vcyear])
4029                 ;;
4030             esac
4031         fi
4033         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
4034         ac_objext=obj
4035         ac_exeext=exe
4037     else
4038         AC_MSG_ERROR([Visual C++ not found after all, huh])
4039     fi
4041     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.4])
4042     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4043         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
4044         // between Visual Studio versions and _MSC_VER:
4045         #if _MSC_VER < 1924
4046         #error
4047         #endif
4048     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
4050     # Check for 64-bit (cross-)compiler to use to build the 64-bit
4051     # version of the Explorer extension (and maybe other small
4052     # bits, too) needed when installing a 32-bit LibreOffice on a
4053     # 64-bit OS. The 64-bit Explorer extension is a feature that
4054     # has been present since long in OOo. Don't confuse it with
4055     # building LibreOffice itself as 64-bit code.
4057     BUILD_X64=
4058     CXX_X64_BINARY=
4060     if test "$WIN_HOST_ARCH" = "x86" -a -n "$WIN_OTHER_ARCH"; then
4061         AC_MSG_CHECKING([for the libraries to build the 64-bit Explorer extensions])
4062         if test -f "$COMPATH/atlmfc/lib/x64/atls.lib" -o \
4063              -f "$COMPATH/atlmfc/lib/spectre/x64/atls.lib"
4064         then
4065             BUILD_X64=TRUE
4066             CXX_X64_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4067             AC_MSG_RESULT([found])
4068         else
4069             AC_MSG_RESULT([not found])
4070             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
4071         fi
4072     elif test "$WIN_HOST_ARCH" = "x64"; then
4073         CXX_X64_BINARY=$CXX
4074     fi
4075     AC_SUBST(BUILD_X64)
4077     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
4078     AC_SUBST(CXX_X64_BINARY)
4080     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
4081     # needed to support TWAIN scan on both 32- and 64-bit systems
4083     case "$WIN_HOST_ARCH" in
4084     x64)
4085         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
4086         if test -n "$CXX_X86_BINARY"; then
4087             BUILD_X86=TRUE
4088             AC_MSG_RESULT([preset])
4089         elif test -n "$WIN_MULTI_ARCH"; then
4090             BUILD_X86=TRUE
4091             CXX_X86_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4092             CXX_X86_BINARY+=" /arch:SSE"
4093             AC_MSG_RESULT([found])
4094         else
4095             AC_MSG_RESULT([not found])
4096             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
4097         fi
4098         ;;
4099     x86)
4100         BUILD_X86=TRUE
4101         CXX_X86_BINARY=$MSVC_CXX
4102         ;;
4103     esac
4104     AC_SUBST(BUILD_X86)
4105     AC_SUBST(CXX_X86_BINARY)
4107 AC_SUBST(VCVER)
4108 AC_SUBST(DEVENV)
4109 AC_SUBST(MSVC_CXX)
4112 # unowinreg.dll
4114 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
4115 AC_SUBST(UNOWINREG_DLL)
4117 COM_IS_CLANG=
4118 AC_MSG_CHECKING([whether the compiler is actually Clang])
4119 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4120     #ifndef __clang__
4121     you lose
4122     #endif
4123     int foo=42;
4124     ]])],
4125     [AC_MSG_RESULT([yes])
4126      COM_IS_CLANG=TRUE],
4127     [AC_MSG_RESULT([no])])
4128 AC_SUBST(COM_IS_CLANG)
4130 CC_PLAIN=$CC
4131 CLANGVER=
4132 if test "$COM_IS_CLANG" = TRUE; then
4133     AC_MSG_CHECKING([whether Clang is new enough])
4134     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4135         #if !defined __apple_build_version__
4136         #error
4137         #endif
4138         ]])],
4139         [my_apple_clang=yes],[my_apple_clang=])
4140     if test "$my_apple_clang" = yes; then
4141         AC_MSG_RESULT([assumed yes (Apple Clang)])
4142     else
4143         if test "$_os" = WINNT; then
4144             dnl In which case, assume clang-cl:
4145             my_args="/EP /TC"
4146             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
4147             dnl clang-cl:
4148             CC_PLAIN=
4149             for i in $CC; do
4150                 case $i in
4151                 -FIIntrin.h)
4152                     ;;
4153                 *)
4154                     CC_PLAIN="$CC_PLAIN $i"
4155                     ;;
4156                 esac
4157             done
4158         else
4159             my_args="-E -P"
4160         fi
4161         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
4162         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
4163         CLANGVER=`echo $clang_version \
4164             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
4165         if test "$CLANGVER" -ge 50002; then
4166             AC_MSG_RESULT([yes ($clang_version)])
4167         else
4168             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
4169         fi
4170         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
4171         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
4172     fi
4175 SHOWINCLUDES_PREFIX=
4176 if test "$_os" = WINNT; then
4177     dnl We need to guess the prefix of the -showIncludes output, it can be
4178     dnl localized
4179     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
4180     echo "#include <stdlib.h>" > conftest.c
4181     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
4182         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
4183     rm -f conftest.c conftest.obj
4184     if test -z "$SHOWINCLUDES_PREFIX"; then
4185         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
4186     else
4187         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
4188     fi
4190 AC_SUBST(SHOWINCLUDES_PREFIX)
4193 # prefix C with ccache if needed
4195 if test "$CCACHE" != ""; then
4196     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
4198     AC_LANG_PUSH([C])
4199     save_CFLAGS=$CFLAGS
4200     CFLAGS="$CFLAGS --ccache-skip -O2"
4201     dnl an empty program will do, we're checking the compiler flags
4202     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
4203                       [use_ccache=yes], [use_ccache=no])
4204     CFLAGS=$save_CFLAGS
4205     if test $use_ccache = yes; then
4206         AC_MSG_RESULT([yes])
4207     else
4208         CC="$CCACHE $CC"
4209         CC_BASE="ccache $CC_BASE"
4210         AC_MSG_RESULT([no])
4211     fi
4212     AC_LANG_POP([C])
4215 # ===================================================================
4216 # check various GCC options that Clang does not support now but maybe
4217 # will somewhen in the future, check them even for GCC, so that the
4218 # flags are set
4219 # ===================================================================
4221 HAVE_GCC_GGDB2=
4222 if test "$GCC" = "yes"; then
4223     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
4224     save_CFLAGS=$CFLAGS
4225     CFLAGS="$CFLAGS -Werror -ggdb2"
4226     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
4227     CFLAGS=$save_CFLAGS
4228     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
4229         AC_MSG_RESULT([yes])
4230     else
4231         AC_MSG_RESULT([no])
4232     fi
4234     if test "$host_cpu" = "m68k"; then
4235         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
4236         save_CFLAGS=$CFLAGS
4237         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
4238         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
4239         CFLAGS=$save_CFLAGS
4240         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
4241             AC_MSG_RESULT([yes])
4242         else
4243             AC_MSG_ERROR([no])
4244         fi
4245     fi
4247 AC_SUBST(HAVE_GCC_GGDB2)
4249 dnl ===================================================================
4250 dnl  Test the gcc version
4251 dnl ===================================================================
4252 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
4253     AC_MSG_CHECKING([the GCC version])
4254     _gcc_version=`$CC -dumpversion`
4255     gcc_full_version=$(printf '%s' "$_gcc_version" | \
4256         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
4257     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
4259     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
4261     if test "$gcc_full_version" -lt 70000; then
4262         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
4263     fi
4264 else
4265     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
4266     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
4267     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
4268     # (which reports itself as GCC 4.2.1).
4269     GCC_VERSION=
4271 AC_SUBST(GCC_VERSION)
4273 dnl Set the ENABLE_DBGUTIL variable
4274 dnl ===================================================================
4275 AC_MSG_CHECKING([whether to build with additional debug utilities])
4276 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
4277     ENABLE_DBGUTIL="TRUE"
4278     # this is an extra var so it can have different default on different MSVC
4279     # versions (in case there are version specific problems with it)
4280     MSVC_USE_DEBUG_RUNTIME="TRUE"
4282     AC_MSG_RESULT([yes])
4283     # cppunit and graphite expose STL in public headers
4284     if test "$with_system_cppunit" = "yes"; then
4285         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
4286     else
4287         with_system_cppunit=no
4288     fi
4289     if test "$with_system_graphite" = "yes"; then
4290         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
4291     else
4292         with_system_graphite=no
4293     fi
4294     if test "$with_system_orcus" = "yes"; then
4295         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
4296     else
4297         with_system_orcus=no
4298     fi
4299     if test "$with_system_libcmis" = "yes"; then
4300         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
4301     else
4302         with_system_libcmis=no
4303     fi
4304     if test "$with_system_hunspell" = "yes"; then
4305         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
4306     else
4307         with_system_hunspell=no
4308     fi
4309     if test "$with_system_gpgmepp" = "yes"; then
4310         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
4311     else
4312         with_system_gpgmepp=no
4313     fi
4314     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
4315     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
4316     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
4317     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
4318     # of those two is using the system variant:
4319     if test "$with_system_libnumbertext" = "yes"; then
4320         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
4321     else
4322         with_system_libnumbertext=no
4323     fi
4324     if test "$with_system_libwps" = "yes"; then
4325         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
4326     else
4327         with_system_libwps=no
4328     fi
4329 else
4330     ENABLE_DBGUTIL=""
4331     MSVC_USE_DEBUG_RUNTIME=""
4332     AC_MSG_RESULT([no])
4334 AC_SUBST(ENABLE_DBGUTIL)
4335 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
4337 dnl Set the ENABLE_DEBUG variable.
4338 dnl ===================================================================
4339 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
4340     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
4342 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
4343     if test -z "$libo_fuzzed_enable_debug"; then
4344         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
4345     else
4346         AC_MSG_NOTICE([Resetting --enable-debug=yes])
4347         enable_debug=yes
4348     fi
4351 AC_MSG_CHECKING([whether to do a debug build])
4352 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
4353     ENABLE_DEBUG="TRUE"
4354     if test -n "$ENABLE_DBGUTIL" ; then
4355         AC_MSG_RESULT([yes (dbgutil)])
4356     else
4357         AC_MSG_RESULT([yes])
4358     fi
4359 else
4360     ENABLE_DEBUG=""
4361     AC_MSG_RESULT([no])
4363 AC_SUBST(ENABLE_DEBUG)
4365 dnl ===================================================================
4366 dnl Select the linker to use (gold/lld/ld.bfd).
4367 dnl This is done only after compiler checks (need to know if Clang is
4368 dnl used, for different defaults) and after checking if a debug build
4369 dnl is wanted (non-debug builds get the default linker if not explicitly
4370 dnl specified otherwise).
4371 dnl All checks for linker features/options should come after this.
4372 dnl ===================================================================
4373 check_use_ld()
4375     use_ld=-fuse-ld=${1%%:*}
4376     use_ld_path=${1#*:}
4377     if test "$use_ld_path" != "$1"; then
4378         use_ld="$use_ld --ld-path=$use_ld_path"
4379     fi
4380     use_ld_fail_if_error=$2
4381     use_ld_ok=
4382     AC_MSG_CHECKING([for $use_ld linker support])
4383     use_ld_ldflags_save="$LDFLAGS"
4384     LDFLAGS="$LDFLAGS $use_ld"
4385     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4386 #include <stdio.h>
4387         ],[
4388 printf ("hello world\n");
4389         ])], USE_LD=$use_ld, [])
4390     if test -n "$USE_LD"; then
4391         AC_MSG_RESULT( yes )
4392         use_ld_ok=yes
4393     else
4394         if test -n "$use_ld_fail_if_error"; then
4395             AC_MSG_ERROR( no )
4396         else
4397             AC_MSG_RESULT( no )
4398         fi
4399     fi
4400     if test -n "$use_ld_ok"; then
4401         dnl keep the value of LDFLAGS
4402         return 0
4403     fi
4404     LDFLAGS="$use_ld_ldflags_save"
4405     return 1
4407 USE_LD=
4408 if test "$enable_ld" != "no"; then
4409     if test "$GCC" = "yes"; then
4410         if test -n "$enable_ld"; then
4411             check_use_ld "$enable_ld" fail_if_error
4412         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4413             dnl non-debug builds default to the default linker
4414             true
4415         elif test -n "$COM_IS_CLANG"; then
4416             check_use_ld lld
4417             if test $? -ne 0; then
4418                 check_use_ld gold
4419             fi
4420         else
4421             # For gcc first try gold, new versions also support lld.
4422             check_use_ld gold
4423             if test $? -ne 0; then
4424                 check_use_ld lld
4425             fi
4426         fi
4427         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4428         rm conftest.out
4429         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4430         if test -z "$ld_used"; then
4431             ld_used="unknown"
4432         fi
4433         AC_MSG_CHECKING([for linker that is used])
4434         AC_MSG_RESULT([$ld_used])
4435         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4436             if echo "$ld_used" | grep -q "^GNU ld"; then
4437                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4438                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4439             fi
4440         fi
4441     else
4442         if test "$enable_ld" = "yes"; then
4443             AC_MSG_ERROR([--enable-ld not supported])
4444         fi
4445     fi
4447 AC_SUBST(USE_LD)
4449 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4450 if test "$GCC" = "yes"; then
4451     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4452     bsymbolic_functions_ldflags_save=$LDFLAGS
4453     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4454     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4455 #include <stdio.h>
4456         ],[
4457 printf ("hello world\n");
4458         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4459     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4460         AC_MSG_RESULT( found )
4461     else
4462         AC_MSG_RESULT( not found )
4463     fi
4464     LDFLAGS=$bsymbolic_functions_ldflags_save
4466 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4468 LD_GC_SECTIONS=
4469 if test "$GCC" = "yes"; then
4470     for flag in "--gc-sections" "-dead_strip"; do
4471         AC_MSG_CHECKING([for $flag linker support])
4472         ldflags_save=$LDFLAGS
4473         LDFLAGS="$LDFLAGS -Wl,$flag"
4474         AC_LINK_IFELSE([AC_LANG_PROGRAM([
4475 #include <stdio.h>
4476             ],[
4477 printf ("hello world\n");
4478             ])],[
4479             LD_GC_SECTIONS="-Wl,$flag"
4480             AC_MSG_RESULT( found )
4481             ], [
4482             AC_MSG_RESULT( not found )
4483             ])
4484         LDFLAGS=$ldflags_save
4485         if test -n "$LD_GC_SECTIONS"; then
4486             break
4487         fi
4488     done
4490 AC_SUBST(LD_GC_SECTIONS)
4492 HAVE_GSPLIT_DWARF=
4493 if test "$enable_split_debug" != no; then
4494     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4495     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4496         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4497         save_CFLAGS=$CFLAGS
4498         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4499         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4500         CFLAGS=$save_CFLAGS
4501         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4502             AC_MSG_RESULT([yes])
4503         else
4504             if test "$enable_split_debug" = yes; then
4505                 AC_MSG_ERROR([no])
4506             else
4507                 AC_MSG_RESULT([no])
4508             fi
4509         fi
4510     fi
4511     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4512         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4513         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4514     fi
4516 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4518 HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=
4519 AC_MSG_CHECKING([whether $CC_BASE supports -Xclang -debug-info-kind=constructor])
4520 save_CFLAGS=$CFLAGS
4521 CFLAGS="$CFLAGS -Werror -Xclang -debug-info-kind=constructor"
4522 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=TRUE ],[])
4523 CFLAGS=$save_CFLAGS
4524 if test "$HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR" = "TRUE"; then
4525     AC_MSG_RESULT([yes])
4526 else
4527     AC_MSG_RESULT([no])
4529 AC_SUBST(HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR)
4531 ENABLE_GDB_INDEX=
4532 if test "$enable_gdb_index" != "no"; then
4533     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4534     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4535         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4536         save_CFLAGS=$CFLAGS
4537         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4538         have_ggnu_pubnames=
4539         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4540         if test "$have_ggnu_pubnames" != "TRUE"; then
4541             if test "$enable_gdb_index" = "yes"; then
4542                 AC_MSG_ERROR([no, --enable-gdb-index not supported])
4543             else
4544                 AC_MSG_RESULT( no )
4545             fi
4546         else
4547             AC_MSG_RESULT( yes )
4548             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4549             ldflags_save=$LDFLAGS
4550             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4551             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4552 #include <stdio.h>
4553                 ],[
4554 printf ("hello world\n");
4555                 ])], ENABLE_GDB_INDEX=TRUE, [])
4556             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4557                 AC_MSG_RESULT( yes )
4558             else
4559                 if test "$enable_gdb_index" = "yes"; then
4560                     AC_MSG_ERROR( no )
4561                 else
4562                     AC_MSG_RESULT( no )
4563                 fi
4564             fi
4565             LDFLAGS=$ldflags_save
4566         fi
4567         CFLAGS=$save_CFLAGS
4568         fi
4569     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4570         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4571         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4572     fi
4574 AC_SUBST(ENABLE_GDB_INDEX)
4576 if test -z "$enable_sal_log" && test "$ENABLE_DEBUG" = TRUE; then
4577     enable_sal_log=yes
4579 if test "$enable_sal_log" = yes; then
4580     ENABLE_SAL_LOG=TRUE
4582 AC_SUBST(ENABLE_SAL_LOG)
4584 dnl Check for enable symbols option
4585 dnl ===================================================================
4586 AC_MSG_CHECKING([whether to generate debug information])
4587 if test -z "$enable_symbols"; then
4588     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4589         enable_symbols=yes
4590     else
4591         enable_symbols=no
4592     fi
4594 if test "$enable_symbols" = yes; then
4595     ENABLE_SYMBOLS_FOR=all
4596     AC_MSG_RESULT([yes])
4597 elif test "$enable_symbols" = no; then
4598     ENABLE_SYMBOLS_FOR=
4599     AC_MSG_RESULT([no])
4600 else
4601     # Selective debuginfo.
4602     ENABLE_SYMBOLS_FOR="$enable_symbols"
4603     AC_MSG_RESULT([for "$enable_symbols"])
4605 AC_SUBST(ENABLE_SYMBOLS_FOR)
4607 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4608     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4609     AC_MSG_CHECKING([whether enough memory is available for linking])
4610     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4611     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4612     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4613         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4614     else
4615         AC_MSG_RESULT([yes])
4616     fi
4619 ENABLE_OPTIMIZED=
4620 ENABLE_OPTIMIZED_DEBUG=
4621 AC_MSG_CHECKING([whether to compile with optimization flags])
4622 if test -z "$enable_optimized"; then
4623     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4624         enable_optimized=no
4625     else
4626         enable_optimized=yes
4627     fi
4629 if test "$enable_optimized" = yes; then
4630     ENABLE_OPTIMIZED=TRUE
4631     AC_MSG_RESULT([yes])
4632 elif test "$enable_optimized" = debug; then
4633     ENABLE_OPTIMIZED_DEBUG=TRUE
4634     AC_MSG_RESULT([yes (debug)])
4635     HAVE_GCC_OG=
4636     if test "$GCC" = "yes"; then
4637         AC_MSG_CHECKING([whether $CC_BASE supports -Og])
4638         save_CFLAGS=$CFLAGS
4639         CFLAGS="$CFLAGS -Werror -Og"
4640         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[])
4641         CFLAGS=$save_CFLAGS
4642         if test "$HAVE_GCC_OG" = "TRUE"; then
4643             AC_MSG_RESULT([yes])
4644         else
4645             AC_MSG_RESULT([no])
4646         fi
4647     fi
4648     if test -z "$HAVE_GCC_OG"; then
4649         AC_MSG_ERROR([The compiler does not support optimizations suitable for debugging.])
4650     fi
4651 else
4652     AC_MSG_RESULT([no])
4654 AC_SUBST(ENABLE_OPTIMIZED)
4655 AC_SUBST(ENABLE_OPTIMIZED_DEBUG)
4658 # determine CPUNAME, OS, ...
4659 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4661 case "$host_os" in
4663 aix*)
4664     COM=GCC
4665     CPUNAME=POWERPC
4666     USING_X11=TRUE
4667     OS=AIX
4668     RTL_OS=AIX
4669     RTL_ARCH=PowerPC
4670     PLATFORMID=aix_powerpc
4671     P_SEP=:
4672     ;;
4674 cygwin*|wsl*)
4675     # Already handled
4676     ;;
4678 darwin*|macos*)
4679     COM=GCC
4680     USING_X11=
4681     OS=MACOSX
4682     RTL_OS=MacOSX
4683     P_SEP=:
4685     case "$host_cpu" in
4686     aarch64|arm64)
4687         if test "$enable_ios_simulator" = "yes"; then
4688             OS=iOS
4689         else
4690             CPUNAME=AARCH64
4691             RTL_ARCH=AARCH64
4692             PLATFORMID=macosx_arm64
4693         fi
4694         ;;
4695     x86_64)
4696         if test "$enable_ios_simulator" = "yes"; then
4697             OS=iOS
4698         fi
4699         CPUNAME=X86_64
4700         RTL_ARCH=X86_64
4701         PLATFORMID=macosx_x86_64
4702         ;;
4703     *)
4704         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4705         ;;
4706     esac
4707     ;;
4709 ios*)
4710     COM=GCC
4711     USING_X11=
4712     OS=iOS
4713     RTL_OS=iOS
4714     P_SEP=:
4716     case "$host_cpu" in
4717     aarch64|arm64)
4718         if test "$enable_ios_simulator" = "yes"; then
4719             AC_MSG_ERROR([iOS simulator is only available in macOS not iOS])
4720         fi
4721         ;;
4722     *)
4723         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4724         ;;
4725     esac
4726     CPUNAME=AARCH64
4727     RTL_ARCH=AARCH64
4728     PLATFORMID=ios_arm64
4729     ;;
4731 dragonfly*)
4732     COM=GCC
4733     USING_X11=TRUE
4734     OS=DRAGONFLY
4735     RTL_OS=DragonFly
4736     P_SEP=:
4738     case "$host_cpu" in
4739     i*86)
4740         CPUNAME=INTEL
4741         RTL_ARCH=x86
4742         PLATFORMID=dragonfly_x86
4743         ;;
4744     x86_64)
4745         CPUNAME=X86_64
4746         RTL_ARCH=X86_64
4747         PLATFORMID=dragonfly_x86_64
4748         ;;
4749     *)
4750         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4751         ;;
4752     esac
4753     ;;
4755 freebsd*)
4756     COM=GCC
4757     USING_X11=TRUE
4758     RTL_OS=FreeBSD
4759     OS=FREEBSD
4760     P_SEP=:
4762     case "$host_cpu" in
4763     aarch64)
4764         CPUNAME=AARCH64
4765         PLATFORMID=freebsd_aarch64
4766         RTL_ARCH=AARCH64
4767         ;;
4768     i*86)
4769         CPUNAME=INTEL
4770         RTL_ARCH=x86
4771         PLATFORMID=freebsd_x86
4772         ;;
4773     x86_64|amd64)
4774         CPUNAME=X86_64
4775         RTL_ARCH=X86_64
4776         PLATFORMID=freebsd_x86_64
4777         ;;
4778     powerpc64)
4779         CPUNAME=POWERPC64
4780         RTL_ARCH=PowerPC_64
4781         PLATFORMID=freebsd_powerpc64
4782         ;;
4783     powerpc|powerpcspe)
4784         CPUNAME=POWERPC
4785         RTL_ARCH=PowerPC
4786         PLATFORMID=freebsd_powerpc
4787         ;;
4788     *)
4789         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4790         ;;
4791     esac
4792     ;;
4794 haiku*)
4795     COM=GCC
4796     USING_X11=
4797     GUIBASE=haiku
4798     RTL_OS=Haiku
4799     OS=HAIKU
4800     P_SEP=:
4802     case "$host_cpu" in
4803     i*86)
4804         CPUNAME=INTEL
4805         RTL_ARCH=x86
4806         PLATFORMID=haiku_x86
4807         ;;
4808     x86_64|amd64)
4809         CPUNAME=X86_64
4810         RTL_ARCH=X86_64
4811         PLATFORMID=haiku_x86_64
4812         ;;
4813     *)
4814         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4815         ;;
4816     esac
4817     ;;
4819 kfreebsd*)
4820     COM=GCC
4821     USING_X11=TRUE
4822     OS=LINUX
4823     RTL_OS=kFreeBSD
4824     P_SEP=:
4826     case "$host_cpu" in
4828     i*86)
4829         CPUNAME=INTEL
4830         RTL_ARCH=x86
4831         PLATFORMID=kfreebsd_x86
4832         ;;
4833     x86_64)
4834         CPUNAME=X86_64
4835         RTL_ARCH=X86_64
4836         PLATFORMID=kfreebsd_x86_64
4837         ;;
4838     *)
4839         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4840         ;;
4841     esac
4842     ;;
4844 linux-gnu*)
4845     COM=GCC
4846     USING_X11=TRUE
4847     OS=LINUX
4848     RTL_OS=Linux
4849     P_SEP=:
4851     case "$host_cpu" in
4853     aarch64)
4854         CPUNAME=AARCH64
4855         PLATFORMID=linux_aarch64
4856         RTL_ARCH=AARCH64
4857         EPM_FLAGS="-a arm64"
4858         ;;
4859     alpha)
4860         CPUNAME=AXP
4861         RTL_ARCH=ALPHA
4862         PLATFORMID=linux_alpha
4863         ;;
4864     arm*)
4865         CPUNAME=ARM
4866         EPM_FLAGS="-a arm"
4867         RTL_ARCH=ARM_EABI
4868         PLATFORMID=linux_arm_eabi
4869         case "$host_cpu" in
4870         arm*-linux)
4871             RTL_ARCH=ARM_OABI
4872             PLATFORMID=linux_arm_oabi
4873             ;;
4874         esac
4875         ;;
4876     hppa)
4877         CPUNAME=HPPA
4878         RTL_ARCH=HPPA
4879         EPM_FLAGS="-a hppa"
4880         PLATFORMID=linux_hppa
4881         ;;
4882     i*86)
4883         CPUNAME=INTEL
4884         RTL_ARCH=x86
4885         PLATFORMID=linux_x86
4886         ;;
4887     ia64)
4888         CPUNAME=IA64
4889         RTL_ARCH=IA64
4890         PLATFORMID=linux_ia64
4891         ;;
4892     mips)
4893         CPUNAME=GODSON
4894         RTL_ARCH=MIPS_EB
4895         EPM_FLAGS="-a mips"
4896         PLATFORMID=linux_mips_eb
4897         ;;
4898     mips64)
4899         CPUNAME=GODSON64
4900         RTL_ARCH=MIPS64_EB
4901         EPM_FLAGS="-a mips64"
4902         PLATFORMID=linux_mips64_eb
4903         ;;
4904     mips64el)
4905         CPUNAME=GODSON64
4906         RTL_ARCH=MIPS64_EL
4907         EPM_FLAGS="-a mips64el"
4908         PLATFORMID=linux_mips64_el
4909         ;;
4910     mipsel)
4911         CPUNAME=GODSON
4912         RTL_ARCH=MIPS_EL
4913         EPM_FLAGS="-a mipsel"
4914         PLATFORMID=linux_mips_el
4915         ;;
4916     m68k)
4917         CPUNAME=M68K
4918         RTL_ARCH=M68K
4919         PLATFORMID=linux_m68k
4920         ;;
4921     powerpc)
4922         CPUNAME=POWERPC
4923         RTL_ARCH=PowerPC
4924         PLATFORMID=linux_powerpc
4925         ;;
4926     powerpc64)
4927         CPUNAME=POWERPC64
4928         RTL_ARCH=PowerPC_64
4929         PLATFORMID=linux_powerpc64
4930         ;;
4931     powerpc64le)
4932         CPUNAME=POWERPC64
4933         RTL_ARCH=PowerPC_64_LE
4934         PLATFORMID=linux_powerpc64_le
4935         ;;
4936     sparc)
4937         CPUNAME=SPARC
4938         RTL_ARCH=SPARC
4939         PLATFORMID=linux_sparc
4940         ;;
4941     sparc64)
4942         CPUNAME=SPARC64
4943         RTL_ARCH=SPARC64
4944         PLATFORMID=linux_sparc64
4945         ;;
4946     s390)
4947         CPUNAME=S390
4948         RTL_ARCH=S390
4949         PLATFORMID=linux_s390
4950         ;;
4951     s390x)
4952         CPUNAME=S390X
4953         RTL_ARCH=S390x
4954         PLATFORMID=linux_s390x
4955         ;;
4956     x86_64)
4957         CPUNAME=X86_64
4958         RTL_ARCH=X86_64
4959         PLATFORMID=linux_x86_64
4960         ;;
4961     *)
4962         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4963         ;;
4964     esac
4965     ;;
4967 linux-android*)
4968     COM=GCC
4969     USING_X11=
4970     OS=ANDROID
4971     RTL_OS=Android
4972     P_SEP=:
4974     case "$host_cpu" in
4976     arm|armel)
4977         CPUNAME=ARM
4978         RTL_ARCH=ARM_EABI
4979         PLATFORMID=android_arm_eabi
4980         ;;
4981     aarch64)
4982         CPUNAME=AARCH64
4983         RTL_ARCH=AARCH64
4984         PLATFORMID=android_aarch64
4985         ;;
4986     i*86)
4987         CPUNAME=INTEL
4988         RTL_ARCH=x86
4989         PLATFORMID=android_x86
4990         ;;
4991     x86_64)
4992         CPUNAME=X86_64
4993         RTL_ARCH=X86_64
4994         PLATFORMID=android_x86_64
4995         ;;
4996     *)
4997         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4998         ;;
4999     esac
5000     ;;
5002 *netbsd*)
5003     COM=GCC
5004     USING_X11=TRUE
5005     OS=NETBSD
5006     RTL_OS=NetBSD
5007     P_SEP=:
5009     case "$host_cpu" in
5010     i*86)
5011         CPUNAME=INTEL
5012         RTL_ARCH=x86
5013         PLATFORMID=netbsd_x86
5014         ;;
5015     powerpc)
5016         CPUNAME=POWERPC
5017         RTL_ARCH=PowerPC
5018         PLATFORMID=netbsd_powerpc
5019         ;;
5020     sparc)
5021         CPUNAME=SPARC
5022         RTL_ARCH=SPARC
5023         PLATFORMID=netbsd_sparc
5024         ;;
5025     x86_64)
5026         CPUNAME=X86_64
5027         RTL_ARCH=X86_64
5028         PLATFORMID=netbsd_x86_64
5029         ;;
5030     *)
5031         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5032         ;;
5033     esac
5034     ;;
5036 openbsd*)
5037     COM=GCC
5038     USING_X11=TRUE
5039     OS=OPENBSD
5040     RTL_OS=OpenBSD
5041     P_SEP=:
5043     case "$host_cpu" in
5044     i*86)
5045         CPUNAME=INTEL
5046         RTL_ARCH=x86
5047         PLATFORMID=openbsd_x86
5048         ;;
5049     x86_64)
5050         CPUNAME=X86_64
5051         RTL_ARCH=X86_64
5052         PLATFORMID=openbsd_x86_64
5053         ;;
5054     *)
5055         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5056         ;;
5057     esac
5058     SOLARINC="$SOLARINC -I/usr/local/include"
5059     ;;
5061 solaris*)
5062     COM=GCC
5063     USING_X11=TRUE
5064     OS=SOLARIS
5065     RTL_OS=Solaris
5066     P_SEP=:
5068     case "$host_cpu" in
5069     i*86)
5070         CPUNAME=INTEL
5071         RTL_ARCH=x86
5072         PLATFORMID=solaris_x86
5073         ;;
5074     sparc)
5075         CPUNAME=SPARC
5076         RTL_ARCH=SPARC
5077         PLATFORMID=solaris_sparc
5078         ;;
5079     sparc64)
5080         CPUNAME=SPARC64
5081         RTL_ARCH=SPARC64
5082         PLATFORMID=solaris_sparc64
5083         ;;
5084     *)
5085         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5086         ;;
5087     esac
5088     SOLARINC="$SOLARINC -I/usr/local/include"
5089     ;;
5092     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
5093     ;;
5094 esac
5096 if test "$with_x" = "no"; then
5097     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
5100 DISABLE_GUI=""
5101 if test "$enable_gui" = "no"; then
5102     if test "$USING_X11" != TRUE; then
5103         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
5104     fi
5105     USING_X11=
5106     DISABLE_GUI=TRUE
5107     AC_DEFINE(HAVE_FEATURE_UI,0)
5108     test_cairo=yes
5110 AC_SUBST(DISABLE_GUI)
5112 WORKDIR="${BUILDDIR}/workdir"
5113 INSTDIR="${BUILDDIR}/instdir"
5114 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
5115 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
5116 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
5117 AC_SUBST(COM)
5118 AC_SUBST(CPUNAME)
5119 AC_SUBST(RTL_OS)
5120 AC_SUBST(RTL_ARCH)
5121 AC_SUBST(EPM_FLAGS)
5122 AC_SUBST(USING_X11)
5123 AC_SUBST([INSTDIR])
5124 AC_SUBST([INSTROOT])
5125 AC_SUBST([INSTROOTBASE])
5126 AC_SUBST(OS)
5127 AC_SUBST(P_SEP)
5128 AC_SUBST(WORKDIR)
5129 AC_SUBST(PLATFORMID)
5130 AC_SUBST(WINDOWS_X64)
5131 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
5133 dnl ===================================================================
5134 dnl Test which package format to use
5135 dnl ===================================================================
5136 AC_MSG_CHECKING([which package format to use])
5137 if test -n "$with_package_format" -a "$with_package_format" != no; then
5138     for i in $with_package_format; do
5139         case "$i" in
5140         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
5141             ;;
5142         *)
5143             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
5144 aix - AIX software distribution
5145 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
5146 deb - Debian software distribution
5147 pkg - Solaris software distribution
5148 rpm - RedHat software distribution
5150 LibreOffice additionally supports:
5151 archive - .tar.gz or .zip
5152 dmg - macOS .dmg
5153 installed - installation tree
5154 msi - Windows .msi
5155         ])
5156             ;;
5157         esac
5158     done
5159     # fakeroot is needed to ensure correct file ownerships/permissions
5160     # inside deb packages and tar archives created on Linux and Solaris.
5161     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
5162         AC_PATH_PROG(FAKEROOT, fakeroot, no)
5163         if test "$FAKEROOT" = "no"; then
5164             AC_MSG_ERROR(
5165                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
5166         fi
5167     fi
5168     PKGFORMAT="$with_package_format"
5169     AC_MSG_RESULT([$PKGFORMAT])
5170 else
5171     PKGFORMAT=
5172     AC_MSG_RESULT([none])
5174 AC_SUBST(PKGFORMAT)
5176 dnl ===================================================================
5177 dnl Set up a different compiler to produce tools to run on the build
5178 dnl machine when doing cross-compilation
5179 dnl ===================================================================
5181 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
5182 m4_pattern_allow([PKG_CONFIG_LIBDIR])
5183 if test "$cross_compiling" = "yes"; then
5184     AC_MSG_CHECKING([for BUILD platform configuration])
5185     echo
5186     rm -rf CONF-FOR-BUILD config_build.mk
5187     mkdir CONF-FOR-BUILD
5188     # Here must be listed all files needed when running the configure script. In particular, also
5189     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
5190     # keep them in the same order as there.
5191     (cd $SRC_ROOT && tar cf - \
5192         config.guess \
5193         bin/get_config_variables \
5194         solenv/bin/getcompver.awk \
5195         solenv/inc/langlist.mk \
5196         download.lst \
5197         config_host.mk.in \
5198         config_host_lang.mk.in \
5199         Makefile.in \
5200         bin/bffvalidator.sh.in \
5201         bin/odfvalidator.sh.in \
5202         bin/officeotron.sh.in \
5203         hardened_runtime.xcent.in \
5204         instsetoo_native/util/openoffice.lst.in \
5205         setup_native/source/packinfo/finals_instsetoo.txt.in \
5206         config_host/*.in \
5207         sysui/desktop/macosx/Info.plist.in) \
5208     | (cd CONF-FOR-BUILD && tar xf -)
5209     cp configure CONF-FOR-BUILD
5210     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
5211     (
5212     unset COM USING_X11 OS CPUNAME
5213     unset CC CXX SYSBASE CFLAGS
5214     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
5215     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
5216     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
5217     if test -n "$CC_FOR_BUILD"; then
5218         export CC="$CC_FOR_BUILD"
5219         CC_BASE=`first_arg_basename "$CC"`
5220     fi
5221     if test -n "$CXX_FOR_BUILD"; then
5222         export CXX="$CXX_FOR_BUILD"
5223         CXX_BASE=`first_arg_basename "$CXX"`
5224     fi
5225     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
5226     cd CONF-FOR-BUILD
5228     sub_conf_opts=""
5229     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
5230     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
5231     test "$with_junit" = "no" && sub_conf_opts="$sub_conf_opts --without-junit"
5232     if test -n "$ENABLE_JAVA"; then
5233         case "$_os" in
5234         iOS) sub_conf_opts="$sub_conf_opts --without-java" ;; # force it off, like it used to be
5235         Android)
5236             # Hack for Android - the build doesn't need a host JDK, so just forward to build for convenience
5237             test -n "$with_jdk_home" && sub_conf_opts="$sub_conf_opts --with-jdk-home=$with_jdk_home"
5238             ;;
5239         *)
5240             if test -z "$with_jdk_home"; then
5241                 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.])
5242             fi
5243             ;;
5244         esac
5245     else
5246         sub_conf_opts="$sub_conf_opts --without-java"
5247     fi
5248     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
5249     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
5250     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
5252     # Don't bother having configure look for stuff not needed for the build platform anyway
5253     ./configure \
5254         --build="$build_alias" \
5255         --disable-cups \
5256         --disable-firebird-sdbc \
5257         --disable-gpgmepp \
5258         --disable-gstreamer-1-0 \
5259         --disable-gtk3 \
5260         --disable-mariadb-sdbc \
5261         --disable-online-update \
5262         --disable-opencl \
5263         --disable-pdfimport \
5264         --disable-postgresql-sdbc \
5265         --disable-skia \
5266         --enable-icecream="$enable_icecream" \
5267         --without-doxygen \
5268         --without-webdav \
5269         --with-parallelism="$with_parallelism" \
5270         --with-theme="$with_theme" \
5271         --with-tls=openssl \
5272         $sub_conf_opts \
5273         --srcdir=$srcdir \
5274         2>&1 | sed -e 's/^/    /'
5275     test -f ./config_host.mk 2>/dev/null || exit
5277     # filter permitted build targets
5278     PERMITTED_BUILD_TARGETS="
5279         AVMEDIA
5280         BOOST
5281         CLUCENE
5282         DBCONNECTIVITY
5283         DESKTOP
5284         DYNLOADING
5285         EPOXY
5286         EXPAT
5287         GLM
5288         GRAPHITE
5289         HARFBUZZ
5290         ICU
5291         LCMS2
5292         LIBJPEG_TURBO
5293         LIBLANGTAG
5294         LibO
5295         LIBFFI
5296         LIBPN
5297         LIBXML2
5298         LIBXSLT
5299         MDDS
5300         NATIVE
5301         OPENSSL
5302         ORCUS
5303         PYTHON
5304         SCRIPTING
5305         ZLIB
5307     # converts BUILD_TYPE and PERMITTED_BUILD_TARGETS into non-whitespace,
5308     # newlined lists, to use grep as a filter
5309     PERMITTED_BUILD_TARGETS=$(echo "$PERMITTED_BUILD_TARGETS" | sed -e '/^ *$/d' -e 's/ *//')
5310     BUILD_TARGETS="$(sed -n -e '/^export BUILD_TYPE=/ s/.*=//p' config_host.mk | tr ' ' '\n')"
5311     BUILD_TARGETS="$(echo "$BUILD_TARGETS" | grep -F "$PERMITTED_BUILD_TARGETS" | tr '\n' ' ')"
5312     sed -i -e "s/ BUILD_TYPE=.*$/ BUILD_TYPE=$BUILD_TARGETS/" config_host.mk
5314     cp config_host.mk ../config_build.mk
5315     cp config_host_lang.mk ../config_build_lang.mk
5316     mv config.log ../config.Build.log
5317     mkdir -p ../config_build
5318     mv config_host/*.h ../config_build
5320     # all these will get a _FOR_BUILD postfix
5321     DIRECT_FOR_BUILD_SETTINGS="
5322         CC
5323         CXX
5324         ILIB
5325         JAVA_HOME
5326         JAVAIFLAGS
5327         JDK
5328         LIBO_BIN_FOLDER
5329         LIBO_LIB_FOLDER
5330         LIBO_URE_LIB_FOLDER
5331         LIBO_URE_MISC_FOLDER
5332         OS
5333         SDKDIRNAME
5334         SYSTEM_LIBXML
5335         SYSTEM_LIBXSLT
5337     # these overwrite host config with build config
5338     OVERWRITING_SETTINGS="
5339         ANT
5340         ANT_HOME
5341         ANT_LIB
5342         HSQLDB_USE_JDBC_4_1
5343         JAVA_CLASSPATH_NOT_SET
5344         JAVA_SOURCE_VER
5345         JAVA_TARGET_VER
5346         JAVACFLAGS
5347         JAVACOMPILER
5348         JAVADOC
5349         JAVADOCISGJDOC
5351     # these need some special handling
5352     EXTRA_HANDLED_SETTINGS="
5353         INSTDIR
5354         INSTROOT
5355         PATH
5356         WORKDIR
5358     OLD_PATH=$PATH
5359     . ./bin/get_config_variables $DIRECT_FOR_BUILD_SETTINGS $OVERWRITING_SETTINGS $EXTRA_HANDLED_SETTINGS
5360     BUILD_PATH=$PATH
5361     PATH=$OLD_PATH
5363     line=`echo "LO_PATH_FOR_BUILD='${BUILD_PATH}'" | sed -e 's,/CONF-FOR-BUILD,,g'`
5364     echo "$line" >>build-config
5366     for V in $DIRECT_FOR_BUILD_SETTINGS; do
5367         VV='$'$V
5368         VV=`eval "echo $VV"`
5369         if test -n "$VV"; then
5370             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
5371             echo "$line" >>build-config
5372         fi
5373     done
5375     for V in $OVERWRITING_SETTINGS; do
5376         VV='$'$V
5377         VV=`eval "echo $VV"`
5378         if test -n "$VV"; then
5379             line=${V}='${'${V}:-$VV'}'
5380             echo "$line" >>build-config
5381         fi
5382     done
5384     for V in INSTDIR INSTROOT WORKDIR; do
5385         VV='$'$V
5386         VV=`eval "echo $VV"`
5387         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
5388         if test -n "$VV"; then
5389             line="${V}_FOR_BUILD='$VV'"
5390             echo "$line" >>build-config
5391         fi
5392     done
5394     )
5395     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
5396     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])
5397     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
5398              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
5400     eval `cat CONF-FOR-BUILD/build-config`
5402     AC_MSG_RESULT([checking for BUILD platform configuration... done])
5404     rm -rf CONF-FOR-BUILD
5405 else
5406     OS_FOR_BUILD="$OS"
5407     CC_FOR_BUILD="$CC"
5408     CXX_FOR_BUILD="$CXX"
5409     INSTDIR_FOR_BUILD="$INSTDIR"
5410     INSTROOT_FOR_BUILD="$INSTROOT"
5411     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
5412     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
5413     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
5414     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
5415     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
5416     WORKDIR_FOR_BUILD="$WORKDIR"
5418 AC_SUBST(OS_FOR_BUILD)
5419 AC_SUBST(INSTDIR_FOR_BUILD)
5420 AC_SUBST(INSTROOT_FOR_BUILD)
5421 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
5422 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
5423 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
5424 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
5425 AC_SUBST(SDKDIRNAME_FOR_BUILD)
5426 AC_SUBST(WORKDIR_FOR_BUILD)
5427 AC_SUBST(CC_FOR_BUILD)
5428 AC_SUBST(CXX_FOR_BUILD)
5430 dnl ===================================================================
5431 dnl Check for syslog header
5432 dnl ===================================================================
5433 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
5435 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
5436 dnl ===================================================================
5437 AC_MSG_CHECKING([whether to turn warnings to errors])
5438 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
5439     ENABLE_WERROR="TRUE"
5440     PYTHONWARNINGS="error"
5441     AC_MSG_RESULT([yes])
5442 else
5443     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
5444         ENABLE_WERROR="TRUE"
5445         PYTHONWARNINGS="error"
5446         AC_MSG_RESULT([yes])
5447     else
5448         AC_MSG_RESULT([no])
5449     fi
5451 AC_SUBST(ENABLE_WERROR)
5452 AC_SUBST(PYTHONWARNINGS)
5454 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
5455 dnl ===================================================================
5456 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
5457 if test -z "$enable_assert_always_abort"; then
5458    if test "$ENABLE_DEBUG" = TRUE; then
5459        enable_assert_always_abort=yes
5460    else
5461        enable_assert_always_abort=no
5462    fi
5464 if test "$enable_assert_always_abort" = "yes"; then
5465     ASSERT_ALWAYS_ABORT="TRUE"
5466     AC_MSG_RESULT([yes])
5467 else
5468     ASSERT_ALWAYS_ABORT="FALSE"
5469     AC_MSG_RESULT([no])
5471 AC_SUBST(ASSERT_ALWAYS_ABORT)
5473 # Determine whether to use ooenv for the instdir installation
5474 # ===================================================================
5475 if test $_os != "WINNT" -a $_os != "Darwin"; then
5476     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
5477     if test "$enable_ooenv" = "no"; then
5478         AC_MSG_RESULT([no])
5479     else
5480         ENABLE_OOENV="TRUE"
5481         AC_MSG_RESULT([yes])
5482     fi
5484 AC_SUBST(ENABLE_OOENV)
5486 if test "$USING_X11" != TRUE; then
5487     # be sure to do not mess with unneeded stuff
5488     test_randr=no
5489     test_xrender=no
5490     test_cups=no
5491     test_dbus=no
5492     build_gstreamer_1_0=no
5493     test_kf5=no
5494     test_qt5=no
5495     test_gtk3_kde5=no
5496     enable_cairo_canvas=no
5499 if test "$OS" = "HAIKU"; then
5500     enable_cairo_canvas=yes
5501     test_kf5=yes
5504 if test "$test_kf5" = "yes" -a "$enable_kde5" = "yes"; then
5505     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!])
5506     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!"
5507     enable_kf5=yes
5510 if test "$test_kf5" = "yes"; then
5511     test_qt5=yes
5514 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
5515     if test "$enable_qt5" = "no"; then
5516         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
5517     else
5518         enable_qt5=yes
5519     fi
5522 dnl ===================================================================
5523 dnl check for cups support
5524 dnl ===================================================================
5525 ENABLE_CUPS=""
5527 if test "$enable_cups" = "no"; then
5528     test_cups=no
5531 AC_MSG_CHECKING([whether to enable CUPS support])
5532 if test "$test_cups" = "yes"; then
5533     ENABLE_CUPS="TRUE"
5534     AC_MSG_RESULT([yes])
5536     AC_MSG_CHECKING([whether cups support is present])
5537     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
5538     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
5539     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
5540         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
5541     fi
5543 else
5544     AC_MSG_RESULT([no])
5547 AC_SUBST(ENABLE_CUPS)
5549 # fontconfig checks
5550 if test "$test_fontconfig" = "yes"; then
5551     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
5552     SYSTEM_FONTCONFIG=TRUE
5553     FilterLibs "${FONTCONFIG_LIBS}"
5554     FONTCONFIG_LIBS="${filteredlibs}"
5556 AC_SUBST(FONTCONFIG_CFLAGS)
5557 AC_SUBST(FONTCONFIG_LIBS)
5558 AC_SUBST([SYSTEM_FONTCONFIG])
5560 dnl whether to find & fetch external tarballs?
5561 dnl ===================================================================
5562 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
5563    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5564        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
5565    else
5566        TARFILE_LOCATION="$LODE_HOME/ext_tar"
5567    fi
5569 if test -z "$TARFILE_LOCATION"; then
5570     if test -d "$SRC_ROOT/src" ; then
5571         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
5572         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
5573     fi
5574     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
5575 else
5576     AbsolutePath "$TARFILE_LOCATION"
5577     PathFormat "${absolute_path}"
5578     TARFILE_LOCATION="${formatted_path}"
5580 AC_SUBST(TARFILE_LOCATION)
5582 AC_MSG_CHECKING([whether we want to fetch tarballs])
5583 if test "$enable_fetch_external" != "no"; then
5584     if test "$with_all_tarballs" = "yes"; then
5585         AC_MSG_RESULT([yes, all of them])
5586         DO_FETCH_TARBALLS="ALL"
5587     else
5588         AC_MSG_RESULT([yes, if we use them])
5589         DO_FETCH_TARBALLS="TRUE"
5590     fi
5591 else
5592     AC_MSG_RESULT([no])
5593     DO_FETCH_TARBALLS=
5595 AC_SUBST(DO_FETCH_TARBALLS)
5597 AC_MSG_CHECKING([whether to build help])
5598 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
5599     BUILD_TYPE="$BUILD_TYPE HELP"
5600     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5601     case "$with_help" in
5602     "html")
5603         ENABLE_HTMLHELP=TRUE
5604         SCPDEFS="$SCPDEFS -DWITH_HELP"
5605         AC_MSG_RESULT([HTML])
5606         ;;
5607     "online")
5608         ENABLE_HTMLHELP=TRUE
5609         HELP_ONLINE=TRUE
5610         AC_MSG_RESULT([HTML])
5611         ;;
5612     yes)
5613         SCPDEFS="$SCPDEFS -DWITH_HELP"
5614         AC_MSG_RESULT([yes])
5615         ;;
5616     *)
5617         AC_MSG_ERROR([Unknown --with-help=$with_help])
5618         ;;
5619     esac
5620 else
5621     AC_MSG_RESULT([no])
5623 AC_SUBST([ENABLE_HTMLHELP])
5624 AC_SUBST([HELP_ONLINE])
5626 AC_MSG_CHECKING([whether to enable xapian-omega support for help])
5627 if test -n "$with_omindex" -a "$with_omindex" != "no" -a $_os != iOS -a $_os != Android; then
5628     BUILD_TYPE="$BUILD_TYPE HELP"
5629     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5630     case "$with_omindex" in
5631     "server")
5632         ENABLE_HTMLHELP=TRUE
5633         HELP_ONLINE=TRUE
5634         HELP_OMINDEX_PAGE=TRUE
5635         AC_MSG_RESULT([SERVER])
5636         ;;
5637     "noxap")
5638         ENABLE_HTMLHELP=TRUE
5639         HELP_ONLINE=TRUE
5640         HELP_OMINDEX_PAGE=FALSE
5641         AC_MSG_RESULT([NOXAP])
5642         ;;
5643     *)
5644         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5645         ;;
5646     esac
5647 else
5648     HELP_OMINDEX_PAGE=FALSE
5649     AC_MSG_RESULT([no])
5651 AC_SUBST([ENABLE_HTMLHELP])
5652 AC_SUBST([HELP_OMINDEX_PAGE])
5653 AC_SUBST([HELP_ONLINE])
5656 dnl Test whether to include MySpell dictionaries
5657 dnl ===================================================================
5658 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5659 if test "$with_myspell_dicts" = "yes"; then
5660     AC_MSG_RESULT([yes])
5661     WITH_MYSPELL_DICTS=TRUE
5662     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5663     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5664 else
5665     AC_MSG_RESULT([no])
5666     WITH_MYSPELL_DICTS=
5668 AC_SUBST(WITH_MYSPELL_DICTS)
5670 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5671 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5672     if test "$with_system_dicts" = yes; then
5673         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5674     fi
5675     with_system_dicts=no
5678 AC_MSG_CHECKING([whether to use dicts from external paths])
5679 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5680     AC_MSG_RESULT([yes])
5681     SYSTEM_DICTS=TRUE
5682     AC_MSG_CHECKING([for spelling dictionary directory])
5683     if test -n "$with_external_dict_dir"; then
5684         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5685     else
5686         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5687         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5688             DICT_SYSTEM_DIR=file:///usr/share/myspell
5689         fi
5690     fi
5691     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5692     AC_MSG_CHECKING([for hyphenation patterns directory])
5693     if test -n "$with_external_hyph_dir"; then
5694         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5695     else
5696         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5697     fi
5698     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5699     AC_MSG_CHECKING([for thesaurus directory])
5700     if test -n "$with_external_thes_dir"; then
5701         THES_SYSTEM_DIR=file://$with_external_thes_dir
5702     else
5703         THES_SYSTEM_DIR=file:///usr/share/mythes
5704     fi
5705     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5706 else
5707     AC_MSG_RESULT([no])
5708     SYSTEM_DICTS=
5710 AC_SUBST(SYSTEM_DICTS)
5711 AC_SUBST(DICT_SYSTEM_DIR)
5712 AC_SUBST(HYPH_SYSTEM_DIR)
5713 AC_SUBST(THES_SYSTEM_DIR)
5715 dnl ===================================================================
5716 dnl Precompiled headers.
5717 ENABLE_PCH=""
5718 AC_MSG_CHECKING([whether to enable pch feature])
5719 if test -z "$enable_pch"; then
5720     if test "$_os" = "WINNT"; then
5721         # Enabled by default on Windows.
5722         enable_pch=yes
5723     else
5724         enable_pch=no
5725     fi
5727 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5728     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5730 if test "$enable_pch" = "system"; then
5731     ENABLE_PCH="1"
5732     AC_MSG_RESULT([yes (system headers)])
5733 elif test "$enable_pch" = "base"; then
5734     ENABLE_PCH="2"
5735     AC_MSG_RESULT([yes (system and base headers)])
5736 elif test "$enable_pch" = "normal"; then
5737     ENABLE_PCH="3"
5738     AC_MSG_RESULT([yes (normal)])
5739 elif test "$enable_pch" = "full"; then
5740     ENABLE_PCH="4"
5741     AC_MSG_RESULT([yes (full)])
5742 elif test "$enable_pch" = "yes"; then
5743     # Pick a suitable default.
5744     if test "$GCC" = "yes"; then
5745         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5746         # while making the PCHs larger and rebuilds more likely.
5747         ENABLE_PCH="2"
5748         AC_MSG_RESULT([yes (system and base headers)])
5749     else
5750         # With MSVC the highest level makes a significant difference,
5751         # and it was the default when there used to be no PCH levels.
5752         ENABLE_PCH="4"
5753         AC_MSG_RESULT([yes (full)])
5754     fi
5755 elif test "$enable_pch" = "no"; then
5756     AC_MSG_RESULT([no])
5757 else
5758     AC_MSG_ERROR([Unknown value for --enable-pch])
5760 AC_SUBST(ENABLE_PCH)
5761 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5762 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5763     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5764     if test "$CCACHE_BIN" != "not found"; then
5765         AC_MSG_CHECKING([ccache version])
5766         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5767         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5768         AC_MSG_RESULT([$CCACHE_VERSION])
5769         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5770         if test "$CCACHE_NUMVER" -gt "030701"; then
5771             AC_MSG_RESULT([yes])
5772         else
5773             AC_MSG_RESULT([no (not newer than 3.7.1)])
5774             CCACHE_DEPEND_MODE=
5775         fi
5776     fi
5779 PCH_INSTANTIATE_TEMPLATES=
5780 if test -n "$ENABLE_PCH"; then
5781     AC_MSG_CHECKING([whether $CC supports -fpch-instantiate-templates])
5782     save_CFLAGS=$CFLAGS
5783     CFLAGS="$CFLAGS -Werror -fpch-instantiate-templates"
5784     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_INSTANTIATE_TEMPLATES="-fpch-instantiate-templates" ],[])
5785     CFLAGS=$save_CFLAGS
5786     if test -n "$PCH_INSTANTIATE_TEMPLATES"; then
5787         AC_MSG_RESULT(yes)
5788     else
5789         AC_MSG_RESULT(no)
5790     fi
5792 AC_SUBST(PCH_INSTANTIATE_TEMPLATES)
5794 BUILDING_PCH_WITH_OBJ=
5795 if test -n "$ENABLE_PCH"; then
5796     AC_MSG_CHECKING([whether $CC supports -Xclang -building-pch-with-obj])
5797     save_CFLAGS=$CFLAGS
5798     CFLAGS="$CFLAGS -Werror -Xclang -building-pch-with-obj"
5799     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ BUILDING_PCH_WITH_OBJ="-Xclang -building-pch-with-obj" ],[])
5800     CFLAGS=$save_CFLAGS
5801     if test -n "$BUILDING_PCH_WITH_OBJ"; then
5802         AC_MSG_RESULT(yes)
5803     else
5804         AC_MSG_RESULT(no)
5805     fi
5807 AC_SUBST(BUILDING_PCH_WITH_OBJ)
5809 PCH_CODEGEN=
5810 PCH_NO_CODEGEN=
5811 if test -n "$BUILDING_PCH_WITH_OBJ"; then
5812     AC_MSG_CHECKING([whether $CC supports -fpch-codegen])
5813     save_CFLAGS=$CFLAGS
5814     CFLAGS="$CFLAGS -Werror -fpch-codegen"
5815     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
5816         [
5817         PCH_CODEGEN="-fpch-codegen"
5818         PCH_NO_CODEGEN="-fno-pch-codegen"
5819         ],[])
5820     CFLAGS=$save_CFLAGS
5821     if test -n "$PCH_CODEGEN"; then
5822         AC_MSG_RESULT(yes)
5823     else
5824         AC_MSG_RESULT(no)
5825     fi
5827 AC_SUBST(PCH_CODEGEN)
5828 AC_SUBST(PCH_NO_CODEGEN)
5829 PCH_DEBUGINFO=
5830 if test -n "$BUILDING_PCH_WITH_OBJ"; then
5831     AC_MSG_CHECKING([whether $CC supports -fpch-debuginfo])
5832     save_CFLAGS=$CFLAGS
5833     CFLAGS="$CFLAGS -Werror -fpch-debuginfo"
5834     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_DEBUGINFO="-fpch-debuginfo" ],[])
5835     CFLAGS=$save_CFLAGS
5836     if test -n "$PCH_DEBUGINFO"; then
5837         AC_MSG_RESULT(yes)
5838     else
5839         AC_MSG_RESULT(no)
5840     fi
5842 AC_SUBST(PCH_DEBUGINFO)
5844 TAB=`printf '\t'`
5846 AC_MSG_CHECKING([the GNU Make version])
5847 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5848 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5849 if test "$_make_longver" -ge "038200"; then
5850     AC_MSG_RESULT([$GNUMAKE $_make_version])
5852 elif test "$_make_longver" -ge "038100"; then
5853     if test "$build_os" = "cygwin"; then
5854         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5855     fi
5856     AC_MSG_RESULT([$GNUMAKE $_make_version])
5858     dnl ===================================================================
5859     dnl Search all the common names for sha1sum
5860     dnl ===================================================================
5861     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5862     if test -z "$SHA1SUM"; then
5863         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5864     elif test "$SHA1SUM" = "openssl"; then
5865         SHA1SUM="openssl sha1"
5866     fi
5867     AC_MSG_CHECKING([for GNU Make bug 20033])
5868     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5869     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5870 A := \$(wildcard *.a)
5872 .PHONY: all
5873 all: \$(A:.a=.b)
5874 <TAB>@echo survived bug20033.
5876 .PHONY: setup
5877 setup:
5878 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5880 define d1
5881 @echo lala \$(1)
5882 @sleep 1
5883 endef
5885 define d2
5886 @echo tyty \$(1)
5887 @sleep 1
5888 endef
5890 %.b : %.a
5891 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5892 <TAB>\$(call d1,\$(CHECKSUM)),\
5893 <TAB>\$(call d2,\$(CHECKSUM)))
5895     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5896         no_parallelism_make="YES"
5897         AC_MSG_RESULT([yes, disable parallelism])
5898     else
5899         AC_MSG_RESULT([no, keep parallelism enabled])
5900     fi
5901     rm -rf $TESTGMAKEBUG20033
5902 else
5903     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5906 # find if gnumake support file function
5907 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5908 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5909 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5910     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5912 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5913 \$(file >test.txt,Success )
5915 .PHONY: all
5916 all:
5917 <TAB>@cat test.txt
5920 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5921 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5922     HAVE_GNUMAKE_FILE_FUNC=TRUE
5923     AC_MSG_RESULT([yes])
5924 else
5925     AC_MSG_RESULT([no])
5927 rm -rf $TESTGMAKEFILEFUNC
5928 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5930 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5931 STALE_MAKE=
5932 if test "$_make_ver_check" = ""; then
5933    STALE_MAKE=TRUE
5936 HAVE_LD_HASH_STYLE=FALSE
5937 WITH_LINKER_HASH_STYLE=
5938 AC_MSG_CHECKING([for --hash-style gcc linker support])
5939 if test "$GCC" = "yes"; then
5940     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5941         hash_styles="gnu sysv"
5942     elif test "$with_linker_hash_style" = "no"; then
5943         hash_styles=
5944     else
5945         hash_styles="$with_linker_hash_style"
5946     fi
5948     for hash_style in $hash_styles; do
5949         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5950         hash_style_ldflags_save=$LDFLAGS
5951         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5953         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5954             [
5955 #include <stdio.h>
5956             ],[
5957 printf ("");
5958             ])],
5959             [
5960                   HAVE_LD_HASH_STYLE=TRUE
5961                   WITH_LINKER_HASH_STYLE=$hash_style
5962             ],
5963             [HAVE_LD_HASH_STYLE=FALSE],
5964             [HAVE_LD_HASH_STYLE=FALSE])
5965         LDFLAGS=$hash_style_ldflags_save
5966     done
5968     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5969         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5970     else
5971         AC_MSG_RESULT( no )
5972     fi
5973     LDFLAGS=$hash_style_ldflags_save
5974 else
5975     AC_MSG_RESULT( no )
5977 AC_SUBST(HAVE_LD_HASH_STYLE)
5978 AC_SUBST(WITH_LINKER_HASH_STYLE)
5980 dnl ===================================================================
5981 dnl Check whether there's a Perl version available.
5982 dnl ===================================================================
5983 if test -z "$with_perl_home"; then
5984     AC_PATH_PROG(PERL, perl)
5985 else
5986     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5987     _perl_path="$with_perl_home/bin/perl"
5988     if test -x "$_perl_path"; then
5989         PERL=$_perl_path
5990     else
5991         AC_MSG_ERROR([$_perl_path not found])
5992     fi
5995 dnl ===================================================================
5996 dnl Testing for Perl version 5 or greater.
5997 dnl $] is the Perl version variable, it is returned as an integer
5998 dnl ===================================================================
5999 if test "$PERL"; then
6000     AC_MSG_CHECKING([the Perl version])
6001     ${PERL} -e "exit($]);"
6002     _perl_version=$?
6003     if test "$_perl_version" -lt 5; then
6004         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
6005     fi
6006     AC_MSG_RESULT([Perl $_perl_version])
6007 else
6008     AC_MSG_ERROR([Perl not found, install Perl 5])
6011 dnl ===================================================================
6012 dnl Testing for required Perl modules
6013 dnl ===================================================================
6015 AC_MSG_CHECKING([for required Perl modules])
6016 perl_use_string="use Cwd ; use Digest::MD5"
6017 if test "$_os" = "WINNT"; then
6018     if test -n "$PKGFORMAT"; then
6019         for i in $PKGFORMAT; do
6020             case "$i" in
6021             msi)
6022                 # for getting fonts versions to use in MSI
6023                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
6024                 ;;
6025             esac
6026         done
6027     fi
6029 if test "$with_system_hsqldb" = "yes"; then
6030     perl_use_string="$perl_use_string ; use Archive::Zip"
6032 if test "$enable_openssl" = "yes" -a "$with_system_openssl" != "yes"; then
6033     # OpenSSL needs that to build
6034     perl_use_string="$perl_use_string ; use FindBin"
6036 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
6037     AC_MSG_RESULT([all modules found])
6038 else
6039     AC_MSG_RESULT([failed to find some modules])
6040     # Find out which modules are missing.
6041     for i in $perl_use_string; do
6042         if test "$i" != "use" -a "$i" != ";"; then
6043             if ! $PERL -e "use $i;">/dev/null 2>&1; then
6044                 missing_perl_modules="$missing_perl_modules $i"
6045             fi
6046         fi
6047     done
6048     AC_MSG_ERROR([
6049     The missing Perl modules are: $missing_perl_modules
6050     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
6053 dnl ===================================================================
6054 dnl Check for pkg-config
6055 dnl ===================================================================
6056 if test "$_os" != "WINNT"; then
6057     PKG_PROG_PKG_CONFIG
6060 if test "$_os" != "WINNT"; then
6062     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
6063     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
6064     # explicitly. Or put /path/to/compiler in PATH yourself.
6066     # Use wrappers for LTO
6067     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
6068         AC_CHECK_TOOL(AR,gcc-ar)
6069         AC_CHECK_TOOL(NM,gcc-nm)
6070         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
6071     else
6072         AC_CHECK_TOOL(AR,ar)
6073         AC_CHECK_TOOL(NM,nm)
6074         AC_CHECK_TOOL(RANLIB,ranlib)
6075     fi
6076     AC_CHECK_TOOL(OBJDUMP,objdump)
6077     AC_CHECK_TOOL(READELF,readelf)
6078     AC_CHECK_TOOL(STRIP,strip)
6079     if test "$_os" = "WINNT"; then
6080         AC_CHECK_TOOL(DLLTOOL,dlltool)
6081         AC_CHECK_TOOL(WINDRES,windres)
6082     fi
6084 AC_SUBST(AR)
6085 AC_SUBST(DLLTOOL)
6086 AC_SUBST(NM)
6087 AC_SUBST(OBJDUMP)
6088 AC_SUBST(PKG_CONFIG)
6089 AC_SUBST(RANLIB)
6090 AC_SUBST(READELF)
6091 AC_SUBST(STRIP)
6092 AC_SUBST(WINDRES)
6094 dnl ===================================================================
6095 dnl pkg-config checks on macOS
6096 dnl ===================================================================
6098 if test $_os = Darwin; then
6099     AC_MSG_CHECKING([for bogus pkg-config])
6100     if test -n "$PKG_CONFIG"; then
6101         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
6102             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
6103         else
6104             if test "$enable_bogus_pkg_config" = "yes"; then
6105                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
6106             else
6107                 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.])
6108             fi
6109         fi
6110     else
6111         AC_MSG_RESULT([no, good])
6112     fi
6115 find_csc()
6117     # Return value: $csctest
6119     unset csctest
6121     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
6122     if test -n "$regvalue"; then
6123         csctest=$regvalue
6124         return
6125     fi
6128 find_al()
6130     # Return value: $altest
6132     unset altest
6134     # We need this check to detect 4.6.1 or above.
6135     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
6136         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
6137         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
6138             altest=$regvalue
6139             return
6140         fi
6141     done
6143     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
6144         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
6145         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
6146             altest=$regvalue
6147             return
6148         fi
6149     done
6152 find_dotnetsdk46()
6154     unset frametest
6156     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
6157         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
6158         if test -n "$regvalue"; then
6159             frametest=$regvalue
6160             return
6161         fi
6162     done
6165 find_winsdk_version()
6167     # Args: $1 : SDK version as in "8.0", "8.1A" etc
6168     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
6170     unset winsdktest winsdkbinsubdir winsdklibsubdir
6172     case "$1" in
6173     8.0|8.0A)
6174         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
6175         if test -n "$regvalue"; then
6176             winsdktest=$regvalue
6177             winsdklibsubdir=win8
6178             return
6179         fi
6180         ;;
6181     8.1|8.1A)
6182         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
6183         if test -n "$regvalue"; then
6184             winsdktest=$regvalue
6185             winsdklibsubdir=winv6.3
6186             return
6187         fi
6188         ;;
6189     10.0)
6190         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
6191         if test -n "$regvalue"; then
6192             winsdktest=$regvalue
6193             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
6194             if test -n "$regvalue"; then
6195                 winsdkbinsubdir="$regvalue".0
6196                 winsdklibsubdir=$winsdkbinsubdir
6197                 local tmppath="$winsdktest\\Include\\$winsdklibsubdir"
6198                 local tmppath_unix=$(cygpath -u "$tmppath")
6199                 # test exist the SDK path
6200                 if test -d "$tmppath_unix"; then
6201                    # when path is convertible to a short path then path is okay
6202                    cygpath -d "$tmppath" >/dev/null 2>&1
6203                    if test $? -ne 0; then
6204                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
6205                    fi
6206                 else
6207                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
6208                 fi
6209             fi
6210             return
6211         fi
6212         ;;
6213     esac
6216 find_winsdk()
6218     # Return value: From find_winsdk_version
6220     unset winsdktest
6222     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
6223         find_winsdk_version $ver
6224         if test -n "$winsdktest"; then
6225             return
6226         fi
6227     done
6230 find_msms()
6232     # Return value: $msmdir
6234     AC_MSG_CHECKING([for MSVC merge modules directory])
6235     local my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
6236     local my_msm_dir
6238     case "$VCVER" in
6239         160)
6240         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
6241         ;;
6242     esac
6243     for f in $my_msm_files; do
6244         echo "$as_me:$LINENO: searching for $f" >&5
6245     done
6247     msmdir=
6248     for ver in 14.0 15.0; do
6249         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
6250         if test -n "$regvalue"; then
6251             for f in ${my_msm_files}; do
6252                 if test -e "$regvalue/${f}"; then
6253                     msmdir=$regvalue
6254                     break
6255                 fi
6256             done
6257         fi
6258     done
6259     dnl Is the following fallback really necessary, or was it added in response
6260     dnl to never having started Visual Studio on a given machine, so the
6261     dnl registry keys checked above had presumably not yet been created?
6262     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
6263     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
6264     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
6265     dnl expanding to "C:\Program Files\Common Files"), which would need
6266     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
6267     dnl obtain its value from cygwin:
6268     if test -z "$msmdir"; then
6269         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
6270         for f in ${my_msm_files}; do
6271             if test -e "$my_msm_dir/${f}"; then
6272                 msmdir=$my_msm_dir
6273             fi
6274         done
6275     fi
6277     dnl Starting from MSVC 15.0, merge modules are located in different directory
6278     case "$VCVER" in
6279     160)
6280         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6281             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
6282             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
6283             for f in ${my_msm_files}; do
6284                 if test -e "$my_msm_dir/${f}"; then
6285                     msmdir=$my_msm_dir
6286                     break
6287                 fi
6288             done
6289         done
6290         ;;
6291     esac
6293     if test -n "$msmdir"; then
6294         msmdir=`cygpath -m "$msmdir"`
6295         AC_MSG_RESULT([$msmdir])
6296     else
6297         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
6298             AC_MSG_FAILURE([not found])
6299         else
6300             AC_MSG_WARN([not found (check config.log)])
6301             add_warning "MSM none of ${my_msm_files} found"
6302         fi
6303     fi
6306 find_msvc_x64_dlls()
6308     # Return value: $msvcdllpath, $msvcdlls
6310     AC_MSG_CHECKING([for MSVC x64 DLL path])
6311     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
6312     case "$VCVER" in
6313     160)
6314         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6315             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
6316             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
6317                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
6318                 break
6319             fi
6320             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
6321             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
6322                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
6323                 break
6324             fi
6325         done
6326         ;;
6327     esac
6328     AC_MSG_RESULT([$msvcdllpath])
6329     AC_MSG_CHECKING([for MSVC x64 DLLs])
6330     msvcdlls="msvcp140.dll vcruntime140.dll"
6331     for dll in $msvcdlls; do
6332         if ! test -f "$msvcdllpath/$dll"; then
6333             AC_MSG_FAILURE([missing $dll])
6334         fi
6335     done
6336     AC_MSG_RESULT([found all ($msvcdlls)])
6339 dnl =========================================
6340 dnl Check for the Windows  SDK.
6341 dnl =========================================
6342 if test "$_os" = "WINNT"; then
6343     AC_MSG_CHECKING([for Windows SDK])
6344     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6345         find_winsdk
6346         WINDOWS_SDK_HOME=$winsdktest
6348         # normalize if found
6349         if test -n "$WINDOWS_SDK_HOME"; then
6350             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
6351             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
6352         fi
6354         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
6355     fi
6357     if test -n "$WINDOWS_SDK_HOME"; then
6358         # Remove a possible trailing backslash
6359         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
6361         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
6362              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
6363              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
6364             have_windows_sdk_headers=yes
6365         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
6366              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
6367              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
6368             have_windows_sdk_headers=yes
6369         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
6370              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
6371              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
6372             have_windows_sdk_headers=yes
6373         else
6374             have_windows_sdk_headers=no
6375         fi
6377         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
6378             have_windows_sdk_libs=yes
6379         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/user32.lib"; then
6380             have_windows_sdk_libs=yes
6381         else
6382             have_windows_sdk_libs=no
6383         fi
6385         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
6386             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
6387 the  Windows SDK are installed.])
6388         fi
6389     fi
6391     if test -z "$WINDOWS_SDK_HOME"; then
6392         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
6393     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
6394         WINDOWS_SDK_VERSION=80
6395         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
6396     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
6397         WINDOWS_SDK_VERSION=81
6398         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
6399     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
6400         WINDOWS_SDK_VERSION=10
6401         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
6402     else
6403         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
6404     fi
6405     PathFormat "$WINDOWS_SDK_HOME"
6406     WINDOWS_SDK_HOME="$formatted_path"
6407     WINDOWS_SDK_HOME_unix="$formatted_path_unix"
6408     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6409         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
6410         if test -d "$WINDOWS_SDK_HOME/include/um"; then
6411             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
6412         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
6413             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
6414         fi
6415     fi
6417     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
6418     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
6419     dnl but not in v8.0), so allow this to be overridden with a
6420     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
6421     dnl and configuration error if no WiLangId.vbs is found would arguably be
6422     dnl better, but I do not know under which conditions exactly it is needed by
6423     dnl msiglobal.pm:
6424     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
6425         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
6426         WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6427         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6428             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WIN_BUILD_ARCH}/WiLangId.vbs"
6429             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6430         fi
6431         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6432             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WIN_BUILD_ARCH/WiLangId.vbs
6433             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6434         fi
6435         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6436             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WIN_BUILD_ARCH/WiLangId.vbs")
6437             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6438         fi
6439     fi
6440     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
6441         if test -n "$with_package_format" -a "$with_package_format" != no; then
6442             for i in "$with_package_format"; do
6443                 if test "$i" = "msi"; then
6444                     if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6445                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
6446                     fi
6447                 fi
6448             done
6449         fi
6450     fi
6452 AC_SUBST(WINDOWS_SDK_HOME)
6453 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
6454 AC_SUBST(WINDOWS_SDK_VERSION)
6455 AC_SUBST(WINDOWS_SDK_WILANGID)
6457 if test "$build_os" = "cygwin"; then
6458     dnl Check midl.exe; this being the first check for a tool in the SDK bin
6459     dnl dir, it also determines that dir's path w/o an arch segment if any,
6460     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
6461     AC_MSG_CHECKING([for midl.exe])
6463     find_winsdk
6464     if test -n "$winsdkbinsubdir" \
6465         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/midl.exe"
6466     then
6467         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH
6468         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
6469     elif test -f "$winsdktest/Bin/$WIN_BUILD_ARCH/midl.exe"; then
6470         MIDL_PATH=$winsdktest/Bin/$WIN_BUILD_ARCH
6471         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
6472     elif test -f "$winsdktest/Bin/midl.exe"; then
6473         MIDL_PATH=$winsdktest/Bin
6474         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
6475     fi
6476     if test ! -f "$MIDL_PATH/midl.exe"; then
6477         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WIN_BUILD_ARCH, Windows SDK installation broken?])
6478     else
6479         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
6480     fi
6482     # Convert to posix path with 8.3 filename restrictions ( No spaces )
6483     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
6485     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
6486          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
6487          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
6488          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
6489     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
6490          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
6491          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6492          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
6493     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
6494          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
6495          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6496          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
6497     else
6498         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
6499     fi
6501     dnl Check csc.exe
6502     AC_MSG_CHECKING([for csc.exe])
6503     find_csc
6504     if test -f "$csctest/csc.exe"; then
6505         CSC_PATH="$csctest"
6506     fi
6507     if test ! -f "$CSC_PATH/csc.exe"; then
6508         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
6509     else
6510         AC_MSG_RESULT([$CSC_PATH/csc.exe])
6511     fi
6513     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
6515     dnl Check al.exe
6516     AC_MSG_CHECKING([for al.exe])
6517     find_winsdk
6518     if test -n "$winsdkbinsubdir" \
6519         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/al.exe"
6520     then
6521         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH"
6522     elif test -f "$winsdktest/Bin/$WIN_BUILD_ARCH/al.exe"; then
6523         AL_PATH="$winsdktest/Bin/$WIN_BUILD_ARCH"
6524     elif test -f "$winsdktest/Bin/al.exe"; then
6525         AL_PATH="$winsdktest/Bin"
6526     fi
6528     if test -z "$AL_PATH"; then
6529         find_al
6530         if test -f "$altest/bin/al.exe"; then
6531             AL_PATH="$altest/bin"
6532         elif test -f "$altest/al.exe"; then
6533             AL_PATH="$altest"
6534         fi
6535     fi
6536     if test ! -f "$AL_PATH/al.exe"; then
6537         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
6538     else
6539         AC_MSG_RESULT([$AL_PATH/al.exe])
6540     fi
6542     AL_PATH=`win_short_path_for_make "$AL_PATH"`
6544     dnl Check mscoree.lib / .NET Framework dir
6545     AC_MSG_CHECKING(.NET Framework)
6546     find_dotnetsdk46
6547     PathFormat "$frametest"
6548     frametest="$formatted_path"
6549     if test -f "$frametest/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6550         DOTNET_FRAMEWORK_HOME="$frametest"
6551     else
6552         find_winsdk
6553         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6554             DOTNET_FRAMEWORK_HOME="$winsdktest"
6555         fi
6556     fi
6557     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
6558         AC_MSG_ERROR([mscoree.lib not found])
6559     fi
6560     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
6562     PathFormat "$MIDL_PATH"
6563     MIDL_PATH="$formatted_path"
6565     PathFormat "$AL_PATH"
6566     AL_PATH="$formatted_path"
6568     PathFormat "$DOTNET_FRAMEWORK_HOME"
6569     DOTNET_FRAMEWORK_HOME="$formatted_path"
6571     PathFormat "$CSC_PATH"
6572     CSC_PATH="$formatted_path"
6575 dnl ===================================================================
6576 dnl Testing for C++ compiler and version...
6577 dnl ===================================================================
6579 if test "$_os" != "WINNT"; then
6580     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
6581     save_CXXFLAGS=$CXXFLAGS
6582     AC_PROG_CXX
6583     CXXFLAGS=$save_CXXFLAGS
6584     if test -z "$CXX_BASE"; then
6585         CXX_BASE=`first_arg_basename "$CXX"`
6586     fi
6589 dnl check for GNU C++ compiler version
6590 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
6591     AC_MSG_CHECKING([the GNU C++ compiler version])
6593     _gpp_version=`$CXX -dumpversion`
6594     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
6596     if test "$_gpp_majmin" -lt "700"; then
6597         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
6598     else
6599         AC_MSG_RESULT([ok (g++ $_gpp_version)])
6600     fi
6602     dnl see https://code.google.com/p/android/issues/detail?id=41770
6603         glibcxx_threads=no
6604         AC_LANG_PUSH([C++])
6605         AC_REQUIRE_CPP
6606         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
6607         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
6608             #include <bits/c++config.h>]],[[
6609             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
6610             && !defined(_GLIBCXX__PTHREADS) \
6611             && !defined(_GLIBCXX_HAS_GTHREADS)
6612             choke me
6613             #endif
6614         ]])],[AC_MSG_RESULT([yes])
6615         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
6616         AC_LANG_POP([C++])
6617         if test $glibcxx_threads = yes; then
6618             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
6619         fi
6621 AC_SUBST(BOOST_CXXFLAGS)
6624 # prefx CXX with ccache if needed
6626 if test "$CCACHE" != ""; then
6627     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
6628     AC_LANG_PUSH([C++])
6629     save_CXXFLAGS=$CXXFLAGS
6630     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
6631     dnl an empty program will do, we're checking the compiler flags
6632     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
6633                       [use_ccache=yes], [use_ccache=no])
6634     if test $use_ccache = yes; then
6635         AC_MSG_RESULT([yes])
6636     else
6637         CXX="$CCACHE $CXX"
6638         CXX_BASE="ccache $CXX_BASE"
6639         AC_MSG_RESULT([no])
6640     fi
6641     CXXFLAGS=$save_CXXFLAGS
6642     AC_LANG_POP([C++])
6645 dnl ===================================================================
6646 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
6647 dnl ===================================================================
6649 if test "$_os" != "WINNT"; then
6650     AC_PROG_CXXCPP
6652     dnl Check whether there's a C pre-processor.
6653     AC_PROG_CPP
6657 dnl ===================================================================
6658 dnl Find integral type sizes and alignments
6659 dnl ===================================================================
6661 if test "$_os" != "WINNT"; then
6663     AC_CHECK_SIZEOF(long)
6664     AC_CHECK_SIZEOF(short)
6665     AC_CHECK_SIZEOF(int)
6666     AC_CHECK_SIZEOF(long long)
6667     AC_CHECK_SIZEOF(double)
6668     AC_CHECK_SIZEOF(void*)
6670     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
6671     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
6672     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
6673     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
6674     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6676     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6677     m4_pattern_allow([AC_CHECK_ALIGNOF])
6678     m4_ifdef([AC_CHECK_ALIGNOF],
6679         [
6680             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6681             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6682             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6683             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6684         ],
6685         [
6686             case "$_os-$host_cpu" in
6687             Linux-i686)
6688                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6689                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6690                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6691                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6692                 ;;
6693             Linux-x86_64)
6694                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6695                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6696                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6697                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6698                 ;;
6699             *)
6700                 if test -z "$ac_cv_alignof_short" -o \
6701                         -z "$ac_cv_alignof_int" -o \
6702                         -z "$ac_cv_alignof_long" -o \
6703                         -z "$ac_cv_alignof_double"; then
6704                    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.])
6705                 fi
6706                 ;;
6707             esac
6708         ])
6710     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6711     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6712     if test $ac_cv_sizeof_long -eq 8; then
6713         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6714     elif test $ac_cv_sizeof_double -eq 8; then
6715         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6716     else
6717         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6718     fi
6720     dnl Check for large file support
6721     AC_SYS_LARGEFILE
6722     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6723         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6724     fi
6725     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6726         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6727     fi
6728 else
6729     # Hardcode for MSVC
6730     SAL_TYPES_SIZEOFSHORT=2
6731     SAL_TYPES_SIZEOFINT=4
6732     SAL_TYPES_SIZEOFLONG=4
6733     SAL_TYPES_SIZEOFLONGLONG=8
6734     if test $WIN_HOST_BITS -eq 32; then
6735         SAL_TYPES_SIZEOFPOINTER=4
6736     else
6737         SAL_TYPES_SIZEOFPOINTER=8
6738     fi
6739     SAL_TYPES_ALIGNMENT2=2
6740     SAL_TYPES_ALIGNMENT4=4
6741     SAL_TYPES_ALIGNMENT8=8
6742     LFS_CFLAGS=''
6744 AC_SUBST(LFS_CFLAGS)
6746 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6747 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6748 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6749 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6750 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6751 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6752 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6753 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6755 dnl ===================================================================
6756 dnl Check whether to enable runtime optimizations
6757 dnl ===================================================================
6758 ENABLE_RUNTIME_OPTIMIZATIONS=
6759 AC_MSG_CHECKING([whether to enable runtime optimizations])
6760 if test -z "$enable_runtime_optimizations"; then
6761     for i in $CC; do
6762         case $i in
6763         -fsanitize=*)
6764             enable_runtime_optimizations=no
6765             break
6766             ;;
6767         esac
6768     done
6770 if test "$enable_runtime_optimizations" != no; then
6771     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6772     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6773     AC_MSG_RESULT([yes])
6774 else
6775     AC_MSG_RESULT([no])
6777 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6779 dnl ===================================================================
6780 dnl Check if valgrind headers are available
6781 dnl ===================================================================
6782 ENABLE_VALGRIND=
6783 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6784     prev_cppflags=$CPPFLAGS
6785     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6786     # or where does it come from?
6787     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6788     AC_CHECK_HEADER([valgrind/valgrind.h],
6789         [ENABLE_VALGRIND=TRUE])
6790     CPPFLAGS=$prev_cppflags
6792 AC_SUBST([ENABLE_VALGRIND])
6793 if test -z "$ENABLE_VALGRIND"; then
6794     if test "$with_valgrind" = yes; then
6795         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6796     fi
6797     VALGRIND_CFLAGS=
6799 AC_SUBST([VALGRIND_CFLAGS])
6802 dnl ===================================================================
6803 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6804 dnl ===================================================================
6806 # We need at least the sys/sdt.h include header.
6807 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6808 if test "$SDT_H_FOUND" = "TRUE"; then
6809     # Found sys/sdt.h header, now make sure the c++ compiler works.
6810     # Old g++ versions had problems with probes in constructors/destructors.
6811     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6812     AC_LANG_PUSH([C++])
6813     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6814     #include <sys/sdt.h>
6815     class ProbeClass
6816     {
6817     private:
6818       int& ref;
6819       const char *name;
6821     public:
6822       ProbeClass(int& v, const char *n) : ref(v), name(n)
6823       {
6824         DTRACE_PROBE2(_test_, cons, name, ref);
6825       }
6827       void method(int min)
6828       {
6829         DTRACE_PROBE3(_test_, meth, name, ref, min);
6830         ref -= min;
6831       }
6833       ~ProbeClass()
6834       {
6835         DTRACE_PROBE2(_test_, dest, name, ref);
6836       }
6837     };
6838     ]],[[
6839     int i = 64;
6840     DTRACE_PROBE1(_test_, call, i);
6841     ProbeClass inst = ProbeClass(i, "call");
6842     inst.method(24);
6843     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6844           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6845     AC_LANG_POP([C++])
6847 AC_CONFIG_HEADERS([config_host/config_probes.h])
6849 dnl ===================================================================
6850 dnl GCC features
6851 dnl ===================================================================
6852 HAVE_GCC_STACK_CLASH_PROTECTION=
6853 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6854     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
6855     save_CFLAGS=$CFLAGS
6856     CFLAGS="$CFLAGS -Werror -fstack-clash-protection"
6857     AC_LINK_IFELSE(
6858         [AC_LANG_PROGRAM(, [[return 0;]])],
6859         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
6860         [AC_MSG_RESULT([no])])
6861     CFLAGS=$save_CFLAGS
6863     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6864     save_CFLAGS=$CFLAGS
6865     CFLAGS="$CFLAGS -Werror -mno-avx"
6866     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6867     CFLAGS=$save_CFLAGS
6868     if test "$HAVE_GCC_AVX" = "TRUE"; then
6869         AC_MSG_RESULT([yes])
6870     else
6871         AC_MSG_RESULT([no])
6872     fi
6874     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
6875     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6876     int v = 0;
6877     if (__sync_add_and_fetch(&v, 1) != 1 ||
6878         __sync_sub_and_fetch(&v, 1) != 0)
6879         return 1;
6880     __sync_synchronize();
6881     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6882         v != 1)
6883         return 1;
6884     return 0;
6885 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6886     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6887         AC_MSG_RESULT([yes])
6888         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6889     else
6890         AC_MSG_RESULT([no])
6891     fi
6893     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
6894     AC_LANG_PUSH([C++])
6895     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6896             #include <cstddef>
6897             #include <cxxabi.h>
6898             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6899         ])], [
6900             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6901             AC_MSG_RESULT([yes])
6902         ], [AC_MSG_RESULT([no])])
6903     AC_LANG_POP([C++])
6905     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
6906     AC_LANG_PUSH([C++])
6907     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6908             #include <cstddef>
6909             #include <cxxabi.h>
6910             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6911         ])], [
6912             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6913             AC_MSG_RESULT([yes])
6914         ], [AC_MSG_RESULT([no])])
6915     AC_LANG_POP([C++])
6917     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
6918     AC_LANG_PUSH([C++])
6919     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6920             #include <cxxabi.h>
6921             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6922         ])], [
6923             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6924             AC_MSG_RESULT([yes])
6925         ], [AC_MSG_RESULT([no])])
6926     AC_LANG_POP([C++])
6928     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
6929     AC_LANG_PUSH([C++])
6930     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6931             #include <cstddef>
6932             #include <cxxabi.h>
6933             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6934         ])], [
6935             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6936             AC_MSG_RESULT([yes])
6937         ], [AC_MSG_RESULT([no])])
6938     AC_LANG_POP([C++])
6940     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exception in cxxabi.h])
6941     AC_LANG_PUSH([C++])
6942     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6943             #include <cstddef>
6944             #include <cxxabi.h>
6945             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exception); }
6946         ])], [
6947             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTION],[1])
6948             AC_MSG_RESULT([yes])
6949         ], [AC_MSG_RESULT([no])])
6950     AC_LANG_POP([C++])
6952     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
6953     AC_LANG_PUSH([C++])
6954     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6955             #include <cxxabi.h>
6956             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6957         ])], [
6958             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6959             AC_MSG_RESULT([yes])
6960         ], [AC_MSG_RESULT([no])])
6961     AC_LANG_POP([C++])
6963     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
6964     AC_LANG_PUSH([C++])
6965     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6966             #include <cxxabi.h>
6967             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6968         ])], [
6969             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6970             AC_MSG_RESULT([yes])
6971         ], [AC_MSG_RESULT([no])])
6972     AC_LANG_POP([C++])
6974     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
6975     AC_LANG_PUSH([C++])
6976     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6977             #include <cxxabi.h>
6978             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6979         ])], [
6980             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6981             AC_MSG_RESULT([yes])
6982         ], [AC_MSG_RESULT([no])])
6983     AC_LANG_POP([C++])
6985     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
6986     AC_LANG_PUSH([C++])
6987     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6988             #include <cstddef>
6989             #include <cxxabi.h>
6990             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6991         ])], [
6992             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6993             AC_MSG_RESULT([yes])
6994         ], [AC_MSG_RESULT([no])])
6995     AC_LANG_POP([C++])
6997     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
6998     AC_LANG_PUSH([C++])
6999     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7000             #include <cstddef>
7001             #include <cxxabi.h>
7002             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
7003         ])], [
7004             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
7005             AC_MSG_RESULT([yes])
7006         ], [AC_MSG_RESULT([no])])
7007     AC_LANG_POP([C++])
7010 AC_SUBST(HAVE_GCC_AVX)
7011 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
7012 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
7014 dnl ===================================================================
7015 dnl Identify the C++ library
7016 dnl ===================================================================
7018 AC_MSG_CHECKING([what the C++ library is])
7019 AC_LANG_PUSH([C++])
7020 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7021 #include <utility>
7022 #ifndef __GLIBCXX__
7023 foo bar
7024 #endif
7025 ]])],
7026     [CPP_LIBRARY=GLIBCXX
7027      cpp_library_name="GNU libstdc++"
7028     ],
7029     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7030 #include <utility>
7031 #ifndef _LIBCPP_VERSION
7032 foo bar
7033 #endif
7034 ]])],
7035     [CPP_LIBRARY=LIBCPP
7036      cpp_library_name="LLVM libc++"
7037      AC_DEFINE([HAVE_LIBCXX])
7038     ],
7039     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7040 #include <utility>
7041 #ifndef _MSC_VER
7042 foo bar
7043 #endif
7044 ]])],
7045     [CPP_LIBRARY=MSVCRT
7046      cpp_library_name="Microsoft"
7047     ],
7048     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
7049 AC_MSG_RESULT([$cpp_library_name])
7050 AC_LANG_POP([C++])
7052 dnl ===================================================================
7053 dnl Check for gperf
7054 dnl ===================================================================
7055 AC_PATH_PROG(GPERF, gperf)
7056 if test -z "$GPERF"; then
7057     AC_MSG_ERROR([gperf not found but needed. Install it.])
7059 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7060     GPERF=`cygpath -m $GPERF`
7062 AC_MSG_CHECKING([whether gperf is new enough])
7063 my_gperf_ver1=$($GPERF --version | head -n 1)
7064 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
7065 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
7066 if test "$my_gperf_ver3" -ge 301; then
7067     AC_MSG_RESULT([yes ($my_gperf_ver2)])
7068 else
7069     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
7071 AC_SUBST(GPERF)
7073 dnl ===================================================================
7074 dnl Check for system libcmis
7075 dnl ===================================================================
7076 # libcmis requires curl and we can't build curl for iOS
7077 if test $_os != iOS; then
7078     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
7079     ENABLE_LIBCMIS=TRUE
7080 else
7081     ENABLE_LIBCMIS=
7083 AC_SUBST(ENABLE_LIBCMIS)
7085 dnl ===================================================================
7086 dnl C++11
7087 dnl ===================================================================
7089 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
7090 CXXFLAGS_CXX11=
7091 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
7092     if test "$with_latest_c__" = yes; then
7093         CXXFLAGS_CXX11=-std:c++latest
7094     else
7095         CXXFLAGS_CXX11=-std:c++17
7096     fi
7097     CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -Zc:__cplusplus"
7098 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7099     my_flags='-std=c++17 -std=c++1z'
7100     if test "$with_latest_c__" = yes; then
7101         my_flags="-std=c++20 -std=c++2a $my_flags"
7102     fi
7103     for flag in $my_flags; do
7104         if test "$COM" = MSC; then
7105             flag="-Xclang $flag"
7106         fi
7107         save_CXXFLAGS=$CXXFLAGS
7108         CXXFLAGS="$CXXFLAGS $flag -Werror"
7109         if test "$SYSTEM_LIBCMIS" = TRUE; then
7110             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
7111         fi
7112         AC_LANG_PUSH([C++])
7113         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7114             #include <algorithm>
7115             #include <functional>
7116             #include <vector>
7118             #if defined SYSTEM_LIBCMIS
7119             // See ucb/source/ucp/cmis/auth_provider.hxx:
7120             #if !defined __clang__
7121             #pragma GCC diagnostic push
7122             #pragma GCC diagnostic ignored "-Wdeprecated"
7123             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
7124             #endif
7125             #include <libcmis/libcmis.hxx>
7126             #if !defined __clang__
7127             #pragma GCC diagnostic pop
7128             #endif
7129             #endif
7131             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
7132                 std::sort(v.begin(), v.end(), fn);
7133             }
7134             ]])],[CXXFLAGS_CXX11=$flag])
7135         AC_LANG_POP([C++])
7136         CXXFLAGS=$save_CXXFLAGS
7137         if test -n "$CXXFLAGS_CXX11"; then
7138             break
7139         fi
7140     done
7142 if test -n "$CXXFLAGS_CXX11"; then
7143     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
7144 else
7145     AC_MSG_ERROR(no)
7147 AC_SUBST(CXXFLAGS_CXX11)
7149 if test "$GCC" = "yes"; then
7150     save_CXXFLAGS=$CXXFLAGS
7151     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7152     CHECK_L_ATOMIC
7153     CXXFLAGS=$save_CXXFLAGS
7154     AC_SUBST(ATOMIC_LIB)
7157 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
7158 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
7159 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
7160 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
7161 dnl again towards 4.7.2:
7162 if test $CPP_LIBRARY = GLIBCXX; then
7163     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
7164     AC_LANG_PUSH([C++])
7165     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7166 #include <list>
7167 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
7168     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
7169     //   GCC 4.7.0: 20120322
7170     //   GCC 4.7.1: 20120614
7171     // and using a range check is not possible as the mapping between
7172     // __GLIBCXX__ values and GCC versions is not monotonic
7173 /* ok */
7174 #else
7175 abi broken
7176 #endif
7177         ]])], [AC_MSG_RESULT(no, ok)],
7178         [AC_MSG_ERROR(yes)])
7179     AC_LANG_POP([C++])
7182 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
7183 save_CXXFLAGS=$CXXFLAGS
7184 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7185 AC_LANG_PUSH([C++])
7187 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7188 #include <stddef.h>
7190 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
7192 namespace
7194         struct b
7195         {
7196                 int i;
7197                 int j;
7198         };
7200 ]], [[
7201 struct a
7203         int i;
7204         int j;
7206 a thinga[]={{0,0}, {1,1}};
7207 b thingb[]={{0,0}, {1,1}};
7208 size_t i = sizeof(sal_n_array_size(thinga));
7209 size_t j = sizeof(sal_n_array_size(thingb));
7210 return !(i != 0 && j != 0);
7212     ], [ AC_MSG_RESULT(yes) ],
7213     [ AC_MSG_ERROR(no)])
7214 AC_LANG_POP([C++])
7215 CXXFLAGS=$save_CXXFLAGS
7217 HAVE_GCC_FNO_SIZED_DEALLOCATION=
7218 if test "$GCC" = yes; then
7219     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
7220     AC_LANG_PUSH([C++])
7221     save_CXXFLAGS=$CXXFLAGS
7222     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
7223     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
7224     CXXFLAGS=$save_CXXFLAGS
7225     AC_LANG_POP([C++])
7226     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
7227         AC_MSG_RESULT([yes])
7228     else
7229         AC_MSG_RESULT([no])
7230     fi
7232 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
7234 AC_MSG_CHECKING([whether $CXX_BASE supports a working C++20 consteval])
7235 dnl ...that does not suffer from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96994> "Missing code
7236 dnl from consteval constructor initializing const variable":
7237 AC_LANG_PUSH([C++])
7238 save_CXXFLAGS=$CXXFLAGS
7239 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7240 AC_RUN_IFELSE([AC_LANG_PROGRAM([
7241         struct S {
7242             consteval S() { i = 1; }
7243             int i = 0;
7244         };
7245         S const s;
7246     ], [
7247         return (s.i == 1) ? 0 : 1;
7248     ])], [
7249         AC_DEFINE([HAVE_CPP_CONSTEVAL],[1])
7250         AC_MSG_RESULT([yes])
7251     ], [AC_MSG_RESULT([no])], [AC_MSG_RESULT([assumed no (cross compiling)])])
7252 CXXFLAGS=$save_CXXFLAGS
7253 AC_LANG_POP([C++])
7255 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
7256 AC_LANG_PUSH([C++])
7257 save_CXXFLAGS=$CXXFLAGS
7258 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7259 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7260         #include <algorithm>
7261         #include <initializer_list>
7262         #include <vector>
7263         template<typename T> class S {
7264         private:
7265             std::vector<T> v_;
7266         public:
7267             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
7268         };
7269         constinit S<int> s{3, 2, 1};
7270     ])], [
7271         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
7272         AC_MSG_RESULT([yes])
7273     ], [AC_MSG_RESULT([no])])
7274 CXXFLAGS=$save_CXXFLAGS
7275 AC_LANG_POP([C++])
7277 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
7278 AC_LANG_PUSH([C++])
7279 save_CXXFLAGS=$CXXFLAGS
7280 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7281 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7282         #include <span>
7283         #include <type_traits>
7284         // Don't check size_type directly, as it was called index_type before P1872R0:
7285         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
7286     ])], [
7287         AC_DEFINE([HAVE_CPP_SPAN],[1])
7288         AC_MSG_RESULT([yes])
7289     ], [AC_MSG_RESULT([no])])
7290 CXXFLAGS=$save_CXXFLAGS
7291 AC_LANG_POP([C++])
7293 AC_MSG_CHECKING([whether $CXX_BASE implements C++ DR P1155R3])
7294 AC_LANG_PUSH([C++])
7295 save_CXXFLAGS=$CXXFLAGS
7296 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7297 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7298         struct S1 { S1(S1 &&); };
7299         struct S2: S1 {};
7300         S1 f(S2 s) { return s; }
7301     ])], [
7302         AC_DEFINE([HAVE_P1155R3],[1])
7303         AC_MSG_RESULT([yes])
7304     ], [AC_MSG_RESULT([no])])
7305 CXXFLAGS=$save_CXXFLAGS
7306 AC_LANG_POP([C++])
7308 dnl Supported since GCC 9 and Clang 10 (which each also started to support -Wdeprecated-copy, but
7309 dnl which is included in -Wextra anyway):
7310 HAVE_WDEPRECATED_COPY_DTOR=
7311 if test "$GCC" = yes; then
7312     AC_MSG_CHECKING([whether $CXX_BASE supports -Wdeprecated-copy-dtor])
7313     AC_LANG_PUSH([C++])
7314     save_CXXFLAGS=$CXXFLAGS
7315     CXXFLAGS="$CXXFLAGS -Werror -Wdeprecated-copy-dtor"
7316     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
7317             HAVE_WDEPRECATED_COPY_DTOR=TRUE
7318             AC_MSG_RESULT([yes])
7319         ], [AC_MSG_RESULT([no])])
7320     CXXFLAGS=$save_CXXFLAGS
7321     AC_LANG_POP([C++])
7323 AC_SUBST([HAVE_WDEPRECATED_COPY_DTOR])
7325 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
7326 dnl uninitialized warning for code like
7328 dnl   OString f();
7329 dnl   boost::optional<OString> * g(bool b) {
7330 dnl       boost::optional<OString> o;
7331 dnl       if (b) o = f();
7332 dnl       return new boost::optional<OString>(o);
7333 dnl   }
7335 dnl (as is e.g. present, in a slightly more elaborate form, in
7336 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
7337 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
7338 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
7339 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7340     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
7341     AC_LANG_PUSH([C++])
7342     save_CXXFLAGS=$CXXFLAGS
7343     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
7344     if test "$ENABLE_OPTIMIZED" = TRUE; then
7345         CXXFLAGS="$CXXFLAGS -O2"
7346     else
7347         CXXFLAGS="$CXXFLAGS -O0"
7348     fi
7349     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7350             #include <new>
7351             void f1(int);
7352             struct S1 {
7353                 ~S1() { f1(n); }
7354                 int n = 0;
7355             };
7356             struct S2 {
7357                 S2() {}
7358                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
7359                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
7360                 void set(S1 s) {
7361                     new (stg) S1(s);
7362                     init = true;
7363                 }
7364                 bool init = false;
7365                 char stg[sizeof (S1)];
7366             } ;
7367             S1 f2();
7368             S2 * f3(bool b) {
7369                 S2 o;
7370                 if (b) o.set(f2());
7371                 return new S2(o);
7372             }
7373         ]])], [AC_MSG_RESULT([no])], [
7374             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
7375             AC_MSG_RESULT([yes])
7376         ])
7377     CXXFLAGS=$save_CXXFLAGS
7378     AC_LANG_POP([C++])
7380 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
7382 dnl Check for <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c5> "[8/9/10/11 Regression]
7383 dnl -Wstringop-overflow false positive due to using MEM_REF type of &MEM" (fixed in GCC 11), which
7384 dnl hits us e.g. with GCC 10 and --enable-optimized at
7386 dnl   In file included from include/rtl/string.hxx:49,
7387 dnl                    from include/rtl/ustring.hxx:43,
7388 dnl                    from include/osl/file.hxx:35,
7389 dnl                    from include/codemaker/global.hxx:28,
7390 dnl                    from include/codemaker/options.hxx:23,
7391 dnl                    from codemaker/source/commoncpp/commoncpp.cxx:24:
7392 dnl   In function â€˜char* rtl::addDataHelper(char*, const char*, std::size_t)’,
7393 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,
7394 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,
7395 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,
7396 dnl       inlined from â€˜rtl::OString codemaker::cpp::scopedCppName(const rtl::OString&, bool)’ at codemaker/source/commoncpp/commoncpp.cxx:53:55:
7397 dnl   include/rtl/stringconcat.hxx:78:15: error: writing 2 bytes into a region of size 1 [-Werror=stringop-overflow=]
7398 dnl      78 |         memcpy( buffer, data, length );
7399 dnl         |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
7400 HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=
7401 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7402     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=stringop-overflow=])
7403     AC_LANG_PUSH([C++])
7404     save_CXXFLAGS=$CXXFLAGS
7405     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wstringop-overflow"
7406     if test "$ENABLE_OPTIMIZED" = TRUE; then
7407         CXXFLAGS="$CXXFLAGS -O2"
7408     else
7409         CXXFLAGS="$CXXFLAGS -O0"
7410     fi
7411     dnl Test code taken from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c0>:
7412     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7413             void fill(char const * begin, char const * end, char c);
7414             struct q {
7415                 char ids[4];
7416                 char username[6];
7417             };
7418             void test(q & c) {
7419                 fill(c.ids, c.ids + sizeof(c.ids), '\0');
7420                 __builtin_strncpy(c.username, "root", sizeof(c.username));
7421             }
7422         ]])], [AC_MSG_RESULT([no])], [
7423             HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=TRUE
7424             AC_MSG_RESULT([yes])
7425         ])
7426     CXXFLAGS=$save_CXXFLAGS
7427     AC_LANG_POP([C++])
7429 AC_SUBST([HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW])
7431 dnl ===================================================================
7432 dnl CPU Intrinsics support - SSE, AVX
7433 dnl ===================================================================
7435 CXXFLAGS_INTRINSICS_SSE2=
7436 CXXFLAGS_INTRINSICS_SSSE3=
7437 CXXFLAGS_INTRINSICS_SSE41=
7438 CXXFLAGS_INTRINSICS_SSE42=
7439 CXXFLAGS_INTRINSICS_AVX=
7440 CXXFLAGS_INTRINSICS_AVX2=
7441 CXXFLAGS_INTRINSICS_AVX512=
7442 CXXFLAGS_INTRINSICS_F16C=
7443 CXXFLAGS_INTRINSICS_FMA=
7445 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7446     # GCC, Clang or Clang-cl (clang-cl + MSVC's -arch options don't work well together)
7447     flag_sse2=-msse2
7448     flag_ssse3=-mssse3
7449     flag_sse41=-msse4.1
7450     flag_sse42=-msse4.2
7451     flag_avx=-mavx
7452     flag_avx2=-mavx2
7453     flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
7454     flag_f16c=-mf16c
7455     flag_fma=-mfma
7456 else
7457     # https://docs.microsoft.com/en-us/cpp/build/reference/arch-x86
7458     # MSVC seems to differentiate only between SSE and SSE2, where in fact
7459     # SSE2 seems to be SSE2+.
7460     # Even if -arch:SSE2 is the default, set it explicitly, so that the variable
7461     # is not empty (and can be tested in gbuild).
7462     flag_sse2=-arch:SSE2
7463     flag_ssse3=-arch:SSE2
7464     flag_sse41=-arch:SSE2
7465     flag_sse42=-arch:SSE2
7466     flag_avx=-arch:AVX
7467     flag_avx2=-arch:AVX2
7468     flag_avx512=-arch:AVX512
7469     # These are part of -arch:AVX2
7470     flag_f16c=-arch:AVX2
7471     flag_fma=-arch:AVX2
7474 AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
7475 AC_LANG_PUSH([C++])
7476 save_CXXFLAGS=$CXXFLAGS
7477 CXXFLAGS="$CXXFLAGS $flag_sse2"
7478 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7479     #include <emmintrin.h>
7480     int main () {
7481         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7482         c = _mm_xor_si128 (a, b);
7483         return 0;
7484     }
7485     ])],
7486     [can_compile_sse2=yes],
7487     [can_compile_sse2=no])
7488 AC_LANG_POP([C++])
7489 CXXFLAGS=$save_CXXFLAGS
7490 AC_MSG_RESULT([${can_compile_sse2}])
7491 if test "${can_compile_sse2}" = "yes" ; then
7492     CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
7495 AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
7496 AC_LANG_PUSH([C++])
7497 save_CXXFLAGS=$CXXFLAGS
7498 CXXFLAGS="$CXXFLAGS $flag_ssse3"
7499 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7500     #include <tmmintrin.h>
7501     int main () {
7502         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7503         c = _mm_maddubs_epi16 (a, b);
7504         return 0;
7505     }
7506     ])],
7507     [can_compile_ssse3=yes],
7508     [can_compile_ssse3=no])
7509 AC_LANG_POP([C++])
7510 CXXFLAGS=$save_CXXFLAGS
7511 AC_MSG_RESULT([${can_compile_ssse3}])
7512 if test "${can_compile_ssse3}" = "yes" ; then
7513     CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
7516 AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
7517 AC_LANG_PUSH([C++])
7518 save_CXXFLAGS=$CXXFLAGS
7519 CXXFLAGS="$CXXFLAGS $flag_sse41"
7520 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7521     #include <smmintrin.h>
7522     int main () {
7523         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7524         c = _mm_cmpeq_epi64 (a, b);
7525         return 0;
7526     }
7527     ])],
7528     [can_compile_sse41=yes],
7529     [can_compile_sse41=no])
7530 AC_LANG_POP([C++])
7531 CXXFLAGS=$save_CXXFLAGS
7532 AC_MSG_RESULT([${can_compile_sse41}])
7533 if test "${can_compile_sse41}" = "yes" ; then
7534     CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
7537 AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
7538 AC_LANG_PUSH([C++])
7539 save_CXXFLAGS=$CXXFLAGS
7540 CXXFLAGS="$CXXFLAGS $flag_sse42"
7541 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7542     #include <nmmintrin.h>
7543     int main () {
7544         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7545         c = _mm_cmpgt_epi64 (a, b);
7546         return 0;
7547     }
7548     ])],
7549     [can_compile_sse42=yes],
7550     [can_compile_sse42=no])
7551 AC_LANG_POP([C++])
7552 CXXFLAGS=$save_CXXFLAGS
7553 AC_MSG_RESULT([${can_compile_sse42}])
7554 if test "${can_compile_sse42}" = "yes" ; then
7555     CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
7558 AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
7559 AC_LANG_PUSH([C++])
7560 save_CXXFLAGS=$CXXFLAGS
7561 CXXFLAGS="$CXXFLAGS $flag_avx"
7562 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7563     #include <immintrin.h>
7564     int main () {
7565         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
7566         c = _mm256_xor_ps(a, b);
7567         return 0;
7568     }
7569     ])],
7570     [can_compile_avx=yes],
7571     [can_compile_avx=no])
7572 AC_LANG_POP([C++])
7573 CXXFLAGS=$save_CXXFLAGS
7574 AC_MSG_RESULT([${can_compile_avx}])
7575 if test "${can_compile_avx}" = "yes" ; then
7576     CXXFLAGS_INTRINSICS_AVX="$flag_avx"
7579 AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
7580 AC_LANG_PUSH([C++])
7581 save_CXXFLAGS=$CXXFLAGS
7582 CXXFLAGS="$CXXFLAGS $flag_avx2"
7583 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7584     #include <immintrin.h>
7585     int main () {
7586         __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
7587         c = _mm256_maddubs_epi16(a, b);
7588         return 0;
7589     }
7590     ])],
7591     [can_compile_avx2=yes],
7592     [can_compile_avx2=no])
7593 AC_LANG_POP([C++])
7594 CXXFLAGS=$save_CXXFLAGS
7595 AC_MSG_RESULT([${can_compile_avx2}])
7596 if test "${can_compile_avx2}" = "yes" ; then
7597     CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
7600 AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
7601 AC_LANG_PUSH([C++])
7602 save_CXXFLAGS=$CXXFLAGS
7603 CXXFLAGS="$CXXFLAGS $flag_avx512"
7604 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7605     #include <immintrin.h>
7606     int main () {
7607         __m512i a = _mm512_loadu_si512(0);
7608         return 0;
7609     }
7610     ])],
7611     [can_compile_avx512=yes],
7612     [can_compile_avx512=no])
7613 AC_LANG_POP([C++])
7614 CXXFLAGS=$save_CXXFLAGS
7615 AC_MSG_RESULT([${can_compile_avx512}])
7616 if test "${can_compile_avx512}" = "yes" ; then
7617     CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
7620 AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
7621 AC_LANG_PUSH([C++])
7622 save_CXXFLAGS=$CXXFLAGS
7623 CXXFLAGS="$CXXFLAGS $flag_f16c"
7624 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7625     #include <immintrin.h>
7626     int main () {
7627         __m128i a = _mm_set1_epi32 (0);
7628         __m128 c;
7629         c = _mm_cvtph_ps(a);
7630         return 0;
7631     }
7632     ])],
7633     [can_compile_f16c=yes],
7634     [can_compile_f16c=no])
7635 AC_LANG_POP([C++])
7636 CXXFLAGS=$save_CXXFLAGS
7637 AC_MSG_RESULT([${can_compile_f16c}])
7638 if test "${can_compile_f16c}" = "yes" ; then
7639     CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
7642 AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
7643 AC_LANG_PUSH([C++])
7644 save_CXXFLAGS=$CXXFLAGS
7645 CXXFLAGS="$CXXFLAGS $flag_fma"
7646 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7647     #include <immintrin.h>
7648     int main () {
7649         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
7650         d = _mm256_fmadd_ps(a, b, c);
7651         return 0;
7652     }
7653     ])],
7654     [can_compile_fma=yes],
7655     [can_compile_fma=no])
7656 AC_LANG_POP([C++])
7657 CXXFLAGS=$save_CXXFLAGS
7658 AC_MSG_RESULT([${can_compile_fma}])
7659 if test "${can_compile_fma}" = "yes" ; then
7660     CXXFLAGS_INTRINSICS_FMA="$flag_fma"
7663 AC_SUBST([CXXFLAGS_INTRINSICS_SSE2])
7664 AC_SUBST([CXXFLAGS_INTRINSICS_SSSE3])
7665 AC_SUBST([CXXFLAGS_INTRINSICS_SSE41])
7666 AC_SUBST([CXXFLAGS_INTRINSICS_SSE42])
7667 AC_SUBST([CXXFLAGS_INTRINSICS_AVX])
7668 AC_SUBST([CXXFLAGS_INTRINSICS_AVX2])
7669 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512])
7670 AC_SUBST([CXXFLAGS_INTRINSICS_F16C])
7671 AC_SUBST([CXXFLAGS_INTRINSICS_FMA])
7673 dnl ===================================================================
7674 dnl system stl sanity tests
7675 dnl ===================================================================
7676 if test "$_os" != "WINNT"; then
7678     AC_LANG_PUSH([C++])
7680     save_CPPFLAGS="$CPPFLAGS"
7681     if test -n "$MACOSX_SDK_PATH"; then
7682         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
7683     fi
7685     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
7686     # only.
7687     if test "$CPP_LIBRARY" = GLIBCXX; then
7688         dnl gcc#19664, gcc#22482, rhbz#162935
7689         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
7690         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
7691         AC_MSG_RESULT([$stlvisok])
7692         if test "$stlvisok" = "no"; then
7693             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
7694         fi
7695     fi
7697     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
7698     # when we don't make any dynamic libraries?
7699     if test "$DISABLE_DYNLOADING" = ""; then
7700         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
7701         cat > conftestlib1.cc <<_ACEOF
7702 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7703 struct S2: S1<int> { virtual ~S2(); };
7704 S2::~S2() {}
7705 _ACEOF
7706         cat > conftestlib2.cc <<_ACEOF
7707 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7708 struct S2: S1<int> { virtual ~S2(); };
7709 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
7710 _ACEOF
7711         gccvisinlineshiddenok=yes
7712         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
7713             gccvisinlineshiddenok=no
7714         else
7715             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
7716             dnl known to not work with -z defs (unsetting which makes the test
7717             dnl moot, though):
7718             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
7719             if test "$COM_IS_CLANG" = TRUE; then
7720                 for i in $CXX $CXXFLAGS; do
7721                     case $i in
7722                     -fsanitize=*)
7723                         my_linkflagsnoundefs=
7724                         break
7725                         ;;
7726                     esac
7727                 done
7728             fi
7729             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
7730                 gccvisinlineshiddenok=no
7731             fi
7732         fi
7734         rm -fr libconftest*
7735         AC_MSG_RESULT([$gccvisinlineshiddenok])
7736         if test "$gccvisinlineshiddenok" = "no"; then
7737             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
7738         fi
7739     fi
7741    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
7742     cat >visibility.cxx <<_ACEOF
7743 #pragma GCC visibility push(hidden)
7744 struct __attribute__ ((visibility ("default"))) TestStruct {
7745   static void Init();
7747 __attribute__ ((visibility ("default"))) void TestFunc() {
7748   TestStruct::Init();
7750 _ACEOF
7751     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
7752         gccvisbroken=yes
7753     else
7754         case "$host_cpu" in
7755         i?86|x86_64)
7756             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
7757                 gccvisbroken=no
7758             else
7759                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
7760                     gccvisbroken=no
7761                 else
7762                     gccvisbroken=yes
7763                 fi
7764             fi
7765             ;;
7766         *)
7767             gccvisbroken=no
7768             ;;
7769         esac
7770     fi
7771     rm -f visibility.s visibility.cxx
7773     AC_MSG_RESULT([$gccvisbroken])
7774     if test "$gccvisbroken" = "yes"; then
7775         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
7776     fi
7778     CPPFLAGS="$save_CPPFLAGS"
7780     AC_LANG_POP([C++])
7783 dnl ===================================================================
7784 dnl  Clang++ tests
7785 dnl ===================================================================
7787 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
7788 if test "$GCC" = "yes"; then
7789     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
7790     AC_LANG_PUSH([C++])
7791     save_CXXFLAGS=$CXXFLAGS
7792     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
7793     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
7794     CXXFLAGS=$save_CXXFLAGS
7795     AC_LANG_POP([C++])
7796     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
7797         AC_MSG_RESULT([yes])
7798     else
7799         AC_MSG_RESULT([no])
7800     fi
7802 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
7804 dnl ===================================================================
7805 dnl Compiler plugins
7806 dnl ===================================================================
7808 COMPILER_PLUGINS=
7809 # currently only Clang
7811 if test "$COM_IS_CLANG" != "TRUE"; then
7812     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
7813         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
7814         enable_compiler_plugins=no
7815     fi
7818 COMPILER_PLUGINS_COM_IS_CLANG=
7819 if test "$COM_IS_CLANG" = "TRUE"; then
7820     if test -n "$enable_compiler_plugins"; then
7821         compiler_plugins="$enable_compiler_plugins"
7822     elif test -n "$ENABLE_DBGUTIL"; then
7823         compiler_plugins=test
7824     else
7825         compiler_plugins=no
7826     fi
7827     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
7828         if test "$CLANGVER" -lt 50002; then
7829             if test "$compiler_plugins" = yes; then
7830                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
7831             else
7832                 compiler_plugins=no
7833             fi
7834         fi
7835     fi
7836     if test "$compiler_plugins" != "no"; then
7837         dnl The prefix where Clang resides, override to where Clang resides if
7838         dnl using a source build:
7839         if test -z "$CLANGDIR"; then
7840             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $(printf '%s\n' $CXX | head -n 1)))))
7841         fi
7842         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
7843         if test -z "$COMPILER_PLUGINS_CXX"; then
7844             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
7845         fi
7846         clangbindir=$CLANGDIR/bin
7847         if test "$build_os" = "cygwin"; then
7848             clangbindir=$(cygpath -u "$clangbindir")
7849         fi
7850         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
7851         if test -n "$LLVM_CONFIG"; then
7852             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
7853             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
7854             if test -z "$CLANGLIBDIR"; then
7855                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
7856             fi
7857             # Try if clang is built from source (in which case its includes are not together with llvm includes).
7858             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
7859             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
7860             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
7861                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
7862             fi
7863             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
7864             clangobjdir=$($LLVM_CONFIG --obj-root)
7865             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
7866                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
7867             fi
7868         fi
7869         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
7870         AC_LANG_PUSH([C++])
7871         save_CXX=$CXX
7872         save_CXXCPP=$CXXCPP
7873         save_CPPFLAGS=$CPPFLAGS
7874         save_CXXFLAGS=$CXXFLAGS
7875         save_LDFLAGS=$LDFLAGS
7876         save_LIBS=$LIBS
7877         CXX=$COMPILER_PLUGINS_CXX
7878         CXXCPP="$COMPILER_PLUGINS_CXX -E"
7879         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7880         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7881         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
7882             [COMPILER_PLUGINS=TRUE],
7883             [
7884             if test "$compiler_plugins" = "yes"; then
7885                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
7886             else
7887                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
7888                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
7889             fi
7890             ])
7891         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
7892         dnl comment in compilerplugins/Makefile-clang.mk:
7893         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
7894             LDFLAGS=""
7895             AC_MSG_CHECKING([for clang libraries to use])
7896             if test -z "$CLANGTOOLLIBS"; then
7897                 LIBS="-lclangTooling -lclangFrontend -lclangDriver -lclangParse -lclangSema -lclangEdit \
7898  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
7899                 AC_LINK_IFELSE([
7900                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7901                         [[ clang::FullSourceLoc().dump(); ]])
7902                 ],[CLANGTOOLLIBS="$LIBS"],[])
7903             fi
7904             if test -z "$CLANGTOOLLIBS"; then
7905                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
7906                 AC_LINK_IFELSE([
7907                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7908                         [[ clang::FullSourceLoc().dump(); ]])
7909                 ],[CLANGTOOLLIBS="$LIBS"],[])
7910             fi
7911             AC_MSG_RESULT([$CLANGTOOLLIBS])
7912             if test -z "$CLANGTOOLLIBS"; then
7913                 if test "$compiler_plugins" = "yes"; then
7914                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
7915                 else
7916                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
7917                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
7918                 fi
7919                 COMPILER_PLUGINS=
7920             fi
7921             if test -n "$COMPILER_PLUGINS"; then
7922                 if test -z "$CLANGSYSINCLUDE"; then
7923                     if test -n "$LLVM_CONFIG"; then
7924                         # Path to the clang system headers (no idea if there's a better way to get it).
7925                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/git\|svn//')/include
7926                     fi
7927                 fi
7928             fi
7929         fi
7930         CXX=$save_CXX
7931         CXXCPP=$save_CXXCPP
7932         CPPFLAGS=$save_CPPFLAGS
7933         CXXFLAGS=$save_CXXFLAGS
7934         LDFLAGS=$save_LDFLAGS
7935         LIBS="$save_LIBS"
7936         AC_LANG_POP([C++])
7938         AC_MSG_CHECKING([whether the compiler for building compilerplugins is actually Clang])
7939         AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7940             #ifndef __clang__
7941             you lose
7942             #endif
7943             int foo=42;
7944             ]])],
7945             [AC_MSG_RESULT([yes])
7946              COMPILER_PLUGINS_COM_IS_CLANG=TRUE],
7947             [AC_MSG_RESULT([no])])
7948         AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
7949     fi
7950 else
7951     if test "$enable_compiler_plugins" = "yes"; then
7952         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
7953     fi
7955 COMPILER_PLUGINS_ANALYZER_PCH=
7956 if test "$enable_compiler_plugins_analyzer_pch" != no; then
7957     COMPILER_PLUGINS_ANALYZER_PCH=TRUE
7959 AC_SUBST(COMPILER_PLUGINS)
7960 AC_SUBST(COMPILER_PLUGINS_ANALYZER_PCH)
7961 AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
7962 AC_SUBST(COMPILER_PLUGINS_CXX)
7963 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
7964 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
7965 AC_SUBST(COMPILER_PLUGINS_DEBUG)
7966 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
7967 AC_SUBST(CLANGDIR)
7968 AC_SUBST(CLANGLIBDIR)
7969 AC_SUBST(CLANGTOOLLIBS)
7970 AC_SUBST(CLANGSYSINCLUDE)
7972 # Plugin to help linker.
7973 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
7974 # This makes --enable-lto build with clang work.
7975 AC_SUBST(LD_PLUGIN)
7977 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
7978 AC_SUBST(HAVE_POSIX_FALLOCATE)
7980 JITC_PROCESSOR_TYPE=""
7981 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
7982     # IBMs JDK needs this...
7983     JITC_PROCESSOR_TYPE=6
7984     export JITC_PROCESSOR_TYPE
7986 AC_SUBST([JITC_PROCESSOR_TYPE])
7988 # Misc Windows Stuff
7989 AC_ARG_WITH(ucrt-dir,
7990     AS_HELP_STRING([--with-ucrt-dir],
7991         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
7992         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
7993         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
7994             Windows6.1-KB2999226-x64.msu
7995             Windows6.1-KB2999226-x86.msu
7996             Windows8.1-KB2999226-x64.msu
7997             Windows8.1-KB2999226-x86.msu
7998             Windows8-RT-KB2999226-x64.msu
7999             Windows8-RT-KB2999226-x86.msu
8000         A zip archive including those files is available from Microsoft site:
8001         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
8004 UCRT_REDISTDIR="$with_ucrt_dir"
8005 if test $_os = "WINNT"; then
8006     find_msvc_x64_dlls
8007     for i in $PKGFORMAT; do
8008         if test "$i" = msi; then
8009             find_msms
8010             break
8011         fi
8012     done
8013     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
8014     MSVC_DLLS="$msvcdlls"
8015     test -n "$msmdir" && MSM_PATH=`win_short_path_for_make "$msmdir"`
8016     # MSVC 15.3 changed it to VC141
8017     if echo "$msvcdllpath" | grep -q "VC142.CRT$"; then
8018         SCPDEFS="$SCPDEFS -DWITH_VC142_REDIST"
8019     elif echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
8020         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
8021     else
8022         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
8023     fi
8025     if test "$UCRT_REDISTDIR" = "no"; then
8026         dnl explicitly disabled
8027         UCRT_REDISTDIR=""
8028     else
8029         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
8030                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
8031                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
8032                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
8033                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
8034                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
8035             UCRT_REDISTDIR=""
8036             if test -n "$PKGFORMAT"; then
8037                for i in $PKGFORMAT; do
8038                    case "$i" in
8039                    msi)
8040                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
8041                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
8042                        ;;
8043                    esac
8044                done
8045             fi
8046         fi
8047     fi
8050 AC_SUBST(UCRT_REDISTDIR)
8051 AC_SUBST(MSVC_DLL_PATH)
8052 AC_SUBST(MSVC_DLLS)
8053 AC_SUBST(MSM_PATH)
8055 dnl ===================================================================
8056 dnl Checks for Java
8057 dnl ===================================================================
8058 if test "$ENABLE_JAVA" != ""; then
8060     # Windows-specific tests
8061     if test "$build_os" = "cygwin"; then
8062         if test -z "$with_jdk_home"; then
8063             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
8064             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
8065             reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
8066             if test -n "$regvalue"; then
8067                 ver=$regvalue
8068                 reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
8069                 reg_jdk_home=$regvalue
8070             fi
8072             if test -f "$reg_jdk_home/lib/jvm.lib" -a -f "$reg_jdk_home/bin/java.exe"; then
8073                 with_jdk_home="$reg_jdk_home"
8074                 howfound="found automatically"
8075             else
8076                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $WIN_HOST_BITS-bit JDK >= 9])
8077             fi
8078         else
8079             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
8080             howfound="you passed"
8081         fi
8082     fi
8084     # 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.
8085     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
8086     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
8087         with_jdk_home=`/usr/libexec/java_home`
8088     fi
8090     JAVA_HOME=; export JAVA_HOME
8091     if test -z "$with_jdk_home"; then
8092         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
8093     else
8094         _java_path="$with_jdk_home/bin/$with_java"
8095         dnl Check if there is a Java interpreter at all.
8096         if test -x "$_java_path"; then
8097             JAVAINTERPRETER=$_java_path
8098         else
8099             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
8100         fi
8101     fi
8103     dnl Check that the JDK found is correct architecture (at least 2 reasons to
8104     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
8105     dnl loaded by java to run JunitTests:
8106     if test "$build_os" = "cygwin" -a "$cross_compiling" != "yes"; then
8107         shortjdkhome=`cygpath -d "$with_jdk_home"`
8108         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
8109             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
8110             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8111         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
8112             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8113             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8114         fi
8116         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
8117             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
8118         fi
8119         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
8120     elif test "$cross_compiling" != "yes"; then
8121         case $CPUNAME in
8122             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
8123                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
8124                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
8125                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8126                 fi
8127                 ;;
8128             *) # assumption: everything else 32-bit
8129                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -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
8133                 ;;
8134         esac
8135     fi
8138 dnl ===================================================================
8139 dnl Checks for JDK.
8140 dnl ===================================================================
8142 # Whether all the complexity here actually is needed any more or not, no idea.
8144 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8145     _gij_longver=0
8146     AC_MSG_CHECKING([the installed JDK])
8147     if test -n "$JAVAINTERPRETER"; then
8148         dnl java -version sends output to stderr!
8149         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
8150             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8151         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
8152             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8153         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
8154             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8155         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
8156             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8157         else
8158             JDK=sun
8160             dnl Sun JDK specific tests
8161             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
8162             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
8164             if test "$_jdk_ver" -lt 10900; then
8165                 AC_MSG_ERROR([JDK is too old, you need at least 9 ($_jdk_ver < 10900)])
8166             fi
8167             if test "$_jdk_ver" -gt 10900; then
8168                 JAVA_CLASSPATH_NOT_SET=TRUE
8169             fi
8171             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
8172             if test "$_os" = "WINNT"; then
8173                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
8174             fi
8175             AC_MSG_RESULT([found $JAVA_HOME (JDK $_jdk)])
8177             # set to limit VM usage for JunitTests
8178             JAVAIFLAGS=-Xmx64M
8179             # set to limit VM usage for javac
8180             JAVACFLAGS=-J-Xmx128M
8181         fi
8182     else
8183         AC_MSG_ERROR([Java not found. You need at least JDK 9])
8184     fi
8185 else
8186     if test -z "$ENABLE_JAVA"; then
8187         dnl Java disabled
8188         JAVA_HOME=
8189         export JAVA_HOME
8190     elif test "$cross_compiling" = "yes"; then
8191         # Just assume compatibility of build and host JDK
8192         JDK=$JDK_FOR_BUILD
8193         JAVAIFLAGS=$JAVAIFLAGS_FOR_BUILD
8194     fi
8197 dnl ===================================================================
8198 dnl Checks for javac
8199 dnl ===================================================================
8200 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8201     javacompiler="javac"
8202     : ${JAVA_SOURCE_VER=8}
8203     : ${JAVA_TARGET_VER=8}
8204     if test -z "$with_jdk_home"; then
8205         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
8206     else
8207         _javac_path="$with_jdk_home/bin/$javacompiler"
8208         dnl Check if there is a Java compiler at all.
8209         if test -x "$_javac_path"; then
8210             JAVACOMPILER=$_javac_path
8211         fi
8212     fi
8213     if test -z "$JAVACOMPILER"; then
8214         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
8215     fi
8216     if test "$build_os" = "cygwin"; then
8217         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
8218             JAVACOMPILER="${JAVACOMPILER}.exe"
8219         fi
8220         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
8221     fi
8224 dnl ===================================================================
8225 dnl Checks for javadoc
8226 dnl ===================================================================
8227 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8228     if test -z "$with_jdk_home"; then
8229         AC_PATH_PROG(JAVADOC, javadoc)
8230     else
8231         _javadoc_path="$with_jdk_home/bin/javadoc"
8232         dnl Check if there is a javadoc at all.
8233         if test -x "$_javadoc_path"; then
8234             JAVADOC=$_javadoc_path
8235         else
8236             AC_PATH_PROG(JAVADOC, javadoc)
8237         fi
8238     fi
8239     if test -z "$JAVADOC"; then
8240         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
8241     fi
8242     if test "$build_os" = "cygwin"; then
8243         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
8244             JAVADOC="${JAVADOC}.exe"
8245         fi
8246         JAVADOC=`win_short_path_for_make "$JAVADOC"`
8247     fi
8249     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
8250     JAVADOCISGJDOC="yes"
8251     fi
8253 AC_SUBST(JAVADOC)
8254 AC_SUBST(JAVADOCISGJDOC)
8256 if test "$ENABLE_JAVA" != "" -a \( "$cross_compiling" != "yes" -o -n "$with_jdk_home" \); then
8257     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
8258     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
8259         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
8260            # try to recover first by looking whether we have an alternative
8261            # system as in Debian or newer SuSEs where following /usr/bin/javac
8262            # over /etc/alternatives/javac leads to the right bindir where we
8263            # just need to strip a bit away to get a valid JAVA_HOME
8264            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
8265         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
8266             # maybe only one level of symlink (e.g. on Mac)
8267             JAVA_HOME=$(readlink $JAVACOMPILER)
8268             if test "$(dirname $JAVA_HOME)" = "."; then
8269                 # we've got no path to trim back
8270                 JAVA_HOME=""
8271             fi
8272         else
8273             # else warn
8274             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
8275             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
8276             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
8277             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
8278         fi
8279         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
8280         if test "$JAVA_HOME" != "/usr"; then
8281             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8282                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
8283                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
8284                 dnl Tiger already returns a JDK path...
8285                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
8286             else
8287                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
8288                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
8289                 dnl that checks which version to run
8290                 if test -f "$JAVA_HOME"; then
8291                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
8292                 fi
8293             fi
8294         fi
8295     fi
8296     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
8298     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
8299     if test -z "$JAVA_HOME"; then
8300         if test "x$with_jdk_home" = "x"; then
8301             cat > findhome.java <<_ACEOF
8302 [import java.io.File;
8304 class findhome
8306     public static void main(String args[])
8307     {
8308         String jrelocation = System.getProperty("java.home");
8309         File jre = new File(jrelocation);
8310         System.out.println(jre.getParent());
8311     }
8313 _ACEOF
8314             AC_MSG_CHECKING([if javac works])
8315             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
8316             AC_TRY_EVAL(javac_cmd)
8317             if test $? = 0 -a -f ./findhome.class; then
8318                 AC_MSG_RESULT([javac works])
8319             else
8320                 echo "configure: javac test failed" >&5
8321                 cat findhome.java >&5
8322                 AC_MSG_ERROR([javac does not work - java projects will not build!])
8323             fi
8324             AC_MSG_CHECKING([if gij knows its java.home])
8325             JAVA_HOME=`$JAVAINTERPRETER findhome`
8326             if test $? = 0 -a "$JAVA_HOME" != ""; then
8327                 AC_MSG_RESULT([$JAVA_HOME])
8328             else
8329                 echo "configure: java test failed" >&5
8330                 cat findhome.java >&5
8331                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
8332             fi
8333             # clean-up after ourselves
8334             rm -f ./findhome.java ./findhome.class
8335         else
8336             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
8337         fi
8338     fi
8340     # now check if $JAVA_HOME is really valid
8341     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8342         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
8343             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
8344             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
8345             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
8346             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
8347             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
8348             add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
8349         fi
8350     fi
8351     PathFormat "$JAVA_HOME"
8352     JAVA_HOME="$formatted_path"
8355 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
8356     "$_os" != Darwin
8357 then
8358     AC_MSG_CHECKING([for JAWT lib])
8359     if test "$_os" = WINNT; then
8360         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
8361         JAWTLIB=jawt.lib
8362     else
8363         case "$host_cpu" in
8364         arm*)
8365             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
8366             JAVA_ARCH=$my_java_arch
8367             ;;
8368         i*86)
8369             my_java_arch=i386
8370             ;;
8371         m68k)
8372             my_java_arch=m68k
8373             ;;
8374         powerpc)
8375             my_java_arch=ppc
8376             ;;
8377         powerpc64)
8378             my_java_arch=ppc64
8379             ;;
8380         powerpc64le)
8381             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
8382             JAVA_ARCH=$my_java_arch
8383             ;;
8384         sparc64)
8385             my_java_arch=sparcv9
8386             ;;
8387         x86_64)
8388             my_java_arch=amd64
8389             ;;
8390         *)
8391             my_java_arch=$host_cpu
8392             ;;
8393         esac
8394         # This is where JDK9 puts the library
8395         if test -e "$JAVA_HOME/lib/libjawt.so"; then
8396             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
8397         else
8398             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
8399         fi
8400         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
8401     fi
8402     AC_MSG_RESULT([$JAWTLIB])
8404 AC_SUBST(JAWTLIB)
8406 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
8407     case "$host_os" in
8409     aix*)
8410         JAVAINC="-I$JAVA_HOME/include"
8411         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
8412         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8413         ;;
8415     cygwin*|wsl*)
8416         JAVAINC="-I$JAVA_HOME/include/win32"
8417         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
8418         ;;
8420     darwin*|macos*)
8421         if test -d "$JAVA_HOME/include/darwin"; then
8422             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
8423         else
8424             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
8425         fi
8426         ;;
8428     dragonfly*)
8429         JAVAINC="-I$JAVA_HOME/include"
8430         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8431         ;;
8433     freebsd*)
8434         JAVAINC="-I$JAVA_HOME/include"
8435         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
8436         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
8437         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8438         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8439         ;;
8441     k*bsd*-gnu*)
8442         JAVAINC="-I$JAVA_HOME/include"
8443         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8444         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8445         ;;
8447     linux-gnu*)
8448         JAVAINC="-I$JAVA_HOME/include"
8449         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8450         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8451         ;;
8453     *netbsd*)
8454         JAVAINC="-I$JAVA_HOME/include"
8455         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
8456         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8457        ;;
8459     openbsd*)
8460         JAVAINC="-I$JAVA_HOME/include"
8461         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
8462         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8463         ;;
8465     solaris*)
8466         JAVAINC="-I$JAVA_HOME/include"
8467         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
8468         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8469         ;;
8470     esac
8472 SOLARINC="$SOLARINC $JAVAINC"
8474 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8475     JAVA_HOME_FOR_BUILD=$JAVA_HOME
8476     JAVAIFLAGS_FOR_BUILD=$JAVAIFLAGS
8477     JDK_FOR_BUILD=$JDK
8480 AC_SUBST(JAVACFLAGS)
8481 AC_SUBST(JAVACOMPILER)
8482 AC_SUBST(JAVAINTERPRETER)
8483 AC_SUBST(JAVAIFLAGS)
8484 AC_SUBST(JAVAIFLAGS_FOR_BUILD)
8485 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
8486 AC_SUBST(JAVA_HOME)
8487 AC_SUBST(JAVA_HOME_FOR_BUILD)
8488 AC_SUBST(JDK)
8489 AC_SUBST(JDK_FOR_BUILD)
8490 AC_SUBST(JAVA_SOURCE_VER)
8491 AC_SUBST(JAVA_TARGET_VER)
8494 dnl ===================================================================
8495 dnl Export file validation
8496 dnl ===================================================================
8497 AC_MSG_CHECKING([whether to enable export file validation])
8498 if test "$with_export_validation" != "no"; then
8499     if test -z "$ENABLE_JAVA"; then
8500         if test "$with_export_validation" = "yes"; then
8501             AC_MSG_ERROR([requested, but Java is disabled])
8502         else
8503             AC_MSG_RESULT([no, as Java is disabled])
8504         fi
8505     elif ! test -d "${SRC_ROOT}/schema"; then
8506         if test "$with_export_validation" = "yes"; then
8507             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
8508         else
8509             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
8510         fi
8511     else
8512         AC_MSG_RESULT([yes])
8513         AC_DEFINE(HAVE_EXPORT_VALIDATION)
8515         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
8516         if test -z "$ODFVALIDATOR"; then
8517             # remember to download the ODF toolkit with validator later
8518             AC_MSG_NOTICE([no odfvalidator found, will download it])
8519             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
8520             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
8522             # and fetch name of odfvalidator jar name from download.lst
8523             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
8524             AC_SUBST(ODFVALIDATOR_JAR)
8526             if test -z "$ODFVALIDATOR_JAR"; then
8527                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
8528             fi
8529         fi
8530         if test "$build_os" = "cygwin"; then
8531             # In case of Cygwin it will be executed from Windows,
8532             # so we need to run bash and absolute path to validator
8533             # so instead of "odfvalidator" it will be
8534             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
8535             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
8536         else
8537             ODFVALIDATOR="sh $ODFVALIDATOR"
8538         fi
8539         AC_SUBST(ODFVALIDATOR)
8542         AC_PATH_PROGS(OFFICEOTRON, officeotron)
8543         if test -z "$OFFICEOTRON"; then
8544             # remember to download the officeotron with validator later
8545             AC_MSG_NOTICE([no officeotron found, will download it])
8546             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
8547             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
8549             # and fetch name of officeotron jar name from download.lst
8550             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
8551             AC_SUBST(OFFICEOTRON_JAR)
8553             if test -z "$OFFICEOTRON_JAR"; then
8554                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
8555             fi
8556         else
8557             # check version of existing officeotron
8558             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
8559             if test 0"$OFFICEOTRON_VER" -lt 704; then
8560                 AC_MSG_ERROR([officeotron too old])
8561             fi
8562         fi
8563         if test "$build_os" = "cygwin"; then
8564             # In case of Cygwin it will be executed from Windows,
8565             # so we need to run bash and absolute path to validator
8566             # so instead of "odfvalidator" it will be
8567             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
8568             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
8569         else
8570             OFFICEOTRON="sh $OFFICEOTRON"
8571         fi
8572     fi
8573     AC_SUBST(OFFICEOTRON)
8574 else
8575     AC_MSG_RESULT([no])
8578 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
8579 if test "$with_bffvalidator" != "no"; then
8580     AC_DEFINE(HAVE_BFFVALIDATOR)
8582     if test "$with_export_validation" = "no"; then
8583         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
8584     fi
8586     if test "$with_bffvalidator" = "yes"; then
8587         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
8588     else
8589         BFFVALIDATOR="$with_bffvalidator"
8590     fi
8592     if test "$build_os" = "cygwin"; then
8593         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
8594             AC_MSG_RESULT($BFFVALIDATOR)
8595         else
8596             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8597         fi
8598     elif test -n "$BFFVALIDATOR"; then
8599         # We are not in Cygwin but need to run Windows binary with wine
8600         AC_PATH_PROGS(WINE, wine)
8602         # so swap in a shell wrapper that converts paths transparently
8603         BFFVALIDATOR_EXE="$BFFVALIDATOR"
8604         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
8605         AC_SUBST(BFFVALIDATOR_EXE)
8606         AC_MSG_RESULT($BFFVALIDATOR)
8607     else
8608         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8609     fi
8610     AC_SUBST(BFFVALIDATOR)
8611 else
8612     AC_MSG_RESULT([no])
8615 dnl ===================================================================
8616 dnl Check for C preprocessor to use
8617 dnl ===================================================================
8618 AC_MSG_CHECKING([which C preprocessor to use in idlc])
8619 if test -n "$with_idlc_cpp"; then
8620     AC_MSG_RESULT([$with_idlc_cpp])
8621     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
8622 else
8623     AC_MSG_RESULT([ucpp])
8624     AC_MSG_CHECKING([which ucpp tp use])
8625     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
8626         AC_MSG_RESULT([external])
8627         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
8628     else
8629         AC_MSG_RESULT([internal])
8630         BUILD_TYPE="$BUILD_TYPE UCPP"
8631     fi
8633 AC_SUBST(SYSTEM_UCPP)
8635 dnl ===================================================================
8636 dnl Check for epm (not needed for Windows)
8637 dnl ===================================================================
8638 AC_MSG_CHECKING([whether to enable EPM for packing])
8639 if test "$enable_epm" = "yes"; then
8640     AC_MSG_RESULT([yes])
8641     if test "$_os" != "WINNT"; then
8642         if test $_os = Darwin; then
8643             EPM=internal
8644         elif test -n "$with_epm"; then
8645             EPM=$with_epm
8646         else
8647             AC_PATH_PROG(EPM, epm, no)
8648         fi
8649         if test "$EPM" = "no" -o "$EPM" = "internal"; then
8650             AC_MSG_NOTICE([EPM will be built.])
8651             BUILD_TYPE="$BUILD_TYPE EPM"
8652             EPM=${WORKDIR}/UnpackedTarball/epm/epm
8653         else
8654             # Gentoo has some epm which is something different...
8655             AC_MSG_CHECKING([whether the found epm is the right epm])
8656             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
8657                 AC_MSG_RESULT([yes])
8658             else
8659                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8660             fi
8661             AC_MSG_CHECKING([epm version])
8662             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
8663             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
8664                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
8665                 AC_MSG_RESULT([OK, >= 3.7])
8666             else
8667                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
8668                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8669             fi
8670         fi
8671     fi
8673     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
8674         AC_MSG_CHECKING([for rpm])
8675         for a in "$RPM" rpmbuild rpm; do
8676             $a --usage >/dev/null 2> /dev/null
8677             if test $? -eq 0; then
8678                 RPM=$a
8679                 break
8680             else
8681                 $a --version >/dev/null 2> /dev/null
8682                 if test $? -eq 0; then
8683                     RPM=$a
8684                     break
8685                 fi
8686             fi
8687         done
8688         if test -z "$RPM"; then
8689             AC_MSG_ERROR([not found])
8690         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
8691             RPM_PATH=`which $RPM`
8692             AC_MSG_RESULT([$RPM_PATH])
8693             SCPDEFS="$SCPDEFS -DWITH_RPM"
8694         else
8695             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
8696         fi
8697     fi
8698     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
8699         AC_PATH_PROG(DPKG, dpkg, no)
8700         if test "$DPKG" = "no"; then
8701             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
8702         fi
8703     fi
8704     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
8705        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8706         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
8707             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
8708                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
8709                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
8710                     AC_MSG_RESULT([yes])
8711                 else
8712                     AC_MSG_RESULT([no])
8713                     if echo "$PKGFORMAT" | $GREP -q rpm; then
8714                         _pt="rpm"
8715                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
8716                         add_warning "the rpms will need to be installed with --nodeps"
8717                     else
8718                         _pt="pkg"
8719                     fi
8720                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
8721                     add_warning "the ${_pt}s will not be relocatable"
8722                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
8723                                  relocation will work, you need to patch your epm with the
8724                                  patch in epm/epm-3.7.patch or build with
8725                                  --with-epm=internal which will build a suitable epm])
8726                 fi
8727             fi
8728         fi
8729     fi
8730     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8731         AC_PATH_PROG(PKGMK, pkgmk, no)
8732         if test "$PKGMK" = "no"; then
8733             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
8734         fi
8735     fi
8736     AC_SUBST(RPM)
8737     AC_SUBST(DPKG)
8738     AC_SUBST(PKGMK)
8739 else
8740     for i in $PKGFORMAT; do
8741         case "$i" in
8742         aix | bsd | deb | pkg | rpm | native | portable)
8743             AC_MSG_ERROR(
8744                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
8745             ;;
8746         esac
8747     done
8748     AC_MSG_RESULT([no])
8749     EPM=NO
8751 AC_SUBST(EPM)
8753 ENABLE_LWP=
8754 if test "$enable_lotuswordpro" = "yes"; then
8755     ENABLE_LWP="TRUE"
8757 AC_SUBST(ENABLE_LWP)
8759 dnl ===================================================================
8760 dnl Check for building ODK
8761 dnl ===================================================================
8762 if test "$enable_odk" = no; then
8763     unset DOXYGEN
8764 else
8765     if test "$with_doxygen" = no; then
8766         AC_MSG_CHECKING([for doxygen])
8767         unset DOXYGEN
8768         AC_MSG_RESULT([no])
8769     else
8770         if test "$with_doxygen" = yes; then
8771             AC_PATH_PROG([DOXYGEN], [doxygen])
8772             if test -z "$DOXYGEN"; then
8773                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
8774             fi
8775             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
8776                 if ! dot -V 2>/dev/null; then
8777                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
8778                 fi
8779             fi
8780         else
8781             AC_MSG_CHECKING([for doxygen])
8782             DOXYGEN=$with_doxygen
8783             AC_MSG_RESULT([$DOXYGEN])
8784         fi
8785         if test -n "$DOXYGEN"; then
8786             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
8787             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
8788             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
8789                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
8790             fi
8791         fi
8792     fi
8794 AC_SUBST([DOXYGEN])
8796 AC_MSG_CHECKING([whether to build the ODK])
8797 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
8798     AC_MSG_RESULT([yes])
8800     if test "$with_java" != "no"; then
8801         AC_MSG_CHECKING([whether to build unowinreg.dll])
8802         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
8803             # build on Win by default
8804             enable_build_unowinreg=yes
8805         fi
8806         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
8807             AC_MSG_RESULT([no])
8808             BUILD_UNOWINREG=
8809         else
8810             AC_MSG_RESULT([yes])
8811             BUILD_UNOWINREG=TRUE
8812         fi
8813         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
8814             if test -z "$with_mingw_cross_compiler"; then
8815                 dnl Guess...
8816                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
8817             elif test -x "$with_mingw_cross_compiler"; then
8818                  MINGWCXX="$with_mingw_cross_compiler"
8819             else
8820                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
8821             fi
8823             if test "$MINGWCXX" = "false"; then
8824                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
8825             fi
8827             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
8828             if test -x "$mingwstrip_test"; then
8829                 MINGWSTRIP="$mingwstrip_test"
8830             else
8831                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
8832             fi
8834             if test "$MINGWSTRIP" = "false"; then
8835                 AC_MSG_ERROR(MinGW32 binutils not found.)
8836             fi
8837         fi
8838     fi
8839     BUILD_TYPE="$BUILD_TYPE ODK"
8840 else
8841     AC_MSG_RESULT([no])
8842     BUILD_UNOWINREG=
8844 AC_SUBST(BUILD_UNOWINREG)
8845 AC_SUBST(MINGWCXX)
8846 AC_SUBST(MINGWSTRIP)
8848 dnl ===================================================================
8849 dnl Check for system zlib
8850 dnl ===================================================================
8851 if test "$with_system_zlib" = "auto"; then
8852     case "$_os" in
8853     WINNT)
8854         with_system_zlib="$with_system_libs"
8855         ;;
8856     *)
8857         if test "$enable_fuzzers" != "yes"; then
8858             with_system_zlib=yes
8859         else
8860             with_system_zlib=no
8861         fi
8862         ;;
8863     esac
8866 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8867 dnl and has no pkg-config for it at least on some tinderboxes,
8868 dnl so leaving that out for now
8869 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8870 AC_MSG_CHECKING([which zlib to use])
8871 if test "$with_system_zlib" = "yes"; then
8872     AC_MSG_RESULT([external])
8873     SYSTEM_ZLIB=TRUE
8874     AC_CHECK_HEADER(zlib.h, [],
8875         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8876     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8877         [AC_MSG_ERROR(zlib not found or functional)], [])
8878 else
8879     AC_MSG_RESULT([internal])
8880     SYSTEM_ZLIB=
8881     BUILD_TYPE="$BUILD_TYPE ZLIB"
8882     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8883     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8885 AC_SUBST(ZLIB_CFLAGS)
8886 AC_SUBST(ZLIB_LIBS)
8887 AC_SUBST(SYSTEM_ZLIB)
8889 dnl ===================================================================
8890 dnl Check for system jpeg
8891 dnl ===================================================================
8892 AC_MSG_CHECKING([which libjpeg to use])
8893 if test "$with_system_jpeg" = "yes"; then
8894     AC_MSG_RESULT([external])
8895     SYSTEM_LIBJPEG=TRUE
8896     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8897         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8898     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8899         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8900 else
8901     SYSTEM_LIBJPEG=
8902     AC_MSG_RESULT([internal, libjpeg-turbo])
8903     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8904     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
8905     if test "$COM" = "MSC"; then
8906         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
8907     else
8908         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
8909     fi
8911     case "$host_cpu" in
8912     x86_64 | amd64 | i*86 | x86 | ia32)
8913         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8914         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8915             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8916                 NASM="$LODE_HOME/opt/bin/nasm"
8917             elif test -x "/opt/lo/bin/nasm"; then
8918                 NASM="/opt/lo/bin/nasm"
8919             fi
8920         fi
8922         if test -n "$NASM"; then
8923             AC_MSG_CHECKING([for object file format of host system])
8924             case "$host_os" in
8925               cygwin* | mingw* | pw32* | wsl*)
8926                 case "$host_cpu" in
8927                   x86_64)
8928                     objfmt='Win64-COFF'
8929                     ;;
8930                   *)
8931                     objfmt='Win32-COFF'
8932                     ;;
8933                 esac
8934               ;;
8935               msdosdjgpp* | go32*)
8936                 objfmt='COFF'
8937               ;;
8938               os2-emx*) # not tested
8939                 objfmt='MSOMF' # obj
8940               ;;
8941               linux*coff* | linux*oldld*)
8942                 objfmt='COFF' # ???
8943               ;;
8944               linux*aout*)
8945                 objfmt='a.out'
8946               ;;
8947               linux*)
8948                 case "$host_cpu" in
8949                   x86_64)
8950                     objfmt='ELF64'
8951                     ;;
8952                   *)
8953                     objfmt='ELF'
8954                     ;;
8955                 esac
8956               ;;
8957               kfreebsd* | freebsd* | netbsd* | openbsd*)
8958                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
8959                   objfmt='BSD-a.out'
8960                 else
8961                   case "$host_cpu" in
8962                     x86_64 | amd64)
8963                       objfmt='ELF64'
8964                       ;;
8965                     *)
8966                       objfmt='ELF'
8967                       ;;
8968                   esac
8969                 fi
8970               ;;
8971               solaris* | sunos* | sysv* | sco*)
8972                 case "$host_cpu" in
8973                   x86_64)
8974                     objfmt='ELF64'
8975                     ;;
8976                   *)
8977                     objfmt='ELF'
8978                     ;;
8979                 esac
8980               ;;
8981               darwin* | rhapsody* | nextstep* | openstep* | macos*)
8982                 case "$host_cpu" in
8983                   x86_64)
8984                     objfmt='Mach-O64'
8985                     ;;
8986                   *)
8987                     objfmt='Mach-O'
8988                     ;;
8989                 esac
8990               ;;
8991               *)
8992                 objfmt='ELF ?'
8993               ;;
8994             esac
8996             AC_MSG_RESULT([$objfmt])
8997             if test "$objfmt" = 'ELF ?'; then
8998               objfmt='ELF'
8999               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
9000             fi
9002             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
9003             case "$objfmt" in
9004               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
9005               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
9006               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
9007               COFF)       NAFLAGS='-fcoff -DCOFF';;
9008               a.out)      NAFLAGS='-faout -DAOUT';;
9009               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
9010               ELF)        NAFLAGS='-felf -DELF';;
9011               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
9012               RDF)        NAFLAGS='-frdf -DRDF';;
9013               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
9014               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
9015             esac
9016             AC_MSG_RESULT([$NAFLAGS])
9018             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
9019             cat > conftest.asm << EOF
9020             [%line __oline__ "configure"
9021                     section .text
9022                     global  _main,main
9023             _main:
9024             main:   xor     eax,eax
9025                     ret
9026             ]
9028             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
9029             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
9030               AC_MSG_RESULT(yes)
9031             else
9032               echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
9033               cat conftest.asm >&AS_MESSAGE_LOG_FD
9034               rm -rf conftest*
9035               AC_MSG_RESULT(no)
9036               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
9037               NASM=""
9038             fi
9040         fi
9042         if test -z "$NASM"; then
9043 cat << _EOS
9044 ****************************************************************************
9045 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
9046 To get one please:
9048 _EOS
9049             if test "$build_os" = "cygwin"; then
9050 cat << _EOS
9051 install a pre-compiled binary for Win32
9053 mkdir -p /opt/lo/bin
9054 cd /opt/lo/bin
9055 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
9056 chmod +x nasm
9058 or get and install one from http://www.nasm.us/
9060 Then re-run autogen.sh
9062 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
9063 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
9065 _EOS
9066             else
9067 cat << _EOS
9068 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
9070 _EOS
9071             fi
9072             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
9073             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
9074         fi
9075       ;;
9076     esac
9079 AC_SUBST(NASM)
9080 AC_SUBST(LIBJPEG_CFLAGS)
9081 AC_SUBST(LIBJPEG_LIBS)
9082 AC_SUBST(SYSTEM_LIBJPEG)
9084 dnl ===================================================================
9085 dnl Check for system clucene
9086 dnl ===================================================================
9087 dnl we should rather be using
9088 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
9089 dnl but the contribs-lib check seems tricky
9090 AC_MSG_CHECKING([which clucene to use])
9091 if test "$with_system_clucene" = "yes"; then
9092     AC_MSG_RESULT([external])
9093     SYSTEM_CLUCENE=TRUE
9094     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
9095     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
9096     FilterLibs "${CLUCENE_LIBS}"
9097     CLUCENE_LIBS="${filteredlibs}"
9098     AC_LANG_PUSH([C++])
9099     save_CXXFLAGS=$CXXFLAGS
9100     save_CPPFLAGS=$CPPFLAGS
9101     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
9102     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
9103     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
9104     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
9105     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
9106                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
9107     CXXFLAGS=$save_CXXFLAGS
9108     CPPFLAGS=$save_CPPFLAGS
9109     AC_LANG_POP([C++])
9111     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
9112 else
9113     AC_MSG_RESULT([internal])
9114     SYSTEM_CLUCENE=
9115     BUILD_TYPE="$BUILD_TYPE CLUCENE"
9117 AC_SUBST(SYSTEM_CLUCENE)
9118 AC_SUBST(CLUCENE_CFLAGS)
9119 AC_SUBST(CLUCENE_LIBS)
9121 dnl ===================================================================
9122 dnl Check for system expat
9123 dnl ===================================================================
9124 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
9126 dnl ===================================================================
9127 dnl Check for system xmlsec
9128 dnl ===================================================================
9129 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
9131 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
9132 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
9133     ENABLE_EOT="TRUE"
9134     AC_DEFINE([ENABLE_EOT])
9135     AC_MSG_RESULT([yes])
9137     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
9138 else
9139     ENABLE_EOT=
9140     AC_MSG_RESULT([no])
9142 AC_SUBST([ENABLE_EOT])
9144 dnl ===================================================================
9145 dnl Check for DLP libs
9146 dnl ===================================================================
9147 AS_IF([test "$COM" = "MSC"],
9148       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
9149       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
9151 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
9153 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
9155 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
9157 AS_IF([test "$COM" = "MSC"],
9158       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
9159       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
9161 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
9163 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
9165 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
9166 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.12])
9168 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
9170 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
9172 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
9174 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
9175 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.17])
9177 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
9178 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.10])
9180 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
9182 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
9183 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
9185 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
9187 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
9189 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
9191 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
9193 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
9194 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.7])
9196 dnl ===================================================================
9197 dnl Check for system lcms2
9198 dnl ===================================================================
9199 if test "$with_system_lcms2" != "yes"; then
9200     SYSTEM_LCMS2=
9202 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
9203 if test "$GCC" = "yes"; then
9204     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
9206 if test "$COM" = "MSC"; then # override the above
9207     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
9210 dnl ===================================================================
9211 dnl Check for system cppunit
9212 dnl ===================================================================
9213 if test "$_os" != "Android" ; then
9214     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
9217 dnl ===================================================================
9218 dnl Check whether freetype is available
9219 dnl ===================================================================
9220 if test  "$test_freetype" = "yes"; then
9221     AC_MSG_CHECKING([whether freetype is available])
9222     # FreeType has 3 different kinds of versions
9223     # * release, like 2.4.10
9224     # * libtool, like 13.0.7 (this what pkg-config returns)
9225     # * soname
9226     # FreeType's docs/VERSION.DLL provides a table mapping between the three
9227     #
9228     # 9.9.3 is 2.2.0
9229     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
9230     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9231     FilterLibs "${FREETYPE_LIBS}"
9232     FREETYPE_LIBS="${filteredlibs}"
9233     SYSTEM_FREETYPE=TRUE
9234 else
9235     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
9236     if test "x$ac_config_site_64bit_host" = xYES; then
9237         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
9238     else
9239         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
9240     fi
9242 AC_SUBST(FREETYPE_CFLAGS)
9243 AC_SUBST(FREETYPE_LIBS)
9244 AC_SUBST([SYSTEM_FREETYPE])
9246 # ===================================================================
9247 # Check for system libxslt
9248 # to prevent incompatibilities between internal libxml2 and external libxslt,
9249 # or vice versa, use with_system_libxml here
9250 # ===================================================================
9251 if test "$with_system_libxml" = "auto"; then
9252     case "$_os" in
9253     WINNT|iOS|Android)
9254         with_system_libxml="$with_system_libs"
9255         ;;
9256     *)
9257         if test "$enable_fuzzers" != "yes"; then
9258             with_system_libxml=yes
9259         else
9260             with_system_libxml=no
9261         fi
9262         ;;
9263     esac
9266 AC_MSG_CHECKING([which libxslt to use])
9267 if test "$with_system_libxml" = "yes"; then
9268     AC_MSG_RESULT([external])
9269     SYSTEM_LIBXSLT=TRUE
9270     if test "$_os" = "Darwin"; then
9271         dnl make sure to use SDK path
9272         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9273         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
9274         dnl omit -L/usr/lib
9275         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
9276         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
9277     else
9278         PKG_CHECK_MODULES(LIBXSLT, libxslt)
9279         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9280         FilterLibs "${LIBXSLT_LIBS}"
9281         LIBXSLT_LIBS="${filteredlibs}"
9282         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
9283         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9284         FilterLibs "${LIBEXSLT_LIBS}"
9285         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
9286     fi
9288     dnl Check for xsltproc
9289     AC_PATH_PROG(XSLTPROC, xsltproc, no)
9290     if test "$XSLTPROC" = "no"; then
9291         AC_MSG_ERROR([xsltproc is required])
9292     fi
9293 else
9294     AC_MSG_RESULT([internal])
9295     SYSTEM_LIBXSLT=
9296     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
9298 AC_SUBST(SYSTEM_LIBXSLT)
9299 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
9300     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
9302 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
9304 AC_SUBST(LIBEXSLT_CFLAGS)
9305 AC_SUBST(LIBEXSLT_LIBS)
9306 AC_SUBST(LIBXSLT_CFLAGS)
9307 AC_SUBST(LIBXSLT_LIBS)
9308 AC_SUBST(XSLTPROC)
9310 # ===================================================================
9311 # Check for system libxml
9312 # ===================================================================
9313 AC_MSG_CHECKING([which libxml to use])
9314 if test "$with_system_libxml" = "yes"; then
9315     AC_MSG_RESULT([external])
9316     SYSTEM_LIBXML=TRUE
9317     if test "$_os" = "Darwin"; then
9318         dnl make sure to use SDK path
9319         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9320         dnl omit -L/usr/lib
9321         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
9322     elif test $_os = iOS; then
9323         dnl make sure to use SDK path
9324         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
9325         LIBXML_CFLAGS="-I$usr/include/libxml2"
9326         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
9327     else
9328         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
9329         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9330         FilterLibs "${LIBXML_LIBS}"
9331         LIBXML_LIBS="${filteredlibs}"
9332     fi
9334     dnl Check for xmllint
9335     AC_PATH_PROG(XMLLINT, xmllint, no)
9336     if test "$XMLLINT" = "no"; then
9337         AC_MSG_ERROR([xmllint is required])
9338     fi
9339 else
9340     AC_MSG_RESULT([internal])
9341     SYSTEM_LIBXML=
9342     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
9343     if test "$COM" = "MSC"; then
9344         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9345     fi
9346     if test "$COM" = "MSC"; then
9347         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
9348     else
9349         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
9350         if test "$_os" = Android; then
9351             LIBXML_LIBS="$LIBXML_LIBS -lm"
9352         fi
9353     fi
9354     BUILD_TYPE="$BUILD_TYPE LIBXML2"
9356 AC_SUBST(SYSTEM_LIBXML)
9357 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
9358     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
9360 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
9361 AC_SUBST(LIBXML_CFLAGS)
9362 AC_SUBST(LIBXML_LIBS)
9363 AC_SUBST(XMLLINT)
9365 # =====================================================================
9366 # Checking for a Python interpreter with version >= 3.3.
9367 # Optionally user can pass an option to configure, i. e.
9368 # ./configure PYTHON=/usr/bin/python
9369 # =====================================================================
9370 if test $_os = Darwin -a "$enable_python" != no -a "$enable_python" != fully-internal -a "$enable_python" != internal; then
9371     # Only allowed choices for macOS are 'no', 'internal' (default), and 'fully-internal'
9372     enable_python=internal
9374 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
9375     if test -n "$PYTHON"; then
9376         PYTHON_FOR_BUILD=$PYTHON
9377     else
9378         # This allows a lack of system python with no error, we use internal one in that case.
9379         AM_PATH_PYTHON([3.3],, [:])
9380         # Clean PYTHON_VERSION checked below if cross-compiling
9381         PYTHON_VERSION=""
9382         if test "$PYTHON" != ":"; then
9383             PYTHON_FOR_BUILD=$PYTHON
9384         fi
9385     fi
9387 AC_SUBST(PYTHON_FOR_BUILD)
9389 # Checks for Python to use for Pyuno
9390 AC_MSG_CHECKING([which Python to use for Pyuno])
9391 case "$enable_python" in
9392 no|disable)
9393     if test -z $PYTHON_FOR_BUILD; then
9394         # Python is required to build LibreOffice. In theory we could separate the build-time Python
9395         # requirement from the choice whether to include Python stuff in the installer, but why
9396         # bother?
9397         AC_MSG_ERROR([Python is required at build time.])
9398     fi
9399     enable_python=no
9400     AC_MSG_RESULT([none])
9401     ;;
9402 ""|yes|auto)
9403     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
9404         AC_MSG_RESULT([no, overridden by --disable-scripting])
9405         enable_python=no
9406     elif test $build_os = cygwin; then
9407         dnl When building on Windows we don't attempt to use any installed
9408         dnl "system"  Python.
9409         AC_MSG_RESULT([fully internal])
9410         enable_python=internal
9411     elif test "$cross_compiling" = yes; then
9412         AC_MSG_RESULT([system])
9413         enable_python=system
9414     else
9415         # Unset variables set by the above AM_PATH_PYTHON so that
9416         # we actually do check anew.
9417         AC_MSG_RESULT([])
9418         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
9419         AM_PATH_PYTHON([3.3],, [:])
9420         AC_MSG_CHECKING([which Python to use for Pyuno])
9421         if test "$PYTHON" = ":"; then
9422             if test -z "$PYTHON_FOR_BUILD"; then
9423                 AC_MSG_RESULT([fully internal])
9424             else
9425                 AC_MSG_RESULT([internal])
9426             fi
9427             enable_python=internal
9428         else
9429             AC_MSG_RESULT([system])
9430             enable_python=system
9431         fi
9432     fi
9433     ;;
9434 internal)
9435     AC_MSG_RESULT([internal])
9436     ;;
9437 fully-internal)
9438     AC_MSG_RESULT([fully internal])
9439     enable_python=internal
9440     ;;
9441 system)
9442     AC_MSG_RESULT([system])
9443     if test "$_os" = Darwin; then
9444         AC_MSG_ERROR([--enable-python=system doesn't work on macOS because the version provided is obsolete])
9445     fi
9446     ;;
9448     AC_MSG_ERROR([Incorrect --enable-python option])
9449     ;;
9450 esac
9452 if test $enable_python != no; then
9453     BUILD_TYPE="$BUILD_TYPE PYUNO"
9456 if test $enable_python = system; then
9457     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
9458         # Fallback: Accept these in the environment, or as set above
9459         # for MacOSX.
9460         :
9461     elif test "$cross_compiling" != yes; then
9462         # Unset variables set by the above AM_PATH_PYTHON so that
9463         # we actually do check anew.
9464         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
9465         # This causes an error if no python command is found
9466         AM_PATH_PYTHON([3.3])
9467         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
9468         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
9469         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
9470         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
9471         if test -z "$PKG_CONFIG"; then
9472             PYTHON_CFLAGS="-I$python_include"
9473             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
9474         elif $PKG_CONFIG --exists python-$python_version-embed; then
9475             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
9476             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
9477         elif $PKG_CONFIG --exists python-$python_version; then
9478             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
9479             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
9480         else
9481             PYTHON_CFLAGS="-I$python_include"
9482             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
9483         fi
9484         FilterLibs "${PYTHON_LIBS}"
9485         PYTHON_LIBS="${filteredlibs}"
9486     else
9487         dnl How to find out the cross-compilation Python installation path?
9488         AC_MSG_CHECKING([for python version])
9489         AS_IF([test -n "$PYTHON_VERSION"],
9490               [AC_MSG_RESULT([$PYTHON_VERSION])],
9491               [AC_MSG_RESULT([not found])
9492                AC_MSG_ERROR([no usable python found])])
9493         test -n "$PYTHON_CFLAGS" && break
9494     fi
9496     dnl Check if the headers really work
9497     save_CPPFLAGS="$CPPFLAGS"
9498     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
9499     AC_CHECK_HEADER(Python.h)
9500     CPPFLAGS="$save_CPPFLAGS"
9502     # let the PYTHON_FOR_BUILD match the same python installation that
9503     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
9504     # better for PythonTests.
9505     PYTHON_FOR_BUILD=$PYTHON
9508 if test "$with_lxml" != no; then
9509     if test -z "$PYTHON_FOR_BUILD"; then
9510         case $build_os in
9511             cygwin)
9512                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
9513                 ;;
9514             *)
9515                 if test "$cross_compiling" != yes ; then
9516                     BUILD_TYPE="$BUILD_TYPE LXML"
9517                 fi
9518                 ;;
9519         esac
9520     else
9521         AC_MSG_CHECKING([for python lxml])
9522         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
9523             AC_MSG_RESULT([yes])
9524         else
9525             case $build_os in
9526                 cygwin)
9527                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
9528                     ;;
9529                 *)
9530                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
9531                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
9532                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
9533                         else
9534                             BUILD_TYPE="$BUILD_TYPE LXML"
9535                             AC_MSG_RESULT([no, using internal lxml])
9536                         fi
9537                     else
9538                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
9539                     fi
9540                     ;;
9541             esac
9542         fi
9543     fi
9546 dnl By now enable_python should be "system", "internal" or "no"
9547 case $enable_python in
9548 system)
9549     SYSTEM_PYTHON=TRUE
9551     if test "x$ac_cv_header_Python_h" != "xyes"; then
9552        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
9553     fi
9555     AC_LANG_PUSH(C)
9556     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
9557     AC_MSG_CHECKING([for correct python library version])
9558        AC_RUN_IFELSE([AC_LANG_SOURCE([[
9559 #include <Python.h>
9561 int main(int argc, char **argv) {
9562    if ((PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
9563    else return 1;
9565        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3])],[AC_MSG_RESULT([skipped; cross-compiling])])
9566     AC_LANG_POP(C)
9568     dnl FIXME Check if the Python library can be linked with, too?
9569     ;;
9571 internal)
9572     SYSTEM_PYTHON=
9573     PYTHON_VERSION_MAJOR=3
9574     PYTHON_VERSION_MINOR=8
9575     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.8
9576     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
9577         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
9578     fi
9579     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
9580     BUILD_TYPE="$BUILD_TYPE PYTHON"
9581     if test "$OS" = LINUX -o "$OS" = WNT ; then
9582         BUILD_TYPE="$BUILD_TYPE LIBFFI"
9583     fi
9584     # Embedded Python dies without Home set
9585     if test "$HOME" = ""; then
9586         export HOME=""
9587     fi
9588     ;;
9590     DISABLE_PYTHON=TRUE
9591     SYSTEM_PYTHON=
9592     ;;
9594     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
9595     ;;
9596 esac
9598 AC_SUBST(DISABLE_PYTHON)
9599 AC_SUBST(SYSTEM_PYTHON)
9600 AC_SUBST(PYTHON_CFLAGS)
9601 AC_SUBST(PYTHON_LIBS)
9602 AC_SUBST(PYTHON_VERSION)
9603 AC_SUBST(PYTHON_VERSION_MAJOR)
9604 AC_SUBST(PYTHON_VERSION_MINOR)
9606 ENABLE_MARIADBC=
9607 MARIADBC_MAJOR=1
9608 MARIADBC_MINOR=0
9609 MARIADBC_MICRO=2
9610 AC_MSG_CHECKING([whether to build the MariaDB/MySQL SDBC driver])
9611 if test "x$enable_mariadb_sdbc" != "xno" -a "$enable_mpl_subset" != "yes"; then
9612     ENABLE_MARIADBC=TRUE
9613     AC_MSG_RESULT([yes])
9614     BUILD_TYPE="$BUILD_TYPE MARIADBC"
9615 else
9616     AC_MSG_RESULT([no])
9618 AC_SUBST(ENABLE_MARIADBC)
9619 AC_SUBST(MARIADBC_MAJOR)
9620 AC_SUBST(MARIADBC_MINOR)
9621 AC_SUBST(MARIADBC_MICRO)
9623 if test "$ENABLE_MARIADBC" = "TRUE"; then
9624     dnl ===================================================================
9625     dnl Check for system MariaDB
9626     dnl ===================================================================
9627     AC_MSG_CHECKING([which MariaDB to use])
9628     if test "$with_system_mariadb" = "yes"; then
9629         AC_MSG_RESULT([external])
9630         SYSTEM_MARIADB_CONNECTOR_C=TRUE
9631         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
9632         if test -z "$MARIADBCONFIG"; then
9633             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
9634             if test -z "$MARIADBCONFIG"; then
9635                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
9636                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
9637             fi
9638         fi
9639         AC_MSG_CHECKING([MariaDB version])
9640         MARIADB_VERSION=`$MARIADBCONFIG --version`
9641         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
9642         if test "$MARIADB_MAJOR" -ge "5"; then
9643             AC_MSG_RESULT([OK])
9644         else
9645             AC_MSG_ERROR([too old, use 5.0.x or later])
9646         fi
9647         AC_MSG_CHECKING([for MariaDB Client library])
9648         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
9649         if test "$COM_IS_CLANG" = TRUE; then
9650             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
9651         fi
9652         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
9653         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
9654         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
9655         dnl linux32:
9656         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
9657             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
9658             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
9659                 | sed -e 's|/lib64/|/lib/|')
9660         fi
9661         FilterLibs "${MARIADB_LIBS}"
9662         MARIADB_LIBS="${filteredlibs}"
9663         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
9664         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
9665         if test "$enable_bundle_mariadb" = "yes"; then
9666             AC_MSG_RESULT([yes])
9667             BUNDLE_MARIADB_CONNECTOR_C=TRUE
9668             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
9670 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
9672 /g' | grep -E '(mysqlclient|mariadb)')
9673             if test "$_os" = "Darwin"; then
9674                 LIBMARIADB=${LIBMARIADB}.dylib
9675             elif test "$_os" = "WINNT"; then
9676                 LIBMARIADB=${LIBMARIADB}.dll
9677             else
9678                 LIBMARIADB=${LIBMARIADB}.so
9679             fi
9680             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
9681             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
9682             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
9683                 AC_MSG_RESULT([found.])
9684                 PathFormat "$LIBMARIADB_PATH"
9685                 LIBMARIADB_PATH="$formatted_path"
9686             else
9687                 AC_MSG_ERROR([not found.])
9688             fi
9689         else
9690             AC_MSG_RESULT([no])
9691             BUNDLE_MARIADB_CONNECTOR_C=
9692         fi
9693     else
9694         AC_MSG_RESULT([internal])
9695         SYSTEM_MARIADB_CONNECTOR_C=
9696         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
9697         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
9698         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
9699     fi
9701     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
9702     AC_SUBST(MARIADB_CFLAGS)
9703     AC_SUBST(MARIADB_LIBS)
9704     AC_SUBST(LIBMARIADB)
9705     AC_SUBST(LIBMARIADB_PATH)
9706     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
9709 dnl ===================================================================
9710 dnl Check for system hsqldb
9711 dnl ===================================================================
9712 if test "$with_java" != "no" -a "$cross_compiling" != "yes"; then
9713     HSQLDB_USE_JDBC_4_1=
9714     AC_MSG_CHECKING([which hsqldb to use])
9715     if test "$with_system_hsqldb" = "yes"; then
9716         AC_MSG_RESULT([external])
9717         SYSTEM_HSQLDB=TRUE
9718         if test -z $HSQLDB_JAR; then
9719             HSQLDB_JAR=/usr/share/java/hsqldb.jar
9720         fi
9721         if ! test -f $HSQLDB_JAR; then
9722                AC_MSG_ERROR(hsqldb.jar not found.)
9723         fi
9724         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
9725         export HSQLDB_JAR
9726         if $PERL -e \
9727            'use Archive::Zip;
9728             my $file = "$ENV{'HSQLDB_JAR'}";
9729             my $zip = Archive::Zip->new( $file );
9730             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
9731             if ( $mf =~ m/Specification-Version: 1.8.*/ )
9732             {
9733                 push @l, split(/\n/, $mf);
9734                 foreach my $line (@l)
9735                 {
9736                     if ($line =~ m/Specification-Version:/)
9737                     {
9738                         ($t, $version) = split (/:/,$line);
9739                         $version =~ s/^\s//;
9740                         ($a, $b, $c, $d) = split (/\./,$version);
9741                         if ($c == "0" && $d > "8")
9742                         {
9743                             exit 0;
9744                         }
9745                         else
9746                         {
9747                             exit 1;
9748                         }
9749                     }
9750                 }
9751             }
9752             else
9753             {
9754                 exit 1;
9755             }'; then
9756             AC_MSG_RESULT([yes])
9757         else
9758             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
9759         fi
9760     else
9761         AC_MSG_RESULT([internal])
9762         SYSTEM_HSQLDB=
9763         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9764         NEED_ANT=TRUE
9765         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
9766         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
9767         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
9768             AC_MSG_RESULT([yes])
9769             HSQLDB_USE_JDBC_4_1=TRUE
9770         else
9771             AC_MSG_RESULT([no])
9772         fi
9773     fi
9774 else
9775     if test "$with_java" != "no" -a -z "$HSQLDB_JAR"; then
9776         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9777     fi
9779 AC_SUBST(SYSTEM_HSQLDB)
9780 AC_SUBST(HSQLDB_JAR)
9781 AC_SUBST([HSQLDB_USE_JDBC_4_1])
9783 dnl ===================================================================
9784 dnl Check for PostgreSQL stuff
9785 dnl ===================================================================
9786 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
9787 if test "x$enable_postgresql_sdbc" != "xno"; then
9788     AC_MSG_RESULT([yes])
9789     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
9791     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
9792         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
9793     fi
9794     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
9795         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
9796     fi
9798     postgres_interface=""
9799     if test "$with_system_postgresql" = "yes"; then
9800         postgres_interface="external PostgreSQL"
9801         SYSTEM_POSTGRESQL=TRUE
9802         if test "$_os" = Darwin; then
9803             supp_path=''
9804             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
9805                 pg_supp_path="$P_SEP$d$pg_supp_path"
9806             done
9807         fi
9808         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
9809         if test -n "$PGCONFIG"; then
9810             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
9811             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
9812         else
9813             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
9814               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
9815               POSTGRESQL_LIB=$POSTGRESQL_LIBS
9816             ],[
9817               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
9818             ])
9819         fi
9820         FilterLibs "${POSTGRESQL_LIB}"
9821         POSTGRESQL_LIB="${filteredlibs}"
9822     else
9823         # if/when anything else than PostgreSQL uses Kerberos,
9824         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
9825         WITH_KRB5=
9826         WITH_GSSAPI=
9827         case "$_os" in
9828         Darwin)
9829             # macOS has system MIT Kerberos 5 since 10.4
9830             if test "$with_krb5" != "no"; then
9831                 WITH_KRB5=TRUE
9832                 save_LIBS=$LIBS
9833                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
9834                 # that the libraries where these functions are located on macOS will change, is it?
9835                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9836                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9837                 KRB5_LIBS=$LIBS
9838                 LIBS=$save_LIBS
9839                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9840                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9841                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9842                 LIBS=$save_LIBS
9843             fi
9844             if test "$with_gssapi" != "no"; then
9845                 WITH_GSSAPI=TRUE
9846                 save_LIBS=$LIBS
9847                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9848                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9849                 GSSAPI_LIBS=$LIBS
9850                 LIBS=$save_LIBS
9851             fi
9852             ;;
9853         WINNT)
9854             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
9855                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
9856             fi
9857             ;;
9858         Linux|GNU|*BSD|DragonFly)
9859             if test "$with_krb5" != "no"; then
9860                 WITH_KRB5=TRUE
9861                 save_LIBS=$LIBS
9862                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9863                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9864                 KRB5_LIBS=$LIBS
9865                 LIBS=$save_LIBS
9866                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9867                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9868                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9869                 LIBS=$save_LIBS
9870             fi
9871             if test "$with_gssapi" != "no"; then
9872                 WITH_GSSAPI=TRUE
9873                 save_LIBS=$LIBS
9874                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9875                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9876                 GSSAPI_LIBS=$LIBS
9877                 LIBS=$save_LIBS
9878             fi
9879             ;;
9880         *)
9881             if test "$with_krb5" = "yes"; then
9882                 WITH_KRB5=TRUE
9883                 save_LIBS=$LIBS
9884                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9885                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9886                 KRB5_LIBS=$LIBS
9887                 LIBS=$save_LIBS
9888                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9889                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9890                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9891                 LIBS=$save_LIBS
9892             fi
9893             if test "$with_gssapi" = "yes"; then
9894                 WITH_GSSAPI=TRUE
9895                 save_LIBS=$LIBS
9896                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9897                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9898                 LIBS=$save_LIBS
9899                 GSSAPI_LIBS=$LIBS
9900             fi
9901         esac
9903         if test -n "$with_libpq_path"; then
9904             SYSTEM_POSTGRESQL=TRUE
9905             postgres_interface="external libpq"
9906             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
9907             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
9908         else
9909             SYSTEM_POSTGRESQL=
9910             postgres_interface="internal"
9911             POSTGRESQL_LIB=""
9912             POSTGRESQL_INC="%OVERRIDE_ME%"
9913             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
9914         fi
9915     fi
9917     AC_MSG_CHECKING([PostgreSQL C interface])
9918     AC_MSG_RESULT([$postgres_interface])
9920     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
9921         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
9922         save_CFLAGS=$CFLAGS
9923         save_CPPFLAGS=$CPPFLAGS
9924         save_LIBS=$LIBS
9925         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
9926         LIBS="${LIBS} ${POSTGRESQL_LIB}"
9927         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
9928         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
9929             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
9930         CFLAGS=$save_CFLAGS
9931         CPPFLAGS=$save_CPPFLAGS
9932         LIBS=$save_LIBS
9933     fi
9934     BUILD_POSTGRESQL_SDBC=TRUE
9935 else
9936     AC_MSG_RESULT([no])
9938 AC_SUBST(WITH_KRB5)
9939 AC_SUBST(WITH_GSSAPI)
9940 AC_SUBST(GSSAPI_LIBS)
9941 AC_SUBST(KRB5_LIBS)
9942 AC_SUBST(BUILD_POSTGRESQL_SDBC)
9943 AC_SUBST(SYSTEM_POSTGRESQL)
9944 AC_SUBST(POSTGRESQL_INC)
9945 AC_SUBST(POSTGRESQL_LIB)
9947 dnl ===================================================================
9948 dnl Check for Firebird stuff
9949 dnl ===================================================================
9950 ENABLE_FIREBIRD_SDBC=
9951 if test "$enable_firebird_sdbc" = "yes" ; then
9952     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
9954     dnl ===================================================================
9955     dnl Check for system Firebird
9956     dnl ===================================================================
9957     AC_MSG_CHECKING([which Firebird to use])
9958     if test "$with_system_firebird" = "yes"; then
9959         AC_MSG_RESULT([external])
9960         SYSTEM_FIREBIRD=TRUE
9961         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
9962         if test -z "$FIREBIRDCONFIG"; then
9963             AC_MSG_NOTICE([No fb_config -- using pkg-config])
9964             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
9965                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
9966             ])
9967             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
9968         else
9969             AC_MSG_NOTICE([fb_config found])
9970             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
9971             AC_MSG_CHECKING([for Firebird Client library])
9972             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
9973             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
9974             FilterLibs "${FIREBIRD_LIBS}"
9975             FIREBIRD_LIBS="${filteredlibs}"
9976         fi
9977         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
9978         AC_MSG_CHECKING([Firebird version])
9979         if test -n "${FIREBIRD_VERSION}"; then
9980             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
9981             if test "$FIREBIRD_MAJOR" -ge "3"; then
9982                 AC_MSG_RESULT([OK])
9983             else
9984                 AC_MSG_ERROR([Ensure firebird >= 3 is installed])
9985             fi
9986         else
9987             save_CFLAGS="${CFLAGS}"
9988             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
9989             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
9990 #if defined(FB_API_VER) && FB_API_VER == 30
9991 int fb_api_is_30(void) { return 0; }
9992 #else
9993 #error "Wrong Firebird API version"
9994 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
9995             CFLAGS="$save_CFLAGS"
9996         fi
9997         ENABLE_FIREBIRD_SDBC=TRUE
9998         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9999     elif test "$enable_database_connectivity" != yes; then
10000         AC_MSG_RESULT([none])
10001     elif test "$cross_compiling" = "yes"; then
10002         AC_MSG_RESULT([none])
10003     else
10004         dnl Embedded Firebird has version 3.0
10005         dnl We need libatomic_ops for any non X86/X64 system
10006         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
10007             dnl ===================================================================
10008             dnl Check for system libatomic_ops
10009             dnl ===================================================================
10010             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[LIBATOMIC_OPS],[atomic_ops >= 0.7.2])
10011             if test "$with_system_libatomic_ops" = "yes"; then
10012                 SYSTEM_LIBATOMIC_OPS=TRUE
10013                 AC_CHECK_HEADERS(atomic_ops.h, [],
10014                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
10015             else
10016                 SYSTEM_LIBATOMIC_OPS=
10017                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
10018                 LIBATOMIC_OPS_LIBS="-latomic_ops"
10019                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
10020             fi
10021         fi
10023         AC_MSG_RESULT([internal])
10024         SYSTEM_FIREBIRD=
10025         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
10026         FIREBIRD_LIBS="-lfbclient"
10028         if test "$with_system_libtommath" = "yes"; then
10029             SYSTEM_LIBTOMMATH=TRUE
10030             dnl check for tommath presence
10031             save_LIBS=$LIBS
10032             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
10033             AC_CHECK_LIB(tommath, mp_init, LIBTOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
10034             LIBS=$save_LIBS
10035         else
10036             SYSTEM_LIBTOMMATH=
10037             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
10038             LIBTOMMATH_LIBS="-ltommath"
10039             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
10040         fi
10042         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
10043         ENABLE_FIREBIRD_SDBC=TRUE
10044         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10045     fi
10047 AC_SUBST(ENABLE_FIREBIRD_SDBC)
10048 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
10049 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
10050 AC_SUBST(LIBATOMIC_OPS_LIBS)
10051 AC_SUBST(SYSTEM_FIREBIRD)
10052 AC_SUBST(FIREBIRD_CFLAGS)
10053 AC_SUBST(FIREBIRD_LIBS)
10054 AC_SUBST(SYSTEM_LIBTOMMATH)
10055 AC_SUBST(LIBTOMMATH_CFLAGS)
10056 AC_SUBST(LIBTOMMATH_LIBS)
10058 dnl ===================================================================
10059 dnl Check for system curl
10060 dnl ===================================================================
10061 AC_MSG_CHECKING([which libcurl to use])
10062 if test "$with_system_curl" = "auto"; then
10063     with_system_curl="$with_system_libs"
10066 if test "$with_system_curl" = "yes"; then
10067     AC_MSG_RESULT([external])
10068     SYSTEM_CURL=TRUE
10070     # First try PKGCONFIG and then fall back
10071     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
10073     if test -n "$CURL_PKG_ERRORS"; then
10074         AC_PATH_PROG(CURLCONFIG, curl-config)
10075         if test -z "$CURLCONFIG"; then
10076             AC_MSG_ERROR([curl development files not found])
10077         fi
10078         CURL_LIBS=`$CURLCONFIG --libs`
10079         FilterLibs "${CURL_LIBS}"
10080         CURL_LIBS="${filteredlibs}"
10081         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
10082         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
10084         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
10085         case $curl_version in
10086         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
10087         dnl so they need to be doubled to end up in the configure script
10088         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
10089             AC_MSG_RESULT([yes])
10090             ;;
10091         *)
10092             AC_MSG_ERROR([no, you have $curl_version])
10093             ;;
10094         esac
10095     fi
10097     ENABLE_CURL=TRUE
10098 else
10099     AC_MSG_RESULT([internal])
10100     SYSTEM_CURL=
10101     BUILD_TYPE="$BUILD_TYPE CURL"
10102     ENABLE_CURL=TRUE
10104 AC_SUBST(SYSTEM_CURL)
10105 AC_SUBST(CURL_CFLAGS)
10106 AC_SUBST(CURL_LIBS)
10107 AC_SUBST(ENABLE_CURL)
10109 dnl ===================================================================
10110 dnl Check for system boost
10111 dnl ===================================================================
10112 AC_MSG_CHECKING([which boost to use])
10113 if test "$with_system_boost" = "yes"; then
10114     AC_MSG_RESULT([external])
10115     SYSTEM_BOOST=TRUE
10116     AX_BOOST_BASE([1.66],,[AC_MSG_ERROR([no suitable Boost found])])
10117     AX_BOOST_DATE_TIME
10118     AX_BOOST_FILESYSTEM
10119     AX_BOOST_IOSTREAMS
10120     AX_BOOST_LOCALE
10121     AC_LANG_PUSH([C++])
10122     save_CXXFLAGS=$CXXFLAGS
10123     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
10124     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
10125        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
10126     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
10127        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
10128     CXXFLAGS=$save_CXXFLAGS
10129     AC_LANG_POP([C++])
10130     # this is in m4/ax_boost_base.m4
10131     FilterLibs "${BOOST_LDFLAGS}"
10132     BOOST_LDFLAGS="${filteredlibs}"
10133 else
10134     AC_MSG_RESULT([internal])
10135     BUILD_TYPE="$BUILD_TYPE BOOST"
10136     SYSTEM_BOOST=
10137     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
10138         # use warning-suppressing wrapper headers
10139         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
10140     else
10141         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
10142     fi
10144 AC_SUBST(SYSTEM_BOOST)
10146 dnl ===================================================================
10147 dnl Check for system mdds
10148 dnl ===================================================================
10149 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
10151 dnl ===================================================================
10152 dnl Check for system glm
10153 dnl ===================================================================
10154 AC_MSG_CHECKING([which glm to use])
10155 if test "$with_system_glm" = "yes"; then
10156     AC_MSG_RESULT([external])
10157     SYSTEM_GLM=TRUE
10158     AC_LANG_PUSH([C++])
10159     AC_CHECK_HEADER([glm/glm.hpp], [],
10160        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
10161     AC_LANG_POP([C++])
10162 else
10163     AC_MSG_RESULT([internal])
10164     BUILD_TYPE="$BUILD_TYPE GLM"
10165     SYSTEM_GLM=
10166     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
10168 AC_SUBST([GLM_CFLAGS])
10169 AC_SUBST([SYSTEM_GLM])
10171 dnl ===================================================================
10172 dnl Check for system odbc
10173 dnl ===================================================================
10174 AC_MSG_CHECKING([which odbc headers to use])
10175 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
10176     AC_MSG_RESULT([external])
10177     SYSTEM_ODBC_HEADERS=TRUE
10179     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
10180         save_CPPFLAGS=$CPPFLAGS
10181         find_winsdk
10182         PathFormat "$winsdktest"
10183         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"
10184         AC_CHECK_HEADER(sqlext.h, [],
10185             [AC_MSG_ERROR(odbc not found. install odbc)],
10186             [#include <windows.h>])
10187         CPPFLAGS=$save_CPPFLAGS
10188     else
10189         AC_CHECK_HEADER(sqlext.h, [],
10190             [AC_MSG_ERROR(odbc not found. install odbc)],[])
10191     fi
10192 elif test "$enable_database_connectivity" != yes; then
10193     AC_MSG_RESULT([none])
10194 else
10195     AC_MSG_RESULT([internal])
10196     SYSTEM_ODBC_HEADERS=
10197     BUILD_TYPE="$BUILD_TYPE IODBC"
10199 AC_SUBST(SYSTEM_ODBC_HEADERS)
10201 dnl ===================================================================
10202 dnl Enable LDAP support
10203 dnl ===================================================================
10205 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
10206 AC_MSG_CHECKING([whether to enable LDAP support])
10207     if test "$enable_ldap" != "yes"; then
10208         AC_MSG_RESULT([no])
10209         ENABLE_LDAP=""
10210         enable_ldap=no
10211     else
10212         AC_MSG_RESULT([yes])
10213         ENABLE_LDAP="TRUE"
10214     fi
10216 AC_SUBST(ENABLE_LDAP)
10218 dnl ===================================================================
10219 dnl Check for system openldap
10220 dnl ===================================================================
10222 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
10223 AC_MSG_CHECKING([which openldap library to use])
10224 if test "$with_system_openldap" = "yes"; then
10225     AC_MSG_RESULT([external])
10226     SYSTEM_OPENLDAP=TRUE
10227     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
10228     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10229     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10230 else
10231     AC_MSG_RESULT([internal])
10232     SYSTEM_OPENLDAP=
10233     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
10236 AC_SUBST(SYSTEM_OPENLDAP)
10238 dnl ===================================================================
10239 dnl Check for system NSS
10240 dnl ===================================================================
10241 if test "$enable_fuzzers" != "yes"; then
10242     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
10243     AC_DEFINE(HAVE_FEATURE_NSS)
10244     ENABLE_NSS="TRUE"
10245     AC_DEFINE(ENABLE_NSS)
10246 elif test $_os != iOS ; then
10247     with_tls=openssl
10249 AC_SUBST(ENABLE_NSS)
10251 dnl ===================================================================
10252 dnl Check for TLS/SSL and cryptographic implementation to use
10253 dnl ===================================================================
10254 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
10255 if test -n "$with_tls"; then
10256     case $with_tls in
10257     openssl)
10258         AC_DEFINE(USE_TLS_OPENSSL)
10259         TLS=OPENSSL
10260         AC_MSG_RESULT([$TLS])
10262         if test "$enable_openssl" != "yes"; then
10263             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
10264         fi
10266         # warn that OpenSSL has been selected but not all TLS code has this option
10267         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
10268         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
10269         ;;
10270     nss)
10271         AC_DEFINE(USE_TLS_NSS)
10272         TLS=NSS
10273         AC_MSG_RESULT([$TLS])
10274         ;;
10275     no)
10276         AC_MSG_RESULT([none])
10277         AC_MSG_WARN([Skipping TLS/SSL])
10278         ;;
10279     *)
10280         AC_MSG_RESULT([])
10281         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
10282 openssl - OpenSSL
10283 nss - Mozilla's Network Security Services (NSS)
10284     ])
10285         ;;
10286     esac
10287 else
10288     # default to using NSS, it results in smaller oox lib
10289     AC_DEFINE(USE_TLS_NSS)
10290     TLS=NSS
10291     AC_MSG_RESULT([$TLS])
10293 AC_SUBST(TLS)
10295 dnl ===================================================================
10296 dnl Check for system sane
10297 dnl ===================================================================
10298 AC_MSG_CHECKING([which sane header to use])
10299 if test "$with_system_sane" = "yes"; then
10300     AC_MSG_RESULT([external])
10301     AC_CHECK_HEADER(sane/sane.h, [],
10302       [AC_MSG_ERROR(sane not found. install sane)], [])
10303 else
10304     AC_MSG_RESULT([internal])
10305     BUILD_TYPE="$BUILD_TYPE SANE"
10308 dnl ===================================================================
10309 dnl Check for system icu
10310 dnl ===================================================================
10311 SYSTEM_GENBRK=
10312 SYSTEM_GENCCODE=
10313 SYSTEM_GENCMN=
10315 ICU_MAJOR=68
10316 ICU_MINOR=1
10317 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
10318 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
10319 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
10320 AC_MSG_CHECKING([which icu to use])
10321 if test "$with_system_icu" = "yes"; then
10322     AC_MSG_RESULT([external])
10323     SYSTEM_ICU=TRUE
10324     AC_LANG_PUSH([C++])
10325     AC_MSG_CHECKING([for unicode/rbbi.h])
10326     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
10327     AC_LANG_POP([C++])
10329     if test "$cross_compiling" != "yes"; then
10330         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
10331         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
10332         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
10333         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
10334     fi
10336     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
10337         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
10338         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
10339         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
10340         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
10341         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
10342             AC_MSG_RESULT([yes])
10343         else
10344             AC_MSG_RESULT([no])
10345             if test "$with_system_icu_for_build" != "force"; then
10346                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
10347 You can use --with-system-icu-for-build=force to use it anyway.])
10348             fi
10349         fi
10350     fi
10352     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
10353         # using the system icu tools can lead to version confusion, use the
10354         # ones from the build environment when cross-compiling
10355         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
10356         if test -z "$SYSTEM_GENBRK"; then
10357             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
10358         fi
10359         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
10360         if test -z "$SYSTEM_GENCCODE"; then
10361             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
10362         fi
10363         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
10364         if test -z "$SYSTEM_GENCMN"; then
10365             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
10366         fi
10367         if test "$ICU_MAJOR" -ge "49"; then
10368             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
10369             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
10370             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
10371         else
10372             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
10373             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
10374             ICU_RECLASSIFIED_HEBREW_LETTER=
10375         fi
10376     fi
10378     if test "$cross_compiling" = "yes"; then
10379         if test "$ICU_MAJOR" -ge "50"; then
10380             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
10381             ICU_MINOR=""
10382         fi
10383     fi
10384 else
10385     AC_MSG_RESULT([internal])
10386     SYSTEM_ICU=
10387     BUILD_TYPE="$BUILD_TYPE ICU"
10388     # surprisingly set these only for "internal" (to be used by various other
10389     # external libs): the system icu-config is quite unhelpful and spits out
10390     # dozens of weird flags and also default path -I/usr/include
10391     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
10392     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
10394 if test "$ICU_MAJOR" -ge "59"; then
10395     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
10396     # with -std=c++11 but not all external libraries can be built with that,
10397     # for those use a bit-compatible typedef uint16_t UChar; see
10398     # icu/source/common/unicode/umachine.h
10399     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
10400 else
10401     ICU_UCHAR_TYPE=""
10403 AC_SUBST(SYSTEM_ICU)
10404 AC_SUBST(SYSTEM_GENBRK)
10405 AC_SUBST(SYSTEM_GENCCODE)
10406 AC_SUBST(SYSTEM_GENCMN)
10407 AC_SUBST(ICU_MAJOR)
10408 AC_SUBST(ICU_MINOR)
10409 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
10410 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
10411 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
10412 AC_SUBST(ICU_CFLAGS)
10413 AC_SUBST(ICU_LIBS)
10414 AC_SUBST(ICU_UCHAR_TYPE)
10416 dnl ==================================================================
10417 dnl Breakpad
10418 dnl ==================================================================
10419 DEFAULT_CRASHDUMP_VALUE="true"
10420 AC_MSG_CHECKING([whether to enable breakpad])
10421 if test "$enable_breakpad" != yes; then
10422     AC_MSG_RESULT([no])
10423 else
10424     AC_MSG_RESULT([yes])
10425     ENABLE_BREAKPAD="TRUE"
10426     AC_DEFINE(ENABLE_BREAKPAD)
10427     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
10428     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
10430     AC_MSG_CHECKING([for disable crash dump])
10431     if test "$enable_crashdump" = no; then
10432         DEFAULT_CRASHDUMP_VALUE="false"
10433         AC_MSG_RESULT([yes])
10434     else
10435        AC_MSG_RESULT([no])
10436     fi
10438     AC_MSG_CHECKING([for crashreport config])
10439     if test "$with_symbol_config" = "no"; then
10440         BREAKPAD_SYMBOL_CONFIG="invalid"
10441         AC_MSG_RESULT([no])
10442     else
10443         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
10444         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
10445         AC_MSG_RESULT([yes])
10446     fi
10447     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
10449 AC_SUBST(ENABLE_BREAKPAD)
10450 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
10452 dnl ==================================================================
10453 dnl libfuzzer
10454 dnl ==================================================================
10455 AC_MSG_CHECKING([whether to enable fuzzers])
10456 if test "$enable_fuzzers" != yes; then
10457     AC_MSG_RESULT([no])
10458 else
10459     AC_MSG_RESULT([yes])
10460     ENABLE_FUZZERS="TRUE"
10461     AC_DEFINE([ENABLE_FUZZERS],1)
10462     BUILD_TYPE="$BUILD_TYPE FUZZERS"
10464 AC_SUBST(ENABLE_FUZZERS)
10466 dnl ===================================================================
10467 dnl Orcus
10468 dnl ===================================================================
10469 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.16 >= 0.16.0])
10470 if test "$with_system_orcus" != "yes"; then
10471     if test "$SYSTEM_BOOST" = "TRUE"; then
10472         # ===========================================================
10473         # Determine if we are going to need to link with Boost.System
10474         # ===========================================================
10475         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
10476         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
10477         dnl in documentation has no effect.
10478         AC_MSG_CHECKING([if we need to link with Boost.System])
10479         AC_LANG_PUSH([C++])
10480         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
10481                 @%:@include <boost/version.hpp>
10482             ]],[[
10483                 #if BOOST_VERSION >= 105000
10484                 #   error yes, we need to link with Boost.System
10485                 #endif
10486             ]])],[
10487                 AC_MSG_RESULT([no])
10488             ],[
10489                 AC_MSG_RESULT([yes])
10490                 AX_BOOST_SYSTEM
10491         ])
10492         AC_LANG_POP([C++])
10493     fi
10495 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
10496 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
10497 AC_SUBST([BOOST_SYSTEM_LIB])
10498 AC_SUBST(SYSTEM_LIBORCUS)
10500 dnl ===================================================================
10501 dnl HarfBuzz
10502 dnl ===================================================================
10503 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
10504                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
10505                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
10507 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
10508                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
10509                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
10511 if test "$COM" = "MSC"; then # override the above
10512     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
10513     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
10516 if test "$with_system_harfbuzz" = "yes"; then
10517     if test "$with_system_graphite" = "no"; then
10518         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
10519     fi
10520     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
10521     save_LIBS="$LIBS"
10522     save_CFLAGS="$CFLAGS"
10523     LIBS="$LIBS $HARFBUZZ_LIBS"
10524     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
10525     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
10526     LIBS="$save_LIBS"
10527     CFLAGS="$save_CFLAGS"
10528 else
10529     if test "$with_system_graphite" = "yes"; then
10530         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
10531     fi
10534 AC_MSG_CHECKING([whether to use X11])
10535 dnl ***************************************
10536 dnl testing for X libraries and includes...
10537 dnl ***************************************
10538 if test "$USING_X11" = TRUE; then
10539     AC_DEFINE(HAVE_FEATURE_X11)
10541 AC_MSG_RESULT([$USING_X11])
10543 if test "$USING_X11" = TRUE; then
10544     AC_PATH_X
10545     AC_PATH_XTRA
10546     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
10548     if test -z "$x_includes"; then
10549         x_includes="default_x_includes"
10550     fi
10551     if test -z "$x_libraries"; then
10552         x_libraries="default_x_libraries"
10553     fi
10554     CFLAGS="$CFLAGS $X_CFLAGS"
10555     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
10556     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
10557 else
10558     x_includes="no_x_includes"
10559     x_libraries="no_x_libraries"
10562 if test "$USING_X11" = TRUE; then
10563     dnl ===================================================================
10564     dnl Check for extension headers
10565     dnl ===================================================================
10566     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
10567      [#include <X11/extensions/shape.h>])
10569     # vcl needs ICE and SM
10570     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
10571     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
10572         [AC_MSG_ERROR(ICE library not found)])
10573     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
10574     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
10575         [AC_MSG_ERROR(SM library not found)])
10578 if test "$USING_X11" = TRUE -a "$ENABLE_JAVA" != ""; then
10579     # bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c needs Xt
10580     AC_CHECK_HEADERS(X11/Intrinsic.h,[],[AC_MSG_ERROR([libXt headers not found])])
10583 dnl ===================================================================
10584 dnl Check for system Xrender
10585 dnl ===================================================================
10586 AC_MSG_CHECKING([whether to use Xrender])
10587 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
10588     AC_MSG_RESULT([yes])
10589     PKG_CHECK_MODULES(XRENDER, xrender)
10590     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10591     FilterLibs "${XRENDER_LIBS}"
10592     XRENDER_LIBS="${filteredlibs}"
10593     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
10594       [AC_MSG_ERROR(libXrender not found or functional)], [])
10595     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
10596       [AC_MSG_ERROR(Xrender not found. install X)], [])
10597 else
10598     AC_MSG_RESULT([no])
10600 AC_SUBST(XRENDER_CFLAGS)
10601 AC_SUBST(XRENDER_LIBS)
10603 dnl ===================================================================
10604 dnl Check for XRandr
10605 dnl ===================================================================
10606 AC_MSG_CHECKING([whether to enable RandR support])
10607 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
10608     AC_MSG_RESULT([yes])
10609     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
10610     if test "$ENABLE_RANDR" != "TRUE"; then
10611         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
10612                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
10613         XRANDR_CFLAGS=" "
10614         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
10615           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
10616         XRANDR_LIBS="-lXrandr "
10617         ENABLE_RANDR="TRUE"
10618     fi
10619     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10620     FilterLibs "${XRANDR_LIBS}"
10621     XRANDR_LIBS="${filteredlibs}"
10622 else
10623     ENABLE_RANDR=""
10624     AC_MSG_RESULT([no])
10626 AC_SUBST(XRANDR_CFLAGS)
10627 AC_SUBST(XRANDR_LIBS)
10628 AC_SUBST(ENABLE_RANDR)
10630 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
10631     if test -z "$WITH_WEBDAV"; then
10632         WITH_WEBDAV="serf"
10633     fi
10635 if test $_os = iOS -o $_os = Android; then
10636     WITH_WEBDAV="no"
10638 AC_MSG_CHECKING([for webdav library])
10639 case "$WITH_WEBDAV" in
10640 serf)
10641     AC_MSG_RESULT([serf])
10642     # Check for system apr-util
10643     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
10644                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
10645                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
10646     if test "$COM" = "MSC"; then
10647         APR_LIB_DIR="LibR"
10648         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
10649         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
10650     fi
10652     # Check for system serf
10653     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.3.9])
10654     ;;
10655 neon)
10656     AC_MSG_RESULT([neon])
10657     # Check for system neon
10658     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.31.2])
10659     if test "$with_system_neon" = "yes"; then
10660         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
10661     else
10662         NEON_VERSION=0312
10663     fi
10664     AC_SUBST(NEON_VERSION)
10665     ;;
10667     AC_MSG_RESULT([none, disabled])
10668     WITH_WEBDAV=""
10669     ;;
10670 esac
10671 AC_SUBST(WITH_WEBDAV)
10673 dnl ===================================================================
10674 dnl Check for disabling cve_tests
10675 dnl ===================================================================
10676 AC_MSG_CHECKING([whether to execute CVE tests])
10677 # If not explicitly enabled or disabled, default
10678 if test -z "$enable_cve_tests"; then
10679     case "$OS" in
10680     WNT)
10681         # Default cves off for Windows with its wild and wonderful
10682         # variety of AV software kicking in and panicking
10683         enable_cve_tests=no
10684         ;;
10685     *)
10686         # otherwise yes
10687         enable_cve_tests=yes
10688         ;;
10689     esac
10691 if test "$enable_cve_tests" = "no"; then
10692     AC_MSG_RESULT([no])
10693     DISABLE_CVE_TESTS=TRUE
10694     AC_SUBST(DISABLE_CVE_TESTS)
10695 else
10696     AC_MSG_RESULT([yes])
10699 dnl ===================================================================
10700 dnl Check for enabling chart XShape tests
10701 dnl ===================================================================
10702 AC_MSG_CHECKING([whether to execute chart XShape tests])
10703 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
10704     AC_MSG_RESULT([yes])
10705     ENABLE_CHART_TESTS=TRUE
10706     AC_SUBST(ENABLE_CHART_TESTS)
10707 else
10708     AC_MSG_RESULT([no])
10711 dnl ===================================================================
10712 dnl Check for system openssl
10713 dnl ===================================================================
10714 DISABLE_OPENSSL=
10715 AC_MSG_CHECKING([whether to disable OpenSSL usage])
10716 if test "$enable_openssl" = "yes"; then
10717     AC_MSG_RESULT([no])
10718     if test "$_os" = Darwin ; then
10719         # OpenSSL is deprecated when building for 10.7 or later.
10720         #
10721         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
10722         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
10724         with_system_openssl=no
10725         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10726     elif test "$_os" = "FreeBSD" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
10727             && test "$with_system_openssl" != "no"; then
10728         with_system_openssl=yes
10729         SYSTEM_OPENSSL=TRUE
10730         OPENSSL_CFLAGS=
10731         OPENSSL_LIBS="-lssl -lcrypto"
10732     else
10733         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10734     fi
10735     if test "$with_system_openssl" = "yes"; then
10736         AC_MSG_CHECKING([whether openssl supports SHA512])
10737         AC_LANG_PUSH([C])
10738         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
10739             SHA512_CTX context;
10740 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
10741         AC_LANG_POP(C)
10742     fi
10743 else
10744     AC_MSG_RESULT([yes])
10745     DISABLE_OPENSSL=TRUE
10747     # warn that although OpenSSL is disabled, system libraries may depend on it
10748     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
10749     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
10752 AC_SUBST([DISABLE_OPENSSL])
10754 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
10755     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
10756         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
10757         enable_cipher_openssl_backend=no
10758     else
10759         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
10760     fi
10762 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
10763 ENABLE_CIPHER_OPENSSL_BACKEND=
10764 if test "$enable_cipher_openssl_backend" = yes; then
10765     AC_MSG_RESULT([yes])
10766     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
10767 else
10768     AC_MSG_RESULT([no])
10770 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
10772 dnl ===================================================================
10773 dnl Check for building gnutls
10774 dnl ===================================================================
10775 AC_MSG_CHECKING([whether to use gnutls])
10776 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
10777     AC_MSG_RESULT([yes])
10778     AM_PATH_LIBGCRYPT()
10779     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
10780         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
10781                       available in the system to use as replacement.]]))
10782     FilterLibs "${LIBGCRYPT_LIBS}"
10783     LIBGCRYPT_LIBS="${filteredlibs}"
10784 else
10785     AC_MSG_RESULT([no])
10788 AC_SUBST([LIBGCRYPT_CFLAGS])
10789 AC_SUBST([LIBGCRYPT_LIBS])
10791 dnl ===================================================================
10792 dnl Check for system redland
10793 dnl ===================================================================
10794 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
10795 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
10796 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
10797 if test "$with_system_redland" = "yes"; then
10798     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
10799             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
10800 else
10801     RAPTOR_MAJOR="0"
10802     RASQAL_MAJOR="3"
10803     REDLAND_MAJOR="0"
10805 AC_SUBST(RAPTOR_MAJOR)
10806 AC_SUBST(RASQAL_MAJOR)
10807 AC_SUBST(REDLAND_MAJOR)
10809 dnl ===================================================================
10810 dnl Check for system hunspell
10811 dnl ===================================================================
10812 AC_MSG_CHECKING([which libhunspell to use])
10813 if test "$with_system_hunspell" = "yes"; then
10814     AC_MSG_RESULT([external])
10815     SYSTEM_HUNSPELL=TRUE
10816     AC_LANG_PUSH([C++])
10817     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
10818     if test "$HUNSPELL_PC" != "TRUE"; then
10819         AC_CHECK_HEADER(hunspell.hxx, [],
10820             [
10821             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
10822             [AC_MSG_ERROR(hunspell headers not found.)], [])
10823             ], [])
10824         AC_CHECK_LIB([hunspell], [main], [:],
10825            [ AC_MSG_ERROR(hunspell library not found.) ], [])
10826         HUNSPELL_LIBS=-lhunspell
10827     fi
10828     AC_LANG_POP([C++])
10829     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10830     FilterLibs "${HUNSPELL_LIBS}"
10831     HUNSPELL_LIBS="${filteredlibs}"
10832 else
10833     AC_MSG_RESULT([internal])
10834     SYSTEM_HUNSPELL=
10835     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
10836     if test "$COM" = "MSC"; then
10837         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
10838     else
10839         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
10840     fi
10841     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
10843 AC_SUBST(SYSTEM_HUNSPELL)
10844 AC_SUBST(HUNSPELL_CFLAGS)
10845 AC_SUBST(HUNSPELL_LIBS)
10847 dnl ===================================================================
10848 dnl Check for system qrcodegen
10849 dnl ===================================================================
10850 AC_MSG_CHECKING([whether to use libqrcodegen])
10851 if test "$enable_qrcodegen" = "no"; then
10852     AC_MSG_RESULT([no])
10853     ENABLE_QRCODEGEN=
10854     SYSTEM_QRCODEGEN=
10855 else
10856     AC_MSG_RESULT([yes])
10857     ENABLE_QRCODEGEN=TRUE
10858     AC_MSG_CHECKING([which libqrcodegen to use])
10859     if test "$with_system_qrcodegen" = "yes"; then
10860         AC_MSG_RESULT([external])
10861         SYSTEM_QRCODEGEN=TRUE
10862         AC_LANG_PUSH([C++])
10863         AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [],
10864             [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>])
10865         AC_CHECK_LIB([qrcodegencpp], [main], [:],
10866             [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], [])
10867         QRCODEGEN_LIBS=-lqrcodegencpp
10868         AC_LANG_POP([C++])
10869         QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10870         FilterLibs "${QRCODEGEN_LIBS}"
10871         QRCODEGEN_LIBS="${filteredlibs}"
10872     else
10873         AC_MSG_RESULT([internal])
10874         SYSTEM_QRCODEGEN=
10875         BUILD_TYPE="$BUILD_TYPE QRCODEGEN"
10876     fi
10877     if test "$ENABLE_QRCODEGEN" = TRUE; then
10878         AC_DEFINE(ENABLE_QRCODEGEN)
10879     fi
10881 AC_SUBST(SYSTEM_QRCODEGEN)
10882 AC_SUBST(ENABLE_QRCODEGEN)
10883 AC_SUBST(QRCODEGEN_CFLAGS)
10884 AC_SUBST(QRCODEGEN_LIBS)
10886 dnl ===================================================================
10887 dnl Check for system box2d
10888 dnl ===================================================================
10889 AC_MSG_CHECKING([which box2d to use])
10890 if test "$with_system_box2d" = "yes"; then
10891     AC_MSG_RESULT([external])
10892     SYSTEM_BOX2D=TRUE
10893     AC_LANG_PUSH([C++])
10894     AC_CHECK_HEADER(box2d/box2d.h, [BOX2D_H_FOUND='TRUE'],
10895         [BOX2D_H_FOUND='FALSE'])
10896     if test "$BOX2D_H_FOUND" = "TRUE"; then # 2.4.0+
10897         _BOX2D_LIB=box2d
10898         AC_DEFINE(BOX2D_HEADER,<box2d/box2d.h>)
10899     else
10900         # fail this. there's no other alternative to check when we are here.
10901         AC_CHECK_HEADER([Box2D/Box2D.h], [],
10902                 [AC_MSG_ERROR(box2d headers not found.)])
10903         _BOX2D_LIB=Box2D
10904         AC_DEFINE(BOX2D_HEADER,<Box2D/Box2D.h>)
10905     fi
10906     AC_CHECK_LIB([$_BOX2D_LIB], [main], [:],
10907         [ AC_MSG_ERROR(box2d library not found.) ], [])
10908     BOX2D_LIBS=-l$_BOX2D_LIB
10909     AC_LANG_POP([C++])
10910     BOX2D_CFLAGS=$(printf '%s' "$BOX2D_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10911     FilterLibs "${BOX2D_LIBS}"
10912     BOX2D_LIBS="${filteredlibs}"
10913 else
10914     AC_MSG_RESULT([internal])
10915     SYSTEM_BOX2D=
10916     BUILD_TYPE="$BUILD_TYPE BOX2D"
10918 AC_SUBST(SYSTEM_BOX2D)
10919 AC_SUBST(BOX2D_CFLAGS)
10920 AC_SUBST(BOX2D_LIBS)
10922 dnl ===================================================================
10923 dnl Checking for altlinuxhyph
10924 dnl ===================================================================
10925 AC_MSG_CHECKING([which altlinuxhyph to use])
10926 if test "$with_system_altlinuxhyph" = "yes"; then
10927     AC_MSG_RESULT([external])
10928     SYSTEM_HYPH=TRUE
10929     AC_CHECK_HEADER(hyphen.h, [],
10930        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
10931     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
10932        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
10933        [#include <hyphen.h>])
10934     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
10935         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10936     if test -z "$HYPHEN_LIB"; then
10937         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
10938            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10939     fi
10940     if test -z "$HYPHEN_LIB"; then
10941         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
10942            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10943     fi
10944 else
10945     AC_MSG_RESULT([internal])
10946     SYSTEM_HYPH=
10947     BUILD_TYPE="$BUILD_TYPE HYPHEN"
10948     if test "$COM" = "MSC"; then
10949         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
10950     else
10951         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
10952     fi
10954 AC_SUBST(SYSTEM_HYPH)
10955 AC_SUBST(HYPHEN_LIB)
10957 dnl ===================================================================
10958 dnl Checking for mythes
10959 dnl ===================================================================
10960 AC_MSG_CHECKING([which mythes to use])
10961 if test "$with_system_mythes" = "yes"; then
10962     AC_MSG_RESULT([external])
10963     SYSTEM_MYTHES=TRUE
10964     AC_LANG_PUSH([C++])
10965     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
10966     if test "$MYTHES_PKGCONFIG" = "no"; then
10967         AC_CHECK_HEADER(mythes.hxx, [],
10968             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
10969         AC_CHECK_LIB([mythes-1.2], [main], [:],
10970             [ MYTHES_FOUND=no], [])
10971     if test "$MYTHES_FOUND" = "no"; then
10972         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
10973                 [ MYTHES_FOUND=no], [])
10974     fi
10975     if test "$MYTHES_FOUND" = "no"; then
10976         AC_MSG_ERROR([mythes library not found!.])
10977     fi
10978     fi
10979     AC_LANG_POP([C++])
10980     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10981     FilterLibs "${MYTHES_LIBS}"
10982     MYTHES_LIBS="${filteredlibs}"
10983 else
10984     AC_MSG_RESULT([internal])
10985     SYSTEM_MYTHES=
10986     BUILD_TYPE="$BUILD_TYPE MYTHES"
10987     if test "$COM" = "MSC"; then
10988         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
10989     else
10990         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
10991     fi
10993 AC_SUBST(SYSTEM_MYTHES)
10994 AC_SUBST(MYTHES_CFLAGS)
10995 AC_SUBST(MYTHES_LIBS)
10997 dnl ===================================================================
10998 dnl How should we build the linear programming solver ?
10999 dnl ===================================================================
11001 ENABLE_COINMP=
11002 AC_MSG_CHECKING([whether to build with CoinMP])
11003 if test "$enable_coinmp" != "no"; then
11004     ENABLE_COINMP=TRUE
11005     AC_MSG_RESULT([yes])
11006     if test "$with_system_coinmp" = "yes"; then
11007         SYSTEM_COINMP=TRUE
11008         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
11009         FilterLibs "${COINMP_LIBS}"
11010         COINMP_LIBS="${filteredlibs}"
11011     else
11012         BUILD_TYPE="$BUILD_TYPE COINMP"
11013     fi
11014 else
11015     AC_MSG_RESULT([no])
11017 AC_SUBST(ENABLE_COINMP)
11018 AC_SUBST(SYSTEM_COINMP)
11019 AC_SUBST(COINMP_CFLAGS)
11020 AC_SUBST(COINMP_LIBS)
11022 ENABLE_LPSOLVE=
11023 AC_MSG_CHECKING([whether to build with lpsolve])
11024 if test "$enable_lpsolve" != "no"; then
11025     ENABLE_LPSOLVE=TRUE
11026     AC_MSG_RESULT([yes])
11027 else
11028     AC_MSG_RESULT([no])
11030 AC_SUBST(ENABLE_LPSOLVE)
11032 if test "$ENABLE_LPSOLVE" = TRUE; then
11033     AC_MSG_CHECKING([which lpsolve to use])
11034     if test "$with_system_lpsolve" = "yes"; then
11035         AC_MSG_RESULT([external])
11036         SYSTEM_LPSOLVE=TRUE
11037         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
11038            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
11039         save_LIBS=$LIBS
11040         # some systems need this. Like Ubuntu...
11041         AC_CHECK_LIB(m, floor)
11042         AC_CHECK_LIB(dl, dlopen)
11043         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
11044             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
11045         LIBS=$save_LIBS
11046     else
11047         AC_MSG_RESULT([internal])
11048         SYSTEM_LPSOLVE=
11049         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
11050     fi
11052 AC_SUBST(SYSTEM_LPSOLVE)
11054 dnl ===================================================================
11055 dnl Checking for libexttextcat
11056 dnl ===================================================================
11057 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
11058 if test "$with_system_libexttextcat" = "yes"; then
11059     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
11061 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
11063 dnl ===================================================================
11064 dnl Checking for libnumbertext
11065 dnl ===================================================================
11066 libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.6])
11067 if test "$with_system_libnumbertext" = "yes"; then
11068     SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
11069     SYSTEM_LIBNUMBERTEXT=YES
11070 else
11071     SYSTEM_LIBNUMBERTEXT=
11072     AC_LANG_PUSH([C++])
11073     save_CPPFLAGS=$CPPFLAGS
11074     CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
11075     AC_CHECK_HEADERS([codecvt regex])
11076     AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
11077             [ LIBNUMBERTEXT_CFLAGS=''
11078               AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
11079                            Enable libnumbertext fallback (missing number to number name conversion).])
11080             ])
11081     CPPFLAGS=$save_CPPFLAGS
11082     AC_LANG_POP([C++])
11084 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
11085 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
11086 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
11088 dnl ***************************************
11089 dnl testing libc version for Linux...
11090 dnl ***************************************
11091 if test "$_os" = "Linux"; then
11092     AC_MSG_CHECKING([whether libc is >= 2.1.1])
11093     exec 6>/dev/null # no output
11094     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
11095     exec 6>&1 # output on again
11096     if test "$HAVE_LIBC"; then
11097         AC_MSG_RESULT([yes])
11098     else
11099         AC_MSG_ERROR([no, upgrade libc])
11100     fi
11103 dnl =========================================
11104 dnl Check for uuidgen
11105 dnl =========================================
11106 if test "$_os" = "WINNT"; then
11107     # we must use the uuidgen from the Windows SDK, which will be in the LO_PATH, but isn't in
11108     # the PATH for AC_PATH_PROG. It is already tested above in the WINDOWS_SDK_HOME check.
11109     UUIDGEN=uuidgen.exe
11110     AC_SUBST(UUIDGEN)
11111 else
11112     AC_PATH_PROG([UUIDGEN], [uuidgen])
11113     if test -z "$UUIDGEN"; then
11114         AC_MSG_WARN([uuid is needed for building installation sets])
11115     fi
11118 dnl ***************************************
11119 dnl Checking for bison and flex
11120 dnl ***************************************
11121 AC_PATH_PROG(BISON, bison)
11122 if test -z "$BISON"; then
11123     AC_MSG_ERROR([no bison found in \$PATH, install it])
11124 else
11125     AC_MSG_CHECKING([the bison version])
11126     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
11127     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
11128     dnl Accept newer than 2.0; for --enable-compiler-plugins at least 2.3 is known to be bad and
11129     dnl cause
11130     dnl
11131     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]
11132     dnl   typedef union YYSTYPE
11133     dnl           ~~~~~~^~~~~~~
11134     dnl
11135     dnl while at least 3.4.1 is know to be good:
11136     if test "$COMPILER_PLUGINS" = TRUE; then
11137         if test "$_bison_longver" -lt 2004; then
11138             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.4+ for --enable-compiler-plugins)])
11139         fi
11140     else
11141         if test "$_bison_longver" -lt 2000; then
11142             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
11143         fi
11144     fi
11146 AC_SUBST([BISON])
11148 AC_PATH_PROG(FLEX, flex)
11149 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11150     FLEX=`cygpath -m $FLEX`
11152 if test -z "$FLEX"; then
11153     AC_MSG_ERROR([no flex found in \$PATH, install it])
11154 else
11155     AC_MSG_CHECKING([the flex version])
11156     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
11157     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
11158         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
11159     fi
11161 AC_SUBST([FLEX])
11162 dnl ***************************************
11163 dnl Checking for patch
11164 dnl ***************************************
11165 AC_PATH_PROG(PATCH, patch)
11166 if test -z "$PATCH"; then
11167     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
11170 dnl On Solaris or macOS, check if --with-gnu-patch was used
11171 if test "$_os" = "SunOS" -o "$_os" = "Darwin" -o "$_os" = "FreeBSD"; then
11172     if test -z "$with_gnu_patch"; then
11173         GNUPATCH=$PATCH
11174     else
11175         if test -x "$with_gnu_patch"; then
11176             GNUPATCH=$with_gnu_patch
11177         else
11178             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
11179         fi
11180     fi
11182     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
11183     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
11184         AC_MSG_RESULT([yes])
11185     else
11186         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
11187     fi
11188 else
11189     GNUPATCH=$PATCH
11192 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11193     GNUPATCH=`cygpath -m $GNUPATCH`
11196 dnl We also need to check for --with-gnu-cp
11198 if test -z "$with_gnu_cp"; then
11199     # check the place where the good stuff is hidden on Solaris...
11200     if test -x /usr/gnu/bin/cp; then
11201         GNUCP=/usr/gnu/bin/cp
11202     else
11203         AC_PATH_PROGS(GNUCP, gnucp cp)
11204     fi
11205     if test -z $GNUCP; then
11206         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
11207     fi
11208 else
11209     if test -x "$with_gnu_cp"; then
11210         GNUCP=$with_gnu_cp
11211     else
11212         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
11213     fi
11216 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11217     GNUCP=`cygpath -m $GNUCP`
11220 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
11221 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
11222     AC_MSG_RESULT([yes])
11223 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
11224     AC_MSG_RESULT([yes])
11225 else
11226     case "$build_os" in
11227     darwin*|macos*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
11228         x_GNUCP=[\#]
11229         GNUCP=''
11230         AC_MSG_RESULT([no gnucp found - using the system's cp command])
11231         ;;
11232     *)
11233         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
11234         ;;
11235     esac
11238 AC_SUBST(GNUPATCH)
11239 AC_SUBST(GNUCP)
11240 AC_SUBST(x_GNUCP)
11242 dnl ***************************************
11243 dnl testing assembler path
11244 dnl ***************************************
11245 ML_EXE=""
11246 if test "$_os" = "WINNT"; then
11247     case "$WIN_HOST_ARCH" in
11248     x86) assembler=ml.exe ;;
11249     x64) assembler=ml64.exe ;;
11250     arm64) assembler=armasm64.exe ;;
11251     esac
11253     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
11254     if test -f "$MSVC_HOST_PATH/$assembler"; then
11255         ML_EXE=`win_short_path_for_make "$MSVC_HOST_PATH/$assembler"`
11256         AC_MSG_RESULT([$ML_EXE])
11257     else
11258         AC_MSG_ERROR([not found in $MSVC_HOST_PATH])
11259     fi
11262 AC_SUBST(ML_EXE)
11264 dnl ===================================================================
11265 dnl We need zip and unzip
11266 dnl ===================================================================
11267 AC_PATH_PROG(ZIP, zip)
11268 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
11269 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
11270     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],,)
11273 AC_PATH_PROG(UNZIP, unzip)
11274 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
11276 dnl ===================================================================
11277 dnl Zip must be a specific type for different build types.
11278 dnl ===================================================================
11279 if test $build_os = cygwin; then
11280     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
11281         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
11282     fi
11285 dnl ===================================================================
11286 dnl We need touch with -h option support.
11287 dnl ===================================================================
11288 AC_PATH_PROG(TOUCH, touch)
11289 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
11290 touch warn
11291 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
11292     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],,)
11295 dnl ===================================================================
11296 dnl Check for system epoxy
11297 dnl ===================================================================
11298 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
11300 dnl ===================================================================
11301 dnl Set vcl option: coordinate device in double or sal_Int32
11302 dnl ===================================================================
11304 dnl disabled for now, we don't want subtle differences between OSs
11305 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
11306 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
11307 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
11308 dnl     AC_MSG_RESULT([double])
11309 dnl else
11310 dnl     AC_MSG_RESULT([sal_Int32])
11311 dnl fi
11313 dnl ===================================================================
11314 dnl Test which vclplugs have to be built.
11315 dnl ===================================================================
11316 R=""
11317 if test "$USING_X11" != TRUE; then
11318     enable_gtk3=no
11321 ENABLE_GTK3=""
11322 if test "x$enable_gtk3" = "xyes"; then
11323     ENABLE_GTK3="TRUE"
11324     AC_DEFINE(ENABLE_GTK3)
11325     R="$R gtk3"
11327 AC_SUBST(ENABLE_GTK3)
11329 ENABLE_GTK3_KDE5=""
11330 if test "x$enable_gtk3_kde5" = "xyes"; then
11331     ENABLE_GTK3_KDE5="TRUE"
11332     AC_DEFINE(ENABLE_GTK3_KDE5)
11333     R="$R gtk3_kde5"
11335 AC_SUBST(ENABLE_GTK3_KDE5)
11337 ENABLE_QT5=""
11338 if test "x$enable_qt5" = "xyes"; then
11339     ENABLE_QT5="TRUE"
11340     AC_DEFINE(ENABLE_QT5)
11341     R="$R qt5"
11343 AC_SUBST(ENABLE_QT5)
11345 ENABLE_KF5=""
11346 if test "x$enable_kf5" = "xyes"; then
11347     ENABLE_KF5="TRUE"
11348     AC_DEFINE(ENABLE_KF5)
11349     R="$R kf5"
11351 AC_SUBST(ENABLE_KF5)
11353 GTK3_CFLAGS=""
11354 GTK3_LIBS=""
11355 if test "x$enable_gtk3" = "xyes" -o "x$enable_gtk3_kde5" = "xyes"; then
11356     if test "$with_system_cairo" = no; then
11357         add_warning 'Non-system cairo combined with gtk3 is assumed to cause trouble; proceed at your own risk.'
11358     fi
11359     : ${with_system_cairo:=yes}
11360     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)
11361     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11362     FilterLibs "${GTK3_LIBS}"
11363     GTK3_LIBS="${filteredlibs}"
11365     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
11366     if test "$with_system_epoxy" != "yes"; then
11367         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
11368         AC_CHECK_HEADER(EGL/eglplatform.h, [],
11369                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
11370     fi
11372 AC_SUBST(GTK3_LIBS)
11373 AC_SUBST(GTK3_CFLAGS)
11375 if test "$enable_introspection" = yes; then
11376     if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
11377         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
11378     else
11379         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
11380     fi
11383 if test "$_os" = "WINNT"; then
11384     R="$R win"
11385 elif test "$_os" = "Darwin"; then
11386     R="$R osx"
11387 elif test "$_os" = "iOS"; then
11388     R="ios (builtin)"
11391 build_vcl_plugins="$R"
11392 if test -z "$build_vcl_plugins"; then
11393     build_vcl_plugins="none"
11395 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
11397 dnl ===================================================================
11398 dnl check for dbus support
11399 dnl ===================================================================
11400 ENABLE_DBUS=""
11401 DBUS_CFLAGS=""
11402 DBUS_LIBS=""
11403 DBUS_GLIB_CFLAGS=""
11404 DBUS_GLIB_LIBS=""
11405 DBUS_HAVE_GLIB=""
11407 if test "$enable_dbus" = "no"; then
11408     test_dbus=no
11411 AC_MSG_CHECKING([whether to enable DBUS support])
11412 if test "$test_dbus" = "yes"; then
11413     ENABLE_DBUS="TRUE"
11414     AC_MSG_RESULT([yes])
11415     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
11416     AC_DEFINE(ENABLE_DBUS)
11417     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11418     FilterLibs "${DBUS_LIBS}"
11419     DBUS_LIBS="${filteredlibs}"
11421     # Glib is needed for BluetoothServer
11422     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
11423     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
11424         [
11425             DBUS_HAVE_GLIB="TRUE"
11426             AC_DEFINE(DBUS_HAVE_GLIB,1)
11427         ],
11428         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
11429     )
11430 else
11431     AC_MSG_RESULT([no])
11434 AC_SUBST(ENABLE_DBUS)
11435 AC_SUBST(DBUS_CFLAGS)
11436 AC_SUBST(DBUS_LIBS)
11437 AC_SUBST(DBUS_GLIB_CFLAGS)
11438 AC_SUBST(DBUS_GLIB_LIBS)
11439 AC_SUBST(DBUS_HAVE_GLIB)
11441 AC_MSG_CHECKING([whether to enable Impress remote control])
11442 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
11443     AC_MSG_RESULT([yes])
11444     ENABLE_SDREMOTE=TRUE
11445     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
11447     if test $OS = MACOSX && test "$MACOSX_SDK_VERSION" -ge 101500; then
11448         # The Bluetooth code doesn't compile with macOS SDK 10.15
11449         if test "$enable_sdremote_bluetooth" = yes; then
11450             AC_MSG_ERROR([macOS SDK $with_macosx_sdk does not currently support --enable-sdremote-bluetooth])
11451         fi
11452         enable_sdremote_bluetooth=no
11453     fi
11454     # If not explicitly enabled or disabled, default
11455     if test -z "$enable_sdremote_bluetooth"; then
11456         case "$OS" in
11457         LINUX|MACOSX|WNT)
11458             # Default to yes for these
11459             enable_sdremote_bluetooth=yes
11460             ;;
11461         *)
11462             # otherwise no
11463             enable_sdremote_bluetooth=no
11464             ;;
11465         esac
11466     fi
11467     # $enable_sdremote_bluetooth is guaranteed non-empty now
11469     if test "$enable_sdremote_bluetooth" != "no"; then
11470         if test "$OS" = "LINUX"; then
11471             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
11472                 AC_MSG_RESULT([yes])
11473                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
11474                 dnl ===================================================================
11475                 dnl Check for system bluez
11476                 dnl ===================================================================
11477                 AC_MSG_CHECKING([which Bluetooth header to use])
11478                 if test "$with_system_bluez" = "yes"; then
11479                     AC_MSG_RESULT([external])
11480                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
11481                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
11482                     SYSTEM_BLUEZ=TRUE
11483                 else
11484                     AC_MSG_RESULT([internal])
11485                     SYSTEM_BLUEZ=
11486                 fi
11487             else
11488                 AC_MSG_RESULT([no, dbus disabled])
11489                 ENABLE_SDREMOTE_BLUETOOTH=
11490                 SYSTEM_BLUEZ=
11491             fi
11492         else
11493             AC_MSG_RESULT([yes])
11494             ENABLE_SDREMOTE_BLUETOOTH=TRUE
11495             SYSTEM_BLUEZ=
11496         fi
11497     else
11498         AC_MSG_RESULT([no])
11499         ENABLE_SDREMOTE_BLUETOOTH=
11500         SYSTEM_BLUEZ=
11501     fi
11502 else
11503     ENABLE_SDREMOTE=
11504     SYSTEM_BLUEZ=
11505     AC_MSG_RESULT([no])
11507 AC_SUBST(ENABLE_SDREMOTE)
11508 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
11509 AC_SUBST(SYSTEM_BLUEZ)
11511 dnl ===================================================================
11512 dnl Check whether to enable GIO support
11513 dnl ===================================================================
11514 if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
11515     AC_MSG_CHECKING([whether to enable GIO support])
11516     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
11517         dnl Need at least 2.26 for the dbus support.
11518         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
11519                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
11520         if test "$ENABLE_GIO" = "TRUE"; then
11521             AC_DEFINE(ENABLE_GIO)
11522             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11523             FilterLibs "${GIO_LIBS}"
11524             GIO_LIBS="${filteredlibs}"
11525         fi
11526     else
11527         AC_MSG_RESULT([no])
11528     fi
11530 AC_SUBST(ENABLE_GIO)
11531 AC_SUBST(GIO_CFLAGS)
11532 AC_SUBST(GIO_LIBS)
11535 dnl ===================================================================
11537 SPLIT_APP_MODULES=""
11538 if test "$enable_split_app_modules" = "yes"; then
11539     SPLIT_APP_MODULES="TRUE"
11541 AC_SUBST(SPLIT_APP_MODULES)
11543 SPLIT_OPT_FEATURES=""
11544 if test "$enable_split_opt_features" = "yes"; then
11545     SPLIT_OPT_FEATURES="TRUE"
11547 AC_SUBST(SPLIT_OPT_FEATURES)
11549 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
11550     if test "$enable_cairo_canvas" = yes; then
11551         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
11552     fi
11553     enable_cairo_canvas=no
11554 elif test -z "$enable_cairo_canvas"; then
11555     enable_cairo_canvas=yes
11558 ENABLE_CAIRO_CANVAS=""
11559 if test "$enable_cairo_canvas" = "yes"; then
11560     test_cairo=yes
11561     ENABLE_CAIRO_CANVAS="TRUE"
11562     AC_DEFINE(ENABLE_CAIRO_CANVAS)
11564 AC_SUBST(ENABLE_CAIRO_CANVAS)
11566 dnl ===================================================================
11567 dnl Check whether the GStreamer libraries are available.
11568 dnl ===================================================================
11570 ENABLE_GSTREAMER_1_0=""
11572 if test "$build_gstreamer_1_0" = "yes"; then
11574     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
11575     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
11576         ENABLE_GSTREAMER_1_0="TRUE"
11577         AC_MSG_RESULT([yes])
11578         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
11579         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11580         FilterLibs "${GSTREAMER_1_0_LIBS}"
11581         GSTREAMER_1_0_LIBS="${filteredlibs}"
11582         AC_DEFINE(ENABLE_GSTREAMER_1_0)
11583     else
11584         AC_MSG_RESULT([no])
11585     fi
11587 AC_SUBST(GSTREAMER_1_0_CFLAGS)
11588 AC_SUBST(GSTREAMER_1_0_LIBS)
11589 AC_SUBST(ENABLE_GSTREAMER_1_0)
11591 dnl ===================================================================
11592 dnl Check whether to build the VLC avmedia backend
11593 dnl ===================================================================
11595 ENABLE_VLC=""
11597 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
11598 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
11599     ENABLE_VLC="TRUE"
11600     AC_MSG_RESULT([yes])
11601 else
11602     AC_MSG_RESULT([no])
11604 AC_SUBST(ENABLE_VLC)
11606 ENABLE_OPENGL_TRANSITIONS=
11607 ENABLE_OPENGL_CANVAS=
11608 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
11609    : # disable
11610 elif test "$_os" = "Darwin"; then
11611     # We use frameworks on macOS, no need for detail checks
11612     ENABLE_OPENGL_TRANSITIONS=TRUE
11613     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11614     ENABLE_OPENGL_CANVAS=TRUE
11615 elif test $_os = WINNT; then
11616     ENABLE_OPENGL_TRANSITIONS=TRUE
11617     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11618     ENABLE_OPENGL_CANVAS=TRUE
11619 else
11620     if test "$USING_X11" = TRUE; then
11621         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
11622         ENABLE_OPENGL_TRANSITIONS=TRUE
11623         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11624         ENABLE_OPENGL_CANVAS=TRUE
11625     fi
11628 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
11629 AC_SUBST(ENABLE_OPENGL_CANVAS)
11631 dnl =================================================
11632 dnl Check whether to build with OpenCL support.
11633 dnl =================================================
11635 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE" -a "$enable_opencl" = "yes"; then
11636     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
11637     # platform (optional at run-time, used through clew).
11638     BUILD_TYPE="$BUILD_TYPE OPENCL"
11639     AC_DEFINE(HAVE_FEATURE_OPENCL)
11642 dnl =================================================
11643 dnl Check whether to build with dconf support.
11644 dnl =================================================
11646 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
11647     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
11648         if test "$enable_dconf" = yes; then
11649             AC_MSG_ERROR([dconf not found])
11650         else
11651             enable_dconf=no
11652         fi])
11654 AC_MSG_CHECKING([whether to enable dconf])
11655 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
11656     DCONF_CFLAGS=
11657     DCONF_LIBS=
11658     ENABLE_DCONF=
11659     AC_MSG_RESULT([no])
11660 else
11661     ENABLE_DCONF=TRUE
11662     AC_DEFINE(ENABLE_DCONF)
11663     AC_MSG_RESULT([yes])
11665 AC_SUBST([DCONF_CFLAGS])
11666 AC_SUBST([DCONF_LIBS])
11667 AC_SUBST([ENABLE_DCONF])
11669 # pdf import?
11670 AC_MSG_CHECKING([whether to build the PDF import feature])
11671 ENABLE_PDFIMPORT=
11672 if test -z "$enable_pdfimport" -o "$enable_pdfimport" = yes; then
11673     AC_MSG_RESULT([yes])
11674     ENABLE_PDFIMPORT=TRUE
11675     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
11676 else
11677     AC_MSG_RESULT([no])
11680 # Pdfium?
11681 AC_MSG_CHECKING([whether to build PDFium])
11682 ENABLE_PDFIUM=
11683 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
11684     AC_MSG_RESULT([yes])
11685     ENABLE_PDFIUM=TRUE
11686     AC_DEFINE(HAVE_FEATURE_PDFIUM)
11687     BUILD_TYPE="$BUILD_TYPE PDFIUM"
11688 else
11689     AC_MSG_RESULT([no])
11691 AC_SUBST(ENABLE_PDFIUM)
11693 dnl ===================================================================
11694 dnl Check for poppler
11695 dnl ===================================================================
11696 ENABLE_POPPLER=
11697 AC_MSG_CHECKING([whether to build Poppler])
11698 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" -a $_os != Android \) -o "$enable_poppler" = yes; then
11699     AC_MSG_RESULT([yes])
11700     ENABLE_POPPLER=TRUE
11701     AC_DEFINE(HAVE_FEATURE_POPPLER)
11702 else
11703     AC_MSG_RESULT([no])
11705 AC_SUBST(ENABLE_POPPLER)
11707 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
11708     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
11711 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
11712     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
11715 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
11716     dnl ===================================================================
11717     dnl Check for system poppler
11718     dnl ===================================================================
11719     AC_MSG_CHECKING([which PDF import poppler to use])
11720     if test "$with_system_poppler" = "yes"; then
11721         AC_MSG_RESULT([external])
11722         SYSTEM_POPPLER=TRUE
11723         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
11724         AC_LANG_PUSH([C++])
11725         save_CXXFLAGS=$CXXFLAGS
11726         save_CPPFLAGS=$CPPFLAGS
11727         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
11728         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
11729         AC_CHECK_HEADER([cpp/poppler-version.h],
11730             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
11731             [])
11732         CXXFLAGS=$save_CXXFLAGS
11733         CPPFLAGS=$save_CPPFLAGS
11734         AC_LANG_POP([C++])
11735         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11737         FilterLibs "${POPPLER_LIBS}"
11738         POPPLER_LIBS="${filteredlibs}"
11739     else
11740         AC_MSG_RESULT([internal])
11741         SYSTEM_POPPLER=
11742         BUILD_TYPE="$BUILD_TYPE POPPLER"
11743         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
11744     fi
11745     AC_DEFINE([ENABLE_PDFIMPORT],1)
11747 AC_SUBST(ENABLE_PDFIMPORT)
11748 AC_SUBST(SYSTEM_POPPLER)
11749 AC_SUBST(POPPLER_CFLAGS)
11750 AC_SUBST(POPPLER_LIBS)
11752 # Skia?
11753 AC_MSG_CHECKING([whether to build Skia])
11754 ENABLE_SKIA=
11755 if test "$enable_skia" != "no" -a "$build_skia" = "yes" -a -z "$DISABLE_GUI"; then
11756     if test "$enable_skia" = "debug"; then
11757         AC_MSG_RESULT([yes (debug)])
11758         ENABLE_SKIA_DEBUG=TRUE
11759     else
11760         AC_MSG_RESULT([yes])
11761         ENABLE_SKIA_DEBUG=
11762     fi
11763     ENABLE_SKIA=TRUE
11764     AC_DEFINE(HAVE_FEATURE_SKIA)
11765     BUILD_TYPE="$BUILD_TYPE SKIA"
11766 else
11767     AC_MSG_RESULT([no])
11769 AC_SUBST(ENABLE_SKIA)
11770 AC_SUBST(ENABLE_SKIA_DEBUG)
11772 LO_CLANG_CXXFLAGS_INTRINSICS_SSE2=
11773 LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3=
11774 LO_CLANG_CXXFLAGS_INTRINSICS_SSE41=
11775 LO_CLANG_CXXFLAGS_INTRINSICS_SSE42=
11776 LO_CLANG_CXXFLAGS_INTRINSICS_AVX=
11777 LO_CLANG_CXXFLAGS_INTRINSICS_AVX2=
11778 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512=
11779 LO_CLANG_CXXFLAGS_INTRINSICS_F16C=
11780 LO_CLANG_CXXFLAGS_INTRINSICS_FMA=
11781 HAVE_LO_CLANG_DLLEXPORTINLINES=
11783 if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE -a ! \( "$_os" = "WINNT" -a "$CPUNAME" = "ARM64" \); then
11784     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
11785         AC_MSG_CHECKING([for Clang])
11786         AC_MSG_RESULT([$LO_CLANG_CC / $LO_CLANG_CXX])
11787     else
11788         if test "$_os" = "WINNT"; then
11789             AC_MSG_CHECKING([for clang-cl])
11790             if test -x "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"; then
11791                 LO_CLANG_CC=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"`
11792                 dnl explicitly set -m32/-m64
11793                 LO_CLANG_CC="$LO_CLANG_CC -m$WIN_HOST_BITS"
11794                 LO_CLANG_CXX="$LO_CLANG_CC"
11795                 AC_MSG_RESULT([$LO_CLANG_CC])
11796             else
11797                 AC_MSG_RESULT([no])
11798             fi
11799         else
11800             AC_CHECK_PROG(LO_CLANG_CC,clang,clang,[])
11801             AC_CHECK_PROG(LO_CLANG_CXX,clang++,clang++,[])
11802         fi
11803     fi
11804     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
11805         clang2_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $LO_CLANG_CC -E - | tail -1 | sed 's/ //g'`
11806         clang2_ver=`echo "$clang2_version" | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
11807         if test "$clang2_ver" -lt 50002; then
11808             AC_MSG_WARN(["$clang2_version" is too old or unrecognized, must be at least Clang 5.0.2])
11809             LO_CLANG_CC=
11810             LO_CLANG_CXX=
11811         fi
11812     fi
11813     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX" -a "$_os" = "WINNT"; then
11814         save_CXX="$CXX"
11815         CXX="$LO_CLANG_CXX"
11816         AC_MSG_CHECKING([whether $CXX supports -Zc:dllexportInlines-])
11817         AC_LANG_PUSH([C++])
11818         save_CXXFLAGS=$CXXFLAGS
11819         CXXFLAGS="$CXXFLAGS -Werror -Zc:dllexportInlines-"
11820         AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
11821                 HAVE_LO_CLANG_DLLEXPORTINLINES=TRUE
11822                 AC_MSG_RESULT([yes])
11823             ], [AC_MSG_RESULT([no])])
11824         CXXFLAGS=$save_CXXFLAGS
11825         AC_LANG_POP([C++])
11826         CXX="$save_CXX"
11827         if test -z "$HAVE_LO_CLANG_DLLEXPORTINLINES"; then
11828             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.])
11829         fi
11830     fi
11831     if test -z "$LO_CLANG_CC" -o -z "$LO_CLANG_CXX"; then
11832         # Skia is the default on Windows, so hard-require Clang.
11833         # Elsewhere it's used just by the 'gen' VCL backend which is rarely used.
11834         if test "$_os" = "WINNT"; then
11835             AC_MSG_ERROR([Clang compiler not found. The Skia library needs to be built using Clang.])
11836         else
11837             AC_MSG_WARN([Clang compiler not found.])
11838         fi
11839     else
11841         save_CXX="$CXX"
11842         CXX="$LO_CLANG_CXX"
11843         # copy&paste (and adjust) of intrinsics checks, since MSVC's -arch doesn't work well for Clang-cl
11844         flag_sse2=-msse2
11845         flag_ssse3=-mssse3
11846         flag_sse41=-msse4.1
11847         flag_sse42=-msse4.2
11848         flag_avx=-mavx
11849         flag_avx2=-mavx2
11850         flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
11851         flag_f16c=-mf16c
11852         flag_fma=-mfma
11854         AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
11855         AC_LANG_PUSH([C++])
11856         save_CXXFLAGS=$CXXFLAGS
11857         CXXFLAGS="$CXXFLAGS $flag_sse2"
11858         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11859             #include <emmintrin.h>
11860             int main () {
11861                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11862                 c = _mm_xor_si128 (a, b);
11863                 return 0;
11864             }
11865             ])],
11866             [can_compile_sse2=yes],
11867             [can_compile_sse2=no])
11868         AC_LANG_POP([C++])
11869         CXXFLAGS=$save_CXXFLAGS
11870         AC_MSG_RESULT([${can_compile_sse2}])
11871         if test "${can_compile_sse2}" = "yes" ; then
11872             LO_CLANG_CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
11873         fi
11875         AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
11876         AC_LANG_PUSH([C++])
11877         save_CXXFLAGS=$CXXFLAGS
11878         CXXFLAGS="$CXXFLAGS $flag_ssse3"
11879         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11880             #include <tmmintrin.h>
11881             int main () {
11882                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11883                 c = _mm_maddubs_epi16 (a, b);
11884                 return 0;
11885             }
11886             ])],
11887             [can_compile_ssse3=yes],
11888             [can_compile_ssse3=no])
11889         AC_LANG_POP([C++])
11890         CXXFLAGS=$save_CXXFLAGS
11891         AC_MSG_RESULT([${can_compile_ssse3}])
11892         if test "${can_compile_ssse3}" = "yes" ; then
11893             LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
11894         fi
11896         AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
11897         AC_LANG_PUSH([C++])
11898         save_CXXFLAGS=$CXXFLAGS
11899         CXXFLAGS="$CXXFLAGS $flag_sse41"
11900         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11901             #include <smmintrin.h>
11902             int main () {
11903                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11904                 c = _mm_cmpeq_epi64 (a, b);
11905                 return 0;
11906             }
11907             ])],
11908             [can_compile_sse41=yes],
11909             [can_compile_sse41=no])
11910         AC_LANG_POP([C++])
11911         CXXFLAGS=$save_CXXFLAGS
11912         AC_MSG_RESULT([${can_compile_sse41}])
11913         if test "${can_compile_sse41}" = "yes" ; then
11914             LO_CLANG_CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
11915         fi
11917         AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
11918         AC_LANG_PUSH([C++])
11919         save_CXXFLAGS=$CXXFLAGS
11920         CXXFLAGS="$CXXFLAGS $flag_sse42"
11921         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11922             #include <nmmintrin.h>
11923             int main () {
11924                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11925                 c = _mm_cmpgt_epi64 (a, b);
11926                 return 0;
11927             }
11928             ])],
11929             [can_compile_sse42=yes],
11930             [can_compile_sse42=no])
11931         AC_LANG_POP([C++])
11932         CXXFLAGS=$save_CXXFLAGS
11933         AC_MSG_RESULT([${can_compile_sse42}])
11934         if test "${can_compile_sse42}" = "yes" ; then
11935             LO_CLANG_CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
11936         fi
11938         AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
11939         AC_LANG_PUSH([C++])
11940         save_CXXFLAGS=$CXXFLAGS
11941         CXXFLAGS="$CXXFLAGS $flag_avx"
11942         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11943             #include <immintrin.h>
11944             int main () {
11945                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
11946                 c = _mm256_xor_ps(a, b);
11947                 return 0;
11948             }
11949             ])],
11950             [can_compile_avx=yes],
11951             [can_compile_avx=no])
11952         AC_LANG_POP([C++])
11953         CXXFLAGS=$save_CXXFLAGS
11954         AC_MSG_RESULT([${can_compile_avx}])
11955         if test "${can_compile_avx}" = "yes" ; then
11956             LO_CLANG_CXXFLAGS_INTRINSICS_AVX="$flag_avx"
11957         fi
11959         AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
11960         AC_LANG_PUSH([C++])
11961         save_CXXFLAGS=$CXXFLAGS
11962         CXXFLAGS="$CXXFLAGS $flag_avx2"
11963         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11964             #include <immintrin.h>
11965             int main () {
11966                 __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
11967                 c = _mm256_maddubs_epi16(a, b);
11968                 return 0;
11969             }
11970             ])],
11971             [can_compile_avx2=yes],
11972             [can_compile_avx2=no])
11973         AC_LANG_POP([C++])
11974         CXXFLAGS=$save_CXXFLAGS
11975         AC_MSG_RESULT([${can_compile_avx2}])
11976         if test "${can_compile_avx2}" = "yes" ; then
11977             LO_CLANG_CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
11978         fi
11980         AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
11981         AC_LANG_PUSH([C++])
11982         save_CXXFLAGS=$CXXFLAGS
11983         CXXFLAGS="$CXXFLAGS $flag_avx512"
11984         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11985             #include <immintrin.h>
11986             int main () {
11987                 __m512i a = _mm512_loadu_si512(0);
11988                 return 0;
11989             }
11990             ])],
11991             [can_compile_avx512=yes],
11992             [can_compile_avx512=no])
11993         AC_LANG_POP([C++])
11994         CXXFLAGS=$save_CXXFLAGS
11995         AC_MSG_RESULT([${can_compile_avx512}])
11996         if test "${can_compile_avx512}" = "yes" ; then
11997             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
11998         fi
12000         AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
12001         AC_LANG_PUSH([C++])
12002         save_CXXFLAGS=$CXXFLAGS
12003         CXXFLAGS="$CXXFLAGS $flag_f16c"
12004         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12005             #include <immintrin.h>
12006             int main () {
12007                 __m128i a = _mm_set1_epi32 (0);
12008                 __m128 c;
12009                 c = _mm_cvtph_ps(a);
12010                 return 0;
12011             }
12012             ])],
12013             [can_compile_f16c=yes],
12014             [can_compile_f16c=no])
12015         AC_LANG_POP([C++])
12016         CXXFLAGS=$save_CXXFLAGS
12017         AC_MSG_RESULT([${can_compile_f16c}])
12018         if test "${can_compile_f16c}" = "yes" ; then
12019             LO_CLANG_CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
12020         fi
12022         AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
12023         AC_LANG_PUSH([C++])
12024         save_CXXFLAGS=$CXXFLAGS
12025         CXXFLAGS="$CXXFLAGS $flag_fma"
12026         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12027             #include <immintrin.h>
12028             int main () {
12029                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
12030                 d = _mm256_fmadd_ps(a, b, c);
12031                 return 0;
12032             }
12033             ])],
12034             [can_compile_fma=yes],
12035             [can_compile_fma=no])
12036         AC_LANG_POP([C++])
12037         CXXFLAGS=$save_CXXFLAGS
12038         AC_MSG_RESULT([${can_compile_fma}])
12039         if test "${can_compile_fma}" = "yes" ; then
12040             LO_CLANG_CXXFLAGS_INTRINSICS_FMA="$flag_fma"
12041         fi
12043         CXX="$save_CXX"
12044     fi
12047 # prefix LO_CLANG_CC/LO_CLANG_CXX with ccache if needed
12049 if test "$CCACHE" != "" -a -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12050     AC_MSG_CHECKING([whether $LO_CLANG_CC is already ccached])
12051     AC_LANG_PUSH([C])
12052     save_CC="$CC"
12053     CC="$LO_CLANG_CC"
12054     save_CFLAGS=$CFLAGS
12055     CFLAGS="$CFLAGS --ccache-skip -O2"
12056     dnl an empty program will do, we're checking the compiler flags
12057     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12058                       [use_ccache=yes], [use_ccache=no])
12059     CFLAGS=$save_CFLAGS
12060     CC=$save_CC
12061     if test $use_ccache = yes; then
12062         AC_MSG_RESULT([yes])
12063     else
12064         LO_CLANG_CC="$CCACHE $LO_CLANG_CC"
12065         AC_MSG_RESULT([no])
12066     fi
12067     AC_LANG_POP([C])
12069     AC_MSG_CHECKING([whether $LO_CLANG_CXX is already ccached])
12070     AC_LANG_PUSH([C++])
12071     save_CXX="$CXX"
12072     CXX="$LO_CLANG_CXX"
12073     save_CXXFLAGS=$CXXFLAGS
12074     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
12075     dnl an empty program will do, we're checking the compiler flags
12076     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12077                       [use_ccache=yes], [use_ccache=no])
12078     if test $use_ccache = yes; then
12079         AC_MSG_RESULT([yes])
12080     else
12081         LO_CLANG_CXX="$CCACHE $LO_CLANG_CXX"
12082         AC_MSG_RESULT([no])
12083     fi
12084     CXXFLAGS=$save_CXXFLAGS
12085     CXX=$save_CXX
12086     AC_LANG_POP([C++])
12089 AC_SUBST(LO_CLANG_CC)
12090 AC_SUBST(LO_CLANG_CXX)
12091 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE2)
12092 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3)
12093 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE41)
12094 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE42)
12095 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX)
12096 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX2)
12097 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512)
12098 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_F16C)
12099 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_FMA)
12100 AC_SUBST(CLANG_USE_LD)
12101 AC_SUBST([HAVE_LO_CLANG_DLLEXPORTINLINES])
12103 SYSTEM_GPGMEPP=
12105 if test "$enable_gpgmepp" = no; then
12106     AC_MSG_CHECKING([whether to enable gpgmepp])
12107     AC_MSG_RESULT([no])
12108 elif test "$enable_mpl_subset" = "yes"; then
12109     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
12110     AC_MSG_RESULT([yes])
12111 elif test "$enable_fuzzers" = "yes"; then
12112     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
12113     AC_MSG_RESULT([yes])
12114 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
12115     dnl ===================================================================
12116     dnl Check for system gpgme
12117     dnl ===================================================================
12118     AC_MSG_CHECKING([which gpgmepp to use])
12119     if test "$with_system_gpgmepp" = "yes"; then
12120         AC_MSG_RESULT([external])
12121         SYSTEM_GPGMEPP=TRUE
12123         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
12124         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
12125             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
12126         # progress_callback is the only func with plain C linkage
12127         # checking for it also filters out older, KDE-dependent libgpgmepp versions
12128         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
12129             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
12130         AC_CHECK_HEADER(gpgme.h, [],
12131             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
12132     else
12133         AC_MSG_RESULT([internal])
12134         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
12135         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
12137         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
12138         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
12139         if test "$_os" != "WINNT"; then
12140             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
12141             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
12142         fi
12143     fi
12144     ENABLE_GPGMEPP=TRUE
12145     AC_DEFINE([HAVE_FEATURE_GPGME])
12146     AC_PATH_PROG(GPG, gpg)
12147     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
12148     # so let's exclude that manually for the moment
12149     if test -n "$GPG" -a "$_os" != "WINNT"; then
12150         # make sure we not only have a working gpgme, but a full working
12151         # gpg installation to run OpenPGP signature verification
12152         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
12153     fi
12154     if test "$_os" = "Linux"; then
12155       uid=`id -u`
12156       AC_MSG_CHECKING([for /run/user/$uid])
12157       if test -d /run/user/$uid; then
12158         AC_MSG_RESULT([yes])
12159         AC_PATH_PROG(GPGCONF, gpgconf)
12161         # Older versions of gpgconf are not working as expected, since
12162         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
12163         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
12164         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
12165         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
12166         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
12167         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
12168         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
12169           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
12170           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
12171           if $GPGCONF --dump-options > /dev/null ; then
12172             if $GPGCONF --dump-options | grep -q create-socketdir ; then
12173               AC_MSG_RESULT([yes])
12174               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
12175               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
12176             else
12177               AC_MSG_RESULT([no])
12178             fi
12179           else
12180             AC_MSG_RESULT([no. missing or broken gpgconf?])
12181           fi
12182         else
12183           AC_MSG_RESULT([no, $GPGCONF_VERSION])
12184         fi
12185       else
12186         AC_MSG_RESULT([no])
12187      fi
12188    fi
12190 AC_SUBST(ENABLE_GPGMEPP)
12191 AC_SUBST(SYSTEM_GPGMEPP)
12192 AC_SUBST(GPG_ERROR_CFLAGS)
12193 AC_SUBST(GPG_ERROR_LIBS)
12194 AC_SUBST(LIBASSUAN_CFLAGS)
12195 AC_SUBST(LIBASSUAN_LIBS)
12196 AC_SUBST(GPGMEPP_CFLAGS)
12197 AC_SUBST(GPGMEPP_LIBS)
12199 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
12200 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
12201     AC_MSG_RESULT([yes])
12202     ENABLE_MEDIAWIKI=TRUE
12203     BUILD_TYPE="$BUILD_TYPE XSLTML"
12204     if test  "x$with_java" = "xno"; then
12205         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
12206     fi
12207 else
12208     AC_MSG_RESULT([no])
12209     ENABLE_MEDIAWIKI=
12210     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
12212 AC_SUBST(ENABLE_MEDIAWIKI)
12214 AC_MSG_CHECKING([whether to build the Report Builder])
12215 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12216     AC_MSG_RESULT([yes])
12217     ENABLE_REPORTBUILDER=TRUE
12218     AC_MSG_CHECKING([which jfreereport libs to use])
12219     if test "$with_system_jfreereport" = "yes"; then
12220         SYSTEM_JFREEREPORT=TRUE
12221         AC_MSG_RESULT([external])
12222         if test -z $SAC_JAR; then
12223             SAC_JAR=/usr/share/java/sac.jar
12224         fi
12225         if ! test -f $SAC_JAR; then
12226              AC_MSG_ERROR(sac.jar not found.)
12227         fi
12229         if test -z $LIBXML_JAR; then
12230             if test -f /usr/share/java/libxml-1.0.0.jar; then
12231                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
12232             elif test -f /usr/share/java/libxml.jar; then
12233                 LIBXML_JAR=/usr/share/java/libxml.jar
12234             else
12235                 AC_MSG_ERROR(libxml.jar replacement not found.)
12236             fi
12237         elif ! test -f $LIBXML_JAR; then
12238             AC_MSG_ERROR(libxml.jar not found.)
12239         fi
12241         if test -z $FLUTE_JAR; then
12242             if test -f /usr/share/java/flute-1.3.0.jar; then
12243                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
12244             elif test -f /usr/share/java/flute.jar; then
12245                 FLUTE_JAR=/usr/share/java/flute.jar
12246             else
12247                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
12248             fi
12249         elif ! test -f $FLUTE_JAR; then
12250             AC_MSG_ERROR(flute-1.3.0.jar not found.)
12251         fi
12253         if test -z $JFREEREPORT_JAR; then
12254             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
12255                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
12256             elif test -f /usr/share/java/flow-engine.jar; then
12257                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
12258             else
12259                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
12260             fi
12261         elif ! test -f  $JFREEREPORT_JAR; then
12262                 AC_MSG_ERROR(jfreereport.jar not found.)
12263         fi
12265         if test -z $LIBLAYOUT_JAR; then
12266             if test -f /usr/share/java/liblayout-0.2.9.jar; then
12267                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
12268             elif test -f /usr/share/java/liblayout.jar; then
12269                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
12270             else
12271                 AC_MSG_ERROR(liblayout.jar replacement not found.)
12272             fi
12273         elif ! test -f $LIBLAYOUT_JAR; then
12274                 AC_MSG_ERROR(liblayout.jar not found.)
12275         fi
12277         if test -z $LIBLOADER_JAR; then
12278             if test -f /usr/share/java/libloader-1.0.0.jar; then
12279                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
12280             elif test -f /usr/share/java/libloader.jar; then
12281                 LIBLOADER_JAR=/usr/share/java/libloader.jar
12282             else
12283                 AC_MSG_ERROR(libloader.jar replacement not found.)
12284             fi
12285         elif ! test -f  $LIBLOADER_JAR; then
12286             AC_MSG_ERROR(libloader.jar not found.)
12287         fi
12289         if test -z $LIBFORMULA_JAR; then
12290             if test -f /usr/share/java/libformula-0.2.0.jar; then
12291                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
12292             elif test -f /usr/share/java/libformula.jar; then
12293                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
12294             else
12295                 AC_MSG_ERROR(libformula.jar replacement not found.)
12296             fi
12297         elif ! test -f $LIBFORMULA_JAR; then
12298                 AC_MSG_ERROR(libformula.jar not found.)
12299         fi
12301         if test -z $LIBREPOSITORY_JAR; then
12302             if test -f /usr/share/java/librepository-1.0.0.jar; then
12303                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
12304             elif test -f /usr/share/java/librepository.jar; then
12305                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
12306             else
12307                 AC_MSG_ERROR(librepository.jar replacement not found.)
12308             fi
12309         elif ! test -f $LIBREPOSITORY_JAR; then
12310             AC_MSG_ERROR(librepository.jar not found.)
12311         fi
12313         if test -z $LIBFONTS_JAR; then
12314             if test -f /usr/share/java/libfonts-1.0.0.jar; then
12315                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
12316             elif test -f /usr/share/java/libfonts.jar; then
12317                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
12318             else
12319                 AC_MSG_ERROR(libfonts.jar replacement not found.)
12320             fi
12321         elif ! test -f $LIBFONTS_JAR; then
12322                 AC_MSG_ERROR(libfonts.jar not found.)
12323         fi
12325         if test -z $LIBSERIALIZER_JAR; then
12326             if test -f /usr/share/java/libserializer-1.0.0.jar; then
12327                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
12328             elif test -f /usr/share/java/libserializer.jar; then
12329                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
12330             else
12331                 AC_MSG_ERROR(libserializer.jar replacement not found.)
12332             fi
12333         elif ! test -f $LIBSERIALIZER_JAR; then
12334                 AC_MSG_ERROR(libserializer.jar not found.)
12335         fi
12337         if test -z $LIBBASE_JAR; then
12338             if test -f /usr/share/java/libbase-1.0.0.jar; then
12339                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
12340             elif test -f /usr/share/java/libbase.jar; then
12341                 LIBBASE_JAR=/usr/share/java/libbase.jar
12342             else
12343                 AC_MSG_ERROR(libbase.jar replacement not found.)
12344             fi
12345         elif ! test -f $LIBBASE_JAR; then
12346             AC_MSG_ERROR(libbase.jar not found.)
12347         fi
12349     else
12350         AC_MSG_RESULT([internal])
12351         SYSTEM_JFREEREPORT=
12352         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
12353         NEED_ANT=TRUE
12354     fi
12355 else
12356     AC_MSG_RESULT([no])
12357     ENABLE_REPORTBUILDER=
12358     SYSTEM_JFREEREPORT=
12360 AC_SUBST(ENABLE_REPORTBUILDER)
12361 AC_SUBST(SYSTEM_JFREEREPORT)
12362 AC_SUBST(SAC_JAR)
12363 AC_SUBST(LIBXML_JAR)
12364 AC_SUBST(FLUTE_JAR)
12365 AC_SUBST(JFREEREPORT_JAR)
12366 AC_SUBST(LIBBASE_JAR)
12367 AC_SUBST(LIBLAYOUT_JAR)
12368 AC_SUBST(LIBLOADER_JAR)
12369 AC_SUBST(LIBFORMULA_JAR)
12370 AC_SUBST(LIBREPOSITORY_JAR)
12371 AC_SUBST(LIBFONTS_JAR)
12372 AC_SUBST(LIBSERIALIZER_JAR)
12374 # this has to be here because both the Wiki Publisher and the SRB use
12375 # commons-logging
12376 COMMONS_LOGGING_VERSION=1.2
12377 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12378     AC_MSG_CHECKING([which Apache commons-* libs to use])
12379     if test "$with_system_apache_commons" = "yes"; then
12380         SYSTEM_APACHE_COMMONS=TRUE
12381         AC_MSG_RESULT([external])
12382         if test -z $COMMONS_LOGGING_JAR; then
12383             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
12384                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
12385            elif test -f /usr/share/java/commons-logging.jar; then
12386                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
12387             else
12388                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
12389             fi
12390         elif ! test -f $COMMONS_LOGGING_JAR; then
12391             AC_MSG_ERROR(commons-logging.jar not found.)
12392         fi
12393     else
12394         AC_MSG_RESULT([internal])
12395         SYSTEM_APACHE_COMMONS=
12396         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
12397         NEED_ANT=TRUE
12398     fi
12400 AC_SUBST(SYSTEM_APACHE_COMMONS)
12401 AC_SUBST(COMMONS_LOGGING_JAR)
12402 AC_SUBST(COMMONS_LOGGING_VERSION)
12404 # scripting provider for BeanShell?
12405 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
12406 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
12407     AC_MSG_RESULT([yes])
12408     ENABLE_SCRIPTING_BEANSHELL=TRUE
12410     dnl ===================================================================
12411     dnl Check for system beanshell
12412     dnl ===================================================================
12413     AC_MSG_CHECKING([which beanshell to use])
12414     if test "$with_system_beanshell" = "yes"; then
12415         AC_MSG_RESULT([external])
12416         SYSTEM_BSH=TRUE
12417         if test -z $BSH_JAR; then
12418             BSH_JAR=/usr/share/java/bsh.jar
12419         fi
12420         if ! test -f $BSH_JAR; then
12421             AC_MSG_ERROR(bsh.jar not found.)
12422         fi
12423     else
12424         AC_MSG_RESULT([internal])
12425         SYSTEM_BSH=
12426         BUILD_TYPE="$BUILD_TYPE BSH"
12427     fi
12428 else
12429     AC_MSG_RESULT([no])
12430     ENABLE_SCRIPTING_BEANSHELL=
12431     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
12433 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
12434 AC_SUBST(SYSTEM_BSH)
12435 AC_SUBST(BSH_JAR)
12437 # scripting provider for JavaScript?
12438 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
12439 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
12440     AC_MSG_RESULT([yes])
12441     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
12443     dnl ===================================================================
12444     dnl Check for system rhino
12445     dnl ===================================================================
12446     AC_MSG_CHECKING([which rhino to use])
12447     if test "$with_system_rhino" = "yes"; then
12448         AC_MSG_RESULT([external])
12449         SYSTEM_RHINO=TRUE
12450         if test -z $RHINO_JAR; then
12451             RHINO_JAR=/usr/share/java/js.jar
12452         fi
12453         if ! test -f $RHINO_JAR; then
12454             AC_MSG_ERROR(js.jar not found.)
12455         fi
12456     else
12457         AC_MSG_RESULT([internal])
12458         SYSTEM_RHINO=
12459         BUILD_TYPE="$BUILD_TYPE RHINO"
12460         NEED_ANT=TRUE
12461     fi
12462 else
12463     AC_MSG_RESULT([no])
12464     ENABLE_SCRIPTING_JAVASCRIPT=
12465     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
12467 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
12468 AC_SUBST(SYSTEM_RHINO)
12469 AC_SUBST(RHINO_JAR)
12471 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
12472 # paths should be added to library search path. So lets put all 64-bit
12473 # platforms there.
12474 supports_multilib=
12475 case "$host_cpu" in
12476 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
12477     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
12478         supports_multilib="yes"
12479     fi
12480     ;;
12482     ;;
12483 esac
12485 dnl ===================================================================
12486 dnl QT5 Integration
12487 dnl ===================================================================
12489 QT5_CFLAGS=""
12490 QT5_LIBS=""
12491 QMAKE5="qmake"
12492 MOC5="moc"
12493 QT5_GOBJECT_CFLAGS=""
12494 QT5_GOBJECT_LIBS=""
12495 QT5_HAVE_GOBJECT=""
12496 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
12497         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
12498         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
12499 then
12500     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
12501     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
12503     if test -n "$supports_multilib"; then
12504         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
12505     fi
12507     qt5_test_include="QtWidgets/qapplication.h"
12508     qt5_test_library="libQt5Widgets.so"
12510     dnl Check for qmake5
12511     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH])
12512     if test "$QMAKE5" = "no"; then
12513         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12514     else
12515         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
12516         if test -z "$qmake5_test_ver"; then
12517             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12518         fi
12519         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
12520         qt5_minimal_minor="6"
12521         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
12522             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
12523         else
12524             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
12525         fi
12526     fi
12528     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
12529     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
12531     AC_MSG_CHECKING([for Qt5 headers])
12532     qt5_incdir="no"
12533     for inc_dir in $qt5_incdirs; do
12534         if test -r "$inc_dir/$qt5_test_include"; then
12535             qt5_incdir="$inc_dir"
12536             break
12537         fi
12538     done
12539     AC_MSG_RESULT([$qt5_incdir])
12540     if test "x$qt5_incdir" = "xno"; then
12541         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12542     fi
12543     # check for scenario: qt5-qtbase-devel-*.86_64 installed but host is i686
12544     AC_LANG_PUSH([C++])
12545     save_CPPFLAGS=$CPPFLAGS
12546     CPPFLAGS="${CPPFLAGS} -I${qt5_incdir}"
12547     AC_CHECK_HEADER(QtCore/qconfig.h, [],
12548         [AC_MSG_ERROR(qconfig.h header not found.)], [])
12549     CPPFLAGS=$save_CPPFLAGS
12550     AC_LANG_POP([C++])
12552     AC_MSG_CHECKING([for Qt5 libraries])
12553     qt5_libdir="no"
12554     for lib_dir in $qt5_libdirs; do
12555         if test -r "$lib_dir/$qt5_test_library"; then
12556             qt5_libdir="$lib_dir"
12557             break
12558         fi
12559     done
12560     AC_MSG_RESULT([$qt5_libdir])
12561     if test "x$qt5_libdir" = "xno"; then
12562         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12563     fi
12565     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
12566     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12567     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
12569     if test "$USING_X11" = TRUE; then
12570         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
12571         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
12572             QT5_HAVE_XCB_ICCCM=1
12573             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
12574         ],[
12575             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)])
12576             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
12577         ])
12578         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
12579         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
12580         QT5_USING_X11=1
12581         AC_DEFINE(QT5_USING_X11)
12582     fi
12584     dnl Check for Meta Object Compiler
12586     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
12587     if test "$MOC5" = "no"; then
12588         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
12589 the root of your Qt installation by exporting QT5DIR before running "configure".])
12590     fi
12592     if test "$build_gstreamer_1_0" = "yes"; then
12593         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
12594                 QT5_HAVE_GOBJECT=1
12595                 AC_DEFINE(QT5_HAVE_GOBJECT)
12596             ],
12597             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
12598         )
12599     fi
12601 AC_SUBST(QT5_CFLAGS)
12602 AC_SUBST(QT5_LIBS)
12603 AC_SUBST(MOC5)
12604 AC_SUBST(QT5_GOBJECT_CFLAGS)
12605 AC_SUBST(QT5_GOBJECT_LIBS)
12606 AC_SUBST(QT5_HAVE_GOBJECT)
12608 dnl ===================================================================
12609 dnl KF5 Integration
12610 dnl ===================================================================
12612 KF5_CFLAGS=""
12613 KF5_LIBS=""
12614 KF5_CONFIG="kf5-config"
12615 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
12616         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
12617 then
12618     if test "$OS" = "HAIKU"; then
12619         haiku_arch="`echo $RTL_ARCH | tr X x`"
12620         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
12621         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
12622     fi
12624     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
12625     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
12626     if test -n "$supports_multilib"; then
12627         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
12628     fi
12630     kf5_test_include="KF5/kcoreaddons_version.h"
12631     kf5_test_library="libKF5CoreAddons.so"
12632     kf5_libdirs="$qt5_libdir $kf5_libdirs"
12634     dnl kf5 KDE4 support compatibility installed
12635     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
12636     if test "$KF5_CONFIG" != "no"; then
12637         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
12638         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
12639     fi
12641     dnl Check for KF5 headers
12642     AC_MSG_CHECKING([for KF5 headers])
12643     kf5_incdir="no"
12644     for kf5_check in $kf5_incdirs; do
12645         if test -r "$kf5_check/$kf5_test_include"; then
12646             kf5_incdir="$kf5_check/KF5"
12647             break
12648         fi
12649     done
12650     AC_MSG_RESULT([$kf5_incdir])
12651     if test "x$kf5_incdir" = "xno"; then
12652         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
12653     fi
12655     dnl Check for KF5 libraries
12656     AC_MSG_CHECKING([for KF5 libraries])
12657     kf5_libdir="no"
12658     for kf5_check in $kf5_libdirs; do
12659         if test -r "$kf5_check/$kf5_test_library"; then
12660             kf5_libdir="$kf5_check"
12661             break
12662         fi
12663     done
12665     AC_MSG_RESULT([$kf5_libdir])
12666     if test "x$kf5_libdir" = "xno"; then
12667         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
12668     fi
12670     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"
12671     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
12672     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12674     if test "$USING_X11" = TRUE; then
12675         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
12676     fi
12678     AC_LANG_PUSH([C++])
12679     save_CXXFLAGS=$CXXFLAGS
12680     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
12681     AC_MSG_CHECKING([whether KDE is >= 5.0])
12682        AC_RUN_IFELSE([AC_LANG_SOURCE([[
12683 #include <kcoreaddons_version.h>
12685 int main(int argc, char **argv) {
12686        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
12687        else return 1;
12689        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
12690     CXXFLAGS=$save_CXXFLAGS
12691     AC_LANG_POP([C++])
12693 AC_SUBST(KF5_CFLAGS)
12694 AC_SUBST(KF5_LIBS)
12696 dnl ===================================================================
12697 dnl Test whether to include Evolution 2 support
12698 dnl ===================================================================
12699 AC_MSG_CHECKING([whether to enable evolution 2 support])
12700 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
12701     AC_MSG_RESULT([yes])
12702     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
12703     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12704     FilterLibs "${GOBJECT_LIBS}"
12705     GOBJECT_LIBS="${filteredlibs}"
12706     ENABLE_EVOAB2="TRUE"
12707 else
12708     ENABLE_EVOAB2=""
12709     AC_MSG_RESULT([no])
12711 AC_SUBST(ENABLE_EVOAB2)
12712 AC_SUBST(GOBJECT_CFLAGS)
12713 AC_SUBST(GOBJECT_LIBS)
12715 dnl ===================================================================
12716 dnl Test which themes to include
12717 dnl ===================================================================
12718 AC_MSG_CHECKING([which themes to include])
12719 # if none given use default subset of available themes
12720 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
12721     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"
12724 WITH_THEMES=""
12725 if test "x$with_theme" != "xno"; then
12726     for theme in $with_theme; do
12727         case $theme in
12728         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" ;;
12729         default) real_theme=colibre ;;
12730         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
12731         esac
12732         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
12733     done
12735 AC_MSG_RESULT([$WITH_THEMES])
12736 AC_SUBST([WITH_THEMES])
12737 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
12738 for theme in $with_theme; do
12739     case $theme in
12740     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
12741     *) ;;
12742     esac
12743 done
12745 dnl ===================================================================
12746 dnl Test whether to integrate helppacks into the product's installer
12747 dnl ===================================================================
12748 AC_MSG_CHECKING([for helppack integration])
12749 if test "$with_helppack_integration" = "no"; then
12750     AC_MSG_RESULT([no integration])
12751 else
12752     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
12753     AC_MSG_RESULT([integration])
12756 ###############################################################################
12757 # Extensions checking
12758 ###############################################################################
12759 AC_MSG_CHECKING([for extensions integration])
12760 if test "x$enable_extension_integration" != "xno"; then
12761     WITH_EXTENSION_INTEGRATION=TRUE
12762     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
12763     AC_MSG_RESULT([yes, use integration])
12764 else
12765     WITH_EXTENSION_INTEGRATION=
12766     AC_MSG_RESULT([no, do not integrate])
12768 AC_SUBST(WITH_EXTENSION_INTEGRATION)
12770 dnl Should any extra extensions be included?
12771 dnl There are standalone tests for each of these below.
12772 WITH_EXTRA_EXTENSIONS=
12773 AC_SUBST([WITH_EXTRA_EXTENSIONS])
12775 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
12776 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
12777 if test "x$with_java" != "xno"; then
12778     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
12779     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
12782 AC_MSG_CHECKING([whether to build opens___.ttf])
12783 if test "$enable_build_opensymbol" = "yes"; then
12784     AC_MSG_RESULT([yes])
12785     AC_PATH_PROG(FONTFORGE, fontforge)
12786     if test -z "$FONTFORGE"; then
12787         AC_MSG_ERROR([fontforge not installed])
12788     fi
12789 else
12790     AC_MSG_RESULT([no])
12791     OPENSYMBOL_TTF=f543e6e2d7275557a839a164941c0a86e5f2c3f2a0042bfc434c88c6dde9e140-opens___.ttf
12792     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
12794 AC_SUBST(OPENSYMBOL_TTF)
12795 AC_SUBST(FONTFORGE)
12797 dnl ===================================================================
12798 dnl Test whether to include fonts
12799 dnl ===================================================================
12800 AC_MSG_CHECKING([whether to include third-party fonts])
12801 if test "$with_fonts" != "no"; then
12802     AC_MSG_RESULT([yes])
12803     WITH_FONTS=TRUE
12804     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
12805     AC_DEFINE(HAVE_MORE_FONTS)
12806 else
12807     AC_MSG_RESULT([no])
12808     WITH_FONTS=
12809     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
12811 AC_SUBST(WITH_FONTS)
12813 dnl Test whether to include more Google Noto fonts
12814 dnl ===================================================================
12815 AC_MSG_CHECKING([whether to include more Google Noto fonts])
12816 if test "$enable_noto_font" = "" -o "$enable_noto_font" = "no" -o "$with_fonts" = "no"; then
12817     AC_MSG_RESULT([no])
12818     WITH_NOTO_FONT=
12819 else
12820     AC_MSG_RESULT([yes])
12821     WITH_NOTO_FONT=TRUE
12822     BUILD_TYPE="$BUILD_TYPE NOTO_FONT"
12823     SCPDEFS="$SCPDEFS -DWITH_NOTO_FONT"
12825 AC_SUBST(WITH_NOTO_FONT)
12827 dnl ===================================================================
12828 dnl Test whether to enable online update service
12829 dnl ===================================================================
12830 AC_MSG_CHECKING([whether to enable online update])
12831 ENABLE_ONLINE_UPDATE=
12832 ENABLE_ONLINE_UPDATE_MAR=
12833 UPDATE_CONFIG=
12834 if test "$enable_online_update" = ""; then
12835     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
12836         AC_MSG_RESULT([yes])
12837         ENABLE_ONLINE_UPDATE="TRUE"
12838     else
12839         AC_MSG_RESULT([no])
12840     fi
12841 else
12842     if test "$enable_online_update" = "mar"; then
12843         AC_MSG_RESULT([yes - MAR-based online update])
12844         ENABLE_ONLINE_UPDATE_MAR="TRUE"
12845         if test "$with_update_config" = ""; then
12846             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
12847         fi
12848         UPDATE_CONFIG="$with_update_config"
12849         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
12850     elif test "$enable_online_update" = "yes"; then
12851         AC_MSG_RESULT([yes])
12852         ENABLE_ONLINE_UPDATE="TRUE"
12853     else
12854         AC_MSG_RESULT([no])
12855     fi
12857 AC_SUBST(ENABLE_ONLINE_UPDATE)
12858 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
12859 AC_SUBST(UPDATE_CONFIG)
12861 dnl ===================================================================
12862 dnl Test whether we need bzip2
12863 dnl ===================================================================
12864 SYSTEM_BZIP2=
12865 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
12866     AC_MSG_CHECKING([whether to use system bzip2])
12867     if test "$with_system_bzip2" = yes; then
12868         SYSTEM_BZIP2=TRUE
12869         AC_MSG_RESULT([yes])
12870         PKG_CHECK_MODULES(BZIP2, bzip2)
12871         FilterLibs "${BZIP2_LIBS}"
12872         BZIP2_LIBS="${filteredlibs}"
12873     else
12874         AC_MSG_RESULT([no])
12875         BUILD_TYPE="$BUILD_TYPE BZIP2"
12876     fi
12878 AC_SUBST(SYSTEM_BZIP2)
12879 AC_SUBST(BZIP2_CFLAGS)
12880 AC_SUBST(BZIP2_LIBS)
12882 dnl ===================================================================
12883 dnl Test whether to enable extension update
12884 dnl ===================================================================
12885 AC_MSG_CHECKING([whether to enable extension update])
12886 ENABLE_EXTENSION_UPDATE=
12887 if test "x$enable_extension_update" = "xno"; then
12888     AC_MSG_RESULT([no])
12889 else
12890     AC_MSG_RESULT([yes])
12891     ENABLE_EXTENSION_UPDATE="TRUE"
12892     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
12893     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
12895 AC_SUBST(ENABLE_EXTENSION_UPDATE)
12898 dnl ===================================================================
12899 dnl Test whether to create MSI with LIMITUI=1 (silent install)
12900 dnl ===================================================================
12901 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
12902 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
12903     AC_MSG_RESULT([no])
12904     ENABLE_SILENT_MSI=
12905 else
12906     AC_MSG_RESULT([yes])
12907     ENABLE_SILENT_MSI=TRUE
12908     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
12910 AC_SUBST(ENABLE_SILENT_MSI)
12912 AC_MSG_CHECKING([whether and how to use Xinerama])
12913 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
12914     if test "$x_libraries" = "default_x_libraries"; then
12915         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
12916         if test "x$XINERAMALIB" = x; then
12917            XINERAMALIB="/usr/lib"
12918         fi
12919     else
12920         XINERAMALIB="$x_libraries"
12921     fi
12922     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
12923         # we have both versions, let the user decide but use the dynamic one
12924         # per default
12925         USE_XINERAMA=TRUE
12926         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
12927             XINERAMA_LINK=dynamic
12928         else
12929             XINERAMA_LINK=static
12930         fi
12931     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
12932         # we have only the dynamic version
12933         USE_XINERAMA=TRUE
12934         XINERAMA_LINK=dynamic
12935     elif test -e "$XINERAMALIB/libXinerama.a"; then
12936         # static version
12937         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
12938             USE_XINERAMA=TRUE
12939             XINERAMA_LINK=static
12940         else
12941             USE_XINERAMA=
12942             XINERAMA_LINK=none
12943         fi
12944     else
12945         # no Xinerama
12946         USE_XINERAMA=
12947         XINERAMA_LINK=none
12948     fi
12949     if test "$USE_XINERAMA" = "TRUE"; then
12950         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
12951         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
12952             [AC_MSG_ERROR(Xinerama header not found.)], [])
12953         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
12954         if test "x$XEXTLIB" = x; then
12955            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
12956         fi
12957         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
12958         if test "$_os" = "FreeBSD"; then
12959             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
12960         fi
12961         if test "$_os" = "Linux"; then
12962             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
12963         fi
12964         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
12965             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
12966     else
12967         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
12968     fi
12969 else
12970     USE_XINERAMA=
12971     XINERAMA_LINK=none
12972     AC_MSG_RESULT([no])
12974 AC_SUBST(USE_XINERAMA)
12975 AC_SUBST(XINERAMA_LINK)
12977 dnl ===================================================================
12978 dnl Test whether to build cairo or rely on the system version
12979 dnl ===================================================================
12981 if test "$USING_X11" = TRUE; then
12982     # Used in vcl/Library_vclplug_gen.mk
12983     test_cairo=yes
12986 if test "$test_cairo" = "yes"; then
12987     AC_MSG_CHECKING([whether to use the system cairo])
12989     : ${with_system_cairo:=$with_system_libs}
12990     if test "$with_system_cairo" = "yes"; then
12991         SYSTEM_CAIRO=TRUE
12992         AC_MSG_RESULT([yes])
12994         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
12995         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12996         FilterLibs "${CAIRO_LIBS}"
12997         CAIRO_LIBS="${filteredlibs}"
12999         if test "$test_xrender" = "yes"; then
13000             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
13001             AC_LANG_PUSH([C])
13002             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
13003 #ifdef PictStandardA8
13004 #else
13005       return fail;
13006 #endif
13007 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
13009             AC_LANG_POP([C])
13010         fi
13011     else
13012         SYSTEM_CAIRO=
13013         AC_MSG_RESULT([no])
13015         BUILD_TYPE="$BUILD_TYPE CAIRO"
13016     fi
13019 AC_SUBST(SYSTEM_CAIRO)
13020 AC_SUBST(CAIRO_CFLAGS)
13021 AC_SUBST(CAIRO_LIBS)
13023 dnl ===================================================================
13024 dnl Test whether to use avahi
13025 dnl ===================================================================
13026 if test "$_os" = "WINNT"; then
13027     # Windows uses bundled mDNSResponder
13028     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
13029 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
13030     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
13031                       [ENABLE_AVAHI="TRUE"])
13032     AC_DEFINE(HAVE_FEATURE_AVAHI)
13033     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13034     FilterLibs "${AVAHI_LIBS}"
13035     AVAHI_LIBS="${filteredlibs}"
13038 AC_SUBST(ENABLE_AVAHI)
13039 AC_SUBST(AVAHI_CFLAGS)
13040 AC_SUBST(AVAHI_LIBS)
13042 dnl ===================================================================
13043 dnl Test whether to use liblangtag
13044 dnl ===================================================================
13045 SYSTEM_LIBLANGTAG=
13046 AC_MSG_CHECKING([whether to use system liblangtag])
13047 if test "$with_system_liblangtag" = yes; then
13048     SYSTEM_LIBLANGTAG=TRUE
13049     AC_MSG_RESULT([yes])
13050     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
13051     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
13052     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
13053     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13054     FilterLibs "${LIBLANGTAG_LIBS}"
13055     LIBLANGTAG_LIBS="${filteredlibs}"
13056 else
13057     SYSTEM_LIBLANGTAG=
13058     AC_MSG_RESULT([no])
13059     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
13060     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
13061     if test "$COM" = "MSC"; then
13062         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
13063     else
13064         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
13065     fi
13067 AC_SUBST(SYSTEM_LIBLANGTAG)
13068 AC_SUBST(LIBLANGTAG_CFLAGS)
13069 AC_SUBST(LIBLANGTAG_LIBS)
13071 dnl ===================================================================
13072 dnl Test whether to build libpng or rely on the system version
13073 dnl ===================================================================
13075 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
13077 dnl ===================================================================
13078 dnl Check for runtime JVM search path
13079 dnl ===================================================================
13080 if test "$ENABLE_JAVA" != ""; then
13081     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
13082     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
13083         AC_MSG_RESULT([yes])
13084         if ! test -d "$with_jvm_path"; then
13085             AC_MSG_ERROR(["$with_jvm_path" not a directory])
13086         fi
13087         if ! test -d "$with_jvm_path"jvm; then
13088             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
13089         fi
13090         JVM_ONE_PATH_CHECK="$with_jvm_path"
13091         AC_SUBST(JVM_ONE_PATH_CHECK)
13092     else
13093         AC_MSG_RESULT([no])
13094     fi
13097 dnl ===================================================================
13098 dnl Test for the presence of Ant and that it works
13099 dnl ===================================================================
13101 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE" -a "$cross_compiling" != "yes"; then
13102     ANT_HOME=; export ANT_HOME
13103     WITH_ANT_HOME=; export WITH_ANT_HOME
13104     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
13105         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
13106             if test "$_os" = "WINNT"; then
13107                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
13108             else
13109                 with_ant_home="$LODE_HOME/opt/ant"
13110             fi
13111         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
13112             with_ant_home="$LODE_HOME/opt/ant"
13113         fi
13114     fi
13115     if test -z "$with_ant_home"; then
13116         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
13117     else
13118         if test "$_os" = "WINNT"; then
13119             # AC_PATH_PROGS needs unix path
13120             with_ant_home=`cygpath -u "$with_ant_home"`
13121         fi
13122         AbsolutePath "$with_ant_home"
13123         with_ant_home=$absolute_path
13124         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
13125         WITH_ANT_HOME=$with_ant_home
13126         ANT_HOME=$with_ant_home
13127     fi
13129     if test -z "$ANT"; then
13130         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
13131     else
13132         # resolve relative or absolute symlink
13133         while test -h "$ANT"; do
13134             a_cwd=`pwd`
13135             a_basename=`basename "$ANT"`
13136             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
13137             cd "`dirname "$ANT"`"
13138             cd "`dirname "$a_script"`"
13139             ANT="`pwd`"/"`basename "$a_script"`"
13140             cd "$a_cwd"
13141         done
13143         AC_MSG_CHECKING([if $ANT works])
13144         mkdir -p conftest.dir
13145         a_cwd=$(pwd)
13146         cd conftest.dir
13147         cat > conftest.java << EOF
13148         public class conftest {
13149             int testmethod(int a, int b) {
13150                     return a + b;
13151             }
13152         }
13155         cat > conftest.xml << EOF
13156         <project name="conftest" default="conftest">
13157         <target name="conftest">
13158             <javac srcdir="." includes="conftest.java">
13159             </javac>
13160         </target>
13161         </project>
13164         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
13165         if test $? = 0 -a -f ./conftest.class; then
13166             AC_MSG_RESULT([Ant works])
13167             if test -z "$WITH_ANT_HOME"; then
13168                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
13169                 if test -z "$ANT_HOME"; then
13170                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
13171                 fi
13172             else
13173                 ANT_HOME="$WITH_ANT_HOME"
13174             fi
13175         else
13176             echo "configure: Ant test failed" >&5
13177             cat conftest.java >&5
13178             cat conftest.xml >&5
13179             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
13180         fi
13181         cd "$a_cwd"
13182         rm -fr conftest.dir
13183     fi
13184     if test -z "$ANT_HOME"; then
13185         ANT_HOME="NO_ANT_HOME"
13186     else
13187         PathFormat "$ANT_HOME"
13188         ANT_HOME="$formatted_path"
13189         PathFormat "$ANT"
13190         ANT="$formatted_path"
13191     fi
13193     dnl Checking for ant.jar
13194     if test "$ANT_HOME" != "NO_ANT_HOME"; then
13195         AC_MSG_CHECKING([Ant lib directory])
13196         if test -f $ANT_HOME/lib/ant.jar; then
13197             ANT_LIB="$ANT_HOME/lib"
13198         else
13199             if test -f $ANT_HOME/ant.jar; then
13200                 ANT_LIB="$ANT_HOME"
13201             else
13202                 if test -f /usr/share/java/ant.jar; then
13203                     ANT_LIB=/usr/share/java
13204                 else
13205                     if test -f /usr/share/ant-core/lib/ant.jar; then
13206                         ANT_LIB=/usr/share/ant-core/lib
13207                     else
13208                         if test -f $ANT_HOME/lib/ant/ant.jar; then
13209                             ANT_LIB="$ANT_HOME/lib/ant"
13210                         else
13211                             if test -f /usr/share/lib/ant/ant.jar; then
13212                                 ANT_LIB=/usr/share/lib/ant
13213                             else
13214                                 AC_MSG_ERROR([Ant libraries not found!])
13215                             fi
13216                         fi
13217                     fi
13218                 fi
13219             fi
13220         fi
13221         PathFormat "$ANT_LIB"
13222         ANT_LIB="$formatted_path"
13223         AC_MSG_RESULT([Ant lib directory found.])
13224     fi
13226     ant_minver=1.6.0
13227     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
13229     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
13230     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
13231     ant_version_major=`echo $ant_version | cut -d. -f1`
13232     ant_version_minor=`echo $ant_version | cut -d. -f2`
13233     echo "configure: ant_version $ant_version " >&5
13234     echo "configure: ant_version_major $ant_version_major " >&5
13235     echo "configure: ant_version_minor $ant_version_minor " >&5
13236     if test "$ant_version_major" -ge "2"; then
13237         AC_MSG_RESULT([yes, $ant_version])
13238     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
13239         AC_MSG_RESULT([yes, $ant_version])
13240     else
13241         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
13242     fi
13244     rm -f conftest* core core.* *.core
13246 AC_SUBST(ANT)
13247 AC_SUBST(ANT_HOME)
13248 AC_SUBST(ANT_LIB)
13250 OOO_JUNIT_JAR=
13251 HAMCREST_JAR=
13252 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no" -a "$cross_compiling" != "yes"; then
13253     AC_MSG_CHECKING([for JUnit 4])
13254     if test "$with_junit" = "yes"; then
13255         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
13256             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
13257         elif test -e /usr/share/java/junit4.jar; then
13258             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
13259         else
13260            if test -e /usr/share/lib/java/junit.jar; then
13261               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
13262            else
13263               OOO_JUNIT_JAR=/usr/share/java/junit.jar
13264            fi
13265         fi
13266     else
13267         OOO_JUNIT_JAR=$with_junit
13268     fi
13269     if test "$_os" = "WINNT"; then
13270         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
13271     fi
13272     printf 'import org.junit.Before;' > conftest.java
13273     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
13274         AC_MSG_RESULT([$OOO_JUNIT_JAR])
13275     else
13276         AC_MSG_ERROR(
13277 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
13278  specify its pathname via --with-junit=..., or disable it via --without-junit])
13279     fi
13280     rm -f conftest.class conftest.java
13281     if test $OOO_JUNIT_JAR != ""; then
13282         BUILD_TYPE="$BUILD_TYPE QADEVOOO"
13283     fi
13285     AC_MSG_CHECKING([for included Hamcrest])
13286     printf 'import org.hamcrest.BaseDescription;' > conftest.java
13287     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
13288         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
13289     else
13290         AC_MSG_RESULT([Not included])
13291         AC_MSG_CHECKING([for standalone hamcrest jar.])
13292         if test "$with_hamcrest" = "yes"; then
13293             if test -e /usr/share/lib/java/hamcrest.jar; then
13294                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
13295             elif test -e /usr/share/java/hamcrest/core.jar; then
13296                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
13297             elif test -e /usr/share/java/hamcrest/hamcrest.jar; then
13298                 HAMCREST_JAR=/usr/share/java/hamcrest/hamcrest.jar
13299             else
13300                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
13301             fi
13302         else
13303             HAMCREST_JAR=$with_hamcrest
13304         fi
13305         if test "$_os" = "WINNT"; then
13306             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
13307         fi
13308         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
13309             AC_MSG_RESULT([$HAMCREST_JAR])
13310         else
13311             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),
13312                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
13313         fi
13314     fi
13315     rm -f conftest.class conftest.java
13317 AC_SUBST(OOO_JUNIT_JAR)
13318 AC_SUBST(HAMCREST_JAR)
13321 AC_SUBST(SCPDEFS)
13324 # check for wget and curl
13326 WGET=
13327 CURL=
13329 if test "$enable_fetch_external" != "no"; then
13331 CURL=`which curl 2>/dev/null`
13333 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
13334     # wget new enough?
13335     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
13336     if test $? -eq 0; then
13337         WGET=$i
13338         break
13339     fi
13340 done
13342 if test -z "$WGET" -a -z "$CURL"; then
13343     AC_MSG_ERROR([neither wget nor curl found!])
13348 AC_SUBST(WGET)
13349 AC_SUBST(CURL)
13352 # check for sha256sum
13354 SHA256SUM=
13356 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
13357     eval "$i -a 256 --version" > /dev/null 2>&1
13358     ret=$?
13359     if test $ret -eq 0; then
13360         SHA256SUM="$i -a 256"
13361         break
13362     fi
13363 done
13365 if test -z "$SHA256SUM"; then
13366     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
13367         eval "$i --version" > /dev/null 2>&1
13368         ret=$?
13369         if test $ret -eq 0; then
13370             SHA256SUM=$i
13371             break
13372         fi
13373     done
13376 if test -z "$SHA256SUM"; then
13377     AC_MSG_ERROR([no sha256sum found!])
13380 AC_SUBST(SHA256SUM)
13382 dnl ===================================================================
13383 dnl Dealing with l10n options
13384 dnl ===================================================================
13385 AC_MSG_CHECKING([which languages to be built])
13386 # get list of all languages
13387 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
13388 # the sed command does the following:
13389 #   + if a line ends with a backslash, append the next line to it
13390 #   + adds " on the beginning of the value (after =)
13391 #   + adds " at the end of the value
13392 #   + removes en-US; we want to put it on the beginning
13393 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
13394 [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)]
13395 ALL_LANGS="en-US $completelangiso"
13396 # check the configured localizations
13397 WITH_LANG="$with_lang"
13399 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
13400 # (Norwegian is "nb" and "nn".)
13401 if test "$WITH_LANG" = "no"; then
13402     WITH_LANG=
13405 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
13406     AC_MSG_RESULT([en-US])
13407 else
13408     AC_MSG_RESULT([$WITH_LANG])
13409     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
13410     if test -z "$MSGFMT"; then
13411         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
13412             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
13413         elif test -x "/opt/lo/bin/msgfmt"; then
13414             MSGFMT="/opt/lo/bin/msgfmt"
13415         else
13416             AC_CHECK_PROGS(MSGFMT, [msgfmt])
13417             if test -z "$MSGFMT"; then
13418                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
13419             fi
13420         fi
13421     fi
13422     if test -z "$MSGUNIQ"; then
13423         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
13424             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
13425         elif test -x "/opt/lo/bin/msguniq"; then
13426             MSGUNIQ="/opt/lo/bin/msguniq"
13427         else
13428             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
13429             if test -z "$MSGUNIQ"; then
13430                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
13431             fi
13432         fi
13433     fi
13435 AC_SUBST(MSGFMT)
13436 AC_SUBST(MSGUNIQ)
13437 # check that the list is valid
13438 for lang in $WITH_LANG; do
13439     test "$lang" = "ALL" && continue
13440     # need to check for the exact string, so add space before and after the list of all languages
13441     for vl in $ALL_LANGS; do
13442         if test "$vl" = "$lang"; then
13443            break
13444         fi
13445     done
13446     if test "$vl" != "$lang"; then
13447         # if you're reading this - you prolly quoted your languages remove the quotes ...
13448         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
13449     fi
13450 done
13451 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
13452     echo $WITH_LANG | grep -q en-US
13453     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
13455 # list with substituted ALL
13456 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
13457 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
13458 test "$WITH_LANG" = "en-US" && WITH_LANG=
13459 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
13460     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
13461     ALL_LANGS=`echo $ALL_LANGS qtz`
13463 AC_SUBST(ALL_LANGS)
13464 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
13465 AC_SUBST(WITH_LANG)
13466 AC_SUBST(WITH_LANG_LIST)
13467 AC_SUBST(GIT_NEEDED_SUBMODULES)
13469 WITH_POOR_HELP_LOCALIZATIONS=
13470 if test -d "$SRC_ROOT/translations/source"; then
13471     for l in `ls -1 $SRC_ROOT/translations/source`; do
13472         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
13473             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
13474         fi
13475     done
13477 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
13479 if test -n "$with_locales"; then
13480     WITH_LOCALES="$with_locales"
13482     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
13483     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
13484     # config_host/config_locales.h.in
13485     for locale in $WITH_LOCALES; do
13486         lang=${locale%_*}
13488         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
13490         case $lang in
13491         hi|mr*ne)
13492             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
13493             ;;
13494         bg|ru)
13495             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
13496             ;;
13497         esac
13498     done
13499 else
13500     AC_DEFINE(WITH_LOCALE_ALL)
13502 AC_SUBST(WITH_LOCALES)
13504 dnl git submodule update --reference
13505 dnl ===================================================================
13506 if test -n "${GIT_REFERENCE_SRC}"; then
13507     for repo in ${GIT_NEEDED_SUBMODULES}; do
13508         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
13509             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
13510         fi
13511     done
13513 AC_SUBST(GIT_REFERENCE_SRC)
13515 dnl git submodules linked dirs
13516 dnl ===================================================================
13517 if test -n "${GIT_LINK_SRC}"; then
13518     for repo in ${GIT_NEEDED_SUBMODULES}; do
13519         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
13520             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
13521         fi
13522     done
13524 AC_SUBST(GIT_LINK_SRC)
13526 dnl branding
13527 dnl ===================================================================
13528 AC_MSG_CHECKING([for alternative branding images directory])
13529 # initialize mapped arrays
13530 BRAND_INTRO_IMAGES="intro.png intro-highres.png"
13531 brand_files="$BRAND_INTRO_IMAGES logo.svg logo_inverted.svg logo-sc.svg logo-sc_inverted.svg about.svg"
13533 if test -z "$with_branding" -o "$with_branding" = "no"; then
13534     AC_MSG_RESULT([none])
13535     DEFAULT_BRAND_IMAGES="$brand_files"
13536 else
13537     if ! test -d $with_branding ; then
13538         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
13539     else
13540         AC_MSG_RESULT([$with_branding])
13541         CUSTOM_BRAND_DIR="$with_branding"
13542         for lfile in $brand_files
13543         do
13544             if ! test -f $with_branding/$lfile ; then
13545                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
13546                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
13547             else
13548                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
13549             fi
13550         done
13551         check_for_progress="yes"
13552     fi
13554 AC_SUBST([BRAND_INTRO_IMAGES])
13555 AC_SUBST([CUSTOM_BRAND_DIR])
13556 AC_SUBST([CUSTOM_BRAND_IMAGES])
13557 AC_SUBST([DEFAULT_BRAND_IMAGES])
13560 AC_MSG_CHECKING([for 'intro' progress settings])
13561 PROGRESSBARCOLOR=
13562 PROGRESSSIZE=
13563 PROGRESSPOSITION=
13564 PROGRESSFRAMECOLOR=
13565 PROGRESSTEXTCOLOR=
13566 PROGRESSTEXTBASELINE=
13568 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
13569     source "$with_branding/progress.conf"
13570     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
13571 else
13572     AC_MSG_RESULT([none])
13575 AC_SUBST(PROGRESSBARCOLOR)
13576 AC_SUBST(PROGRESSSIZE)
13577 AC_SUBST(PROGRESSPOSITION)
13578 AC_SUBST(PROGRESSFRAMECOLOR)
13579 AC_SUBST(PROGRESSTEXTCOLOR)
13580 AC_SUBST(PROGRESSTEXTBASELINE)
13583 dnl ===================================================================
13584 dnl Custom build version
13585 dnl ===================================================================
13586 AC_MSG_CHECKING([for extra build ID])
13587 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
13588     EXTRA_BUILDID="$with_extra_buildid"
13590 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
13591 if test -n "$EXTRA_BUILDID" ; then
13592     AC_MSG_RESULT([$EXTRA_BUILDID])
13593 else
13594     AC_MSG_RESULT([not set])
13596 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
13598 OOO_VENDOR=
13599 AC_MSG_CHECKING([for vendor])
13600 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
13601     OOO_VENDOR="$USERNAME"
13603     if test -z "$OOO_VENDOR"; then
13604         OOO_VENDOR="$USER"
13605     fi
13607     if test -z "$OOO_VENDOR"; then
13608         OOO_VENDOR="`id -u -n`"
13609     fi
13611     AC_MSG_RESULT([not set, using $OOO_VENDOR])
13612 else
13613     OOO_VENDOR="$with_vendor"
13614     AC_MSG_RESULT([$OOO_VENDOR])
13616 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
13617 AC_SUBST(OOO_VENDOR)
13619 if test "$_os" = "Android" ; then
13620     ANDROID_PACKAGE_NAME=
13621     AC_MSG_CHECKING([for Android package name])
13622     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
13623         if test -n "$ENABLE_DEBUG"; then
13624             # Default to the package name that makes ndk-gdb happy.
13625             ANDROID_PACKAGE_NAME="org.libreoffice"
13626         else
13627             ANDROID_PACKAGE_NAME="org.example.libreoffice"
13628         fi
13630         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
13631     else
13632         ANDROID_PACKAGE_NAME="$with_android_package_name"
13633         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
13634     fi
13635     AC_SUBST(ANDROID_PACKAGE_NAME)
13638 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
13639 if test "$with_compat_oowrappers" = "yes"; then
13640     WITH_COMPAT_OOWRAPPERS=TRUE
13641     AC_MSG_RESULT(yes)
13642 else
13643     WITH_COMPAT_OOWRAPPERS=
13644     AC_MSG_RESULT(no)
13646 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
13648 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{gsub(" ", "", $0);print tolower($0)}'`
13649 AC_MSG_CHECKING([for install dirname])
13650 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
13651     INSTALLDIRNAME="$with_install_dirname"
13653 AC_MSG_RESULT([$INSTALLDIRNAME])
13654 AC_SUBST(INSTALLDIRNAME)
13656 AC_MSG_CHECKING([for prefix])
13657 test "x$prefix" = xNONE && prefix=$ac_default_prefix
13658 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
13659 PREFIXDIR="$prefix"
13660 AC_MSG_RESULT([$PREFIXDIR])
13661 AC_SUBST(PREFIXDIR)
13663 LIBDIR=[$(eval echo $(eval echo $libdir))]
13664 AC_SUBST(LIBDIR)
13666 DATADIR=[$(eval echo $(eval echo $datadir))]
13667 AC_SUBST(DATADIR)
13669 MANDIR=[$(eval echo $(eval echo $mandir))]
13670 AC_SUBST(MANDIR)
13672 DOCDIR=[$(eval echo $(eval echo $docdir))]
13673 AC_SUBST(DOCDIR)
13675 BINDIR=[$(eval echo $(eval echo $bindir))]
13676 AC_SUBST(BINDIR)
13678 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
13679 AC_SUBST(INSTALLDIR)
13681 TESTINSTALLDIR="${BUILDDIR}/test-install"
13682 AC_SUBST(TESTINSTALLDIR)
13685 # ===================================================================
13686 # OAuth2 id and secrets
13687 # ===================================================================
13689 AC_MSG_CHECKING([for Google Drive client id and secret])
13690 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
13691     AC_MSG_RESULT([not set])
13692     GDRIVE_CLIENT_ID="\"\""
13693     GDRIVE_CLIENT_SECRET="\"\""
13694 else
13695     AC_MSG_RESULT([set])
13696     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
13697     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
13699 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
13700 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
13702 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
13703 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
13704     AC_MSG_RESULT([not set])
13705     ALFRESCO_CLOUD_CLIENT_ID="\"\""
13706     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
13707 else
13708     AC_MSG_RESULT([set])
13709     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
13710     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
13712 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
13713 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
13715 AC_MSG_CHECKING([for OneDrive client id and secret])
13716 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
13717     AC_MSG_RESULT([not set])
13718     ONEDRIVE_CLIENT_ID="\"\""
13719     ONEDRIVE_CLIENT_SECRET="\"\""
13720 else
13721     AC_MSG_RESULT([set])
13722     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
13723     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
13725 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
13726 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
13729 dnl ===================================================================
13730 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
13731 dnl --enable-dependency-tracking configure option
13732 dnl ===================================================================
13733 AC_MSG_CHECKING([whether to enable dependency tracking])
13734 if test "$enable_dependency_tracking" = "no"; then
13735     nodep=TRUE
13736     AC_MSG_RESULT([no])
13737 else
13738     AC_MSG_RESULT([yes])
13740 AC_SUBST(nodep)
13742 dnl ===================================================================
13743 dnl Number of CPUs to use during the build
13744 dnl ===================================================================
13745 AC_MSG_CHECKING([for number of processors to use])
13746 # plain --with-parallelism is just the default
13747 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
13748     if test "$with_parallelism" = "no"; then
13749         PARALLELISM=0
13750     else
13751         PARALLELISM=$with_parallelism
13752     fi
13753 else
13754     if test "$enable_icecream" = "yes"; then
13755         PARALLELISM="40"
13756     else
13757         case `uname -s` in
13759         Darwin|FreeBSD|NetBSD|OpenBSD)
13760             PARALLELISM=`sysctl -n hw.ncpu`
13761             ;;
13763         Linux)
13764             PARALLELISM=`getconf _NPROCESSORS_ONLN`
13765         ;;
13766         # what else than above does profit here *and* has /proc?
13767         *)
13768             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
13769             ;;
13770         esac
13772         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
13773         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
13774     fi
13777 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
13778     if test -z "$with_parallelism"; then
13779             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
13780             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
13781             PARALLELISM="1"
13782     else
13783         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."
13784     fi
13787 if test $PARALLELISM -eq 0; then
13788     AC_MSG_RESULT([explicit make -j option needed])
13789 else
13790     AC_MSG_RESULT([$PARALLELISM])
13792 AC_SUBST(PARALLELISM)
13794 IWYU_PATH="$with_iwyu"
13795 AC_SUBST(IWYU_PATH)
13796 if test ! -z "$IWYU_PATH"; then
13797     if test ! -f "$IWYU_PATH"; then
13798         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
13799     fi
13803 # Set up ILIB for MSVC build
13805 ILIB1=
13806 if test "$build_os" = "cygwin"; then
13807     ILIB="."
13808     if test -n "$JAVA_HOME"; then
13809         ILIB="$ILIB;$JAVA_HOME/lib"
13810     fi
13811     ILIB1=-link
13812     ILIB="$ILIB;$COMPATH/lib/$WIN_HOST_ARCH"
13813     ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/$WIN_HOST_ARCH"
13814     ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
13815     ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
13816     if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
13817         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
13818         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
13819     fi
13820     PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/$WIN_HOST_ARCH"
13821     ucrtlibpath_formatted=$formatted_path
13822     ILIB="$ILIB;$ucrtlibpath_formatted"
13823     ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
13824     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
13825         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
13826     else
13827         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WIN_HOST_ARCH"
13828     fi
13830     if test "$cross_compiling" != "yes"; then
13831         ILIB_FOR_BUILD="$ILIB"
13832     fi
13834 AC_SUBST(ILIB)
13835 AC_SUBST(ILIB_FOR_BUILD)
13837 # ===================================================================
13838 # Creating bigger shared library to link against
13839 # ===================================================================
13840 AC_MSG_CHECKING([whether to create huge library])
13841 MERGELIBS=
13843 if test $_os = iOS -o $_os = Android; then
13844     # Never any point in mergelibs for these as we build just static
13845     # libraries anyway...
13846     enable_mergelibs=no
13849 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
13850     if test $_os != Linux -a $_os != WINNT; then
13851         add_warning "--enable-mergelibs is not tested for this platform"
13852     fi
13853     MERGELIBS="TRUE"
13854     AC_MSG_RESULT([yes])
13855     AC_DEFINE(ENABLE_MERGELIBS)
13856 else
13857     AC_MSG_RESULT([no])
13859 AC_SUBST([MERGELIBS])
13861 dnl ===================================================================
13862 dnl icerun is a wrapper that stops us spawning tens of processes
13863 dnl locally - for tools that can't be executed on the compile cluster
13864 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
13865 dnl ===================================================================
13866 AC_MSG_CHECKING([whether to use icerun wrapper])
13867 ICECREAM_RUN=
13868 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
13869     ICECREAM_RUN=icerun
13870     AC_MSG_RESULT([yes])
13871 else
13872     AC_MSG_RESULT([no])
13874 AC_SUBST(ICECREAM_RUN)
13876 dnl ===================================================================
13877 dnl Setup the ICECC_VERSION for the build the same way it was set for
13878 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
13879 dnl ===================================================================
13880 x_ICECC_VERSION=[\#]
13881 if test -n "$ICECC_VERSION" ; then
13882     x_ICECC_VERSION=
13884 AC_SUBST(x_ICECC_VERSION)
13885 AC_SUBST(ICECC_VERSION)
13887 dnl ===================================================================
13889 AC_MSG_CHECKING([MPL subset])
13890 MPL_SUBSET=
13892 if test "$enable_mpl_subset" = "yes"; then
13893     warn_report=false
13894     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
13895         warn_report=true
13896     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
13897         warn_report=true
13898     fi
13899     if test "$warn_report" = "true"; then
13900         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
13901     fi
13902     if test "x$enable_postgresql_sdbc" != "xno"; then
13903         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
13904     fi
13905     if test "$enable_lotuswordpro" = "yes"; then
13906         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
13907     fi
13908     if test "$WITH_WEBDAV" = "neon"; then
13909         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
13910     fi
13911     if test -n "$ENABLE_POPPLER"; then
13912         if test "x$SYSTEM_POPPLER" = "x"; then
13913             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
13914         fi
13915     fi
13916     # cf. m4/libo_check_extension.m4
13917     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
13918         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
13919     fi
13920     for theme in $WITH_THEMES; do
13921         case $theme in
13922         breeze|breeze_dark|breeze_dark_svg|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #denylist of icon themes under GPL or LGPL
13923             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=colibre]) ;;
13924         *) : ;;
13925         esac
13926     done
13928     ENABLE_OPENGL_TRANSITIONS=
13930     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
13931         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
13932     fi
13934     MPL_SUBSET="TRUE"
13935     AC_DEFINE(MPL_HAVE_SUBSET)
13936     AC_MSG_RESULT([only])
13937 else
13938     AC_MSG_RESULT([no restrictions])
13940 AC_SUBST(MPL_SUBSET)
13942 dnl ===================================================================
13944 AC_MSG_CHECKING([formula logger])
13945 ENABLE_FORMULA_LOGGER=
13947 if test "x$enable_formula_logger" = "xyes"; then
13948     AC_MSG_RESULT([yes])
13949     AC_DEFINE(ENABLE_FORMULA_LOGGER)
13950     ENABLE_FORMULA_LOGGER=TRUE
13951 elif test -n "$ENABLE_DBGUTIL" ; then
13952     AC_MSG_RESULT([yes])
13953     AC_DEFINE(ENABLE_FORMULA_LOGGER)
13954     ENABLE_FORMULA_LOGGER=TRUE
13955 else
13956     AC_MSG_RESULT([no])
13959 AC_SUBST(ENABLE_FORMULA_LOGGER)
13961 dnl ===================================================================
13962 dnl Checking for active Antivirus software.
13963 dnl ===================================================================
13965 if test $_os = WINNT -a -f "$SRC_ROOT/antivirusDetection.vbs" ; then
13966     AC_MSG_CHECKING([for active Antivirus software])
13967     ANTIVIRUS_LIST=`cscript.exe //Nologo $SRC_ROOT/antivirusDetection.vbs`
13968     if [ [ "$ANTIVIRUS_LIST" != "NULL" ] ]; then
13969         if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then
13970             AC_MSG_RESULT([found])
13971             EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
13972             echo $EICAR_STRING > $SRC_ROOT/eicar
13973             EICAR_TEMP_FILE_CONTENTS=`cat $SRC_ROOT/eicar`
13974             rm $SRC_ROOT/eicar
13975             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
13976                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
13977             fi
13978             echo $EICAR_STRING > $BUILDDIR/eicar
13979             EICAR_TEMP_FILE_CONTENTS=`cat $BUILDDIR/eicar`
13980             rm $BUILDDIR/eicar
13981             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
13982                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
13983             fi
13984             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"
13985         else
13986             AC_MSG_RESULT([not found])
13987         fi
13988     else
13989         AC_MSG_RESULT([n/a])
13990     fi
13993 dnl ===================================================================
13994 dnl Setting up the environment.
13995 dnl ===================================================================
13996 AC_MSG_NOTICE([setting up the build environment variables...])
13998 AC_SUBST(COMPATH)
14000 if test "$build_os" = "cygwin"; then
14001     if test -d "$COMPATH/atlmfc/lib/spectre"; then
14002         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
14003         ATL_INCLUDE="$COMPATH/atlmfc/include"
14004     elif test -d "$COMPATH/atlmfc/lib"; then
14005         ATL_LIB="$COMPATH/atlmfc/lib"
14006         ATL_INCLUDE="$COMPATH/atlmfc/include"
14007     else
14008         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
14009         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
14010     fi
14011     ATL_LIB="$ATL_LIB/$WIN_HOST_ARCH"
14012     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
14013     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
14015     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
14016     PathFormat "/usr/bin/find.exe"
14017     FIND="$formatted_path"
14018     PathFormat "/usr/bin/sort.exe"
14019     SORT="$formatted_path"
14020     PathFormat "/usr/bin/grep.exe"
14021     WIN_GREP="$formatted_path"
14022     PathFormat "/usr/bin/ls.exe"
14023     WIN_LS="$formatted_path"
14024     PathFormat "/usr/bin/touch.exe"
14025     WIN_TOUCH="$formatted_path"
14026 else
14027     FIND=find
14028     SORT=sort
14031 AC_SUBST(ATL_INCLUDE)
14032 AC_SUBST(ATL_LIB)
14033 AC_SUBST(FIND)
14034 AC_SUBST(SORT)
14035 AC_SUBST(WIN_GREP)
14036 AC_SUBST(WIN_LS)
14037 AC_SUBST(WIN_TOUCH)
14039 AC_SUBST(BUILD_TYPE)
14041 AC_SUBST(SOLARINC)
14043 PathFormat "$PERL"
14044 PERL="$formatted_path"
14045 AC_SUBST(PERL)
14047 if test -n "$TMPDIR"; then
14048     TEMP_DIRECTORY="$TMPDIR"
14049 else
14050     TEMP_DIRECTORY="/tmp"
14052 if test "$build_os" = "cygwin"; then
14053     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
14055 AC_SUBST(TEMP_DIRECTORY)
14057 # setup the PATH for the environment
14058 if test -n "$LO_PATH_FOR_BUILD"; then
14059     LO_PATH="$LO_PATH_FOR_BUILD"
14060     case "$host_os" in
14061     cygwin*|wsl*)
14062         pathmunge "$MSVC_HOST_PATH" "before"
14063         ;;
14064     esac
14065 else
14066     LO_PATH="$PATH"
14068     case "$host_os" in
14070     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
14071         if test "$ENABLE_JAVA" != ""; then
14072             pathmunge "$JAVA_HOME/bin" "after"
14073         fi
14074         ;;
14076     cygwin*|wsl*)
14077         # Win32 make needs native paths
14078         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
14079             LO_PATH=`cygpath -p -m "$PATH"`
14080         fi
14081         if test "$WIN_BUILD_ARCH" = "x64"; then
14082             # needed for msi packaging
14083             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
14084         fi
14085         # .NET 4.6 and higher don't have bin directory
14086         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
14087             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
14088         fi
14089         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
14090         pathmunge "$CSC_PATH" "before"
14091         pathmunge "$MIDL_PATH" "before"
14092         pathmunge "$AL_PATH" "before"
14093         pathmunge "$MSVC_MULTI_PATH" "before"
14094         pathmunge "$MSVC_BUILD_PATH" "before"
14095         if test -n "$MSBUILD_PATH" ; then
14096             pathmunge "$MSBUILD_PATH" "before"
14097         fi
14098         pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/$WIN_BUILD_ARCH" "before"
14099         if test "$ENABLE_JAVA" != ""; then
14100             if test -d "$JAVA_HOME/jre/bin/client"; then
14101                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
14102             fi
14103             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
14104                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
14105             fi
14106             pathmunge "$JAVA_HOME/bin" "before"
14107         fi
14108         pathmunge "$MSVC_HOST_PATH" "before"
14109         ;;
14111     solaris*)
14112         pathmunge "/usr/css/bin" "before"
14113         if test "$ENABLE_JAVA" != ""; then
14114             pathmunge "$JAVA_HOME/bin" "after"
14115         fi
14116         ;;
14117     esac
14120 AC_SUBST(LO_PATH)
14122 # Allow to pass LO_ELFCHECK_ALLOWLIST from autogen.input to bin/check-elf-dynamic-objects:
14123 if test "$LO_ELFCHECK_ALLOWLIST" = x || test "${LO_ELFCHECK_ALLOWLIST-x}" != x; then
14124     x_LO_ELFCHECK_ALLOWLIST=
14125 else
14126     x_LO_ELFCHECK_ALLOWLIST=[\#]
14128 AC_SUBST(x_LO_ELFCHECK_ALLOWLIST)
14129 AC_SUBST(LO_ELFCHECK_ALLOWLIST)
14131 libo_FUZZ_SUMMARY
14133 # Generate a configuration sha256 we can use for deps
14134 if test -f config_host.mk; then
14135     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
14137 if test -f config_host_lang.mk; then
14138     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
14141 CFLAGS=$my_original_CFLAGS
14142 CXXFLAGS=$my_original_CXXFLAGS
14143 CPPFLAGS=$my_original_CPPFLAGS
14145 AC_CONFIG_LINKS([include:include])
14147 # Keep in sync with list of files far up, at AC_MSG_CHECKING([for
14148 # BUILD platform configuration] - otherwise breaks cross building
14149 AC_CONFIG_FILES([config_host.mk
14150                  config_host_lang.mk
14151                  Makefile
14152                  bin/bffvalidator.sh
14153                  bin/odfvalidator.sh
14154                  bin/officeotron.sh
14155                  hardened_runtime.xcent
14156                  instsetoo_native/util/openoffice.lst
14157                  setup_native/source/packinfo/finals_instsetoo.txt
14158                  sysui/desktop/macosx/Info.plist])
14159 AC_CONFIG_HEADERS([config_host/config_buildid.h])
14160 AC_CONFIG_HEADERS([config_host/config_box2d.h])
14161 AC_CONFIG_HEADERS([config_host/config_clang.h])
14162 AC_CONFIG_HEADERS([config_host/config_dconf.h])
14163 AC_CONFIG_HEADERS([config_host/config_eot.h])
14164 AC_CONFIG_HEADERS([config_host/config_extensions.h])
14165 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
14166 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
14167 AC_CONFIG_HEADERS([config_host/config_dbus.h])
14168 AC_CONFIG_HEADERS([config_host/config_features.h])
14169 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
14170 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
14171 AC_CONFIG_HEADERS([config_host/config_firebird.h])
14172 AC_CONFIG_HEADERS([config_host/config_folders.h])
14173 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
14174 AC_CONFIG_HEADERS([config_host/config_gio.h])
14175 AC_CONFIG_HEADERS([config_host/config_global.h])
14176 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
14177 AC_CONFIG_HEADERS([config_host/config_java.h])
14178 AC_CONFIG_HEADERS([config_host/config_langs.h])
14179 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
14180 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
14181 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
14182 AC_CONFIG_HEADERS([config_host/config_locales.h])
14183 AC_CONFIG_HEADERS([config_host/config_mpl.h])
14184 AC_CONFIG_HEADERS([config_host/config_oox.h])
14185 AC_CONFIG_HEADERS([config_host/config_options.h])
14186 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
14187 AC_CONFIG_HEADERS([config_host/config_qrcodegen.h])
14188 AC_CONFIG_HEADERS([config_host/config_skia.h])
14189 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
14190 AC_CONFIG_HEADERS([config_host/config_vendor.h])
14191 AC_CONFIG_HEADERS([config_host/config_vcl.h])
14192 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
14193 AC_CONFIG_HEADERS([config_host/config_version.h])
14194 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
14195 AC_CONFIG_HEADERS([config_host/config_poppler.h])
14196 AC_CONFIG_HEADERS([config_host/config_python.h])
14197 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
14198 AC_OUTPUT
14200 if test "$CROSS_COMPILING" = TRUE; then
14201     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
14204 # touch the config timestamp file
14205 if test ! -f config_host.mk.stamp; then
14206     echo > config_host.mk.stamp
14207 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
14208     echo "Host Configuration unchanged - avoiding scp2 stamp update"
14209 else
14210     echo > config_host.mk.stamp
14213 # touch the config lang timestamp file
14214 if test ! -f config_host_lang.mk.stamp; then
14215     echo > config_host_lang.mk.stamp
14216 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
14217     echo "Language Configuration unchanged - avoiding scp2 stamp update"
14218 else
14219     echo > config_host_lang.mk.stamp
14223 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
14224         -a "$build_os" = "cygwin"; then
14226 cat << _EOS
14227 ****************************************************************************
14228 WARNING:
14229 Your make version is known to be horribly slow, and hard to debug
14230 problems with. To get a reasonably functional make please do:
14232 to install a pre-compiled binary make for Win32
14234  mkdir -p /opt/lo/bin
14235  cd /opt/lo/bin
14236  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
14237  cp make-4.2.1-msvc.exe make
14238  chmod +x make
14240 to install from source:
14241 place yourself in a working directory of you choice.
14243  git clone git://git.savannah.gnu.org/make.git
14245  [go to Start menu, open "Visual Studio 2019", click "x86 Native Tools Command Prompt" or "x64 Native Tools Command Prompt"]
14246  set PATH=%PATH%;C:\Cygwin\bin
14247  [or Cygwin64, if that is what you have]
14248  cd path-to-make-repo-you-cloned-above
14249  build_w32.bat --without-guile
14251 should result in a WinRel/gnumake.exe.
14252 Copy it to the Cygwin /opt/lo/bin directory as make.exe
14254 Then re-run autogen.sh
14256 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
14257 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
14259 _EOS
14260 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
14261     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
14266 cat << _EOF
14267 ****************************************************************************
14269 To build, run:
14270 $GNUMAKE
14272 To view some help, run:
14273 $GNUMAKE help
14275 _EOF
14277 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
14278     cat << _EOF
14279 After the build has finished successfully, you can immediately run what you built using the command:
14280 _EOF
14282     if test $_os = Darwin; then
14283         echo open instdir/$PRODUCTNAME_WITHOUT_SPACES.app
14284     else
14285         echo instdir/program/soffice
14286     fi
14287     cat << _EOF
14289 If you want to run the smoketest, run:
14290 $GNUMAKE check
14292 _EOF
14295 if test -f warn; then
14296     cat warn
14297     rm warn
14300 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: