add privacy URL to crashreport dialog & updatecheck tab in options
[LibreOffice.git] / configure.ac
blob4652067a64de724fdb086fa4b398415b53020168
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 100 -*-
2 dnl configure.ac serves as input for the GNU autoconf package
3 dnl in order to create a configure script.
5 # The version number in the second argument to AC_INIT should be four numbers separated by
6 # periods. Some parts of the code requires the first one to be less than 128 and the others to be less
7 # than 256. The four numbers can optionally be followed by a period and a free-form string containing
8 # no spaces or periods, like "frobozz-mumble-42" or "alpha0". If the free-form string ends with one or
9 # several non-alphanumeric characters, those are split off and used only for the
10 # ABOUTBOXPRODUCTVERSIONSUFFIX in openoffice.lst. Why that is necessary, no idea.
12 AC_INIT([LibreOffice],[7.2.0.0.alpha1+],[],[],[http://documentfoundation.org/])
14 dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed
15 dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard
16 dnl so check for the version of autoconf that is actually used to create the configure script
17 AC_PREREQ([2.59])
18 m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.68]), -1,
19     [AC_MSG_ERROR([at least autoconf version 2.68 is needed (you can use AUTOCONF environment variable to point to a suitable one)])])
21 if test -n "$BUILD_TYPE"; then
22     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
25 save_CC=$CC
26 save_CXX=$CXX
28 first_arg_basename()
30     for i in $1; do
31         basename "$i"
32         break
33     done
36 CC_BASE=`first_arg_basename "$CC"`
37 CXX_BASE=`first_arg_basename "$CXX"`
39 BUILD_TYPE="LibO"
40 SCPDEFS=""
41 GIT_NEEDED_SUBMODULES=""
42 LO_PATH= # used by path_munge to construct a PATH variable
44 FilterLibs()
46     # Return value: $filteredlibs
48     filteredlibs=
49     for f in $1; do
50         case "$f" in
51             # let's start with Fedora's paths for now
52             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
53                 # ignore it: on UNIXoids it is searched by default anyway
54                 # but if it's given explicitly then it may override other paths
55                 # (on macOS it would be an error to use it instead of SDK)
56                 ;;
57             *)
58                 filteredlibs="$filteredlibs $f"
59                 ;;
60         esac
61     done
64 PathFormat()
66     # Args: $1: A pathname. On Cygwin and WSL, in either the Unix or the Windows format. Note that this
67     # function is called also on Unix.
68     #
69     # Return value: $formatted_path and $formatted_path_unix.
70     #
71     # $formatted_path is the argument in Windows format, but using forward slashes instead of
72     # backslashes, using 8.3 pathname components if necessary (if it otherwise would contains spaces
73     # or shell metacharacters).
74     #
75     # $formatted_path_unix is the argument in a form usable in Cygwin or WSL, using 8.3 components if
76     # necessary. On Cygwin, it is the same as $formatted_path, but on WSL it is $formatted_path as a
77     # Unix pathname.
78     #
79     # Errors out if 8.3 names are needed but aren't present for some of the path components.
81     # Examples:
82     #
83     # /home/tml/lo/master-optimised => C:/cygwin64/home/tml/lo/master-optimised
84     #
85     # C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe => C:/PROGRA~2/MICROS~3/INSTAL~1/vswhere.exe
86     #
87     # C:\Program Files (x86)\Microsoft Visual Studio\2019\Community => C:/PROGRA~2/MICROS~3/2019/COMMUN~1
88     #
89     # C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/ucrt => C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/ucrt
90     #
91     # /cygdrive/c/PROGRA~2/WI3CF2~1/10 => C:/PROGRA~2/WI3CF2~1/10
92     #
93     # C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\ => C:/PROGRA~2/WI3CF2~1/NETFXSDK/4.8/
94     #
95     # /usr/bin/find.exe => C:/cygwin64/bin/find.exe
97     if test -n "$UNITTEST_WSL_PATHFORMAT"; then
98         printf "PathFormat $1 ==> "
99     fi
101     formatted_path="$1"
102     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
103         if test "$build_os" = "wsl"; then
104             formatted_path=$(echo "$formatted_path" | tr -d '\r')
105         fi
107         pf_conv_to_dos=
108         # spaces,parentheses,brackets,braces are problematic in pathname
109         # so are backslashes
110         case "$formatted_path" in
111             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
112                 pf_conv_to_dos="yes"
113             ;;
114         esac
115         if test "$pf_conv_to_dos" = "yes"; then
116             if test "$build_os" = "wsl"; then
117                 case "$formatted_path" in
118                     /*)
119                         formatted_path=$(wslpath -w "$formatted_path")
120                         ;;
121                 esac
122                 formatted_path=$($BUILDDIR/solenv/wsl/wsl-lo-helper.exe --8.3 "$formatted_path")
123             elif test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
124                 formatted_path=`cygpath -sm "$formatted_path"`
125             else
126                 formatted_path=`cygpath -d "$formatted_path"`
127             fi
128             if test $? -ne 0;  then
129                 AC_MSG_ERROR([path conversion failed for "$1".])
130             fi
131         fi
132         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
133         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
134         if test "$fp_count_slash$fp_count_colon" != "00"; then
135             if test "$fp_count_colon" = "0"; then
136                 new_formatted_path=`realpath "$formatted_path"`
137                 if test $? -ne 0;  then
138                     AC_MSG_WARN([realpath failed for "$formatted_path", not necessarily a problem.])
139                 else
140                     formatted_path="$new_formatted_path"
141                 fi
142             fi
143             if test "$build_os" = "wsl"; then
144                 if test "$fp_count_colon" != "0"; then
145                     formatted_path=$(wslpath "$formatted_path")
146                     local final_slash=
147                     case "$formatted_path" in
148                         */)
149                             final_slash=/
150                             ;;
151                     esac
152                     formatted_path=$(wslpath -m $formatted_path)
153                     case "$formatted_path" in
154                         */)
155                             ;;
156                         *)
157                             formatted_path="$formatted_path"$final_slash
158                             ;;
159                     esac
160                 else
161                     formatted_path=$(wslpath -m "$formatted_path")
162                 fi
163             else
164                 formatted_path=`cygpath -m "$formatted_path"`
165             fi
166             if test $? -ne 0;  then
167                 AC_MSG_ERROR([path conversion failed for "$1".])
168             fi
169         fi
170         fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
171         if test "$fp_count_space" != "0"; then
172             AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
173         fi
174     fi
175     if test "$build_os" = "wsl"; then
176         # WSL can't run Windows binaries from Windows pathnames so we need a separate return value in Unix format
177         formatted_path_unix=$(wslpath "$formatted_path")
178     else
179         # But Cygwin can
180         formatted_path_unix="$formatted_path"
181     fi
184 AbsolutePath()
186     # There appears to be no simple and portable method to get an absolute and
187     # canonical path, so we try creating the directory if does not exist and
188     # utilizing the shell and pwd.
190     # Args: $1: A possibly relative pathname
191     # Return value: $absolute_path
193     local rel="$1"
194     absolute_path=""
195     test ! -e "$rel" && mkdir -p "$rel"
196     if test -d "$rel" ; then
197         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
198         absolute_path="$(pwd)"
199         cd - > /dev/null
200     else
201         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
202     fi
205 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"
402 AC_MSG_RESULT([$PRODUCTNAME])
403 AC_SUBST(PRODUCTNAME)
404 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
405 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
407 dnl ===================================================================
408 dnl Our version is defined by the AC_INIT() at the top of this script.
409 dnl ===================================================================
411 AC_MSG_CHECKING([for package version])
412 if test -n "$with_package_version" -a "$with_package_version" != no; then
413     PACKAGE_VERSION="$with_package_version"
415 AC_MSG_RESULT([$PACKAGE_VERSION])
417 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
419 LIBO_VERSION_MAJOR=$1
420 LIBO_VERSION_MINOR=$2
421 LIBO_VERSION_MICRO=$3
422 LIBO_VERSION_PATCH=$4
424 LIBO_VERSION_SUFFIX=$5
426 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
427 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
428 # they get undoubled before actually passed to sed.
429 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
430 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
431 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
432 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
434 # The value for key CFBundleVersion in the Info.plist file must be a period-separated list of at most
435 # three non-negative integers. Please find more information about CFBundleVersion at
436 # https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleversion
438 # The value for key CFBundleShortVersionString in the Info.plist file must be a period-separated list
439 # of at most three non-negative integers. Please find more information about
440 # CFBundleShortVersionString at
441 # https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleshortversionstring
443 # But that is enforced only in the App Store, and we apparently want to break the rules otherwise.
445 if test "$enable_macosx_sandbox" = yes; then
446     MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
447     MACOSX_BUNDLE_VERSION=$MACOSX_BUNDLE_SHORTVERSION
448 else
449     MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.$LIBO_VERSION_MICRO.$LIBO_VERSION_PATCH
450     MACOSX_BUNDLE_VERSION=$MACOSX_BUNDLE_SHORTVERSION$LIBO_VERSION_SUFFIX
453 AC_SUBST(LIBO_VERSION_MAJOR)
454 AC_SUBST(LIBO_VERSION_MINOR)
455 AC_SUBST(LIBO_VERSION_MICRO)
456 AC_SUBST(LIBO_VERSION_PATCH)
457 AC_SUBST(LIBO_VERSION_SUFFIX)
458 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
459 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
460 AC_SUBST(MACOSX_BUNDLE_VERSION)
462 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
463 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
464 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
465 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
467 LIBO_THIS_YEAR=`date +%Y`
468 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
470 dnl ===================================================================
471 dnl Product version
472 dnl ===================================================================
473 AC_MSG_CHECKING([for product version])
474 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
475 AC_MSG_RESULT([$PRODUCTVERSION])
476 AC_SUBST(PRODUCTVERSION)
478 AC_PROG_EGREP
479 # AC_PROG_EGREP doesn't set GREP on all systems as well
480 AC_PATH_PROG(GREP, grep)
482 BUILDDIR=`pwd`
483 cd $srcdir
484 SRC_ROOT=`pwd`
485 cd $BUILDDIR
486 x_Cygwin=[\#]
488 dnl ======================================
489 dnl Required GObject introspection version
490 dnl ======================================
491 INTROSPECTION_REQUIRED_VERSION=1.32.0
493 dnl ===================================================================
494 dnl Search all the common names for GNU Make
495 dnl ===================================================================
496 AC_MSG_CHECKING([for GNU Make])
498 # try to use our own make if it is available and GNUMAKE was not already defined
499 if test -z "$GNUMAKE"; then
500     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
501         GNUMAKE="$LODE_HOME/opt/bin/make"
502     elif test -x "/opt/lo/bin/make"; then
503         GNUMAKE="/opt/lo/bin/make"
504     fi
507 GNUMAKE_WIN_NATIVE=
508 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
509     if test -n "$a"; then
510         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
511         if test $? -eq 0;  then
512             if test "$build_os" = "cygwin"; then
513                 if test -n "$($a -v | grep 'Built for Windows')" ; then
514                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
515                     GNUMAKE_WIN_NATIVE="TRUE"
516                 else
517                     GNUMAKE=`which $a`
518                 fi
519             else
520                 GNUMAKE=`which $a`
521             fi
522             break
523         fi
524     fi
525 done
526 AC_MSG_RESULT($GNUMAKE)
527 if test -z "$GNUMAKE"; then
528     AC_MSG_ERROR([not found. install GNU Make.])
529 else
530     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
531         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
532     fi
535 win_short_path_for_make()
537     local short_path="$1"
538     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
539         cygpath -sm "$short_path"
540     else
541         cygpath -u "$(cygpath -d "$short_path")"
542     fi
546 if test "$build_os" = "cygwin"; then
547     PathFormat "$SRC_ROOT"
548     SRC_ROOT="$formatted_path"
549     PathFormat "$BUILDDIR"
550     BUILDDIR="$formatted_path"
551     x_Cygwin=
552     AC_MSG_CHECKING(for explicit COMSPEC)
553     if test -z "$COMSPEC"; then
554         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
555     else
556         AC_MSG_RESULT([found: $COMSPEC])
557     fi
560 AC_SUBST(SRC_ROOT)
561 AC_SUBST(BUILDDIR)
562 AC_SUBST(x_Cygwin)
563 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
564 AC_DEFINE_UNQUOTED(SRC_ROOT,"$SRC_ROOT")
565 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
567 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
568     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
571 # need sed in os checks...
572 AC_PATH_PROGS(SED, sed)
573 if test -z "$SED"; then
574     AC_MSG_ERROR([install sed to run this script])
577 # Set the ENABLE_LTO variable
578 # ===================================================================
579 AC_MSG_CHECKING([whether to use link-time optimization])
580 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
581     ENABLE_LTO="TRUE"
582     AC_MSG_RESULT([yes])
583 else
584     ENABLE_LTO=""
585     AC_MSG_RESULT([no])
587 AC_SUBST(ENABLE_LTO)
589 AC_ARG_ENABLE(fuzz-options,
590     AS_HELP_STRING([--enable-fuzz-options],
591         [Randomly enable or disable each of those configurable options
592          that are supposed to be freely selectable without interdependencies,
593          or where bad interaction from interdependencies is automatically avoided.])
596 dnl ===================================================================
597 dnl When building for Android, --with-android-ndk,
598 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
599 dnl mandatory
600 dnl ===================================================================
602 AC_ARG_WITH(android-ndk,
603     AS_HELP_STRING([--with-android-ndk],
604         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
607 AC_ARG_WITH(android-ndk-toolchain-version,
608     AS_HELP_STRING([--with-android-ndk-toolchain-version],
609         [Specify which toolchain version to use, of those present in the
610         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
611         with_android_ndk_toolchain_version=clang5.0)
613 AC_ARG_WITH(android-sdk,
614     AS_HELP_STRING([--with-android-sdk],
615         [Specify location of the Android SDK. Mandatory when building for Android.]),
618 AC_ARG_WITH(android-api-level,
619     AS_HELP_STRING([--with-android-api-level],
620         [Specify the API level when building for Android. Defaults to 16 for ARM and x86 and to 21 for ARM64 and x86-64]),
623 ANDROID_NDK_HOME=
624 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
625     with_android_ndk="$SRC_ROOT/external/android-ndk"
627 if test -n "$with_android_ndk"; then
628     eval ANDROID_NDK_HOME=$with_android_ndk
630     # Set up a lot of pre-canned defaults
632     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
633         if test ! -f $ANDROID_NDK_HOME/source.properties; then
634             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
635         fi
636         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
637     else
638         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
639     fi
640     if test -z "$ANDROID_NDK_VERSION";  then
641         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
642     fi
643     case $ANDROID_NDK_VERSION in
644     r9*|r10*)
645         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
646         ;;
647     11.1.*|12.1.*|13.1.*|14.1.*)
648         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
649         ;;
650     16.*|17.*|18.*|19.*|20.*)
651         ;;
652     *)
653         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk.])
654         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk."
655         ;;
656     esac
658     ANDROID_API_LEVEL=16
659     if test -n "$with_android_api_level" ; then
660         ANDROID_API_LEVEL="$with_android_api_level"
661     fi
663     android_cpu=$host_cpu
664     if test $host_cpu = arm; then
665         android_platform_prefix=arm-linux-androideabi
666         android_gnu_prefix=$android_platform_prefix
667         LLVM_TRIPLE=armv7a-linux-androideabi
668         ANDROID_APP_ABI=armeabi-v7a
669         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
670     elif test $host_cpu = aarch64; then
671         android_platform_prefix=aarch64-linux-android
672         android_gnu_prefix=$android_platform_prefix
673         LLVM_TRIPLE=$android_platform_prefix
674         # minimum android version that supports aarch64
675         if test "$ANDROID_API_LEVEL" -lt "21" ; then
676             ANDROID_API_LEVEL=21
677         fi
678         ANDROID_APP_ABI=arm64-v8a
679     elif test $host_cpu = x86_64; then
680         android_platform_prefix=x86_64-linux-android
681         android_gnu_prefix=$android_platform_prefix
682         LLVM_TRIPLE=$android_platform_prefix
683         # minimum android version that supports x86_64
684         ANDROID_API_LEVEL=21
685         ANDROID_APP_ABI=x86_64
686     else
687         # host_cpu is something like "i386" or "i686" I guess, NDK uses
688         # "x86" in some contexts
689         android_cpu=x86
690         android_platform_prefix=$android_cpu
691         android_gnu_prefix=i686-linux-android
692         LLVM_TRIPLE=$android_gnu_prefix
693         ANDROID_APP_ABI=x86
694     fi
696     case "$with_android_ndk_toolchain_version" in
697     clang5.0)
698         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
699         ;;
700     *)
701         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
702     esac
704     AC_MSG_NOTICE([using the Android API level... $ANDROID_API_LEVEL])
706     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
707     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
708     # manage to link the (app-specific) single huge .so that is built for the app in
709     # android/source/ if there is debug information in a significant part of the object files.
710     # (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
711     # all objects have been built with debug information.)
712     case $build_os in
713     linux-gnu*)
714         android_HOST_TAG=linux-x86_64
715         ;;
716     darwin*)
717         android_HOST_TAG=darwin-x86_64
718         ;;
719     *)
720         AC_MSG_ERROR([We only support building for Android from Linux or macOS])
721         # ndk would also support windows and windows-x86_64
722         ;;
723     esac
724     android_TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$android_HOST_TAG
725     ANDROID_COMPILER_BIN=$android_TOOLCHAIN/bin
726     dnl TODO: NSS build uses it...
727     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION/prebuilt/$android_HOST_TAG
728     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
730     test -z "$AR" && AR=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ar
731     test -z "$NM" && NM=$ANDROID_COMPILER_BIN/$android_gnu_prefix-nm
732     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-objdump
733     test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ranlib
734     test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-strip
736     ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
737     ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
738     if test "$ENABLE_LTO" = TRUE; then
739         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
740         # $CC and $CXX when building external libraries
741         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
742     fi
744     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -stdlib=libc++"
746     if test -z "$CC"; then
747         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
748         CC_BASE="clang"
749     fi
750     if test -z "$CXX"; then
751         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
752         CXX_BASE="clang++"
753     fi
755 AC_SUBST(ANDROID_NDK_HOME)
756 AC_SUBST(ANDROID_APP_ABI)
757 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
759 dnl ===================================================================
760 dnl --with-android-sdk
761 dnl ===================================================================
762 ANDROID_SDK_HOME=
763 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
764     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
766 if test -n "$with_android_sdk"; then
767     eval ANDROID_SDK_HOME=$with_android_sdk
768     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
770 AC_SUBST(ANDROID_SDK_HOME)
772 AC_ARG_ENABLE([android-lok],
773     AS_HELP_STRING([--enable-android-lok],
774         [The Android app from the android/ subdir needs several tweaks all
775          over the place that break the LOK when used in the Online-based
776          Android app.  This switch indicates that the intent of this build is
777          actually the Online-based, non-modified LOK.])
779 ENABLE_ANDROID_LOK=
780 if test -n "$ANDROID_NDK_HOME" ; then
781     if test "$enable_android_lok" = yes; then
782         ENABLE_ANDROID_LOK=TRUE
783         AC_DEFINE(HAVE_FEATURE_ANDROID_LOK)
784         AC_MSG_NOTICE([building the Android version... for the Online-based Android app])
785     else
786         AC_MSG_NOTICE([building the Android version... for the app from the android/ subdir])
787     fi
789 AC_SUBST([ENABLE_ANDROID_LOK])
791 libo_FUZZ_ARG_ENABLE([android-editing],
792     AS_HELP_STRING([--enable-android-editing],
793         [Enable the experimental editing feature on Android.])
795 ENABLE_ANDROID_EDITING=
796 if test "$enable_android_editing" = yes; then
797     ENABLE_ANDROID_EDITING=TRUE
799 AC_SUBST([ENABLE_ANDROID_EDITING])
801 dnl ===================================================================
802 dnl The following is a list of supported systems.
803 dnl Sequential to keep the logic very simple
804 dnl These values may be checked and reset later.
805 dnl ===================================================================
806 #defaults unless the os test overrides this:
807 test_cmis=yes
808 test_curl=yes
809 test_randr=yes
810 test_xrender=yes
811 test_cups=yes
812 test_dbus=yes
813 test_fontconfig=yes
814 test_cairo=no
815 test_gdb_index=no
816 test_split_debug=no
818 # Default values, as such probably valid just for Linux, set
819 # differently below just for Mac OSX, but at least better than
820 # hardcoding these as we used to do. Much of this is duplicated also
821 # in solenv for old build system and for gbuild, ideally we should
822 # perhaps define stuff like this only here in configure.ac?
824 LINKFLAGSSHL="-shared"
825 PICSWITCH="-fpic"
826 DLLPOST=".so"
828 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
830 INSTROOTBASESUFFIX=
831 INSTROOTCONTENTSUFFIX=
832 SDKDIRNAME=sdk
834 HOST_PLATFORM="$host"
836 host_cpu_for_clang="$host_cpu"
838 case "$host_os" in
840 solaris*)
841     build_gstreamer_1_0=yes
842     test_freetype=yes
843     build_skia=yes
844     _os=SunOS
846     dnl ===========================================================
847     dnl Check whether we're using Solaris 10 - SPARC or Intel.
848     dnl ===========================================================
849     AC_MSG_CHECKING([the Solaris operating system release])
850     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
851     if test "$_os_release" -lt "10"; then
852         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
853     else
854         AC_MSG_RESULT([ok ($_os_release)])
855     fi
857     dnl Check whether we're using a SPARC or i386 processor
858     AC_MSG_CHECKING([the processor type])
859     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
860         AC_MSG_RESULT([ok ($host_cpu)])
861     else
862         AC_MSG_ERROR([only SPARC and i386 processors are supported])
863     fi
864     ;;
866 linux-gnu*|k*bsd*-gnu*)
867     build_gstreamer_1_0=yes
868     test_kf5=yes
869     test_gtk3_kde5=yes
870     build_skia=yes
871     test_gdb_index=yes
872     test_split_debug=yes
873     if test "$enable_fuzzers" != yes; then
874         test_freetype=yes
875         test_fontconfig=yes
876     else
877         test_freetype=no
878         test_fontconfig=no
879         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
880     fi
881     _os=Linux
882     ;;
884 gnu)
885     test_randr=no
886     test_xrender=no
887     _os=GNU
888      ;;
890 cygwin*|wsl*)
892     # When building on Windows normally with MSVC under Cygwin,
893     # configure thinks that the host platform (the platform the
894     # built code will run on) is Cygwin, even if it obviously is
895     # Windows, which in Autoconf terminology is called
896     # "mingw32". (Which is misleading as MinGW is the name of the
897     # tool-chain, not an operating system.)
899     # Somewhat confusing, yes. But this configure script doesn't
900     # look at $host etc that much, it mostly uses its own $_os
901     # variable, set here in this case statement.
903     test_cups=no
904     test_dbus=no
905     test_randr=no
906     test_xrender=no
907     test_freetype=no
908     test_fontconfig=no
909     build_skia=yes
910     _os=WINNT
912     DLLPOST=".dll"
913     LINKFLAGSNOUNDEFS=
915     if test "$host_cpu" = "aarch64"; then
916         enable_gpgmepp=no
917         enable_coinmp=no
918         enable_firebird_sdbc=no
919     fi
920     ;;
922 darwin*|macos*) # macOS
923     test_randr=no
924     test_xrender=no
925     test_freetype=no
926     test_fontconfig=no
927     test_dbus=no
928     if test -n "$LODE_HOME" ; then
929         mac_sanitize_path
930         AC_MSG_NOTICE([sanitized the PATH to $PATH])
931     fi
932     _os=Darwin
933     INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
934     INSTROOTCONTENTSUFFIX=/Contents
935     SDKDIRNAME=${PRODUCTNAME_WITHOUT_SPACES}${PRODUCTVERSION}_SDK
936     # See comment above the case "$host_os"
937     LINKFLAGSSHL="-dynamiclib -single_module"
939     # -fPIC is default
940     PICSWITCH=""
942     DLLPOST=".dylib"
944     # -undefined error is the default
945     LINKFLAGSNOUNDEFS=""
946     case "$host_cpu" in
947     aarch64|arm64)
948         case "$host_os" in
949         macos*)
950             # HOST_PLATFORM is used for external projects and their configury occasionally doesn't like
951             # the "macos" part so be sure to use aarch64-apple-darwin for now.
952             HOST_PLATFORM=aarch64-apple-darwin
953             ;;
954         esac
956         # Apple's Clang uses "arm64"
957         host_cpu_for_clang=arm64
958     esac
961 ios*) # iOS
962     test_cmis=no
963     test_randr=no
964     test_xrender=no
965     test_freetype=no
966     test_fontconfig=no
967     test_dbus=no
968     if test -n "$LODE_HOME" ; then
969         mac_sanitize_path
970         AC_MSG_NOTICE([sanitized the PATH to $PATH])
971     fi
972     enable_gpgmepp=no
973     _os=iOS
974     test_cups=no
975     enable_mpl_subset=yes
976     enable_lotuswordpro=no
977     enable_coinmp=no
978     enable_lpsolve=no
979     enable_mariadb_sdbc=no
980     enable_postgresql_sdbc=no
981     enable_extension_integration=no
982     enable_report_builder=no
983     with_ppds=no
984     if test "$enable_ios_simulator" = "yes"; then
985         host=x86_64-apple-darwin
986     fi
987     # See comment above the case "$host_os"
988     LINKFLAGSSHL="-dynamiclib -single_module"
990     # -fPIC is default
991     PICSWITCH=""
993     DLLPOST=".dylib"
995     # -undefined error is the default
996     LINKFLAGSNOUNDEFS=""
998     # HOST_PLATFORM is used for external projects and their configury typically doesn't like the "ios"
999     # part, so use aarch64-apple-darwin for now.
1000     HOST_PLATFORM=aarch64-apple-darwin
1002     # Apple's Clang uses "arm64"
1003     host_cpu_for_clang=arm64
1006 freebsd*)
1007     build_gstreamer_1_0=yes
1008     test_kf5=yes
1009     test_gtk3_kde5=yes
1010     test_freetype=yes
1011     build_skia=yes
1012     AC_MSG_CHECKING([the FreeBSD operating system release])
1013     if test -n "$with_os_version"; then
1014         OSVERSION="$with_os_version"
1015     else
1016         OSVERSION=`/sbin/sysctl -n kern.osreldate`
1017     fi
1018     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
1019     AC_MSG_CHECKING([which thread library to use])
1020     if test "$OSVERSION" -lt "500016"; then
1021         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1022         PTHREAD_LIBS="-pthread"
1023     elif test "$OSVERSION" -lt "502102"; then
1024         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1025         PTHREAD_LIBS="-lc_r"
1026     else
1027         PTHREAD_CFLAGS=""
1028         PTHREAD_LIBS="-pthread"
1029     fi
1030     AC_MSG_RESULT([$PTHREAD_LIBS])
1031     _os=FreeBSD
1032     ;;
1034 *netbsd*)
1035     build_gstreamer_1_0=yes
1036     test_kf5=yes
1037     test_gtk3_kde5=yes
1038     test_freetype=yes
1039     build_skia=yes
1040     PTHREAD_LIBS="-pthread -lpthread"
1041     _os=NetBSD
1042     ;;
1044 aix*)
1045     test_randr=no
1046     test_freetype=yes
1047     PTHREAD_LIBS=-pthread
1048     _os=AIX
1049     ;;
1051 openbsd*)
1052     test_freetype=yes
1053     PTHREAD_CFLAGS="-D_THREAD_SAFE"
1054     PTHREAD_LIBS="-pthread"
1055     _os=OpenBSD
1056     ;;
1058 dragonfly*)
1059     build_gstreamer_1_0=yes
1060     test_kf5=yes
1061     test_gtk3_kde5=yes
1062     test_freetype=yes
1063     build_skia=yes
1064     PTHREAD_LIBS="-pthread"
1065     _os=DragonFly
1066     ;;
1068 linux-android*)
1069     build_gstreamer_1_0=no
1070     enable_lotuswordpro=no
1071     enable_mpl_subset=yes
1072     enable_coinmp=yes
1073     enable_lpsolve=no
1074     enable_mariadb_sdbc=no
1075     enable_report_builder=no
1076     enable_odk=no
1077     enable_postgresql_sdbc=no
1078     enable_python=no
1079     test_cups=no
1080     test_dbus=no
1081     test_fontconfig=no
1082     test_freetype=no
1083     test_kf5=no
1084     test_qt5=no
1085     test_gtk3_kde5=no
1086     test_randr=no
1087     test_xrender=no
1088     _os=Android
1090     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
1091     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
1092     ;;
1094 haiku*)
1095     test_cups=no
1096     test_dbus=no
1097     test_randr=no
1098     test_xrender=no
1099     test_freetype=yes
1100     enable_odk=no
1101     enable_gstreamer_1_0=no
1102     enable_coinmp=no
1103     enable_pdfium=no
1104     enable_sdremote=no
1105     enable_postgresql_sdbc=no
1106     enable_firebird_sdbc=no
1107     _os=Haiku
1108     ;;
1110 emscripten)
1111     build_gstreamer_1_0=no
1112     enable_lpsolve=no
1113     enable_report_builder=no
1114     with_theme="breeze"
1115     test_cmis=no
1116     test_cups=no
1117     test_curl=no
1118     test_dbus=no
1119     test_fontconfig=no
1120     test_freetype=no
1121     test_gtk=no
1122     test_randr=no
1123     test_xrender=no
1124     enable_postgresql_sdbc=no
1125     enable_firebird_sdbc=no
1126     enable_mariadb_sdbc=no
1127     with_system_zlib=no
1128     _os=Emscripten
1130     BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
1131     ;;
1134     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
1135     ;;
1136 esac
1138 AC_SUBST(HOST_PLATFORM)
1140 if test "$_os" = "Android" ; then
1141     # Verify that the NDK and SDK options are proper
1142     if test -z "$with_android_ndk"; then
1143         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
1144     elif test ! -f "$ANDROID_NDK_HOME/meta/abis.json"; then
1145         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
1146     fi
1148     if test -z "$ANDROID_SDK_HOME"; then
1149         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
1150     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
1151         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
1152     fi
1154     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
1155     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
1156         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
1157                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
1158                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
1159         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
1160         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
1161         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
1162     fi
1163     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
1164         AC_MSG_WARN([android support repository not found - install with
1165                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
1166                      to allow the build to download the specified version of the android support libraries])
1167         add_warning "android support repository not found - install with"
1168         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
1169         add_warning "to allow the build to download the specified version of the android support libraries"
1170     fi
1173 if test "$_os" = "AIX"; then
1174     AC_PATH_PROG(GAWK, gawk)
1175     if test -z "$GAWK"; then
1176         AC_MSG_ERROR([gawk not found in \$PATH])
1177     fi
1180 AC_SUBST(SDKDIRNAME)
1182 AC_SUBST(PTHREAD_CFLAGS)
1183 AC_SUBST(PTHREAD_LIBS)
1185 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
1186 # By default use the ones specified by our build system,
1187 # but explicit override is possible.
1188 AC_MSG_CHECKING(for explicit AFLAGS)
1189 if test -n "$AFLAGS"; then
1190     AC_MSG_RESULT([$AFLAGS])
1191     x_AFLAGS=
1192 else
1193     AC_MSG_RESULT(no)
1194     x_AFLAGS=[\#]
1196 AC_MSG_CHECKING(for explicit CFLAGS)
1197 if test -n "$CFLAGS"; then
1198     AC_MSG_RESULT([$CFLAGS])
1199     x_CFLAGS=
1200 else
1201     AC_MSG_RESULT(no)
1202     x_CFLAGS=[\#]
1204 AC_MSG_CHECKING(for explicit CXXFLAGS)
1205 if test -n "$CXXFLAGS"; then
1206     AC_MSG_RESULT([$CXXFLAGS])
1207     x_CXXFLAGS=
1208 else
1209     AC_MSG_RESULT(no)
1210     x_CXXFLAGS=[\#]
1212 AC_MSG_CHECKING(for explicit OBJCFLAGS)
1213 if test -n "$OBJCFLAGS"; then
1214     AC_MSG_RESULT([$OBJCFLAGS])
1215     x_OBJCFLAGS=
1216 else
1217     AC_MSG_RESULT(no)
1218     x_OBJCFLAGS=[\#]
1220 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
1221 if test -n "$OBJCXXFLAGS"; then
1222     AC_MSG_RESULT([$OBJCXXFLAGS])
1223     x_OBJCXXFLAGS=
1224 else
1225     AC_MSG_RESULT(no)
1226     x_OBJCXXFLAGS=[\#]
1228 AC_MSG_CHECKING(for explicit LDFLAGS)
1229 if test -n "$LDFLAGS"; then
1230     AC_MSG_RESULT([$LDFLAGS])
1231     x_LDFLAGS=
1232 else
1233     AC_MSG_RESULT(no)
1234     x_LDFLAGS=[\#]
1236 AC_SUBST(AFLAGS)
1237 AC_SUBST(CFLAGS)
1238 AC_SUBST(CXXFLAGS)
1239 AC_SUBST(OBJCFLAGS)
1240 AC_SUBST(OBJCXXFLAGS)
1241 AC_SUBST(LDFLAGS)
1242 AC_SUBST(x_AFLAGS)
1243 AC_SUBST(x_CFLAGS)
1244 AC_SUBST(x_CXXFLAGS)
1245 AC_SUBST(x_OBJCFLAGS)
1246 AC_SUBST(x_OBJCXXFLAGS)
1247 AC_SUBST(x_LDFLAGS)
1249 dnl These are potentially set for MSVC, in the code checking for UCRT below:
1250 my_original_CFLAGS=$CFLAGS
1251 my_original_CXXFLAGS=$CXXFLAGS
1252 my_original_CPPFLAGS=$CPPFLAGS
1254 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
1255 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
1256 dnl AC_PROG_CC internally.
1257 if test "$_os" != "WINNT"; then
1258     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
1259     save_CFLAGS=$CFLAGS
1260     AC_PROG_CC
1261     CFLAGS=$save_CFLAGS
1262     if test -z "$CC_BASE"; then
1263         CC_BASE=`first_arg_basename "$CC"`
1264     fi
1267 if test "$_os" != "WINNT"; then
1268     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
1269 else
1270     ENDIANNESS=little
1272 AC_SUBST(ENDIANNESS)
1274 if test $_os != "WINNT"; then
1275     save_LIBS="$LIBS"
1276     AC_SEARCH_LIBS([dlsym], [dl],
1277         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
1278         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
1279     LIBS="$save_LIBS"
1281 AC_SUBST(DLOPEN_LIBS)
1283 dnl ===================================================================
1284 dnl Sanity checks for Emscripten SDK setup
1285 dnl ===================================================================
1287 if test "$_os" = "Emscripten"; then
1288     EMSCRIPTEN_ERROR=0
1289     if ! which emconfigure >/dev/null 2>&1; then
1290         AC_MSG_WARN([emconfigure must be in your \$PATH])
1291         EMSCRIPTEN_ERROR=1
1292     fi
1293     if test -z "$EMMAKEN_JUST_CONFIGURE"; then
1294         AC_MSG_WARN(["\$EMMAKEN_JUST_CONFIGURE wasn't set by emconfigure. Prefix configure or use autogen.sh])
1295         EMSCRIPTEN_ERROR=1
1296     fi
1297     if test $EMSCRIPTEN_ERROR -ne 0; then
1298         AC_MSG_ERROR(["Please fix your EMSDK setup to build with Emscripten!"])
1299     fi
1302 ###############################################################################
1303 # Extensions switches --enable/--disable
1304 ###############################################################################
1305 # By default these should be enabled unless having extra dependencies.
1306 # If there is extra dependency over configure options then the enable should
1307 # be automagic based on whether the requiring feature is enabled or not.
1308 # All this options change anything only with --enable-extension-integration.
1310 # The name of this option and its help string makes it sound as if
1311 # extensions are built anyway, just not integrated in the installer,
1312 # if you use --disable-extension-integration. Is that really the
1313 # case?
1315 AC_ARG_ENABLE(ios-simulator,
1316     AS_HELP_STRING([--enable-ios-simulator],
1317         [build for iOS simulator])
1320 libo_FUZZ_ARG_ENABLE(extension-integration,
1321     AS_HELP_STRING([--disable-extension-integration],
1322         [Disable integration of the built extensions in the installer of the
1323          product. Use this switch to disable the integration.])
1326 AC_ARG_ENABLE(avmedia,
1327     AS_HELP_STRING([--disable-avmedia],
1328         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
1331 AC_ARG_ENABLE(database-connectivity,
1332     AS_HELP_STRING([--disable-database-connectivity],
1333         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1336 # This doesn't mean not building (or "integrating") extensions
1337 # (although it probably should; i.e. it should imply
1338 # --disable-extension-integration I guess), it means not supporting
1339 # any extension mechanism at all
1340 libo_FUZZ_ARG_ENABLE(extensions,
1341     AS_HELP_STRING([--disable-extensions],
1342         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1345 AC_ARG_ENABLE(scripting,
1346     AS_HELP_STRING([--disable-scripting],
1347         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1350 # This is mainly for Android and iOS, but could potentially be used in some
1351 # special case otherwise, too, so factored out as a separate setting
1353 AC_ARG_ENABLE(dynamic-loading,
1354     AS_HELP_STRING([--disable-dynamic-loading],
1355         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1358 libo_FUZZ_ARG_ENABLE(report-builder,
1359     AS_HELP_STRING([--disable-report-builder],
1360         [Disable the Report Builder.])
1363 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1364     AS_HELP_STRING([--enable-ext-wiki-publisher],
1365         [Enable the Wiki Publisher extension.])
1368 libo_FUZZ_ARG_ENABLE(lpsolve,
1369     AS_HELP_STRING([--disable-lpsolve],
1370         [Disable compilation of the lp solve solver ])
1372 libo_FUZZ_ARG_ENABLE(coinmp,
1373     AS_HELP_STRING([--disable-coinmp],
1374         [Disable compilation of the CoinMP solver ])
1377 libo_FUZZ_ARG_ENABLE(pdfimport,
1378     AS_HELP_STRING([--disable-pdfimport],
1379         [Disable building the PDF import feature.])
1382 libo_FUZZ_ARG_ENABLE(pdfium,
1383     AS_HELP_STRING([--disable-pdfium],
1384         [Disable building PDFium. Results in unsecure PDF signature verification.])
1387 libo_FUZZ_ARG_ENABLE(skia,
1388     AS_HELP_STRING([--disable-skia],
1389         [Disable building Skia. Use --enable-skia=debug to build without optimizations.])
1392 ###############################################################################
1394 dnl ---------- *** ----------
1396 libo_FUZZ_ARG_ENABLE(mergelibs,
1397     AS_HELP_STRING([--enable-mergelibs],
1398         [Merge several of the smaller libraries into one big, "merged", one.])
1401 libo_FUZZ_ARG_ENABLE(breakpad,
1402     AS_HELP_STRING([--enable-breakpad],
1403         [Enables breakpad for crash reporting.])
1406 libo_FUZZ_ARG_ENABLE(crashdump,
1407     AS_HELP_STRING([--disable-crashdump],
1408         [Disable dump.ini and dump-file, when --enable-breakpad])
1411 AC_ARG_ENABLE(fetch-external,
1412     AS_HELP_STRING([--disable-fetch-external],
1413         [Disables fetching external tarballs from web sources.])
1416 AC_ARG_ENABLE(fuzzers,
1417     AS_HELP_STRING([--enable-fuzzers],
1418         [Enables building libfuzzer targets for fuzz testing.])
1421 libo_FUZZ_ARG_ENABLE(pch,
1422     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1423         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1424          Using 'system' will include only external headers, 'base' will add also headers
1425          from base modules, 'normal' will also add all headers except from the module built,
1426          'full' will use all suitable headers even from a module itself.])
1429 libo_FUZZ_ARG_ENABLE(epm,
1430     AS_HELP_STRING([--enable-epm],
1431         [LibreOffice includes self-packaging code, that requires epm, however epm is
1432          useless for large scale package building.])
1435 libo_FUZZ_ARG_ENABLE(odk,
1436     AS_HELP_STRING([--enable-odk],
1437         [Enable building the Office Development Kit, the part that extensions need to build against])
1440 AC_ARG_ENABLE(mpl-subset,
1441     AS_HELP_STRING([--enable-mpl-subset],
1442         [Don't compile any pieces which are not MPL or more liberally licensed])
1445 libo_FUZZ_ARG_ENABLE(evolution2,
1446     AS_HELP_STRING([--enable-evolution2],
1447         [Allows the built-in evolution 2 addressbook connectivity build to be
1448          enabled.])
1451 AC_ARG_ENABLE(avahi,
1452     AS_HELP_STRING([--enable-avahi],
1453         [Determines whether to use Avahi to advertise Impress to remote controls.])
1456 libo_FUZZ_ARG_ENABLE(werror,
1457     AS_HELP_STRING([--enable-werror],
1458         [Turn warnings to errors. (Has no effect in modules where the treating
1459          of warnings as errors is disabled explicitly.)]),
1462 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1463     AS_HELP_STRING([--enable-assert-always-abort],
1464         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1467 libo_FUZZ_ARG_ENABLE(dbgutil,
1468     AS_HELP_STRING([--enable-dbgutil],
1469         [Provide debugging support from --enable-debug and include additional debugging
1470          utilities such as object counting or more expensive checks.
1471          This is the recommended option for developers.
1472          Note that this makes the build ABI incompatible, it is not possible to mix object
1473          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1475 libo_FUZZ_ARG_ENABLE(debug,
1476     AS_HELP_STRING([--enable-debug],
1477         [Include debugging information, disable compiler optimization and inlining plus
1478          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1480 libo_FUZZ_ARG_ENABLE(split-debug,
1481     AS_HELP_STRING([--disable-split-debug],
1482         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1483          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1485 libo_FUZZ_ARG_ENABLE(gdb-index,
1486     AS_HELP_STRING([--disable-gdb-index],
1487         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1488          The feature requires the gold or lld linker.]))
1490 libo_FUZZ_ARG_ENABLE(sal-log,
1491     AS_HELP_STRING([--enable-sal-log],
1492         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1494 libo_FUZZ_ARG_ENABLE(symbols,
1495     AS_HELP_STRING([--enable-symbols],
1496         [Generate debug information.
1497          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1498          otherwise. It is possible to explicitly specify gbuild build targets
1499          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1500          everything in the directory; there is no ordering, more specific overrides
1501          more general, and disabling takes precedence).
1502          Example: --enable-symbols="all -sw/ -Library_sc".]))
1504 libo_FUZZ_ARG_ENABLE(optimized,
1505     AS_HELP_STRING([--enable-optimized=<yes/no/debug>],
1506         [Whether to compile with optimization flags.
1507          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1508          otherwise. Using 'debug' will try to use only optimizations that should
1509          not interfere with debugging. For Emscripten we default to optimized (-O1)
1510          debug build, as otherwise binaries become too large.]))
1512 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1513     AS_HELP_STRING([--disable-runtime-optimizations],
1514         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1515          JVM JIT) that are known to interact badly with certain dynamic analysis
1516          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1517          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1518          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1520 AC_ARG_WITH(valgrind,
1521     AS_HELP_STRING([--with-valgrind],
1522         [Make availability of Valgrind headers a hard requirement.]))
1524 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1525     AS_HELP_STRING([--enable-compiler-plugins],
1526         [Enable compiler plugins that will perform additional checks during
1527          building. Enabled automatically by --enable-dbgutil.
1528          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1529 COMPILER_PLUGINS_DEBUG=
1530 if test "$enable_compiler_plugins" = debug; then
1531     enable_compiler_plugins=yes
1532     COMPILER_PLUGINS_DEBUG=TRUE
1535 libo_FUZZ_ARG_ENABLE(compiler-plugins-analyzer-pch,
1536     AS_HELP_STRING([--disable-compiler-plugins-analyzer-pch],
1537         [Disable use of precompiled headers when running the Clang compiler plugin analyzer.  Not
1538          relevant in the --disable-compiler-plugins case.]))
1540 libo_FUZZ_ARG_ENABLE(ooenv,
1541     AS_HELP_STRING([--enable-ooenv],
1542         [Enable ooenv for the instdir installation.]))
1544 AC_ARG_ENABLE(lto,
1545     AS_HELP_STRING([--enable-lto],
1546         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1547          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1548          linker. For MSVC, this option is broken at the moment. This is experimental work
1549          in progress that shouldn't be used unless you are working on it.)]))
1551 AC_ARG_ENABLE(python,
1552     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1553         [Enables or disables Python support at run-time.
1554          Also specifies what Python to use at build-time.
1555          'fully-internal' even forces the internal version for uses of Python
1556          during the build.
1557          On macOS the only choices are
1558          'internal' (default) or 'fully-internal'. Otherwise the default is 'auto'.
1559          ]))
1561 libo_FUZZ_ARG_ENABLE(gtk3,
1562     AS_HELP_STRING([--disable-gtk3],
1563         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1564 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1566 AC_ARG_ENABLE(gtk4,
1567     AS_HELP_STRING([--enable-gtk4],
1568         [Determines whether to use Gtk+ 4.0 vclplug on platforms where Gtk+ 4.0 is available.]))
1570 AC_ARG_ENABLE(introspection,
1571     AS_HELP_STRING([--enable-introspection],
1572         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1573          Linux distributions.)]))
1575 AC_ARG_ENABLE(split-app-modules,
1576     AS_HELP_STRING([--enable-split-app-modules],
1577         [Split file lists for app modules, e.g. base, calc.
1578          Has effect only with make distro-pack-install]),
1581 AC_ARG_ENABLE(split-opt-features,
1582     AS_HELP_STRING([--enable-split-opt-features],
1583         [Split file lists for some optional features, e.g. pyuno, testtool.
1584          Has effect only with make distro-pack-install]),
1587 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1588     AS_HELP_STRING([--disable-cairo-canvas],
1589         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1592 libo_FUZZ_ARG_ENABLE(dbus,
1593     AS_HELP_STRING([--disable-dbus],
1594         [Determines whether to enable features that depend on dbus.
1595          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1596 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1598 libo_FUZZ_ARG_ENABLE(sdremote,
1599     AS_HELP_STRING([--disable-sdremote],
1600         [Determines whether to enable Impress remote control (i.e. the server component).]),
1601 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1603 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1604     AS_HELP_STRING([--disable-sdremote-bluetooth],
1605         [Determines whether to build sdremote with bluetooth support.
1606          Requires dbus on Linux.]))
1608 libo_FUZZ_ARG_ENABLE(gio,
1609     AS_HELP_STRING([--disable-gio],
1610         [Determines whether to use the GIO support.]),
1611 ,test "${enable_gio+set}" = set || enable_gio=yes)
1613 AC_ARG_ENABLE(qt5,
1614     AS_HELP_STRING([--enable-qt5],
1615         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1616          available.]),
1619 AC_ARG_ENABLE(kf5,
1620     AS_HELP_STRING([--enable-kf5],
1621         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1622          KF5 are available.]),
1625 AC_ARG_ENABLE(kde5,
1626     AS_HELP_STRING([--enable-kde5],
1627         [Compatibility switch for the kde5 => kf5 rename. Use --enable-kf5!])
1630 AC_ARG_ENABLE(gtk3_kde5,
1631     AS_HELP_STRING([--enable-gtk3-kde5],
1632         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1633          platforms where Gtk3, Qt5 and Plasma is available.]),
1636 AC_ARG_ENABLE(gui,
1637     AS_HELP_STRING([--disable-gui],
1638         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1639 ,enable_gui=yes)
1641 libo_FUZZ_ARG_ENABLE(randr,
1642     AS_HELP_STRING([--disable-randr],
1643         [Disable RandR support in the vcl project.]),
1644 ,test "${enable_randr+set}" = set || enable_randr=yes)
1646 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1647     AS_HELP_STRING([--disable-gstreamer-1-0],
1648         [Disable building with the gstreamer 1.0 avmedia backend.]),
1649 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1651 libo_FUZZ_ARG_ENABLE(neon,
1652     AS_HELP_STRING([--disable-neon],
1653         [Disable neon and the compilation of webdav binding.]),
1656 libo_FUZZ_ARG_ENABLE([eot],
1657     [AS_HELP_STRING([--enable-eot],
1658         [Enable support for Embedded OpenType fonts.])],
1659 ,test "${enable_eot+set}" = set || enable_eot=no)
1661 libo_FUZZ_ARG_ENABLE(cve-tests,
1662     AS_HELP_STRING([--disable-cve-tests],
1663         [Prevent CVE tests to be executed]),
1666 libo_FUZZ_ARG_ENABLE(chart-tests,
1667     AS_HELP_STRING([--enable-chart-tests],
1668         [Executes chart XShape tests. In a perfect world these tests would be
1669          stable and everyone could run them, in reality it is best to run them
1670          only on a few machines that are known to work and maintained by people
1671          who can judge if a test failure is a regression or not.]),
1674 AC_ARG_ENABLE(build-opensymbol,
1675     AS_HELP_STRING([--enable-build-opensymbol],
1676         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1677          fontforge installed.]),
1680 AC_ARG_ENABLE(dependency-tracking,
1681     AS_HELP_STRING([--enable-dependency-tracking],
1682         [Do not reject slow dependency extractors.])[
1683   --disable-dependency-tracking
1684                           Disables generation of dependency information.
1685                           Speed up one-time builds.],
1688 AC_ARG_ENABLE(icecream,
1689     AS_HELP_STRING([--enable-icecream],
1690         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1691          It defaults to /opt/icecream for the location of the icecream gcc/g++
1692          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1695 AC_ARG_ENABLE(ld,
1696     AS_HELP_STRING([--enable-ld=<linker>],
1697         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1698          By default tries to use the best linker possible, use --disable-ld to use the default linker.
1699          If <linker> contains any ':', the part before the first ':' is used as the value of
1700          -fuse-ld, while the part after the first ':' is used as the value of --ld-path (which is
1701          needed for Clang 12).]),
1704 libo_FUZZ_ARG_ENABLE(cups,
1705     AS_HELP_STRING([--disable-cups],
1706         [Do not build cups support.])
1709 AC_ARG_ENABLE(ccache,
1710     AS_HELP_STRING([--disable-ccache],
1711         [Do not try to use ccache automatically.
1712          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1713          CC/CXX are not yet set, and --enable-icecream is not given, we
1714          attempt to use ccache. --disable-ccache disables ccache completely.
1715          Additionally ccache's depend mode is enabled if possible,
1716          use --enable-ccache=nodepend to enable ccache without depend mode.
1720 libo_FUZZ_ARG_ENABLE(online-update,
1721     AS_HELP_STRING([--enable-online-update],
1722         [Enable the online update service that will check for new versions of
1723          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1724          If the value is "mar", the experimental Mozilla-like update will be
1725          enabled instead of the traditional update mechanism.]),
1728 AC_ARG_WITH(update-config,
1729     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1730                    [Path to the update config ini file]))
1732 libo_FUZZ_ARG_ENABLE(extension-update,
1733     AS_HELP_STRING([--disable-extension-update],
1734         [Disable possibility to update installed extensions.]),
1737 libo_FUZZ_ARG_ENABLE(release-build,
1738     AS_HELP_STRING([--enable-release-build],
1739         [Enable release build. Note that the "release build" choice is orthogonal to
1740          whether symbols are present, debug info is generated, or optimization
1741          is done.
1742          See http://wiki.documentfoundation.org/Development/DevBuild]),
1745 AC_ARG_ENABLE(windows-build-signing,
1746     AS_HELP_STRING([--enable-windows-build-signing],
1747         [Enable signing of windows binaries (*.exe, *.dll)]),
1750 AC_ARG_ENABLE(silent-msi,
1751     AS_HELP_STRING([--enable-silent-msi],
1752         [Enable MSI with LIMITUI=1 (silent install).]),
1755 AC_ARG_ENABLE(macosx-code-signing,
1756     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1757         [Sign executables, dylibs, frameworks and the app bundle. If you
1758          don't provide an identity the first suitable certificate
1759          in your keychain is used.]),
1762 AC_ARG_ENABLE(macosx-package-signing,
1763     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1764         [Create a .pkg suitable for uploading to the Mac App Store and sign
1765          it. If you don't provide an identity the first suitable certificate
1766          in your keychain is used.]),
1769 AC_ARG_ENABLE(macosx-sandbox,
1770     AS_HELP_STRING([--enable-macosx-sandbox],
1771         [Make the app bundle run in a sandbox. Requires code signing.
1772          Is required by apps distributed in the Mac App Store, and implies
1773          adherence to App Store rules.]),
1776 AC_ARG_WITH(macosx-bundle-identifier,
1777     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1778         [Define the macOS bundle identifier. Default is the somewhat weird
1779          org.libreoffice.script ("script", huh?).]),
1780 ,with_macosx_bundle_identifier=org.libreoffice.script)
1782 AC_ARG_WITH(product-name,
1783     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1784         [Define the product name. Default is AC_PACKAGE_NAME.]),
1785 ,with_product_name=$PRODUCTNAME)
1787 libo_FUZZ_ARG_ENABLE(community-flavor,
1788     AS_HELP_STRING([--disable-community-flavor],
1789         [Disable the Community branding.]),
1792 AC_ARG_WITH(package-version,
1793     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1794         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1797 libo_FUZZ_ARG_ENABLE(readonly-installset,
1798     AS_HELP_STRING([--enable-readonly-installset],
1799         [Prevents any attempts by LibreOffice to write into its installation. That means
1800          at least that no "system-wide" extensions can be added. Partly experimental work in
1801          progress, probably not fully implemented. Always enabled for macOS.]),
1804 libo_FUZZ_ARG_ENABLE(mariadb-sdbc,
1805     AS_HELP_STRING([--disable-mariadb-sdbc],
1806         [Disable the build of the MariaDB/MySQL-SDBC driver.])
1809 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1810     AS_HELP_STRING([--disable-postgresql-sdbc],
1811         [Disable the build of the PostgreSQL-SDBC driver.])
1814 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1815     AS_HELP_STRING([--disable-lotuswordpro],
1816         [Disable the build of the Lotus Word Pro filter.]),
1817 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1819 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1820     AS_HELP_STRING([--disable-firebird-sdbc],
1821         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1822 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1824 AC_ARG_ENABLE(bogus-pkg-config,
1825     AS_HELP_STRING([--enable-bogus-pkg-config],
1826         [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.]),
1829 AC_ARG_ENABLE(openssl,
1830     AS_HELP_STRING([--disable-openssl],
1831         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1832          components will either use GNUTLS or NSS. Work in progress,
1833          use only if you are hacking on it.]),
1834 ,enable_openssl=yes)
1836 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1837     AS_HELP_STRING([--enable-cipher-openssl-backend],
1838         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1839          Requires --enable-openssl.]))
1841 AC_ARG_ENABLE(nss,
1842     AS_HELP_STRING([--disable-nss],
1843         [Disable using NSS. If disabled,
1844          components will either use GNUTLS or openssl. Work in progress,
1845          use only if you are hacking on it.]),
1846 ,enable_nss=yes)
1848 AC_ARG_ENABLE(library-bin-tar,
1849     AS_HELP_STRING([--enable-library-bin-tar],
1850         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1851         Some libraries can save their build result in a tarball
1852         stored in TARFILE_LOCATION. That binary tarball is
1853         uniquely identified by the source tarball,
1854         the content of the config_host.mk file and the content
1855         of the top-level directory in core for that library
1856         If this option is enabled, then if such a tarfile exist, it will be untarred
1857         instead of the source tarfile, and the build step will be skipped for that
1858         library.
1859         If a proper tarfile does not exist, then the normal source-based
1860         build is done for that library and a proper binary tarfile is created
1861         for the next time.]),
1864 AC_ARG_ENABLE(dconf,
1865     AS_HELP_STRING([--disable-dconf],
1866         [Disable the dconf configuration backend (enabled by default where
1867          available).]))
1869 libo_FUZZ_ARG_ENABLE(formula-logger,
1870     AS_HELP_STRING(
1871         [--enable-formula-logger],
1872         [Enable formula logger for logging formula calculation flow in Calc.]
1873     )
1876 AC_ARG_ENABLE(ldap,
1877     AS_HELP_STRING([--disable-ldap],
1878         [Disable LDAP support.]),
1879 ,enable_ldap=yes)
1881 AC_ARG_ENABLE(opencl,
1882     AS_HELP_STRING([--disable-opencl],
1883         [Disable OpenCL support.]),
1884 ,enable_opencl=yes)
1886 libo_FUZZ_ARG_ENABLE(librelogo,
1887     AS_HELP_STRING([--disable-librelogo],
1888         [Do not build LibreLogo.]),
1889 ,enable_librelogo=yes)
1891 AC_ARG_ENABLE(cmis,
1892     AS_HELP_STRING([--disable-cmis],
1893         [Disable CMIS support.]),
1894 ,enable_cmis=yes)
1896 AC_ARG_ENABLE(curl,
1897     AS_HELP_STRING([--disable-curl],
1898         [Disable CURL support.]),
1899 ,enable_curl=yes)
1901 AC_ARG_ENABLE(wasm-strip,
1902     AS_HELP_STRING([--enable-wasm-strip],
1903         [Strip the static build like for WASM/emscripten platform.]),
1904 ,enable_wasm_strip=yes)
1907 dnl ===================================================================
1908 dnl Optional Packages (--with/without-)
1909 dnl ===================================================================
1911 AC_ARG_WITH(gcc-home,
1912     AS_HELP_STRING([--with-gcc-home],
1913         [Specify the location of gcc/g++ manually. This can be used in conjunction
1914          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1915          non-default path.]),
1918 AC_ARG_WITH(gnu-patch,
1919     AS_HELP_STRING([--with-gnu-patch],
1920         [Specify location of GNU patch on Solaris or FreeBSD.]),
1923 AC_ARG_WITH(build-platform-configure-options,
1924     AS_HELP_STRING([--with-build-platform-configure-options],
1925         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1928 AC_ARG_WITH(gnu-cp,
1929     AS_HELP_STRING([--with-gnu-cp],
1930         [Specify location of GNU cp on Solaris or FreeBSD.]),
1933 AC_ARG_WITH(external-tar,
1934     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1935         [Specify an absolute path of where to find (and store) tarfiles.]),
1936     TARFILE_LOCATION=$withval ,
1939 AC_ARG_WITH(referenced-git,
1940     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1941         [Specify another checkout directory to reference. This makes use of
1942                  git submodule update --reference, and saves a lot of diskspace
1943                  when having multiple trees side-by-side.]),
1944     GIT_REFERENCE_SRC=$withval ,
1947 AC_ARG_WITH(linked-git,
1948     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1949         [Specify a directory where the repositories of submodules are located.
1950          This uses a method similar to git-new-workdir to get submodules.]),
1951     GIT_LINK_SRC=$withval ,
1954 AC_ARG_WITH(galleries,
1955     AS_HELP_STRING([--with-galleries],
1956         [Specify how galleries should be built. It is possible either to
1957          build these internally from source ("build"),
1958          or to disable them ("no")]),
1961 AC_ARG_WITH(theme,
1962     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1963         [Choose which themes to include. By default those themes with an '*' are included.
1964          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg, *colibre, *colibre_svg, *elementary,
1965          *elementary_svg, *karasa_jaga, *karasa_jaga_svg, *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg, *sukapura, *sukapura_svg.]),
1968 libo_FUZZ_ARG_WITH(helppack-integration,
1969     AS_HELP_STRING([--without-helppack-integration],
1970         [It will not integrate the helppacks to the installer
1971          of the product. Please use this switch to use the online help
1972          or separate help packages.]),
1975 libo_FUZZ_ARG_WITH(fonts,
1976     AS_HELP_STRING([--without-fonts],
1977         [LibreOffice includes some third-party fonts to provide a reliable basis for
1978          help content, templates, samples, etc. When these fonts are already
1979          known to be available on the system then you should use this option.]),
1982 AC_ARG_WITH(epm,
1983     AS_HELP_STRING([--with-epm],
1984         [Decides which epm to use. Default is to use the one from the system if
1985          one is built. When either this is not there or you say =internal epm
1986          will be built.]),
1989 AC_ARG_WITH(package-format,
1990     AS_HELP_STRING([--with-package-format],
1991         [Specify package format(s) for LibreOffice installation sets. The
1992          implicit --without-package-format leads to no installation sets being
1993          generated. Possible values: aix, archive, bsd, deb, dmg,
1994          installed, msi, pkg, and rpm.
1995          Example: --with-package-format='deb rpm']),
1998 AC_ARG_WITH(tls,
1999     AS_HELP_STRING([--with-tls],
2000         [Decides which TLS/SSL and cryptographic implementations to use for
2001          LibreOffice's code. Notice that this doesn't apply for depending
2002          libraries like "neon", for example. Default is to use NSS
2003          although OpenSSL is also possible. Notice that selecting NSS restricts
2004          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
2005          restrict by now the usage of NSS in LO's code. Possible values:
2006          openssl, nss. Example: --with-tls="nss"]),
2009 AC_ARG_WITH(system-libs,
2010     AS_HELP_STRING([--with-system-libs],
2011         [Use libraries already on system -- enables all --with-system-* flags.]),
2014 AC_ARG_WITH(system-bzip2,
2015     AS_HELP_STRING([--with-system-bzip2],
2016         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
2017     [with_system_bzip2="$with_system_libs"])
2019 AC_ARG_WITH(system-headers,
2020     AS_HELP_STRING([--with-system-headers],
2021         [Use headers already on system -- enables all --with-system-* flags for
2022          external packages whose headers are the only entities used i.e.
2023          boost/odbc/sane-header(s).]),,
2024     [with_system_headers="$with_system_libs"])
2026 AC_ARG_WITH(system-jars,
2027     AS_HELP_STRING([--without-system-jars],
2028         [When building with --with-system-libs, also the needed jars are expected
2029          on the system. Use this to disable that]),,
2030     [with_system_jars="$with_system_libs"])
2032 AC_ARG_WITH(system-cairo,
2033     AS_HELP_STRING([--with-system-cairo],
2034         [Use cairo libraries already on system.  Happens automatically for
2035          (implicit) --enable-gtk3.]))
2037 AC_ARG_WITH(system-epoxy,
2038     AS_HELP_STRING([--with-system-epoxy],
2039         [Use epoxy libraries already on system.  Happens automatically for
2040          (implicit) --enable-gtk3.]),,
2041        [with_system_epoxy="$with_system_libs"])
2043 AC_ARG_WITH(myspell-dicts,
2044     AS_HELP_STRING([--with-myspell-dicts],
2045         [Adds myspell dictionaries to the LibreOffice installation set]),
2048 AC_ARG_WITH(system-dicts,
2049     AS_HELP_STRING([--without-system-dicts],
2050         [Do not use dictionaries from system paths.]),
2053 AC_ARG_WITH(external-dict-dir,
2054     AS_HELP_STRING([--with-external-dict-dir],
2055         [Specify external dictionary dir.]),
2058 AC_ARG_WITH(external-hyph-dir,
2059     AS_HELP_STRING([--with-external-hyph-dir],
2060         [Specify external hyphenation pattern dir.]),
2063 AC_ARG_WITH(external-thes-dir,
2064     AS_HELP_STRING([--with-external-thes-dir],
2065         [Specify external thesaurus dir.]),
2068 AC_ARG_WITH(system-zlib,
2069     AS_HELP_STRING([--with-system-zlib],
2070         [Use zlib already on system.]),,
2071     [with_system_zlib=auto])
2073 AC_ARG_WITH(system-jpeg,
2074     AS_HELP_STRING([--with-system-jpeg],
2075         [Use jpeg already on system.]),,
2076     [with_system_jpeg="$with_system_libs"])
2078 AC_ARG_WITH(system-clucene,
2079     AS_HELP_STRING([--with-system-clucene],
2080         [Use clucene already on system.]),,
2081     [with_system_clucene="$with_system_libs"])
2083 AC_ARG_WITH(system-expat,
2084     AS_HELP_STRING([--with-system-expat],
2085         [Use expat already on system.]),,
2086     [with_system_expat="$with_system_libs"])
2088 AC_ARG_WITH(system-libxml,
2089     AS_HELP_STRING([--with-system-libxml],
2090         [Use libxml/libxslt already on system.]),,
2091     [with_system_libxml=auto])
2093 AC_ARG_WITH(system-icu,
2094     AS_HELP_STRING([--with-system-icu],
2095         [Use icu already on system.]),,
2096     [with_system_icu="$with_system_libs"])
2098 AC_ARG_WITH(system-ucpp,
2099     AS_HELP_STRING([--with-system-ucpp],
2100         [Use ucpp already on system.]),,
2101     [])
2103 AC_ARG_WITH(system-openldap,
2104     AS_HELP_STRING([--with-system-openldap],
2105         [Use the OpenLDAP LDAP SDK already on system.]),,
2106     [with_system_openldap="$with_system_libs"])
2108 libo_FUZZ_ARG_ENABLE(poppler,
2109     AS_HELP_STRING([--disable-poppler],
2110         [Disable building Poppler.])
2113 AC_ARG_WITH(system-poppler,
2114     AS_HELP_STRING([--with-system-poppler],
2115         [Use system poppler (only needed for PDF import).]),,
2116     [with_system_poppler="$with_system_libs"])
2118 libo_FUZZ_ARG_ENABLE(gpgmepp,
2119     AS_HELP_STRING([--disable-gpgmepp],
2120         [Disable building gpgmepp. Do not use in normal cases unless you want to fix potential problems it causes.])
2123 AC_ARG_WITH(system-gpgmepp,
2124     AS_HELP_STRING([--with-system-gpgmepp],
2125         [Use gpgmepp already on system]),,
2126     [with_system_gpgmepp="$with_system_libs"])
2128 AC_ARG_WITH(system-mariadb,
2129     AS_HELP_STRING([--with-system-mariadb],
2130         [Use MariaDB/MySQL libraries already on system.]),,
2131     [with_system_mariadb="$with_system_libs"])
2133 AC_ARG_ENABLE(bundle-mariadb,
2134     AS_HELP_STRING([--enable-bundle-mariadb],
2135         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
2138 AC_ARG_WITH(system-postgresql,
2139     AS_HELP_STRING([--with-system-postgresql],
2140         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
2141          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
2142     [with_system_postgresql="$with_system_libs"])
2144 AC_ARG_WITH(libpq-path,
2145     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
2146         [Use this PostgreSQL C interface (libpq) installation for building
2147          the PostgreSQL-SDBC extension.]),
2150 AC_ARG_WITH(system-firebird,
2151     AS_HELP_STRING([--with-system-firebird],
2152         [Use Firebird libraries already on system, for building the Firebird-SDBC
2153          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
2154     [with_system_firebird="$with_system_libs"])
2156 AC_ARG_WITH(system-libtommath,
2157             AS_HELP_STRING([--with-system-libtommath],
2158                            [Use libtommath already on system]),,
2159             [with_system_libtommath="$with_system_libs"])
2161 AC_ARG_WITH(system-hsqldb,
2162     AS_HELP_STRING([--with-system-hsqldb],
2163         [Use hsqldb already on system.]))
2165 AC_ARG_WITH(hsqldb-jar,
2166     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
2167         [Specify path to jarfile manually.]),
2168     HSQLDB_JAR=$withval)
2170 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
2171     AS_HELP_STRING([--disable-scripting-beanshell],
2172         [Disable support for scripts in BeanShell.]),
2176 AC_ARG_WITH(system-beanshell,
2177     AS_HELP_STRING([--with-system-beanshell],
2178         [Use beanshell already on system.]),,
2179     [with_system_beanshell="$with_system_jars"])
2181 AC_ARG_WITH(beanshell-jar,
2182     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
2183         [Specify path to jarfile manually.]),
2184     BSH_JAR=$withval)
2186 libo_FUZZ_ARG_ENABLE(scripting-javascript,
2187     AS_HELP_STRING([--disable-scripting-javascript],
2188         [Disable support for scripts in JavaScript.]),
2192 AC_ARG_WITH(system-rhino,
2193     AS_HELP_STRING([--with-system-rhino],
2194         [Use rhino already on system.]),,)
2195 #    [with_system_rhino="$with_system_jars"])
2196 # Above is not used as we have different debug interface
2197 # patched into internal rhino. This code needs to be fixed
2198 # before we can enable it by default.
2200 AC_ARG_WITH(rhino-jar,
2201     AS_HELP_STRING([--with-rhino-jar=JARFILE],
2202         [Specify path to jarfile manually.]),
2203     RHINO_JAR=$withval)
2205 AC_ARG_WITH(system-jfreereport,
2206     AS_HELP_STRING([--with-system-jfreereport],
2207         [Use JFreeReport already on system.]),,
2208     [with_system_jfreereport="$with_system_jars"])
2210 AC_ARG_WITH(sac-jar,
2211     AS_HELP_STRING([--with-sac-jar=JARFILE],
2212         [Specify path to jarfile manually.]),
2213     SAC_JAR=$withval)
2215 AC_ARG_WITH(libxml-jar,
2216     AS_HELP_STRING([--with-libxml-jar=JARFILE],
2217         [Specify path to jarfile manually.]),
2218     LIBXML_JAR=$withval)
2220 AC_ARG_WITH(flute-jar,
2221     AS_HELP_STRING([--with-flute-jar=JARFILE],
2222         [Specify path to jarfile manually.]),
2223     FLUTE_JAR=$withval)
2225 AC_ARG_WITH(jfreereport-jar,
2226     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
2227         [Specify path to jarfile manually.]),
2228     JFREEREPORT_JAR=$withval)
2230 AC_ARG_WITH(liblayout-jar,
2231     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
2232         [Specify path to jarfile manually.]),
2233     LIBLAYOUT_JAR=$withval)
2235 AC_ARG_WITH(libloader-jar,
2236     AS_HELP_STRING([--with-libloader-jar=JARFILE],
2237         [Specify path to jarfile manually.]),
2238     LIBLOADER_JAR=$withval)
2240 AC_ARG_WITH(libformula-jar,
2241     AS_HELP_STRING([--with-libformula-jar=JARFILE],
2242         [Specify path to jarfile manually.]),
2243     LIBFORMULA_JAR=$withval)
2245 AC_ARG_WITH(librepository-jar,
2246     AS_HELP_STRING([--with-librepository-jar=JARFILE],
2247         [Specify path to jarfile manually.]),
2248     LIBREPOSITORY_JAR=$withval)
2250 AC_ARG_WITH(libfonts-jar,
2251     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
2252         [Specify path to jarfile manually.]),
2253     LIBFONTS_JAR=$withval)
2255 AC_ARG_WITH(libserializer-jar,
2256     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
2257         [Specify path to jarfile manually.]),
2258     LIBSERIALIZER_JAR=$withval)
2260 AC_ARG_WITH(libbase-jar,
2261     AS_HELP_STRING([--with-libbase-jar=JARFILE],
2262         [Specify path to jarfile manually.]),
2263     LIBBASE_JAR=$withval)
2265 AC_ARG_WITH(system-odbc,
2266     AS_HELP_STRING([--with-system-odbc],
2267         [Use the odbc headers already on system.]),,
2268     [with_system_odbc="auto"])
2270 AC_ARG_WITH(system-sane,
2271     AS_HELP_STRING([--with-system-sane],
2272         [Use sane.h already on system.]),,
2273     [with_system_sane="$with_system_headers"])
2275 AC_ARG_WITH(system-bluez,
2276     AS_HELP_STRING([--with-system-bluez],
2277         [Use bluetooth.h already on system.]),,
2278     [with_system_bluez="$with_system_headers"])
2280 AC_ARG_WITH(system-curl,
2281     AS_HELP_STRING([--with-system-curl],
2282         [Use curl already on system.]),,
2283     [with_system_curl=auto])
2285 AC_ARG_WITH(system-boost,
2286     AS_HELP_STRING([--with-system-boost],
2287         [Use boost already on system.]),,
2288     [with_system_boost="$with_system_headers"])
2290 AC_ARG_WITH(system-glm,
2291     AS_HELP_STRING([--with-system-glm],
2292         [Use glm already on system.]),,
2293     [with_system_glm="$with_system_headers"])
2295 AC_ARG_WITH(system-hunspell,
2296     AS_HELP_STRING([--with-system-hunspell],
2297         [Use libhunspell already on system.]),,
2298     [with_system_hunspell="$with_system_libs"])
2300 libo_FUZZ_ARG_ENABLE(zxing,
2301     AS_HELP_STRING([--disable-zxing],
2302        [Disable use of zxing external library.]))
2304 AC_ARG_WITH(system-zxing,
2305     AS_HELP_STRING([--with-system-zxing],
2306         [Use libzxing already on system.]),,
2307     [with_system_zxing="$with_system_libs"])
2309 AC_ARG_WITH(system-box2d,
2310     AS_HELP_STRING([--with-system-box2d],
2311         [Use box2d already on system.]),,
2312     [with_system_box2d="$with_system_libs"])
2314 AC_ARG_WITH(system-mythes,
2315     AS_HELP_STRING([--with-system-mythes],
2316         [Use mythes already on system.]),,
2317     [with_system_mythes="$with_system_libs"])
2319 AC_ARG_WITH(system-altlinuxhyph,
2320     AS_HELP_STRING([--with-system-altlinuxhyph],
2321         [Use ALTLinuxhyph already on system.]),,
2322     [with_system_altlinuxhyph="$with_system_libs"])
2324 AC_ARG_WITH(system-lpsolve,
2325     AS_HELP_STRING([--with-system-lpsolve],
2326         [Use lpsolve already on system.]),,
2327     [with_system_lpsolve="$with_system_libs"])
2329 AC_ARG_WITH(system-coinmp,
2330     AS_HELP_STRING([--with-system-coinmp],
2331         [Use CoinMP already on system.]),,
2332     [with_system_coinmp="$with_system_libs"])
2334 AC_ARG_WITH(system-liblangtag,
2335     AS_HELP_STRING([--with-system-liblangtag],
2336         [Use liblangtag library already on system.]),,
2337     [with_system_liblangtag="$with_system_libs"])
2339 AC_ARG_WITH(webdav,
2340     AS_HELP_STRING([--with-webdav],
2341         [Specify which library to use for webdav implementation.
2342          Possible values: "neon", "serf", "no". The default value is "neon".
2343          Example: --with-webdav="serf"]),
2344     WITH_WEBDAV=$withval,
2345     WITH_WEBDAV="neon")
2347 AC_ARG_WITH(linker-hash-style,
2348     AS_HELP_STRING([--with-linker-hash-style],
2349         [Use linker with --hash-style=<style> when linking shared objects.
2350          Possible values: "sysv", "gnu", "both". The default value is "gnu"
2351          if supported on the build system, and "sysv" otherwise.]))
2353 AC_ARG_WITH(jdk-home,
2354     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
2355         [If you have installed JDK 9 or later on your system please supply the
2356          path here. Note that this is not the location of the java command but the
2357          location of the entire distribution. In case of cross-compiling, this
2358          is the JDK of the host os. Use --with-build-platform-configure-options
2359          to point to a different build platform JDK.]),
2362 AC_ARG_WITH(help,
2363     AS_HELP_STRING([--with-help],
2364         [Enable the build of help. There is a special parameter "common" that
2365          can be used to bundle only the common part, .e.g help-specific icons.
2366          This is useful when you build the helpcontent separately.])
2367     [
2368                           Usage:     --with-help    build the old local help
2369                                  --without-help     no local help (default)
2370                                  --with-help=html   build the new HTML local help
2371                                  --with-help=online build the new HTML online help
2372     ],
2375 AC_ARG_WITH(omindex,
2376    AS_HELP_STRING([--with-omindex],
2377         [Enable the support of xapian-omega index for online help.])
2378    [
2379                          Usage: --with-omindex=server prepare the pages for omindex
2380                                 but let xapian-omega be built in server.
2381                                 --with-omindex=noxap do not prepare online pages
2382                                 for xapian-omega
2383   ],
2386 libo_FUZZ_ARG_WITH(java,
2387     AS_HELP_STRING([--with-java=<java command>],
2388         [Specify the name of the Java interpreter command. Typically "java"
2389          which is the default.
2391          To build without support for Java components, applets, accessibility
2392          or the XML filters written in Java, use --without-java or --with-java=no.]),
2393     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2394     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2397 AC_ARG_WITH(jvm-path,
2398     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2399         [Use a specific JVM search path at runtime.
2400          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2403 AC_ARG_WITH(ant-home,
2404     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2405         [If you have installed Apache Ant on your system, please supply the path here.
2406          Note that this is not the location of the Ant binary but the location
2407          of the entire distribution.]),
2410 AC_ARG_WITH(symbol-config,
2411     AS_HELP_STRING([--with-symbol-config],
2412         [Configuration for the crashreport symbol upload]),
2413         [],
2414         [with_symbol_config=no])
2416 AC_ARG_WITH(export-validation,
2417     AS_HELP_STRING([--without-export-validation],
2418         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2419 ,with_export_validation=auto)
2421 AC_ARG_WITH(bffvalidator,
2422     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2423         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2424          Requires installed Microsoft Office Binary File Format Validator.
2425          Note: export-validation (--with-export-validation) is required to be turned on.
2426          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2427 ,with_bffvalidator=no)
2429 libo_FUZZ_ARG_WITH(junit,
2430     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2431         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2432          --without-junit disables those tests. Not relevant in the --without-java case.]),
2433 ,with_junit=yes)
2435 AC_ARG_WITH(hamcrest,
2436     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2437         [Specifies the hamcrest jar file to use for JUnit-based tests.
2438          --without-junit disables those tests. Not relevant in the --without-java case.]),
2439 ,with_hamcrest=yes)
2441 AC_ARG_WITH(perl-home,
2442     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2443         [If you have installed Perl 5 Distribution, on your system, please
2444          supply the path here. Note that this is not the location of the Perl
2445          binary but the location of the entire distribution.]),
2448 libo_FUZZ_ARG_WITH(doxygen,
2449     AS_HELP_STRING(
2450         [--with-doxygen=<absolute path to doxygen executable>],
2451         [Specifies the doxygen executable to use when generating ODK C/C++
2452          documentation. --without-doxygen disables generation of ODK C/C++
2453          documentation. Not relevant in the --disable-odk case.]),
2454 ,with_doxygen=yes)
2456 AC_ARG_WITH(visual-studio,
2457     AS_HELP_STRING([--with-visual-studio=<2019>],
2458         [Specify which Visual Studio version to use in case several are
2459          installed. Currently only 2019 (default) is supported.]),
2462 AC_ARG_WITH(windows-sdk,
2463     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10.0>],
2464         [Specify which Windows SDK, or "Windows Kit", version to use
2465          in case the one that came with the selected Visual Studio
2466          is not what you want for some reason. Note that not all compiler/SDK
2467          combinations are supported. The intent is that this option should not
2468          be needed.]),
2471 AC_ARG_WITH(lang,
2472     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2473         [Use this option to build LibreOffice with additional UI language support.
2474          English (US) is always included by default.
2475          Separate multiple languages with space.
2476          For all languages, use --with-lang=ALL.]),
2479 AC_ARG_WITH(locales,
2480     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2481         [Use this option to limit the locale information built in.
2482          Separate multiple locales with space.
2483          Very experimental and might well break stuff.
2484          Just a desperate measure to shrink code and data size.
2485          By default all the locales available is included.
2486          This option is completely unrelated to --with-lang.])
2487     [
2488                           Affects also our character encoding conversion
2489                           tables for encodings mainly targeted for a
2490                           particular locale, like EUC-CN and EUC-TW for
2491                           zh, ISO-2022-JP for ja.
2493                           Affects also our add-on break iterator data for
2494                           some languages.
2496                           For the default, all locales, don't use this switch at all.
2497                           Specifying just the language part of a locale means all matching
2498                           locales will be included.
2499     ],
2502 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2503 libo_FUZZ_ARG_WITH(krb5,
2504     AS_HELP_STRING([--with-krb5],
2505         [Enable MIT Kerberos 5 support in modules that support it.
2506          By default automatically enabled on platforms
2507          where a good system Kerberos 5 is available.]),
2510 libo_FUZZ_ARG_WITH(gssapi,
2511     AS_HELP_STRING([--with-gssapi],
2512         [Enable GSSAPI support in modules that support it.
2513          By default automatically enabled on platforms
2514          where a good system GSSAPI is available.]),
2517 AC_ARG_WITH(iwyu,
2518     AS_HELP_STRING([--with-iwyu],
2519         [Use given IWYU binary path to check unneeded includes instead of building.
2520          Use only if you are hacking on it.]),
2523 libo_FUZZ_ARG_WITH(lxml,
2524     AS_HELP_STRING([--without-lxml],
2525         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2526          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2527          report widget classes and ids.]),
2530 libo_FUZZ_ARG_WITH(latest-c++,
2531     AS_HELP_STRING([--with-latest-c++],
2532         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2533          published standard.]),,
2534         [with_latest_c__=no])
2536 dnl ===================================================================
2537 dnl Branding
2538 dnl ===================================================================
2540 AC_ARG_WITH(branding,
2541     AS_HELP_STRING([--with-branding=/path/to/images],
2542         [Use given path to retrieve branding images set.])
2543     [
2544                           Search for intro.png about.svg and logo.svg.
2545                           If any is missing, default ones will be used instead.
2547                           Search also progress.conf for progress
2548                           settings on intro screen :
2550                           PROGRESSBARCOLOR="255,255,255" Set color of
2551                           progress bar. Comma separated RGB decimal values.
2552                           PROGRESSSIZE="407,6" Set size of progress bar.
2553                           Comma separated decimal values (width, height).
2554                           PROGRESSPOSITION="61,317" Set position of progress
2555                           bar from left,top. Comma separated decimal values.
2556                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2557                           bar frame. Comma separated RGB decimal values.
2558                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2559                           bar text. Comma separated RGB decimal values.
2560                           PROGRESSTEXTBASELINE="287" Set vertical position of
2561                           progress bar text from top. Decimal value.
2563                           Default values will be used if not found.
2564     ],
2568 AC_ARG_WITH(extra-buildid,
2569     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2570         [Show addition build identification in about dialog.]),
2574 AC_ARG_WITH(vendor,
2575     AS_HELP_STRING([--with-vendor="John the Builder"],
2576         [Set vendor of the build.]),
2579 AC_ARG_WITH(privacy-policy-url,
2580     AS_HELP_STRING([--with-privacy-policy-url="https://yourdomain/privacy-policy"],
2581         [The URL to your privacy policy (needed when
2582          enabling online-update or crashreporting via breakpad)]),
2583         [if test "x$with_privacy_policy_url" = "xyes"; then
2584             AC_MSG_FAILURE([you need to specify an argument when using --with-privacy-policy-url])
2585          elif test "x$with_privacy_policy_url" = "xno"; then
2586             with_privacy_policy_url="undefined"
2587          fi]
2588 ,[with_privacy_policy_url="undefined"])
2590 AC_ARG_WITH(android-package-name,
2591     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2592         [Set Android package name of the build.]),
2595 AC_ARG_WITH(compat-oowrappers,
2596     AS_HELP_STRING([--with-compat-oowrappers],
2597         [Install oo* wrappers in parallel with
2598          lo* ones to keep backward compatibility.
2599          Has effect only with make distro-pack-install]),
2602 AC_ARG_WITH(os-version,
2603     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2604         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2607 AC_ARG_WITH(idlc-cpp,
2608     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2609         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2612 AC_ARG_WITH(parallelism,
2613     AS_HELP_STRING([--with-parallelism],
2614         [Number of jobs to run simultaneously during build. Parallel builds can
2615         save a lot of time on multi-cpu machines. Defaults to the number of
2616         CPUs on the machine, unless you configure --enable-icecream - then to
2617         40.]),
2620 AC_ARG_WITH(all-tarballs,
2621     AS_HELP_STRING([--with-all-tarballs],
2622         [Download all external tarballs unconditionally]))
2624 AC_ARG_WITH(gdrive-client-id,
2625     AS_HELP_STRING([--with-gdrive-client-id],
2626         [Provides the client id of the application for OAuth2 authentication
2627         on Google Drive. If either this or --with-gdrive-client-secret is
2628         empty, the feature will be disabled]),
2631 AC_ARG_WITH(gdrive-client-secret,
2632     AS_HELP_STRING([--with-gdrive-client-secret],
2633         [Provides the client secret of the application for OAuth2
2634         authentication on Google Drive. If either this or
2635         --with-gdrive-client-id is empty, the feature will be disabled]),
2638 AC_ARG_WITH(alfresco-cloud-client-id,
2639     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2640         [Provides the client id of the application for OAuth2 authentication
2641         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2642         empty, the feature will be disabled]),
2645 AC_ARG_WITH(alfresco-cloud-client-secret,
2646     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2647         [Provides the client secret of the application for OAuth2
2648         authentication on Alfresco Cloud. If either this or
2649         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2652 AC_ARG_WITH(onedrive-client-id,
2653     AS_HELP_STRING([--with-onedrive-client-id],
2654         [Provides the client id of the application for OAuth2 authentication
2655         on OneDrive. If either this or --with-onedrive-client-secret is
2656         empty, the feature will be disabled]),
2659 AC_ARG_WITH(onedrive-client-secret,
2660     AS_HELP_STRING([--with-onedrive-client-secret],
2661         [Provides the client secret of the application for OAuth2
2662         authentication on OneDrive. If either this or
2663         --with-onedrive-client-id is empty, the feature will be disabled]),
2665 dnl ===================================================================
2666 dnl Do we want to use pre-build binary tarball for recompile
2667 dnl ===================================================================
2669 if test "$enable_library_bin_tar" = "yes" ; then
2670     USE_LIBRARY_BIN_TAR=TRUE
2671 else
2672     USE_LIBRARY_BIN_TAR=
2674 AC_SUBST(USE_LIBRARY_BIN_TAR)
2676 dnl ===================================================================
2677 dnl Test whether build target is Release Build
2678 dnl ===================================================================
2679 AC_MSG_CHECKING([whether build target is Release Build])
2680 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2681     AC_MSG_RESULT([no])
2682     ENABLE_RELEASE_BUILD=
2683     GET_TASK_ALLOW_ENTITLEMENT='
2684         <!-- We want to be able to debug a hardened process when not building for release -->
2685         <key>com.apple.security.get-task-allow</key>
2686         <true/>'
2687 else
2688     AC_MSG_RESULT([yes])
2689     ENABLE_RELEASE_BUILD=TRUE
2690     GET_TASK_ALLOW_ENTITLEMENT=''
2692 AC_SUBST(ENABLE_RELEASE_BUILD)
2693 AC_SUBST(GET_TASK_ALLOW_ENTITLEMENT)
2695 AC_MSG_CHECKING([whether to build a Community flavor])
2696 if test -z "$enable_community_flavor" -o "$enable_community_flavor" = "yes"; then
2697     AC_DEFINE(HAVE_FEATURE_COMMUNITY_FLAVOR)
2698     AC_MSG_RESULT([yes])
2699 else
2700     AC_MSG_RESULT([no])
2703 dnl ===================================================================
2704 dnl Test whether to sign Windows Build
2705 dnl ===================================================================
2706 AC_MSG_CHECKING([whether to sign windows build])
2707 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2708     AC_MSG_RESULT([yes])
2709     WINDOWS_BUILD_SIGNING="TRUE"
2710 else
2711     AC_MSG_RESULT([no])
2712     WINDOWS_BUILD_SIGNING="FALSE"
2714 AC_SUBST(WINDOWS_BUILD_SIGNING)
2716 dnl ===================================================================
2717 dnl MacOSX build and runtime environment options
2718 dnl ===================================================================
2720 AC_ARG_WITH(macosx-sdk,
2721     AS_HELP_STRING([--with-macosx-sdk=<version>],
2722         [Prefer a specific SDK for building.])
2723     [
2724                           If the requested SDK is not available, a search for the oldest one will be done.
2725                           With current Xcode versions, only the latest SDK is included, so this option is
2726                           not terribly useful. It works fine to build with a new SDK and run the result
2727                           on an older OS.
2729                           e. g.: --with-macosx-sdk=10.10
2731                           there are 3 options to control the MacOSX build:
2732                           --with-macosx-sdk (referred as 'sdk' below)
2733                           --with-macosx-version-min-required (referred as 'min' below)
2734                           --with-macosx-version-max-allowed (referred as 'max' below)
2736                           the connection between these value and the default they take is as follow:
2737                           ( ? means not specified on the command line, s means the SDK version found,
2738                           constraint: 8 <= x <= y <= z)
2740                           ==========================================
2741                            command line      || config result
2742                           ==========================================
2743                           min  | max  | sdk  || min   | max  | sdk  |
2744                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2745                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2746                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2747                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2748                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2749                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2750                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2751                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2754                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2755                           for a detailed technical explanation of these variables
2757                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2758     ],
2761 AC_ARG_WITH(macosx-version-min-required,
2762     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2763         [set the minimum OS version needed to run the built LibreOffice])
2764     [
2765                           e. g.: --with-macosx-version-min-required=10.10
2766                           see --with-macosx-sdk for more info
2767     ],
2770 AC_ARG_WITH(macosx-version-max-allowed,
2771     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2772         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2773     [
2774                           e. g.: --with-macosx-version-max-allowed=10.10
2775                           see --with-macosx-sdk for more info
2776     ],
2780 dnl ===================================================================
2781 dnl options for stuff used during cross-compilation build
2782 dnl Not quite superseded by --with-build-platform-configure-options.
2783 dnl TODO: check, if the "force" option is still needed anywhere.
2784 dnl ===================================================================
2786 AC_ARG_WITH(system-icu-for-build,
2787     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2788         [Use icu already on system for build tools (cross-compilation only).]))
2791 dnl ===================================================================
2792 dnl Check for incompatible options set by fuzzing, and reset those
2793 dnl automatically to working combinations
2794 dnl ===================================================================
2796 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2797         "$enable_dbus" != "$enable_avahi"; then
2798     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2799     enable_avahi=$enable_dbus
2802 add_lopath_after ()
2804     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2805         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2806     fi
2809 add_lopath_before ()
2811     local IFS=${P_SEP}
2812     local path_cleanup
2813     local dir
2814     for dir in $LO_PATH ; do
2815         if test "$dir" != "$1" ; then
2816             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2817         fi
2818     done
2819     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2822 dnl ===================================================================
2823 dnl check for required programs (grep, awk, sed, bash)
2824 dnl ===================================================================
2826 pathmunge ()
2828     local new_path
2829     if test -n "$1"; then
2830         if test "$build_os" = "cygwin"; then
2831             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2832                 PathFormat "$1"
2833                 new_path=`cygpath -sm "$formatted_path"`
2834             else
2835                 PathFormat "$1"
2836                 new_path=`cygpath -u "$formatted_path"`
2837             fi
2838         else
2839             new_path="$1"
2840         fi
2841         if test "$2" = "after"; then
2842             add_lopath_after "$new_path"
2843         else
2844             add_lopath_before "$new_path"
2845         fi
2846     fi
2849 AC_PROG_AWK
2850 AC_PATH_PROG( AWK, $AWK)
2851 if test -z "$AWK"; then
2852     AC_MSG_ERROR([install awk to run this script])
2855 AC_PATH_PROG(BASH, bash)
2856 if test -z "$BASH"; then
2857     AC_MSG_ERROR([bash not found in \$PATH])
2859 AC_SUBST(BASH)
2861 AC_MSG_CHECKING([for GNU or BSD tar])
2862 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2863     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2864     if test $? -eq 0;  then
2865         GNUTAR=$a
2866         break
2867     fi
2868 done
2869 AC_MSG_RESULT($GNUTAR)
2870 if test -z "$GNUTAR"; then
2871     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2873 AC_SUBST(GNUTAR)
2875 AC_MSG_CHECKING([for tar's option to strip components])
2876 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2877 if test $? -eq 0; then
2878     STRIP_COMPONENTS="--strip-components"
2879 else
2880     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2881     if test $? -eq 0; then
2882         STRIP_COMPONENTS="--strip-path"
2883     else
2884         STRIP_COMPONENTS="unsupported"
2885     fi
2887 AC_MSG_RESULT($STRIP_COMPONENTS)
2888 if test x$STRIP_COMPONENTS = xunsupported; then
2889     AC_MSG_ERROR([you need a tar that is able to strip components.])
2891 AC_SUBST(STRIP_COMPONENTS)
2893 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2894 dnl desktop OSes from "mobile" ones.
2896 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2897 dnl In other words, that when building for an OS that is not a
2898 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2900 dnl Note the direction of the implication; there is no assumption that
2901 dnl cross-compiling would imply a non-desktop OS.
2903 if test $_os != iOS -a $_os != Android -a $_os != Emscripten -a "$enable_fuzzers" != "yes"; then
2904     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2905     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2906     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2909 # Whether to build "avmedia" functionality or not.
2911 if test -z "$enable_avmedia"; then
2912     enable_avmedia=yes
2915 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2916 if test "$enable_avmedia" = yes; then
2917     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2918 else
2919     USE_AVMEDIA_DUMMY='TRUE'
2921 AC_SUBST(USE_AVMEDIA_DUMMY)
2923 # Decide whether to build database connectivity stuff (including
2924 # Base) or not. We probably don't want to on non-desktop OSes.
2925 if test -z "$enable_database_connectivity"; then
2926     # --disable-database-connectivity is unfinished work in progress
2927     # and the iOS test app doesn't link if we actually try to use it.
2928     # if test $_os != iOS -a $_os != Android; then
2929     if test $_os != iOS; then
2930         enable_database_connectivity=yes
2931     fi
2934 if test "$enable_database_connectivity" = yes; then
2935     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2936     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2939 if test -z "$enable_extensions"; then
2940     # For iOS and Android Viewer, disable extensions unless specifically overridden with --enable-extensions.
2941     if test $_os != iOS && test $_os != Android -o "$ENABLE_ANDROID_LOK" = TRUE ; then
2942         enable_extensions=yes
2943     fi
2946 if test "$enable_extensions" = yes; then
2947     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2948     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2951 if test -z "$enable_scripting"; then
2952     # Disable scripting for iOS unless specifically overridden
2953     # with --enable-scripting.
2954     if test $_os != iOS -o $_os = Emscripten; then
2955         enable_scripting=yes
2956     fi
2959 DISABLE_SCRIPTING=''
2960 if test "$enable_scripting" = yes; then
2961     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2962     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2963 else
2964     DISABLE_SCRIPTING='TRUE'
2965     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2968 if test $_os = iOS -o $_os = Android -o $_os = Emscripten; then
2969     # Disable dynamic_loading always for iOS and Android
2970     enable_dynamic_loading=no
2971 elif test -z "$enable_dynamic_loading"; then
2972     # Otherwise enable it unless specifically disabled
2973     enable_dynamic_loading=yes
2976 DISABLE_DYNLOADING=''
2977 if test "$enable_dynamic_loading" = yes; then
2978     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2979 else
2980     DISABLE_DYNLOADING='TRUE'
2982 AC_SUBST(DISABLE_DYNLOADING)
2984 # remember SYSBASE value
2985 AC_SUBST(SYSBASE)
2987 dnl ===================================================================
2988 dnl  Sort out various gallery compilation options
2989 dnl ===================================================================
2990 WITH_GALLERY_BUILD=TRUE
2991 AC_MSG_CHECKING([how to build and package galleries])
2992 if test -n "${with_galleries}"; then
2993     if test "$with_galleries" = "build"; then
2994         AC_MSG_RESULT([build from source images internally])
2995     elif test "$with_galleries" = "no"; then
2996         WITH_GALLERY_BUILD=
2997         AC_MSG_RESULT([disable non-internal gallery build])
2998     else
2999         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
3000     fi
3001 else
3002     if test $_os != iOS -a $_os != Android; then
3003         AC_MSG_RESULT([internal src images for desktop])
3004     else
3005         WITH_GALLERY_BUILD=
3006         AC_MSG_RESULT([disable src image build])
3007     fi
3009 AC_SUBST(WITH_GALLERY_BUILD)
3011 dnl ===================================================================
3012 dnl  Checks if ccache is available
3013 dnl ===================================================================
3014 CCACHE_DEPEND_MODE=
3015 if test "$enable_ccache" = "no"; then
3016     CCACHE=""
3017 elif test "$_os" = "WINNT"; then
3018     # on windows/VC build do not use ccache - but perhaps sccache is around?
3019     case "%$CC%$CXX%" in
3020     # If $CC and/or $CXX already contain "sccache" (possibly suffixed with some version number etc),
3021     # assume that's good then
3022     *%sccache[[-_' ']]*|*/sccache[[-_' ']]*)
3023         AC_MSG_NOTICE([sccache seems to be included in a pre-defined CC and/or CXX])
3024         CCACHE_DEPEND_MODE=1
3025         ;;
3026     *)
3027         # for sharing code below, reuse CCACHE env var
3028         AC_PATH_PROG([CCACHE],[sccache],[not found])
3029         if test "$CCACHE" = "not found"; then
3030             CCACHE=""
3031         else
3032             CCACHE=`win_short_path_for_make "$CCACHE"`
3033             CCACHE_DEPEND_MODE=1
3034         fi
3035         ;;
3036     esac
3037 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
3038     case "%$CC%$CXX%" in
3039     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
3040     # assume that's good then
3041     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
3042         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
3043         CCACHE_DEPEND_MODE=1
3044         ;;
3045     *)
3046         AC_PATH_PROG([CCACHE],[ccache],[not found])
3047         if test "$CCACHE" = "not found"; then
3048             CCACHE=""
3049         else
3050             CCACHE_DEPEND_MODE=1
3051             # Need to check for ccache version: otherwise prevents
3052             # caching of the results (like "-x objective-c++" for Mac)
3053             if test $_os = Darwin -o $_os = iOS; then
3054                 # Check ccache version
3055                 AC_MSG_CHECKING([whether version of ccache is suitable])
3056                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
3057                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
3058                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
3059                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
3060                 else
3061                     AC_MSG_RESULT([no, $CCACHE_VERSION])
3062                     CCACHE=""
3063                     CCACHE_DEPEND_MODE=
3064                 fi
3065             fi
3066         fi
3067         ;;
3068     esac
3069 else
3070     CCACHE=""
3072 if test "$enable_ccache" = "nodepend"; then
3073     CCACHE_DEPEND_MODE=""
3075 AC_SUBST(CCACHE_DEPEND_MODE)
3077 # skip on windows - sccache defaults are good enough
3078 if test "$CCACHE" != "" -a "$_os" != "WINNT"; then
3079     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
3080     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
3081     if test "$ccache_size" = ""; then
3082         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
3083         if test "$ccache_size" = ""; then
3084             ccache_size=0
3085         fi
3086         # we could not determine the size or it was less than 1GB -> disable auto-ccache
3087         if test $ccache_size -lt 1024; then
3088             CCACHE=""
3089             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
3090             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
3091         else
3092             # warn that ccache may be too small for debug build
3093             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3094             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3095         fi
3096     else
3097         if test $ccache_size -lt 5; then
3098             #warn that ccache may be too small for debug build
3099             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3100             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3101         fi
3102     fi
3105 dnl ===================================================================
3106 dnl  Checks for C compiler,
3107 dnl  The check for the C++ compiler is later on.
3108 dnl ===================================================================
3109 if test "$_os" != "WINNT"; then
3110     GCC_HOME_SET="true"
3111     AC_MSG_CHECKING([gcc home])
3112     if test -z "$with_gcc_home"; then
3113         if test "$enable_icecream" = "yes"; then
3114             if test -d "/usr/lib/icecc/bin"; then
3115                 GCC_HOME="/usr/lib/icecc/"
3116             elif test -d "/usr/libexec/icecc/bin"; then
3117                 GCC_HOME="/usr/libexec/icecc/"
3118             elif test -d "/opt/icecream/bin"; then
3119                 GCC_HOME="/opt/icecream/"
3120             else
3121                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
3123             fi
3124         else
3125             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
3126             GCC_HOME_SET="false"
3127         fi
3128     else
3129         GCC_HOME="$with_gcc_home"
3130     fi
3131     AC_MSG_RESULT($GCC_HOME)
3132     AC_SUBST(GCC_HOME)
3134     if test "$GCC_HOME_SET" = "true"; then
3135         if test -z "$CC"; then
3136             CC="$GCC_HOME/bin/gcc"
3137             CC_BASE="gcc"
3138         fi
3139         if test -z "$CXX"; then
3140             CXX="$GCC_HOME/bin/g++"
3141             CXX_BASE="g++"
3142         fi
3143     fi
3146 COMPATH=`dirname "$CC"`
3147 if test "$COMPATH" = "."; then
3148     AC_PATH_PROGS(COMPATH, $CC)
3149     dnl double square bracket to get single because of M4 quote...
3150     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
3152 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
3154 dnl ===================================================================
3155 dnl Java support
3156 dnl ===================================================================
3157 AC_MSG_CHECKING([whether to build with Java support])
3158 if test "$with_java" != "no"; then
3159     if test "$DISABLE_SCRIPTING" = TRUE; then
3160         AC_MSG_RESULT([no, overridden by --disable-scripting])
3161         ENABLE_JAVA=""
3162         with_java=no
3163     else
3164         AC_MSG_RESULT([yes])
3165         ENABLE_JAVA="TRUE"
3166         AC_DEFINE(HAVE_FEATURE_JAVA)
3167     fi
3168 else
3169     AC_MSG_RESULT([no])
3170     ENABLE_JAVA=""
3173 AC_SUBST(ENABLE_JAVA)
3175 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
3177 dnl ENABLE_JAVA="" indicate no Java support at all
3179 dnl ===================================================================
3180 dnl Check macOS SDK and compiler
3181 dnl ===================================================================
3183 if test $_os = Darwin; then
3185     # If no --with-macosx-sdk option is given, look for one
3187     # The intent is that for "most" Mac-based developers, a suitable
3188     # SDK will be found automatically without any configure options.
3190     # For developers with a current Xcode, the lowest-numbered SDK
3191     # higher than or equal to the minimum required should be found.
3193     AC_MSG_CHECKING([what macOS SDK to use])
3194     for _macosx_sdk in ${with_macosx_sdk-11.3 11.1 11.0 10.15 10.14 10.13}; do
3195         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
3196         if test -d "$MACOSX_SDK_PATH"; then
3197             with_macosx_sdk="${_macosx_sdk}"
3198             break
3199         else
3200             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
3201             if test -d "$MACOSX_SDK_PATH"; then
3202                 with_macosx_sdk="${_macosx_sdk}"
3203                 break
3204             fi
3205         fi
3206     done
3207     if test ! -d "$MACOSX_SDK_PATH"; then
3208         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
3209     fi
3211     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
3213     case $with_macosx_sdk in
3214     10.13)
3215         MACOSX_SDK_VERSION=101300
3216         ;;
3217     10.14)
3218         MACOSX_SDK_VERSION=101400
3219         ;;
3220     10.15)
3221         MACOSX_SDK_VERSION=101500
3222         ;;
3223     11.0)
3224         MACOSX_SDK_VERSION=110000
3225         ;;
3226     11.1)
3227         MACOSX_SDK_VERSION=110100
3228         ;;
3229     11.3)
3230         MACOSX_SDK_VERSION=110300
3231         ;;
3232     *)
3233         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.13--11.3])
3234         ;;
3235     esac
3237     if test "$host_cpu" = arm64 -a $MACOSX_SDK_VERSION -lt 110000; then
3238         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value for Apple Silicon])
3239     fi
3241     if test "$with_macosx_version_min_required" = "" ; then
3242         if test "$host_cpu" = x86_64; then
3243             with_macosx_version_min_required="10.10";
3244         else
3245             with_macosx_version_min_required="11.0";
3246         fi
3247     fi
3249     if test "$with_macosx_version_max_allowed" = "" ; then
3250         with_macosx_version_max_allowed="$with_macosx_sdk"
3251     fi
3253     # export this so that "xcrun" invocations later return matching values
3254     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
3255     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
3256     export DEVELOPER_DIR
3257     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
3258     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
3260     AC_MSG_CHECKING([whether Xcode is new enough])
3261     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
3262     my_xcode_ver2=${my_xcode_ver1#Xcode }
3263     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
3264     if test "$my_xcode_ver3" -ge 1103; then
3265         AC_MSG_RESULT([yes ($my_xcode_ver2)])
3266     else
3267         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 11.3])
3268     fi
3270     case "$with_macosx_version_min_required" in
3271     10.10)
3272         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
3273         ;;
3274     10.11)
3275         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
3276         ;;
3277     10.12)
3278         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
3279         ;;
3280     10.13)
3281         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
3282         ;;
3283     10.14)
3284         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
3285         ;;
3286     10.15)
3287         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
3288         ;;
3289     10.16)
3290         MAC_OS_X_VERSION_MIN_REQUIRED="101600"
3291         ;;
3292     11.0)
3293         MAC_OS_X_VERSION_MIN_REQUIRED="110000"
3294         ;;
3295     11.1)
3296         MAC_OS_X_VERSION_MIN_REQUIRED="110100"
3297         ;;
3298     11.3)
3299         MAC_OS_X_VERSION_MIN_REQUIRED="110300"
3300         ;;
3301     *)
3302         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--11.3])
3303         ;;
3304     esac
3306     LIBTOOL=/usr/bin/libtool
3307     INSTALL_NAME_TOOL=install_name_tool
3308     if test -z "$save_CC"; then
3309         stdlib=-stdlib=libc++
3311         AC_MSG_CHECKING([what C compiler to use])
3312         CC="`xcrun -find clang`"
3313         CC_BASE=`first_arg_basename "$CC"`
3314         if test "$host_cpu" = x86_64; then
3315             CC+=" -target x86_64-apple-macos"
3316         else
3317             CC+=" -target arm64-apple-macos"
3318         fi
3319         CC+=" -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3320         AC_MSG_RESULT([$CC])
3322         AC_MSG_CHECKING([what C++ compiler to use])
3323         CXX="`xcrun -find clang++`"
3324         CXX_BASE=`first_arg_basename "$CXX"`
3325         if test "$host_cpu" = x86_64; then
3326             CXX+=" -target x86_64-apple-macos"
3327         else
3328             CXX+=" -target arm64-apple-macos"
3329         fi
3330         CXX+=" $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3331         AC_MSG_RESULT([$CXX])
3333         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3334         AR=`xcrun -find ar`
3335         NM=`xcrun -find nm`
3336         STRIP=`xcrun -find strip`
3337         LIBTOOL=`xcrun -find libtool`
3338         RANLIB=`xcrun -find ranlib`
3339     fi
3341     case "$with_macosx_version_max_allowed" in
3342     10.10)
3343         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
3344         ;;
3345     10.11)
3346         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
3347         ;;
3348     10.12)
3349         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
3350         ;;
3351     10.13)
3352         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
3353         ;;
3354     10.14)
3355         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
3356         ;;
3357     10.15)
3358         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
3359         ;;
3360     11.0)
3361         MAC_OS_X_VERSION_MAX_ALLOWED="110000"
3362         ;;
3363     11.1)
3364         MAC_OS_X_VERSION_MAX_ALLOWED="110100"
3365         ;;
3366     11.3)
3367         MAC_OS_X_VERSION_MAX_ALLOWED="110300"
3368         ;;
3369     *)
3370         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--11.3])
3371         ;;
3372     esac
3374     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
3375     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
3376         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])
3377     else
3378         AC_MSG_RESULT([ok])
3379     fi
3381     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
3382     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
3383         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
3384     else
3385         AC_MSG_RESULT([ok])
3386     fi
3387     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
3388     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
3390     AC_MSG_CHECKING([whether to do code signing])
3392     if test "$enable_macosx_code_signing" = yes; then
3393         # By default use the first suitable certificate (?).
3395         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
3396         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
3397         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
3398         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
3399         # "Developer ID Application" one.
3401         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
3402         if test -n "$identity"; then
3403             MACOSX_CODESIGNING_IDENTITY=$identity
3404             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3405             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3406         else
3407             AC_MSG_ERROR([cannot determine identity to use])
3408         fi
3409     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
3410         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
3411         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3412         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3413     else
3414         AC_MSG_RESULT([no])
3415     fi
3417     AC_MSG_CHECKING([whether to create a Mac App Store package])
3419     if test -z "$enable_macosx_package_signing" || test "$enable_macosx_package_signing" == no; then
3420         AC_MSG_RESULT([no])
3421     elif test -z "$MACOSX_CODESIGNING_IDENTITY"; then
3422         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3423     elif test "$enable_macosx_package_signing" = yes; then
3424         # By default use the first suitable certificate.
3425         # It should be a "3rd Party Mac Developer Installer" one
3427         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
3428         if test -n "$identity"; then
3429             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3430             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3431             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3432         else
3433             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3434         fi
3435     else
3436         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
3437         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3438         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3439     fi
3441     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3442         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3443     fi
3445     AC_MSG_CHECKING([whether to sandbox the application])
3447     if test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3448         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3449     elif test "$enable_macosx_sandbox" = yes; then
3450         ENABLE_MACOSX_SANDBOX=TRUE
3451         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3452         AC_MSG_RESULT([yes])
3453     else
3454         AC_MSG_RESULT([no])
3455     fi
3457     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3458     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3459     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3461 AC_SUBST(MACOSX_SDK_PATH)
3462 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3463 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3464 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3465 AC_SUBST(INSTALL_NAME_TOOL)
3466 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3467 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3468 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3469 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3470 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3472 dnl ===================================================================
3473 dnl Check iOS SDK and compiler
3474 dnl ===================================================================
3476 if test $_os = iOS; then
3477     AC_MSG_CHECKING([what iOS SDK to use])
3478     current_sdk_ver=14.5
3479     older_sdk_vers="14.4 14.3 14.2 14.1 14.0 13.7"
3480     if test "$enable_ios_simulator" = "yes"; then
3481         platform=iPhoneSimulator
3482         versionmin=-mios-simulator-version-min=12.2
3483     else
3484         platform=iPhoneOS
3485         versionmin=-miphoneos-version-min=12.2
3486     fi
3487     xcode_developer=`xcode-select -print-path`
3489     for sdkver in $current_sdk_ver $older_sdk_vers; do
3490         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3491         if test -d $t; then
3492             sysroot=$t
3493             break
3494         fi
3495     done
3497     if test -z "$sysroot"; then
3498         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3499     fi
3501     AC_MSG_RESULT($sysroot)
3503     stdlib="-stdlib=libc++"
3505     AC_MSG_CHECKING([what C compiler to use])
3506     CC="`xcrun -find clang`"
3507     CC_BASE=`first_arg_basename "$CC"`
3508     CC+=" -arch $host_cpu_for_clang -isysroot $sysroot $versionmin"
3509     AC_MSG_RESULT([$CC])
3511     AC_MSG_CHECKING([what C++ compiler to use])
3512     CXX="`xcrun -find clang++`"
3513     CXX_BASE=`first_arg_basename "$CXX"`
3514     CXX+=" -arch $host_cpu_for_clang $stdlib -isysroot $sysroot $versionmin"
3515     AC_MSG_RESULT([$CXX])
3517     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3518     AR=`xcrun -find ar`
3519     NM=`xcrun -find nm`
3520     STRIP=`xcrun -find strip`
3521     LIBTOOL=`xcrun -find libtool`
3522     RANLIB=`xcrun -find ranlib`
3525 AC_MSG_CHECKING([whether to treat the installation as read-only])
3527 if test $_os = Darwin; then
3528     enable_readonly_installset=yes
3529 elif test "$enable_extensions" != yes; then
3530     enable_readonly_installset=yes
3532 if test "$enable_readonly_installset" = yes; then
3533     AC_MSG_RESULT([yes])
3534     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3535 else
3536     AC_MSG_RESULT([no])
3539 dnl ===================================================================
3540 dnl Structure of install set
3541 dnl ===================================================================
3543 if test $_os = Darwin; then
3544     LIBO_BIN_FOLDER=MacOS
3545     LIBO_ETC_FOLDER=Resources
3546     LIBO_LIBEXEC_FOLDER=MacOS
3547     LIBO_LIB_FOLDER=Frameworks
3548     LIBO_LIB_PYUNO_FOLDER=Resources
3549     LIBO_SHARE_FOLDER=Resources
3550     LIBO_SHARE_HELP_FOLDER=Resources/help
3551     LIBO_SHARE_JAVA_FOLDER=Resources/java
3552     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3553     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3554     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3555     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3556     LIBO_URE_BIN_FOLDER=MacOS
3557     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3558     LIBO_URE_LIB_FOLDER=Frameworks
3559     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3560     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3561 elif test $_os = WINNT; then
3562     LIBO_BIN_FOLDER=program
3563     LIBO_ETC_FOLDER=program
3564     LIBO_LIBEXEC_FOLDER=program
3565     LIBO_LIB_FOLDER=program
3566     LIBO_LIB_PYUNO_FOLDER=program
3567     LIBO_SHARE_FOLDER=share
3568     LIBO_SHARE_HELP_FOLDER=help
3569     LIBO_SHARE_JAVA_FOLDER=program/classes
3570     LIBO_SHARE_PRESETS_FOLDER=presets
3571     LIBO_SHARE_READMES_FOLDER=readmes
3572     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3573     LIBO_SHARE_SHELL_FOLDER=program/shell
3574     LIBO_URE_BIN_FOLDER=program
3575     LIBO_URE_ETC_FOLDER=program
3576     LIBO_URE_LIB_FOLDER=program
3577     LIBO_URE_MISC_FOLDER=program
3578     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3579 else
3580     LIBO_BIN_FOLDER=program
3581     LIBO_ETC_FOLDER=program
3582     LIBO_LIBEXEC_FOLDER=program
3583     LIBO_LIB_FOLDER=program
3584     LIBO_LIB_PYUNO_FOLDER=program
3585     LIBO_SHARE_FOLDER=share
3586     LIBO_SHARE_HELP_FOLDER=help
3587     LIBO_SHARE_JAVA_FOLDER=program/classes
3588     LIBO_SHARE_PRESETS_FOLDER=presets
3589     LIBO_SHARE_READMES_FOLDER=readmes
3590     if test "$enable_fuzzers" != yes; then
3591         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3592     else
3593         LIBO_SHARE_RESOURCE_FOLDER=resource
3594     fi
3595     LIBO_SHARE_SHELL_FOLDER=program/shell
3596     LIBO_URE_BIN_FOLDER=program
3597     LIBO_URE_ETC_FOLDER=program
3598     LIBO_URE_LIB_FOLDER=program
3599     LIBO_URE_MISC_FOLDER=program
3600     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3602 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3603 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3604 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3605 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3606 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3607 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3608 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3609 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3610 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3611 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3612 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3613 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3614 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3615 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3616 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3617 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3619 # Not all of them needed in config_host.mk, add more if need arises
3620 AC_SUBST(LIBO_BIN_FOLDER)
3621 AC_SUBST(LIBO_ETC_FOLDER)
3622 AC_SUBST(LIBO_LIB_FOLDER)
3623 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3624 AC_SUBST(LIBO_SHARE_FOLDER)
3625 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3626 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3627 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3628 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3629 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3630 AC_SUBST(LIBO_URE_BIN_FOLDER)
3631 AC_SUBST(LIBO_URE_ETC_FOLDER)
3632 AC_SUBST(LIBO_URE_LIB_FOLDER)
3633 AC_SUBST(LIBO_URE_MISC_FOLDER)
3634 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3636 dnl ===================================================================
3637 dnl Windows specific tests and stuff
3638 dnl ===================================================================
3640 reg_get_value()
3642     # Return value: $regvalue
3643     unset regvalue
3645     if test "$build_os" = "wsl"; then
3646         regvalue=$($BUILDDIR/solenv/wsl/wsl-lo-helper.exe --read-registry $1 "$2" 2>/dev/null)
3647         return
3648     fi
3650     local _regentry="/proc/registry${1}/${2}"
3651     if test -f "$_regentry"; then
3652         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3653         # Registry keys read via /proc/registry* are always \0 terminated!
3654         local _regvalue=$(tr -d '\0' < "$_regentry")
3655         if test $? -eq 0; then
3656             regvalue=$_regvalue
3657         fi
3658     fi
3661 # Get a value from the 32-bit side of the Registry
3662 reg_get_value_32()
3664     reg_get_value "32" "$1"
3667 # Get a value from the 64-bit side of the Registry
3668 reg_get_value_64()
3670     reg_get_value "64" "$1"
3673 case "$host_os" in
3674 cygwin*|wsl*)
3675     COM=MSC
3676     USING_X11=
3677     OS=WNT
3678     RTL_OS=Windows
3679     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3680         P_SEP=";"
3681     else
3682         P_SEP=:
3683     fi
3684     case "$host_cpu" in
3685     x86_64)
3686         CPUNAME=X86_64
3687         RTL_ARCH=X86_64
3688         PLATFORMID=windows_x86_64
3689         WINDOWS_X64=1
3690         SCPDEFS="$SCPDEFS -DWINDOWS_X64"
3691         WIN_HOST_ARCH="x64"
3692         WIN_MULTI_ARCH="x86"
3693         WIN_HOST_BITS=64
3694         ;;
3695     i*86)
3696         CPUNAME=INTEL
3697         RTL_ARCH=x86
3698         PLATFORMID=windows_x86
3699         WIN_HOST_ARCH="x86"
3700         WIN_HOST_BITS=32
3701         WIN_OTHER_ARCH="x64"
3702         ;;
3703     aarch64)
3704         CPUNAME=AARCH64
3705         RTL_ARCH=AARCH64
3706         PLATFORMID=windows_aarch64
3707         WINDOWS_X64=1
3708         SCPDEFS="$SCPDEFS -DWINDOWS_AARCH64"
3709         WIN_HOST_ARCH="arm64"
3710         WIN_HOST_BITS=64
3711         with_ucrt_dir=no
3712         ;;
3713     *)
3714         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3715         ;;
3716     esac
3718     case "$build_cpu" in
3719     x86_64) WIN_BUILD_ARCH="x64" ;;
3720     i*86) WIN_BUILD_ARCH="x86" ;;
3721     aarch64) WIN_BUILD_ARCH="arm64" ;;
3722     *)
3723         AC_MSG_ERROR([Unsupported build_cpu $build_cpu for host_os $host_os])
3724         ;;
3725     esac
3727     SCPDEFS="$SCPDEFS -D_MSC_VER"
3728     ;;
3729 esac
3731 # multi-arch is an arch, which can execute on the host (x86 on x64), while
3732 # other-arch won't, but wouldn't break the build (x64 on x86).
3733 if test -n "$WIN_MULTI_ARCH" -a -n "$WIN_OTHER_ARCH"; then
3734     AC_MSG_ERROR([Broken configure.ac file: can't have set \$WIN_MULTI_ARCH and $WIN_OTHER_ARCH])
3738 if test "$_os" = "iOS" -o "$build_cpu" != "$host_cpu"; then
3739     # To allow building Windows multi-arch releases without cross-tooling
3740     if test -z "$WIN_MULTI_ARCH" -a -z "$WIN_OTHER_ARCH"; then
3741         cross_compiling="yes"
3742     fi
3745 ENABLE_WASM_STRIP=''
3746 if test "$cross_compiling" = "yes"; then
3747     export CROSS_COMPILING=TRUE
3748     if test "$enable_dynamic_loading" != yes -a "$enable_wasm_strip" = yes; then
3749         ENABLE_WASM_STRIP=TRUE
3750     fi
3751 else
3752     CROSS_COMPILING=
3753     BUILD_TYPE="$BUILD_TYPE NATIVE"
3755 AC_SUBST(CROSS_COMPILING)
3756 AC_SUBST(ENABLE_WASM_STRIP)
3758 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3759 # NOTE: must _not_ be used for bundled external libraries!
3760 ISYSTEM=
3761 if test "$GCC" = "yes"; then
3762     AC_MSG_CHECKING( for -isystem )
3763     save_CFLAGS=$CFLAGS
3764     CFLAGS="$CFLAGS -Werror"
3765     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3766     CFLAGS=$save_CFLAGS
3767     if test -n "$ISYSTEM"; then
3768         AC_MSG_RESULT(yes)
3769     else
3770         AC_MSG_RESULT(no)
3771     fi
3773 if test -z "$ISYSTEM"; then
3774     # fall back to using -I
3775     ISYSTEM=-I
3777 AC_SUBST(ISYSTEM)
3779 dnl ===================================================================
3780 dnl  Check which Visual Studio compiler is used
3781 dnl ===================================================================
3783 map_vs_year_to_version()
3785     # Return value: $vsversion
3787     unset vsversion
3789     case $1 in
3790     2019)
3791         vsversion=16;;
3792     *)
3793         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3794     esac
3797 vs_versions_to_check()
3799     # Args: $1 (optional) : versions to check, in the order of preference
3800     # Return value: $vsversions
3802     unset vsversions
3804     if test -n "$1"; then
3805         map_vs_year_to_version "$1"
3806         vsversions=$vsversion
3807     else
3808         # We accept only 2019
3809         vsversions="16"
3810     fi
3813 win_get_env_from_vsvars32bat()
3815     local WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3816     # Also seems to be located in another directory under the same name: vsvars32.bat
3817     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3818     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3819     # use 'echo.%ENV%' syntax (instead of 'echo %ENV%') to avoid outputting "ECHO is off." in case when ENV is empty or a space
3820     printf '@setlocal\r\n@echo.%%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3821     local result
3822     if test "$build_os" = "wsl"; then
3823         result=$(cd /mnt/c && cmd.exe /c $(wslpath -w $WRAPPERBATCHFILEPATH) | tr -d '\r')
3824     else
3825         chmod +x $WRAPPERBATCHFILEPATH
3826         result=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3827     fi
3828     rm -f $WRAPPERBATCHFILEPATH
3829     printf '%s' "$result"
3832 find_ucrt()
3834     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3835     if test -n "$regvalue"; then
3836         PathFormat "$regvalue"
3837         UCRTSDKDIR=$formatted_path_unix
3838         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3839         UCRTVERSION=$regvalue
3840         # Rest if not exist
3841         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3842           UCRTSDKDIR=
3843         fi
3844     fi
3845     if test -z "$UCRTSDKDIR"; then
3846         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3847         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3848         if test -f "$ide_env_file"; then
3849             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3850             UCRTSDKDIR=$formatted_path
3851             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3852             dnl Hack needed at least by tml:
3853             if test "$UCRTVERSION" = 10.0.15063.0 \
3854                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3855                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3856             then
3857                 UCRTVERSION=10.0.14393.0
3858             fi
3859         else
3860           AC_MSG_ERROR([No UCRT found])
3861         fi
3862     fi
3865 find_msvc()
3867     # Find Visual C++ 2019
3868     # Args: $1 (optional) : The VS version year
3869     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3871     unset vctest vcnum vcnumwithdot vcbuildnumber
3873     vs_versions_to_check "$1"
3874     if test "$build_os" = wsl; then
3875         vswhere="$PROGRAMFILESX86"
3876     else
3877         vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3878     fi
3879     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3880     PathFormat "$vswhere"
3881     vswhere=$formatted_path_unix
3882     for ver in $vsversions; do
3883         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3884         # Fall back to all MS products (this includes VC++ Build Tools)
3885         if ! test -n "$vswhereoutput"; then
3886             AC_MSG_CHECKING([VC++ Build Tools and similar])
3887             vswhereoutput=`$vswhere -products \* -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3888         fi
3889         if test -n "$vswhereoutput"; then
3890             PathFormat "$vswhereoutput"
3891             vctest=$formatted_path_unix
3892             break
3893         fi
3894     done
3896     if test -n "$vctest"; then
3897         vcnumwithdot="$ver.0"
3898         case "$vcnumwithdot" in
3899         16.0)
3900             vcyear=2019
3901             vcnum=160
3902             ;;
3903         esac
3904         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3906     fi
3909 test_cl_exe()
3911     AC_MSG_CHECKING([$1 compiler])
3913     CL_EXE_PATH="$2/cl.exe"
3915     if test ! -f "$CL_EXE_PATH"; then
3916         if test "$1" = "multi-arch"; then
3917             AC_MSG_WARN([no compiler (cl.exe) in $2])
3918             return 1
3919         else
3920             AC_MSG_ERROR([no compiler (cl.exe) in $2])
3921         fi
3922     fi
3924     dnl ===========================================================
3925     dnl  Check for the corresponding mspdb*.dll
3926     dnl ===========================================================
3928     # MSVC 15.0 has libraries from 14.0?
3929     mspdbnum="140"
3931     if test ! -e "$2/mspdb${mspdbnum}.dll"; then
3932         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $2, Visual Studio installation broken?])
3933     fi
3935     # The compiles has to find its shared libraries
3936     OLD_PATH="$PATH"
3937     TEMP_PATH=`cygpath -d "$2"`
3938     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3940     if ! "$CL_EXE_PATH" -? </dev/null >/dev/null 2>&1; then
3941         AC_MSG_ERROR([no compiler (cl.exe) in $2])
3942     fi
3944     PATH="$OLD_PATH"
3946     AC_MSG_RESULT([$CL_EXE_PATH])
3949 SOLARINC=
3950 MSBUILD_PATH=
3951 DEVENV=
3952 if test "$_os" = "WINNT"; then
3953     AC_MSG_CHECKING([Visual C++])
3954     find_msvc "$with_visual_studio"
3955     if test -z "$vctest"; then
3956         if test -n "$with_visual_studio"; then
3957             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
3958         else
3959             AC_MSG_ERROR([no Visual Studio 2019 installation found])
3960         fi
3961     fi
3962     AC_MSG_RESULT([])
3964     VC_PRODUCT_DIR="$vctest/VC"
3965     COMPATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber"
3967     # $WIN_OTHER_ARCH is a hack to test the x64 compiler on x86, even if it's not multi-arch
3968     if test -n "$WIN_MULTI_ARCH" -o -n "$WIN_OTHER_ARCH"; then
3969         MSVC_MULTI_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/${WIN_MULTI_ARCH}${WIN_OTHER_ARCH}"
3970         test_cl_exe "multi-arch" "$MSVC_MULTI_PATH"
3971         if test $? -ne 0; then
3972             WIN_MULTI_ARCH=""
3973             WIN_OTHER_ARCH=""
3974         fi
3975     fi
3977     if test "$WIN_BUILD_ARCH" = "$WIN_HOST_ARCH"; then
3978         MSVC_BUILD_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_BUILD_ARCH"
3979         test_cl_exe "build" "$MSVC_BUILD_PATH"
3980     fi
3982     if test "$WIN_BUILD_ARCH" != "$WIN_HOST_ARCH"; then
3983         MSVC_HOST_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_HOST_ARCH"
3984         test_cl_exe "host" "$MSVC_HOST_PATH"
3985     else
3986         MSVC_HOST_PATH="$MSVC_BUILD_PATH"
3987     fi
3989     AC_MSG_CHECKING([for short pathname of VC product directory])
3990     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3991     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3993     UCRTSDKDIR=
3994     UCRTVERSION=
3996     AC_MSG_CHECKING([for UCRT location])
3997     find_ucrt
3998     # find_ucrt errors out if it doesn't find it
3999     AC_MSG_RESULT([$UCRTSDKDIR ($UCRTVERSION)])
4000     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
4001     ucrtincpath_formatted=$formatted_path
4002     # SOLARINC is used for external modules and must be set too.
4003     # And no, it's not sufficient to set SOLARINC only, as configure
4004     # itself doesn't honour it.
4005     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
4006     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
4007     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
4008     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
4010     AC_SUBST(UCRTSDKDIR)
4011     AC_SUBST(UCRTVERSION)
4013     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
4014     # Find the proper version of MSBuild.exe to use based on the VS version
4015     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
4016     if test -n "$regvalue" ; then
4017         AC_MSG_RESULT([found: $regvalue])
4018         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
4019     else
4020         if test "$vcnumwithdot" = "16.0"; then
4021             if test "$WIN_BUILD_ARCH" != "x64"; then
4022                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
4023             else
4024                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
4025             fi
4026         else
4027             if test "$WIN_BUILD_ARCH" != "x64"; then
4028                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
4029             else
4030                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
4031             fi
4032         fi
4033         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
4034         AC_MSG_RESULT([$regvalue])
4035     fi
4037     # Find the version of devenv.exe
4038     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
4039     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
4040     DEVENV_unix=$(cygpath -u "$DEVENV")
4041     if test ! -e "$DEVENV_unix"; then
4042         AC_MSG_WARN([No devenv.exe found - this is expected for VC++ Build Tools])
4043     fi
4045     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
4046     dnl needed when building CLR code:
4047     if test -z "$MSVC_CXX"; then
4048         # This gives us a posix path with 8.3 filename restrictions
4049         MSVC_CXX=`win_short_path_for_make "$MSVC_HOST_PATH/cl.exe"`
4050     fi
4052     if test -z "$CC"; then
4053         CC=$MSVC_CXX
4054         CC_BASE=`first_arg_basename "$CC"`
4055     fi
4056     if test -z "$CXX"; then
4057         CXX=$MSVC_CXX
4058         CXX_BASE=`first_arg_basename "$CXX"`
4059     fi
4061     if test -n "$CC"; then
4062         # Remove /cl.exe from CC case insensitive
4063         AC_MSG_NOTICE([found Visual C++ $vcyear])
4065         main_include_dir=`cygpath -d -m "$COMPATH/Include"`
4066         CPPFLAGS="$CPPFLAGS -I$main_include_dir"
4068         PathFormat "$COMPATH"
4069         COMPATH=`win_short_path_for_make "$formatted_path"`
4071         VCVER=$vcnum
4073         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
4074         # are always "better", we list them in reverse chronological order.
4076         case "$vcnum" in
4077         160)
4078             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
4079             ;;
4080         esac
4082         # The expectation is that --with-windows-sdk should not need to be used
4083         if test -n "$with_windows_sdk"; then
4084             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
4085             *" "$with_windows_sdk" "*)
4086                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
4087                 ;;
4088             *)
4089                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $vcyear])
4090                 ;;
4091             esac
4092         fi
4094         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
4095         ac_objext=obj
4096         ac_exeext=exe
4098     else
4099         AC_MSG_ERROR([Visual C++ not found after all, huh])
4100     fi
4102     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.5])
4103     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4104         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
4105         // between Visual Studio versions and _MSC_VER:
4106         #if _MSC_VER < 1925
4107         #error
4108         #endif
4109     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
4111     # Check for 64-bit (cross-)compiler to use to build the 64-bit
4112     # version of the Explorer extension (and maybe other small
4113     # bits, too) needed when installing a 32-bit LibreOffice on a
4114     # 64-bit OS. The 64-bit Explorer extension is a feature that
4115     # has been present since long in OOo. Don't confuse it with
4116     # building LibreOffice itself as 64-bit code.
4118     BUILD_X64=
4119     CXX_X64_BINARY=
4121     if test "$WIN_HOST_ARCH" = "x86" -a -n "$WIN_OTHER_ARCH"; then
4122         AC_MSG_CHECKING([for the libraries to build the 64-bit Explorer extensions])
4123         if test -f "$COMPATH/atlmfc/lib/x64/atls.lib" -o \
4124              -f "$COMPATH/atlmfc/lib/spectre/x64/atls.lib"
4125         then
4126             BUILD_X64=TRUE
4127             CXX_X64_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4128             AC_MSG_RESULT([found])
4129         else
4130             AC_MSG_RESULT([not found])
4131             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
4132         fi
4133     elif test "$WIN_HOST_ARCH" = "x64"; then
4134         CXX_X64_BINARY=$CXX
4135     fi
4136     AC_SUBST(BUILD_X64)
4138     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
4139     AC_SUBST(CXX_X64_BINARY)
4141     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
4142     # needed to support TWAIN scan on both 32- and 64-bit systems
4144     case "$WIN_HOST_ARCH" in
4145     x64)
4146         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
4147         if test -n "$CXX_X86_BINARY"; then
4148             BUILD_X86=TRUE
4149             AC_MSG_RESULT([preset])
4150         elif test -n "$WIN_MULTI_ARCH"; then
4151             BUILD_X86=TRUE
4152             CXX_X86_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4153             CXX_X86_BINARY+=" /arch:SSE"
4154             AC_MSG_RESULT([found])
4155         else
4156             AC_MSG_RESULT([not found])
4157             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
4158         fi
4159         ;;
4160     x86)
4161         BUILD_X86=TRUE
4162         CXX_X86_BINARY=$MSVC_CXX
4163         ;;
4164     esac
4165     AC_SUBST(BUILD_X86)
4166     AC_SUBST(CXX_X86_BINARY)
4168 AC_SUBST(VCVER)
4169 AC_SUBST(DEVENV)
4170 AC_SUBST(MSVC_CXX)
4172 COM_IS_CLANG=
4173 AC_MSG_CHECKING([whether the compiler is actually Clang])
4174 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4175     #ifndef __clang__
4176     you lose
4177     #endif
4178     int foo=42;
4179     ]])],
4180     [AC_MSG_RESULT([yes])
4181      COM_IS_CLANG=TRUE],
4182     [AC_MSG_RESULT([no])])
4183 AC_SUBST(COM_IS_CLANG)
4185 CC_PLAIN=$CC
4186 CLANGVER=
4187 if test "$COM_IS_CLANG" = TRUE; then
4188     AC_MSG_CHECKING([whether Clang is new enough])
4189     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4190         #if !defined __apple_build_version__
4191         #error
4192         #endif
4193         ]])],
4194         [my_apple_clang=yes],[my_apple_clang=])
4195     if test "$my_apple_clang" = yes; then
4196         AC_MSG_RESULT([assumed yes (Apple Clang)])
4197     elif test "$_os" = Emscripten; then
4198         AC_MSG_RESULT([assumed yes (Emscripten Clang)])
4199     else
4200         if test "$_os" = WINNT; then
4201             dnl In which case, assume clang-cl:
4202             my_args="/EP /TC"
4203             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
4204             dnl clang-cl:
4205             CC_PLAIN=
4206             for i in $CC; do
4207                 case $i in
4208                 -FIIntrin.h)
4209                     ;;
4210                 *)
4211                     CC_PLAIN="$CC_PLAIN $i"
4212                     ;;
4213                 esac
4214             done
4215         else
4216             my_args="-E -P"
4217         fi
4218         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
4219         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
4220         CLANGVER=`echo $clang_version \
4221             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
4222         if test "$CLANGVER" -ge 50002; then
4223             AC_MSG_RESULT([yes ($clang_version)])
4224         else
4225             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
4226         fi
4227         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
4228         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
4229     fi
4232 SHOWINCLUDES_PREFIX=
4233 if test "$_os" = WINNT; then
4234     dnl We need to guess the prefix of the -showIncludes output, it can be
4235     dnl localized
4236     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
4237     echo "#include <stdlib.h>" > conftest.c
4238     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
4239         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
4240     rm -f conftest.c conftest.obj
4241     if test -z "$SHOWINCLUDES_PREFIX"; then
4242         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
4243     else
4244         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
4245     fi
4247 AC_SUBST(SHOWINCLUDES_PREFIX)
4250 # prefix C with ccache if needed
4252 UNCACHED_CC="$CC"
4253 if test "$CCACHE" != ""; then
4254     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
4256     AC_LANG_PUSH([C])
4257     save_CFLAGS=$CFLAGS
4258     CFLAGS="$CFLAGS --ccache-skip -O2"
4259     dnl an empty program will do, we're checking the compiler flags
4260     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
4261                       [use_ccache=yes], [use_ccache=no])
4262     CFLAGS=$save_CFLAGS
4263     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
4264         AC_MSG_RESULT([yes])
4265     else
4266         CC="$CCACHE $CC"
4267         CC_BASE="ccache $CC_BASE"
4268         AC_MSG_RESULT([no])
4269     fi
4270     AC_LANG_POP([C])
4273 # ===================================================================
4274 # check various GCC options that Clang does not support now but maybe
4275 # will somewhen in the future, check them even for GCC, so that the
4276 # flags are set
4277 # ===================================================================
4279 HAVE_GCC_GGDB2=
4280 if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4281     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
4282     save_CFLAGS=$CFLAGS
4283     CFLAGS="$CFLAGS -Werror -ggdb2"
4284     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
4285     CFLAGS=$save_CFLAGS
4286     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
4287         AC_MSG_RESULT([yes])
4288     else
4289         AC_MSG_RESULT([no])
4290     fi
4292     if test "$host_cpu" = "m68k"; then
4293         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
4294         save_CFLAGS=$CFLAGS
4295         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
4296         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
4297         CFLAGS=$save_CFLAGS
4298         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
4299             AC_MSG_RESULT([yes])
4300         else
4301             AC_MSG_ERROR([no])
4302         fi
4303     fi
4305 AC_SUBST(HAVE_GCC_GGDB2)
4307 dnl ===================================================================
4308 dnl  Test the gcc version
4309 dnl ===================================================================
4310 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
4311     AC_MSG_CHECKING([the GCC version])
4312     _gcc_version=`$CC -dumpversion`
4313     gcc_full_version=$(printf '%s' "$_gcc_version" | \
4314         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
4315     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
4317     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
4319     if test "$gcc_full_version" -lt 70000; then
4320         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
4321     fi
4322 else
4323     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
4324     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
4325     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
4326     # (which reports itself as GCC 4.2.1).
4327     GCC_VERSION=
4329 AC_SUBST(GCC_VERSION)
4331 dnl Set the ENABLE_DBGUTIL variable
4332 dnl ===================================================================
4333 AC_MSG_CHECKING([whether to build with additional debug utilities])
4334 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
4335     ENABLE_DBGUTIL="TRUE"
4336     # this is an extra var so it can have different default on different MSVC
4337     # versions (in case there are version specific problems with it)
4338     MSVC_USE_DEBUG_RUNTIME="TRUE"
4340     AC_MSG_RESULT([yes])
4341     # cppunit and graphite expose STL in public headers
4342     if test "$with_system_cppunit" = "yes"; then
4343         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
4344     else
4345         with_system_cppunit=no
4346     fi
4347     if test "$with_system_graphite" = "yes"; then
4348         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
4349     else
4350         with_system_graphite=no
4351     fi
4352     if test "$with_system_orcus" = "yes"; then
4353         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
4354     else
4355         with_system_orcus=no
4356     fi
4357     if test "$with_system_libcmis" = "yes"; then
4358         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
4359     else
4360         with_system_libcmis=no
4361     fi
4362     if test "$with_system_hunspell" = "yes"; then
4363         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
4364     else
4365         with_system_hunspell=no
4366     fi
4367     if test "$with_system_gpgmepp" = "yes"; then
4368         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
4369     else
4370         with_system_gpgmepp=no
4371     fi
4372     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
4373     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
4374     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
4375     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
4376     # of those two is using the system variant:
4377     if test "$with_system_libnumbertext" = "yes"; then
4378         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
4379     else
4380         with_system_libnumbertext=no
4381     fi
4382     if test "$with_system_libwps" = "yes"; then
4383         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
4384     else
4385         with_system_libwps=no
4386     fi
4387 else
4388     ENABLE_DBGUTIL=""
4389     MSVC_USE_DEBUG_RUNTIME=""
4390     AC_MSG_RESULT([no])
4392 AC_SUBST(ENABLE_DBGUTIL)
4393 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
4395 dnl Set the ENABLE_DEBUG variable.
4396 dnl ===================================================================
4397 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
4398     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
4400 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
4401     if test -z "$libo_fuzzed_enable_debug"; then
4402         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
4403     else
4404         AC_MSG_NOTICE([Resetting --enable-debug=yes])
4405         enable_debug=yes
4406     fi
4409 AC_MSG_CHECKING([whether to do a debug build])
4410 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
4411     ENABLE_DEBUG="TRUE"
4412     if test -n "$ENABLE_DBGUTIL" ; then
4413         AC_MSG_RESULT([yes (dbgutil)])
4414     else
4415         AC_MSG_RESULT([yes])
4416     fi
4417 else
4418     ENABLE_DEBUG=""
4419     AC_MSG_RESULT([no])
4421 AC_SUBST(ENABLE_DEBUG)
4423 dnl ===================================================================
4424 dnl Select the linker to use (gold/lld/ld.bfd).
4425 dnl This is done only after compiler checks (need to know if Clang is
4426 dnl used, for different defaults) and after checking if a debug build
4427 dnl is wanted (non-debug builds get the default linker if not explicitly
4428 dnl specified otherwise).
4429 dnl All checks for linker features/options should come after this.
4430 dnl ===================================================================
4431 check_use_ld()
4433     use_ld=-fuse-ld=${1%%:*}
4434     use_ld_path=${1#*:}
4435     if test "$use_ld_path" != "$1"; then
4436         use_ld="$use_ld --ld-path=$use_ld_path"
4437     fi
4438     use_ld_fail_if_error=$2
4439     use_ld_ok=
4440     AC_MSG_CHECKING([for $use_ld linker support])
4441     use_ld_ldflags_save="$LDFLAGS"
4442     LDFLAGS="$LDFLAGS $use_ld"
4443     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4444 #include <stdio.h>
4445         ],[
4446 printf ("hello world\n");
4447         ])], USE_LD=$use_ld, [])
4448     if test -n "$USE_LD"; then
4449         AC_MSG_RESULT( yes )
4450         use_ld_ok=yes
4451     else
4452         if test -n "$use_ld_fail_if_error"; then
4453             AC_MSG_ERROR( no )
4454         else
4455             AC_MSG_RESULT( no )
4456         fi
4457     fi
4458     if test -n "$use_ld_ok"; then
4459         dnl keep the value of LDFLAGS
4460         return 0
4461     fi
4462     LDFLAGS="$use_ld_ldflags_save"
4463     return 1
4465 USE_LD=
4466 if test "$enable_ld" != "no"; then
4467     if test "$GCC" = "yes"; then
4468         if test -n "$enable_ld"; then
4469             check_use_ld "$enable_ld" fail_if_error
4470         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4471             dnl non-debug builds default to the default linker
4472             true
4473         elif test -n "$COM_IS_CLANG"; then
4474             check_use_ld lld
4475             if test $? -ne 0; then
4476                 check_use_ld gold
4477             fi
4478         else
4479             # For gcc first try gold, new versions also support lld.
4480             check_use_ld gold
4481             if test $? -ne 0; then
4482                 check_use_ld lld
4483             fi
4484         fi
4485         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4486         rm conftest.out
4487         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4488         if test -z "$ld_used"; then
4489             ld_used="unknown"
4490         fi
4491         AC_MSG_CHECKING([for linker that is used])
4492         AC_MSG_RESULT([$ld_used])
4493         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4494             if echo "$ld_used" | grep -q "^GNU ld"; then
4495                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4496                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4497             fi
4498         fi
4499     else
4500         if test "$enable_ld" = "yes"; then
4501             AC_MSG_ERROR([--enable-ld not supported])
4502         fi
4503     fi
4505 AC_SUBST(USE_LD)
4507 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4508 if test "$GCC" = "yes" -a "$_os" != Emscripten ; then
4509     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4510     bsymbolic_functions_ldflags_save=$LDFLAGS
4511     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4512     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4513 #include <stdio.h>
4514         ],[
4515 printf ("hello world\n");
4516         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4517     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4518         AC_MSG_RESULT( found )
4519     else
4520         AC_MSG_RESULT( not found )
4521     fi
4522     LDFLAGS=$bsymbolic_functions_ldflags_save
4524 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4526 LD_GC_SECTIONS=
4527 if test "$GCC" = "yes"; then
4528     for flag in "--gc-sections" "-dead_strip"; do
4529         AC_MSG_CHECKING([for $flag linker support])
4530         ldflags_save=$LDFLAGS
4531         LDFLAGS="$LDFLAGS -Wl,$flag"
4532         AC_LINK_IFELSE([AC_LANG_PROGRAM([
4533 #include <stdio.h>
4534             ],[
4535 printf ("hello world\n");
4536             ])],[
4537             LD_GC_SECTIONS="-Wl,$flag"
4538             AC_MSG_RESULT( found )
4539             ], [
4540             AC_MSG_RESULT( not found )
4541             ])
4542         LDFLAGS=$ldflags_save
4543         if test -n "$LD_GC_SECTIONS"; then
4544             break
4545         fi
4546     done
4548 AC_SUBST(LD_GC_SECTIONS)
4550 HAVE_GSPLIT_DWARF=
4551 if test "$enable_split_debug" != no; then
4552     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4553     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4554         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4555         save_CFLAGS=$CFLAGS
4556         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4557         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4558         CFLAGS=$save_CFLAGS
4559         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4560             AC_MSG_RESULT([yes])
4561         else
4562             if test "$enable_split_debug" = yes; then
4563                 AC_MSG_ERROR([no])
4564             else
4565                 AC_MSG_RESULT([no])
4566             fi
4567         fi
4568     fi
4569     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4570         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4571         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4572     fi
4574 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4576 HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=
4577 AC_MSG_CHECKING([whether $CC_BASE supports -Xclang -debug-info-kind=constructor])
4578 save_CFLAGS=$CFLAGS
4579 CFLAGS="$CFLAGS -Werror -Xclang -debug-info-kind=constructor"
4580 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=TRUE ],[])
4581 CFLAGS=$save_CFLAGS
4582 if test "$HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR" = "TRUE"; then
4583     AC_MSG_RESULT([yes])
4584 else
4585     AC_MSG_RESULT([no])
4587 AC_SUBST(HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR)
4589 ENABLE_GDB_INDEX=
4590 if test "$enable_gdb_index" != "no"; then
4591     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4592     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4593         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4594         save_CFLAGS=$CFLAGS
4595         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4596         have_ggnu_pubnames=
4597         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4598         if test "$have_ggnu_pubnames" != "TRUE"; then
4599             if test "$enable_gdb_index" = "yes"; then
4600                 AC_MSG_ERROR([no, --enable-gdb-index not supported])
4601             else
4602                 AC_MSG_RESULT( no )
4603             fi
4604         else
4605             AC_MSG_RESULT( yes )
4606             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4607             ldflags_save=$LDFLAGS
4608             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4609             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4610 #include <stdio.h>
4611                 ],[
4612 printf ("hello world\n");
4613                 ])], ENABLE_GDB_INDEX=TRUE, [])
4614             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4615                 AC_MSG_RESULT( yes )
4616             else
4617                 if test "$enable_gdb_index" = "yes"; then
4618                     AC_MSG_ERROR( no )
4619                 else
4620                     AC_MSG_RESULT( no )
4621                 fi
4622             fi
4623             LDFLAGS=$ldflags_save
4624         fi
4625         CFLAGS=$save_CFLAGS
4626         fi
4627     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4628         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4629         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4630     fi
4632 AC_SUBST(ENABLE_GDB_INDEX)
4634 if test -z "$enable_sal_log" && test "$ENABLE_DEBUG" = TRUE; then
4635     enable_sal_log=yes
4637 if test "$enable_sal_log" = yes; then
4638     ENABLE_SAL_LOG=TRUE
4640 AC_SUBST(ENABLE_SAL_LOG)
4642 dnl Check for enable symbols option
4643 dnl ===================================================================
4644 AC_MSG_CHECKING([whether to generate debug information])
4645 if test -z "$enable_symbols"; then
4646     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4647         enable_symbols=yes
4648     else
4649         enable_symbols=no
4650     fi
4652 if test "$enable_symbols" = yes; then
4653     ENABLE_SYMBOLS_FOR=all
4654     AC_MSG_RESULT([yes])
4655 elif test "$enable_symbols" = no; then
4656     ENABLE_SYMBOLS_FOR=
4657     AC_MSG_RESULT([no])
4658 else
4659     # Selective debuginfo.
4660     ENABLE_SYMBOLS_FOR="$enable_symbols"
4661     AC_MSG_RESULT([for "$enable_symbols"])
4663 AC_SUBST(ENABLE_SYMBOLS_FOR)
4665 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4666     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4667     AC_MSG_CHECKING([whether enough memory is available for linking])
4668     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4669     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4670     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4671         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4672     else
4673         AC_MSG_RESULT([yes])
4674     fi
4677 ENABLE_OPTIMIZED=
4678 ENABLE_OPTIMIZED_DEBUG=
4679 AC_MSG_CHECKING([whether to compile with optimization flags])
4680 if test -z "$enable_optimized"; then
4681     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4682         enable_optimized=no
4683     else
4684         enable_optimized=yes
4685     fi
4687 if test "$enable_optimized" = yes; then
4688     ENABLE_OPTIMIZED=TRUE
4689     AC_MSG_RESULT([yes])
4690 elif test "$enable_optimized" = debug; then
4691     ENABLE_OPTIMIZED_DEBUG=TRUE
4692     AC_MSG_RESULT([yes (debug)])
4693     HAVE_GCC_OG=
4694     if test "$GCC" = "yes" -a "$_os" != "Emscripten"; then
4695         AC_MSG_CHECKING([whether $CC_BASE supports -Og])
4696         save_CFLAGS=$CFLAGS
4697         CFLAGS="$CFLAGS -Werror -Og"
4698         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[])
4699         CFLAGS=$save_CFLAGS
4700         if test "$HAVE_GCC_OG" = "TRUE"; then
4701             AC_MSG_RESULT([yes])
4702         else
4703             AC_MSG_RESULT([no])
4704         fi
4705     fi
4706     if test -z "$HAVE_GCC_OG" -a "$_os" != "Emscripten"; then
4707         AC_MSG_ERROR([The compiler does not support optimizations suitable for debugging.])
4708     fi
4709 else
4710     AC_MSG_RESULT([no])
4712 AC_SUBST(ENABLE_OPTIMIZED)
4713 AC_SUBST(ENABLE_OPTIMIZED_DEBUG)
4716 # determine CPUNAME, OS, ...
4717 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4719 case "$host_os" in
4721 aix*)
4722     COM=GCC
4723     CPUNAME=POWERPC
4724     USING_X11=TRUE
4725     OS=AIX
4726     RTL_OS=AIX
4727     RTL_ARCH=PowerPC
4728     PLATFORMID=aix_powerpc
4729     P_SEP=:
4730     ;;
4732 cygwin*|wsl*)
4733     # Already handled
4734     ;;
4736 darwin*|macos*)
4737     COM=GCC
4738     USING_X11=
4739     OS=MACOSX
4740     RTL_OS=MacOSX
4741     P_SEP=:
4743     case "$host_cpu" in
4744     aarch64|arm64)
4745         if test "$enable_ios_simulator" = "yes"; then
4746             OS=iOS
4747         else
4748             CPUNAME=AARCH64
4749             RTL_ARCH=AARCH64
4750             PLATFORMID=macosx_aarch64
4751         fi
4752         ;;
4753     x86_64)
4754         if test "$enable_ios_simulator" = "yes"; then
4755             OS=iOS
4756         fi
4757         CPUNAME=X86_64
4758         RTL_ARCH=X86_64
4759         PLATFORMID=macosx_x86_64
4760         ;;
4761     *)
4762         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4763         ;;
4764     esac
4765     ;;
4767 ios*)
4768     COM=GCC
4769     USING_X11=
4770     OS=iOS
4771     RTL_OS=iOS
4772     P_SEP=:
4774     case "$host_cpu" in
4775     aarch64|arm64)
4776         if test "$enable_ios_simulator" = "yes"; then
4777             AC_MSG_ERROR([iOS simulator is only available in macOS not iOS])
4778         fi
4779         ;;
4780     *)
4781         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4782         ;;
4783     esac
4784     CPUNAME=AARCH64
4785     RTL_ARCH=AARCH64
4786     PLATFORMID=ios_arm64
4787     ;;
4789 dragonfly*)
4790     COM=GCC
4791     USING_X11=TRUE
4792     OS=DRAGONFLY
4793     RTL_OS=DragonFly
4794     P_SEP=:
4796     case "$host_cpu" in
4797     i*86)
4798         CPUNAME=INTEL
4799         RTL_ARCH=x86
4800         PLATFORMID=dragonfly_x86
4801         ;;
4802     x86_64)
4803         CPUNAME=X86_64
4804         RTL_ARCH=X86_64
4805         PLATFORMID=dragonfly_x86_64
4806         ;;
4807     *)
4808         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4809         ;;
4810     esac
4811     ;;
4813 freebsd*)
4814     COM=GCC
4815     USING_X11=TRUE
4816     RTL_OS=FreeBSD
4817     OS=FREEBSD
4818     P_SEP=:
4820     case "$host_cpu" in
4821     aarch64)
4822         CPUNAME=AARCH64
4823         PLATFORMID=freebsd_aarch64
4824         RTL_ARCH=AARCH64
4825         ;;
4826     i*86)
4827         CPUNAME=INTEL
4828         RTL_ARCH=x86
4829         PLATFORMID=freebsd_x86
4830         ;;
4831     x86_64|amd64)
4832         CPUNAME=X86_64
4833         RTL_ARCH=X86_64
4834         PLATFORMID=freebsd_x86_64
4835         ;;
4836     powerpc64)
4837         CPUNAME=POWERPC64
4838         RTL_ARCH=PowerPC_64
4839         PLATFORMID=freebsd_powerpc64
4840         ;;
4841     powerpc|powerpcspe)
4842         CPUNAME=POWERPC
4843         RTL_ARCH=PowerPC
4844         PLATFORMID=freebsd_powerpc
4845         ;;
4846     *)
4847         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4848         ;;
4849     esac
4850     ;;
4852 haiku*)
4853     COM=GCC
4854     USING_X11=
4855     GUIBASE=haiku
4856     RTL_OS=Haiku
4857     OS=HAIKU
4858     P_SEP=:
4860     case "$host_cpu" in
4861     i*86)
4862         CPUNAME=INTEL
4863         RTL_ARCH=x86
4864         PLATFORMID=haiku_x86
4865         ;;
4866     x86_64|amd64)
4867         CPUNAME=X86_64
4868         RTL_ARCH=X86_64
4869         PLATFORMID=haiku_x86_64
4870         ;;
4871     *)
4872         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4873         ;;
4874     esac
4875     ;;
4877 kfreebsd*)
4878     COM=GCC
4879     USING_X11=TRUE
4880     OS=LINUX
4881     RTL_OS=kFreeBSD
4882     P_SEP=:
4884     case "$host_cpu" in
4886     i*86)
4887         CPUNAME=INTEL
4888         RTL_ARCH=x86
4889         PLATFORMID=kfreebsd_x86
4890         ;;
4891     x86_64)
4892         CPUNAME=X86_64
4893         RTL_ARCH=X86_64
4894         PLATFORMID=kfreebsd_x86_64
4895         ;;
4896     *)
4897         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4898         ;;
4899     esac
4900     ;;
4902 linux-gnu*)
4903     COM=GCC
4904     USING_X11=TRUE
4905     OS=LINUX
4906     RTL_OS=Linux
4907     P_SEP=:
4909     case "$host_cpu" in
4911     aarch64)
4912         CPUNAME=AARCH64
4913         PLATFORMID=linux_aarch64
4914         RTL_ARCH=AARCH64
4915         EPM_FLAGS="-a arm64"
4916         ;;
4917     alpha)
4918         CPUNAME=AXP
4919         RTL_ARCH=ALPHA
4920         PLATFORMID=linux_alpha
4921         ;;
4922     arm*)
4923         CPUNAME=ARM
4924         EPM_FLAGS="-a arm"
4925         RTL_ARCH=ARM_EABI
4926         PLATFORMID=linux_arm_eabi
4927         case "$host_cpu" in
4928         arm*-linux)
4929             RTL_ARCH=ARM_OABI
4930             PLATFORMID=linux_arm_oabi
4931             ;;
4932         esac
4933         ;;
4934     hppa)
4935         CPUNAME=HPPA
4936         RTL_ARCH=HPPA
4937         EPM_FLAGS="-a hppa"
4938         PLATFORMID=linux_hppa
4939         ;;
4940     i*86)
4941         CPUNAME=INTEL
4942         RTL_ARCH=x86
4943         PLATFORMID=linux_x86
4944         ;;
4945     ia64)
4946         CPUNAME=IA64
4947         RTL_ARCH=IA64
4948         PLATFORMID=linux_ia64
4949         ;;
4950     mips)
4951         CPUNAME=GODSON
4952         RTL_ARCH=MIPS_EB
4953         EPM_FLAGS="-a mips"
4954         PLATFORMID=linux_mips_eb
4955         ;;
4956     mips64)
4957         CPUNAME=GODSON64
4958         RTL_ARCH=MIPS64_EB
4959         EPM_FLAGS="-a mips64"
4960         PLATFORMID=linux_mips64_eb
4961         ;;
4962     mips64el)
4963         CPUNAME=GODSON64
4964         RTL_ARCH=MIPS64_EL
4965         EPM_FLAGS="-a mips64el"
4966         PLATFORMID=linux_mips64_el
4967         ;;
4968     mipsel)
4969         CPUNAME=GODSON
4970         RTL_ARCH=MIPS_EL
4971         EPM_FLAGS="-a mipsel"
4972         PLATFORMID=linux_mips_el
4973         ;;
4974     m68k)
4975         CPUNAME=M68K
4976         RTL_ARCH=M68K
4977         PLATFORMID=linux_m68k
4978         ;;
4979     powerpc)
4980         CPUNAME=POWERPC
4981         RTL_ARCH=PowerPC
4982         PLATFORMID=linux_powerpc
4983         ;;
4984     powerpc64)
4985         CPUNAME=POWERPC64
4986         RTL_ARCH=PowerPC_64
4987         PLATFORMID=linux_powerpc64
4988         ;;
4989     powerpc64le)
4990         CPUNAME=POWERPC64
4991         RTL_ARCH=PowerPC_64_LE
4992         PLATFORMID=linux_powerpc64_le
4993         ;;
4994     sparc)
4995         CPUNAME=SPARC
4996         RTL_ARCH=SPARC
4997         PLATFORMID=linux_sparc
4998         ;;
4999     sparc64)
5000         CPUNAME=SPARC64
5001         RTL_ARCH=SPARC64
5002         PLATFORMID=linux_sparc64
5003         ;;
5004     s390)
5005         CPUNAME=S390
5006         RTL_ARCH=S390
5007         PLATFORMID=linux_s390
5008         ;;
5009     s390x)
5010         CPUNAME=S390X
5011         RTL_ARCH=S390x
5012         PLATFORMID=linux_s390x
5013         ;;
5014     x86_64)
5015         CPUNAME=X86_64
5016         RTL_ARCH=X86_64
5017         PLATFORMID=linux_x86_64
5018         ;;
5019     *)
5020         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5021         ;;
5022     esac
5023     ;;
5025 linux-android*)
5026     COM=GCC
5027     USING_X11=
5028     OS=ANDROID
5029     RTL_OS=Android
5030     P_SEP=:
5032     case "$host_cpu" in
5034     arm|armel)
5035         CPUNAME=ARM
5036         RTL_ARCH=ARM_EABI
5037         PLATFORMID=android_arm_eabi
5038         ;;
5039     aarch64)
5040         CPUNAME=AARCH64
5041         RTL_ARCH=AARCH64
5042         PLATFORMID=android_aarch64
5043         ;;
5044     i*86)
5045         CPUNAME=INTEL
5046         RTL_ARCH=x86
5047         PLATFORMID=android_x86
5048         ;;
5049     x86_64)
5050         CPUNAME=X86_64
5051         RTL_ARCH=X86_64
5052         PLATFORMID=android_x86_64
5053         ;;
5054     *)
5055         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5056         ;;
5057     esac
5058     ;;
5060 *netbsd*)
5061     COM=GCC
5062     USING_X11=TRUE
5063     OS=NETBSD
5064     RTL_OS=NetBSD
5065     P_SEP=:
5067     case "$host_cpu" in
5068     i*86)
5069         CPUNAME=INTEL
5070         RTL_ARCH=x86
5071         PLATFORMID=netbsd_x86
5072         ;;
5073     powerpc)
5074         CPUNAME=POWERPC
5075         RTL_ARCH=PowerPC
5076         PLATFORMID=netbsd_powerpc
5077         ;;
5078     sparc)
5079         CPUNAME=SPARC
5080         RTL_ARCH=SPARC
5081         PLATFORMID=netbsd_sparc
5082         ;;
5083     x86_64)
5084         CPUNAME=X86_64
5085         RTL_ARCH=X86_64
5086         PLATFORMID=netbsd_x86_64
5087         ;;
5088     *)
5089         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5090         ;;
5091     esac
5092     ;;
5094 openbsd*)
5095     COM=GCC
5096     USING_X11=TRUE
5097     OS=OPENBSD
5098     RTL_OS=OpenBSD
5099     P_SEP=:
5101     case "$host_cpu" in
5102     i*86)
5103         CPUNAME=INTEL
5104         RTL_ARCH=x86
5105         PLATFORMID=openbsd_x86
5106         ;;
5107     x86_64)
5108         CPUNAME=X86_64
5109         RTL_ARCH=X86_64
5110         PLATFORMID=openbsd_x86_64
5111         ;;
5112     *)
5113         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5114         ;;
5115     esac
5116     SOLARINC="$SOLARINC -I/usr/local/include"
5117     ;;
5119 solaris*)
5120     COM=GCC
5121     USING_X11=TRUE
5122     OS=SOLARIS
5123     RTL_OS=Solaris
5124     P_SEP=:
5126     case "$host_cpu" in
5127     i*86)
5128         CPUNAME=INTEL
5129         RTL_ARCH=x86
5130         PLATFORMID=solaris_x86
5131         ;;
5132     sparc)
5133         CPUNAME=SPARC
5134         RTL_ARCH=SPARC
5135         PLATFORMID=solaris_sparc
5136         ;;
5137     sparc64)
5138         CPUNAME=SPARC64
5139         RTL_ARCH=SPARC64
5140         PLATFORMID=solaris_sparc64
5141         ;;
5142     *)
5143         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5144         ;;
5145     esac
5146     SOLARINC="$SOLARINC -I/usr/local/include"
5147     ;;
5149 emscripten*)
5150     COM=GCC
5151     USING_X11=
5152     OS=EMSCRIPTEN
5153     RTL_OS=Emscripten
5154     P_SEP=:
5156     case "$host_cpu" in
5157     wasm32|wasm64)
5158         ;;
5159     *)
5160         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5161         ;;
5162     esac
5163     CPUNAME=INTEL
5164     RTL_ARCH=x86
5165     PLATFORMID=linux_x86
5166     ;;
5169     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
5170     ;;
5171 esac
5173 if test "$with_x" = "no"; then
5174     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
5177 DISABLE_GUI=""
5178 if test "$enable_gui" = "no"; then
5179     if test "$USING_X11" != TRUE; then
5180         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
5181     fi
5182     USING_X11=
5183     DISABLE_GUI=TRUE
5184     AC_DEFINE(HAVE_FEATURE_UI,0)
5185     test_cairo=yes
5187 AC_SUBST(DISABLE_GUI)
5189 WORKDIR="${BUILDDIR}/workdir"
5190 INSTDIR="${BUILDDIR}/instdir"
5191 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
5192 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
5193 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
5194 AC_SUBST(COM)
5195 AC_SUBST(CPUNAME)
5196 AC_SUBST(RTL_OS)
5197 AC_SUBST(RTL_ARCH)
5198 AC_SUBST(EPM_FLAGS)
5199 AC_SUBST(USING_X11)
5200 AC_SUBST([INSTDIR])
5201 AC_SUBST([INSTROOT])
5202 AC_SUBST([INSTROOTBASE])
5203 AC_SUBST(OS)
5204 AC_SUBST(P_SEP)
5205 AC_SUBST(WORKDIR)
5206 AC_SUBST(PLATFORMID)
5207 AC_SUBST(WINDOWS_X64)
5208 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
5210 dnl ===================================================================
5211 dnl Test which package format to use
5212 dnl ===================================================================
5213 AC_MSG_CHECKING([which package format to use])
5214 if test -n "$with_package_format" -a "$with_package_format" != no; then
5215     for i in $with_package_format; do
5216         case "$i" in
5217         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
5218             ;;
5219         *)
5220             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
5221 aix - AIX software distribution
5222 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
5223 deb - Debian software distribution
5224 pkg - Solaris software distribution
5225 rpm - RedHat software distribution
5227 LibreOffice additionally supports:
5228 archive - .tar.gz or .zip
5229 dmg - macOS .dmg
5230 installed - installation tree
5231 msi - Windows .msi
5232         ])
5233             ;;
5234         esac
5235     done
5236     # fakeroot is needed to ensure correct file ownerships/permissions
5237     # inside deb packages and tar archives created on Linux and Solaris.
5238     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
5239         AC_PATH_PROG(FAKEROOT, fakeroot, no)
5240         if test "$FAKEROOT" = "no"; then
5241             AC_MSG_ERROR(
5242                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
5243         fi
5244     fi
5245     PKGFORMAT="$with_package_format"
5246     AC_MSG_RESULT([$PKGFORMAT])
5247 else
5248     PKGFORMAT=
5249     AC_MSG_RESULT([none])
5251 AC_SUBST(PKGFORMAT)
5253 dnl ===================================================================
5254 dnl Set up a different compiler to produce tools to run on the build
5255 dnl machine when doing cross-compilation
5256 dnl ===================================================================
5258 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
5259 m4_pattern_allow([PKG_CONFIG_LIBDIR])
5260 if test "$cross_compiling" = "yes"; then
5261     AC_MSG_CHECKING([for BUILD platform configuration])
5262     echo
5263     rm -rf CONF-FOR-BUILD config_build.mk
5264     mkdir CONF-FOR-BUILD
5265     # Here must be listed all files needed when running the configure script. In particular, also
5266     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
5267     # keep them in the same order as there.
5268     (cd $SRC_ROOT && tar cf - \
5269         config.guess \
5270         bin/get_config_variables \
5271         solenv/bin/getcompver.awk \
5272         solenv/inc/langlist.mk \
5273         download.lst \
5274         config_host.mk.in \
5275         config_host_lang.mk.in \
5276         Makefile.in \
5277         bin/bffvalidator.sh.in \
5278         bin/odfvalidator.sh.in \
5279         bin/officeotron.sh.in \
5280         hardened_runtime.xcent.in \
5281         instsetoo_native/util/openoffice.lst.in \
5282         config_host/*.in \
5283         sysui/desktop/macosx/Info.plist.in \
5284         .vscode/vs-code-template.code-workspace.in \
5285         ) \
5286     | (cd CONF-FOR-BUILD && tar xf -)
5287     cp configure CONF-FOR-BUILD
5288     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
5289     (
5290     unset COM USING_X11 OS CPUNAME
5291     unset CC CXX SYSBASE CFLAGS
5292     unset AR LD NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
5293     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
5294     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC
5295     unset PKG_CONFIG_LIBDIR PKG_CONFIG_PATH
5296     if test -n "$CC_FOR_BUILD"; then
5297         export CC="$CC_FOR_BUILD"
5298         CC_BASE=`first_arg_basename "$CC"`
5299     fi
5300     if test -n "$CXX_FOR_BUILD"; then
5301         export CXX="$CXX_FOR_BUILD"
5302         CXX_BASE=`first_arg_basename "$CXX"`
5303     fi
5304     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
5305     cd CONF-FOR-BUILD
5307     # Handle host configuration, which affects the cross-toolset too
5308     sub_conf_opts=""
5309     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
5310     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
5311     test "$with_junit" = "no" && sub_conf_opts="$sub_conf_opts --without-junit"
5312     if test -n "$ENABLE_JAVA"; then
5313         case "$_os" in
5314         iOS) sub_conf_opts="$sub_conf_opts --without-java" ;; # force it off, like it used to be
5315         Android)
5316             # Hack for Android - the build doesn't need a host JDK, so just forward to build for convenience
5317             test -n "$with_jdk_home" && sub_conf_opts="$sub_conf_opts --with-jdk-home=$with_jdk_home"
5318             ;;
5319         *)
5320             if test -z "$with_jdk_home"; then
5321                 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.])
5322             fi
5323             ;;
5324         esac
5325     else
5326         sub_conf_opts="$sub_conf_opts --without-java"
5327     fi
5328     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
5329     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
5330     test "$with_galleries" = "no" -o -z "$WITH_GALLERY_BUILD" && sub_conf_opts="$sub_conf_opts --with-galleries=no"
5331     test "$enable_wasm_strip" = "yes" && sub_conf_opts="$sub_conf_opts --enable-wasm-strip"
5332     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
5334     # Don't bother having configure look for stuff not needed for the build platform anyway
5335     ./configure \
5336         --build="$build_alias" \
5337         --disable-cups \
5338         --disable-firebird-sdbc \
5339         --disable-gpgmepp \
5340         --disable-gstreamer-1-0 \
5341         --disable-gtk3 \
5342         --disable-mariadb-sdbc \
5343         --disable-nss \
5344         --disable-online-update \
5345         --disable-opencl \
5346         --disable-pdfimport \
5347         --disable-postgresql-sdbc \
5348         --disable-skia \
5349         --enable-icecream="$enable_icecream" \
5350         --without-doxygen \
5351         --without-webdav \
5352         --with-parallelism="$with_parallelism" \
5353         --with-theme="$with_theme" \
5354         --with-tls=openssl \
5355         $sub_conf_opts \
5356         --srcdir=$srcdir \
5357         2>&1 | sed -e 's/^/    /'
5358     if test [${PIPESTATUS[0]}] -ne 0; then
5359         AC_MSG_ERROR([Running the configure script for BUILD side failed, see CONF-FOR-BUILD/config.log])
5360     fi
5362     # filter permitted build targets
5363     PERMITTED_BUILD_TARGETS="
5364         AVMEDIA
5365         BOOST
5366         CAIRO
5367         CLUCENE
5368         CURL
5369         DBCONNECTIVITY
5370         DESKTOP
5371         DYNLOADING
5372         EPOXY
5373         EXPAT
5374         GLM
5375         GRAPHITE
5376         HARFBUZZ
5377         ICU
5378         LCMS2
5379         LIBJPEG_TURBO
5380         LIBLANGTAG
5381         LibO
5382         LIBFFI
5383         LIBPN
5384         LIBXML2
5385         LIBXSLT
5386         MDDS
5387         NATIVE
5388         OPENSSL
5389         ORCUS
5390         PYTHON
5391         SCRIPTING
5392         ZLIB
5394     # converts BUILD_TYPE and PERMITTED_BUILD_TARGETS into non-whitespace,
5395     # newlined lists, to use grep as a filter
5396     PERMITTED_BUILD_TARGETS=$(echo "$PERMITTED_BUILD_TARGETS" | sed -e '/^ *$/d' -e 's/ *//')
5397     BUILD_TARGETS="$(sed -n -e '/^export BUILD_TYPE=/ s/.*=//p' config_host.mk | tr ' ' '\n')"
5398     BUILD_TARGETS="$(echo "$BUILD_TARGETS" | grep -F "$PERMITTED_BUILD_TARGETS" | tr '\n' ' ')"
5399     sed -i -e "s/ BUILD_TYPE=.*$/ BUILD_TYPE=$BUILD_TARGETS/" config_host.mk
5401     cp config_host.mk ../config_build.mk
5402     cp config_host_lang.mk ../config_build_lang.mk
5403     mv config.log ../config.Build.log
5404     mkdir -p ../config_build
5405     mv config_host/*.h ../config_build
5407     # all these will get a _FOR_BUILD postfix
5408     DIRECT_FOR_BUILD_SETTINGS="
5409         CC
5410         CXX
5411         ILIB
5412         JAVA_HOME
5413         JAVAIFLAGS
5414         JDK
5415         LIBO_BIN_FOLDER
5416         LIBO_LIB_FOLDER
5417         LIBO_URE_LIB_FOLDER
5418         LIBO_URE_MISC_FOLDER
5419         OS
5420         SDKDIRNAME
5421         SYSTEM_LIBXML
5422         SYSTEM_LIBXSLT
5424     # these overwrite host config with build config
5425     OVERWRITING_SETTINGS="
5426         ANT
5427         ANT_HOME
5428         ANT_LIB
5429         HSQLDB_USE_JDBC_4_1
5430         JAVA_CLASSPATH_NOT_SET
5431         JAVA_SOURCE_VER
5432         JAVA_TARGET_VER
5433         JAVACFLAGS
5434         JAVACOMPILER
5435         JAVADOC
5436         JAVADOCISGJDOC
5438     # these need some special handling
5439     EXTRA_HANDLED_SETTINGS="
5440         INSTDIR
5441         INSTROOT
5442         PATH
5443         WORKDIR
5445     OLD_PATH=$PATH
5446     . ./bin/get_config_variables $DIRECT_FOR_BUILD_SETTINGS $OVERWRITING_SETTINGS $EXTRA_HANDLED_SETTINGS
5447     BUILD_PATH=$PATH
5448     PATH=$OLD_PATH
5450     line=`echo "LO_PATH_FOR_BUILD='${BUILD_PATH}'" | sed -e 's,/CONF-FOR-BUILD,,g'`
5451     echo "$line" >>build-config
5453     for V in $DIRECT_FOR_BUILD_SETTINGS; do
5454         VV='$'$V
5455         VV=`eval "echo $VV"`
5456         if test -n "$VV"; then
5457             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
5458             echo "$line" >>build-config
5459         fi
5460     done
5462     for V in $OVERWRITING_SETTINGS; do
5463         VV='$'$V
5464         VV=`eval "echo $VV"`
5465         if test -n "$VV"; then
5466             line=${V}='${'${V}:-$VV'}'
5467             echo "$line" >>build-config
5468         fi
5469     done
5471     for V in INSTDIR INSTROOT WORKDIR; do
5472         VV='$'$V
5473         VV=`eval "echo $VV"`
5474         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
5475         if test -n "$VV"; then
5476             line="${V}_FOR_BUILD='$VV'"
5477             echo "$line" >>build-config
5478         fi
5479     done
5481     )
5482     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([setup/configure for BUILD side failed, see CONF-FOR-BUILD/config.log])
5483     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])
5484     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
5485              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
5487     eval `cat CONF-FOR-BUILD/build-config`
5489     AC_MSG_RESULT([checking for BUILD platform configuration... done])
5491     rm -rf CONF-FOR-BUILD
5492 else
5493     OS_FOR_BUILD="$OS"
5494     CC_FOR_BUILD="$CC"
5495     CXX_FOR_BUILD="$CXX"
5496     INSTDIR_FOR_BUILD="$INSTDIR"
5497     INSTROOT_FOR_BUILD="$INSTROOT"
5498     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
5499     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
5500     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
5501     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
5502     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
5503     WORKDIR_FOR_BUILD="$WORKDIR"
5505 AC_SUBST(OS_FOR_BUILD)
5506 AC_SUBST(INSTDIR_FOR_BUILD)
5507 AC_SUBST(INSTROOT_FOR_BUILD)
5508 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
5509 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
5510 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
5511 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
5512 AC_SUBST(SDKDIRNAME_FOR_BUILD)
5513 AC_SUBST(WORKDIR_FOR_BUILD)
5514 AC_SUBST(CC_FOR_BUILD)
5515 AC_SUBST(CXX_FOR_BUILD)
5517 dnl ===================================================================
5518 dnl Check for syslog header
5519 dnl ===================================================================
5520 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
5522 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
5523 dnl ===================================================================
5524 AC_MSG_CHECKING([whether to turn warnings to errors])
5525 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
5526     ENABLE_WERROR="TRUE"
5527     PYTHONWARNINGS="error"
5528     AC_MSG_RESULT([yes])
5529 else
5530     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
5531         ENABLE_WERROR="TRUE"
5532         PYTHONWARNINGS="error"
5533         AC_MSG_RESULT([yes])
5534     else
5535         AC_MSG_RESULT([no])
5536     fi
5538 AC_SUBST(ENABLE_WERROR)
5539 AC_SUBST(PYTHONWARNINGS)
5541 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
5542 dnl ===================================================================
5543 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
5544 if test -z "$enable_assert_always_abort"; then
5545    if test "$ENABLE_DEBUG" = TRUE; then
5546        enable_assert_always_abort=yes
5547    else
5548        enable_assert_always_abort=no
5549    fi
5551 if test "$enable_assert_always_abort" = "yes"; then
5552     ASSERT_ALWAYS_ABORT="TRUE"
5553     AC_MSG_RESULT([yes])
5554 else
5555     ASSERT_ALWAYS_ABORT="FALSE"
5556     AC_MSG_RESULT([no])
5558 AC_SUBST(ASSERT_ALWAYS_ABORT)
5560 # Determine whether to use ooenv for the instdir installation
5561 # ===================================================================
5562 if test $_os != "WINNT" -a $_os != "Darwin"; then
5563     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
5564     if test -z "$enable_ooenv"; then
5565         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5566             enable_ooenv=yes
5567         else
5568             enable_ooenv=no
5569         fi
5570     fi
5571     if test "$enable_ooenv" = "no"; then
5572         AC_MSG_RESULT([no])
5573     else
5574         ENABLE_OOENV="TRUE"
5575         AC_MSG_RESULT([yes])
5576     fi
5578 AC_SUBST(ENABLE_OOENV)
5580 if test "$USING_X11" != TRUE; then
5581     # be sure to do not mess with unneeded stuff
5582     test_randr=no
5583     test_xrender=no
5584     test_cups=no
5585     test_dbus=no
5586     build_gstreamer_1_0=no
5587     test_kf5=no
5588     test_qt5=no
5589     test_gtk3_kde5=no
5590     enable_cairo_canvas=no
5593 if test "$OS" = "HAIKU"; then
5594     enable_cairo_canvas=yes
5595     test_kf5=yes
5598 if test "$test_kf5" = "yes" -a "$enable_kde5" = "yes"; then
5599     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!])
5600     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!"
5601     enable_kf5=yes
5604 if test "$test_kf5" = "yes"; then
5605     test_qt5=yes
5608 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
5609     if test "$enable_qt5" = "no"; then
5610         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
5611     else
5612         enable_qt5=yes
5613     fi
5616 dnl ===================================================================
5617 dnl check for cups support
5618 dnl ===================================================================
5619 ENABLE_CUPS=""
5621 if test "$enable_cups" = "no"; then
5622     test_cups=no
5625 AC_MSG_CHECKING([whether to enable CUPS support])
5626 if test "$test_cups" = "yes"; then
5627     ENABLE_CUPS="TRUE"
5628     AC_MSG_RESULT([yes])
5630     AC_MSG_CHECKING([whether cups support is present])
5631     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
5632     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
5633     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
5634         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
5635     fi
5637 else
5638     AC_MSG_RESULT([no])
5641 AC_SUBST(ENABLE_CUPS)
5643 # fontconfig checks
5644 if test "$test_fontconfig" = "yes"; then
5645     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
5646     SYSTEM_FONTCONFIG=TRUE
5647     FilterLibs "${FONTCONFIG_LIBS}"
5648     FONTCONFIG_LIBS="${filteredlibs}"
5650 AC_SUBST(FONTCONFIG_CFLAGS)
5651 AC_SUBST(FONTCONFIG_LIBS)
5652 AC_SUBST([SYSTEM_FONTCONFIG])
5654 dnl whether to find & fetch external tarballs?
5655 dnl ===================================================================
5656 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
5657    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5658        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
5659    else
5660        TARFILE_LOCATION="$LODE_HOME/ext_tar"
5661    fi
5663 if test -z "$TARFILE_LOCATION"; then
5664     if test -d "$SRC_ROOT/src" ; then
5665         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
5666         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
5667     fi
5668     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
5669 else
5670     AbsolutePath "$TARFILE_LOCATION"
5671     PathFormat "${absolute_path}"
5672     TARFILE_LOCATION="${formatted_path}"
5674 AC_SUBST(TARFILE_LOCATION)
5676 AC_MSG_CHECKING([whether we want to fetch tarballs])
5677 if test "$enable_fetch_external" != "no"; then
5678     if test "$with_all_tarballs" = "yes"; then
5679         AC_MSG_RESULT([yes, all of them])
5680         DO_FETCH_TARBALLS="ALL"
5681     else
5682         AC_MSG_RESULT([yes, if we use them])
5683         DO_FETCH_TARBALLS="TRUE"
5684     fi
5685 else
5686     AC_MSG_RESULT([no])
5687     DO_FETCH_TARBALLS=
5689 AC_SUBST(DO_FETCH_TARBALLS)
5691 AC_MSG_CHECKING([whether to build help])
5692 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
5693     BUILD_TYPE="$BUILD_TYPE HELP"
5694     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5695     case "$with_help" in
5696     "html")
5697         ENABLE_HTMLHELP=TRUE
5698         SCPDEFS="$SCPDEFS -DWITH_HELP"
5699         AC_MSG_RESULT([HTML])
5700         ;;
5701     "online")
5702         ENABLE_HTMLHELP=TRUE
5703         HELP_ONLINE=TRUE
5704         AC_MSG_RESULT([HTML])
5705         ;;
5706     yes)
5707         SCPDEFS="$SCPDEFS -DWITH_HELP"
5708         AC_MSG_RESULT([yes])
5709         ;;
5710     *)
5711         AC_MSG_ERROR([Unknown --with-help=$with_help])
5712         ;;
5713     esac
5714 else
5715     AC_MSG_RESULT([no])
5717 AC_SUBST([ENABLE_HTMLHELP])
5718 AC_SUBST([HELP_ONLINE])
5720 AC_MSG_CHECKING([whether to enable xapian-omega support for help])
5721 if test -n "$with_omindex" -a "$with_omindex" != "no" -a $_os != iOS -a $_os != Android; then
5722     BUILD_TYPE="$BUILD_TYPE HELP"
5723     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5724     case "$with_omindex" in
5725     "server")
5726         ENABLE_HTMLHELP=TRUE
5727         HELP_ONLINE=TRUE
5728         HELP_OMINDEX_PAGE=TRUE
5729         AC_MSG_RESULT([SERVER])
5730         ;;
5731     "noxap")
5732         ENABLE_HTMLHELP=TRUE
5733         HELP_ONLINE=TRUE
5734         HELP_OMINDEX_PAGE=FALSE
5735         AC_MSG_RESULT([NOXAP])
5736         ;;
5737     *)
5738         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5739         ;;
5740     esac
5741 else
5742     HELP_OMINDEX_PAGE=FALSE
5743     AC_MSG_RESULT([no])
5745 AC_SUBST([ENABLE_HTMLHELP])
5746 AC_SUBST([HELP_OMINDEX_PAGE])
5747 AC_SUBST([HELP_ONLINE])
5750 dnl Test whether to include MySpell dictionaries
5751 dnl ===================================================================
5752 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5753 if test "$with_myspell_dicts" = "yes"; then
5754     AC_MSG_RESULT([yes])
5755     WITH_MYSPELL_DICTS=TRUE
5756     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5757     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5758 else
5759     AC_MSG_RESULT([no])
5760     WITH_MYSPELL_DICTS=
5762 AC_SUBST(WITH_MYSPELL_DICTS)
5764 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5765 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5766     if test "$with_system_dicts" = yes; then
5767         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5768     fi
5769     with_system_dicts=no
5772 AC_MSG_CHECKING([whether to use dicts from external paths])
5773 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5774     AC_MSG_RESULT([yes])
5775     SYSTEM_DICTS=TRUE
5776     AC_MSG_CHECKING([for spelling dictionary directory])
5777     if test -n "$with_external_dict_dir"; then
5778         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5779     else
5780         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5781         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5782             DICT_SYSTEM_DIR=file:///usr/share/myspell
5783         fi
5784     fi
5785     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5786     AC_MSG_CHECKING([for hyphenation patterns directory])
5787     if test -n "$with_external_hyph_dir"; then
5788         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5789     else
5790         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5791     fi
5792     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5793     AC_MSG_CHECKING([for thesaurus directory])
5794     if test -n "$with_external_thes_dir"; then
5795         THES_SYSTEM_DIR=file://$with_external_thes_dir
5796     else
5797         THES_SYSTEM_DIR=file:///usr/share/mythes
5798     fi
5799     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5800 else
5801     AC_MSG_RESULT([no])
5802     SYSTEM_DICTS=
5804 AC_SUBST(SYSTEM_DICTS)
5805 AC_SUBST(DICT_SYSTEM_DIR)
5806 AC_SUBST(HYPH_SYSTEM_DIR)
5807 AC_SUBST(THES_SYSTEM_DIR)
5809 dnl ===================================================================
5810 dnl Precompiled headers.
5811 ENABLE_PCH=""
5812 AC_MSG_CHECKING([whether to enable pch feature])
5813 if test -z "$enable_pch"; then
5814     if test "$_os" = "WINNT"; then
5815         # Enabled by default on Windows.
5816         enable_pch=yes
5817     else
5818         enable_pch=no
5819     fi
5821 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5822     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5824 if test "$enable_pch" = "system"; then
5825     ENABLE_PCH="1"
5826     AC_MSG_RESULT([yes (system headers)])
5827 elif test "$enable_pch" = "base"; then
5828     ENABLE_PCH="2"
5829     AC_MSG_RESULT([yes (system and base headers)])
5830 elif test "$enable_pch" = "normal"; then
5831     ENABLE_PCH="3"
5832     AC_MSG_RESULT([yes (normal)])
5833 elif test "$enable_pch" = "full"; then
5834     ENABLE_PCH="4"
5835     AC_MSG_RESULT([yes (full)])
5836 elif test "$enable_pch" = "yes"; then
5837     # Pick a suitable default.
5838     if test "$GCC" = "yes"; then
5839         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5840         # while making the PCHs larger and rebuilds more likely.
5841         ENABLE_PCH="2"
5842         AC_MSG_RESULT([yes (system and base headers)])
5843     else
5844         # With MSVC the highest level makes a significant difference,
5845         # and it was the default when there used to be no PCH levels.
5846         ENABLE_PCH="4"
5847         AC_MSG_RESULT([yes (full)])
5848     fi
5849 elif test "$enable_pch" = "no"; then
5850     AC_MSG_RESULT([no])
5851 else
5852     AC_MSG_ERROR([Unknown value for --enable-pch])
5854 AC_SUBST(ENABLE_PCH)
5855 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5856 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5857     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5858     if test "$CCACHE_BIN" != "not found"; then
5859         AC_MSG_CHECKING([ccache version])
5860         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5861         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5862         AC_MSG_RESULT([$CCACHE_VERSION])
5863         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5864         if test "$CCACHE_NUMVER" -gt "030701"; then
5865             AC_MSG_RESULT([yes])
5866         else
5867             AC_MSG_RESULT([no (not newer than 3.7.1)])
5868             CCACHE_DEPEND_MODE=
5869         fi
5870     fi
5873 PCH_INSTANTIATE_TEMPLATES=
5874 if test -n "$ENABLE_PCH"; then
5875     AC_MSG_CHECKING([whether $CC supports -fpch-instantiate-templates])
5876     save_CFLAGS=$CFLAGS
5877     CFLAGS="$CFLAGS -Werror -fpch-instantiate-templates"
5878     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_INSTANTIATE_TEMPLATES="-fpch-instantiate-templates" ],[])
5879     CFLAGS=$save_CFLAGS
5880     if test -n "$PCH_INSTANTIATE_TEMPLATES"; then
5881         AC_MSG_RESULT(yes)
5882     else
5883         AC_MSG_RESULT(no)
5884     fi
5886 AC_SUBST(PCH_INSTANTIATE_TEMPLATES)
5888 BUILDING_PCH_WITH_OBJ=
5889 if test -n "$ENABLE_PCH"; then
5890     AC_MSG_CHECKING([whether $CC supports -Xclang -building-pch-with-obj])
5891     save_CFLAGS=$CFLAGS
5892     CFLAGS="$CFLAGS -Werror -Xclang -building-pch-with-obj"
5893     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ BUILDING_PCH_WITH_OBJ="-Xclang -building-pch-with-obj" ],[])
5894     CFLAGS=$save_CFLAGS
5895     if test -n "$BUILDING_PCH_WITH_OBJ"; then
5896         AC_MSG_RESULT(yes)
5897     else
5898         AC_MSG_RESULT(no)
5899     fi
5901 AC_SUBST(BUILDING_PCH_WITH_OBJ)
5903 PCH_CODEGEN=
5904 PCH_NO_CODEGEN=
5905 if test -n "$BUILDING_PCH_WITH_OBJ"; then
5906     AC_MSG_CHECKING([whether $CC supports -fpch-codegen])
5907     save_CFLAGS=$CFLAGS
5908     CFLAGS="$CFLAGS -Werror -fpch-codegen"
5909     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
5910         [
5911         PCH_CODEGEN="-fpch-codegen"
5912         PCH_NO_CODEGEN="-fno-pch-codegen"
5913         ],[])
5914     CFLAGS=$save_CFLAGS
5915     if test -n "$PCH_CODEGEN"; then
5916         AC_MSG_RESULT(yes)
5917     else
5918         AC_MSG_RESULT(no)
5919     fi
5921 AC_SUBST(PCH_CODEGEN)
5922 AC_SUBST(PCH_NO_CODEGEN)
5923 PCH_DEBUGINFO=
5924 if test -n "$BUILDING_PCH_WITH_OBJ"; then
5925     AC_MSG_CHECKING([whether $CC supports -fpch-debuginfo])
5926     save_CFLAGS=$CFLAGS
5927     CFLAGS="$CFLAGS -Werror -fpch-debuginfo"
5928     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_DEBUGINFO="-fpch-debuginfo" ],[])
5929     CFLAGS=$save_CFLAGS
5930     if test -n "$PCH_DEBUGINFO"; then
5931         AC_MSG_RESULT(yes)
5932     else
5933         AC_MSG_RESULT(no)
5934     fi
5936 AC_SUBST(PCH_DEBUGINFO)
5938 TAB=`printf '\t'`
5940 AC_MSG_CHECKING([the GNU Make version])
5941 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5942 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5943 if test "$_make_longver" -ge "038200"; then
5944     AC_MSG_RESULT([$GNUMAKE $_make_version])
5946 elif test "$_make_longver" -ge "038100"; then
5947     if test "$build_os" = "cygwin"; then
5948         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5949     fi
5950     AC_MSG_RESULT([$GNUMAKE $_make_version])
5952     dnl ===================================================================
5953     dnl Search all the common names for sha1sum
5954     dnl ===================================================================
5955     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5956     if test -z "$SHA1SUM"; then
5957         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5958     elif test "$SHA1SUM" = "openssl"; then
5959         SHA1SUM="openssl sha1"
5960     fi
5961     AC_MSG_CHECKING([for GNU Make bug 20033])
5962     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5963     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5964 A := \$(wildcard *.a)
5966 .PHONY: all
5967 all: \$(A:.a=.b)
5968 <TAB>@echo survived bug20033.
5970 .PHONY: setup
5971 setup:
5972 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5974 define d1
5975 @echo lala \$(1)
5976 @sleep 1
5977 endef
5979 define d2
5980 @echo tyty \$(1)
5981 @sleep 1
5982 endef
5984 %.b : %.a
5985 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5986 <TAB>\$(call d1,\$(CHECKSUM)),\
5987 <TAB>\$(call d2,\$(CHECKSUM)))
5989     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5990         no_parallelism_make="YES"
5991         AC_MSG_RESULT([yes, disable parallelism])
5992     else
5993         AC_MSG_RESULT([no, keep parallelism enabled])
5994     fi
5995     rm -rf $TESTGMAKEBUG20033
5996 else
5997     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
6000 # find if gnumake support file function
6001 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
6002 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
6003 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6004     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
6006 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
6007 \$(file >test.txt,Success )
6009 .PHONY: all
6010 all:
6011 <TAB>@cat test.txt
6014 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
6015 if test -f $TESTGMAKEFILEFUNC/test.txt; then
6016     HAVE_GNUMAKE_FILE_FUNC=TRUE
6017     AC_MSG_RESULT([yes])
6018 else
6019     AC_MSG_RESULT([no])
6021 rm -rf $TESTGMAKEFILEFUNC
6022 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
6023 AC_SUBST(GNUMAKE_WIN_NATIVE)
6025 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
6026 STALE_MAKE=
6027 if test "$_make_ver_check" = ""; then
6028    STALE_MAKE=TRUE
6031 HAVE_LD_HASH_STYLE=FALSE
6032 WITH_LINKER_HASH_STYLE=
6033 AC_MSG_CHECKING([for --hash-style gcc linker support])
6034 if test "$GCC" = "yes"; then
6035     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
6036         hash_styles="gnu sysv"
6037     elif test "$with_linker_hash_style" = "no"; then
6038         hash_styles=
6039     else
6040         hash_styles="$with_linker_hash_style"
6041     fi
6043     for hash_style in $hash_styles; do
6044         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
6045         hash_style_ldflags_save=$LDFLAGS
6046         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
6048         AC_RUN_IFELSE([AC_LANG_PROGRAM(
6049             [
6050 #include <stdio.h>
6051             ],[
6052 printf ("");
6053             ])],
6054             [
6055                   HAVE_LD_HASH_STYLE=TRUE
6056                   WITH_LINKER_HASH_STYLE=$hash_style
6057             ],
6058             [HAVE_LD_HASH_STYLE=FALSE],
6059             [HAVE_LD_HASH_STYLE=FALSE])
6060         LDFLAGS=$hash_style_ldflags_save
6061     done
6063     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
6064         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
6065     else
6066         AC_MSG_RESULT( no )
6067     fi
6068     LDFLAGS=$hash_style_ldflags_save
6069 else
6070     AC_MSG_RESULT( no )
6072 AC_SUBST(HAVE_LD_HASH_STYLE)
6073 AC_SUBST(WITH_LINKER_HASH_STYLE)
6075 dnl ===================================================================
6076 dnl Check whether there's a Perl version available.
6077 dnl ===================================================================
6078 if test -z "$with_perl_home"; then
6079     AC_PATH_PROG(PERL, perl)
6080 else
6081     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
6082     _perl_path="$with_perl_home/bin/perl"
6083     if test -x "$_perl_path"; then
6084         PERL=$_perl_path
6085     else
6086         AC_MSG_ERROR([$_perl_path not found])
6087     fi
6090 dnl ===================================================================
6091 dnl Testing for Perl version 5 or greater.
6092 dnl $] is the Perl version variable, it is returned as an integer
6093 dnl ===================================================================
6094 if test "$PERL"; then
6095     AC_MSG_CHECKING([the Perl version])
6096     ${PERL} -e "exit($]);"
6097     _perl_version=$?
6098     if test "$_perl_version" -lt 5; then
6099         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
6100     fi
6101     AC_MSG_RESULT([Perl $_perl_version])
6102 else
6103     AC_MSG_ERROR([Perl not found, install Perl 5])
6106 dnl ===================================================================
6107 dnl Testing for required Perl modules
6108 dnl ===================================================================
6110 AC_MSG_CHECKING([for required Perl modules])
6111 perl_use_string="use Cwd ; use Digest::MD5"
6112 if test "$_os" = "WINNT"; then
6113     if test -n "$PKGFORMAT"; then
6114         for i in $PKGFORMAT; do
6115             case "$i" in
6116             msi)
6117                 # for getting fonts versions to use in MSI
6118                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
6119                 ;;
6120             esac
6121         done
6122     fi
6124 if test "$with_system_hsqldb" = "yes"; then
6125     perl_use_string="$perl_use_string ; use Archive::Zip"
6127 if test "$enable_openssl" = "yes" -a "$with_system_openssl" != "yes"; then
6128     # OpenSSL needs that to build
6129     perl_use_string="$perl_use_string ; use FindBin"
6131 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
6132     AC_MSG_RESULT([all modules found])
6133 else
6134     AC_MSG_RESULT([failed to find some modules])
6135     # Find out which modules are missing.
6136     for i in $perl_use_string; do
6137         if test "$i" != "use" -a "$i" != ";"; then
6138             if ! $PERL -e "use $i;">/dev/null 2>&1; then
6139                 missing_perl_modules="$missing_perl_modules $i"
6140             fi
6141         fi
6142     done
6143     AC_MSG_ERROR([
6144     The missing Perl modules are: $missing_perl_modules
6145     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
6148 dnl ===================================================================
6149 dnl Check for pkg-config
6150 dnl ===================================================================
6151 if test "$_os" != "WINNT"; then
6152     PKG_PROG_PKG_CONFIG
6155 if test "$_os" != "WINNT"; then
6157     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
6158     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
6159     # explicitly. Or put /path/to/compiler in PATH yourself.
6161     # Use wrappers for LTO
6162     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
6163         AC_CHECK_TOOL(AR,gcc-ar)
6164         AC_CHECK_TOOL(NM,gcc-nm)
6165         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
6166     else
6167         AC_CHECK_TOOL(AR,ar)
6168         AC_CHECK_TOOL(NM,nm)
6169         AC_CHECK_TOOL(RANLIB,ranlib)
6170     fi
6171     AC_CHECK_TOOL(OBJDUMP,objdump)
6172     AC_CHECK_TOOL(READELF,readelf)
6173     AC_CHECK_TOOL(STRIP,strip)
6174     if test "$_os" = "WINNT"; then
6175         AC_CHECK_TOOL(DLLTOOL,dlltool)
6176         AC_CHECK_TOOL(WINDRES,windres)
6177     fi
6179 AC_SUBST(AR)
6180 AC_SUBST(DLLTOOL)
6181 AC_SUBST(LD)
6182 AC_SUBST(NM)
6183 AC_SUBST(OBJDUMP)
6184 AC_SUBST(PKG_CONFIG)
6185 AC_SUBST(PKG_CONFIG_PATH)
6186 AC_SUBST(PKG_CONFIG_LIBDIR)
6187 AC_SUBST(RANLIB)
6188 AC_SUBST(READELF)
6189 AC_SUBST(STRIP)
6190 AC_SUBST(WINDRES)
6192 dnl ===================================================================
6193 dnl pkg-config checks on macOS
6194 dnl ===================================================================
6196 if test $_os = Darwin; then
6197     AC_MSG_CHECKING([for bogus pkg-config])
6198     if test -n "$PKG_CONFIG"; then
6199         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
6200             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
6201         else
6202             if test "$enable_bogus_pkg_config" = "yes"; then
6203                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
6204             else
6205                 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.])
6206             fi
6207         fi
6208     else
6209         AC_MSG_RESULT([no, good])
6210     fi
6213 find_csc()
6215     # Return value: $csctest
6217     unset csctest
6219     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
6220     if test -n "$regvalue"; then
6221         csctest=$regvalue
6222         return
6223     fi
6226 find_al()
6228     # Return value: $altest
6230     unset altest
6232     # We need this check to detect 4.6.1 or above.
6233     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
6234         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
6235         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
6236             altest=$regvalue
6237             return
6238         fi
6239     done
6241     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
6242         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
6243         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
6244             altest=$regvalue
6245             return
6246         fi
6247     done
6250 find_dotnetsdk46()
6252     unset frametest
6254     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
6255         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
6256         if test -n "$regvalue"; then
6257             frametest=$regvalue
6258             return
6259         fi
6260     done
6263 find_winsdk_version()
6265     # Args: $1 : SDK version as in "8.0", "8.1A" etc
6266     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
6268     unset winsdktest winsdkbinsubdir winsdklibsubdir
6270     case "$1" in
6271     8.0|8.0A)
6272         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
6273         if test -n "$regvalue"; then
6274             winsdktest=$regvalue
6275             winsdklibsubdir=win8
6276             return
6277         fi
6278         ;;
6279     8.1|8.1A)
6280         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
6281         if test -n "$regvalue"; then
6282             winsdktest=$regvalue
6283             winsdklibsubdir=winv6.3
6284             return
6285         fi
6286         ;;
6287     10.0)
6288         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
6289         if test -n "$regvalue"; then
6290             winsdktest=$regvalue
6291             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
6292             if test -n "$regvalue"; then
6293                 winsdkbinsubdir="$regvalue".0
6294                 winsdklibsubdir=$winsdkbinsubdir
6295                 local tmppath="$winsdktest\\Include\\$winsdklibsubdir"
6296                 local tmppath_unix=$(cygpath -u "$tmppath")
6297                 # test exist the SDK path
6298                 if test -d "$tmppath_unix"; then
6299                    # when path is convertible to a short path then path is okay
6300                    cygpath -d "$tmppath" >/dev/null 2>&1
6301                    if test $? -ne 0; then
6302                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
6303                    fi
6304                 else
6305                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
6306                 fi
6307             fi
6308             return
6309         fi
6310         ;;
6311     esac
6314 find_winsdk()
6316     # Return value: From find_winsdk_version
6318     unset winsdktest
6320     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
6321         find_winsdk_version $ver
6322         if test -n "$winsdktest"; then
6323             return
6324         fi
6325     done
6328 find_msms()
6330     # Return value: $msmdir
6332     AC_MSG_CHECKING([for MSVC merge modules directory])
6333     local my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
6334     local my_msm_dir
6336     case "$VCVER" in
6337         160)
6338         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
6339         ;;
6340     esac
6341     for f in $my_msm_files; do
6342         echo "$as_me:$LINENO: searching for $f" >&5
6343     done
6345     msmdir=
6346     for ver in 14.0 15.0; do
6347         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
6348         if test -n "$regvalue"; then
6349             for f in ${my_msm_files}; do
6350                 if test -e "$regvalue/${f}"; then
6351                     msmdir=$regvalue
6352                     break
6353                 fi
6354             done
6355         fi
6356     done
6357     dnl Is the following fallback really necessary, or was it added in response
6358     dnl to never having started Visual Studio on a given machine, so the
6359     dnl registry keys checked above had presumably not yet been created?
6360     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
6361     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
6362     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
6363     dnl expanding to "C:\Program Files\Common Files"), which would need
6364     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
6365     dnl obtain its value from cygwin:
6366     if test -z "$msmdir"; then
6367         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
6368         for f in ${my_msm_files}; do
6369             if test -e "$my_msm_dir/${f}"; then
6370                 msmdir=$my_msm_dir
6371             fi
6372         done
6373     fi
6375     dnl Starting from MSVC 15.0, merge modules are located in different directory
6376     case "$VCVER" in
6377     160)
6378         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6379             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
6380             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
6381             for f in ${my_msm_files}; do
6382                 if test -e "$my_msm_dir/${f}"; then
6383                     msmdir=$my_msm_dir
6384                     break
6385                 fi
6386             done
6387         done
6388         ;;
6389     esac
6391     if test -n "$msmdir"; then
6392         msmdir=`cygpath -m "$msmdir"`
6393         AC_MSG_RESULT([$msmdir])
6394     else
6395         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
6396             AC_MSG_FAILURE([not found])
6397         else
6398             AC_MSG_WARN([not found (check config.log)])
6399             add_warning "MSM none of ${my_msm_files} found"
6400         fi
6401     fi
6404 find_msvc_x64_dlls()
6406     # Return value: $msvcdllpath, $msvcdlls
6408     AC_MSG_CHECKING([for MSVC x64 DLL path])
6409     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
6410     case "$VCVER" in
6411     160)
6412         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6413             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
6414             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
6415                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
6416                 break
6417             fi
6418             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
6419             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
6420                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
6421                 break
6422             fi
6423         done
6424         ;;
6425     esac
6426     AC_MSG_RESULT([$msvcdllpath])
6427     AC_MSG_CHECKING([for MSVC x64 DLLs])
6428     msvcdlls="msvcp140.dll vcruntime140.dll"
6429     for dll in $msvcdlls; do
6430         if ! test -f "$msvcdllpath/$dll"; then
6431             AC_MSG_FAILURE([missing $dll])
6432         fi
6433     done
6434     AC_MSG_RESULT([found all ($msvcdlls)])
6437 dnl =========================================
6438 dnl Check for the Windows  SDK.
6439 dnl =========================================
6440 if test "$_os" = "WINNT"; then
6441     AC_MSG_CHECKING([for Windows SDK])
6442     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6443         find_winsdk
6444         WINDOWS_SDK_HOME=$winsdktest
6446         # normalize if found
6447         if test -n "$WINDOWS_SDK_HOME"; then
6448             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
6449             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
6450         fi
6452         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
6453     fi
6455     if test -n "$WINDOWS_SDK_HOME"; then
6456         # Remove a possible trailing backslash
6457         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
6459         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
6460              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
6461              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
6462             have_windows_sdk_headers=yes
6463         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
6464              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
6465              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
6466             have_windows_sdk_headers=yes
6467         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
6468              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
6469              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
6470             have_windows_sdk_headers=yes
6471         else
6472             have_windows_sdk_headers=no
6473         fi
6475         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
6476             have_windows_sdk_libs=yes
6477         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/user32.lib"; then
6478             have_windows_sdk_libs=yes
6479         else
6480             have_windows_sdk_libs=no
6481         fi
6483         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
6484             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
6485 the  Windows SDK are installed.])
6486         fi
6487     fi
6489     if test -z "$WINDOWS_SDK_HOME"; then
6490         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
6491     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
6492         WINDOWS_SDK_VERSION=80
6493         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
6494     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
6495         WINDOWS_SDK_VERSION=81
6496         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
6497     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
6498         WINDOWS_SDK_VERSION=10
6499         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
6500     else
6501         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
6502     fi
6503     PathFormat "$WINDOWS_SDK_HOME"
6504     WINDOWS_SDK_HOME="$formatted_path"
6505     WINDOWS_SDK_HOME_unix="$formatted_path_unix"
6506     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6507         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
6508         if test -d "$WINDOWS_SDK_HOME/include/um"; then
6509             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
6510         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
6511             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
6512         fi
6513     fi
6515     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
6516     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
6517     dnl but not in v8.0), so allow this to be overridden with a
6518     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
6519     dnl and configuration error if no WiLangId.vbs is found would arguably be
6520     dnl better, but I do not know under which conditions exactly it is needed by
6521     dnl msiglobal.pm:
6522     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
6523         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
6524         WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6525         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6526             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WIN_BUILD_ARCH}/WiLangId.vbs"
6527             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6528         fi
6529         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6530             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WIN_BUILD_ARCH/WiLangId.vbs
6531             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6532         fi
6533         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6534             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WIN_BUILD_ARCH/WiLangId.vbs")
6535             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6536         fi
6537     fi
6538     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
6539         if test -n "$with_package_format" -a "$with_package_format" != no; then
6540             for i in "$with_package_format"; do
6541                 if test "$i" = "msi"; then
6542                     if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6543                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
6544                     fi
6545                 fi
6546             done
6547         fi
6548     fi
6550 AC_SUBST(WINDOWS_SDK_HOME)
6551 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
6552 AC_SUBST(WINDOWS_SDK_VERSION)
6553 AC_SUBST(WINDOWS_SDK_WILANGID)
6555 if test "$build_os" = "cygwin"; then
6556     dnl Check midl.exe; this being the first check for a tool in the SDK bin
6557     dnl dir, it also determines that dir's path w/o an arch segment if any,
6558     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
6559     AC_MSG_CHECKING([for midl.exe])
6561     find_winsdk
6562     if test -n "$winsdkbinsubdir" \
6563         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/midl.exe"
6564     then
6565         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH
6566         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
6567     elif test -f "$winsdktest/Bin/$WIN_BUILD_ARCH/midl.exe"; then
6568         MIDL_PATH=$winsdktest/Bin/$WIN_BUILD_ARCH
6569         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
6570     elif test -f "$winsdktest/Bin/midl.exe"; then
6571         MIDL_PATH=$winsdktest/Bin
6572         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
6573     fi
6574     if test ! -f "$MIDL_PATH/midl.exe"; then
6575         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WIN_BUILD_ARCH, Windows SDK installation broken?])
6576     else
6577         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
6578     fi
6580     # Convert to posix path with 8.3 filename restrictions ( No spaces )
6581     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
6583     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
6584          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
6585          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
6586          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
6587     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
6588          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
6589          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6590          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
6591     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
6592          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
6593          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6594          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
6595     else
6596         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
6597     fi
6599     dnl Check csc.exe
6600     AC_MSG_CHECKING([for csc.exe])
6601     find_csc
6602     if test -f "$csctest/csc.exe"; then
6603         CSC_PATH="$csctest"
6604     fi
6605     if test ! -f "$CSC_PATH/csc.exe"; then
6606         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
6607     else
6608         AC_MSG_RESULT([$CSC_PATH/csc.exe])
6609     fi
6611     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
6613     dnl Check al.exe
6614     AC_MSG_CHECKING([for al.exe])
6615     find_winsdk
6616     if test -n "$winsdkbinsubdir" \
6617         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/al.exe"
6618     then
6619         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH"
6620     elif test -f "$winsdktest/Bin/$WIN_BUILD_ARCH/al.exe"; then
6621         AL_PATH="$winsdktest/Bin/$WIN_BUILD_ARCH"
6622     elif test -f "$winsdktest/Bin/al.exe"; then
6623         AL_PATH="$winsdktest/Bin"
6624     fi
6626     if test -z "$AL_PATH"; then
6627         find_al
6628         if test -f "$altest/bin/al.exe"; then
6629             AL_PATH="$altest/bin"
6630         elif test -f "$altest/al.exe"; then
6631             AL_PATH="$altest"
6632         fi
6633     fi
6634     if test ! -f "$AL_PATH/al.exe"; then
6635         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
6636     else
6637         AC_MSG_RESULT([$AL_PATH/al.exe])
6638     fi
6640     AL_PATH=`win_short_path_for_make "$AL_PATH"`
6642     dnl Check mscoree.lib / .NET Framework dir
6643     AC_MSG_CHECKING(.NET Framework)
6644     find_dotnetsdk46
6645     PathFormat "$frametest"
6646     frametest="$formatted_path"
6647     if test -f "$frametest/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6648         DOTNET_FRAMEWORK_HOME="$frametest"
6649     else
6650         find_winsdk
6651         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6652             DOTNET_FRAMEWORK_HOME="$winsdktest"
6653         fi
6654     fi
6655     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
6656         AC_MSG_ERROR([mscoree.lib not found])
6657     fi
6658     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
6660     PathFormat "$MIDL_PATH"
6661     MIDL_PATH="$formatted_path"
6663     PathFormat "$AL_PATH"
6664     AL_PATH="$formatted_path"
6666     PathFormat "$DOTNET_FRAMEWORK_HOME"
6667     DOTNET_FRAMEWORK_HOME="$formatted_path"
6669     PathFormat "$CSC_PATH"
6670     CSC_PATH="$formatted_path"
6673 dnl ===================================================================
6674 dnl Testing for C++ compiler and version...
6675 dnl ===================================================================
6677 if test "$_os" != "WINNT"; then
6678     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
6679     save_CXXFLAGS=$CXXFLAGS
6680     AC_PROG_CXX
6681     CXXFLAGS=$save_CXXFLAGS
6682     if test -z "$CXX_BASE"; then
6683         CXX_BASE=`first_arg_basename "$CXX"`
6684     fi
6687 dnl check for GNU C++ compiler version
6688 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
6689     AC_MSG_CHECKING([the GNU C++ compiler version])
6691     _gpp_version=`$CXX -dumpversion`
6692     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
6694     if test "$_gpp_majmin" -lt "700"; then
6695         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
6696     else
6697         AC_MSG_RESULT([ok (g++ $_gpp_version)])
6698     fi
6700     dnl see https://code.google.com/p/android/issues/detail?id=41770
6701         glibcxx_threads=no
6702         AC_LANG_PUSH([C++])
6703         AC_REQUIRE_CPP
6704         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
6705         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
6706             #include <bits/c++config.h>]],[[
6707             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
6708             && !defined(_GLIBCXX__PTHREADS) \
6709             && !defined(_GLIBCXX_HAS_GTHREADS)
6710             choke me
6711             #endif
6712         ]])],[AC_MSG_RESULT([yes])
6713         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
6714         AC_LANG_POP([C++])
6715         if test $glibcxx_threads = yes; then
6716             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
6717         fi
6719 AC_SUBST(BOOST_CXXFLAGS)
6722 # prefx CXX with ccache if needed
6724 UNCACHED_CXX="$CXX"
6725 if test "$CCACHE" != ""; then
6726     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
6727     AC_LANG_PUSH([C++])
6728     save_CXXFLAGS=$CXXFLAGS
6729     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
6730     dnl an empty program will do, we're checking the compiler flags
6731     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
6732                       [use_ccache=yes], [use_ccache=no])
6733     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
6734         AC_MSG_RESULT([yes])
6735     else
6736         CXX="$CCACHE $CXX"
6737         CXX_BASE="ccache $CXX_BASE"
6738         AC_MSG_RESULT([no])
6739     fi
6740     CXXFLAGS=$save_CXXFLAGS
6741     AC_LANG_POP([C++])
6744 dnl ===================================================================
6745 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
6746 dnl ===================================================================
6748 if test "$_os" != "WINNT"; then
6749     AC_PROG_CXXCPP
6751     dnl Check whether there's a C pre-processor.
6752     AC_PROG_CPP
6756 dnl ===================================================================
6757 dnl Find integral type sizes and alignments
6758 dnl ===================================================================
6760 if test "$_os" != "WINNT"; then
6762     AC_CHECK_SIZEOF(long)
6763     AC_CHECK_SIZEOF(short)
6764     AC_CHECK_SIZEOF(int)
6765     AC_CHECK_SIZEOF(long long)
6766     AC_CHECK_SIZEOF(double)
6767     AC_CHECK_SIZEOF(void*)
6769     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
6770     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
6771     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
6772     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
6773     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6775     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6776     m4_pattern_allow([AC_CHECK_ALIGNOF])
6777     m4_ifdef([AC_CHECK_ALIGNOF],
6778         [
6779             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6780             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6781             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6782             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6783         ],
6784         [
6785             case "$_os-$host_cpu" in
6786             Linux-i686)
6787                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6788                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6789                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6790                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6791                 ;;
6792             Linux-x86_64)
6793                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6794                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6795                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6796                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6797                 ;;
6798             *)
6799                 if test -z "$ac_cv_alignof_short" -o \
6800                         -z "$ac_cv_alignof_int" -o \
6801                         -z "$ac_cv_alignof_long" -o \
6802                         -z "$ac_cv_alignof_double"; then
6803                    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.])
6804                 fi
6805                 ;;
6806             esac
6807         ])
6809     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6810     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6811     if test $ac_cv_sizeof_long -eq 8; then
6812         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6813     elif test $ac_cv_sizeof_double -eq 8; then
6814         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6815     else
6816         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6817     fi
6819     dnl Check for large file support
6820     AC_SYS_LARGEFILE
6821     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6822         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6823     fi
6824     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6825         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6826     fi
6827 else
6828     # Hardcode for MSVC
6829     SAL_TYPES_SIZEOFSHORT=2
6830     SAL_TYPES_SIZEOFINT=4
6831     SAL_TYPES_SIZEOFLONG=4
6832     SAL_TYPES_SIZEOFLONGLONG=8
6833     if test $WIN_HOST_BITS -eq 32; then
6834         SAL_TYPES_SIZEOFPOINTER=4
6835     else
6836         SAL_TYPES_SIZEOFPOINTER=8
6837     fi
6838     SAL_TYPES_ALIGNMENT2=2
6839     SAL_TYPES_ALIGNMENT4=4
6840     SAL_TYPES_ALIGNMENT8=8
6841     LFS_CFLAGS=''
6843 AC_SUBST(LFS_CFLAGS)
6845 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6846 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6847 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6848 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6849 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6850 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6851 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6852 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6854 dnl ===================================================================
6855 dnl Check whether to enable runtime optimizations
6856 dnl ===================================================================
6857 ENABLE_RUNTIME_OPTIMIZATIONS=
6858 AC_MSG_CHECKING([whether to enable runtime optimizations])
6859 if test -z "$enable_runtime_optimizations"; then
6860     for i in $CC; do
6861         case $i in
6862         -fsanitize=*)
6863             enable_runtime_optimizations=no
6864             break
6865             ;;
6866         esac
6867     done
6869 if test "$enable_runtime_optimizations" != no; then
6870     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6871     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6872     AC_MSG_RESULT([yes])
6873 else
6874     AC_MSG_RESULT([no])
6876 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6878 dnl ===================================================================
6879 dnl Check if valgrind headers are available
6880 dnl ===================================================================
6881 ENABLE_VALGRIND=
6882 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6883     prev_cppflags=$CPPFLAGS
6884     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6885     # or where does it come from?
6886     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6887     AC_CHECK_HEADER([valgrind/valgrind.h],
6888         [ENABLE_VALGRIND=TRUE])
6889     CPPFLAGS=$prev_cppflags
6891 AC_SUBST([ENABLE_VALGRIND])
6892 if test -z "$ENABLE_VALGRIND"; then
6893     if test "$with_valgrind" = yes; then
6894         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6895     fi
6896     VALGRIND_CFLAGS=
6898 AC_SUBST([VALGRIND_CFLAGS])
6901 dnl ===================================================================
6902 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6903 dnl ===================================================================
6905 # We need at least the sys/sdt.h include header.
6906 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6907 if test "$SDT_H_FOUND" = "TRUE"; then
6908     # Found sys/sdt.h header, now make sure the c++ compiler works.
6909     # Old g++ versions had problems with probes in constructors/destructors.
6910     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6911     AC_LANG_PUSH([C++])
6912     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6913     #include <sys/sdt.h>
6914     class ProbeClass
6915     {
6916     private:
6917       int& ref;
6918       const char *name;
6920     public:
6921       ProbeClass(int& v, const char *n) : ref(v), name(n)
6922       {
6923         DTRACE_PROBE2(_test_, cons, name, ref);
6924       }
6926       void method(int min)
6927       {
6928         DTRACE_PROBE3(_test_, meth, name, ref, min);
6929         ref -= min;
6930       }
6932       ~ProbeClass()
6933       {
6934         DTRACE_PROBE2(_test_, dest, name, ref);
6935       }
6936     };
6937     ]],[[
6938     int i = 64;
6939     DTRACE_PROBE1(_test_, call, i);
6940     ProbeClass inst = ProbeClass(i, "call");
6941     inst.method(24);
6942     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6943           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6944     AC_LANG_POP([C++])
6946 AC_CONFIG_HEADERS([config_host/config_probes.h])
6948 dnl ===================================================================
6949 dnl GCC features
6950 dnl ===================================================================
6951 HAVE_GCC_STACK_CLASH_PROTECTION=
6952 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6953     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
6954     save_CFLAGS=$CFLAGS
6955     CFLAGS="$CFLAGS -Werror -fstack-clash-protection"
6956     AC_LINK_IFELSE(
6957         [AC_LANG_PROGRAM(, [[return 0;]])],
6958         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
6959         [AC_MSG_RESULT([no])])
6960     CFLAGS=$save_CFLAGS
6962     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6963     save_CFLAGS=$CFLAGS
6964     CFLAGS="$CFLAGS -Werror -mno-avx"
6965     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6966     CFLAGS=$save_CFLAGS
6967     if test "$HAVE_GCC_AVX" = "TRUE"; then
6968         AC_MSG_RESULT([yes])
6969     else
6970         AC_MSG_RESULT([no])
6971     fi
6973     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
6974     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6975     int v = 0;
6976     if (__sync_add_and_fetch(&v, 1) != 1 ||
6977         __sync_sub_and_fetch(&v, 1) != 0)
6978         return 1;
6979     __sync_synchronize();
6980     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6981         v != 1)
6982         return 1;
6983     return 0;
6984 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6985     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6986         AC_MSG_RESULT([yes])
6987         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6988     else
6989         AC_MSG_RESULT([no])
6990     fi
6992     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
6993     AC_LANG_PUSH([C++])
6994     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6995             #include <cstddef>
6996             #include <cxxabi.h>
6997             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6998         ])], [
6999             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
7000             AC_MSG_RESULT([yes])
7001         ], [AC_MSG_RESULT([no])])
7002     AC_LANG_POP([C++])
7004     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
7005     AC_LANG_PUSH([C++])
7006     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7007             #include <cstddef>
7008             #include <cxxabi.h>
7009             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
7010         ])], [
7011             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
7012             AC_MSG_RESULT([yes])
7013         ], [AC_MSG_RESULT([no])])
7014     AC_LANG_POP([C++])
7016     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
7017     AC_LANG_PUSH([C++])
7018     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7019             #include <cxxabi.h>
7020             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
7021         ])], [
7022             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
7023             AC_MSG_RESULT([yes])
7024         ], [AC_MSG_RESULT([no])])
7025     AC_LANG_POP([C++])
7027     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
7028     AC_LANG_PUSH([C++])
7029     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7030             #include <cstddef>
7031             #include <cxxabi.h>
7032             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
7033         ])], [
7034             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
7035             AC_MSG_RESULT([yes])
7036         ], [AC_MSG_RESULT([no])])
7037     AC_LANG_POP([C++])
7039     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exception in cxxabi.h])
7040     AC_LANG_PUSH([C++])
7041     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7042             #include <cstddef>
7043             #include <cxxabi.h>
7044             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exception); }
7045         ])], [
7046             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTION],[1])
7047             AC_MSG_RESULT([yes])
7048         ], [AC_MSG_RESULT([no])])
7049     AC_LANG_POP([C++])
7051     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
7052     AC_LANG_PUSH([C++])
7053     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7054             #include <cxxabi.h>
7055             void * f() { return __cxxabiv1::__cxa_get_globals(); }
7056         ])], [
7057             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
7058             AC_MSG_RESULT([yes])
7059         ], [AC_MSG_RESULT([no])])
7060     AC_LANG_POP([C++])
7062     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
7063     AC_LANG_PUSH([C++])
7064     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7065             #include <cxxabi.h>
7066             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
7067         ])], [
7068             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
7069             AC_MSG_RESULT([yes])
7070         ], [AC_MSG_RESULT([no])])
7071     AC_LANG_POP([C++])
7073     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
7074     AC_LANG_PUSH([C++])
7075     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7076             #include <cxxabi.h>
7077             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
7078         ])], [
7079             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
7080             AC_MSG_RESULT([yes])
7081         ], [AC_MSG_RESULT([no])])
7082     AC_LANG_POP([C++])
7084     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
7085     AC_LANG_PUSH([C++])
7086     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7087             #include <cstddef>
7088             #include <cxxabi.h>
7089             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
7090         ])], [
7091             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
7092             AC_MSG_RESULT([yes])
7093         ], [AC_MSG_RESULT([no])])
7094     AC_LANG_POP([C++])
7096     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
7097     AC_LANG_PUSH([C++])
7098     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7099             #include <cstddef>
7100             #include <cxxabi.h>
7101             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
7102         ])], [
7103             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
7104             AC_MSG_RESULT([yes])
7105         ], [AC_MSG_RESULT([no])])
7106     AC_LANG_POP([C++])
7109 AC_SUBST(HAVE_GCC_AVX)
7110 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
7111 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
7113 dnl ===================================================================
7114 dnl Identify the C++ library
7115 dnl ===================================================================
7117 AC_MSG_CHECKING([what the C++ library is])
7118 AC_LANG_PUSH([C++])
7119 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7120 #include <utility>
7121 #ifndef __GLIBCXX__
7122 foo bar
7123 #endif
7124 ]])],
7125     [CPP_LIBRARY=GLIBCXX
7126      cpp_library_name="GNU libstdc++"
7127     ],
7128     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7129 #include <utility>
7130 #ifndef _LIBCPP_VERSION
7131 foo bar
7132 #endif
7133 ]])],
7134     [CPP_LIBRARY=LIBCPP
7135      cpp_library_name="LLVM libc++"
7136      AC_DEFINE([HAVE_LIBCXX])
7137     ],
7138     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7139 #include <utility>
7140 #ifndef _MSC_VER
7141 foo bar
7142 #endif
7143 ]])],
7144     [CPP_LIBRARY=MSVCRT
7145      cpp_library_name="Microsoft"
7146     ],
7147     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
7148 AC_MSG_RESULT([$cpp_library_name])
7149 AC_LANG_POP([C++])
7151 dnl ===================================================================
7152 dnl Check for gperf
7153 dnl ===================================================================
7154 AC_PATH_PROG(GPERF, gperf)
7155 if test -z "$GPERF"; then
7156     AC_MSG_ERROR([gperf not found but needed. Install it.])
7158 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7159     GPERF=`cygpath -m $GPERF`
7161 AC_MSG_CHECKING([whether gperf is new enough])
7162 my_gperf_ver1=$($GPERF --version | head -n 1)
7163 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
7164 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
7165 if test "$my_gperf_ver3" -ge 301; then
7166     AC_MSG_RESULT([yes ($my_gperf_ver2)])
7167 else
7168     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
7170 AC_SUBST(GPERF)
7172 dnl ===================================================================
7173 dnl Check for system libcmis
7174 dnl ===================================================================
7175 # libcmis requires curl and we can't build curl for iOS
7176 if test "$test_cmis" = "yes" -a "$enable_cmis" = "yes"; then
7177     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
7178     ENABLE_LIBCMIS=TRUE
7179 else
7180     ENABLE_LIBCMIS=
7182 AC_SUBST(ENABLE_LIBCMIS)
7184 dnl ===================================================================
7185 dnl C++11
7186 dnl ===================================================================
7188 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
7189 CXXFLAGS_CXX11=
7190 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
7191     if test "$with_latest_c__" = yes; then
7192         CXXFLAGS_CXX11=-std:c++latest
7193     else
7194         CXXFLAGS_CXX11=-std:c++17
7195     fi
7196     CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -permissive- -Zc:__cplusplus"
7197 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7198     my_flags='-std=c++17 -std=c++1z'
7199     if test "$with_latest_c__" = yes; then
7200         my_flags="-std=c++23 -std=c++2b -std=c++20 -std=c++2a $my_flags"
7201     fi
7202     for flag in $my_flags; do
7203         if test "$COM" = MSC; then
7204             flag="-Xclang $flag"
7205         fi
7206         save_CXXFLAGS=$CXXFLAGS
7207         CXXFLAGS="$CXXFLAGS $flag -Werror"
7208         if test "$SYSTEM_LIBCMIS" = TRUE; then
7209             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
7210         fi
7211         AC_LANG_PUSH([C++])
7212         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7213             #include <algorithm>
7214             #include <functional>
7215             #include <vector>
7217             #if defined SYSTEM_LIBCMIS
7218             // See ucb/source/ucp/cmis/auth_provider.hxx:
7219             #if !defined __clang__
7220             #pragma GCC diagnostic push
7221             #pragma GCC diagnostic ignored "-Wdeprecated"
7222             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
7223             #endif
7224             #include <libcmis/libcmis.hxx>
7225             #if !defined __clang__
7226             #pragma GCC diagnostic pop
7227             #endif
7228             #endif
7230             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
7231                 std::sort(v.begin(), v.end(), fn);
7232             }
7233             ]])],[CXXFLAGS_CXX11=$flag])
7234         AC_LANG_POP([C++])
7235         CXXFLAGS=$save_CXXFLAGS
7236         if test -n "$CXXFLAGS_CXX11"; then
7237             break
7238         fi
7239     done
7241 if test -n "$CXXFLAGS_CXX11"; then
7242     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
7243 else
7244     AC_MSG_ERROR(no)
7246 AC_SUBST(CXXFLAGS_CXX11)
7248 if test "$GCC" = "yes"; then
7249     save_CXXFLAGS=$CXXFLAGS
7250     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7251     CHECK_L_ATOMIC
7252     CXXFLAGS=$save_CXXFLAGS
7253     AC_SUBST(ATOMIC_LIB)
7256 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
7257 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
7258 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
7259 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
7260 dnl again towards 4.7.2:
7261 if test $CPP_LIBRARY = GLIBCXX; then
7262     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
7263     AC_LANG_PUSH([C++])
7264     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7265 #include <list>
7266 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
7267     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
7268     //   GCC 4.7.0: 20120322
7269     //   GCC 4.7.1: 20120614
7270     // and using a range check is not possible as the mapping between
7271     // __GLIBCXX__ values and GCC versions is not monotonic
7272 /* ok */
7273 #else
7274 abi broken
7275 #endif
7276         ]])], [AC_MSG_RESULT(no, ok)],
7277         [AC_MSG_ERROR(yes)])
7278     AC_LANG_POP([C++])
7281 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
7282 save_CXXFLAGS=$CXXFLAGS
7283 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7284 AC_LANG_PUSH([C++])
7286 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7287 #include <stddef.h>
7289 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
7291 namespace
7293         struct b
7294         {
7295                 int i;
7296                 int j;
7297         };
7299 ]], [[
7300 struct a
7302         int i;
7303         int j;
7305 a thinga[]={{0,0}, {1,1}};
7306 b thingb[]={{0,0}, {1,1}};
7307 size_t i = sizeof(sal_n_array_size(thinga));
7308 size_t j = sizeof(sal_n_array_size(thingb));
7309 return !(i != 0 && j != 0);
7311     ], [ AC_MSG_RESULT(yes) ],
7312     [ AC_MSG_ERROR(no)])
7313 AC_LANG_POP([C++])
7314 CXXFLAGS=$save_CXXFLAGS
7316 HAVE_GCC_FNO_SIZED_DEALLOCATION=
7317 if test "$GCC" = yes; then
7318     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
7319     AC_LANG_PUSH([C++])
7320     save_CXXFLAGS=$CXXFLAGS
7321     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
7322     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
7323     CXXFLAGS=$save_CXXFLAGS
7324     AC_LANG_POP([C++])
7325     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
7326         AC_MSG_RESULT([yes])
7327     else
7328         AC_MSG_RESULT([no])
7329     fi
7331 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
7333 AC_MSG_CHECKING([whether $CXX_BASE supports a working C++20 consteval])
7334 dnl ...that does not suffer from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96994> "Missing code
7335 dnl from consteval constructor initializing const variable",
7336 dnl <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98752> "wrong 'error: â€˜this’ is not a constant
7337 dnl expression' with consteval constructor", or <https://bugs.llvm.org/show_bug.cgi?id=50063> "code
7338 dnl using consteval: 'clang/lib/CodeGen/Address.h:38: llvm::Value*
7339 dnl clang::CodeGen::Address::getPointer() const: Assertion `isValid()' failed.'":
7340 AC_LANG_PUSH([C++])
7341 save_CXXFLAGS=$CXXFLAGS
7342 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7343 AC_RUN_IFELSE([AC_LANG_PROGRAM([
7344         struct S {
7345             consteval S() { i = 1; }
7346             int i = 0;
7347         };
7348         S const s;
7350         struct S1 { consteval S1(int) {} };
7351         struct S2 {
7352             S1 x;
7353             S2(): x(0) {}
7354         };
7356         struct S3 {
7357             consteval S3() {}
7358             union {
7359                 int a;
7360                 unsigned b = 0;
7361             };
7362         };
7363         void f() { S3(); }
7364     ], [
7365         return (s.i == 1) ? 0 : 1;
7366     ])], [
7367         AC_DEFINE([HAVE_CPP_CONSTEVAL],[1])
7368         AC_MSG_RESULT([yes])
7369     ], [AC_MSG_RESULT([no])], [AC_MSG_RESULT([assumed no (cross compiling)])])
7370 CXXFLAGS=$save_CXXFLAGS
7371 AC_LANG_POP([C++])
7373 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
7374 AC_LANG_PUSH([C++])
7375 save_CXXFLAGS=$CXXFLAGS
7376 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7377 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7378         #include <algorithm>
7379         #include <initializer_list>
7380         #include <vector>
7381         template<typename T> class S {
7382         private:
7383             std::vector<T> v_;
7384         public:
7385             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
7386         };
7387         constinit S<int> s{3, 2, 1};
7388     ])], [
7389         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
7390         AC_MSG_RESULT([yes])
7391     ], [AC_MSG_RESULT([no])])
7392 CXXFLAGS=$save_CXXFLAGS
7393 AC_LANG_POP([C++])
7395 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
7396 AC_LANG_PUSH([C++])
7397 save_CXXFLAGS=$CXXFLAGS
7398 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7399 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7400         #include <span>
7401         #include <type_traits>
7402         // Don't check size_type directly, as it was called index_type before P1872R0:
7403         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
7404     ])], [
7405         AC_DEFINE([HAVE_CPP_SPAN],[1])
7406         AC_MSG_RESULT([yes])
7407     ], [AC_MSG_RESULT([no])])
7408 CXXFLAGS=$save_CXXFLAGS
7409 AC_LANG_POP([C++])
7411 AC_MSG_CHECKING([whether $CXX_BASE implements C++ DR P1155R3])
7412 AC_LANG_PUSH([C++])
7413 save_CXXFLAGS=$CXXFLAGS
7414 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7415 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7416         struct S1 { S1(S1 &&); };
7417         struct S2: S1 {};
7418         S1 f(S2 s) { return s; }
7419     ])], [
7420         AC_DEFINE([HAVE_P1155R3],[1])
7421         AC_MSG_RESULT([yes])
7422     ], [AC_MSG_RESULT([no])])
7423 CXXFLAGS=$save_CXXFLAGS
7424 AC_LANG_POP([C++])
7426 dnl Supported since GCC 9 and Clang 10 (which each also started to support -Wdeprecated-copy, but
7427 dnl which is included in -Wextra anyway):
7428 HAVE_WDEPRECATED_COPY_DTOR=
7429 if test "$GCC" = yes; then
7430     AC_MSG_CHECKING([whether $CXX_BASE supports -Wdeprecated-copy-dtor])
7431     AC_LANG_PUSH([C++])
7432     save_CXXFLAGS=$CXXFLAGS
7433     CXXFLAGS="$CXXFLAGS -Werror -Wdeprecated-copy-dtor"
7434     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
7435             HAVE_WDEPRECATED_COPY_DTOR=TRUE
7436             AC_MSG_RESULT([yes])
7437         ], [AC_MSG_RESULT([no])])
7438     CXXFLAGS=$save_CXXFLAGS
7439     AC_LANG_POP([C++])
7441 AC_SUBST([HAVE_WDEPRECATED_COPY_DTOR])
7443 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
7444 dnl uninitialized warning for code like
7446 dnl   OString f();
7447 dnl   boost::optional<OString> * g(bool b) {
7448 dnl       boost::optional<OString> o;
7449 dnl       if (b) o = f();
7450 dnl       return new boost::optional<OString>(o);
7451 dnl   }
7453 dnl (as is e.g. present, in a slightly more elaborate form, in
7454 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
7455 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
7456 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
7457 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7458     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
7459     AC_LANG_PUSH([C++])
7460     save_CXXFLAGS=$CXXFLAGS
7461     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
7462     if test "$ENABLE_OPTIMIZED" = TRUE; then
7463         CXXFLAGS="$CXXFLAGS -O2"
7464     else
7465         CXXFLAGS="$CXXFLAGS -O0"
7466     fi
7467     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7468             #include <new>
7469             void f1(int);
7470             struct S1 {
7471                 ~S1() { f1(n); }
7472                 int n = 0;
7473             };
7474             struct S2 {
7475                 S2() {}
7476                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
7477                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
7478                 void set(S1 s) {
7479                     new (stg) S1(s);
7480                     init = true;
7481                 }
7482                 bool init = false;
7483                 char stg[sizeof (S1)];
7484             } ;
7485             S1 f2();
7486             S2 * f3(bool b) {
7487                 S2 o;
7488                 if (b) o.set(f2());
7489                 return new S2(o);
7490             }
7491         ]])], [AC_MSG_RESULT([no])], [
7492             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
7493             AC_MSG_RESULT([yes])
7494         ])
7495     CXXFLAGS=$save_CXXFLAGS
7496     AC_LANG_POP([C++])
7498 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
7500 dnl Check for <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c5> "[8/9/10/11 Regression]
7501 dnl -Wstringop-overflow false positive due to using MEM_REF type of &MEM" (fixed in GCC 11), which
7502 dnl hits us e.g. with GCC 10 and --enable-optimized at
7504 dnl   In file included from include/rtl/string.hxx:49,
7505 dnl                    from include/rtl/ustring.hxx:43,
7506 dnl                    from include/osl/file.hxx:35,
7507 dnl                    from include/codemaker/global.hxx:28,
7508 dnl                    from include/codemaker/options.hxx:23,
7509 dnl                    from codemaker/source/commoncpp/commoncpp.cxx:24:
7510 dnl   In function â€˜char* rtl::addDataHelper(char*, const char*, std::size_t)’,
7511 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,
7512 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,
7513 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,
7514 dnl       inlined from â€˜rtl::OString codemaker::cpp::scopedCppName(const rtl::OString&, bool)’ at codemaker/source/commoncpp/commoncpp.cxx:53:55:
7515 dnl   include/rtl/stringconcat.hxx:78:15: error: writing 2 bytes into a region of size 1 [-Werror=stringop-overflow=]
7516 dnl      78 |         memcpy( buffer, data, length );
7517 dnl         |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
7518 HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=
7519 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7520     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=stringop-overflow=])
7521     AC_LANG_PUSH([C++])
7522     save_CXXFLAGS=$CXXFLAGS
7523     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wstringop-overflow"
7524     if test "$ENABLE_OPTIMIZED" = TRUE; then
7525         CXXFLAGS="$CXXFLAGS -O2"
7526     else
7527         CXXFLAGS="$CXXFLAGS -O0"
7528     fi
7529     dnl Test code taken from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c0>:
7530     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7531             void fill(char const * begin, char const * end, char c);
7532             struct q {
7533                 char ids[4];
7534                 char username[6];
7535             };
7536             void test(q & c) {
7537                 fill(c.ids, c.ids + sizeof(c.ids), '\0');
7538                 __builtin_strncpy(c.username, "root", sizeof(c.username));
7539             }
7540         ]])], [AC_MSG_RESULT([no])], [
7541             HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=TRUE
7542             AC_MSG_RESULT([yes])
7543         ])
7544     CXXFLAGS=$save_CXXFLAGS
7545     AC_LANG_POP([C++])
7547 AC_SUBST([HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW])
7549 dnl ===================================================================
7550 dnl CPU Intrinsics support - SSE, AVX
7551 dnl ===================================================================
7553 CXXFLAGS_INTRINSICS_SSE2=
7554 CXXFLAGS_INTRINSICS_SSSE3=
7555 CXXFLAGS_INTRINSICS_SSE41=
7556 CXXFLAGS_INTRINSICS_SSE42=
7557 CXXFLAGS_INTRINSICS_AVX=
7558 CXXFLAGS_INTRINSICS_AVX2=
7559 CXXFLAGS_INTRINSICS_AVX512=
7560 CXXFLAGS_INTRINSICS_F16C=
7561 CXXFLAGS_INTRINSICS_FMA=
7563 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7564     # GCC, Clang or Clang-cl (clang-cl + MSVC's -arch options don't work well together)
7565     flag_sse2=-msse2
7566     flag_ssse3=-mssse3
7567     flag_sse41=-msse4.1
7568     flag_sse42=-msse4.2
7569     flag_avx=-mavx
7570     flag_avx2=-mavx2
7571     flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
7572     flag_f16c=-mf16c
7573     flag_fma=-mfma
7574 else
7575     # https://docs.microsoft.com/en-us/cpp/build/reference/arch-x86
7576     # MSVC seems to differentiate only between SSE and SSE2, where in fact
7577     # SSE2 seems to be SSE2+.
7578     # Even if -arch:SSE2 is the default, set it explicitly, so that the variable
7579     # is not empty (and can be tested in gbuild).
7580     flag_sse2=-arch:SSE2
7581     flag_ssse3=-arch:SSE2
7582     flag_sse41=-arch:SSE2
7583     flag_sse42=-arch:SSE2
7584     flag_avx=-arch:AVX
7585     flag_avx2=-arch:AVX2
7586     flag_avx512=-arch:AVX512
7587     # These are part of -arch:AVX2
7588     flag_f16c=-arch:AVX2
7589     flag_fma=-arch:AVX2
7592 AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
7593 AC_LANG_PUSH([C++])
7594 save_CXXFLAGS=$CXXFLAGS
7595 CXXFLAGS="$CXXFLAGS $flag_sse2"
7596 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7597     #include <emmintrin.h>
7598     int main () {
7599         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7600         c = _mm_xor_si128 (a, b);
7601         return 0;
7602     }
7603     ])],
7604     [can_compile_sse2=yes],
7605     [can_compile_sse2=no])
7606 AC_LANG_POP([C++])
7607 CXXFLAGS=$save_CXXFLAGS
7608 AC_MSG_RESULT([${can_compile_sse2}])
7609 if test "${can_compile_sse2}" = "yes" ; then
7610     CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
7613 AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
7614 AC_LANG_PUSH([C++])
7615 save_CXXFLAGS=$CXXFLAGS
7616 CXXFLAGS="$CXXFLAGS $flag_ssse3"
7617 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7618     #include <tmmintrin.h>
7619     int main () {
7620         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7621         c = _mm_maddubs_epi16 (a, b);
7622         return 0;
7623     }
7624     ])],
7625     [can_compile_ssse3=yes],
7626     [can_compile_ssse3=no])
7627 AC_LANG_POP([C++])
7628 CXXFLAGS=$save_CXXFLAGS
7629 AC_MSG_RESULT([${can_compile_ssse3}])
7630 if test "${can_compile_ssse3}" = "yes" ; then
7631     CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
7634 AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
7635 AC_LANG_PUSH([C++])
7636 save_CXXFLAGS=$CXXFLAGS
7637 CXXFLAGS="$CXXFLAGS $flag_sse41"
7638 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7639     #include <smmintrin.h>
7640     int main () {
7641         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7642         c = _mm_cmpeq_epi64 (a, b);
7643         return 0;
7644     }
7645     ])],
7646     [can_compile_sse41=yes],
7647     [can_compile_sse41=no])
7648 AC_LANG_POP([C++])
7649 CXXFLAGS=$save_CXXFLAGS
7650 AC_MSG_RESULT([${can_compile_sse41}])
7651 if test "${can_compile_sse41}" = "yes" ; then
7652     CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
7655 AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
7656 AC_LANG_PUSH([C++])
7657 save_CXXFLAGS=$CXXFLAGS
7658 CXXFLAGS="$CXXFLAGS $flag_sse42"
7659 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7660     #include <nmmintrin.h>
7661     int main () {
7662         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7663         c = _mm_cmpgt_epi64 (a, b);
7664         return 0;
7665     }
7666     ])],
7667     [can_compile_sse42=yes],
7668     [can_compile_sse42=no])
7669 AC_LANG_POP([C++])
7670 CXXFLAGS=$save_CXXFLAGS
7671 AC_MSG_RESULT([${can_compile_sse42}])
7672 if test "${can_compile_sse42}" = "yes" ; then
7673     CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
7676 AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
7677 AC_LANG_PUSH([C++])
7678 save_CXXFLAGS=$CXXFLAGS
7679 CXXFLAGS="$CXXFLAGS $flag_avx"
7680 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7681     #include <immintrin.h>
7682     int main () {
7683         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
7684         c = _mm256_xor_ps(a, b);
7685         return 0;
7686     }
7687     ])],
7688     [can_compile_avx=yes],
7689     [can_compile_avx=no])
7690 AC_LANG_POP([C++])
7691 CXXFLAGS=$save_CXXFLAGS
7692 AC_MSG_RESULT([${can_compile_avx}])
7693 if test "${can_compile_avx}" = "yes" ; then
7694     CXXFLAGS_INTRINSICS_AVX="$flag_avx"
7697 AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
7698 AC_LANG_PUSH([C++])
7699 save_CXXFLAGS=$CXXFLAGS
7700 CXXFLAGS="$CXXFLAGS $flag_avx2"
7701 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7702     #include <immintrin.h>
7703     int main () {
7704         __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
7705         c = _mm256_maddubs_epi16(a, b);
7706         return 0;
7707     }
7708     ])],
7709     [can_compile_avx2=yes],
7710     [can_compile_avx2=no])
7711 AC_LANG_POP([C++])
7712 CXXFLAGS=$save_CXXFLAGS
7713 AC_MSG_RESULT([${can_compile_avx2}])
7714 if test "${can_compile_avx2}" = "yes" ; then
7715     CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
7718 AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
7719 AC_LANG_PUSH([C++])
7720 save_CXXFLAGS=$CXXFLAGS
7721 CXXFLAGS="$CXXFLAGS $flag_avx512"
7722 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7723     #include <immintrin.h>
7724     int main () {
7725         __m512i a = _mm512_loadu_si512(0);
7726         return 0;
7727     }
7728     ])],
7729     [can_compile_avx512=yes],
7730     [can_compile_avx512=no])
7731 AC_LANG_POP([C++])
7732 CXXFLAGS=$save_CXXFLAGS
7733 AC_MSG_RESULT([${can_compile_avx512}])
7734 if test "${can_compile_avx512}" = "yes" ; then
7735     CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
7738 AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
7739 AC_LANG_PUSH([C++])
7740 save_CXXFLAGS=$CXXFLAGS
7741 CXXFLAGS="$CXXFLAGS $flag_f16c"
7742 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7743     #include <immintrin.h>
7744     int main () {
7745         __m128i a = _mm_set1_epi32 (0);
7746         __m128 c;
7747         c = _mm_cvtph_ps(a);
7748         return 0;
7749     }
7750     ])],
7751     [can_compile_f16c=yes],
7752     [can_compile_f16c=no])
7753 AC_LANG_POP([C++])
7754 CXXFLAGS=$save_CXXFLAGS
7755 AC_MSG_RESULT([${can_compile_f16c}])
7756 if test "${can_compile_f16c}" = "yes" ; then
7757     CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
7760 AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
7761 AC_LANG_PUSH([C++])
7762 save_CXXFLAGS=$CXXFLAGS
7763 CXXFLAGS="$CXXFLAGS $flag_fma"
7764 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7765     #include <immintrin.h>
7766     int main () {
7767         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
7768         d = _mm256_fmadd_ps(a, b, c);
7769         return 0;
7770     }
7771     ])],
7772     [can_compile_fma=yes],
7773     [can_compile_fma=no])
7774 AC_LANG_POP([C++])
7775 CXXFLAGS=$save_CXXFLAGS
7776 AC_MSG_RESULT([${can_compile_fma}])
7777 if test "${can_compile_fma}" = "yes" ; then
7778     CXXFLAGS_INTRINSICS_FMA="$flag_fma"
7781 AC_SUBST([CXXFLAGS_INTRINSICS_SSE2])
7782 AC_SUBST([CXXFLAGS_INTRINSICS_SSSE3])
7783 AC_SUBST([CXXFLAGS_INTRINSICS_SSE41])
7784 AC_SUBST([CXXFLAGS_INTRINSICS_SSE42])
7785 AC_SUBST([CXXFLAGS_INTRINSICS_AVX])
7786 AC_SUBST([CXXFLAGS_INTRINSICS_AVX2])
7787 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512])
7788 AC_SUBST([CXXFLAGS_INTRINSICS_F16C])
7789 AC_SUBST([CXXFLAGS_INTRINSICS_FMA])
7791 dnl ===================================================================
7792 dnl system stl sanity tests
7793 dnl ===================================================================
7794 if test "$_os" != "WINNT"; then
7796     AC_LANG_PUSH([C++])
7798     save_CPPFLAGS="$CPPFLAGS"
7799     if test -n "$MACOSX_SDK_PATH"; then
7800         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
7801     fi
7803     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
7804     # only.
7805     if test "$CPP_LIBRARY" = GLIBCXX; then
7806         dnl gcc#19664, gcc#22482, rhbz#162935
7807         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
7808         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
7809         AC_MSG_RESULT([$stlvisok])
7810         if test "$stlvisok" = "no"; then
7811             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
7812         fi
7813     fi
7815     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
7816     # when we don't make any dynamic libraries?
7817     if test "$DISABLE_DYNLOADING" = ""; then
7818         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
7819         cat > conftestlib1.cc <<_ACEOF
7820 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7821 struct S2: S1<int> { virtual ~S2(); };
7822 S2::~S2() {}
7823 _ACEOF
7824         cat > conftestlib2.cc <<_ACEOF
7825 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7826 struct S2: S1<int> { virtual ~S2(); };
7827 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
7828 _ACEOF
7829         gccvisinlineshiddenok=yes
7830         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
7831             gccvisinlineshiddenok=no
7832         else
7833             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
7834             dnl known to not work with -z defs (unsetting which makes the test
7835             dnl moot, though):
7836             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
7837             if test "$COM_IS_CLANG" = TRUE; then
7838                 for i in $CXX $CXXFLAGS; do
7839                     case $i in
7840                     -fsanitize=*)
7841                         my_linkflagsnoundefs=
7842                         break
7843                         ;;
7844                     esac
7845                 done
7846             fi
7847             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
7848                 gccvisinlineshiddenok=no
7849             fi
7850         fi
7852         rm -fr libconftest*
7853         AC_MSG_RESULT([$gccvisinlineshiddenok])
7854         if test "$gccvisinlineshiddenok" = "no"; then
7855             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
7856         fi
7857     fi
7859    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
7860     cat >visibility.cxx <<_ACEOF
7861 #pragma GCC visibility push(hidden)
7862 struct __attribute__ ((visibility ("default"))) TestStruct {
7863   static void Init();
7865 __attribute__ ((visibility ("default"))) void TestFunc() {
7866   TestStruct::Init();
7868 _ACEOF
7869     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
7870         gccvisbroken=yes
7871     else
7872         case "$host_cpu" in
7873         i?86|x86_64)
7874             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
7875                 gccvisbroken=no
7876             else
7877                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
7878                     gccvisbroken=no
7879                 else
7880                     gccvisbroken=yes
7881                 fi
7882             fi
7883             ;;
7884         *)
7885             gccvisbroken=no
7886             ;;
7887         esac
7888     fi
7889     rm -f visibility.s visibility.cxx
7891     AC_MSG_RESULT([$gccvisbroken])
7892     if test "$gccvisbroken" = "yes"; then
7893         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
7894     fi
7896     CPPFLAGS="$save_CPPFLAGS"
7898     AC_LANG_POP([C++])
7901 dnl ===================================================================
7902 dnl  Clang++ tests
7903 dnl ===================================================================
7905 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
7906 if test "$GCC" = "yes"; then
7907     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
7908     AC_LANG_PUSH([C++])
7909     save_CXXFLAGS=$CXXFLAGS
7910     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
7911     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
7912     CXXFLAGS=$save_CXXFLAGS
7913     AC_LANG_POP([C++])
7914     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
7915         AC_MSG_RESULT([yes])
7916     else
7917         AC_MSG_RESULT([no])
7918     fi
7920 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
7922 dnl ===================================================================
7923 dnl Compiler plugins
7924 dnl ===================================================================
7926 COMPILER_PLUGINS=
7927 # currently only Clang
7929 if test "$COM_IS_CLANG" != "TRUE"; then
7930     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
7931         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
7932         enable_compiler_plugins=no
7933     fi
7936 COMPILER_PLUGINS_COM_IS_CLANG=
7937 if test "$COM_IS_CLANG" = "TRUE"; then
7938     if test -n "$enable_compiler_plugins"; then
7939         compiler_plugins="$enable_compiler_plugins"
7940     elif test -n "$ENABLE_DBGUTIL"; then
7941         compiler_plugins=test
7942     else
7943         compiler_plugins=no
7944     fi
7945     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
7946         if test "$CLANGVER" -lt 50002; then
7947             if test "$compiler_plugins" = yes; then
7948                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
7949             else
7950                 compiler_plugins=no
7951             fi
7952         fi
7953     fi
7954     if test "$compiler_plugins" != "no"; then
7955         dnl The prefix where Clang resides, override to where Clang resides if
7956         dnl using a source build:
7957         if test -z "$CLANGDIR"; then
7958             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $(printf '%s\n' $CXX | grep clang | head -n 1)))))
7959         fi
7960         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
7961         if test -z "$COMPILER_PLUGINS_CXX"; then
7962             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
7963         fi
7964         clangbindir=$CLANGDIR/bin
7965         if test "$build_os" = "cygwin"; then
7966             clangbindir=$(cygpath -u "$clangbindir")
7967         fi
7968         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
7969         if test -n "$LLVM_CONFIG"; then
7970             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
7971             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
7972             if test -z "$CLANGLIBDIR"; then
7973                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
7974             fi
7975             # Try if clang is built from source (in which case its includes are not together with llvm includes).
7976             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
7977             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
7978             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
7979                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
7980             fi
7981             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
7982             clangobjdir=$($LLVM_CONFIG --obj-root)
7983             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
7984                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
7985             fi
7986         fi
7987         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
7988         AC_LANG_PUSH([C++])
7989         save_CXX=$CXX
7990         save_CXXCPP=$CXXCPP
7991         save_CPPFLAGS=$CPPFLAGS
7992         save_CXXFLAGS=$CXXFLAGS
7993         save_LDFLAGS=$LDFLAGS
7994         save_LIBS=$LIBS
7995         CXX=$COMPILER_PLUGINS_CXX
7996         CXXCPP="$COMPILER_PLUGINS_CXX -E"
7997         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7998         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7999         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
8000             [COMPILER_PLUGINS=TRUE],
8001             [
8002             if test "$compiler_plugins" = "yes"; then
8003                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
8004             else
8005                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
8006                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
8007             fi
8008             ])
8009         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
8010         dnl comment in compilerplugins/Makefile-clang.mk:
8011         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
8012             LDFLAGS=""
8013             AC_MSG_CHECKING([for clang libraries to use])
8014             if test -z "$CLANGTOOLLIBS"; then
8015                 LIBS="-lclangTooling -lclangFrontend -lclangDriver -lclangParse -lclangSema -lclangEdit \
8016  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
8017                 AC_LINK_IFELSE([
8018                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8019                         [[ clang::FullSourceLoc().dump(); ]])
8020                 ],[CLANGTOOLLIBS="$LIBS"],[])
8021             fi
8022             if test -z "$CLANGTOOLLIBS"; then
8023                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
8024                 AC_LINK_IFELSE([
8025                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
8026                         [[ clang::FullSourceLoc().dump(); ]])
8027                 ],[CLANGTOOLLIBS="$LIBS"],[])
8028             fi
8029             AC_MSG_RESULT([$CLANGTOOLLIBS])
8030             if test -z "$CLANGTOOLLIBS"; then
8031                 if test "$compiler_plugins" = "yes"; then
8032                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
8033                 else
8034                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
8035                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
8036                 fi
8037                 COMPILER_PLUGINS=
8038             fi
8039             if test -n "$COMPILER_PLUGINS"; then
8040                 if test -z "$CLANGSYSINCLUDE"; then
8041                     if test -n "$LLVM_CONFIG"; then
8042                         # Path to the clang system headers (no idea if there's a better way to get it).
8043                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/git\|svn//')/include
8044                     fi
8045                 fi
8046             fi
8047         fi
8048         CXX=$save_CXX
8049         CXXCPP=$save_CXXCPP
8050         CPPFLAGS=$save_CPPFLAGS
8051         CXXFLAGS=$save_CXXFLAGS
8052         LDFLAGS=$save_LDFLAGS
8053         LIBS="$save_LIBS"
8054         AC_LANG_POP([C++])
8056         AC_MSG_CHECKING([whether the compiler for building compilerplugins is actually Clang])
8057         AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
8058             #ifndef __clang__
8059             you lose
8060             #endif
8061             int foo=42;
8062             ]])],
8063             [AC_MSG_RESULT([yes])
8064              COMPILER_PLUGINS_COM_IS_CLANG=TRUE],
8065             [AC_MSG_RESULT([no])])
8066         AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8067     fi
8068 else
8069     if test "$enable_compiler_plugins" = "yes"; then
8070         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
8071     fi
8073 COMPILER_PLUGINS_ANALYZER_PCH=
8074 if test "$enable_compiler_plugins_analyzer_pch" != no; then
8075     COMPILER_PLUGINS_ANALYZER_PCH=TRUE
8077 AC_SUBST(COMPILER_PLUGINS)
8078 AC_SUBST(COMPILER_PLUGINS_ANALYZER_PCH)
8079 AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
8080 AC_SUBST(COMPILER_PLUGINS_CXX)
8081 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
8082 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
8083 AC_SUBST(COMPILER_PLUGINS_DEBUG)
8084 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
8085 AC_SUBST(CLANGDIR)
8086 AC_SUBST(CLANGLIBDIR)
8087 AC_SUBST(CLANGTOOLLIBS)
8088 AC_SUBST(CLANGSYSINCLUDE)
8090 # Plugin to help linker.
8091 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
8092 # This makes --enable-lto build with clang work.
8093 AC_SUBST(LD_PLUGIN)
8095 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
8096 AC_SUBST(HAVE_POSIX_FALLOCATE)
8098 JITC_PROCESSOR_TYPE=""
8099 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
8100     # IBMs JDK needs this...
8101     JITC_PROCESSOR_TYPE=6
8102     export JITC_PROCESSOR_TYPE
8104 AC_SUBST([JITC_PROCESSOR_TYPE])
8106 # Misc Windows Stuff
8107 AC_ARG_WITH(ucrt-dir,
8108     AS_HELP_STRING([--with-ucrt-dir],
8109         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
8110         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
8111         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
8112             Windows6.1-KB2999226-x64.msu
8113             Windows6.1-KB2999226-x86.msu
8114             Windows8.1-KB2999226-x64.msu
8115             Windows8.1-KB2999226-x86.msu
8116             Windows8-RT-KB2999226-x64.msu
8117             Windows8-RT-KB2999226-x86.msu
8118         A zip archive including those files is available from Microsoft site:
8119         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
8122 UCRT_REDISTDIR="$with_ucrt_dir"
8123 if test $_os = "WINNT"; then
8124     find_msvc_x64_dlls
8125     for i in $PKGFORMAT; do
8126         if test "$i" = msi; then
8127             find_msms
8128             break
8129         fi
8130     done
8131     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
8132     MSVC_DLLS="$msvcdlls"
8133     test -n "$msmdir" && MSM_PATH=`win_short_path_for_make "$msmdir"`
8134     # MSVC 15.3 changed it to VC141
8135     if echo "$msvcdllpath" | grep -q "VC142.CRT$"; then
8136         SCPDEFS="$SCPDEFS -DWITH_VC142_REDIST"
8137     elif echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
8138         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
8139     else
8140         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
8141     fi
8143     if test "$UCRT_REDISTDIR" = "no"; then
8144         dnl explicitly disabled
8145         UCRT_REDISTDIR=""
8146     else
8147         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
8148                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
8149                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
8150                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
8151                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
8152                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
8153             UCRT_REDISTDIR=""
8154             if test -n "$PKGFORMAT"; then
8155                for i in $PKGFORMAT; do
8156                    case "$i" in
8157                    msi)
8158                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
8159                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
8160                        ;;
8161                    esac
8162                done
8163             fi
8164         fi
8165     fi
8168 AC_SUBST(UCRT_REDISTDIR)
8169 AC_SUBST(MSVC_DLL_PATH)
8170 AC_SUBST(MSVC_DLLS)
8171 AC_SUBST(MSM_PATH)
8174 dnl ===================================================================
8175 dnl Checks for Java
8176 dnl ===================================================================
8177 if test "$ENABLE_JAVA" != ""; then
8179     # Windows-specific tests
8180     if test "$build_os" = "cygwin"; then
8181         if test -z "$with_jdk_home"; then
8182             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
8183             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
8184             reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
8185             if test -n "$regvalue"; then
8186                 ver=$regvalue
8187                 reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
8188                 with_jdk_home=$regvalue
8189             fi
8190             howfound="found automatically"
8191         else
8192             with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
8193             howfound="you passed"
8194         fi
8196         if ! test -f "$with_jdk_home/lib/jvm.lib" -a -f "$with_jdk_home/bin/java.exe"; then
8197             AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option (or fix the path) pointing to a $WIN_HOST_BITS-bit JDK >= 9])
8198         fi
8199     fi
8201     # 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.
8202     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
8203     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
8204         with_jdk_home=`/usr/libexec/java_home`
8205     fi
8207     JAVA_HOME=; export JAVA_HOME
8208     if test -z "$with_jdk_home"; then
8209         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
8210     else
8211         _java_path="$with_jdk_home/bin/$with_java"
8212         dnl Check if there is a Java interpreter at all.
8213         if test -x "$_java_path"; then
8214             JAVAINTERPRETER=$_java_path
8215         else
8216             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
8217         fi
8218     fi
8220     dnl Check that the JDK found is correct architecture (at least 2 reasons to
8221     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
8222     dnl loaded by java to run JunitTests:
8223     if test "$build_os" = "cygwin" -a "$cross_compiling" != "yes"; then
8224         shortjdkhome=`cygpath -d "$with_jdk_home"`
8225         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
8226             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
8227             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8228         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
8229             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8230             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8231         fi
8233         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
8234             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
8235         fi
8236         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
8237     elif test "$cross_compiling" != "yes"; then
8238         case $CPUNAME in
8239             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
8240                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
8241                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
8242                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8243                 fi
8244                 ;;
8245             *) # assumption: everything else 32-bit
8246                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
8247                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8248                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8249                 fi
8250                 ;;
8251         esac
8252     fi
8255 dnl ===================================================================
8256 dnl Checks for JDK.
8257 dnl ===================================================================
8259 # Whether all the complexity here actually is needed any more or not, no idea.
8261 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8262     _gij_longver=0
8263     AC_MSG_CHECKING([the installed JDK])
8264     if test -n "$JAVAINTERPRETER"; then
8265         dnl java -version sends output to stderr!
8266         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
8267             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8268         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
8269             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8270         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
8271             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8272         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
8273             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8274         else
8275             JDK=sun
8277             dnl Sun JDK specific tests
8278             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
8279             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
8281             if test "$_jdk_ver" -lt 10900; then
8282                 AC_MSG_ERROR([JDK is too old, you need at least 9 ($_jdk_ver < 10900)])
8283             fi
8284             if test "$_jdk_ver" -gt 10900; then
8285                 JAVA_CLASSPATH_NOT_SET=TRUE
8286             fi
8288             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
8289             if test "$_os" = "WINNT"; then
8290                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
8291             fi
8292             AC_MSG_RESULT([found $JAVA_HOME (JDK $_jdk)])
8294             # set to limit VM usage for JunitTests
8295             JAVAIFLAGS=-Xmx64M
8296             # set to limit VM usage for javac
8297             JAVACFLAGS=-J-Xmx128M
8298         fi
8299     else
8300         AC_MSG_ERROR([Java not found. You need at least JDK 9])
8301     fi
8302 else
8303     if test -z "$ENABLE_JAVA"; then
8304         dnl Java disabled
8305         JAVA_HOME=
8306         export JAVA_HOME
8307     elif test "$cross_compiling" = "yes"; then
8308         # Just assume compatibility of build and host JDK
8309         JDK=$JDK_FOR_BUILD
8310         JAVAIFLAGS=$JAVAIFLAGS_FOR_BUILD
8311     fi
8314 dnl ===================================================================
8315 dnl Checks for javac
8316 dnl ===================================================================
8317 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8318     javacompiler="javac"
8319     : ${JAVA_SOURCE_VER=8}
8320     : ${JAVA_TARGET_VER=8}
8321     if test -z "$with_jdk_home"; then
8322         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
8323     else
8324         _javac_path="$with_jdk_home/bin/$javacompiler"
8325         dnl Check if there is a Java compiler at all.
8326         if test -x "$_javac_path"; then
8327             JAVACOMPILER=$_javac_path
8328         fi
8329     fi
8330     if test -z "$JAVACOMPILER"; then
8331         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
8332     fi
8333     if test "$build_os" = "cygwin"; then
8334         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
8335             JAVACOMPILER="${JAVACOMPILER}.exe"
8336         fi
8337         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
8338     fi
8341 dnl ===================================================================
8342 dnl Checks for javadoc
8343 dnl ===================================================================
8344 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8345     if test -z "$with_jdk_home"; then
8346         AC_PATH_PROG(JAVADOC, javadoc)
8347     else
8348         _javadoc_path="$with_jdk_home/bin/javadoc"
8349         dnl Check if there is a javadoc at all.
8350         if test -x "$_javadoc_path"; then
8351             JAVADOC=$_javadoc_path
8352         else
8353             AC_PATH_PROG(JAVADOC, javadoc)
8354         fi
8355     fi
8356     if test -z "$JAVADOC"; then
8357         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
8358     fi
8359     if test "$build_os" = "cygwin"; then
8360         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
8361             JAVADOC="${JAVADOC}.exe"
8362         fi
8363         JAVADOC=`win_short_path_for_make "$JAVADOC"`
8364     fi
8366     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
8367     JAVADOCISGJDOC="yes"
8368     fi
8370 AC_SUBST(JAVADOC)
8371 AC_SUBST(JAVADOCISGJDOC)
8373 if test "$ENABLE_JAVA" != "" -a \( "$cross_compiling" != "yes" -o -n "$with_jdk_home" \); then
8374     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
8375     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
8376         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
8377            # try to recover first by looking whether we have an alternative
8378            # system as in Debian or newer SuSEs where following /usr/bin/javac
8379            # over /etc/alternatives/javac leads to the right bindir where we
8380            # just need to strip a bit away to get a valid JAVA_HOME
8381            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
8382         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
8383             # maybe only one level of symlink (e.g. on Mac)
8384             JAVA_HOME=$(readlink $JAVACOMPILER)
8385             if test "$(dirname $JAVA_HOME)" = "."; then
8386                 # we've got no path to trim back
8387                 JAVA_HOME=""
8388             fi
8389         else
8390             # else warn
8391             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
8392             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
8393             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
8394             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
8395         fi
8396         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
8397         if test "$JAVA_HOME" != "/usr"; then
8398             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8399                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
8400                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
8401                 dnl Tiger already returns a JDK path...
8402                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
8403             else
8404                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
8405                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
8406                 dnl that checks which version to run
8407                 if test -f "$JAVA_HOME"; then
8408                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
8409                 fi
8410             fi
8411         fi
8412     fi
8413     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
8415     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
8416     if test -z "$JAVA_HOME"; then
8417         if test "x$with_jdk_home" = "x"; then
8418             cat > findhome.java <<_ACEOF
8419 [import java.io.File;
8421 class findhome
8423     public static void main(String args[])
8424     {
8425         String jrelocation = System.getProperty("java.home");
8426         File jre = new File(jrelocation);
8427         System.out.println(jre.getParent());
8428     }
8430 _ACEOF
8431             AC_MSG_CHECKING([if javac works])
8432             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
8433             AC_TRY_EVAL(javac_cmd)
8434             if test $? = 0 -a -f ./findhome.class; then
8435                 AC_MSG_RESULT([javac works])
8436             else
8437                 echo "configure: javac test failed" >&5
8438                 cat findhome.java >&5
8439                 AC_MSG_ERROR([javac does not work - java projects will not build!])
8440             fi
8441             AC_MSG_CHECKING([if gij knows its java.home])
8442             JAVA_HOME=`$JAVAINTERPRETER findhome`
8443             if test $? = 0 -a "$JAVA_HOME" != ""; then
8444                 AC_MSG_RESULT([$JAVA_HOME])
8445             else
8446                 echo "configure: java test failed" >&5
8447                 cat findhome.java >&5
8448                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
8449             fi
8450             # clean-up after ourselves
8451             rm -f ./findhome.java ./findhome.class
8452         else
8453             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
8454         fi
8455     fi
8457     # now check if $JAVA_HOME is really valid
8458     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8459         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
8460             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
8461             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
8462             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
8463             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
8464             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
8465             add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
8466         fi
8467     fi
8468     PathFormat "$JAVA_HOME"
8469     JAVA_HOME="$formatted_path"
8472 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
8473     "$_os" != Darwin
8474 then
8475     AC_MSG_CHECKING([for JAWT lib])
8476     if test "$_os" = WINNT; then
8477         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
8478         JAWTLIB=jawt.lib
8479     else
8480         case "$host_cpu" in
8481         arm*)
8482             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
8483             JAVA_ARCH=$my_java_arch
8484             ;;
8485         i*86)
8486             my_java_arch=i386
8487             ;;
8488         m68k)
8489             my_java_arch=m68k
8490             ;;
8491         powerpc)
8492             my_java_arch=ppc
8493             ;;
8494         powerpc64)
8495             my_java_arch=ppc64
8496             ;;
8497         powerpc64le)
8498             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
8499             JAVA_ARCH=$my_java_arch
8500             ;;
8501         sparc64)
8502             my_java_arch=sparcv9
8503             ;;
8504         x86_64)
8505             my_java_arch=amd64
8506             ;;
8507         *)
8508             my_java_arch=$host_cpu
8509             ;;
8510         esac
8511         # This is where JDK9 puts the library
8512         if test -e "$JAVA_HOME/lib/libjawt.so"; then
8513             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
8514         else
8515             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
8516         fi
8517         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
8518     fi
8519     AC_MSG_RESULT([$JAWTLIB])
8521 AC_SUBST(JAWTLIB)
8523 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
8524     case "$host_os" in
8526     aix*)
8527         JAVAINC="-I$JAVA_HOME/include"
8528         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
8529         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8530         ;;
8532     cygwin*|wsl*)
8533         JAVAINC="-I$JAVA_HOME/include/win32"
8534         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
8535         ;;
8537     darwin*|macos*)
8538         if test -d "$JAVA_HOME/include/darwin"; then
8539             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
8540         else
8541             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
8542         fi
8543         ;;
8545     dragonfly*)
8546         JAVAINC="-I$JAVA_HOME/include"
8547         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8548         ;;
8550     freebsd*)
8551         JAVAINC="-I$JAVA_HOME/include"
8552         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
8553         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
8554         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8555         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8556         ;;
8558     k*bsd*-gnu*)
8559         JAVAINC="-I$JAVA_HOME/include"
8560         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8561         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8562         ;;
8564     linux-gnu*)
8565         JAVAINC="-I$JAVA_HOME/include"
8566         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8567         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8568         ;;
8570     *netbsd*)
8571         JAVAINC="-I$JAVA_HOME/include"
8572         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
8573         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8574        ;;
8576     openbsd*)
8577         JAVAINC="-I$JAVA_HOME/include"
8578         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
8579         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8580         ;;
8582     solaris*)
8583         JAVAINC="-I$JAVA_HOME/include"
8584         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
8585         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8586         ;;
8587     esac
8589 SOLARINC="$SOLARINC $JAVAINC"
8591 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8592     JAVA_HOME_FOR_BUILD=$JAVA_HOME
8593     JAVAIFLAGS_FOR_BUILD=$JAVAIFLAGS
8594     JDK_FOR_BUILD=$JDK
8597 AC_SUBST(JAVACFLAGS)
8598 AC_SUBST(JAVACOMPILER)
8599 AC_SUBST(JAVAINTERPRETER)
8600 AC_SUBST(JAVAIFLAGS)
8601 AC_SUBST(JAVAIFLAGS_FOR_BUILD)
8602 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
8603 AC_SUBST(JAVA_HOME)
8604 AC_SUBST(JAVA_HOME_FOR_BUILD)
8605 AC_SUBST(JDK)
8606 AC_SUBST(JDK_FOR_BUILD)
8607 AC_SUBST(JAVA_SOURCE_VER)
8608 AC_SUBST(JAVA_TARGET_VER)
8611 dnl ===================================================================
8612 dnl Export file validation
8613 dnl ===================================================================
8614 AC_MSG_CHECKING([whether to enable export file validation])
8615 if test "$with_export_validation" != "no"; then
8616     if test -z "$ENABLE_JAVA"; then
8617         if test "$with_export_validation" = "yes"; then
8618             AC_MSG_ERROR([requested, but Java is disabled])
8619         else
8620             AC_MSG_RESULT([no, as Java is disabled])
8621         fi
8622     elif ! test -d "${SRC_ROOT}/schema"; then
8623         if test "$with_export_validation" = "yes"; then
8624             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
8625         else
8626             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
8627         fi
8628     else
8629         AC_MSG_RESULT([yes])
8630         AC_DEFINE(HAVE_EXPORT_VALIDATION)
8632         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
8633         if test -z "$ODFVALIDATOR"; then
8634             # remember to download the ODF toolkit with validator later
8635             AC_MSG_NOTICE([no odfvalidator found, will download it])
8636             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
8637             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
8639             # and fetch name of odfvalidator jar name from download.lst
8640             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
8641             AC_SUBST(ODFVALIDATOR_JAR)
8643             if test -z "$ODFVALIDATOR_JAR"; then
8644                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
8645             fi
8646         fi
8647         if test "$build_os" = "cygwin"; then
8648             # In case of Cygwin it will be executed from Windows,
8649             # so we need to run bash and absolute path to validator
8650             # so instead of "odfvalidator" it will be
8651             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
8652             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
8653         else
8654             ODFVALIDATOR="sh $ODFVALIDATOR"
8655         fi
8656         AC_SUBST(ODFVALIDATOR)
8659         AC_PATH_PROGS(OFFICEOTRON, officeotron)
8660         if test -z "$OFFICEOTRON"; then
8661             # remember to download the officeotron with validator later
8662             AC_MSG_NOTICE([no officeotron found, will download it])
8663             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
8664             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
8666             # and fetch name of officeotron jar name from download.lst
8667             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
8668             AC_SUBST(OFFICEOTRON_JAR)
8670             if test -z "$OFFICEOTRON_JAR"; then
8671                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
8672             fi
8673         else
8674             # check version of existing officeotron
8675             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
8676             if test 0"$OFFICEOTRON_VER" -lt 704; then
8677                 AC_MSG_ERROR([officeotron too old])
8678             fi
8679         fi
8680         if test "$build_os" = "cygwin"; then
8681             # In case of Cygwin it will be executed from Windows,
8682             # so we need to run bash and absolute path to validator
8683             # so instead of "odfvalidator" it will be
8684             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
8685             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
8686         else
8687             OFFICEOTRON="sh $OFFICEOTRON"
8688         fi
8689     fi
8690     AC_SUBST(OFFICEOTRON)
8691 else
8692     AC_MSG_RESULT([no])
8695 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
8696 if test "$with_bffvalidator" != "no"; then
8697     AC_DEFINE(HAVE_BFFVALIDATOR)
8699     if test "$with_export_validation" = "no"; then
8700         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
8701     fi
8703     if test "$with_bffvalidator" = "yes"; then
8704         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
8705     else
8706         BFFVALIDATOR="$with_bffvalidator"
8707     fi
8709     if test "$build_os" = "cygwin"; then
8710         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
8711             AC_MSG_RESULT($BFFVALIDATOR)
8712         else
8713             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8714         fi
8715     elif test -n "$BFFVALIDATOR"; then
8716         # We are not in Cygwin but need to run Windows binary with wine
8717         AC_PATH_PROGS(WINE, wine)
8719         # so swap in a shell wrapper that converts paths transparently
8720         BFFVALIDATOR_EXE="$BFFVALIDATOR"
8721         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
8722         AC_SUBST(BFFVALIDATOR_EXE)
8723         AC_MSG_RESULT($BFFVALIDATOR)
8724     else
8725         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8726     fi
8727     AC_SUBST(BFFVALIDATOR)
8728 else
8729     AC_MSG_RESULT([no])
8732 dnl ===================================================================
8733 dnl Check for C preprocessor to use
8734 dnl ===================================================================
8735 AC_MSG_CHECKING([which C preprocessor to use in idlc])
8736 if test -n "$with_idlc_cpp"; then
8737     AC_MSG_RESULT([$with_idlc_cpp])
8738     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
8739 else
8740     AC_MSG_RESULT([ucpp])
8741     AC_MSG_CHECKING([which ucpp tp use])
8742     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
8743         AC_MSG_RESULT([external])
8744         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
8745     else
8746         AC_MSG_RESULT([internal])
8747         BUILD_TYPE="$BUILD_TYPE UCPP"
8748     fi
8750 AC_SUBST(SYSTEM_UCPP)
8752 dnl ===================================================================
8753 dnl Check for epm (not needed for Windows)
8754 dnl ===================================================================
8755 AC_MSG_CHECKING([whether to enable EPM for packing])
8756 if test "$enable_epm" = "yes"; then
8757     AC_MSG_RESULT([yes])
8758     if test "$_os" != "WINNT"; then
8759         if test $_os = Darwin; then
8760             EPM=internal
8761         elif test -n "$with_epm"; then
8762             EPM=$with_epm
8763         else
8764             AC_PATH_PROG(EPM, epm, no)
8765         fi
8766         if test "$EPM" = "no" -o "$EPM" = "internal"; then
8767             AC_MSG_NOTICE([EPM will be built.])
8768             BUILD_TYPE="$BUILD_TYPE EPM"
8769             EPM=${WORKDIR}/UnpackedTarball/epm/epm
8770         else
8771             # Gentoo has some epm which is something different...
8772             AC_MSG_CHECKING([whether the found epm is the right epm])
8773             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
8774                 AC_MSG_RESULT([yes])
8775             else
8776                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8777             fi
8778             AC_MSG_CHECKING([epm version])
8779             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
8780             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
8781                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
8782                 AC_MSG_RESULT([OK, >= 3.7])
8783             else
8784                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
8785                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8786             fi
8787         fi
8788     fi
8790     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
8791         AC_MSG_CHECKING([for rpm])
8792         for a in "$RPM" rpmbuild rpm; do
8793             $a --usage >/dev/null 2> /dev/null
8794             if test $? -eq 0; then
8795                 RPM=$a
8796                 break
8797             else
8798                 $a --version >/dev/null 2> /dev/null
8799                 if test $? -eq 0; then
8800                     RPM=$a
8801                     break
8802                 fi
8803             fi
8804         done
8805         if test -z "$RPM"; then
8806             AC_MSG_ERROR([not found])
8807         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
8808             RPM_PATH=`which $RPM`
8809             AC_MSG_RESULT([$RPM_PATH])
8810             SCPDEFS="$SCPDEFS -DWITH_RPM"
8811         else
8812             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
8813         fi
8814     fi
8815     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
8816         AC_PATH_PROG(DPKG, dpkg, no)
8817         if test "$DPKG" = "no"; then
8818             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
8819         fi
8820     fi
8821     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
8822        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8823         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
8824             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
8825                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
8826                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
8827                     AC_MSG_RESULT([yes])
8828                 else
8829                     AC_MSG_RESULT([no])
8830                     if echo "$PKGFORMAT" | $GREP -q rpm; then
8831                         _pt="rpm"
8832                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
8833                         add_warning "the rpms will need to be installed with --nodeps"
8834                     else
8835                         _pt="pkg"
8836                     fi
8837                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
8838                     add_warning "the ${_pt}s will not be relocatable"
8839                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
8840                                  relocation will work, you need to patch your epm with the
8841                                  patch in epm/epm-3.7.patch or build with
8842                                  --with-epm=internal which will build a suitable epm])
8843                 fi
8844             fi
8845         fi
8846     fi
8847     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8848         AC_PATH_PROG(PKGMK, pkgmk, no)
8849         if test "$PKGMK" = "no"; then
8850             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
8851         fi
8852     fi
8853     AC_SUBST(RPM)
8854     AC_SUBST(DPKG)
8855     AC_SUBST(PKGMK)
8856 else
8857     for i in $PKGFORMAT; do
8858         case "$i" in
8859         aix | bsd | deb | pkg | rpm | native | portable)
8860             AC_MSG_ERROR(
8861                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
8862             ;;
8863         esac
8864     done
8865     AC_MSG_RESULT([no])
8866     EPM=NO
8868 AC_SUBST(EPM)
8870 ENABLE_LWP=
8871 if test "$enable_lotuswordpro" = "yes"; then
8872     ENABLE_LWP="TRUE"
8874 AC_SUBST(ENABLE_LWP)
8876 dnl ===================================================================
8877 dnl Check for building ODK
8878 dnl ===================================================================
8879 if test "$enable_odk" != yes; then
8880     unset DOXYGEN
8881 else
8882     if test "$with_doxygen" = no; then
8883         AC_MSG_CHECKING([for doxygen])
8884         unset DOXYGEN
8885         AC_MSG_RESULT([no])
8886     else
8887         if test "$with_doxygen" = yes; then
8888             AC_PATH_PROG([DOXYGEN], [doxygen])
8889             if test -z "$DOXYGEN"; then
8890                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
8891             fi
8892             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
8893                 if ! dot -V 2>/dev/null; then
8894                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
8895                 fi
8896             fi
8897         else
8898             AC_MSG_CHECKING([for doxygen])
8899             DOXYGEN=$with_doxygen
8900             AC_MSG_RESULT([$DOXYGEN])
8901         fi
8902         if test -n "$DOXYGEN"; then
8903             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
8904             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
8905             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
8906                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
8907             fi
8908         fi
8909     fi
8911 AC_SUBST([DOXYGEN])
8913 AC_MSG_CHECKING([whether to build the ODK])
8914 if test "$enable_odk" = yes; then
8915     AC_MSG_RESULT([yes])
8916     BUILD_TYPE="$BUILD_TYPE ODK"
8917 else
8918     AC_MSG_RESULT([no])
8921 dnl ===================================================================
8922 dnl Check for system zlib
8923 dnl ===================================================================
8924 if test "$with_system_zlib" = "auto"; then
8925     case "$_os" in
8926     WINNT)
8927         with_system_zlib="$with_system_libs"
8928         ;;
8929     *)
8930         if test "$enable_fuzzers" != "yes"; then
8931             with_system_zlib=yes
8932         else
8933             with_system_zlib=no
8934         fi
8935         ;;
8936     esac
8939 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8940 dnl and has no pkg-config for it at least on some tinderboxes,
8941 dnl so leaving that out for now
8942 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8943 AC_MSG_CHECKING([which zlib to use])
8944 if test "$with_system_zlib" = "yes"; then
8945     AC_MSG_RESULT([external])
8946     SYSTEM_ZLIB=TRUE
8947     AC_CHECK_HEADER(zlib.h, [],
8948         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8949     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8950         [AC_MSG_ERROR(zlib not found or functional)], [])
8951 else
8952     AC_MSG_RESULT([internal])
8953     SYSTEM_ZLIB=
8954     BUILD_TYPE="$BUILD_TYPE ZLIB"
8955     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8956     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8958 AC_SUBST(ZLIB_CFLAGS)
8959 AC_SUBST(ZLIB_LIBS)
8960 AC_SUBST(SYSTEM_ZLIB)
8962 dnl ===================================================================
8963 dnl Check for system jpeg
8964 dnl ===================================================================
8965 AC_MSG_CHECKING([which libjpeg to use])
8966 if test "$with_system_jpeg" = "yes"; then
8967     AC_MSG_RESULT([external])
8968     SYSTEM_LIBJPEG=TRUE
8969     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8970         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8971     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8972         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8973 else
8974     SYSTEM_LIBJPEG=
8975     AC_MSG_RESULT([internal, libjpeg-turbo])
8976     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8977     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
8978     if test "$COM" = "MSC"; then
8979         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
8980     else
8981         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
8982     fi
8984     case "$host_cpu" in
8985     x86_64 | amd64 | i*86 | x86 | ia32)
8986         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8987         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8988             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8989                 NASM="$LODE_HOME/opt/bin/nasm"
8990             elif test -x "/opt/lo/bin/nasm"; then
8991                 NASM="/opt/lo/bin/nasm"
8992             fi
8993         fi
8995         if test -n "$NASM"; then
8996             AC_MSG_CHECKING([for object file format of host system])
8997             case "$host_os" in
8998               cygwin* | mingw* | pw32* | wsl*)
8999                 case "$host_cpu" in
9000                   x86_64)
9001                     objfmt='Win64-COFF'
9002                     ;;
9003                   *)
9004                     objfmt='Win32-COFF'
9005                     ;;
9006                 esac
9007               ;;
9008               msdosdjgpp* | go32*)
9009                 objfmt='COFF'
9010               ;;
9011               os2-emx*) # not tested
9012                 objfmt='MSOMF' # obj
9013               ;;
9014               linux*coff* | linux*oldld*)
9015                 objfmt='COFF' # ???
9016               ;;
9017               linux*aout*)
9018                 objfmt='a.out'
9019               ;;
9020               linux*)
9021                 case "$host_cpu" in
9022                   x86_64)
9023                     objfmt='ELF64'
9024                     ;;
9025                   *)
9026                     objfmt='ELF'
9027                     ;;
9028                 esac
9029               ;;
9030               kfreebsd* | freebsd* | netbsd* | openbsd*)
9031                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
9032                   objfmt='BSD-a.out'
9033                 else
9034                   case "$host_cpu" in
9035                     x86_64 | amd64)
9036                       objfmt='ELF64'
9037                       ;;
9038                     *)
9039                       objfmt='ELF'
9040                       ;;
9041                   esac
9042                 fi
9043               ;;
9044               solaris* | sunos* | sysv* | sco*)
9045                 case "$host_cpu" in
9046                   x86_64)
9047                     objfmt='ELF64'
9048                     ;;
9049                   *)
9050                     objfmt='ELF'
9051                     ;;
9052                 esac
9053               ;;
9054               darwin* | rhapsody* | nextstep* | openstep* | macos*)
9055                 case "$host_cpu" in
9056                   x86_64)
9057                     objfmt='Mach-O64'
9058                     ;;
9059                   *)
9060                     objfmt='Mach-O'
9061                     ;;
9062                 esac
9063               ;;
9064               *)
9065                 objfmt='ELF ?'
9066               ;;
9067             esac
9069             AC_MSG_RESULT([$objfmt])
9070             if test "$objfmt" = 'ELF ?'; then
9071               objfmt='ELF'
9072               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
9073             fi
9075             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
9076             case "$objfmt" in
9077               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
9078               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
9079               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
9080               COFF)       NAFLAGS='-fcoff -DCOFF';;
9081               a.out)      NAFLAGS='-faout -DAOUT';;
9082               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
9083               ELF)        NAFLAGS='-felf -DELF';;
9084               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
9085               RDF)        NAFLAGS='-frdf -DRDF';;
9086               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
9087               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
9088             esac
9089             AC_MSG_RESULT([$NAFLAGS])
9091             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
9092             cat > conftest.asm << EOF
9093             [%line __oline__ "configure"
9094                     section .text
9095                     global  _main,main
9096             _main:
9097             main:   xor     eax,eax
9098                     ret
9099             ]
9101             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
9102             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
9103               AC_MSG_RESULT(yes)
9104             else
9105               echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
9106               cat conftest.asm >&AS_MESSAGE_LOG_FD
9107               rm -rf conftest*
9108               AC_MSG_RESULT(no)
9109               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
9110               NASM=""
9111             fi
9113         fi
9115         if test -z "$NASM"; then
9116 cat << _EOS
9117 ****************************************************************************
9118 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
9119 To get one please:
9121 _EOS
9122             if test "$build_os" = "cygwin"; then
9123 cat << _EOS
9124 install a pre-compiled binary for Win32
9126 mkdir -p /opt/lo/bin
9127 cd /opt/lo/bin
9128 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
9129 chmod +x nasm
9131 or get and install one from http://www.nasm.us/
9133 Then re-run autogen.sh
9135 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
9136 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
9138 _EOS
9139             else
9140 cat << _EOS
9141 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
9143 _EOS
9144             fi
9145             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
9146             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
9147         fi
9148       ;;
9149     esac
9152 AC_SUBST(NASM)
9153 AC_SUBST(LIBJPEG_CFLAGS)
9154 AC_SUBST(LIBJPEG_LIBS)
9155 AC_SUBST(SYSTEM_LIBJPEG)
9157 dnl ===================================================================
9158 dnl Check for system clucene
9159 dnl ===================================================================
9160 dnl we should rather be using
9161 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
9162 dnl but the contribs-lib check seems tricky
9163 AC_MSG_CHECKING([which clucene to use])
9164 if test "$with_system_clucene" = "yes"; then
9165     AC_MSG_RESULT([external])
9166     SYSTEM_CLUCENE=TRUE
9167     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
9168     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
9169     FilterLibs "${CLUCENE_LIBS}"
9170     CLUCENE_LIBS="${filteredlibs}"
9171     AC_LANG_PUSH([C++])
9172     save_CXXFLAGS=$CXXFLAGS
9173     save_CPPFLAGS=$CPPFLAGS
9174     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
9175     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
9176     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
9177     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
9178     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
9179                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
9180     CXXFLAGS=$save_CXXFLAGS
9181     CPPFLAGS=$save_CPPFLAGS
9182     AC_LANG_POP([C++])
9184     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
9185 else
9186     AC_MSG_RESULT([internal])
9187     SYSTEM_CLUCENE=
9188     BUILD_TYPE="$BUILD_TYPE CLUCENE"
9190 AC_SUBST(SYSTEM_CLUCENE)
9191 AC_SUBST(CLUCENE_CFLAGS)
9192 AC_SUBST(CLUCENE_LIBS)
9194 dnl ===================================================================
9195 dnl Check for system expat
9196 dnl ===================================================================
9197 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
9199 dnl ===================================================================
9200 dnl Check for system xmlsec
9201 dnl ===================================================================
9202 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
9204 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
9205 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
9206     ENABLE_EOT="TRUE"
9207     AC_DEFINE([ENABLE_EOT])
9208     AC_MSG_RESULT([yes])
9210     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
9211 else
9212     ENABLE_EOT=
9213     AC_MSG_RESULT([no])
9215 AC_SUBST([ENABLE_EOT])
9217 dnl ===================================================================
9218 dnl Check for DLP libs
9219 dnl ===================================================================
9220 AS_IF([test "$COM" = "MSC"],
9221       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
9222       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
9224 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
9226 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
9228 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
9230 AS_IF([test "$COM" = "MSC"],
9231       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
9232       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
9234 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
9236 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
9238 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
9239 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.12])
9241 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
9243 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
9245 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
9247 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
9248 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.19])
9250 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
9251 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.10])
9253 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
9255 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
9256 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
9258 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
9260 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
9262 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
9264 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
9266 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
9267 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.7])
9269 dnl ===================================================================
9270 dnl Check for system lcms2
9271 dnl ===================================================================
9272 if test "$with_system_lcms2" != "yes"; then
9273     SYSTEM_LCMS2=
9275 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
9276 if test "$GCC" = "yes"; then
9277     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
9279 if test "$COM" = "MSC"; then # override the above
9280     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
9283 dnl ===================================================================
9284 dnl Check for system cppunit
9285 dnl ===================================================================
9286 if test "$_os" != "Android" ; then
9287     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
9290 dnl ===================================================================
9291 dnl Check whether freetype is available
9292 dnl ===================================================================
9293 if test  "$test_freetype" = "yes"; then
9294     AC_MSG_CHECKING([whether freetype is available])
9295     # FreeType has 3 different kinds of versions
9296     # * release, like 2.4.10
9297     # * libtool, like 13.0.7 (this what pkg-config returns)
9298     # * soname
9299     # FreeType's docs/VERSION.DLL provides a table mapping between the three
9300     #
9301     # 9.9.3 is 2.2.0
9302     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
9303     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9304     FilterLibs "${FREETYPE_LIBS}"
9305     FREETYPE_LIBS="${filteredlibs}"
9306     SYSTEM_FREETYPE=TRUE
9307 else
9308     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
9309     if test "x$ac_config_site_64bit_host" = xYES; then
9310         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
9311     else
9312         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
9313     fi
9315 AC_SUBST(FREETYPE_CFLAGS)
9316 AC_SUBST(FREETYPE_LIBS)
9317 AC_SUBST([SYSTEM_FREETYPE])
9319 # ===================================================================
9320 # Check for system libxslt
9321 # to prevent incompatibilities between internal libxml2 and external libxslt,
9322 # or vice versa, use with_system_libxml here
9323 # ===================================================================
9324 if test "$with_system_libxml" = "auto"; then
9325     case "$_os" in
9326     WINNT|iOS|Android)
9327         with_system_libxml="$with_system_libs"
9328         ;;
9329     Emscripten)
9330         with_system_libxml=no
9331         ;;
9332     *)
9333         if test "$enable_fuzzers" != "yes"; then
9334             with_system_libxml=yes
9335         else
9336             with_system_libxml=no
9337         fi
9338         ;;
9339     esac
9342 AC_MSG_CHECKING([which libxslt to use])
9343 if test "$with_system_libxml" = "yes"; then
9344     AC_MSG_RESULT([external])
9345     SYSTEM_LIBXSLT=TRUE
9346     if test "$_os" = "Darwin"; then
9347         dnl make sure to use SDK path
9348         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9349         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
9350         dnl omit -L/usr/lib
9351         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
9352         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
9353     else
9354         PKG_CHECK_MODULES(LIBXSLT, libxslt)
9355         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9356         FilterLibs "${LIBXSLT_LIBS}"
9357         LIBXSLT_LIBS="${filteredlibs}"
9358         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
9359         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9360         FilterLibs "${LIBEXSLT_LIBS}"
9361         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
9362     fi
9364     dnl Check for xsltproc
9365     AC_PATH_PROG(XSLTPROC, xsltproc, no)
9366     if test "$XSLTPROC" = "no"; then
9367         AC_MSG_ERROR([xsltproc is required])
9368     fi
9369 else
9370     AC_MSG_RESULT([internal])
9371     SYSTEM_LIBXSLT=
9372     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
9374 AC_SUBST(SYSTEM_LIBXSLT)
9375 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
9376     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
9378 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
9380 AC_SUBST(LIBEXSLT_CFLAGS)
9381 AC_SUBST(LIBEXSLT_LIBS)
9382 AC_SUBST(LIBXSLT_CFLAGS)
9383 AC_SUBST(LIBXSLT_LIBS)
9384 AC_SUBST(XSLTPROC)
9386 # ===================================================================
9387 # Check for system libxml
9388 # ===================================================================
9389 AC_MSG_CHECKING([which libxml to use])
9390 if test "$with_system_libxml" = "yes"; then
9391     AC_MSG_RESULT([external])
9392     SYSTEM_LIBXML=TRUE
9393     if test "$_os" = "Darwin"; then
9394         dnl make sure to use SDK path
9395         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9396         dnl omit -L/usr/lib
9397         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
9398     elif test $_os = iOS; then
9399         dnl make sure to use SDK path
9400         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
9401         LIBXML_CFLAGS="-I$usr/include/libxml2"
9402         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
9403     else
9404         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
9405         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9406         FilterLibs "${LIBXML_LIBS}"
9407         LIBXML_LIBS="${filteredlibs}"
9408     fi
9410     dnl Check for xmllint
9411     AC_PATH_PROG(XMLLINT, xmllint, no)
9412     if test "$XMLLINT" = "no"; then
9413         AC_MSG_ERROR([xmllint is required])
9414     fi
9415 else
9416     AC_MSG_RESULT([internal])
9417     SYSTEM_LIBXML=
9418     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
9419     if test "$COM" = "MSC"; then
9420         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9421     fi
9422     if test "$COM" = "MSC"; then
9423         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
9424     else
9425         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
9426         if test "$_os" = Android; then
9427             LIBXML_LIBS="$LIBXML_LIBS -lm"
9428         fi
9429     fi
9430     BUILD_TYPE="$BUILD_TYPE LIBXML2"
9432 AC_SUBST(SYSTEM_LIBXML)
9433 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
9434     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
9436 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
9437 AC_SUBST(LIBXML_CFLAGS)
9438 AC_SUBST(LIBXML_LIBS)
9439 AC_SUBST(XMLLINT)
9441 # =====================================================================
9442 # Checking for a Python interpreter with version >= 3.3.
9443 # Optionally user can pass an option to configure, i. e.
9444 # ./configure PYTHON=/usr/bin/python
9445 # =====================================================================
9446 if test $_os = Darwin -a "$enable_python" != no -a "$enable_python" != fully-internal -a "$enable_python" != internal -a "$enable_python" != system; then
9447     # Only allowed choices for macOS are 'no', 'internal' (default), and 'fully-internal'
9448     # unless PYTHON is defined as above which allows 'system'
9449     enable_python=internal
9451 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
9452     if test -n "$PYTHON"; then
9453         PYTHON_FOR_BUILD=$PYTHON
9454     else
9455         # This allows a lack of system python with no error, we use internal one in that case.
9456         AM_PATH_PYTHON([3.3],, [:])
9457         # Clean PYTHON_VERSION checked below if cross-compiling
9458         PYTHON_VERSION=""
9459         if test "$PYTHON" != ":"; then
9460             PYTHON_FOR_BUILD=$PYTHON
9461         fi
9462     fi
9464 AC_SUBST(PYTHON_FOR_BUILD)
9466 # Checks for Python to use for Pyuno
9467 AC_MSG_CHECKING([which Python to use for Pyuno])
9468 case "$enable_python" in
9469 no|disable)
9470     if test -z $PYTHON_FOR_BUILD; then
9471         # Python is required to build LibreOffice. In theory we could separate the build-time Python
9472         # requirement from the choice whether to include Python stuff in the installer, but why
9473         # bother?
9474         if test "$cross_compiling" = yes; then
9475             enable_python=system
9476         else
9477             AC_MSG_ERROR([Python is required at build time.])
9478         fi
9479     fi
9480     enable_python=no
9481     AC_MSG_RESULT([none])
9482     ;;
9483 ""|yes|auto)
9484     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
9485         AC_MSG_RESULT([no, overridden by --disable-scripting])
9486         enable_python=no
9487     elif test $build_os = cygwin; then
9488         dnl When building on Windows we don't attempt to use any installed
9489         dnl "system"  Python.
9490         AC_MSG_RESULT([fully internal])
9491         enable_python=internal
9492     elif test "$cross_compiling" = yes; then
9493         AC_MSG_RESULT([system])
9494         enable_python=system
9495     else
9496         # Unset variables set by the above AM_PATH_PYTHON so that
9497         # we actually do check anew.
9498         AC_MSG_RESULT([])
9499         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
9500         AM_PATH_PYTHON([3.3],, [:])
9501         AC_MSG_CHECKING([which Python to use for Pyuno])
9502         if test "$PYTHON" = ":"; then
9503             if test -z "$PYTHON_FOR_BUILD"; then
9504                 AC_MSG_RESULT([fully internal])
9505             else
9506                 AC_MSG_RESULT([internal])
9507             fi
9508             enable_python=internal
9509         else
9510             AC_MSG_RESULT([system])
9511             enable_python=system
9512         fi
9513     fi
9514     ;;
9515 internal)
9516     AC_MSG_RESULT([internal])
9517     ;;
9518 fully-internal)
9519     AC_MSG_RESULT([fully internal])
9520     enable_python=internal
9521     ;;
9522 system)
9523     AC_MSG_RESULT([system])
9524     if test "$_os" = Darwin -a -z "$PYTHON"; then
9525         AC_MSG_ERROR([--enable-python=system doesn't work on macOS because the version provided is obsolete])
9526     fi
9527     ;;
9529     AC_MSG_ERROR([Incorrect --enable-python option])
9530     ;;
9531 esac
9533 if test $enable_python != no; then
9534     BUILD_TYPE="$BUILD_TYPE PYUNO"
9537 if test $enable_python = system; then
9538     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
9539         # Fallback: Accept these in the environment, or as set above
9540         # for MacOSX.
9541         :
9542     elif test "$cross_compiling" != yes; then
9543         # Unset variables set by the above AM_PATH_PYTHON so that
9544         # we actually do check anew.
9545         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
9546         # This causes an error if no python command is found
9547         AM_PATH_PYTHON([3.3])
9548         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
9549         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
9550         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
9551         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
9552         if test -z "$PKG_CONFIG"; then
9553             PYTHON_CFLAGS="-I$python_include"
9554             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
9555         elif $PKG_CONFIG --exists python-$python_version-embed; then
9556             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
9557             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
9558         elif $PKG_CONFIG --exists python-$python_version; then
9559             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
9560             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
9561         else
9562             PYTHON_CFLAGS="-I$python_include"
9563             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
9564         fi
9565         FilterLibs "${PYTHON_LIBS}"
9566         PYTHON_LIBS="${filteredlibs}"
9567     else
9568         dnl How to find out the cross-compilation Python installation path?
9569         AC_MSG_CHECKING([for python version])
9570         AS_IF([test -n "$PYTHON_VERSION"],
9571               [AC_MSG_RESULT([$PYTHON_VERSION])],
9572               [AC_MSG_RESULT([not found])
9573                AC_MSG_ERROR([no usable python found])])
9574         test -n "$PYTHON_CFLAGS" && break
9575     fi
9577     dnl Check if the headers really work
9578     save_CPPFLAGS="$CPPFLAGS"
9579     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
9580     AC_CHECK_HEADER(Python.h)
9581     CPPFLAGS="$save_CPPFLAGS"
9583     # let the PYTHON_FOR_BUILD match the same python installation that
9584     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
9585     # better for PythonTests.
9586     PYTHON_FOR_BUILD=$PYTHON
9589 if test "$with_lxml" != no; then
9590     if test -z "$PYTHON_FOR_BUILD"; then
9591         case $build_os in
9592             cygwin)
9593                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
9594                 ;;
9595             *)
9596                 if test "$cross_compiling" != yes ; then
9597                     BUILD_TYPE="$BUILD_TYPE LXML"
9598                 fi
9599                 ;;
9600         esac
9601     else
9602         AC_MSG_CHECKING([for python lxml])
9603         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
9604             AC_MSG_RESULT([yes])
9605         else
9606             case $build_os in
9607                 cygwin)
9608                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
9609                     ;;
9610                 *)
9611                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
9612                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
9613                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
9614                         else
9615                             BUILD_TYPE="$BUILD_TYPE LXML"
9616                             AC_MSG_RESULT([no, using internal lxml])
9617                         fi
9618                     else
9619                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
9620                     fi
9621                     ;;
9622             esac
9623         fi
9624     fi
9627 dnl By now enable_python should be "system", "internal" or "no"
9628 case $enable_python in
9629 system)
9630     SYSTEM_PYTHON=TRUE
9632     if test "x$ac_cv_header_Python_h" != "xyes"; then
9633        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
9634     fi
9636     AC_LANG_PUSH(C)
9637     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
9638     AC_MSG_CHECKING([for correct python library version])
9639        AC_RUN_IFELSE([AC_LANG_SOURCE([[
9640 #include <Python.h>
9642 int main(int argc, char **argv) {
9643    if ((PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
9644    else return 1;
9646        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3])],[AC_MSG_RESULT([skipped; cross-compiling])])
9647     AC_LANG_POP(C)
9649     dnl FIXME Check if the Python library can be linked with, too?
9650     ;;
9652 internal)
9653     SYSTEM_PYTHON=
9654     PYTHON_VERSION_MAJOR=3
9655     PYTHON_VERSION_MINOR=8
9656     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.8
9657     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
9658         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
9659     fi
9660     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
9661     BUILD_TYPE="$BUILD_TYPE PYTHON"
9662     if test "$OS" = LINUX -o "$OS" = WNT ; then
9663         BUILD_TYPE="$BUILD_TYPE LIBFFI"
9664     fi
9665     # Embedded Python dies without Home set
9666     if test "$HOME" = ""; then
9667         export HOME=""
9668     fi
9669     ;;
9671     DISABLE_PYTHON=TRUE
9672     SYSTEM_PYTHON=
9673     ;;
9675     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
9676     ;;
9677 esac
9679 AC_SUBST(DISABLE_PYTHON)
9680 AC_SUBST(SYSTEM_PYTHON)
9681 AC_SUBST(PYTHON_CFLAGS)
9682 AC_SUBST(PYTHON_LIBS)
9683 AC_SUBST(PYTHON_VERSION)
9684 AC_SUBST(PYTHON_VERSION_MAJOR)
9685 AC_SUBST(PYTHON_VERSION_MINOR)
9687 AC_MSG_CHECKING([whether to build LibreLogo])
9688 case "$enable_python" in
9689 no|disable)
9690     AC_MSG_RESULT([no; Python disabled])
9691     ;;
9693     if test "${enable_librelogo}" = "no"; then
9694         AC_MSG_RESULT([no])
9695     else
9696         AC_MSG_RESULT([yes])
9697         BUILD_TYPE="${BUILD_TYPE} LIBRELOGO"
9698         AC_DEFINE([ENABLE_LIBRELOGO],1)
9699     fi
9700     ;;
9701 esac
9702 AC_SUBST(ENABLE_LIBRELOGO)
9704 ENABLE_MARIADBC=
9705 MARIADBC_MAJOR=1
9706 MARIADBC_MINOR=0
9707 MARIADBC_MICRO=2
9708 AC_MSG_CHECKING([whether to build the MariaDB/MySQL SDBC driver])
9709 if test "x$enable_mariadb_sdbc" != "xno" -a "$enable_mpl_subset" != "yes"; then
9710     ENABLE_MARIADBC=TRUE
9711     AC_MSG_RESULT([yes])
9712     BUILD_TYPE="$BUILD_TYPE MARIADBC"
9713 else
9714     AC_MSG_RESULT([no])
9716 AC_SUBST(ENABLE_MARIADBC)
9717 AC_SUBST(MARIADBC_MAJOR)
9718 AC_SUBST(MARIADBC_MINOR)
9719 AC_SUBST(MARIADBC_MICRO)
9721 if test "$ENABLE_MARIADBC" = "TRUE"; then
9722     dnl ===================================================================
9723     dnl Check for system MariaDB
9724     dnl ===================================================================
9725     AC_MSG_CHECKING([which MariaDB to use])
9726     if test "$with_system_mariadb" = "yes"; then
9727         AC_MSG_RESULT([external])
9728         SYSTEM_MARIADB_CONNECTOR_C=TRUE
9729         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
9730         if test -z "$MARIADBCONFIG"; then
9731             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
9732             if test -z "$MARIADBCONFIG"; then
9733                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
9734                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
9735             fi
9736         fi
9737         AC_MSG_CHECKING([MariaDB version])
9738         MARIADB_VERSION=`$MARIADBCONFIG --version`
9739         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
9740         if test "$MARIADB_MAJOR" -ge "5"; then
9741             AC_MSG_RESULT([OK])
9742         else
9743             AC_MSG_ERROR([too old, use 5.0.x or later])
9744         fi
9745         AC_MSG_CHECKING([for MariaDB Client library])
9746         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
9747         if test "$COM_IS_CLANG" = TRUE; then
9748             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
9749         fi
9750         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
9751         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
9752         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
9753         dnl linux32:
9754         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
9755             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
9756             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
9757                 | sed -e 's|/lib64/|/lib/|')
9758         fi
9759         FilterLibs "${MARIADB_LIBS}"
9760         MARIADB_LIBS="${filteredlibs}"
9761         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
9762         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
9763         if test "$enable_bundle_mariadb" = "yes"; then
9764             AC_MSG_RESULT([yes])
9765             BUNDLE_MARIADB_CONNECTOR_C=TRUE
9766             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
9768 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
9770 /g' | grep -E '(mysqlclient|mariadb)')
9771             if test "$_os" = "Darwin"; then
9772                 LIBMARIADB=${LIBMARIADB}.dylib
9773             elif test "$_os" = "WINNT"; then
9774                 LIBMARIADB=${LIBMARIADB}.dll
9775             else
9776                 LIBMARIADB=${LIBMARIADB}.so
9777             fi
9778             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
9779             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
9780             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
9781                 AC_MSG_RESULT([found.])
9782                 PathFormat "$LIBMARIADB_PATH"
9783                 LIBMARIADB_PATH="$formatted_path"
9784             else
9785                 AC_MSG_ERROR([not found.])
9786             fi
9787         else
9788             AC_MSG_RESULT([no])
9789             BUNDLE_MARIADB_CONNECTOR_C=
9790         fi
9791     else
9792         AC_MSG_RESULT([internal])
9793         SYSTEM_MARIADB_CONNECTOR_C=
9794         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
9795         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
9796         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
9797     fi
9799     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
9800     AC_SUBST(MARIADB_CFLAGS)
9801     AC_SUBST(MARIADB_LIBS)
9802     AC_SUBST(LIBMARIADB)
9803     AC_SUBST(LIBMARIADB_PATH)
9804     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
9807 dnl ===================================================================
9808 dnl Check for system hsqldb
9809 dnl ===================================================================
9810 if test "$with_java" != "no" -a "$cross_compiling" != "yes"; then
9811     HSQLDB_USE_JDBC_4_1=
9812     AC_MSG_CHECKING([which hsqldb to use])
9813     if test "$with_system_hsqldb" = "yes"; then
9814         AC_MSG_RESULT([external])
9815         SYSTEM_HSQLDB=TRUE
9816         if test -z $HSQLDB_JAR; then
9817             HSQLDB_JAR=/usr/share/java/hsqldb.jar
9818         fi
9819         if ! test -f $HSQLDB_JAR; then
9820                AC_MSG_ERROR(hsqldb.jar not found.)
9821         fi
9822         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
9823         export HSQLDB_JAR
9824         if $PERL -e \
9825            'use Archive::Zip;
9826             my $file = "$ENV{'HSQLDB_JAR'}";
9827             my $zip = Archive::Zip->new( $file );
9828             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
9829             if ( $mf =~ m/Specification-Version: 1.8.*/ )
9830             {
9831                 push @l, split(/\n/, $mf);
9832                 foreach my $line (@l)
9833                 {
9834                     if ($line =~ m/Specification-Version:/)
9835                     {
9836                         ($t, $version) = split (/:/,$line);
9837                         $version =~ s/^\s//;
9838                         ($a, $b, $c, $d) = split (/\./,$version);
9839                         if ($c == "0" && $d > "8")
9840                         {
9841                             exit 0;
9842                         }
9843                         else
9844                         {
9845                             exit 1;
9846                         }
9847                     }
9848                 }
9849             }
9850             else
9851             {
9852                 exit 1;
9853             }'; then
9854             AC_MSG_RESULT([yes])
9855         else
9856             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
9857         fi
9858     else
9859         AC_MSG_RESULT([internal])
9860         SYSTEM_HSQLDB=
9861         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9862         NEED_ANT=TRUE
9863         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
9864         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
9865         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
9866             AC_MSG_RESULT([yes])
9867             HSQLDB_USE_JDBC_4_1=TRUE
9868         else
9869             AC_MSG_RESULT([no])
9870         fi
9871     fi
9872 else
9873     if test "$with_java" != "no" -a -z "$HSQLDB_JAR"; then
9874         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9875     fi
9877 AC_SUBST(SYSTEM_HSQLDB)
9878 AC_SUBST(HSQLDB_JAR)
9879 AC_SUBST([HSQLDB_USE_JDBC_4_1])
9881 dnl ===================================================================
9882 dnl Check for PostgreSQL stuff
9883 dnl ===================================================================
9884 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
9885 if test "x$enable_postgresql_sdbc" != "xno"; then
9886     AC_MSG_RESULT([yes])
9887     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
9889     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
9890         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
9891     fi
9892     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
9893         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
9894     fi
9896     postgres_interface=""
9897     if test "$with_system_postgresql" = "yes"; then
9898         postgres_interface="external PostgreSQL"
9899         SYSTEM_POSTGRESQL=TRUE
9900         if test "$_os" = Darwin; then
9901             supp_path=''
9902             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
9903                 pg_supp_path="$P_SEP$d$pg_supp_path"
9904             done
9905         fi
9906         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
9907         if test -n "$PGCONFIG"; then
9908             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
9909             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
9910         else
9911             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
9912               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
9913               POSTGRESQL_LIB=$POSTGRESQL_LIBS
9914             ],[
9915               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
9916             ])
9917         fi
9918         FilterLibs "${POSTGRESQL_LIB}"
9919         POSTGRESQL_LIB="${filteredlibs}"
9920     else
9921         # if/when anything else than PostgreSQL uses Kerberos,
9922         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
9923         WITH_KRB5=
9924         WITH_GSSAPI=
9925         case "$_os" in
9926         Darwin)
9927             # macOS has system MIT Kerberos 5 since 10.4
9928             if test "$with_krb5" != "no"; then
9929                 WITH_KRB5=TRUE
9930                 save_LIBS=$LIBS
9931                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
9932                 # that the libraries where these functions are located on macOS will change, is it?
9933                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9934                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9935                 KRB5_LIBS=$LIBS
9936                 LIBS=$save_LIBS
9937                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9938                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9939                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9940                 LIBS=$save_LIBS
9941             fi
9942             if test "$with_gssapi" != "no"; then
9943                 WITH_GSSAPI=TRUE
9944                 save_LIBS=$LIBS
9945                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9946                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9947                 GSSAPI_LIBS=$LIBS
9948                 LIBS=$save_LIBS
9949             fi
9950             ;;
9951         WINNT)
9952             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
9953                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
9954             fi
9955             ;;
9956         Linux|GNU|*BSD|DragonFly)
9957             if test "$with_krb5" != "no"; then
9958                 WITH_KRB5=TRUE
9959                 save_LIBS=$LIBS
9960                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9961                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9962                 KRB5_LIBS=$LIBS
9963                 LIBS=$save_LIBS
9964                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9965                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9966                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9967                 LIBS=$save_LIBS
9968             fi
9969             if test "$with_gssapi" != "no"; then
9970                 WITH_GSSAPI=TRUE
9971                 save_LIBS=$LIBS
9972                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9973                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9974                 GSSAPI_LIBS=$LIBS
9975                 LIBS=$save_LIBS
9976             fi
9977             ;;
9978         *)
9979             if test "$with_krb5" = "yes"; then
9980                 WITH_KRB5=TRUE
9981                 save_LIBS=$LIBS
9982                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9983                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9984                 KRB5_LIBS=$LIBS
9985                 LIBS=$save_LIBS
9986                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9987                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9988                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9989                 LIBS=$save_LIBS
9990             fi
9991             if test "$with_gssapi" = "yes"; then
9992                 WITH_GSSAPI=TRUE
9993                 save_LIBS=$LIBS
9994                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9995                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9996                 LIBS=$save_LIBS
9997                 GSSAPI_LIBS=$LIBS
9998             fi
9999         esac
10001         if test -n "$with_libpq_path"; then
10002             SYSTEM_POSTGRESQL=TRUE
10003             postgres_interface="external libpq"
10004             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
10005             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
10006         else
10007             SYSTEM_POSTGRESQL=
10008             postgres_interface="internal"
10009             POSTGRESQL_LIB=""
10010             POSTGRESQL_INC="%OVERRIDE_ME%"
10011             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
10012         fi
10013     fi
10015     AC_MSG_CHECKING([PostgreSQL C interface])
10016     AC_MSG_RESULT([$postgres_interface])
10018     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
10019         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
10020         save_CFLAGS=$CFLAGS
10021         save_CPPFLAGS=$CPPFLAGS
10022         save_LIBS=$LIBS
10023         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
10024         LIBS="${LIBS} ${POSTGRESQL_LIB}"
10025         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
10026         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
10027             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
10028         CFLAGS=$save_CFLAGS
10029         CPPFLAGS=$save_CPPFLAGS
10030         LIBS=$save_LIBS
10031     fi
10032     BUILD_POSTGRESQL_SDBC=TRUE
10033 else
10034     AC_MSG_RESULT([no])
10036 AC_SUBST(WITH_KRB5)
10037 AC_SUBST(WITH_GSSAPI)
10038 AC_SUBST(GSSAPI_LIBS)
10039 AC_SUBST(KRB5_LIBS)
10040 AC_SUBST(BUILD_POSTGRESQL_SDBC)
10041 AC_SUBST(SYSTEM_POSTGRESQL)
10042 AC_SUBST(POSTGRESQL_INC)
10043 AC_SUBST(POSTGRESQL_LIB)
10045 dnl ===================================================================
10046 dnl Check for Firebird stuff
10047 dnl ===================================================================
10048 ENABLE_FIREBIRD_SDBC=
10049 if test "$enable_firebird_sdbc" = "yes" ; then
10050     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
10052     dnl ===================================================================
10053     dnl Check for system Firebird
10054     dnl ===================================================================
10055     AC_MSG_CHECKING([which Firebird to use])
10056     if test "$with_system_firebird" = "yes"; then
10057         AC_MSG_RESULT([external])
10058         SYSTEM_FIREBIRD=TRUE
10059         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
10060         if test -z "$FIREBIRDCONFIG"; then
10061             AC_MSG_NOTICE([No fb_config -- using pkg-config])
10062             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
10063                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
10064             ])
10065             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
10066         else
10067             AC_MSG_NOTICE([fb_config found])
10068             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
10069             AC_MSG_CHECKING([for Firebird Client library])
10070             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
10071             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
10072             FilterLibs "${FIREBIRD_LIBS}"
10073             FIREBIRD_LIBS="${filteredlibs}"
10074         fi
10075         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
10076         AC_MSG_CHECKING([Firebird version])
10077         if test -n "${FIREBIRD_VERSION}"; then
10078             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
10079             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
10080             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
10081                 AC_MSG_RESULT([OK])
10082             else
10083                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
10084             fi
10085         else
10086             save_CFLAGS="${CFLAGS}"
10087             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
10088             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
10089 #if defined(FB_API_VER) && FB_API_VER == 30
10090 int fb_api_is_30(void) { return 0; }
10091 #else
10092 #error "Wrong Firebird API version"
10093 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
10094             CFLAGS="$save_CFLAGS"
10095         fi
10096         ENABLE_FIREBIRD_SDBC=TRUE
10097         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10098     elif test "$enable_database_connectivity" != yes; then
10099         AC_MSG_RESULT([none])
10100     elif test "$cross_compiling" = "yes"; then
10101         AC_MSG_RESULT([none])
10102     else
10103         dnl Embedded Firebird has version 3.0
10104         AC_DEFINE(HAVE_FIREBIRD_30, 1)
10105         dnl We need libatomic_ops for any non X86/X64 system
10106         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
10107             dnl ===================================================================
10108             dnl Check for system libatomic_ops
10109             dnl ===================================================================
10110             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[LIBATOMIC_OPS],[atomic_ops >= 0.7.2])
10111             if test "$with_system_libatomic_ops" = "yes"; then
10112                 SYSTEM_LIBATOMIC_OPS=TRUE
10113                 AC_CHECK_HEADERS(atomic_ops.h, [],
10114                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
10115             else
10116                 SYSTEM_LIBATOMIC_OPS=
10117                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
10118                 LIBATOMIC_OPS_LIBS="-latomic_ops"
10119                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
10120             fi
10121         fi
10123         AC_MSG_RESULT([internal])
10124         SYSTEM_FIREBIRD=
10125         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
10126         FIREBIRD_LIBS="-lfbclient"
10128         if test "$with_system_libtommath" = "yes"; then
10129             SYSTEM_LIBTOMMATH=TRUE
10130             dnl check for tommath presence
10131             save_LIBS=$LIBS
10132             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
10133             AC_CHECK_LIB(tommath, mp_init, LIBTOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
10134             LIBS=$save_LIBS
10135         else
10136             SYSTEM_LIBTOMMATH=
10137             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
10138             LIBTOMMATH_LIBS="-ltommath"
10139             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
10140         fi
10142         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
10143         ENABLE_FIREBIRD_SDBC=TRUE
10144         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10145     fi
10147 AC_SUBST(ENABLE_FIREBIRD_SDBC)
10148 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
10149 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
10150 AC_SUBST(LIBATOMIC_OPS_LIBS)
10151 AC_SUBST(SYSTEM_FIREBIRD)
10152 AC_SUBST(FIREBIRD_CFLAGS)
10153 AC_SUBST(FIREBIRD_LIBS)
10154 AC_SUBST(SYSTEM_LIBTOMMATH)
10155 AC_SUBST(LIBTOMMATH_CFLAGS)
10156 AC_SUBST(LIBTOMMATH_LIBS)
10158 dnl ===================================================================
10159 dnl Check for system curl
10160 dnl ===================================================================
10161 AC_MSG_CHECKING([which libcurl to use])
10162 if test "$with_system_curl" = "auto"; then
10163     with_system_curl="$with_system_libs"
10166 if test "$test_curl" = "yes" -a "$enable_curl" = "yes" -a "$with_system_curl" = "yes"; then
10167     AC_MSG_RESULT([external])
10168     SYSTEM_CURL=TRUE
10170     # First try PKGCONFIG and then fall back
10171     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
10173     if test -n "$CURL_PKG_ERRORS"; then
10174         AC_PATH_PROG(CURLCONFIG, curl-config)
10175         if test -z "$CURLCONFIG"; then
10176             AC_MSG_ERROR([curl development files not found])
10177         fi
10178         CURL_LIBS=`$CURLCONFIG --libs`
10179         FilterLibs "${CURL_LIBS}"
10180         CURL_LIBS="${filteredlibs}"
10181         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
10182         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
10184         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
10185         case $curl_version in
10186         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
10187         dnl so they need to be doubled to end up in the configure script
10188         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
10189             AC_MSG_RESULT([yes])
10190             ;;
10191         *)
10192             AC_MSG_ERROR([no, you have $curl_version])
10193             ;;
10194         esac
10195     fi
10197     ENABLE_CURL=TRUE
10198 elif test "$test_curl" = "no"; then
10199     AC_MSG_RESULT([none])
10200 else
10201     AC_MSG_RESULT([internal])
10202     SYSTEM_CURL=
10203     BUILD_TYPE="$BUILD_TYPE CURL"
10204     ENABLE_CURL=TRUE
10206 AC_SUBST(SYSTEM_CURL)
10207 AC_SUBST(CURL_CFLAGS)
10208 AC_SUBST(CURL_LIBS)
10209 AC_SUBST(ENABLE_CURL)
10211 dnl ===================================================================
10212 dnl Check for system boost
10213 dnl ===================================================================
10214 AC_MSG_CHECKING([which boost to use])
10215 if test "$with_system_boost" = "yes"; then
10216     AC_MSG_RESULT([external])
10217     SYSTEM_BOOST=TRUE
10218     AX_BOOST_BASE([1.66],,[AC_MSG_ERROR([no suitable Boost found])])
10219     AX_BOOST_DATE_TIME
10220     AX_BOOST_FILESYSTEM
10221     AX_BOOST_IOSTREAMS
10222     AX_BOOST_LOCALE
10223     AC_LANG_PUSH([C++])
10224     save_CXXFLAGS=$CXXFLAGS
10225     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
10226     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
10227        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
10228     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
10229        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
10230     CXXFLAGS=$save_CXXFLAGS
10231     AC_LANG_POP([C++])
10232     # this is in m4/ax_boost_base.m4
10233     FilterLibs "${BOOST_LDFLAGS}"
10234     BOOST_LDFLAGS="${filteredlibs}"
10235 else
10236     AC_MSG_RESULT([internal])
10237     BUILD_TYPE="$BUILD_TYPE BOOST"
10238     SYSTEM_BOOST=
10239     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
10240         # use warning-suppressing wrapper headers
10241         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
10242     else
10243         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
10244     fi
10246 AC_SUBST(SYSTEM_BOOST)
10248 dnl ===================================================================
10249 dnl Check for system mdds
10250 dnl ===================================================================
10251 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
10253 dnl ===================================================================
10254 dnl Check for system glm
10255 dnl ===================================================================
10256 AC_MSG_CHECKING([which glm to use])
10257 if test "$with_system_glm" = "yes"; then
10258     AC_MSG_RESULT([external])
10259     SYSTEM_GLM=TRUE
10260     AC_LANG_PUSH([C++])
10261     AC_CHECK_HEADER([glm/glm.hpp], [],
10262        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
10263     AC_LANG_POP([C++])
10264 else
10265     AC_MSG_RESULT([internal])
10266     BUILD_TYPE="$BUILD_TYPE GLM"
10267     SYSTEM_GLM=
10268     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
10270 AC_SUBST([GLM_CFLAGS])
10271 AC_SUBST([SYSTEM_GLM])
10273 dnl ===================================================================
10274 dnl Check for system odbc
10275 dnl ===================================================================
10276 AC_MSG_CHECKING([which odbc headers to use])
10277 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
10278     AC_MSG_RESULT([external])
10279     SYSTEM_ODBC_HEADERS=TRUE
10281     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
10282         save_CPPFLAGS=$CPPFLAGS
10283         find_winsdk
10284         PathFormat "$winsdktest"
10285         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"
10286         AC_CHECK_HEADER(sqlext.h, [],
10287             [AC_MSG_ERROR(odbc not found. install odbc)],
10288             [#include <windows.h>])
10289         CPPFLAGS=$save_CPPFLAGS
10290     else
10291         AC_CHECK_HEADER(sqlext.h, [],
10292             [AC_MSG_ERROR(odbc not found. install odbc)],[])
10293     fi
10294 elif test "$enable_database_connectivity" != yes; then
10295     AC_MSG_RESULT([none])
10296 else
10297     AC_MSG_RESULT([internal])
10298     SYSTEM_ODBC_HEADERS=
10300 AC_SUBST(SYSTEM_ODBC_HEADERS)
10302 dnl ===================================================================
10303 dnl Enable LDAP support
10304 dnl ===================================================================
10306 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
10307 AC_MSG_CHECKING([whether to enable LDAP support])
10308     if test "$enable_ldap" != "yes"; then
10309         AC_MSG_RESULT([no])
10310         ENABLE_LDAP=""
10311         enable_ldap=no
10312     else
10313         AC_MSG_RESULT([yes])
10314         ENABLE_LDAP="TRUE"
10315     fi
10317 AC_SUBST(ENABLE_LDAP)
10319 dnl ===================================================================
10320 dnl Check for system openldap
10321 dnl ===================================================================
10323 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
10324 AC_MSG_CHECKING([which openldap library to use])
10325 if test "$with_system_openldap" = "yes"; then
10326     AC_MSG_RESULT([external])
10327     SYSTEM_OPENLDAP=TRUE
10328     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
10329     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10330     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10331 else
10332     AC_MSG_RESULT([internal])
10333     SYSTEM_OPENLDAP=
10334     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
10337 AC_SUBST(SYSTEM_OPENLDAP)
10339 dnl ===================================================================
10340 dnl Check for system NSS
10341 dnl ===================================================================
10342 if test "$enable_fuzzers" != "yes" -a "$enable_nss" = "yes"; then
10343     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
10344     AC_DEFINE(HAVE_FEATURE_NSS)
10345     ENABLE_NSS="TRUE"
10346     AC_DEFINE(ENABLE_NSS)
10347 elif test $_os != iOS ; then
10348     with_tls=openssl
10350 AC_SUBST(ENABLE_NSS)
10352 dnl ===================================================================
10353 dnl Check for TLS/SSL and cryptographic implementation to use
10354 dnl ===================================================================
10355 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
10356 if test -n "$with_tls"; then
10357     case $with_tls in
10358     openssl)
10359         AC_DEFINE(USE_TLS_OPENSSL)
10360         TLS=OPENSSL
10361         AC_MSG_RESULT([$TLS])
10363         if test "$enable_openssl" != "yes"; then
10364             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
10365         fi
10367         # warn that OpenSSL has been selected but not all TLS code has this option
10368         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
10369         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
10370         ;;
10371     nss)
10372         AC_DEFINE(USE_TLS_NSS)
10373         TLS=NSS
10374         AC_MSG_RESULT([$TLS])
10375         ;;
10376     no)
10377         AC_MSG_RESULT([none])
10378         AC_MSG_WARN([Skipping TLS/SSL])
10379         ;;
10380     *)
10381         AC_MSG_RESULT([])
10382         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
10383 openssl - OpenSSL
10384 nss - Mozilla's Network Security Services (NSS)
10385     ])
10386         ;;
10387     esac
10388 else
10389     # default to using NSS, it results in smaller oox lib
10390     AC_DEFINE(USE_TLS_NSS)
10391     TLS=NSS
10392     AC_MSG_RESULT([$TLS])
10394 AC_SUBST(TLS)
10396 dnl ===================================================================
10397 dnl Check for system sane
10398 dnl ===================================================================
10399 AC_MSG_CHECKING([which sane header to use])
10400 if test "$with_system_sane" = "yes"; then
10401     AC_MSG_RESULT([external])
10402     AC_CHECK_HEADER(sane/sane.h, [],
10403       [AC_MSG_ERROR(sane not found. install sane)], [])
10404 else
10405     AC_MSG_RESULT([internal])
10406     BUILD_TYPE="$BUILD_TYPE SANE"
10409 dnl ===================================================================
10410 dnl Check for system icu
10411 dnl ===================================================================
10412 SYSTEM_GENBRK=
10413 SYSTEM_GENCCODE=
10414 SYSTEM_GENCMN=
10416 ICU_MAJOR=69
10417 ICU_MINOR=1
10418 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
10419 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
10420 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
10421 AC_MSG_CHECKING([which icu to use])
10422 if test "$with_system_icu" = "yes"; then
10423     AC_MSG_RESULT([external])
10424     SYSTEM_ICU=TRUE
10425     AC_LANG_PUSH([C++])
10426     AC_MSG_CHECKING([for unicode/rbbi.h])
10427     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
10428     AC_LANG_POP([C++])
10430     if test "$cross_compiling" != "yes"; then
10431         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
10432         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
10433         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
10434         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
10435     fi
10437     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
10438         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
10439         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
10440         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
10441         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
10442         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
10443             AC_MSG_RESULT([yes])
10444         else
10445             AC_MSG_RESULT([no])
10446             if test "$with_system_icu_for_build" != "force"; then
10447                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
10448 You can use --with-system-icu-for-build=force to use it anyway.])
10449             fi
10450         fi
10451     fi
10453     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
10454         # using the system icu tools can lead to version confusion, use the
10455         # ones from the build environment when cross-compiling
10456         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
10457         if test -z "$SYSTEM_GENBRK"; then
10458             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
10459         fi
10460         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
10461         if test -z "$SYSTEM_GENCCODE"; then
10462             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
10463         fi
10464         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
10465         if test -z "$SYSTEM_GENCMN"; then
10466             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
10467         fi
10468         if test "$ICU_MAJOR" -ge "49"; then
10469             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
10470             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
10471             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
10472         else
10473             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
10474             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
10475             ICU_RECLASSIFIED_HEBREW_LETTER=
10476         fi
10477     fi
10479     if test "$cross_compiling" = "yes"; then
10480         if test "$ICU_MAJOR" -ge "50"; then
10481             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
10482             ICU_MINOR=""
10483         fi
10484     fi
10485 else
10486     AC_MSG_RESULT([internal])
10487     SYSTEM_ICU=
10488     BUILD_TYPE="$BUILD_TYPE ICU"
10489     # surprisingly set these only for "internal" (to be used by various other
10490     # external libs): the system icu-config is quite unhelpful and spits out
10491     # dozens of weird flags and also default path -I/usr/include
10492     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
10493     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
10495 if test "$ICU_MAJOR" -ge "59"; then
10496     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
10497     # with -std=c++11 but not all external libraries can be built with that,
10498     # for those use a bit-compatible typedef uint16_t UChar; see
10499     # icu/source/common/unicode/umachine.h
10500     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
10501 else
10502     ICU_UCHAR_TYPE=""
10504 AC_SUBST(SYSTEM_ICU)
10505 AC_SUBST(SYSTEM_GENBRK)
10506 AC_SUBST(SYSTEM_GENCCODE)
10507 AC_SUBST(SYSTEM_GENCMN)
10508 AC_SUBST(ICU_MAJOR)
10509 AC_SUBST(ICU_MINOR)
10510 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
10511 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
10512 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
10513 AC_SUBST(ICU_CFLAGS)
10514 AC_SUBST(ICU_LIBS)
10515 AC_SUBST(ICU_UCHAR_TYPE)
10517 dnl ==================================================================
10518 dnl Breakpad
10519 dnl ==================================================================
10520 DEFAULT_CRASHDUMP_VALUE="true"
10521 AC_MSG_CHECKING([whether to enable breakpad])
10522 if test "$enable_breakpad" != yes; then
10523     AC_MSG_RESULT([no])
10524 else
10525     AC_MSG_RESULT([yes])
10526     ENABLE_BREAKPAD="TRUE"
10527     AC_DEFINE(ENABLE_BREAKPAD)
10528     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
10529     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
10531     AC_MSG_CHECKING([for disable crash dump])
10532     if test "$enable_crashdump" = no; then
10533         DEFAULT_CRASHDUMP_VALUE="false"
10534         AC_MSG_RESULT([yes])
10535     else
10536        AC_MSG_RESULT([no])
10537     fi
10539     AC_MSG_CHECKING([for crashreport config])
10540     if test "$with_symbol_config" = "no"; then
10541         BREAKPAD_SYMBOL_CONFIG="invalid"
10542         AC_MSG_RESULT([no])
10543     else
10544         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
10545         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
10546         AC_MSG_RESULT([yes])
10547     fi
10548     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
10550 AC_SUBST(ENABLE_BREAKPAD)
10551 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
10553 dnl ==================================================================
10554 dnl libfuzzer
10555 dnl ==================================================================
10556 AC_MSG_CHECKING([whether to enable fuzzers])
10557 if test "$enable_fuzzers" != yes; then
10558     AC_MSG_RESULT([no])
10559 else
10560     if test $LIB_FUZZING_ENGINE == ""; then
10561       AC_MSG_ERROR(['LIB_FUZZING_ENGINE' must be set when using --enable-fuzzers. Examples include '-fsanitize=fuzzer'.])
10562     fi
10563     AC_MSG_RESULT([yes])
10564     ENABLE_FUZZERS="TRUE"
10565     AC_DEFINE([ENABLE_FUZZERS],1)
10566     BUILD_TYPE="$BUILD_TYPE FUZZERS"
10568 AC_SUBST(LIB_FUZZING_ENGINE)
10569 AC_SUBST(ENABLE_FUZZERS)
10571 dnl ===================================================================
10572 dnl Orcus
10573 dnl ===================================================================
10574 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.16 >= 0.16.0])
10575 if test "$with_system_orcus" != "yes"; then
10576     if test "$SYSTEM_BOOST" = "TRUE"; then
10577         # ===========================================================
10578         # Determine if we are going to need to link with Boost.System
10579         # ===========================================================
10580         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
10581         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
10582         dnl in documentation has no effect.
10583         AC_MSG_CHECKING([if we need to link with Boost.System])
10584         AC_LANG_PUSH([C++])
10585         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
10586                 @%:@include <boost/version.hpp>
10587             ]],[[
10588                 #if BOOST_VERSION >= 105000
10589                 #   error yes, we need to link with Boost.System
10590                 #endif
10591             ]])],[
10592                 AC_MSG_RESULT([no])
10593             ],[
10594                 AC_MSG_RESULT([yes])
10595                 AX_BOOST_SYSTEM
10596         ])
10597         AC_LANG_POP([C++])
10598     fi
10600 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
10601 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
10602 AC_SUBST([BOOST_SYSTEM_LIB])
10603 AC_SUBST(SYSTEM_LIBORCUS)
10605 dnl ===================================================================
10606 dnl HarfBuzz
10607 dnl ===================================================================
10608 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
10609                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
10610                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
10612 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
10613                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
10614                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
10616 if test "$COM" = "MSC"; then # override the above
10617     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
10618     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
10621 if test "$with_system_harfbuzz" = "yes"; then
10622     if test "$with_system_graphite" = "no"; then
10623         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
10624     fi
10625     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
10626     save_LIBS="$LIBS"
10627     save_CFLAGS="$CFLAGS"
10628     LIBS="$LIBS $HARFBUZZ_LIBS"
10629     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
10630     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
10631     LIBS="$save_LIBS"
10632     CFLAGS="$save_CFLAGS"
10633 else
10634     if test "$with_system_graphite" = "yes"; then
10635         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
10636     fi
10639 AC_MSG_CHECKING([whether to use X11])
10640 dnl ***************************************
10641 dnl testing for X libraries and includes...
10642 dnl ***************************************
10643 if test "$USING_X11" = TRUE; then
10644     AC_DEFINE(HAVE_FEATURE_X11)
10646 AC_MSG_RESULT([$USING_X11])
10648 if test "$USING_X11" = TRUE; then
10649     AC_PATH_X
10650     AC_PATH_XTRA
10651     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
10653     if test -z "$x_includes"; then
10654         x_includes="default_x_includes"
10655     fi
10656     if test -z "$x_libraries"; then
10657         x_libraries="default_x_libraries"
10658     fi
10659     CFLAGS="$CFLAGS $X_CFLAGS"
10660     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
10661     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
10662 else
10663     x_includes="no_x_includes"
10664     x_libraries="no_x_libraries"
10667 if test "$USING_X11" = TRUE; then
10668     dnl ===================================================================
10669     dnl Check for extension headers
10670     dnl ===================================================================
10671     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
10672      [#include <X11/extensions/shape.h>])
10674     # vcl needs ICE and SM
10675     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
10676     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
10677         [AC_MSG_ERROR(ICE library not found)])
10678     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
10679     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
10680         [AC_MSG_ERROR(SM library not found)])
10683 if test "$USING_X11" = TRUE -a "$ENABLE_JAVA" != ""; then
10684     # bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c needs Xt
10685     AC_CHECK_HEADERS(X11/Intrinsic.h,[],[AC_MSG_ERROR([libXt headers not found])])
10688 dnl ===================================================================
10689 dnl Check for system Xrender
10690 dnl ===================================================================
10691 AC_MSG_CHECKING([whether to use Xrender])
10692 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
10693     AC_MSG_RESULT([yes])
10694     PKG_CHECK_MODULES(XRENDER, xrender)
10695     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10696     FilterLibs "${XRENDER_LIBS}"
10697     XRENDER_LIBS="${filteredlibs}"
10698     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
10699       [AC_MSG_ERROR(libXrender not found or functional)], [])
10700     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
10701       [AC_MSG_ERROR(Xrender not found. install X)], [])
10702 else
10703     AC_MSG_RESULT([no])
10705 AC_SUBST(XRENDER_CFLAGS)
10706 AC_SUBST(XRENDER_LIBS)
10708 dnl ===================================================================
10709 dnl Check for XRandr
10710 dnl ===================================================================
10711 AC_MSG_CHECKING([whether to enable RandR support])
10712 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
10713     AC_MSG_RESULT([yes])
10714     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
10715     if test "$ENABLE_RANDR" != "TRUE"; then
10716         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
10717                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
10718         XRANDR_CFLAGS=" "
10719         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
10720           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
10721         XRANDR_LIBS="-lXrandr "
10722         ENABLE_RANDR="TRUE"
10723     fi
10724     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10725     FilterLibs "${XRANDR_LIBS}"
10726     XRANDR_LIBS="${filteredlibs}"
10727 else
10728     ENABLE_RANDR=""
10729     AC_MSG_RESULT([no])
10731 AC_SUBST(XRANDR_CFLAGS)
10732 AC_SUBST(XRANDR_LIBS)
10733 AC_SUBST(ENABLE_RANDR)
10735 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
10736     if test -z "$WITH_WEBDAV"; then
10737         WITH_WEBDAV="serf"
10738     fi
10740 if test $_os = iOS -o $_os = Android; then
10741     WITH_WEBDAV="no"
10743 AC_MSG_CHECKING([for webdav library])
10744 case "$WITH_WEBDAV" in
10745 serf)
10746     AC_MSG_RESULT([serf])
10747     # Check for system apr-util
10748     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
10749                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
10750                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
10751     if test "$COM" = "MSC"; then
10752         APR_LIB_DIR="LibR"
10753         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
10754         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
10755     fi
10757     # Check for system serf
10758     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.3.9])
10759     ;;
10760 neon)
10761     AC_MSG_RESULT([neon])
10762     # Check for system neon
10763     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.31.2])
10764     if test "$with_system_neon" = "yes"; then
10765         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
10766     else
10767         NEON_VERSION=0312
10768     fi
10769     AC_SUBST(NEON_VERSION)
10770     ;;
10772     AC_MSG_RESULT([none, disabled])
10773     WITH_WEBDAV=""
10774     ;;
10775 esac
10776 AC_SUBST(WITH_WEBDAV)
10778 dnl ===================================================================
10779 dnl Check for disabling cve_tests
10780 dnl ===================================================================
10781 AC_MSG_CHECKING([whether to execute CVE tests])
10782 # If not explicitly enabled or disabled, default
10783 if test -z "$enable_cve_tests"; then
10784     case "$OS" in
10785     WNT)
10786         # Default cves off for Windows with its wild and wonderful
10787         # variety of AV software kicking in and panicking
10788         enable_cve_tests=no
10789         ;;
10790     *)
10791         # otherwise yes
10792         enable_cve_tests=yes
10793         ;;
10794     esac
10796 if test "$enable_cve_tests" = "no"; then
10797     AC_MSG_RESULT([no])
10798     DISABLE_CVE_TESTS=TRUE
10799     AC_SUBST(DISABLE_CVE_TESTS)
10800 else
10801     AC_MSG_RESULT([yes])
10804 dnl ===================================================================
10805 dnl Check for enabling chart XShape tests
10806 dnl ===================================================================
10807 AC_MSG_CHECKING([whether to execute chart XShape tests])
10808 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
10809     AC_MSG_RESULT([yes])
10810     ENABLE_CHART_TESTS=TRUE
10811     AC_SUBST(ENABLE_CHART_TESTS)
10812 else
10813     AC_MSG_RESULT([no])
10816 dnl ===================================================================
10817 dnl Check for system openssl
10818 dnl ===================================================================
10819 ENABLE_OPENSSL=
10820 AC_MSG_CHECKING([whether to disable OpenSSL usage])
10821 if test "$enable_openssl" = "yes"; then
10822     AC_MSG_RESULT([no])
10823     ENABLE_OPENSSL=TRUE
10824     if test "$_os" = Darwin ; then
10825         # OpenSSL is deprecated when building for 10.7 or later.
10826         #
10827         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
10828         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
10830         with_system_openssl=no
10831         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10832     elif test "$_os" = "FreeBSD" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
10833             && test "$with_system_openssl" != "no"; then
10834         with_system_openssl=yes
10835         SYSTEM_OPENSSL=TRUE
10836         OPENSSL_CFLAGS=
10837         OPENSSL_LIBS="-lssl -lcrypto"
10838     else
10839         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10840     fi
10841     if test "$with_system_openssl" = "yes"; then
10842         AC_MSG_CHECKING([whether openssl supports SHA512])
10843         AC_LANG_PUSH([C])
10844         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
10845             SHA512_CTX context;
10846 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
10847         AC_LANG_POP(C)
10848     fi
10849 else
10850     AC_MSG_RESULT([yes])
10852     # warn that although OpenSSL is disabled, system libraries may depend on it
10853     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
10854     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
10857 AC_SUBST([ENABLE_OPENSSL])
10859 if test "$enable_cipher_openssl_backend" = yes && test "$ENABLE_OPENSSL" != TRUE; then
10860     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
10861         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
10862         enable_cipher_openssl_backend=no
10863     else
10864         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
10865     fi
10867 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
10868 ENABLE_CIPHER_OPENSSL_BACKEND=
10869 if test "$enable_cipher_openssl_backend" = yes; then
10870     AC_MSG_RESULT([yes])
10871     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
10872 else
10873     AC_MSG_RESULT([no])
10875 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
10877 dnl ===================================================================
10878 dnl Check for building gnutls
10879 dnl ===================================================================
10880 AC_MSG_CHECKING([whether to use gnutls])
10881 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
10882     AC_MSG_RESULT([yes])
10883     AM_PATH_LIBGCRYPT()
10884     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
10885         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
10886                       available in the system to use as replacement.]]))
10887     FilterLibs "${LIBGCRYPT_LIBS}"
10888     LIBGCRYPT_LIBS="${filteredlibs}"
10889 else
10890     AC_MSG_RESULT([no])
10893 AC_SUBST([LIBGCRYPT_CFLAGS])
10894 AC_SUBST([LIBGCRYPT_LIBS])
10896 dnl ===================================================================
10897 dnl Check for system redland
10898 dnl ===================================================================
10899 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
10900 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
10901 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
10902 if test "$with_system_redland" = "yes"; then
10903     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
10904             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
10905 else
10906     RAPTOR_MAJOR="0"
10907     RASQAL_MAJOR="3"
10908     REDLAND_MAJOR="0"
10910 AC_SUBST(RAPTOR_MAJOR)
10911 AC_SUBST(RASQAL_MAJOR)
10912 AC_SUBST(REDLAND_MAJOR)
10914 dnl ===================================================================
10915 dnl Check for system hunspell
10916 dnl ===================================================================
10917 AC_MSG_CHECKING([which libhunspell to use])
10918 if test "$with_system_hunspell" = "yes"; then
10919     AC_MSG_RESULT([external])
10920     SYSTEM_HUNSPELL=TRUE
10921     AC_LANG_PUSH([C++])
10922     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
10923     if test "$HUNSPELL_PC" != "TRUE"; then
10924         AC_CHECK_HEADER(hunspell.hxx, [],
10925             [
10926             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
10927             [AC_MSG_ERROR(hunspell headers not found.)], [])
10928             ], [])
10929         AC_CHECK_LIB([hunspell], [main], [:],
10930            [ AC_MSG_ERROR(hunspell library not found.) ], [])
10931         HUNSPELL_LIBS=-lhunspell
10932     fi
10933     AC_LANG_POP([C++])
10934     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10935     FilterLibs "${HUNSPELL_LIBS}"
10936     HUNSPELL_LIBS="${filteredlibs}"
10937 else
10938     AC_MSG_RESULT([internal])
10939     SYSTEM_HUNSPELL=
10940     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
10941     if test "$COM" = "MSC"; then
10942         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
10943     else
10944         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
10945     fi
10946     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
10948 AC_SUBST(SYSTEM_HUNSPELL)
10949 AC_SUBST(HUNSPELL_CFLAGS)
10950 AC_SUBST(HUNSPELL_LIBS)
10952 dnl ===================================================================
10953 dnl Check for system zxing
10954 dnl ===================================================================
10955 AC_MSG_CHECKING([whether to use zxing])
10956 if test "$enable_zxing" = "no"; then
10957     AC_MSG_RESULT([no])
10958     ENABLE_ZXING=
10959     SYSTEM_ZXING=
10960 else
10961     AC_MSG_RESULT([yes])
10962     ENABLE_ZXING=TRUE
10963     AC_MSG_CHECKING([which libzxing to use])
10964     if test "$with_system_zxing" = "yes"; then
10965         AC_MSG_RESULT([external])
10966         SYSTEM_ZXING=TRUE
10967         AC_LANG_PUSH([C++])
10968         AC_CHECK_HEADER(ZXing/MultiFormatWriter.h, [],
10969             [AC_MSG_ERROR(zxing headers not found.)], [#include <stdexcept>])
10970         ZXING_CFLAGS=-I/usr/include/ZXing
10971         AC_CHECK_LIB([ZXing], [main], [ZXING_LIBS=-lZXing],
10972             [ AC_CHECK_LIB([ZXingCore], [main], [ZXING_LIBS=-lZXingCore],
10973             [ AC_MSG_ERROR(zxing C++ library not found.) ])], [])
10974         AC_LANG_POP([C++])
10975         ZXING_CFLAGS=$(printf '%s' "$ZXING_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10976         FilterLibs "${ZXING_LIBS}"
10977         ZXING_LIBS="${filteredlibs}"
10978     else
10979         AC_MSG_RESULT([internal])
10980         SYSTEM_ZXING=
10981         BUILD_TYPE="$BUILD_TYPE ZXING"
10982     fi
10983     if test "$ENABLE_ZXING" = TRUE; then
10984         AC_DEFINE(ENABLE_ZXING)
10985     fi
10987 AC_SUBST(SYSTEM_ZXING)
10988 AC_SUBST(ENABLE_ZXING)
10989 AC_SUBST(ZXING_CFLAGS)
10990 AC_SUBST(ZXING_LIBS)
10992 dnl ===================================================================
10993 dnl Check for system box2d
10994 dnl ===================================================================
10995 AC_MSG_CHECKING([which box2d to use])
10996 if test "$with_system_box2d" = "yes"; then
10997     AC_MSG_RESULT([external])
10998     SYSTEM_BOX2D=TRUE
10999     AC_LANG_PUSH([C++])
11000     AC_CHECK_HEADER(box2d/box2d.h, [BOX2D_H_FOUND='TRUE'],
11001         [BOX2D_H_FOUND='FALSE'])
11002     if test "$BOX2D_H_FOUND" = "TRUE"; then # 2.4.0+
11003         _BOX2D_LIB=box2d
11004         AC_DEFINE(BOX2D_HEADER,<box2d/box2d.h>)
11005     else
11006         # fail this. there's no other alternative to check when we are here.
11007         AC_CHECK_HEADER([Box2D/Box2D.h], [],
11008             [AC_MSG_ERROR(box2d headers not found.)])
11009         _BOX2D_LIB=Box2D
11010         AC_DEFINE(BOX2D_HEADER,<Box2D/Box2D.h>)
11011     fi
11012     AC_CHECK_LIB([$_BOX2D_LIB], [main], [:],
11013         [ AC_MSG_ERROR(box2d library not found.) ], [])
11014     BOX2D_LIBS=-l$_BOX2D_LIB
11015     AC_LANG_POP([C++])
11016     BOX2D_CFLAGS=$(printf '%s' "$BOX2D_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11017     FilterLibs "${BOX2D_LIBS}"
11018     BOX2D_LIBS="${filteredlibs}"
11019 else
11020     AC_MSG_RESULT([internal])
11021     SYSTEM_BOX2D=
11022     BUILD_TYPE="$BUILD_TYPE BOX2D"
11024 AC_SUBST(SYSTEM_BOX2D)
11025 AC_SUBST(BOX2D_CFLAGS)
11026 AC_SUBST(BOX2D_LIBS)
11028 dnl ===================================================================
11029 dnl Checking for altlinuxhyph
11030 dnl ===================================================================
11031 AC_MSG_CHECKING([which altlinuxhyph to use])
11032 if test "$with_system_altlinuxhyph" = "yes"; then
11033     AC_MSG_RESULT([external])
11034     SYSTEM_HYPH=TRUE
11035     AC_CHECK_HEADER(hyphen.h, [],
11036        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
11037     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
11038        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
11039        [#include <hyphen.h>])
11040     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
11041         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11042     if test -z "$HYPHEN_LIB"; then
11043         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
11044            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11045     fi
11046     if test -z "$HYPHEN_LIB"; then
11047         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
11048            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
11049     fi
11050 else
11051     AC_MSG_RESULT([internal])
11052     SYSTEM_HYPH=
11053     BUILD_TYPE="$BUILD_TYPE HYPHEN"
11054     if test "$COM" = "MSC"; then
11055         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
11056     else
11057         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
11058     fi
11060 AC_SUBST(SYSTEM_HYPH)
11061 AC_SUBST(HYPHEN_LIB)
11063 dnl ===================================================================
11064 dnl Checking for mythes
11065 dnl ===================================================================
11066 AC_MSG_CHECKING([which mythes to use])
11067 if test "$with_system_mythes" = "yes"; then
11068     AC_MSG_RESULT([external])
11069     SYSTEM_MYTHES=TRUE
11070     AC_LANG_PUSH([C++])
11071     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
11072     if test "$MYTHES_PKGCONFIG" = "no"; then
11073         AC_CHECK_HEADER(mythes.hxx, [],
11074             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
11075         AC_CHECK_LIB([mythes-1.2], [main], [:],
11076             [ MYTHES_FOUND=no], [])
11077     if test "$MYTHES_FOUND" = "no"; then
11078         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
11079                 [ MYTHES_FOUND=no], [])
11080     fi
11081     if test "$MYTHES_FOUND" = "no"; then
11082         AC_MSG_ERROR([mythes library not found!.])
11083     fi
11084     fi
11085     AC_LANG_POP([C++])
11086     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11087     FilterLibs "${MYTHES_LIBS}"
11088     MYTHES_LIBS="${filteredlibs}"
11089 else
11090     AC_MSG_RESULT([internal])
11091     SYSTEM_MYTHES=
11092     BUILD_TYPE="$BUILD_TYPE MYTHES"
11093     if test "$COM" = "MSC"; then
11094         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
11095     else
11096         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
11097     fi
11099 AC_SUBST(SYSTEM_MYTHES)
11100 AC_SUBST(MYTHES_CFLAGS)
11101 AC_SUBST(MYTHES_LIBS)
11103 dnl ===================================================================
11104 dnl How should we build the linear programming solver ?
11105 dnl ===================================================================
11107 ENABLE_COINMP=
11108 AC_MSG_CHECKING([whether to build with CoinMP])
11109 if test "$enable_coinmp" != "no"; then
11110     ENABLE_COINMP=TRUE
11111     AC_MSG_RESULT([yes])
11112     if test "$with_system_coinmp" = "yes"; then
11113         SYSTEM_COINMP=TRUE
11114         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
11115         FilterLibs "${COINMP_LIBS}"
11116         COINMP_LIBS="${filteredlibs}"
11117     else
11118         BUILD_TYPE="$BUILD_TYPE COINMP"
11119     fi
11120 else
11121     AC_MSG_RESULT([no])
11123 AC_SUBST(ENABLE_COINMP)
11124 AC_SUBST(SYSTEM_COINMP)
11125 AC_SUBST(COINMP_CFLAGS)
11126 AC_SUBST(COINMP_LIBS)
11128 ENABLE_LPSOLVE=
11129 AC_MSG_CHECKING([whether to build with lpsolve])
11130 if test "$enable_lpsolve" != "no"; then
11131     ENABLE_LPSOLVE=TRUE
11132     AC_MSG_RESULT([yes])
11133 else
11134     AC_MSG_RESULT([no])
11136 AC_SUBST(ENABLE_LPSOLVE)
11138 if test "$ENABLE_LPSOLVE" = TRUE; then
11139     AC_MSG_CHECKING([which lpsolve to use])
11140     if test "$with_system_lpsolve" = "yes"; then
11141         AC_MSG_RESULT([external])
11142         SYSTEM_LPSOLVE=TRUE
11143         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
11144            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
11145         save_LIBS=$LIBS
11146         # some systems need this. Like Ubuntu...
11147         AC_CHECK_LIB(m, floor)
11148         AC_CHECK_LIB(dl, dlopen)
11149         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
11150             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
11151         LIBS=$save_LIBS
11152     else
11153         AC_MSG_RESULT([internal])
11154         SYSTEM_LPSOLVE=
11155         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
11156     fi
11158 AC_SUBST(SYSTEM_LPSOLVE)
11160 dnl ===================================================================
11161 dnl Checking for libexttextcat
11162 dnl ===================================================================
11163 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
11164 if test "$with_system_libexttextcat" = "yes"; then
11165     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
11167 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
11169 dnl ===================================================================
11170 dnl Checking for libnumbertext
11171 dnl ===================================================================
11172 libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.6])
11173 if test "$with_system_libnumbertext" = "yes"; then
11174     SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
11175     SYSTEM_LIBNUMBERTEXT=YES
11176 else
11177     SYSTEM_LIBNUMBERTEXT=
11178     AC_LANG_PUSH([C++])
11179     save_CPPFLAGS=$CPPFLAGS
11180     CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
11181     AC_CHECK_HEADERS([codecvt regex])
11182     AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
11183             [ LIBNUMBERTEXT_CFLAGS=''
11184               AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
11185                            Enable libnumbertext fallback (missing number to number name conversion).])
11186             ])
11187     CPPFLAGS=$save_CPPFLAGS
11188     AC_LANG_POP([C++])
11190 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
11191 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
11192 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
11194 dnl ***************************************
11195 dnl testing libc version for Linux...
11196 dnl ***************************************
11197 if test "$_os" = "Linux"; then
11198     AC_MSG_CHECKING([whether libc is >= 2.1.1])
11199     exec 6>/dev/null # no output
11200     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
11201     exec 6>&1 # output on again
11202     if test "$HAVE_LIBC"; then
11203         AC_MSG_RESULT([yes])
11204     else
11205         AC_MSG_ERROR([no, upgrade libc])
11206     fi
11209 dnl =========================================
11210 dnl Check for uuidgen
11211 dnl =========================================
11212 if test "$_os" = "WINNT"; then
11213     # we must use the uuidgen from the Windows SDK, which will be in the LO_PATH, but isn't in
11214     # the PATH for AC_PATH_PROG. It is already tested above in the WINDOWS_SDK_HOME check.
11215     UUIDGEN=uuidgen.exe
11216     AC_SUBST(UUIDGEN)
11217 else
11218     AC_PATH_PROG([UUIDGEN], [uuidgen])
11219     if test -z "$UUIDGEN"; then
11220         AC_MSG_WARN([uuid is needed for building installation sets])
11221     fi
11224 dnl ***************************************
11225 dnl Checking for bison and flex
11226 dnl ***************************************
11227 AC_PATH_PROG(BISON, bison)
11228 if test -z "$BISON"; then
11229     AC_MSG_ERROR([no bison found in \$PATH, install it])
11230 else
11231     AC_MSG_CHECKING([the bison version])
11232     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
11233     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
11234     dnl Accept newer than 2.0; for --enable-compiler-plugins at least 2.3 is known to be bad and
11235     dnl cause
11236     dnl
11237     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]
11238     dnl   typedef union YYSTYPE
11239     dnl           ~~~~~~^~~~~~~
11240     dnl
11241     dnl while at least 3.4.1 is know to be good:
11242     if test "$COMPILER_PLUGINS" = TRUE; then
11243         if test "$_bison_longver" -lt 2004; then
11244             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.4+ for --enable-compiler-plugins)])
11245         fi
11246     else
11247         if test "$_bison_longver" -lt 2000; then
11248             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
11249         fi
11250     fi
11252 AC_SUBST([BISON])
11254 AC_PATH_PROG(FLEX, flex)
11255 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11256     FLEX=`cygpath -m $FLEX`
11258 if test -z "$FLEX"; then
11259     AC_MSG_ERROR([no flex found in \$PATH, install it])
11260 else
11261     AC_MSG_CHECKING([the flex version])
11262     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
11263     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
11264         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
11265     fi
11267 AC_SUBST([FLEX])
11268 dnl ***************************************
11269 dnl Checking for patch
11270 dnl ***************************************
11271 AC_PATH_PROG(PATCH, patch)
11272 if test -z "$PATCH"; then
11273     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
11276 dnl On Solaris or macOS, check if --with-gnu-patch was used
11277 if test "$_os" = "SunOS" -o "$_os" = "Darwin"; then
11278     if test -z "$with_gnu_patch"; then
11279         GNUPATCH=$PATCH
11280     else
11281         if test -x "$with_gnu_patch"; then
11282             GNUPATCH=$with_gnu_patch
11283         else
11284             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
11285         fi
11286     fi
11288     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
11289     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
11290         AC_MSG_RESULT([yes])
11291     else
11292         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
11293     fi
11294 else
11295     GNUPATCH=$PATCH
11298 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11299     GNUPATCH=`cygpath -m $GNUPATCH`
11302 dnl We also need to check for --with-gnu-cp
11304 if test -z "$with_gnu_cp"; then
11305     # check the place where the good stuff is hidden on Solaris...
11306     if test -x /usr/gnu/bin/cp; then
11307         GNUCP=/usr/gnu/bin/cp
11308     else
11309         AC_PATH_PROGS(GNUCP, gnucp cp)
11310     fi
11311     if test -z $GNUCP; then
11312         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
11313     fi
11314 else
11315     if test -x "$with_gnu_cp"; then
11316         GNUCP=$with_gnu_cp
11317     else
11318         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
11319     fi
11322 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11323     GNUCP=`cygpath -m $GNUCP`
11326 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
11327 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
11328     AC_MSG_RESULT([yes])
11329 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
11330     AC_MSG_RESULT([yes])
11331 else
11332     case "$build_os" in
11333     darwin*|macos*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
11334         x_GNUCP=[\#]
11335         GNUCP=''
11336         AC_MSG_RESULT([no gnucp found - using the system's cp command])
11337         ;;
11338     *)
11339         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
11340         ;;
11341     esac
11344 AC_SUBST(GNUPATCH)
11345 AC_SUBST(GNUCP)
11346 AC_SUBST(x_GNUCP)
11348 dnl ***************************************
11349 dnl testing assembler path
11350 dnl ***************************************
11351 ML_EXE=""
11352 if test "$_os" = "WINNT"; then
11353     case "$WIN_HOST_ARCH" in
11354     x86) assembler=ml.exe ;;
11355     x64) assembler=ml64.exe ;;
11356     arm64) assembler=armasm64.exe ;;
11357     esac
11359     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
11360     if test -f "$MSVC_HOST_PATH/$assembler"; then
11361         ML_EXE=`win_short_path_for_make "$MSVC_HOST_PATH/$assembler"`
11362         AC_MSG_RESULT([$ML_EXE])
11363     else
11364         AC_MSG_ERROR([not found in $MSVC_HOST_PATH])
11365     fi
11368 AC_SUBST(ML_EXE)
11370 dnl ===================================================================
11371 dnl We need zip and unzip
11372 dnl ===================================================================
11373 AC_PATH_PROG(ZIP, zip)
11374 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
11375 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
11376     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],,)
11379 AC_PATH_PROG(UNZIP, unzip)
11380 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
11382 dnl ===================================================================
11383 dnl Zip must be a specific type for different build types.
11384 dnl ===================================================================
11385 if test $build_os = cygwin; then
11386     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
11387         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
11388     fi
11391 dnl ===================================================================
11392 dnl We need touch with -h option support.
11393 dnl ===================================================================
11394 AC_PATH_PROG(TOUCH, touch)
11395 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
11396 touch warn
11397 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
11398     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],,)
11401 dnl ===================================================================
11402 dnl Check for system epoxy
11403 dnl ===================================================================
11404 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
11406 dnl ===================================================================
11407 dnl Set vcl option: coordinate device in double or sal_Int32
11408 dnl ===================================================================
11410 dnl disabled for now, we don't want subtle differences between OSs
11411 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
11412 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
11413 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
11414 dnl     AC_MSG_RESULT([double])
11415 dnl else
11416 dnl     AC_MSG_RESULT([sal_Int32])
11417 dnl fi
11419 dnl ===================================================================
11420 dnl Show which vclplugs will be built.
11421 dnl ===================================================================
11422 R=""
11423 if test "$USING_X11" != TRUE; then
11424     enable_gtk3=no
11427 ENABLE_GTK3=""
11428 if test "x$enable_gtk3" = "xyes"; then
11429     ENABLE_GTK3="TRUE"
11430     AC_DEFINE(ENABLE_GTK3)
11431     R="$R gtk3"
11433 AC_SUBST(ENABLE_GTK3)
11435 ENABLE_GTK3_KDE5=""
11436 if test "x$enable_gtk3_kde5" = "xyes"; then
11437     ENABLE_GTK3_KDE5="TRUE"
11438     AC_DEFINE(ENABLE_GTK3_KDE5)
11439     R="$R gtk3_kde5"
11441 AC_SUBST(ENABLE_GTK3_KDE5)
11443 ENABLE_GTK4=""
11444 if test "x$enable_gtk4" = "xyes"; then
11445     ENABLE_GTK4="TRUE"
11446     AC_DEFINE(ENABLE_GTK4)
11447     R="$R gtk4"
11449 AC_SUBST(ENABLE_GTK4)
11451 ENABLE_QT5=""
11452 if test "x$enable_qt5" = "xyes"; then
11453     ENABLE_QT5="TRUE"
11454     AC_DEFINE(ENABLE_QT5)
11455     R="$R qt5"
11457 AC_SUBST(ENABLE_QT5)
11459 ENABLE_KF5=""
11460 if test "x$enable_kf5" = "xyes"; then
11461     ENABLE_KF5="TRUE"
11462     AC_DEFINE(ENABLE_KF5)
11463     R="$R kf5"
11465 AC_SUBST(ENABLE_KF5)
11467 if test "x$USING_X11" = "xyes"; then
11468     R="$R gen"
11471 if test "$_os" = "WINNT"; then
11472     R="$R win"
11473 elif test "$_os" = "Darwin"; then
11474     R="$R osx"
11475 elif test "$_os" = "iOS"; then
11476     R="ios (builtin)"
11479 build_vcl_plugins="$R"
11480 if test -z "$build_vcl_plugins"; then
11481     build_vcl_plugins=" none"
11483 AC_MSG_NOTICE([VCLplugs to be built:${build_vcl_plugins}])
11484 VCL_PLUGIN_INFO=$R
11485 AC_SUBST([VCL_PLUGIN_INFO])
11487 dnl ===================================================================
11488 dnl Check for GTK libraries
11489 dnl ===================================================================
11491 GTK3_CFLAGS=""
11492 GTK3_LIBS=""
11493 if test "x$enable_gtk3" = "xyes" -o "x$enable_gtk3_kde5" = "xyes"; then
11494     if test "$with_system_cairo" = no; then
11495         add_warning 'Non-system cairo combined with gtk3 is assumed to cause trouble; proceed at your own risk.'
11496     fi
11497     : ${with_system_cairo:=yes}
11498     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)
11499     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11500     GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
11501     FilterLibs "${GTK3_LIBS}"
11502     GTK3_LIBS="${filteredlibs}"
11504     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
11505     if test "$with_system_epoxy" != "yes"; then
11506         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
11507         AC_CHECK_HEADER(EGL/eglplatform.h, [],
11508                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
11509     fi
11511 AC_SUBST(GTK3_LIBS)
11512 AC_SUBST(GTK3_CFLAGS)
11514 GTK4_CFLAGS=""
11515 GTK4_LIBS=""
11516 if test "x$enable_gtk4" = "xyes"; then
11517     if test "$with_system_cairo" = no; then
11518         add_warning 'Non-system cairo combined with gtk4 is assumed to cause trouble; proceed at your own risk.'
11519     fi
11520     : ${with_system_cairo:=yes}
11521     PKG_CHECK_MODULES(GTK4, gtk4 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo atk)
11522     GTK4_CFLAGS=$(printf '%s' "$GTK4_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11523     GTK4_CFLAGS="$GTK4_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
11524     FilterLibs "${GTK4_LIBS}"
11525     GTK4_LIBS="${filteredlibs}"
11527     dnl We require egl only for the gtk4 plugin. Otherwise we use glx.
11528     if test "$with_system_epoxy" != "yes"; then
11529         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
11530         AC_CHECK_HEADER(EGL/eglplatform.h, [],
11531                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
11532     fi
11534 AC_SUBST(GTK4_LIBS)
11535 AC_SUBST(GTK4_CFLAGS)
11537 if test "$enable_introspection" = yes; then
11538     if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
11539         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
11540     else
11541         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
11542     fi
11545 dnl ===================================================================
11546 dnl check for dbus support
11547 dnl ===================================================================
11548 ENABLE_DBUS=""
11549 DBUS_CFLAGS=""
11550 DBUS_LIBS=""
11551 DBUS_GLIB_CFLAGS=""
11552 DBUS_GLIB_LIBS=""
11553 DBUS_HAVE_GLIB=""
11555 if test "$enable_dbus" = "no"; then
11556     test_dbus=no
11559 AC_MSG_CHECKING([whether to enable DBUS support])
11560 if test "$test_dbus" = "yes"; then
11561     ENABLE_DBUS="TRUE"
11562     AC_MSG_RESULT([yes])
11563     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
11564     AC_DEFINE(ENABLE_DBUS)
11565     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11566     FilterLibs "${DBUS_LIBS}"
11567     DBUS_LIBS="${filteredlibs}"
11569     # Glib is needed for BluetoothServer
11570     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
11571     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
11572         [
11573             DBUS_HAVE_GLIB="TRUE"
11574             AC_DEFINE(DBUS_HAVE_GLIB,1)
11575         ],
11576         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
11577     )
11578 else
11579     AC_MSG_RESULT([no])
11582 AC_SUBST(ENABLE_DBUS)
11583 AC_SUBST(DBUS_CFLAGS)
11584 AC_SUBST(DBUS_LIBS)
11585 AC_SUBST(DBUS_GLIB_CFLAGS)
11586 AC_SUBST(DBUS_GLIB_LIBS)
11587 AC_SUBST(DBUS_HAVE_GLIB)
11589 AC_MSG_CHECKING([whether to enable Impress remote control])
11590 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
11591     AC_MSG_RESULT([yes])
11592     ENABLE_SDREMOTE=TRUE
11593     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
11595     if test $OS = MACOSX && test "$MACOSX_SDK_VERSION" -ge 101500; then
11596         # The Bluetooth code doesn't compile with macOS SDK 10.15
11597         if test "$enable_sdremote_bluetooth" = yes; then
11598             AC_MSG_ERROR([macOS SDK $with_macosx_sdk does not currently support --enable-sdremote-bluetooth])
11599         fi
11600         enable_sdremote_bluetooth=no
11601     fi
11602     # If not explicitly enabled or disabled, default
11603     if test -z "$enable_sdremote_bluetooth"; then
11604         case "$OS" in
11605         LINUX|MACOSX|WNT)
11606             # Default to yes for these
11607             enable_sdremote_bluetooth=yes
11608             ;;
11609         *)
11610             # otherwise no
11611             enable_sdremote_bluetooth=no
11612             ;;
11613         esac
11614     fi
11615     # $enable_sdremote_bluetooth is guaranteed non-empty now
11617     if test "$enable_sdremote_bluetooth" != "no"; then
11618         if test "$OS" = "LINUX"; then
11619             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
11620                 AC_MSG_RESULT([yes])
11621                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
11622                 dnl ===================================================================
11623                 dnl Check for system bluez
11624                 dnl ===================================================================
11625                 AC_MSG_CHECKING([which Bluetooth header to use])
11626                 if test "$with_system_bluez" = "yes"; then
11627                     AC_MSG_RESULT([external])
11628                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
11629                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
11630                     SYSTEM_BLUEZ=TRUE
11631                 else
11632                     AC_MSG_RESULT([internal])
11633                     SYSTEM_BLUEZ=
11634                 fi
11635             else
11636                 AC_MSG_RESULT([no, dbus disabled])
11637                 ENABLE_SDREMOTE_BLUETOOTH=
11638                 SYSTEM_BLUEZ=
11639             fi
11640         else
11641             AC_MSG_RESULT([yes])
11642             ENABLE_SDREMOTE_BLUETOOTH=TRUE
11643             SYSTEM_BLUEZ=
11644         fi
11645     else
11646         AC_MSG_RESULT([no])
11647         ENABLE_SDREMOTE_BLUETOOTH=
11648         SYSTEM_BLUEZ=
11649     fi
11650 else
11651     ENABLE_SDREMOTE=
11652     SYSTEM_BLUEZ=
11653     AC_MSG_RESULT([no])
11655 AC_SUBST(ENABLE_SDREMOTE)
11656 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
11657 AC_SUBST(SYSTEM_BLUEZ)
11659 dnl ===================================================================
11660 dnl Check whether to enable GIO support
11661 dnl ===================================================================
11662 if test "$ENABLE_GTK4" = "TRUE" -o "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
11663     AC_MSG_CHECKING([whether to enable GIO support])
11664     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
11665         dnl Need at least 2.26 for the dbus support.
11666         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
11667                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
11668         if test "$ENABLE_GIO" = "TRUE"; then
11669             AC_DEFINE(ENABLE_GIO)
11670             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11671             FilterLibs "${GIO_LIBS}"
11672             GIO_LIBS="${filteredlibs}"
11673         fi
11674     else
11675         AC_MSG_RESULT([no])
11676     fi
11678 AC_SUBST(ENABLE_GIO)
11679 AC_SUBST(GIO_CFLAGS)
11680 AC_SUBST(GIO_LIBS)
11683 dnl ===================================================================
11685 SPLIT_APP_MODULES=""
11686 if test "$enable_split_app_modules" = "yes"; then
11687     SPLIT_APP_MODULES="TRUE"
11689 AC_SUBST(SPLIT_APP_MODULES)
11691 SPLIT_OPT_FEATURES=""
11692 if test "$enable_split_opt_features" = "yes"; then
11693     SPLIT_OPT_FEATURES="TRUE"
11695 AC_SUBST(SPLIT_OPT_FEATURES)
11697 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
11698     if test "$enable_cairo_canvas" = yes; then
11699         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
11700     fi
11701     enable_cairo_canvas=no
11702 elif test -z "$enable_cairo_canvas"; then
11703     enable_cairo_canvas=yes
11706 ENABLE_CAIRO_CANVAS=""
11707 if test "$enable_cairo_canvas" = "yes"; then
11708     test_cairo=yes
11709     ENABLE_CAIRO_CANVAS="TRUE"
11710     AC_DEFINE(ENABLE_CAIRO_CANVAS)
11712 AC_SUBST(ENABLE_CAIRO_CANVAS)
11714 dnl ===================================================================
11715 dnl Check whether the GStreamer libraries are available.
11716 dnl ===================================================================
11718 ENABLE_GSTREAMER_1_0=""
11720 if test "$build_gstreamer_1_0" = "yes"; then
11722     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
11723     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
11724         ENABLE_GSTREAMER_1_0="TRUE"
11725         AC_MSG_RESULT([yes])
11726         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
11727         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11728         FilterLibs "${GSTREAMER_1_0_LIBS}"
11729         GSTREAMER_1_0_LIBS="${filteredlibs}"
11730         AC_DEFINE(ENABLE_GSTREAMER_1_0)
11731     else
11732         AC_MSG_RESULT([no])
11733     fi
11735 AC_SUBST(GSTREAMER_1_0_CFLAGS)
11736 AC_SUBST(GSTREAMER_1_0_LIBS)
11737 AC_SUBST(ENABLE_GSTREAMER_1_0)
11739 ENABLE_OPENGL_TRANSITIONS=
11740 ENABLE_OPENGL_CANVAS=
11741 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
11742    : # disable
11743 elif test "$_os" = "Darwin"; then
11744     # We use frameworks on macOS, no need for detail checks
11745     ENABLE_OPENGL_TRANSITIONS=TRUE
11746     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11747     ENABLE_OPENGL_CANVAS=TRUE
11748 elif test $_os = WINNT; then
11749     ENABLE_OPENGL_TRANSITIONS=TRUE
11750     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11751     ENABLE_OPENGL_CANVAS=TRUE
11752 else
11753     if test "$USING_X11" = TRUE; then
11754         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
11755         ENABLE_OPENGL_TRANSITIONS=TRUE
11756         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11757         ENABLE_OPENGL_CANVAS=TRUE
11758     fi
11761 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
11762 AC_SUBST(ENABLE_OPENGL_CANVAS)
11764 dnl =================================================
11765 dnl Check whether to build with OpenCL support.
11766 dnl =================================================
11768 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE" -a "$enable_opencl" = "yes"; then
11769     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
11770     # platform (optional at run-time, used through clew).
11771     BUILD_TYPE="$BUILD_TYPE OPENCL"
11772     AC_DEFINE(HAVE_FEATURE_OPENCL)
11775 dnl =================================================
11776 dnl Check whether to build with dconf support.
11777 dnl =================================================
11779 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
11780     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
11781         if test "$enable_dconf" = yes; then
11782             AC_MSG_ERROR([dconf not found])
11783         else
11784             enable_dconf=no
11785         fi])
11787 AC_MSG_CHECKING([whether to enable dconf])
11788 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
11789     DCONF_CFLAGS=
11790     DCONF_LIBS=
11791     ENABLE_DCONF=
11792     AC_MSG_RESULT([no])
11793 else
11794     ENABLE_DCONF=TRUE
11795     AC_DEFINE(ENABLE_DCONF)
11796     AC_MSG_RESULT([yes])
11798 AC_SUBST([DCONF_CFLAGS])
11799 AC_SUBST([DCONF_LIBS])
11800 AC_SUBST([ENABLE_DCONF])
11802 # pdf import?
11803 AC_MSG_CHECKING([whether to build the PDF import feature])
11804 ENABLE_PDFIMPORT=
11805 if test -z "$enable_pdfimport" -o "$enable_pdfimport" = yes; then
11806     AC_MSG_RESULT([yes])
11807     ENABLE_PDFIMPORT=TRUE
11808     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
11809 else
11810     AC_MSG_RESULT([no])
11813 # Pdfium?
11814 AC_MSG_CHECKING([whether to build PDFium])
11815 ENABLE_PDFIUM=
11816 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
11817     AC_MSG_RESULT([yes])
11818     ENABLE_PDFIUM=TRUE
11819     BUILD_TYPE="$BUILD_TYPE PDFIUM"
11820 else
11821     AC_MSG_RESULT([no])
11823 AC_SUBST(ENABLE_PDFIUM)
11825 dnl ===================================================================
11826 dnl Check for poppler
11827 dnl ===================================================================
11828 ENABLE_POPPLER=
11829 AC_MSG_CHECKING([whether to build Poppler])
11830 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" -a $_os != Android \) -o "$enable_poppler" = yes; then
11831     AC_MSG_RESULT([yes])
11832     ENABLE_POPPLER=TRUE
11833     AC_DEFINE(HAVE_FEATURE_POPPLER)
11834 else
11835     AC_MSG_RESULT([no])
11837 AC_SUBST(ENABLE_POPPLER)
11839 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
11840     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
11843 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
11844     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
11847 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
11848     dnl ===================================================================
11849     dnl Check for system poppler
11850     dnl ===================================================================
11851     AC_MSG_CHECKING([which PDF import poppler to use])
11852     if test "$with_system_poppler" = "yes"; then
11853         AC_MSG_RESULT([external])
11854         SYSTEM_POPPLER=TRUE
11855         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
11856         AC_LANG_PUSH([C++])
11857         save_CXXFLAGS=$CXXFLAGS
11858         save_CPPFLAGS=$CPPFLAGS
11859         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
11860         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
11861         AC_CHECK_HEADER([cpp/poppler-version.h],
11862             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
11863             [])
11864         CXXFLAGS=$save_CXXFLAGS
11865         CPPFLAGS=$save_CPPFLAGS
11866         AC_LANG_POP([C++])
11867         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11869         FilterLibs "${POPPLER_LIBS}"
11870         POPPLER_LIBS="${filteredlibs}"
11871     else
11872         AC_MSG_RESULT([internal])
11873         SYSTEM_POPPLER=
11874         BUILD_TYPE="$BUILD_TYPE POPPLER"
11875         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
11876     fi
11877     AC_DEFINE([ENABLE_PDFIMPORT],1)
11879 AC_SUBST(ENABLE_PDFIMPORT)
11880 AC_SUBST(SYSTEM_POPPLER)
11881 AC_SUBST(POPPLER_CFLAGS)
11882 AC_SUBST(POPPLER_LIBS)
11884 # Skia?
11885 AC_MSG_CHECKING([whether to build Skia])
11886 ENABLE_SKIA=
11887 if test "$enable_skia" != "no" -a "$build_skia" = "yes" -a -z "$DISABLE_GUI"; then
11888     if test "$enable_skia" = "debug"; then
11889         AC_MSG_RESULT([yes (debug)])
11890         ENABLE_SKIA_DEBUG=TRUE
11891     else
11892         AC_MSG_RESULT([yes])
11893         ENABLE_SKIA_DEBUG=
11894     fi
11895     ENABLE_SKIA=TRUE
11896     AC_DEFINE(HAVE_FEATURE_SKIA)
11897     BUILD_TYPE="$BUILD_TYPE SKIA"
11898 else
11899     AC_MSG_RESULT([no])
11901 AC_SUBST(ENABLE_SKIA)
11902 AC_SUBST(ENABLE_SKIA_DEBUG)
11904 LO_CLANG_CXXFLAGS_INTRINSICS_SSE2=
11905 LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3=
11906 LO_CLANG_CXXFLAGS_INTRINSICS_SSE41=
11907 LO_CLANG_CXXFLAGS_INTRINSICS_SSE42=
11908 LO_CLANG_CXXFLAGS_INTRINSICS_AVX=
11909 LO_CLANG_CXXFLAGS_INTRINSICS_AVX2=
11910 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512=
11911 LO_CLANG_CXXFLAGS_INTRINSICS_F16C=
11912 LO_CLANG_CXXFLAGS_INTRINSICS_FMA=
11914 if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE -a ! \( "$_os" = "WINNT" -a "$CPUNAME" = "AARCH64" \); then
11915     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
11916         AC_MSG_CHECKING([for Clang])
11917         AC_MSG_RESULT([$LO_CLANG_CC / $LO_CLANG_CXX])
11918     else
11919         if test "$_os" = "WINNT"; then
11920             AC_MSG_CHECKING([for clang-cl])
11921             if test -x "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"; then
11922                 LO_CLANG_CC=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"`
11923                 dnl explicitly set -m32/-m64
11924                 LO_CLANG_CC="$LO_CLANG_CC -m$WIN_HOST_BITS"
11925                 LO_CLANG_CXX="$LO_CLANG_CC"
11926                 AC_MSG_RESULT([$LO_CLANG_CC])
11927             else
11928                 AC_MSG_RESULT([no])
11929             fi
11930         else
11931             AC_CHECK_PROG(LO_CLANG_CC,clang,clang,[])
11932             AC_CHECK_PROG(LO_CLANG_CXX,clang++,clang++,[])
11933         fi
11934     fi
11935     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
11936         clang2_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $LO_CLANG_CC -E - | tail -1 | sed 's/ //g'`
11937         clang2_ver=`echo "$clang2_version" | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
11938         if test "$clang2_ver" -lt 50002; then
11939             AC_MSG_WARN(["$clang2_version" is too old or unrecognized, must be at least Clang 5.0.2])
11940             LO_CLANG_CC=
11941             LO_CLANG_CXX=
11942         fi
11943     fi
11944     if test -z "$LO_CLANG_CC" -o -z "$LO_CLANG_CXX"; then
11945         # Skia is the default on Windows, so hard-require Clang.
11946         # Elsewhere it's used just by the 'gen' VCL backend which is rarely used.
11947         if test "$_os" = "WINNT"; then
11948             AC_MSG_ERROR([Clang compiler not found. The Skia library needs to be built using Clang.])
11949         else
11950             AC_MSG_WARN([Clang compiler not found.])
11951         fi
11952     else
11954         save_CXX="$CXX"
11955         CXX="$LO_CLANG_CXX"
11956         # copy&paste (and adjust) of intrinsics checks, since MSVC's -arch doesn't work well for Clang-cl
11957         flag_sse2=-msse2
11958         flag_ssse3=-mssse3
11959         flag_sse41=-msse4.1
11960         flag_sse42=-msse4.2
11961         flag_avx=-mavx
11962         flag_avx2=-mavx2
11963         flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
11964         flag_f16c=-mf16c
11965         flag_fma=-mfma
11967         AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
11968         AC_LANG_PUSH([C++])
11969         save_CXXFLAGS=$CXXFLAGS
11970         CXXFLAGS="$CXXFLAGS $flag_sse2"
11971         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11972             #include <emmintrin.h>
11973             int main () {
11974                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11975                 c = _mm_xor_si128 (a, b);
11976                 return 0;
11977             }
11978             ])],
11979             [can_compile_sse2=yes],
11980             [can_compile_sse2=no])
11981         AC_LANG_POP([C++])
11982         CXXFLAGS=$save_CXXFLAGS
11983         AC_MSG_RESULT([${can_compile_sse2}])
11984         if test "${can_compile_sse2}" = "yes" ; then
11985             LO_CLANG_CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
11986         fi
11988         AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
11989         AC_LANG_PUSH([C++])
11990         save_CXXFLAGS=$CXXFLAGS
11991         CXXFLAGS="$CXXFLAGS $flag_ssse3"
11992         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11993             #include <tmmintrin.h>
11994             int main () {
11995                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11996                 c = _mm_maddubs_epi16 (a, b);
11997                 return 0;
11998             }
11999             ])],
12000             [can_compile_ssse3=yes],
12001             [can_compile_ssse3=no])
12002         AC_LANG_POP([C++])
12003         CXXFLAGS=$save_CXXFLAGS
12004         AC_MSG_RESULT([${can_compile_ssse3}])
12005         if test "${can_compile_ssse3}" = "yes" ; then
12006             LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
12007         fi
12009         AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
12010         AC_LANG_PUSH([C++])
12011         save_CXXFLAGS=$CXXFLAGS
12012         CXXFLAGS="$CXXFLAGS $flag_sse41"
12013         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12014             #include <smmintrin.h>
12015             int main () {
12016                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12017                 c = _mm_cmpeq_epi64 (a, b);
12018                 return 0;
12019             }
12020             ])],
12021             [can_compile_sse41=yes],
12022             [can_compile_sse41=no])
12023         AC_LANG_POP([C++])
12024         CXXFLAGS=$save_CXXFLAGS
12025         AC_MSG_RESULT([${can_compile_sse41}])
12026         if test "${can_compile_sse41}" = "yes" ; then
12027             LO_CLANG_CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
12028         fi
12030         AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
12031         AC_LANG_PUSH([C++])
12032         save_CXXFLAGS=$CXXFLAGS
12033         CXXFLAGS="$CXXFLAGS $flag_sse42"
12034         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12035             #include <nmmintrin.h>
12036             int main () {
12037                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
12038                 c = _mm_cmpgt_epi64 (a, b);
12039                 return 0;
12040             }
12041             ])],
12042             [can_compile_sse42=yes],
12043             [can_compile_sse42=no])
12044         AC_LANG_POP([C++])
12045         CXXFLAGS=$save_CXXFLAGS
12046         AC_MSG_RESULT([${can_compile_sse42}])
12047         if test "${can_compile_sse42}" = "yes" ; then
12048             LO_CLANG_CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
12049         fi
12051         AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
12052         AC_LANG_PUSH([C++])
12053         save_CXXFLAGS=$CXXFLAGS
12054         CXXFLAGS="$CXXFLAGS $flag_avx"
12055         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12056             #include <immintrin.h>
12057             int main () {
12058                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
12059                 c = _mm256_xor_ps(a, b);
12060                 return 0;
12061             }
12062             ])],
12063             [can_compile_avx=yes],
12064             [can_compile_avx=no])
12065         AC_LANG_POP([C++])
12066         CXXFLAGS=$save_CXXFLAGS
12067         AC_MSG_RESULT([${can_compile_avx}])
12068         if test "${can_compile_avx}" = "yes" ; then
12069             LO_CLANG_CXXFLAGS_INTRINSICS_AVX="$flag_avx"
12070         fi
12072         AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
12073         AC_LANG_PUSH([C++])
12074         save_CXXFLAGS=$CXXFLAGS
12075         CXXFLAGS="$CXXFLAGS $flag_avx2"
12076         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12077             #include <immintrin.h>
12078             int main () {
12079                 __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
12080                 c = _mm256_maddubs_epi16(a, b);
12081                 return 0;
12082             }
12083             ])],
12084             [can_compile_avx2=yes],
12085             [can_compile_avx2=no])
12086         AC_LANG_POP([C++])
12087         CXXFLAGS=$save_CXXFLAGS
12088         AC_MSG_RESULT([${can_compile_avx2}])
12089         if test "${can_compile_avx2}" = "yes" ; then
12090             LO_CLANG_CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
12091         fi
12093         AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
12094         AC_LANG_PUSH([C++])
12095         save_CXXFLAGS=$CXXFLAGS
12096         CXXFLAGS="$CXXFLAGS $flag_avx512"
12097         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12098             #include <immintrin.h>
12099             int main () {
12100                 __m512i a = _mm512_loadu_si512(0);
12101                 return 0;
12102             }
12103             ])],
12104             [can_compile_avx512=yes],
12105             [can_compile_avx512=no])
12106         AC_LANG_POP([C++])
12107         CXXFLAGS=$save_CXXFLAGS
12108         AC_MSG_RESULT([${can_compile_avx512}])
12109         if test "${can_compile_avx512}" = "yes" ; then
12110             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
12111         fi
12113         AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
12114         AC_LANG_PUSH([C++])
12115         save_CXXFLAGS=$CXXFLAGS
12116         CXXFLAGS="$CXXFLAGS $flag_f16c"
12117         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12118             #include <immintrin.h>
12119             int main () {
12120                 __m128i a = _mm_set1_epi32 (0);
12121                 __m128 c;
12122                 c = _mm_cvtph_ps(a);
12123                 return 0;
12124             }
12125             ])],
12126             [can_compile_f16c=yes],
12127             [can_compile_f16c=no])
12128         AC_LANG_POP([C++])
12129         CXXFLAGS=$save_CXXFLAGS
12130         AC_MSG_RESULT([${can_compile_f16c}])
12131         if test "${can_compile_f16c}" = "yes" ; then
12132             LO_CLANG_CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
12133         fi
12135         AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
12136         AC_LANG_PUSH([C++])
12137         save_CXXFLAGS=$CXXFLAGS
12138         CXXFLAGS="$CXXFLAGS $flag_fma"
12139         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
12140             #include <immintrin.h>
12141             int main () {
12142                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
12143                 d = _mm256_fmadd_ps(a, b, c);
12144                 return 0;
12145             }
12146             ])],
12147             [can_compile_fma=yes],
12148             [can_compile_fma=no])
12149         AC_LANG_POP([C++])
12150         CXXFLAGS=$save_CXXFLAGS
12151         AC_MSG_RESULT([${can_compile_fma}])
12152         if test "${can_compile_fma}" = "yes" ; then
12153             LO_CLANG_CXXFLAGS_INTRINSICS_FMA="$flag_fma"
12154         fi
12156         CXX="$save_CXX"
12157     fi
12160 # prefix LO_CLANG_CC/LO_CLANG_CXX with ccache if needed
12162 UNCACHED_CLANG_CC="$LO_CLANG_CC"
12163 UNCACHED_CLANG_CXX="$LO_CLANG_CXX"
12164 if test "$CCACHE" != "" -a -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
12165     AC_MSG_CHECKING([whether $LO_CLANG_CC is already ccached])
12166     AC_LANG_PUSH([C])
12167     save_CC="$CC"
12168     CC="$LO_CLANG_CC"
12169     save_CFLAGS=$CFLAGS
12170     CFLAGS="$CFLAGS --ccache-skip -O2"
12171     dnl an empty program will do, we're checking the compiler flags
12172     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12173                       [use_ccache=yes], [use_ccache=no])
12174     CFLAGS=$save_CFLAGS
12175     CC=$save_CC
12176     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12177         AC_MSG_RESULT([yes])
12178     else
12179         LO_CLANG_CC="$CCACHE $LO_CLANG_CC"
12180         AC_MSG_RESULT([no])
12181     fi
12182     AC_LANG_POP([C])
12184     AC_MSG_CHECKING([whether $LO_CLANG_CXX is already ccached])
12185     AC_LANG_PUSH([C++])
12186     save_CXX="$CXX"
12187     CXX="$LO_CLANG_CXX"
12188     save_CXXFLAGS=$CXXFLAGS
12189     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
12190     dnl an empty program will do, we're checking the compiler flags
12191     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12192                       [use_ccache=yes], [use_ccache=no])
12193     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12194         AC_MSG_RESULT([yes])
12195     else
12196         LO_CLANG_CXX="$CCACHE $LO_CLANG_CXX"
12197         AC_MSG_RESULT([no])
12198     fi
12199     CXXFLAGS=$save_CXXFLAGS
12200     CXX=$save_CXX
12201     AC_LANG_POP([C++])
12204 AC_SUBST(UNCACHED_CC)
12205 AC_SUBST(UNCACHED_CXX)
12206 AC_SUBST(LO_CLANG_CC)
12207 AC_SUBST(LO_CLANG_CXX)
12208 AC_SUBST(UNCACHED_CLANG_CC)
12209 AC_SUBST(UNCACHED_CLANG_CXX)
12210 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE2)
12211 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3)
12212 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE41)
12213 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE42)
12214 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX)
12215 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX2)
12216 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512)
12217 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_F16C)
12218 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_FMA)
12219 AC_SUBST(CLANG_USE_LD)
12221 SYSTEM_GPGMEPP=
12223 if test "$enable_gpgmepp" = no; then
12224     AC_MSG_CHECKING([whether to enable gpgmepp])
12225     AC_MSG_RESULT([no])
12226 elif test "$enable_mpl_subset" = "yes"; then
12227     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
12228     AC_MSG_RESULT([yes])
12229 elif test "$enable_fuzzers" = "yes"; then
12230     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
12231     AC_MSG_RESULT([yes])
12232 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
12233     dnl ===================================================================
12234     dnl Check for system gpgme
12235     dnl ===================================================================
12236     AC_MSG_CHECKING([which gpgmepp to use])
12237     if test "$with_system_gpgmepp" = "yes"; then
12238         AC_MSG_RESULT([external])
12239         SYSTEM_GPGMEPP=TRUE
12241         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
12242         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
12243             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
12244         # progress_callback is the only func with plain C linkage
12245         # checking for it also filters out older, KDE-dependent libgpgmepp versions
12246         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
12247             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
12248         AC_CHECK_HEADER(gpgme.h, [],
12249             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
12250     else
12251         AC_MSG_RESULT([internal])
12252         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
12253         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
12255         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
12256         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
12257         if test "$_os" != "WINNT"; then
12258             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
12259             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
12260         fi
12261     fi
12262     ENABLE_GPGMEPP=TRUE
12263     AC_DEFINE([HAVE_FEATURE_GPGME])
12264     AC_PATH_PROG(GPG, gpg)
12265     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
12266     # so let's exclude that manually for the moment
12267     if test -n "$GPG" -a "$_os" != "WINNT"; then
12268         # make sure we not only have a working gpgme, but a full working
12269         # gpg installation to run OpenPGP signature verification
12270         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
12271     fi
12272     if test "$_os" = "Linux"; then
12273       uid=`id -u`
12274       AC_MSG_CHECKING([for /run/user/$uid])
12275       if test -d /run/user/$uid; then
12276         AC_MSG_RESULT([yes])
12277         AC_PATH_PROG(GPGCONF, gpgconf)
12279         # Older versions of gpgconf are not working as expected, since
12280         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
12281         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
12282         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
12283         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
12284         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
12285         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
12286         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
12287           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
12288           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
12289           if $GPGCONF --dump-options > /dev/null ; then
12290             if $GPGCONF --dump-options | grep -q create-socketdir ; then
12291               AC_MSG_RESULT([yes])
12292               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
12293               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
12294             else
12295               AC_MSG_RESULT([no])
12296             fi
12297           else
12298             AC_MSG_RESULT([no. missing or broken gpgconf?])
12299           fi
12300         else
12301           AC_MSG_RESULT([no, $GPGCONF_VERSION])
12302         fi
12303       else
12304         AC_MSG_RESULT([no])
12305      fi
12306    fi
12308 AC_SUBST(ENABLE_GPGMEPP)
12309 AC_SUBST(SYSTEM_GPGMEPP)
12310 AC_SUBST(GPG_ERROR_CFLAGS)
12311 AC_SUBST(GPG_ERROR_LIBS)
12312 AC_SUBST(LIBASSUAN_CFLAGS)
12313 AC_SUBST(LIBASSUAN_LIBS)
12314 AC_SUBST(GPGMEPP_CFLAGS)
12315 AC_SUBST(GPGMEPP_LIBS)
12317 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
12318 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
12319     AC_MSG_RESULT([yes])
12320     ENABLE_MEDIAWIKI=TRUE
12321     BUILD_TYPE="$BUILD_TYPE XSLTML"
12322     if test  "x$with_java" = "xno"; then
12323         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
12324     fi
12325 else
12326     AC_MSG_RESULT([no])
12327     ENABLE_MEDIAWIKI=
12328     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
12330 AC_SUBST(ENABLE_MEDIAWIKI)
12332 AC_MSG_CHECKING([whether to build the Report Builder])
12333 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12334     AC_MSG_RESULT([yes])
12335     ENABLE_REPORTBUILDER=TRUE
12336     AC_MSG_CHECKING([which jfreereport libs to use])
12337     if test "$with_system_jfreereport" = "yes"; then
12338         SYSTEM_JFREEREPORT=TRUE
12339         AC_MSG_RESULT([external])
12340         if test -z $SAC_JAR; then
12341             SAC_JAR=/usr/share/java/sac.jar
12342         fi
12343         if ! test -f $SAC_JAR; then
12344              AC_MSG_ERROR(sac.jar not found.)
12345         fi
12347         if test -z $LIBXML_JAR; then
12348             if test -f /usr/share/java/libxml-1.0.0.jar; then
12349                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
12350             elif test -f /usr/share/java/libxml.jar; then
12351                 LIBXML_JAR=/usr/share/java/libxml.jar
12352             else
12353                 AC_MSG_ERROR(libxml.jar replacement not found.)
12354             fi
12355         elif ! test -f $LIBXML_JAR; then
12356             AC_MSG_ERROR(libxml.jar not found.)
12357         fi
12359         if test -z $FLUTE_JAR; then
12360             if test -f /usr/share/java/flute-1.3.0.jar; then
12361                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
12362             elif test -f /usr/share/java/flute.jar; then
12363                 FLUTE_JAR=/usr/share/java/flute.jar
12364             else
12365                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
12366             fi
12367         elif ! test -f $FLUTE_JAR; then
12368             AC_MSG_ERROR(flute-1.3.0.jar not found.)
12369         fi
12371         if test -z $JFREEREPORT_JAR; then
12372             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
12373                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
12374             elif test -f /usr/share/java/flow-engine.jar; then
12375                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
12376             else
12377                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
12378             fi
12379         elif ! test -f  $JFREEREPORT_JAR; then
12380                 AC_MSG_ERROR(jfreereport.jar not found.)
12381         fi
12383         if test -z $LIBLAYOUT_JAR; then
12384             if test -f /usr/share/java/liblayout-0.2.9.jar; then
12385                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
12386             elif test -f /usr/share/java/liblayout.jar; then
12387                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
12388             else
12389                 AC_MSG_ERROR(liblayout.jar replacement not found.)
12390             fi
12391         elif ! test -f $LIBLAYOUT_JAR; then
12392                 AC_MSG_ERROR(liblayout.jar not found.)
12393         fi
12395         if test -z $LIBLOADER_JAR; then
12396             if test -f /usr/share/java/libloader-1.0.0.jar; then
12397                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
12398             elif test -f /usr/share/java/libloader.jar; then
12399                 LIBLOADER_JAR=/usr/share/java/libloader.jar
12400             else
12401                 AC_MSG_ERROR(libloader.jar replacement not found.)
12402             fi
12403         elif ! test -f  $LIBLOADER_JAR; then
12404             AC_MSG_ERROR(libloader.jar not found.)
12405         fi
12407         if test -z $LIBFORMULA_JAR; then
12408             if test -f /usr/share/java/libformula-0.2.0.jar; then
12409                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
12410             elif test -f /usr/share/java/libformula.jar; then
12411                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
12412             else
12413                 AC_MSG_ERROR(libformula.jar replacement not found.)
12414             fi
12415         elif ! test -f $LIBFORMULA_JAR; then
12416                 AC_MSG_ERROR(libformula.jar not found.)
12417         fi
12419         if test -z $LIBREPOSITORY_JAR; then
12420             if test -f /usr/share/java/librepository-1.0.0.jar; then
12421                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
12422             elif test -f /usr/share/java/librepository.jar; then
12423                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
12424             else
12425                 AC_MSG_ERROR(librepository.jar replacement not found.)
12426             fi
12427         elif ! test -f $LIBREPOSITORY_JAR; then
12428             AC_MSG_ERROR(librepository.jar not found.)
12429         fi
12431         if test -z $LIBFONTS_JAR; then
12432             if test -f /usr/share/java/libfonts-1.0.0.jar; then
12433                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
12434             elif test -f /usr/share/java/libfonts.jar; then
12435                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
12436             else
12437                 AC_MSG_ERROR(libfonts.jar replacement not found.)
12438             fi
12439         elif ! test -f $LIBFONTS_JAR; then
12440                 AC_MSG_ERROR(libfonts.jar not found.)
12441         fi
12443         if test -z $LIBSERIALIZER_JAR; then
12444             if test -f /usr/share/java/libserializer-1.0.0.jar; then
12445                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
12446             elif test -f /usr/share/java/libserializer.jar; then
12447                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
12448             else
12449                 AC_MSG_ERROR(libserializer.jar replacement not found.)
12450             fi
12451         elif ! test -f $LIBSERIALIZER_JAR; then
12452                 AC_MSG_ERROR(libserializer.jar not found.)
12453         fi
12455         if test -z $LIBBASE_JAR; then
12456             if test -f /usr/share/java/libbase-1.0.0.jar; then
12457                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
12458             elif test -f /usr/share/java/libbase.jar; then
12459                 LIBBASE_JAR=/usr/share/java/libbase.jar
12460             else
12461                 AC_MSG_ERROR(libbase.jar replacement not found.)
12462             fi
12463         elif ! test -f $LIBBASE_JAR; then
12464             AC_MSG_ERROR(libbase.jar not found.)
12465         fi
12467     else
12468         AC_MSG_RESULT([internal])
12469         SYSTEM_JFREEREPORT=
12470         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
12471         NEED_ANT=TRUE
12472     fi
12473 else
12474     AC_MSG_RESULT([no])
12475     ENABLE_REPORTBUILDER=
12476     SYSTEM_JFREEREPORT=
12478 AC_SUBST(ENABLE_REPORTBUILDER)
12479 AC_SUBST(SYSTEM_JFREEREPORT)
12480 AC_SUBST(SAC_JAR)
12481 AC_SUBST(LIBXML_JAR)
12482 AC_SUBST(FLUTE_JAR)
12483 AC_SUBST(JFREEREPORT_JAR)
12484 AC_SUBST(LIBBASE_JAR)
12485 AC_SUBST(LIBLAYOUT_JAR)
12486 AC_SUBST(LIBLOADER_JAR)
12487 AC_SUBST(LIBFORMULA_JAR)
12488 AC_SUBST(LIBREPOSITORY_JAR)
12489 AC_SUBST(LIBFONTS_JAR)
12490 AC_SUBST(LIBSERIALIZER_JAR)
12492 # scripting provider for BeanShell?
12493 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
12494 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
12495     AC_MSG_RESULT([yes])
12496     ENABLE_SCRIPTING_BEANSHELL=TRUE
12498     dnl ===================================================================
12499     dnl Check for system beanshell
12500     dnl ===================================================================
12501     AC_MSG_CHECKING([which beanshell to use])
12502     if test "$with_system_beanshell" = "yes"; then
12503         AC_MSG_RESULT([external])
12504         SYSTEM_BSH=TRUE
12505         if test -z $BSH_JAR; then
12506             BSH_JAR=/usr/share/java/bsh.jar
12507         fi
12508         if ! test -f $BSH_JAR; then
12509             AC_MSG_ERROR(bsh.jar not found.)
12510         fi
12511     else
12512         AC_MSG_RESULT([internal])
12513         SYSTEM_BSH=
12514         BUILD_TYPE="$BUILD_TYPE BSH"
12515     fi
12516 else
12517     AC_MSG_RESULT([no])
12518     ENABLE_SCRIPTING_BEANSHELL=
12519     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
12521 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
12522 AC_SUBST(SYSTEM_BSH)
12523 AC_SUBST(BSH_JAR)
12525 # scripting provider for JavaScript?
12526 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
12527 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
12528     AC_MSG_RESULT([yes])
12529     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
12531     dnl ===================================================================
12532     dnl Check for system rhino
12533     dnl ===================================================================
12534     AC_MSG_CHECKING([which rhino to use])
12535     if test "$with_system_rhino" = "yes"; then
12536         AC_MSG_RESULT([external])
12537         SYSTEM_RHINO=TRUE
12538         if test -z $RHINO_JAR; then
12539             RHINO_JAR=/usr/share/java/js.jar
12540         fi
12541         if ! test -f $RHINO_JAR; then
12542             AC_MSG_ERROR(js.jar not found.)
12543         fi
12544     else
12545         AC_MSG_RESULT([internal])
12546         SYSTEM_RHINO=
12547         BUILD_TYPE="$BUILD_TYPE RHINO"
12548         NEED_ANT=TRUE
12549     fi
12550 else
12551     AC_MSG_RESULT([no])
12552     ENABLE_SCRIPTING_JAVASCRIPT=
12553     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
12555 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
12556 AC_SUBST(SYSTEM_RHINO)
12557 AC_SUBST(RHINO_JAR)
12559 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
12560 # paths should be added to library search path. So lets put all 64-bit
12561 # platforms there.
12562 supports_multilib=
12563 case "$host_cpu" in
12564 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
12565     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
12566         supports_multilib="yes"
12567     fi
12568     ;;
12570     ;;
12571 esac
12573 dnl ===================================================================
12574 dnl QT5 Integration
12575 dnl ===================================================================
12577 QT5_CFLAGS=""
12578 QT5_LIBS=""
12579 QMAKE5="qmake"
12580 MOC5="moc"
12581 QT5_GOBJECT_CFLAGS=""
12582 QT5_GOBJECT_LIBS=""
12583 QT5_HAVE_GOBJECT=""
12584 QT5_PLATFORMS_SRCDIR=""
12585 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
12586         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
12587         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
12588 then
12589     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
12590     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
12592     if test -n "$supports_multilib"; then
12593         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
12594     fi
12596     qt5_test_include="QtWidgets/qapplication.h"
12597     if test "$_os" = "Emscripten"; then
12598         qt5_test_library="libQt5Widgets.a"
12599     else
12600         qt5_test_library="libQt5Widgets.so"
12601     fi
12603     dnl Check for qmake5
12604     if test -n "$QT5DIR"; then
12605         AC_PATH_PROG(QMAKE5, [qmake], no, [$QT5DIR/bin])
12606     else
12607         AC_PATH_PROGS(QMAKE5, [qmake-qt5 qmake], no)
12608     fi
12609     if test "$QMAKE5" = "no"; then
12610         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12611     else
12612         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
12613         if test -z "$qmake5_test_ver"; then
12614             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12615         fi
12616         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
12617         qt5_minimal_minor="6"
12618         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
12619             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
12620         else
12621             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
12622         fi
12623     fi
12625     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
12626     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
12627     qt5_platformsdir="`$QMAKE5 -query QT_INSTALL_PLUGINS`/platforms"
12628     QT5_PLATFORMS_SRCDIR="$qt5_platformsdir"
12630     AC_MSG_CHECKING([for Qt5 headers])
12631     qt5_incdir="no"
12632     for inc_dir in $qt5_incdirs; do
12633         if test -r "$inc_dir/$qt5_test_include"; then
12634             qt5_incdir="$inc_dir"
12635             break
12636         fi
12637     done
12638     AC_MSG_RESULT([$qt5_incdir])
12639     if test "x$qt5_incdir" = "xno"; then
12640         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12641     fi
12642     # check for scenario: qt5-qtbase-devel-*.86_64 installed but host is i686
12643     AC_LANG_PUSH([C++])
12644     save_CPPFLAGS=$CPPFLAGS
12645     CPPFLAGS="${CPPFLAGS} -I${qt5_incdir}"
12646     AC_CHECK_HEADER(QtCore/qconfig.h, [],
12647         [AC_MSG_ERROR(qconfig.h header not found.)], [])
12648     CPPFLAGS=$save_CPPFLAGS
12649     AC_LANG_POP([C++])
12651     AC_MSG_CHECKING([for Qt5 libraries])
12652     qt5_libdir="no"
12653     for lib_dir in $qt5_libdirs; do
12654         if test -r "$lib_dir/$qt5_test_library"; then
12655             qt5_libdir="$lib_dir"
12656             break
12657         fi
12658     done
12659     AC_MSG_RESULT([$qt5_libdir])
12660     if test "x$qt5_libdir" = "xno"; then
12661         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12662     fi
12664     if test "$_os" = "Emscripten"; then
12665         if test ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html ; then
12666             QT5_PLATFORMS_SRCDIR="${QT5_PLATFORMS_SRCDIR/plugins/src\/plugins}/wasm"
12667         fi
12668         if test ! -f "${qt5_platformsdir}"/libqwasm.a -o ! -f "$QT5_PLATFORMS_SRCDIR"/wasm_shell.html; then
12669             AC_MSG_ERROR([No Qt5 WASM QPA plugin found in ${qt5_platformsdir} or ${QT5_PLATFORMS_SRCDIR}])
12670         fi
12671     fi
12673     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
12674     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12675     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
12676     if test "$_os" = "Emscripten"; then
12677         QT5_LIBS="$QT5_LIBS -lqtpcre2 -lQt5EventDispatcherSupport -lQt5FontDatabaseSupport -L${qt5_platformsdir} -lqwasm"
12678     fi
12680     if test "$USING_X11" = TRUE; then
12681         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
12682         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
12683             QT5_HAVE_XCB_ICCCM=1
12684             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
12685         ],[
12686             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)])
12687             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
12688         ])
12689         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
12690         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
12691         QT5_USING_X11=1
12692         AC_DEFINE(QT5_USING_X11)
12693     fi
12695     dnl Check for Meta Object Compiler
12697     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
12698     if test "$MOC5" = "no"; then
12699         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
12700 the root of your Qt installation by exporting QT5DIR before running "configure".])
12701     fi
12703     if test "$build_gstreamer_1_0" = "yes"; then
12704         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
12705                 QT5_HAVE_GOBJECT=1
12706                 AC_DEFINE(QT5_HAVE_GOBJECT)
12707             ],
12708             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
12709         )
12710     fi
12712 AC_SUBST(QT5_CFLAGS)
12713 AC_SUBST(QT5_LIBS)
12714 AC_SUBST(MOC5)
12715 AC_SUBST(QT5_GOBJECT_CFLAGS)
12716 AC_SUBST(QT5_GOBJECT_LIBS)
12717 AC_SUBST(QT5_HAVE_GOBJECT)
12718 AC_SUBST(QT5_PLATFORMS_SRCDIR)
12720 dnl ===================================================================
12721 dnl KF5 Integration
12722 dnl ===================================================================
12724 KF5_CFLAGS=""
12725 KF5_LIBS=""
12726 KF5_CONFIG="kf5-config"
12727 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
12728         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
12729 then
12730     if test "$OS" = "HAIKU"; then
12731         haiku_arch="`echo $RTL_ARCH | tr X x`"
12732         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
12733         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
12734     fi
12736     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
12737     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
12738     if test -n "$supports_multilib"; then
12739         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
12740     fi
12742     kf5_test_include="KF5/kcoreaddons_version.h"
12743     kf5_test_library="libKF5CoreAddons.so"
12744     kf5_libdirs="$qt5_libdir $kf5_libdirs"
12746     dnl kf5 KDE4 support compatibility installed
12747     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
12748     if test "$KF5_CONFIG" != "no"; then
12749         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
12750         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
12751     fi
12753     dnl Check for KF5 headers
12754     AC_MSG_CHECKING([for KF5 headers])
12755     kf5_incdir="no"
12756     for kf5_check in $kf5_incdirs; do
12757         if test -r "$kf5_check/$kf5_test_include"; then
12758             kf5_incdir="$kf5_check/KF5"
12759             break
12760         fi
12761     done
12762     AC_MSG_RESULT([$kf5_incdir])
12763     if test "x$kf5_incdir" = "xno"; then
12764         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
12765     fi
12767     dnl Check for KF5 libraries
12768     AC_MSG_CHECKING([for KF5 libraries])
12769     kf5_libdir="no"
12770     for kf5_check in $kf5_libdirs; do
12771         if test -r "$kf5_check/$kf5_test_library"; then
12772             kf5_libdir="$kf5_check"
12773             break
12774         fi
12775     done
12777     AC_MSG_RESULT([$kf5_libdir])
12778     if test "x$kf5_libdir" = "xno"; then
12779         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
12780     fi
12782     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"
12783     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
12784     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12786     if test "$USING_X11" = TRUE; then
12787         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
12788     fi
12790     AC_LANG_PUSH([C++])
12791     save_CXXFLAGS=$CXXFLAGS
12792     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
12793     AC_MSG_CHECKING([whether KDE is >= 5.0])
12794        AC_RUN_IFELSE([AC_LANG_SOURCE([[
12795 #include <kcoreaddons_version.h>
12797 int main(int argc, char **argv) {
12798        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
12799        else return 1;
12801        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
12802     CXXFLAGS=$save_CXXFLAGS
12803     AC_LANG_POP([C++])
12805 AC_SUBST(KF5_CFLAGS)
12806 AC_SUBST(KF5_LIBS)
12808 dnl ===================================================================
12809 dnl Test whether to include Evolution 2 support
12810 dnl ===================================================================
12811 AC_MSG_CHECKING([whether to enable evolution 2 support])
12812 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
12813     AC_MSG_RESULT([yes])
12814     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
12815     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12816     FilterLibs "${GOBJECT_LIBS}"
12817     GOBJECT_LIBS="${filteredlibs}"
12818     ENABLE_EVOAB2="TRUE"
12819 else
12820     ENABLE_EVOAB2=""
12821     AC_MSG_RESULT([no])
12823 AC_SUBST(ENABLE_EVOAB2)
12824 AC_SUBST(GOBJECT_CFLAGS)
12825 AC_SUBST(GOBJECT_LIBS)
12827 dnl ===================================================================
12828 dnl Test which themes to include
12829 dnl ===================================================================
12830 AC_MSG_CHECKING([which themes to include])
12831 # if none given use default subset of available themes
12832 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
12833     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"
12836 WITH_THEMES=""
12837 if test "x$with_theme" != "xno"; then
12838     for theme in $with_theme; do
12839         case $theme in
12840         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" ;;
12841         default) real_theme=colibre ;;
12842         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
12843         esac
12844         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
12845     done
12847 AC_MSG_RESULT([$WITH_THEMES])
12848 AC_SUBST([WITH_THEMES])
12849 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
12850 for theme in $with_theme; do
12851     case $theme in
12852     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
12853     *) ;;
12854     esac
12855 done
12857 dnl ===================================================================
12858 dnl Test whether to integrate helppacks into the product's installer
12859 dnl ===================================================================
12860 AC_MSG_CHECKING([for helppack integration])
12861 if test "$with_helppack_integration" = "no"; then
12862     AC_MSG_RESULT([no integration])
12863 else
12864     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
12865     AC_MSG_RESULT([integration])
12868 ###############################################################################
12869 # Extensions checking
12870 ###############################################################################
12871 AC_MSG_CHECKING([for extensions integration])
12872 if test "x$enable_extension_integration" != "xno"; then
12873     WITH_EXTENSION_INTEGRATION=TRUE
12874     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
12875     AC_MSG_RESULT([yes, use integration])
12876 else
12877     WITH_EXTENSION_INTEGRATION=
12878     AC_MSG_RESULT([no, do not integrate])
12880 AC_SUBST(WITH_EXTENSION_INTEGRATION)
12882 dnl Should any extra extensions be included?
12883 dnl There are standalone tests for each of these below.
12884 WITH_EXTRA_EXTENSIONS=
12885 AC_SUBST([WITH_EXTRA_EXTENSIONS])
12887 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
12888 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
12889 if test "x$with_java" != "xno"; then
12890     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
12891     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
12894 AC_MSG_CHECKING([whether to build opens___.ttf])
12895 if test "$enable_build_opensymbol" = "yes"; then
12896     AC_MSG_RESULT([yes])
12897     AC_PATH_PROG(FONTFORGE, fontforge)
12898     if test -z "$FONTFORGE"; then
12899         AC_MSG_ERROR([fontforge not installed])
12900     fi
12901 else
12902     AC_MSG_RESULT([no])
12903     OPENSYMBOL_TTF=f543e6e2d7275557a839a164941c0a86e5f2c3f2a0042bfc434c88c6dde9e140-opens___.ttf
12904     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
12906 AC_SUBST(OPENSYMBOL_TTF)
12907 AC_SUBST(FONTFORGE)
12909 dnl ===================================================================
12910 dnl Test whether to include fonts
12911 dnl ===================================================================
12912 AC_MSG_CHECKING([whether to include third-party fonts])
12913 if test "$with_fonts" != "no"; then
12914     AC_MSG_RESULT([yes])
12915     WITH_FONTS=TRUE
12916     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
12917     AC_DEFINE(HAVE_MORE_FONTS)
12918 else
12919     AC_MSG_RESULT([no])
12920     WITH_FONTS=
12921     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
12923 AC_SUBST(WITH_FONTS)
12926 dnl ===================================================================
12927 dnl Test whether to enable online update service
12928 dnl ===================================================================
12929 AC_MSG_CHECKING([whether to enable online update])
12930 ENABLE_ONLINE_UPDATE=
12931 ENABLE_ONLINE_UPDATE_MAR=
12932 UPDATE_CONFIG=
12933 if test "$enable_online_update" = ""; then
12934     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
12935         AC_MSG_RESULT([yes])
12936         ENABLE_ONLINE_UPDATE="TRUE"
12937     else
12938         AC_MSG_RESULT([no])
12939     fi
12940 else
12941     if test "$enable_online_update" = "mar"; then
12942         AC_MSG_RESULT([yes - MAR-based online update])
12943         ENABLE_ONLINE_UPDATE_MAR="TRUE"
12944         if test "$with_update_config" = ""; then
12945             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
12946         fi
12947         UPDATE_CONFIG="$with_update_config"
12948         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
12949     elif test "$enable_online_update" = "yes"; then
12950         AC_MSG_RESULT([yes])
12951         ENABLE_ONLINE_UPDATE="TRUE"
12952     else
12953         AC_MSG_RESULT([no])
12954     fi
12956 AC_SUBST(ENABLE_ONLINE_UPDATE)
12957 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
12958 AC_SUBST(UPDATE_CONFIG)
12961 PRIVACY_POLICY_URL="$with_privacy_policy_url"
12962 if test "$ENABLE_ONLINE_UPDATE" = TRUE -o "$ENABLE_BREAKPAD" = "TRUE"; then
12963     if test "x$with_privacy_policy_url" = "xundefined"; then
12964         AC_MSG_FAILURE([online update or breakpad/crashreporting are enabled, but no privacy url was provided])
12965     fi
12967 AC_SUBST(PRIVACY_POLICY_URL)
12968 dnl ===================================================================
12969 dnl Test whether we need bzip2
12970 dnl ===================================================================
12971 SYSTEM_BZIP2=
12972 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
12973     AC_MSG_CHECKING([whether to use system bzip2])
12974     if test "$with_system_bzip2" = yes; then
12975         SYSTEM_BZIP2=TRUE
12976         AC_MSG_RESULT([yes])
12977         PKG_CHECK_MODULES(BZIP2, bzip2)
12978         FilterLibs "${BZIP2_LIBS}"
12979         BZIP2_LIBS="${filteredlibs}"
12980     else
12981         AC_MSG_RESULT([no])
12982         BUILD_TYPE="$BUILD_TYPE BZIP2"
12983     fi
12985 AC_SUBST(SYSTEM_BZIP2)
12986 AC_SUBST(BZIP2_CFLAGS)
12987 AC_SUBST(BZIP2_LIBS)
12989 dnl ===================================================================
12990 dnl Test whether to enable extension update
12991 dnl ===================================================================
12992 AC_MSG_CHECKING([whether to enable extension update])
12993 ENABLE_EXTENSION_UPDATE=
12994 if test "x$enable_extension_update" = "xno"; then
12995     AC_MSG_RESULT([no])
12996 else
12997     AC_MSG_RESULT([yes])
12998     ENABLE_EXTENSION_UPDATE="TRUE"
12999     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
13000     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
13002 AC_SUBST(ENABLE_EXTENSION_UPDATE)
13005 dnl ===================================================================
13006 dnl Test whether to create MSI with LIMITUI=1 (silent install)
13007 dnl ===================================================================
13008 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
13009 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
13010     AC_MSG_RESULT([no])
13011     ENABLE_SILENT_MSI=
13012 else
13013     AC_MSG_RESULT([yes])
13014     ENABLE_SILENT_MSI=TRUE
13015     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
13017 AC_SUBST(ENABLE_SILENT_MSI)
13019 AC_MSG_CHECKING([whether and how to use Xinerama])
13020 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
13021     if test "$x_libraries" = "default_x_libraries"; then
13022         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
13023         if test "x$XINERAMALIB" = x; then
13024            XINERAMALIB="/usr/lib"
13025         fi
13026     else
13027         XINERAMALIB="$x_libraries"
13028     fi
13029     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
13030         # we have both versions, let the user decide but use the dynamic one
13031         # per default
13032         USE_XINERAMA=TRUE
13033         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
13034             XINERAMA_LINK=dynamic
13035         else
13036             XINERAMA_LINK=static
13037         fi
13038     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
13039         # we have only the dynamic version
13040         USE_XINERAMA=TRUE
13041         XINERAMA_LINK=dynamic
13042     elif test -e "$XINERAMALIB/libXinerama.a"; then
13043         # static version
13044         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
13045             USE_XINERAMA=TRUE
13046             XINERAMA_LINK=static
13047         else
13048             USE_XINERAMA=
13049             XINERAMA_LINK=none
13050         fi
13051     else
13052         # no Xinerama
13053         USE_XINERAMA=
13054         XINERAMA_LINK=none
13055     fi
13056     if test "$USE_XINERAMA" = "TRUE"; then
13057         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
13058         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
13059             [AC_MSG_ERROR(Xinerama header not found.)], [])
13060         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
13061         if test "x$XEXTLIB" = x; then
13062            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
13063         fi
13064         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
13065         if test "$_os" = "FreeBSD"; then
13066             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
13067         fi
13068         if test "$_os" = "Linux"; then
13069             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
13070         fi
13071         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
13072             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
13073     else
13074         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
13075     fi
13076 else
13077     USE_XINERAMA=
13078     XINERAMA_LINK=none
13079     AC_MSG_RESULT([no])
13081 AC_SUBST(USE_XINERAMA)
13082 AC_SUBST(XINERAMA_LINK)
13084 dnl ===================================================================
13085 dnl Test whether to build cairo or rely on the system version
13086 dnl ===================================================================
13088 if test "$USING_X11" = TRUE; then
13089     # Used in vcl/Library_vclplug_gen.mk
13090     test_cairo=yes
13093 if test "$test_cairo" = "yes"; then
13094     AC_MSG_CHECKING([whether to use the system cairo])
13096     : ${with_system_cairo:=$with_system_libs}
13097     if test "$with_system_cairo" = "yes"; then
13098         SYSTEM_CAIRO=TRUE
13099         AC_MSG_RESULT([yes])
13101         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
13102         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13103         FilterLibs "${CAIRO_LIBS}"
13104         CAIRO_LIBS="${filteredlibs}"
13106         if test "$test_xrender" = "yes"; then
13107             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
13108             AC_LANG_PUSH([C])
13109             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
13110 #ifdef PictStandardA8
13111 #else
13112       return fail;
13113 #endif
13114 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
13116             AC_LANG_POP([C])
13117         fi
13118     else
13119         SYSTEM_CAIRO=
13120         AC_MSG_RESULT([no])
13122         BUILD_TYPE="$BUILD_TYPE CAIRO"
13123     fi
13126 AC_SUBST(SYSTEM_CAIRO)
13127 AC_SUBST(CAIRO_CFLAGS)
13128 AC_SUBST(CAIRO_LIBS)
13130 dnl ===================================================================
13131 dnl Test whether to use avahi
13132 dnl ===================================================================
13133 if test "$_os" = "WINNT"; then
13134     # Windows uses bundled mDNSResponder
13135     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
13136 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
13137     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
13138                       [ENABLE_AVAHI="TRUE"])
13139     AC_DEFINE(HAVE_FEATURE_AVAHI)
13140     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13141     FilterLibs "${AVAHI_LIBS}"
13142     AVAHI_LIBS="${filteredlibs}"
13145 AC_SUBST(ENABLE_AVAHI)
13146 AC_SUBST(AVAHI_CFLAGS)
13147 AC_SUBST(AVAHI_LIBS)
13149 dnl ===================================================================
13150 dnl Test whether to use liblangtag
13151 dnl ===================================================================
13152 SYSTEM_LIBLANGTAG=
13153 AC_MSG_CHECKING([whether to use system liblangtag])
13154 if test "$with_system_liblangtag" = yes; then
13155     SYSTEM_LIBLANGTAG=TRUE
13156     AC_MSG_RESULT([yes])
13157     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
13158     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
13159     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
13160     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
13161     FilterLibs "${LIBLANGTAG_LIBS}"
13162     LIBLANGTAG_LIBS="${filteredlibs}"
13163 else
13164     SYSTEM_LIBLANGTAG=
13165     AC_MSG_RESULT([no])
13166     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
13167     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
13168     if test "$COM" = "MSC"; then
13169         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
13170     else
13171         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
13172     fi
13174 AC_SUBST(SYSTEM_LIBLANGTAG)
13175 AC_SUBST(LIBLANGTAG_CFLAGS)
13176 AC_SUBST(LIBLANGTAG_LIBS)
13178 dnl ===================================================================
13179 dnl Test whether to build libpng or rely on the system version
13180 dnl ===================================================================
13182 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
13184 dnl ===================================================================
13185 dnl Check for runtime JVM search path
13186 dnl ===================================================================
13187 if test "$ENABLE_JAVA" != ""; then
13188     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
13189     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
13190         AC_MSG_RESULT([yes])
13191         if ! test -d "$with_jvm_path"; then
13192             AC_MSG_ERROR(["$with_jvm_path" not a directory])
13193         fi
13194         if ! test -d "$with_jvm_path"jvm; then
13195             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
13196         fi
13197         JVM_ONE_PATH_CHECK="$with_jvm_path"
13198         AC_SUBST(JVM_ONE_PATH_CHECK)
13199     else
13200         AC_MSG_RESULT([no])
13201     fi
13204 dnl ===================================================================
13205 dnl Test for the presence of Ant and that it works
13206 dnl ===================================================================
13208 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE" -a "$cross_compiling" != "yes"; then
13209     ANT_HOME=; export ANT_HOME
13210     WITH_ANT_HOME=; export WITH_ANT_HOME
13211     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
13212         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
13213             if test "$_os" = "WINNT"; then
13214                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
13215             else
13216                 with_ant_home="$LODE_HOME/opt/ant"
13217             fi
13218         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
13219             with_ant_home="$LODE_HOME/opt/ant"
13220         fi
13221     fi
13222     if test -z "$with_ant_home"; then
13223         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
13224     else
13225         if test "$_os" = "WINNT"; then
13226             # AC_PATH_PROGS needs unix path
13227             with_ant_home=`cygpath -u "$with_ant_home"`
13228         fi
13229         AbsolutePath "$with_ant_home"
13230         with_ant_home=$absolute_path
13231         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
13232         WITH_ANT_HOME=$with_ant_home
13233         ANT_HOME=$with_ant_home
13234     fi
13236     if test -z "$ANT"; then
13237         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
13238     else
13239         # resolve relative or absolute symlink
13240         while test -h "$ANT"; do
13241             a_cwd=`pwd`
13242             a_basename=`basename "$ANT"`
13243             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
13244             cd "`dirname "$ANT"`"
13245             cd "`dirname "$a_script"`"
13246             ANT="`pwd`"/"`basename "$a_script"`"
13247             cd "$a_cwd"
13248         done
13250         AC_MSG_CHECKING([if $ANT works])
13251         mkdir -p conftest.dir
13252         a_cwd=$(pwd)
13253         cd conftest.dir
13254         cat > conftest.java << EOF
13255         public class conftest {
13256             int testmethod(int a, int b) {
13257                     return a + b;
13258             }
13259         }
13262         cat > conftest.xml << EOF
13263         <project name="conftest" default="conftest">
13264         <target name="conftest">
13265             <javac srcdir="." includes="conftest.java">
13266             </javac>
13267         </target>
13268         </project>
13271         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
13272         if test $? = 0 -a -f ./conftest.class; then
13273             AC_MSG_RESULT([Ant works])
13274             if test -z "$WITH_ANT_HOME"; then
13275                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
13276                 if test -z "$ANT_HOME"; then
13277                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
13278                 fi
13279             else
13280                 ANT_HOME="$WITH_ANT_HOME"
13281             fi
13282         else
13283             echo "configure: Ant test failed" >&5
13284             cat conftest.java >&5
13285             cat conftest.xml >&5
13286             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
13287         fi
13288         cd "$a_cwd"
13289         rm -fr conftest.dir
13290     fi
13291     if test -z "$ANT_HOME"; then
13292         ANT_HOME="NO_ANT_HOME"
13293     else
13294         PathFormat "$ANT_HOME"
13295         ANT_HOME="$formatted_path"
13296         PathFormat "$ANT"
13297         ANT="$formatted_path"
13298     fi
13300     dnl Checking for ant.jar
13301     if test "$ANT_HOME" != "NO_ANT_HOME"; then
13302         AC_MSG_CHECKING([Ant lib directory])
13303         if test -f $ANT_HOME/lib/ant.jar; then
13304             ANT_LIB="$ANT_HOME/lib"
13305         else
13306             if test -f $ANT_HOME/ant.jar; then
13307                 ANT_LIB="$ANT_HOME"
13308             else
13309                 if test -f /usr/share/java/ant.jar; then
13310                     ANT_LIB=/usr/share/java
13311                 else
13312                     if test -f /usr/share/ant-core/lib/ant.jar; then
13313                         ANT_LIB=/usr/share/ant-core/lib
13314                     else
13315                         if test -f $ANT_HOME/lib/ant/ant.jar; then
13316                             ANT_LIB="$ANT_HOME/lib/ant"
13317                         else
13318                             if test -f /usr/share/lib/ant/ant.jar; then
13319                                 ANT_LIB=/usr/share/lib/ant
13320                             else
13321                                 AC_MSG_ERROR([Ant libraries not found!])
13322                             fi
13323                         fi
13324                     fi
13325                 fi
13326             fi
13327         fi
13328         PathFormat "$ANT_LIB"
13329         ANT_LIB="$formatted_path"
13330         AC_MSG_RESULT([Ant lib directory found.])
13331     fi
13333     ant_minver=1.6.0
13334     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
13336     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
13337     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
13338     ant_version_major=`echo $ant_version | cut -d. -f1`
13339     ant_version_minor=`echo $ant_version | cut -d. -f2`
13340     echo "configure: ant_version $ant_version " >&5
13341     echo "configure: ant_version_major $ant_version_major " >&5
13342     echo "configure: ant_version_minor $ant_version_minor " >&5
13343     if test "$ant_version_major" -ge "2"; then
13344         AC_MSG_RESULT([yes, $ant_version])
13345     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
13346         AC_MSG_RESULT([yes, $ant_version])
13347     else
13348         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
13349     fi
13351     rm -f conftest* core core.* *.core
13353 AC_SUBST(ANT)
13354 AC_SUBST(ANT_HOME)
13355 AC_SUBST(ANT_LIB)
13357 OOO_JUNIT_JAR=
13358 HAMCREST_JAR=
13359 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no" -a "$cross_compiling" != "yes"; then
13360     AC_MSG_CHECKING([for JUnit 4])
13361     if test "$with_junit" = "yes"; then
13362         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
13363             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
13364         elif test -e /usr/share/java/junit4.jar; then
13365             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
13366         else
13367            if test -e /usr/share/lib/java/junit.jar; then
13368               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
13369            else
13370               OOO_JUNIT_JAR=/usr/share/java/junit.jar
13371            fi
13372         fi
13373     else
13374         OOO_JUNIT_JAR=$with_junit
13375     fi
13376     if test "$_os" = "WINNT"; then
13377         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
13378     fi
13379     printf 'import org.junit.Before;' > conftest.java
13380     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
13381         AC_MSG_RESULT([$OOO_JUNIT_JAR])
13382     else
13383         AC_MSG_ERROR(
13384 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
13385  specify its pathname via --with-junit=..., or disable it via --without-junit])
13386     fi
13387     rm -f conftest.class conftest.java
13388     if test $OOO_JUNIT_JAR != ""; then
13389         BUILD_TYPE="$BUILD_TYPE QADEVOOO"
13390     fi
13392     AC_MSG_CHECKING([for included Hamcrest])
13393     printf 'import org.hamcrest.BaseDescription;' > conftest.java
13394     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
13395         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
13396     else
13397         AC_MSG_RESULT([Not included])
13398         AC_MSG_CHECKING([for standalone hamcrest jar.])
13399         if test "$with_hamcrest" = "yes"; then
13400             if test -e /usr/share/lib/java/hamcrest.jar; then
13401                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
13402             elif test -e /usr/share/java/hamcrest/core.jar; then
13403                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
13404             else
13405                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
13406             fi
13407         else
13408             HAMCREST_JAR=$with_hamcrest
13409         fi
13410         if test "$_os" = "WINNT"; then
13411             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
13412         fi
13413         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
13414             AC_MSG_RESULT([$HAMCREST_JAR])
13415         else
13416             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),
13417                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
13418         fi
13419     fi
13420     rm -f conftest.class conftest.java
13422 AC_SUBST(OOO_JUNIT_JAR)
13423 AC_SUBST(HAMCREST_JAR)
13426 AC_SUBST(SCPDEFS)
13429 # check for wget and curl
13431 WGET=
13432 CURL=
13434 if test "$enable_fetch_external" != "no"; then
13436 CURL=`which curl 2>/dev/null`
13438 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
13439     # wget new enough?
13440     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
13441     if test $? -eq 0; then
13442         WGET=$i
13443         break
13444     fi
13445 done
13447 if test -z "$WGET" -a -z "$CURL"; then
13448     AC_MSG_ERROR([neither wget nor curl found!])
13453 AC_SUBST(WGET)
13454 AC_SUBST(CURL)
13457 # check for sha256sum
13459 SHA256SUM=
13461 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
13462     eval "$i -a 256 --version" > /dev/null 2>&1
13463     ret=$?
13464     if test $ret -eq 0; then
13465         SHA256SUM="$i -a 256"
13466         break
13467     fi
13468 done
13470 if test -z "$SHA256SUM"; then
13471     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
13472         eval "$i --version" > /dev/null 2>&1
13473         ret=$?
13474         if test $ret -eq 0; then
13475             SHA256SUM=$i
13476             break
13477         fi
13478     done
13481 if test -z "$SHA256SUM"; then
13482     AC_MSG_ERROR([no sha256sum found!])
13485 AC_SUBST(SHA256SUM)
13487 dnl ===================================================================
13488 dnl Dealing with l10n options
13489 dnl ===================================================================
13490 AC_MSG_CHECKING([which languages to be built])
13491 # get list of all languages
13492 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
13493 # the sed command does the following:
13494 #   + if a line ends with a backslash, append the next line to it
13495 #   + adds " on the beginning of the value (after =)
13496 #   + adds " at the end of the value
13497 #   + removes en-US; we want to put it on the beginning
13498 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
13499 [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)]
13500 ALL_LANGS="en-US $completelangiso"
13501 # check the configured localizations
13502 WITH_LANG="$with_lang"
13504 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
13505 # (Norwegian is "nb" and "nn".)
13506 if test "$WITH_LANG" = "no"; then
13507     WITH_LANG=
13510 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
13511     AC_MSG_RESULT([en-US])
13512 else
13513     AC_MSG_RESULT([$WITH_LANG])
13514     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
13515     if test -z "$MSGFMT"; then
13516         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
13517             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
13518         elif test -x "/opt/lo/bin/msgfmt"; then
13519             MSGFMT="/opt/lo/bin/msgfmt"
13520         else
13521             AC_CHECK_PROGS(MSGFMT, [msgfmt])
13522             if test -z "$MSGFMT"; then
13523                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
13524             fi
13525         fi
13526     fi
13527     if test -z "$MSGUNIQ"; then
13528         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
13529             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
13530         elif test -x "/opt/lo/bin/msguniq"; then
13531             MSGUNIQ="/opt/lo/bin/msguniq"
13532         else
13533             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
13534             if test -z "$MSGUNIQ"; then
13535                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
13536             fi
13537         fi
13538     fi
13540 AC_SUBST(MSGFMT)
13541 AC_SUBST(MSGUNIQ)
13542 # check that the list is valid
13543 for lang in $WITH_LANG; do
13544     test "$lang" = "ALL" && continue
13545     # need to check for the exact string, so add space before and after the list of all languages
13546     for vl in $ALL_LANGS; do
13547         if test "$vl" = "$lang"; then
13548            break
13549         fi
13550     done
13551     if test "$vl" != "$lang"; then
13552         # if you're reading this - you prolly quoted your languages remove the quotes ...
13553         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
13554     fi
13555 done
13556 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
13557     echo $WITH_LANG | grep -q en-US
13558     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
13560 # list with substituted ALL
13561 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
13562 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
13563 test "$WITH_LANG" = "en-US" && WITH_LANG=
13564 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
13565     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
13566     ALL_LANGS=`echo $ALL_LANGS qtz`
13568 AC_SUBST(ALL_LANGS)
13569 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
13570 AC_SUBST(WITH_LANG)
13571 AC_SUBST(WITH_LANG_LIST)
13572 AC_SUBST(GIT_NEEDED_SUBMODULES)
13574 WITH_POOR_HELP_LOCALIZATIONS=
13575 if test -d "$SRC_ROOT/translations/source"; then
13576     for l in `ls -1 $SRC_ROOT/translations/source`; do
13577         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
13578             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
13579         fi
13580     done
13582 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
13584 if test -n "$with_locales"; then
13585     WITH_LOCALES="$with_locales"
13587     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
13588     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
13589     # config_host/config_locales.h.in
13590     for locale in $WITH_LOCALES; do
13591         lang=${locale%_*}
13593         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
13595         case $lang in
13596         hi|mr*ne)
13597             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
13598             ;;
13599         bg|ru)
13600             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
13601             ;;
13602         esac
13603     done
13604 else
13605     AC_DEFINE(WITH_LOCALE_ALL)
13607 AC_SUBST(WITH_LOCALES)
13609 dnl git submodule update --reference
13610 dnl ===================================================================
13611 if test -n "${GIT_REFERENCE_SRC}"; then
13612     for repo in ${GIT_NEEDED_SUBMODULES}; do
13613         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
13614             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
13615         fi
13616     done
13618 AC_SUBST(GIT_REFERENCE_SRC)
13620 dnl git submodules linked dirs
13621 dnl ===================================================================
13622 if test -n "${GIT_LINK_SRC}"; then
13623     for repo in ${GIT_NEEDED_SUBMODULES}; do
13624         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
13625             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
13626         fi
13627     done
13629 AC_SUBST(GIT_LINK_SRC)
13631 dnl branding
13632 dnl ===================================================================
13633 AC_MSG_CHECKING([for alternative branding images directory])
13634 # initialize mapped arrays
13635 BRAND_INTRO_IMAGES="intro.png intro-highres.png"
13636 brand_files="$BRAND_INTRO_IMAGES logo.svg logo_inverted.svg logo-sc.svg logo-sc_inverted.svg about.svg"
13638 if test -z "$with_branding" -o "$with_branding" = "no"; then
13639     AC_MSG_RESULT([none])
13640     DEFAULT_BRAND_IMAGES="$brand_files"
13641 else
13642     if ! test -d $with_branding ; then
13643         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
13644     else
13645         AC_MSG_RESULT([$with_branding])
13646         CUSTOM_BRAND_DIR="$with_branding"
13647         for lfile in $brand_files
13648         do
13649             if ! test -f $with_branding/$lfile ; then
13650                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
13651                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
13652             else
13653                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
13654             fi
13655         done
13656         check_for_progress="yes"
13657     fi
13659 AC_SUBST([BRAND_INTRO_IMAGES])
13660 AC_SUBST([CUSTOM_BRAND_DIR])
13661 AC_SUBST([CUSTOM_BRAND_IMAGES])
13662 AC_SUBST([DEFAULT_BRAND_IMAGES])
13665 AC_MSG_CHECKING([for 'intro' progress settings])
13666 PROGRESSBARCOLOR=
13667 PROGRESSSIZE=
13668 PROGRESSPOSITION=
13669 PROGRESSFRAMECOLOR=
13670 PROGRESSTEXTCOLOR=
13671 PROGRESSTEXTBASELINE=
13673 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
13674     source "$with_branding/progress.conf"
13675     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
13676 else
13677     AC_MSG_RESULT([none])
13680 AC_SUBST(PROGRESSBARCOLOR)
13681 AC_SUBST(PROGRESSSIZE)
13682 AC_SUBST(PROGRESSPOSITION)
13683 AC_SUBST(PROGRESSFRAMECOLOR)
13684 AC_SUBST(PROGRESSTEXTCOLOR)
13685 AC_SUBST(PROGRESSTEXTBASELINE)
13688 dnl ===================================================================
13689 dnl Custom build version
13690 dnl ===================================================================
13691 AC_MSG_CHECKING([for extra build ID])
13692 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
13693     EXTRA_BUILDID="$with_extra_buildid"
13695 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
13696 if test -n "$EXTRA_BUILDID" ; then
13697     AC_MSG_RESULT([$EXTRA_BUILDID])
13698 else
13699     AC_MSG_RESULT([not set])
13701 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
13703 OOO_VENDOR=
13704 AC_MSG_CHECKING([for vendor])
13705 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
13706     OOO_VENDOR="$USERNAME"
13708     if test -z "$OOO_VENDOR"; then
13709         OOO_VENDOR="$USER"
13710     fi
13712     if test -z "$OOO_VENDOR"; then
13713         OOO_VENDOR="`id -u -n`"
13714     fi
13716     AC_MSG_RESULT([not set, using $OOO_VENDOR])
13717 else
13718     OOO_VENDOR="$with_vendor"
13719     AC_MSG_RESULT([$OOO_VENDOR])
13721 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
13722 AC_SUBST(OOO_VENDOR)
13724 if test "$_os" = "Android" ; then
13725     ANDROID_PACKAGE_NAME=
13726     AC_MSG_CHECKING([for Android package name])
13727     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
13728         if test -n "$ENABLE_DEBUG"; then
13729             # Default to the package name that makes ndk-gdb happy.
13730             ANDROID_PACKAGE_NAME="org.libreoffice"
13731         else
13732             ANDROID_PACKAGE_NAME="org.example.libreoffice"
13733         fi
13735         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
13736     else
13737         ANDROID_PACKAGE_NAME="$with_android_package_name"
13738         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
13739     fi
13740     AC_SUBST(ANDROID_PACKAGE_NAME)
13743 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
13744 if test "$with_compat_oowrappers" = "yes"; then
13745     WITH_COMPAT_OOWRAPPERS=TRUE
13746     AC_MSG_RESULT(yes)
13747 else
13748     WITH_COMPAT_OOWRAPPERS=
13749     AC_MSG_RESULT(no)
13751 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
13753 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
13754 AC_MSG_CHECKING([for install dirname])
13755 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
13756     INSTALLDIRNAME="$with_install_dirname"
13758 AC_MSG_RESULT([$INSTALLDIRNAME])
13759 AC_SUBST(INSTALLDIRNAME)
13761 AC_MSG_CHECKING([for prefix])
13762 test "x$prefix" = xNONE && prefix=$ac_default_prefix
13763 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
13764 PREFIXDIR="$prefix"
13765 AC_MSG_RESULT([$PREFIXDIR])
13766 AC_SUBST(PREFIXDIR)
13768 LIBDIR=[$(eval echo $(eval echo $libdir))]
13769 AC_SUBST(LIBDIR)
13771 DATADIR=[$(eval echo $(eval echo $datadir))]
13772 AC_SUBST(DATADIR)
13774 MANDIR=[$(eval echo $(eval echo $mandir))]
13775 AC_SUBST(MANDIR)
13777 DOCDIR=[$(eval echo $(eval echo $docdir))]
13778 AC_SUBST(DOCDIR)
13780 BINDIR=[$(eval echo $(eval echo $bindir))]
13781 AC_SUBST(BINDIR)
13783 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
13784 AC_SUBST(INSTALLDIR)
13786 TESTINSTALLDIR="${BUILDDIR}/test-install"
13787 AC_SUBST(TESTINSTALLDIR)
13790 # ===================================================================
13791 # OAuth2 id and secrets
13792 # ===================================================================
13794 AC_MSG_CHECKING([for Google Drive client id and secret])
13795 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
13796     AC_MSG_RESULT([not set])
13797     GDRIVE_CLIENT_ID="\"\""
13798     GDRIVE_CLIENT_SECRET="\"\""
13799 else
13800     AC_MSG_RESULT([set])
13801     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
13802     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
13804 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
13805 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
13807 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
13808 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
13809     AC_MSG_RESULT([not set])
13810     ALFRESCO_CLOUD_CLIENT_ID="\"\""
13811     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
13812 else
13813     AC_MSG_RESULT([set])
13814     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
13815     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
13817 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
13818 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
13820 AC_MSG_CHECKING([for OneDrive client id and secret])
13821 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
13822     AC_MSG_RESULT([not set])
13823     ONEDRIVE_CLIENT_ID="\"\""
13824     ONEDRIVE_CLIENT_SECRET="\"\""
13825 else
13826     AC_MSG_RESULT([set])
13827     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
13828     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
13830 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
13831 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
13834 dnl ===================================================================
13835 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
13836 dnl --enable-dependency-tracking configure option
13837 dnl ===================================================================
13838 AC_MSG_CHECKING([whether to enable dependency tracking])
13839 if test "$enable_dependency_tracking" = "no"; then
13840     nodep=TRUE
13841     AC_MSG_RESULT([no])
13842 else
13843     AC_MSG_RESULT([yes])
13845 AC_SUBST(nodep)
13847 dnl ===================================================================
13848 dnl Number of CPUs to use during the build
13849 dnl ===================================================================
13850 AC_MSG_CHECKING([for number of processors to use])
13851 # plain --with-parallelism is just the default
13852 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
13853     if test "$with_parallelism" = "no"; then
13854         PARALLELISM=0
13855     else
13856         PARALLELISM=$with_parallelism
13857     fi
13858 else
13859     if test "$enable_icecream" = "yes"; then
13860         PARALLELISM="40"
13861     else
13862         case `uname -s` in
13864         Darwin|FreeBSD|NetBSD|OpenBSD)
13865             PARALLELISM=`sysctl -n hw.ncpu`
13866             ;;
13868         Linux)
13869             PARALLELISM=`getconf _NPROCESSORS_ONLN`
13870         ;;
13871         # what else than above does profit here *and* has /proc?
13872         *)
13873             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
13874             ;;
13875         esac
13877         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
13878         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
13879     fi
13882 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
13883     if test -z "$with_parallelism"; then
13884             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
13885             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
13886             PARALLELISM="1"
13887     else
13888         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."
13889     fi
13892 if test $PARALLELISM -eq 0; then
13893     AC_MSG_RESULT([explicit make -j option needed])
13894 else
13895     AC_MSG_RESULT([$PARALLELISM])
13897 AC_SUBST(PARALLELISM)
13899 IWYU_PATH="$with_iwyu"
13900 AC_SUBST(IWYU_PATH)
13901 if test ! -z "$IWYU_PATH"; then
13902     if test ! -f "$IWYU_PATH"; then
13903         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
13904     fi
13908 # Set up ILIB for MSVC build
13910 ILIB1=
13911 if test "$build_os" = "cygwin"; then
13912     ILIB="."
13913     if test -n "$JAVA_HOME"; then
13914         ILIB="$ILIB;$JAVA_HOME/lib"
13915     fi
13916     ILIB1=-link
13917     ILIB="$ILIB;$COMPATH/lib/$WIN_HOST_ARCH"
13918     ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/$WIN_HOST_ARCH"
13919     ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
13920     ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
13921     if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
13922         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
13923         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
13924     fi
13925     PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/$WIN_HOST_ARCH"
13926     ucrtlibpath_formatted=$formatted_path
13927     ILIB="$ILIB;$ucrtlibpath_formatted"
13928     ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
13929     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
13930         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
13931     else
13932         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WIN_HOST_ARCH"
13933     fi
13935     if test "$cross_compiling" != "yes"; then
13936         ILIB_FOR_BUILD="$ILIB"
13937     fi
13939 AC_SUBST(ILIB)
13940 AC_SUBST(ILIB_FOR_BUILD)
13942 # ===================================================================
13943 # Creating bigger shared library to link against
13944 # ===================================================================
13945 AC_MSG_CHECKING([whether to create huge library])
13946 MERGELIBS=
13948 if test $_os = iOS -o $_os = Android; then
13949     # Never any point in mergelibs for these as we build just static
13950     # libraries anyway...
13951     enable_mergelibs=no
13954 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
13955     if test $_os != Linux -a $_os != WINNT; then
13956         add_warning "--enable-mergelibs is not tested for this platform"
13957     fi
13958     MERGELIBS="TRUE"
13959     AC_MSG_RESULT([yes])
13960     AC_DEFINE(ENABLE_MERGELIBS)
13961 else
13962     AC_MSG_RESULT([no])
13964 AC_SUBST([MERGELIBS])
13966 dnl ===================================================================
13967 dnl icerun is a wrapper that stops us spawning tens of processes
13968 dnl locally - for tools that can't be executed on the compile cluster
13969 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
13970 dnl ===================================================================
13971 AC_MSG_CHECKING([whether to use icerun wrapper])
13972 ICECREAM_RUN=
13973 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
13974     ICECREAM_RUN=icerun
13975     AC_MSG_RESULT([yes])
13976 else
13977     AC_MSG_RESULT([no])
13979 AC_SUBST(ICECREAM_RUN)
13981 dnl ===================================================================
13982 dnl Setup the ICECC_VERSION for the build the same way it was set for
13983 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
13984 dnl ===================================================================
13985 x_ICECC_VERSION=[\#]
13986 if test -n "$ICECC_VERSION" ; then
13987     x_ICECC_VERSION=
13989 AC_SUBST(x_ICECC_VERSION)
13990 AC_SUBST(ICECC_VERSION)
13992 dnl ===================================================================
13994 AC_MSG_CHECKING([MPL subset])
13995 MPL_SUBSET=
13997 if test "$enable_mpl_subset" = "yes"; then
13998     warn_report=false
13999     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
14000         warn_report=true
14001     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
14002         warn_report=true
14003     fi
14004     if test "$warn_report" = "true"; then
14005         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
14006     fi
14007     if test "x$enable_postgresql_sdbc" != "xno"; then
14008         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
14009     fi
14010     if test "$enable_lotuswordpro" = "yes"; then
14011         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
14012     fi
14013     if test "$WITH_WEBDAV" = "neon"; then
14014         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
14015     fi
14016     if test -n "$ENABLE_POPPLER"; then
14017         if test "x$SYSTEM_POPPLER" = "x"; then
14018             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
14019         fi
14020     fi
14021     # cf. m4/libo_check_extension.m4
14022     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
14023         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
14024     fi
14025     for theme in $WITH_THEMES; do
14026         case $theme in
14027         breeze|breeze_dark|breeze_dark_svg|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #denylist of icon themes under GPL or LGPL
14028             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=colibre]) ;;
14029         *) : ;;
14030         esac
14031     done
14033     ENABLE_OPENGL_TRANSITIONS=
14035     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
14036         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
14037     fi
14039     MPL_SUBSET="TRUE"
14040     AC_DEFINE(MPL_HAVE_SUBSET)
14041     AC_MSG_RESULT([only])
14042 else
14043     AC_MSG_RESULT([no restrictions])
14045 AC_SUBST(MPL_SUBSET)
14047 dnl ===================================================================
14049 AC_MSG_CHECKING([formula logger])
14050 ENABLE_FORMULA_LOGGER=
14052 if test "x$enable_formula_logger" = "xyes"; then
14053     AC_MSG_RESULT([yes])
14054     AC_DEFINE(ENABLE_FORMULA_LOGGER)
14055     ENABLE_FORMULA_LOGGER=TRUE
14056 elif test -n "$ENABLE_DBGUTIL" ; then
14057     AC_MSG_RESULT([yes])
14058     AC_DEFINE(ENABLE_FORMULA_LOGGER)
14059     ENABLE_FORMULA_LOGGER=TRUE
14060 else
14061     AC_MSG_RESULT([no])
14064 AC_SUBST(ENABLE_FORMULA_LOGGER)
14066 dnl ===================================================================
14067 dnl Checking for active Antivirus software.
14068 dnl ===================================================================
14070 if test $_os = WINNT -a -f "$SRC_ROOT/antivirusDetection.vbs" ; then
14071     AC_MSG_CHECKING([for active Antivirus software])
14072     ANTIVIRUS_LIST=`cscript.exe //Nologo $SRC_ROOT/antivirusDetection.vbs`
14073     if [ [ "$ANTIVIRUS_LIST" != "NULL" ] ]; then
14074         if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then
14075             AC_MSG_RESULT([found])
14076             EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
14077             echo $EICAR_STRING > $SRC_ROOT/eicar
14078             EICAR_TEMP_FILE_CONTENTS=`cat $SRC_ROOT/eicar`
14079             rm $SRC_ROOT/eicar
14080             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
14081                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
14082             fi
14083             echo $EICAR_STRING > $BUILDDIR/eicar
14084             EICAR_TEMP_FILE_CONTENTS=`cat $BUILDDIR/eicar`
14085             rm $BUILDDIR/eicar
14086             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
14087                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
14088             fi
14089             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"
14090         else
14091             AC_MSG_RESULT([not found])
14092         fi
14093     else
14094         AC_MSG_RESULT([n/a])
14095     fi
14098 dnl ===================================================================
14099 dnl Setting up the environment.
14100 dnl ===================================================================
14101 AC_MSG_NOTICE([setting up the build environment variables...])
14103 AC_SUBST(COMPATH)
14105 if test "$build_os" = "cygwin"; then
14106     if test -d "$COMPATH/atlmfc/lib/spectre"; then
14107         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
14108         ATL_INCLUDE="$COMPATH/atlmfc/include"
14109     elif test -d "$COMPATH/atlmfc/lib"; then
14110         ATL_LIB="$COMPATH/atlmfc/lib"
14111         ATL_INCLUDE="$COMPATH/atlmfc/include"
14112     else
14113         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
14114         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
14115     fi
14116     ATL_LIB="$ATL_LIB/$WIN_HOST_ARCH"
14117     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
14118     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
14120     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
14121     PathFormat "/usr/bin/find.exe"
14122     FIND="$formatted_path"
14123     PathFormat "/usr/bin/sort.exe"
14124     SORT="$formatted_path"
14125     PathFormat "/usr/bin/grep.exe"
14126     WIN_GREP="$formatted_path"
14127     PathFormat "/usr/bin/ls.exe"
14128     WIN_LS="$formatted_path"
14129     PathFormat "/usr/bin/touch.exe"
14130     WIN_TOUCH="$formatted_path"
14131 else
14132     FIND=find
14133     SORT=sort
14136 AC_SUBST(ATL_INCLUDE)
14137 AC_SUBST(ATL_LIB)
14138 AC_SUBST(FIND)
14139 AC_SUBST(SORT)
14140 AC_SUBST(WIN_GREP)
14141 AC_SUBST(WIN_LS)
14142 AC_SUBST(WIN_TOUCH)
14144 AC_SUBST(BUILD_TYPE)
14146 AC_SUBST(SOLARINC)
14148 PathFormat "$PERL"
14149 PERL="$formatted_path"
14150 AC_SUBST(PERL)
14152 if test -n "$TMPDIR"; then
14153     TEMP_DIRECTORY="$TMPDIR"
14154 else
14155     TEMP_DIRECTORY="/tmp"
14157 if test "$build_os" = "cygwin"; then
14158     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
14160 AC_SUBST(TEMP_DIRECTORY)
14162 # setup the PATH for the environment
14163 if test -n "$LO_PATH_FOR_BUILD"; then
14164     LO_PATH="$LO_PATH_FOR_BUILD"
14165     case "$host_os" in
14166     cygwin*|wsl*)
14167         pathmunge "$MSVC_HOST_PATH" "before"
14168         ;;
14169     esac
14170 else
14171     LO_PATH="$PATH"
14173     case "$host_os" in
14175     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
14176         if test "$ENABLE_JAVA" != ""; then
14177             pathmunge "$JAVA_HOME/bin" "after"
14178         fi
14179         ;;
14181     cygwin*|wsl*)
14182         # Win32 make needs native paths
14183         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
14184             LO_PATH=`cygpath -p -m "$PATH"`
14185         fi
14186         if test "$WIN_BUILD_ARCH" = "x64"; then
14187             # needed for msi packaging
14188             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
14189         fi
14190         # .NET 4.6 and higher don't have bin directory
14191         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
14192             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
14193         fi
14194         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
14195         pathmunge "$CSC_PATH" "before"
14196         pathmunge "$MIDL_PATH" "before"
14197         pathmunge "$AL_PATH" "before"
14198         pathmunge "$MSVC_MULTI_PATH" "before"
14199         pathmunge "$MSVC_BUILD_PATH" "before"
14200         if test -n "$MSBUILD_PATH" ; then
14201             pathmunge "$MSBUILD_PATH" "before"
14202         fi
14203         pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/$WIN_BUILD_ARCH" "before"
14204         if test "$ENABLE_JAVA" != ""; then
14205             if test -d "$JAVA_HOME/jre/bin/client"; then
14206                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
14207             fi
14208             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
14209                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
14210             fi
14211             pathmunge "$JAVA_HOME/bin" "before"
14212         fi
14213         pathmunge "$MSVC_HOST_PATH" "before"
14214         ;;
14216     solaris*)
14217         pathmunge "/usr/css/bin" "before"
14218         if test "$ENABLE_JAVA" != ""; then
14219             pathmunge "$JAVA_HOME/bin" "after"
14220         fi
14221         ;;
14222     esac
14225 AC_SUBST(LO_PATH)
14227 # Allow to pass LO_ELFCHECK_ALLOWLIST from autogen.input to bin/check-elf-dynamic-objects:
14228 if test "$LO_ELFCHECK_ALLOWLIST" = x || test "${LO_ELFCHECK_ALLOWLIST-x}" != x; then
14229     x_LO_ELFCHECK_ALLOWLIST=
14230 else
14231     x_LO_ELFCHECK_ALLOWLIST=[\#]
14233 AC_SUBST(x_LO_ELFCHECK_ALLOWLIST)
14234 AC_SUBST(LO_ELFCHECK_ALLOWLIST)
14236 libo_FUZZ_SUMMARY
14238 # Generate a configuration sha256 we can use for deps
14239 if test -f config_host.mk; then
14240     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
14242 if test -f config_host_lang.mk; then
14243     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
14246 CFLAGS=$my_original_CFLAGS
14247 CXXFLAGS=$my_original_CXXFLAGS
14248 CPPFLAGS=$my_original_CPPFLAGS
14250 AC_CONFIG_LINKS([include:include])
14252 # Keep in sync with list of files far up, at AC_MSG_CHECKING([for
14253 # BUILD platform configuration] - otherwise breaks cross building
14254 AC_CONFIG_FILES([config_host.mk
14255                  config_host_lang.mk
14256                  Makefile
14257                  bin/bffvalidator.sh
14258                  bin/odfvalidator.sh
14259                  bin/officeotron.sh
14260                  hardened_runtime.xcent
14261                  instsetoo_native/util/openoffice.lst
14262                  sysui/desktop/macosx/Info.plist
14263                  vs-code-template.code-workspace:.vscode/vs-code-template.code-workspace.in])
14264 AC_CONFIG_HEADERS([config_host/config_buildid.h])
14265 AC_CONFIG_HEADERS([config_host/config_box2d.h])
14266 AC_CONFIG_HEADERS([config_host/config_clang.h])
14267 AC_CONFIG_HEADERS([config_host/config_dconf.h])
14268 AC_CONFIG_HEADERS([config_host/config_eot.h])
14269 AC_CONFIG_HEADERS([config_host/config_extensions.h])
14270 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
14271 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
14272 AC_CONFIG_HEADERS([config_host/config_dbus.h])
14273 AC_CONFIG_HEADERS([config_host/config_features.h])
14274 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
14275 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
14276 AC_CONFIG_HEADERS([config_host/config_firebird.h])
14277 AC_CONFIG_HEADERS([config_host/config_folders.h])
14278 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
14279 AC_CONFIG_HEADERS([config_host/config_gio.h])
14280 AC_CONFIG_HEADERS([config_host/config_global.h])
14281 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
14282 AC_CONFIG_HEADERS([config_host/config_java.h])
14283 AC_CONFIG_HEADERS([config_host/config_langs.h])
14284 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
14285 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
14286 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
14287 AC_CONFIG_HEADERS([config_host/config_locales.h])
14288 AC_CONFIG_HEADERS([config_host/config_mpl.h])
14289 AC_CONFIG_HEADERS([config_host/config_oox.h])
14290 AC_CONFIG_HEADERS([config_host/config_options.h])
14291 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
14292 AC_CONFIG_HEADERS([config_host/config_zxing.h])
14293 AC_CONFIG_HEADERS([config_host/config_skia.h])
14294 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
14295 AC_CONFIG_HEADERS([config_host/config_vendor.h])
14296 AC_CONFIG_HEADERS([config_host/config_vcl.h])
14297 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
14298 AC_CONFIG_HEADERS([config_host/config_version.h])
14299 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
14300 AC_CONFIG_HEADERS([config_host/config_poppler.h])
14301 AC_CONFIG_HEADERS([config_host/config_python.h])
14302 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
14303 AC_OUTPUT
14305 if test "$CROSS_COMPILING" = TRUE; then
14306     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
14309 # touch the config timestamp file
14310 if test ! -f config_host.mk.stamp; then
14311     echo > config_host.mk.stamp
14312 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
14313     echo "Host Configuration unchanged - avoiding scp2 stamp update"
14314 else
14315     echo > config_host.mk.stamp
14318 # touch the config lang timestamp file
14319 if test ! -f config_host_lang.mk.stamp; then
14320     echo > config_host_lang.mk.stamp
14321 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
14322     echo "Language Configuration unchanged - avoiding scp2 stamp update"
14323 else
14324     echo > config_host_lang.mk.stamp
14328 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
14329         -a "$build_os" = "cygwin"; then
14331 cat << _EOS
14332 ****************************************************************************
14333 WARNING:
14334 Your make version is known to be horribly slow, and hard to debug
14335 problems with. To get a reasonably functional make please do:
14337 to install a pre-compiled binary make for Win32
14339  mkdir -p /opt/lo/bin
14340  cd /opt/lo/bin
14341  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
14342  cp make-4.2.1-msvc.exe make
14343  chmod +x make
14345 to install from source:
14346 place yourself in a working directory of you choice.
14348  git clone git://git.savannah.gnu.org/make.git
14350  [go to Start menu, open "Visual Studio 2019", click "x86 Native Tools Command Prompt" or "x64 Native Tools Command Prompt"]
14351  set PATH=%PATH%;C:\Cygwin\bin
14352  [or Cygwin64, if that is what you have]
14353  cd path-to-make-repo-you-cloned-above
14354  build_w32.bat --without-guile
14356 should result in a WinRel/gnumake.exe.
14357 Copy it to the Cygwin /opt/lo/bin directory as make.exe
14359 Then re-run autogen.sh
14361 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
14362 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
14364 _EOS
14365 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
14366     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
14371 cat << _EOF
14372 ****************************************************************************
14374 To build, run:
14375 $GNUMAKE
14377 To view some help, run:
14378 $GNUMAKE help
14380 _EOF
14382 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
14383     cat << _EOF
14384 After the build has finished successfully, you can immediately run what you built using the command:
14385 _EOF
14387     if test $_os = Darwin; then
14388         echo open instdir/$PRODUCTNAME_WITHOUT_SPACES.app
14389     else
14390         echo instdir/program/soffice
14391     fi
14392     cat << _EOF
14394 If you want to run the smoketest, run:
14395 $GNUMAKE check
14397 _EOF
14400 if test -f warn; then
14401     cat warn
14402     rm warn
14405 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: