Fix typo
[LibreOffice.git] / configure.ac
blobae6fc04fb5d239c1794856be33002974a1f5c58c
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.alpha0+],[],[],[http://documentfoundation.org/])
14 dnl libnumbertext needs autoconf 2.68, but that can pick up autoconf268 just fine if it is installed
15 dnl whereas aclocal (as run by autogen.sh) insists on using autoconf and fails hard
16 dnl so check for the version of autoconf that is actually used to create the configure script
17 AC_PREREQ([2.59])
18 m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.68]), -1,
19     [AC_MSG_ERROR([at least autoconf version 2.68 is needed (you can use AUTOCONF environment variable to point to a suitable one)])])
21 if test -n "$BUILD_TYPE"; then
22     AC_MSG_ERROR([You have sourced config_host.mk in this shell.  This may lead to trouble, please run in a fresh (login) shell.])
25 save_CC=$CC
26 save_CXX=$CXX
28 first_arg_basename()
30     for i in $1; do
31         basename "$i"
32         break
33     done
36 CC_BASE=`first_arg_basename "$CC"`
37 CXX_BASE=`first_arg_basename "$CXX"`
39 BUILD_TYPE="LibO"
40 SCPDEFS=""
41 GIT_NEEDED_SUBMODULES=""
42 LO_PATH= # used by path_munge to construct a PATH variable
44 FilterLibs()
46     # Return value: $filteredlibs
48     filteredlibs=
49     for f in $1; do
50         case "$f" in
51             # let's start with Fedora's paths for now
52             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
53                 # ignore it: on UNIXoids it is searched by default anyway
54                 # but if it's given explicitly then it may override other paths
55                 # (on macOS it would be an error to use it instead of SDK)
56                 ;;
57             *)
58                 filteredlibs="$filteredlibs $f"
59                 ;;
60         esac
61     done
64 PathFormat()
66     # Args: $1: A pathname. On Cygwin and WSL, in either the Unix or the Windows format. Note that this
67     # function is called also on Unix.
68     #
69     # Return value: $formatted_path and $formatted_path_unix.
70     #
71     # $formatted_path is the argument in Windows format, but using forward slashes instead of
72     # backslashes, using 8.3 pathname components if necessary (if it otherwise would contains spaces
73     # or shell metacharacters).
74     #
75     # $formatted_path_unix is the argument in a form usable in Cygwin or WSL, using 8.3 components if
76     # necessary. On Cygwin, it is the same as $formatted_path, but on WSL it is $formatted_path as a
77     # Unix pathname.
78     #
79     # Errors out if 8.3 names are needed but aren't present for some of the path components.
81     # Examples:
82     #
83     # /home/tml/lo/master-optimised => C:/cygwin64/home/tml/lo/master-optimised
84     #
85     # C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe => C:/PROGRA~2/MICROS~3/INSTAL~1/vswhere.exe
86     #
87     # C:\Program Files (x86)\Microsoft Visual Studio\2019\Community => C:/PROGRA~2/MICROS~3/2019/COMMUN~1
88     #
89     # C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/ucrt => C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/ucrt
90     #
91     # /cygdrive/c/PROGRA~2/WI3CF2~1/10 => C:/PROGRA~2/WI3CF2~1/10
92     #
93     # C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\ => C:/PROGRA~2/WI3CF2~1/NETFXSDK/4.8/
94     #
95     # /usr/bin/find.exe => C:/cygwin64/bin/find.exe
97     if test -n "$UNITTEST_WSL_PATHFORMAT"; then
98         printf "PathFormat $1 ==> "
99     fi
101     formatted_path="$1"
102     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
103         if test "$build_os" = "wsl"; then
104             formatted_path=$(echo "$formatted_path" | tr -d '\r')
105         fi
107         pf_conv_to_dos=
108         # spaces,parentheses,brackets,braces are problematic in pathname
109         # so are backslashes
110         case "$formatted_path" in
111             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
112                 pf_conv_to_dos="yes"
113             ;;
114         esac
115         if test "$pf_conv_to_dos" = "yes"; then
116             if test "$build_os" = "wsl"; then
117                 case "$formatted_path" in
118                     /*)
119                         formatted_path=$(wslpath -w "$formatted_path")
120                         ;;
121                 esac
122                 formatted_path=$($BUILDDIR/solenv/wsl/wsl-lo-helper.exe --8.3 "$formatted_path")
123             elif test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
124                 formatted_path=`cygpath -sm "$formatted_path"`
125             else
126                 formatted_path=`cygpath -d "$formatted_path"`
127             fi
128             if test $? -ne 0;  then
129                 AC_MSG_ERROR([path conversion failed for "$1".])
130             fi
131         fi
132         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
133         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
134         if test "$fp_count_slash$fp_count_colon" != "00"; then
135             if test "$fp_count_colon" = "0"; then
136                 new_formatted_path=`realpath "$formatted_path"`
137                 if test $? -ne 0;  then
138                     AC_MSG_WARN([realpath failed for "$formatted_path", not necessarily a problem.])
139                 else
140                     formatted_path="$new_formatted_path"
141                 fi
142             fi
143             if test "$build_os" = "wsl"; then
144                 if test "$fp_count_colon" != "0"; then
145                     formatted_path=$(wslpath "$formatted_path")
146                     local final_slash=
147                     case "$formatted_path" in
148                         */)
149                             final_slash=/
150                             ;;
151                     esac
152                     formatted_path=$(wslpath -m $formatted_path)
153                     case "$formatted_path" in
154                         */)
155                             ;;
156                         *)
157                             formatted_path="$formatted_path"$final_slash
158                             ;;
159                     esac
160                 else
161                     formatted_path=$(wslpath -m "$formatted_path")
162                 fi
163             else
164                 formatted_path=`cygpath -m "$formatted_path"`
165             fi
166             if test $? -ne 0;  then
167                 AC_MSG_ERROR([path conversion failed for "$1".])
168             fi
169         fi
170         fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
171         if test "$fp_count_space" != "0"; then
172             AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
173         fi
174     fi
175     if test "$build_os" = "wsl"; then
176         # WSL can't run Windows binaries from Windows pathnames so we need a separate return value in Unix format
177         formatted_path_unix=$(wslpath "$formatted_path")
178     else
179         # But Cygwin can
180         formatted_path_unix="$formatted_path"
181     fi
184 AbsolutePath()
186     # There appears to be no simple and portable method to get an absolute and
187     # canonical path, so we try creating the directory if does not exist and
188     # utilizing the shell and pwd.
190     # Args: $1: A possibly relative pathname
191     # Return value: $absolute_path
193     local rel="$1"
194     absolute_path=""
195     test ! -e "$rel" && mkdir -p "$rel"
196     if test -d "$rel" ; then
197         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
198         absolute_path="$(pwd)"
199         cd - > /dev/null
200     else
201         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
202     fi
205 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_randr=yes
808 test_xrender=yes
809 test_cups=yes
810 test_dbus=yes
811 test_fontconfig=yes
812 test_cairo=no
813 test_gdb_index=no
814 test_split_debug=no
816 # Default values, as such probably valid just for Linux, set
817 # differently below just for Mac OSX, but at least better than
818 # hardcoding these as we used to do. Much of this is duplicated also
819 # in solenv for old build system and for gbuild, ideally we should
820 # perhaps define stuff like this only here in configure.ac?
822 LINKFLAGSSHL="-shared"
823 PICSWITCH="-fpic"
824 DLLPOST=".so"
826 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
828 INSTROOTBASESUFFIX=
829 INSTROOTCONTENTSUFFIX=
830 SDKDIRNAME=sdk
832 HOST_PLATFORM="$host"
834 host_cpu_for_clang="$host_cpu"
836 case "$host_os" in
838 solaris*)
839     build_gstreamer_1_0=yes
840     test_freetype=yes
841     build_skia=yes
842     _os=SunOS
844     dnl ===========================================================
845     dnl Check whether we're using Solaris 10 - SPARC or Intel.
846     dnl ===========================================================
847     AC_MSG_CHECKING([the Solaris operating system release])
848     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
849     if test "$_os_release" -lt "10"; then
850         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
851     else
852         AC_MSG_RESULT([ok ($_os_release)])
853     fi
855     dnl Check whether we're using a SPARC or i386 processor
856     AC_MSG_CHECKING([the processor type])
857     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
858         AC_MSG_RESULT([ok ($host_cpu)])
859     else
860         AC_MSG_ERROR([only SPARC and i386 processors are supported])
861     fi
862     ;;
864 linux-gnu*|k*bsd*-gnu*)
865     build_gstreamer_1_0=yes
866     test_kf5=yes
867     test_gtk3_kde5=yes
868     build_skia=yes
869     test_gdb_index=yes
870     test_split_debug=yes
871     if test "$enable_fuzzers" != yes; then
872         test_freetype=yes
873         test_fontconfig=yes
874     else
875         test_freetype=no
876         test_fontconfig=no
877         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
878     fi
879     _os=Linux
880     ;;
882 gnu)
883     test_randr=no
884     test_xrender=no
885     _os=GNU
886      ;;
888 cygwin*|wsl*)
890     # When building on Windows normally with MSVC under Cygwin,
891     # configure thinks that the host platform (the platform the
892     # built code will run on) is Cygwin, even if it obviously is
893     # Windows, which in Autoconf terminology is called
894     # "mingw32". (Which is misleading as MinGW is the name of the
895     # tool-chain, not an operating system.)
897     # Somewhat confusing, yes. But this configure script doesn't
898     # look at $host etc that much, it mostly uses its own $_os
899     # variable, set here in this case statement.
901     test_cups=no
902     test_dbus=no
903     test_randr=no
904     test_xrender=no
905     test_freetype=no
906     test_fontconfig=no
907     build_skia=yes
908     _os=WINNT
910     DLLPOST=".dll"
911     LINKFLAGSNOUNDEFS=
913     if test "$host_cpu" = "aarch64"; then
914         enable_gpgmepp=no
915         enable_coinmp=no
916         enable_firebird_sdbc=no
917     fi
918     ;;
920 darwin*|macos*) # macOS
921     test_randr=no
922     test_xrender=no
923     test_freetype=no
924     test_fontconfig=no
925     test_dbus=no
926     if test -n "$LODE_HOME" ; then
927         mac_sanitize_path
928         AC_MSG_NOTICE([sanitized the PATH to $PATH])
929     fi
930     _os=Darwin
931     INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
932     INSTROOTCONTENTSUFFIX=/Contents
933     SDKDIRNAME=${PRODUCTNAME_WITHOUT_SPACES}${PRODUCTVERSION}_SDK
934     # See comment above the case "$host_os"
935     LINKFLAGSSHL="-dynamiclib -single_module"
937     # -fPIC is default
938     PICSWITCH=""
940     DLLPOST=".dylib"
942     # -undefined error is the default
943     LINKFLAGSNOUNDEFS=""
944     case "$host_cpu" in
945     aarch64|arm64)
946         case "$host_os" in
947         macos*)
948             # HOST_PLATFORM is used for external projects and their configury occasionally doesn't like
949             # the "macos" part so be sure to use aarch64-apple-darwin for now.
950             HOST_PLATFORM=aarch64-apple-darwin
951             ;;
952         esac
954         # Apple's Clang uses "arm64"
955         host_cpu_for_clang=arm64
956     esac
959 ios*) # iOS
960     test_randr=no
961     test_xrender=no
962     test_freetype=no
963     test_fontconfig=no
964     test_dbus=no
965     if test -n "$LODE_HOME" ; then
966         mac_sanitize_path
967         AC_MSG_NOTICE([sanitized the PATH to $PATH])
968     fi
969     enable_gpgmepp=no
970     _os=iOS
971     test_cups=no
972     enable_mpl_subset=yes
973     enable_lotuswordpro=no
974     enable_coinmp=no
975     enable_lpsolve=no
976     enable_mariadb_sdbc=no
977     enable_postgresql_sdbc=no
978     enable_extension_integration=no
979     enable_report_builder=no
980     with_ppds=no
981     if test "$enable_ios_simulator" = "yes"; then
982         host=x86_64-apple-darwin
983     fi
984     # See comment above the case "$host_os"
985     LINKFLAGSSHL="-dynamiclib -single_module"
987     # -fPIC is default
988     PICSWITCH=""
990     DLLPOST=".dylib"
992     # -undefined error is the default
993     LINKFLAGSNOUNDEFS=""
995     # HOST_PLATFORM is used for external projects and their configury typically doesn't like the "ios"
996     # part, so use aarch64-apple-darwin for now.
997     HOST_PLATFORM=aarch64-apple-darwin
999     # Apple's Clang uses "arm64"
1000     host_cpu_for_clang=arm64
1003 freebsd*)
1004     build_gstreamer_1_0=yes
1005     test_kf5=yes
1006     test_gtk3_kde5=yes
1007     test_freetype=yes
1008     build_skia=yes
1009     AC_MSG_CHECKING([the FreeBSD operating system release])
1010     if test -n "$with_os_version"; then
1011         OSVERSION="$with_os_version"
1012     else
1013         OSVERSION=`/sbin/sysctl -n kern.osreldate`
1014     fi
1015     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
1016     AC_MSG_CHECKING([which thread library to use])
1017     if test "$OSVERSION" -lt "500016"; then
1018         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1019         PTHREAD_LIBS="-pthread"
1020     elif test "$OSVERSION" -lt "502102"; then
1021         PTHREAD_CFLAGS="-D_THREAD_SAFE"
1022         PTHREAD_LIBS="-lc_r"
1023     else
1024         PTHREAD_CFLAGS=""
1025         PTHREAD_LIBS="-pthread"
1026     fi
1027     AC_MSG_RESULT([$PTHREAD_LIBS])
1028     _os=FreeBSD
1029     ;;
1031 *netbsd*)
1032     build_gstreamer_1_0=yes
1033     test_kf5=yes
1034     test_gtk3_kde5=yes
1035     test_freetype=yes
1036     build_skia=yes
1037     PTHREAD_LIBS="-pthread -lpthread"
1038     _os=NetBSD
1039     ;;
1041 aix*)
1042     test_randr=no
1043     test_freetype=yes
1044     PTHREAD_LIBS=-pthread
1045     _os=AIX
1046     ;;
1048 openbsd*)
1049     test_freetype=yes
1050     PTHREAD_CFLAGS="-D_THREAD_SAFE"
1051     PTHREAD_LIBS="-pthread"
1052     _os=OpenBSD
1053     ;;
1055 dragonfly*)
1056     build_gstreamer_1_0=yes
1057     test_kf5=yes
1058     test_gtk3_kde5=yes
1059     test_freetype=yes
1060     build_skia=yes
1061     PTHREAD_LIBS="-pthread"
1062     _os=DragonFly
1063     ;;
1065 linux-android*)
1066     build_gstreamer_1_0=no
1067     enable_lotuswordpro=no
1068     enable_mpl_subset=yes
1069     enable_coinmp=yes
1070     enable_lpsolve=no
1071     enable_mariadb_sdbc=no
1072     enable_report_builder=no
1073     enable_odk=no
1074     enable_postgresql_sdbc=no
1075     enable_python=no
1076     test_cups=no
1077     test_dbus=no
1078     test_fontconfig=no
1079     test_freetype=no
1080     test_kf5=no
1081     test_qt5=no
1082     test_gtk3_kde5=no
1083     test_randr=no
1084     test_xrender=no
1085     _os=Android
1087     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
1088     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
1089     ;;
1091 haiku*)
1092     test_cups=no
1093     test_dbus=no
1094     test_randr=no
1095     test_xrender=no
1096     test_freetype=yes
1097     enable_odk=no
1098     enable_gstreamer_1_0=no
1099     enable_coinmp=no
1100     enable_pdfium=no
1101     enable_sdremote=no
1102     enable_postgresql_sdbc=no
1103     enable_firebird_sdbc=no
1104     _os=Haiku
1105     ;;
1108     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
1109     ;;
1110 esac
1112 AC_SUBST(HOST_PLATFORM)
1114 if test "$_os" = "Android" ; then
1115     # Verify that the NDK and SDK options are proper
1116     if test -z "$with_android_ndk"; then
1117         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
1118     elif test ! -f "$ANDROID_NDK_HOME/meta/abis.json"; then
1119         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
1120     fi
1122     if test -z "$ANDROID_SDK_HOME"; then
1123         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
1124     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
1125         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
1126     fi
1128     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
1129     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
1130         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
1131                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
1132                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
1133         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
1134         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
1135         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
1136     fi
1137     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
1138         AC_MSG_WARN([android support repository not found - install with
1139                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
1140                      to allow the build to download the specified version of the android support libraries])
1141         add_warning "android support repository not found - install with"
1142         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
1143         add_warning "to allow the build to download the specified version of the android support libraries"
1144     fi
1147 if test "$_os" = "AIX"; then
1148     AC_PATH_PROG(GAWK, gawk)
1149     if test -z "$GAWK"; then
1150         AC_MSG_ERROR([gawk not found in \$PATH])
1151     fi
1154 AC_SUBST(SDKDIRNAME)
1156 AC_SUBST(PTHREAD_CFLAGS)
1157 AC_SUBST(PTHREAD_LIBS)
1159 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
1160 # By default use the ones specified by our build system,
1161 # but explicit override is possible.
1162 AC_MSG_CHECKING(for explicit AFLAGS)
1163 if test -n "$AFLAGS"; then
1164     AC_MSG_RESULT([$AFLAGS])
1165     x_AFLAGS=
1166 else
1167     AC_MSG_RESULT(no)
1168     x_AFLAGS=[\#]
1170 AC_MSG_CHECKING(for explicit CFLAGS)
1171 if test -n "$CFLAGS"; then
1172     AC_MSG_RESULT([$CFLAGS])
1173     x_CFLAGS=
1174 else
1175     AC_MSG_RESULT(no)
1176     x_CFLAGS=[\#]
1178 AC_MSG_CHECKING(for explicit CXXFLAGS)
1179 if test -n "$CXXFLAGS"; then
1180     AC_MSG_RESULT([$CXXFLAGS])
1181     x_CXXFLAGS=
1182 else
1183     AC_MSG_RESULT(no)
1184     x_CXXFLAGS=[\#]
1186 AC_MSG_CHECKING(for explicit OBJCFLAGS)
1187 if test -n "$OBJCFLAGS"; then
1188     AC_MSG_RESULT([$OBJCFLAGS])
1189     x_OBJCFLAGS=
1190 else
1191     AC_MSG_RESULT(no)
1192     x_OBJCFLAGS=[\#]
1194 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
1195 if test -n "$OBJCXXFLAGS"; then
1196     AC_MSG_RESULT([$OBJCXXFLAGS])
1197     x_OBJCXXFLAGS=
1198 else
1199     AC_MSG_RESULT(no)
1200     x_OBJCXXFLAGS=[\#]
1202 AC_MSG_CHECKING(for explicit LDFLAGS)
1203 if test -n "$LDFLAGS"; then
1204     AC_MSG_RESULT([$LDFLAGS])
1205     x_LDFLAGS=
1206 else
1207     AC_MSG_RESULT(no)
1208     x_LDFLAGS=[\#]
1210 AC_SUBST(AFLAGS)
1211 AC_SUBST(CFLAGS)
1212 AC_SUBST(CXXFLAGS)
1213 AC_SUBST(OBJCFLAGS)
1214 AC_SUBST(OBJCXXFLAGS)
1215 AC_SUBST(LDFLAGS)
1216 AC_SUBST(x_AFLAGS)
1217 AC_SUBST(x_CFLAGS)
1218 AC_SUBST(x_CXXFLAGS)
1219 AC_SUBST(x_OBJCFLAGS)
1220 AC_SUBST(x_OBJCXXFLAGS)
1221 AC_SUBST(x_LDFLAGS)
1223 dnl These are potentially set for MSVC, in the code checking for UCRT below:
1224 my_original_CFLAGS=$CFLAGS
1225 my_original_CXXFLAGS=$CXXFLAGS
1226 my_original_CPPFLAGS=$CPPFLAGS
1228 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
1229 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
1230 dnl AC_PROG_CC internally.
1231 if test "$_os" != "WINNT"; then
1232     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
1233     save_CFLAGS=$CFLAGS
1234     AC_PROG_CC
1235     CFLAGS=$save_CFLAGS
1236     if test -z "$CC_BASE"; then
1237         CC_BASE=`first_arg_basename "$CC"`
1238     fi
1241 if test "$_os" != "WINNT"; then
1242     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
1243 else
1244     ENDIANNESS=little
1246 AC_SUBST(ENDIANNESS)
1248 if test $_os != "WINNT"; then
1249     save_LIBS="$LIBS"
1250     AC_SEARCH_LIBS([dlsym], [dl],
1251         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
1252         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
1253     LIBS="$save_LIBS"
1255 AC_SUBST(DLOPEN_LIBS)
1257 AC_ARG_ENABLE(ios-simulator,
1258     AS_HELP_STRING([--enable-ios-simulator],
1259         [build for iOS simulator])
1262 ###############################################################################
1263 # Extensions switches --enable/--disable
1264 ###############################################################################
1265 # By default these should be enabled unless having extra dependencies.
1266 # If there is extra dependency over configure options then the enable should
1267 # be automagic based on whether the requiring feature is enabled or not.
1268 # All this options change anything only with --enable-extension-integration.
1270 # The name of this option and its help string makes it sound as if
1271 # extensions are built anyway, just not integrated in the installer,
1272 # if you use --disable-extension-integration. Is that really the
1273 # case?
1275 libo_FUZZ_ARG_ENABLE(extension-integration,
1276     AS_HELP_STRING([--disable-extension-integration],
1277         [Disable integration of the built extensions in the installer of the
1278          product. Use this switch to disable the integration.])
1281 AC_ARG_ENABLE(avmedia,
1282     AS_HELP_STRING([--disable-avmedia],
1283         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
1286 AC_ARG_ENABLE(database-connectivity,
1287     AS_HELP_STRING([--disable-database-connectivity],
1288         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
1291 # This doesn't mean not building (or "integrating") extensions
1292 # (although it probably should; i.e. it should imply
1293 # --disable-extension-integration I guess), it means not supporting
1294 # any extension mechanism at all
1295 libo_FUZZ_ARG_ENABLE(extensions,
1296     AS_HELP_STRING([--disable-extensions],
1297         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
1300 AC_ARG_ENABLE(scripting,
1301     AS_HELP_STRING([--disable-scripting],
1302         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1305 # This is mainly for Android and iOS, but could potentially be used in some
1306 # special case otherwise, too, so factored out as a separate setting
1308 AC_ARG_ENABLE(dynamic-loading,
1309     AS_HELP_STRING([--disable-dynamic-loading],
1310         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1313 libo_FUZZ_ARG_ENABLE(report-builder,
1314     AS_HELP_STRING([--disable-report-builder],
1315         [Disable the Report Builder.])
1318 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1319     AS_HELP_STRING([--enable-ext-wiki-publisher],
1320         [Enable the Wiki Publisher extension.])
1323 libo_FUZZ_ARG_ENABLE(lpsolve,
1324     AS_HELP_STRING([--disable-lpsolve],
1325         [Disable compilation of the lp solve solver ])
1327 libo_FUZZ_ARG_ENABLE(coinmp,
1328     AS_HELP_STRING([--disable-coinmp],
1329         [Disable compilation of the CoinMP solver ])
1332 libo_FUZZ_ARG_ENABLE(pdfimport,
1333     AS_HELP_STRING([--disable-pdfimport],
1334         [Disable building the PDF import feature.])
1337 libo_FUZZ_ARG_ENABLE(pdfium,
1338     AS_HELP_STRING([--disable-pdfium],
1339         [Disable building PDFium. Results in unsecure PDF signature verification.])
1342 libo_FUZZ_ARG_ENABLE(skia,
1343     AS_HELP_STRING([--disable-skia],
1344         [Disable building Skia. Use --enable-skia=debug to build without optimizations.])
1347 ###############################################################################
1349 dnl ---------- *** ----------
1351 libo_FUZZ_ARG_ENABLE(mergelibs,
1352     AS_HELP_STRING([--enable-mergelibs],
1353         [Merge several of the smaller libraries into one big, "merged", one.])
1356 libo_FUZZ_ARG_ENABLE(breakpad,
1357     AS_HELP_STRING([--enable-breakpad],
1358         [Enables breakpad for crash reporting.])
1361 libo_FUZZ_ARG_ENABLE(crashdump,
1362     AS_HELP_STRING([--disable-crashdump],
1363         [Disable dump.ini and dump-file, when --enable-breakpad])
1366 AC_ARG_ENABLE(fetch-external,
1367     AS_HELP_STRING([--disable-fetch-external],
1368         [Disables fetching external tarballs from web sources.])
1371 AC_ARG_ENABLE(fuzzers,
1372     AS_HELP_STRING([--enable-fuzzers],
1373         [Enables building libfuzzer targets for fuzz testing.])
1376 libo_FUZZ_ARG_ENABLE(pch,
1377     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1378         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1379          Using 'system' will include only external headers, 'base' will add also headers
1380          from base modules, 'normal' will also add all headers except from the module built,
1381          'full' will use all suitable headers even from a module itself.])
1384 libo_FUZZ_ARG_ENABLE(epm,
1385     AS_HELP_STRING([--enable-epm],
1386         [LibreOffice includes self-packaging code, that requires epm, however epm is
1387          useless for large scale package building.])
1390 libo_FUZZ_ARG_ENABLE(odk,
1391     AS_HELP_STRING([--disable-odk],
1392         [LibreOffice includes an ODK, office development kit which some packagers may
1393          wish to build without.])
1396 AC_ARG_ENABLE(mpl-subset,
1397     AS_HELP_STRING([--enable-mpl-subset],
1398         [Don't compile any pieces which are not MPL or more liberally licensed])
1401 libo_FUZZ_ARG_ENABLE(evolution2,
1402     AS_HELP_STRING([--enable-evolution2],
1403         [Allows the built-in evolution 2 addressbook connectivity build to be
1404          enabled.])
1407 AC_ARG_ENABLE(avahi,
1408     AS_HELP_STRING([--enable-avahi],
1409         [Determines whether to use Avahi to advertise Impress to remote controls.])
1412 libo_FUZZ_ARG_ENABLE(werror,
1413     AS_HELP_STRING([--enable-werror],
1414         [Turn warnings to errors. (Has no effect in modules where the treating
1415          of warnings as errors is disabled explicitly.)]),
1418 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1419     AS_HELP_STRING([--enable-assert-always-abort],
1420         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1423 libo_FUZZ_ARG_ENABLE(dbgutil,
1424     AS_HELP_STRING([--enable-dbgutil],
1425         [Provide debugging support from --enable-debug and include additional debugging
1426          utilities such as object counting or more expensive checks.
1427          This is the recommended option for developers.
1428          Note that this makes the build ABI incompatible, it is not possible to mix object
1429          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1431 libo_FUZZ_ARG_ENABLE(debug,
1432     AS_HELP_STRING([--enable-debug],
1433         [Include debugging information, disable compiler optimization and inlining plus
1434          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1436 libo_FUZZ_ARG_ENABLE(split-debug,
1437     AS_HELP_STRING([--disable-split-debug],
1438         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1439          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1441 libo_FUZZ_ARG_ENABLE(gdb-index,
1442     AS_HELP_STRING([--disable-gdb-index],
1443         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1444          The feature requires the gold or lld linker.]))
1446 libo_FUZZ_ARG_ENABLE(sal-log,
1447     AS_HELP_STRING([--enable-sal-log],
1448         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1450 libo_FUZZ_ARG_ENABLE(symbols,
1451     AS_HELP_STRING([--enable-symbols],
1452         [Generate debug information.
1453          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1454          otherwise. It is possible to explicitly specify gbuild build targets
1455          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1456          everything in the directory; there is no ordering, more specific overrides
1457          more general, and disabling takes precedence).
1458          Example: --enable-symbols="all -sw/ -Library_sc".]))
1460 libo_FUZZ_ARG_ENABLE(optimized,
1461     AS_HELP_STRING([--enable-optimized=<yes/no/debug>],
1462         [Whether to compile with optimization flags.
1463          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1464          otherwise. Using 'debug' will try to use only optimizations that should
1465          not interfere with debugging.]))
1467 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1468     AS_HELP_STRING([--disable-runtime-optimizations],
1469         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1470          JVM JIT) that are known to interact badly with certain dynamic analysis
1471          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1472          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1473          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1475 AC_ARG_WITH(valgrind,
1476     AS_HELP_STRING([--with-valgrind],
1477         [Make availability of Valgrind headers a hard requirement.]))
1479 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1480     AS_HELP_STRING([--enable-compiler-plugins],
1481         [Enable compiler plugins that will perform additional checks during
1482          building. Enabled automatically by --enable-dbgutil.
1483          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1484 COMPILER_PLUGINS_DEBUG=
1485 if test "$enable_compiler_plugins" = debug; then
1486     enable_compiler_plugins=yes
1487     COMPILER_PLUGINS_DEBUG=TRUE
1490 libo_FUZZ_ARG_ENABLE(compiler-plugins-analyzer-pch,
1491     AS_HELP_STRING([--disable-compiler-plugins-analyzer-pch],
1492         [Disable use of precompiled headers when running the Clang compiler plugin analyzer.  Not
1493          relevant in the --disable-compiler-plugins case.]))
1495 libo_FUZZ_ARG_ENABLE(ooenv,
1496     AS_HELP_STRING([--enable-ooenv],
1497         [Enable ooenv for the instdir installation.]))
1499 AC_ARG_ENABLE(lto,
1500     AS_HELP_STRING([--enable-lto],
1501         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1502          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1503          linker. For MSVC, this option is broken at the moment. This is experimental work
1504          in progress that shouldn't be used unless you are working on it.)]))
1506 AC_ARG_ENABLE(python,
1507     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1508         [Enables or disables Python support at run-time.
1509          Also specifies what Python to use at build-time.
1510          'fully-internal' even forces the internal version for uses of Python
1511          during the build.
1512          On macOS the only choices are
1513          'internal' (default) or 'fully-internal'. Otherwise the default is 'auto'.
1514          ]))
1516 libo_FUZZ_ARG_ENABLE(gtk3,
1517     AS_HELP_STRING([--disable-gtk3],
1518         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1519 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1521 AC_ARG_ENABLE(introspection,
1522     AS_HELP_STRING([--enable-introspection],
1523         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1524          Linux distributions.)]))
1526 AC_ARG_ENABLE(split-app-modules,
1527     AS_HELP_STRING([--enable-split-app-modules],
1528         [Split file lists for app modules, e.g. base, calc.
1529          Has effect only with make distro-pack-install]),
1532 AC_ARG_ENABLE(split-opt-features,
1533     AS_HELP_STRING([--enable-split-opt-features],
1534         [Split file lists for some optional features, e.g. pyuno, testtool.
1535          Has effect only with make distro-pack-install]),
1538 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1539     AS_HELP_STRING([--disable-cairo-canvas],
1540         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1543 libo_FUZZ_ARG_ENABLE(dbus,
1544     AS_HELP_STRING([--disable-dbus],
1545         [Determines whether to enable features that depend on dbus.
1546          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1547 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1549 libo_FUZZ_ARG_ENABLE(sdremote,
1550     AS_HELP_STRING([--disable-sdremote],
1551         [Determines whether to enable Impress remote control (i.e. the server component).]),
1552 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1554 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1555     AS_HELP_STRING([--disable-sdremote-bluetooth],
1556         [Determines whether to build sdremote with bluetooth support.
1557          Requires dbus on Linux.]))
1559 libo_FUZZ_ARG_ENABLE(gio,
1560     AS_HELP_STRING([--disable-gio],
1561         [Determines whether to use the GIO support.]),
1562 ,test "${enable_gio+set}" = set || enable_gio=yes)
1564 AC_ARG_ENABLE(qt5,
1565     AS_HELP_STRING([--enable-qt5],
1566         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1567          available.]),
1570 AC_ARG_ENABLE(kf5,
1571     AS_HELP_STRING([--enable-kf5],
1572         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1573          KF5 are available.]),
1576 AC_ARG_ENABLE(kde5,
1577     AS_HELP_STRING([--enable-kde5],
1578         [Compatibility switch for the kde5 => kf5 rename. Use --enable-kf5!])
1581 AC_ARG_ENABLE(gtk3_kde5,
1582     AS_HELP_STRING([--enable-gtk3-kde5],
1583         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1584          platforms where Gtk3, Qt5 and Plasma is available.]),
1587 AC_ARG_ENABLE(gui,
1588     AS_HELP_STRING([--disable-gui],
1589         [Disable use of X11 or Wayland to reduce dependencies (e.g. for building LibreOfficeKit).]),
1590 ,enable_gui=yes)
1592 libo_FUZZ_ARG_ENABLE(randr,
1593     AS_HELP_STRING([--disable-randr],
1594         [Disable RandR support in the vcl project.]),
1595 ,test "${enable_randr+set}" = set || enable_randr=yes)
1597 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1598     AS_HELP_STRING([--disable-gstreamer-1-0],
1599         [Disable building with the gstreamer 1.0 avmedia backend.]),
1600 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1602 libo_FUZZ_ARG_ENABLE(neon,
1603     AS_HELP_STRING([--disable-neon],
1604         [Disable neon and the compilation of webdav binding.]),
1607 libo_FUZZ_ARG_ENABLE([eot],
1608     [AS_HELP_STRING([--enable-eot],
1609         [Enable support for Embedded OpenType fonts.])],
1610 ,test "${enable_eot+set}" = set || enable_eot=no)
1612 libo_FUZZ_ARG_ENABLE(cve-tests,
1613     AS_HELP_STRING([--disable-cve-tests],
1614         [Prevent CVE tests to be executed]),
1617 libo_FUZZ_ARG_ENABLE(chart-tests,
1618     AS_HELP_STRING([--enable-chart-tests],
1619         [Executes chart XShape tests. In a perfect world these tests would be
1620          stable and everyone could run them, in reality it is best to run them
1621          only on a few machines that are known to work and maintained by people
1622          who can judge if a test failure is a regression or not.]),
1625 AC_ARG_ENABLE(build-opensymbol,
1626     AS_HELP_STRING([--enable-build-opensymbol],
1627         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1628          fontforge installed.]),
1631 AC_ARG_ENABLE(dependency-tracking,
1632     AS_HELP_STRING([--enable-dependency-tracking],
1633         [Do not reject slow dependency extractors.])[
1634   --disable-dependency-tracking
1635                           Disables generation of dependency information.
1636                           Speed up one-time builds.],
1639 AC_ARG_ENABLE(icecream,
1640     AS_HELP_STRING([--enable-icecream],
1641         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1642          It defaults to /opt/icecream for the location of the icecream gcc/g++
1643          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1646 AC_ARG_ENABLE(ld,
1647     AS_HELP_STRING([--enable-ld=<linker>],
1648         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1649          By default tries to use the best linker possible, use --disable-ld to use the default linker.
1650          If <linker> contains any ':', the part before the first ':' is used as the value of
1651          -fuse-ld, while the part after the first ':' is used as the value of --ld-path (which is
1652          needed for Clang 12).]),
1655 libo_FUZZ_ARG_ENABLE(cups,
1656     AS_HELP_STRING([--disable-cups],
1657         [Do not build cups support.])
1660 AC_ARG_ENABLE(ccache,
1661     AS_HELP_STRING([--disable-ccache],
1662         [Do not try to use ccache automatically.
1663          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1664          CC/CXX are not yet set, and --enable-icecream is not given, we
1665          attempt to use ccache. --disable-ccache disables ccache completely.
1666          Additionally ccache's depend mode is enabled if possible,
1667          use --enable-ccache=nodepend to enable ccache without depend mode.
1671 libo_FUZZ_ARG_ENABLE(online-update,
1672     AS_HELP_STRING([--enable-online-update],
1673         [Enable the online update service that will check for new versions of
1674          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1675          If the value is "mar", the experimental Mozilla-like update will be
1676          enabled instead of the traditional update mechanism.]),
1679 AC_ARG_WITH(update-config,
1680     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1681                    [Path to the update config ini file]))
1683 libo_FUZZ_ARG_ENABLE(extension-update,
1684     AS_HELP_STRING([--disable-extension-update],
1685         [Disable possibility to update installed extensions.]),
1688 libo_FUZZ_ARG_ENABLE(release-build,
1689     AS_HELP_STRING([--enable-release-build],
1690         [Enable release build. Note that the "release build" choice is orthogonal to
1691          whether symbols are present, debug info is generated, or optimization
1692          is done.
1693          See http://wiki.documentfoundation.org/Development/DevBuild]),
1696 AC_ARG_ENABLE(windows-build-signing,
1697     AS_HELP_STRING([--enable-windows-build-signing],
1698         [Enable signing of windows binaries (*.exe, *.dll)]),
1701 AC_ARG_ENABLE(silent-msi,
1702     AS_HELP_STRING([--enable-silent-msi],
1703         [Enable MSI with LIMITUI=1 (silent install).]),
1706 AC_ARG_ENABLE(macosx-code-signing,
1707     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1708         [Sign executables, dylibs, frameworks and the app bundle. If you
1709          don't provide an identity the first suitable certificate
1710          in your keychain is used.]),
1713 AC_ARG_ENABLE(macosx-package-signing,
1714     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1715         [Create a .pkg suitable for uploading to the Mac App Store and sign
1716          it. If you don't provide an identity the first suitable certificate
1717          in your keychain is used.]),
1720 AC_ARG_ENABLE(macosx-sandbox,
1721     AS_HELP_STRING([--enable-macosx-sandbox],
1722         [Make the app bundle run in a sandbox. Requires code signing.
1723          Is required by apps distributed in the Mac App Store, and implies
1724          adherence to App Store rules.]),
1727 AC_ARG_WITH(macosx-bundle-identifier,
1728     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1729         [Define the macOS bundle identifier. Default is the somewhat weird
1730          org.libreoffice.script ("script", huh?).]),
1731 ,with_macosx_bundle_identifier=org.libreoffice.script)
1733 AC_ARG_WITH(product-name,
1734     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1735         [Define the product name. Default is AC_PACKAGE_NAME.]),
1736 ,with_product_name=$PRODUCTNAME)
1738 libo_FUZZ_ARG_ENABLE(community-flavor,
1739     AS_HELP_STRING([--disable-community-flavor],
1740         [Disable the Community branding.]),
1743 AC_ARG_WITH(package-version,
1744     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1745         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1748 libo_FUZZ_ARG_ENABLE(readonly-installset,
1749     AS_HELP_STRING([--enable-readonly-installset],
1750         [Prevents any attempts by LibreOffice to write into its installation. That means
1751          at least that no "system-wide" extensions can be added. Partly experimental work in
1752          progress, probably not fully implemented. Always enabled for macOS.]),
1755 libo_FUZZ_ARG_ENABLE(mariadb-sdbc,
1756     AS_HELP_STRING([--disable-mariadb-sdbc],
1757         [Disable the build of the MariaDB/MySQL-SDBC driver.])
1760 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1761     AS_HELP_STRING([--disable-postgresql-sdbc],
1762         [Disable the build of the PostgreSQL-SDBC driver.])
1765 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1766     AS_HELP_STRING([--disable-lotuswordpro],
1767         [Disable the build of the Lotus Word Pro filter.]),
1768 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1770 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1771     AS_HELP_STRING([--disable-firebird-sdbc],
1772         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1773 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1775 AC_ARG_ENABLE(bogus-pkg-config,
1776     AS_HELP_STRING([--enable-bogus-pkg-config],
1777         [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.]),
1780 AC_ARG_ENABLE(openssl,
1781     AS_HELP_STRING([--disable-openssl],
1782         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1783          components will either use GNUTLS or NSS. Work in progress,
1784          use only if you are hacking on it.]),
1785 ,enable_openssl=yes)
1787 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1788     AS_HELP_STRING([--enable-cipher-openssl-backend],
1789         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1790          Requires --enable-openssl.]))
1792 AC_ARG_ENABLE(library-bin-tar,
1793     AS_HELP_STRING([--enable-library-bin-tar],
1794         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1795         Some libraries can save their build result in a tarball
1796         stored in TARFILE_LOCATION. That binary tarball is
1797         uniquely identified by the source tarball,
1798         the content of the config_host.mk file and the content
1799         of the top-level directory in core for that library
1800         If this option is enabled, then if such a tarfile exist, it will be untarred
1801         instead of the source tarfile, and the build step will be skipped for that
1802         library.
1803         If a proper tarfile does not exist, then the normal source-based
1804         build is done for that library and a proper binary tarfile is created
1805         for the next time.]),
1808 AC_ARG_ENABLE(dconf,
1809     AS_HELP_STRING([--disable-dconf],
1810         [Disable the dconf configuration backend (enabled by default where
1811          available).]))
1813 libo_FUZZ_ARG_ENABLE(formula-logger,
1814     AS_HELP_STRING(
1815         [--enable-formula-logger],
1816         [Enable formula logger for logging formula calculation flow in Calc.]
1817     )
1820 AC_ARG_ENABLE(ldap,
1821     AS_HELP_STRING([--disable-ldap],
1822         [Disable LDAP support.]),
1823 ,enable_ldap=yes)
1825 AC_ARG_ENABLE(opencl,
1826     AS_HELP_STRING([--disable-opencl],
1827         [Disable OpenCL support.]),
1828 ,enable_opencl=yes)
1830 libo_FUZZ_ARG_ENABLE(librelogo,
1831     AS_HELP_STRING([--disable-librelogo],
1832         [Do not build LibreLogo.]),
1833 ,enable_librelogo=yes)
1835 dnl ===================================================================
1836 dnl Optional Packages (--with/without-)
1837 dnl ===================================================================
1839 AC_ARG_WITH(gcc-home,
1840     AS_HELP_STRING([--with-gcc-home],
1841         [Specify the location of gcc/g++ manually. This can be used in conjunction
1842          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1843          non-default path.]),
1846 AC_ARG_WITH(gnu-patch,
1847     AS_HELP_STRING([--with-gnu-patch],
1848         [Specify location of GNU patch on Solaris or FreeBSD.]),
1851 AC_ARG_WITH(build-platform-configure-options,
1852     AS_HELP_STRING([--with-build-platform-configure-options],
1853         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1856 AC_ARG_WITH(gnu-cp,
1857     AS_HELP_STRING([--with-gnu-cp],
1858         [Specify location of GNU cp on Solaris or FreeBSD.]),
1861 AC_ARG_WITH(external-tar,
1862     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1863         [Specify an absolute path of where to find (and store) tarfiles.]),
1864     TARFILE_LOCATION=$withval ,
1867 AC_ARG_WITH(referenced-git,
1868     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1869         [Specify another checkout directory to reference. This makes use of
1870                  git submodule update --reference, and saves a lot of diskspace
1871                  when having multiple trees side-by-side.]),
1872     GIT_REFERENCE_SRC=$withval ,
1875 AC_ARG_WITH(linked-git,
1876     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1877         [Specify a directory where the repositories of submodules are located.
1878          This uses a method similar to git-new-workdir to get submodules.]),
1879     GIT_LINK_SRC=$withval ,
1882 AC_ARG_WITH(galleries,
1883     AS_HELP_STRING([--with-galleries],
1884         [Specify how galleries should be built. It is possible either to
1885          build these internally from source ("build"),
1886          or to disable them ("no")]),
1889 AC_ARG_WITH(theme,
1890     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1891         [Choose which themes to include. By default those themes with an '*' are included.
1892          Possible choices: *breeze, *breeze_dark, *breeze_dark_svg, *breeze_svg, *colibre, *colibre_svg, *elementary,
1893          *elementary_svg, *karasa_jaga, *karasa_jaga_svg, *sifr, *sifr_dark, *sifr_dark_svg, *sifr_svg, *sukapura, *sukapura_svg.]),
1896 libo_FUZZ_ARG_WITH(helppack-integration,
1897     AS_HELP_STRING([--without-helppack-integration],
1898         [It will not integrate the helppacks to the installer
1899          of the product. Please use this switch to use the online help
1900          or separate help packages.]),
1903 libo_FUZZ_ARG_WITH(fonts,
1904     AS_HELP_STRING([--without-fonts],
1905         [LibreOffice includes some third-party fonts to provide a reliable basis for
1906          help content, templates, samples, etc. When these fonts are already
1907          known to be available on the system then you should use this option.]),
1910 AC_ARG_WITH(epm,
1911     AS_HELP_STRING([--with-epm],
1912         [Decides which epm to use. Default is to use the one from the system if
1913          one is built. When either this is not there or you say =internal epm
1914          will be built.]),
1917 AC_ARG_WITH(package-format,
1918     AS_HELP_STRING([--with-package-format],
1919         [Specify package format(s) for LibreOffice installation sets. The
1920          implicit --without-package-format leads to no installation sets being
1921          generated. Possible values: aix, archive, bsd, deb, dmg,
1922          installed, msi, pkg, and rpm.
1923          Example: --with-package-format='deb rpm']),
1926 AC_ARG_WITH(tls,
1927     AS_HELP_STRING([--with-tls],
1928         [Decides which TLS/SSL and cryptographic implementations to use for
1929          LibreOffice's code. Notice that this doesn't apply for depending
1930          libraries like "neon", for example. Default is to use NSS
1931          although OpenSSL is also possible. Notice that selecting NSS restricts
1932          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1933          restrict by now the usage of NSS in LO's code. Possible values:
1934          openssl, nss. Example: --with-tls="nss"]),
1937 AC_ARG_WITH(system-libs,
1938     AS_HELP_STRING([--with-system-libs],
1939         [Use libraries already on system -- enables all --with-system-* flags.]),
1942 AC_ARG_WITH(system-bzip2,
1943     AS_HELP_STRING([--with-system-bzip2],
1944         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1945     [with_system_bzip2="$with_system_libs"])
1947 AC_ARG_WITH(system-headers,
1948     AS_HELP_STRING([--with-system-headers],
1949         [Use headers already on system -- enables all --with-system-* flags for
1950          external packages whose headers are the only entities used i.e.
1951          boost/odbc/sane-header(s).]),,
1952     [with_system_headers="$with_system_libs"])
1954 AC_ARG_WITH(system-jars,
1955     AS_HELP_STRING([--without-system-jars],
1956         [When building with --with-system-libs, also the needed jars are expected
1957          on the system. Use this to disable that]),,
1958     [with_system_jars="$with_system_libs"])
1960 AC_ARG_WITH(system-cairo,
1961     AS_HELP_STRING([--with-system-cairo],
1962         [Use cairo libraries already on system.  Happens automatically for
1963          (implicit) --enable-gtk3.]))
1965 AC_ARG_WITH(system-epoxy,
1966     AS_HELP_STRING([--with-system-epoxy],
1967         [Use epoxy libraries already on system.  Happens automatically for
1968          (implicit) --enable-gtk3.]),,
1969        [with_system_epoxy="$with_system_libs"])
1971 AC_ARG_WITH(myspell-dicts,
1972     AS_HELP_STRING([--with-myspell-dicts],
1973         [Adds myspell dictionaries to the LibreOffice installation set]),
1976 AC_ARG_WITH(system-dicts,
1977     AS_HELP_STRING([--without-system-dicts],
1978         [Do not use dictionaries from system paths.]),
1981 AC_ARG_WITH(external-dict-dir,
1982     AS_HELP_STRING([--with-external-dict-dir],
1983         [Specify external dictionary dir.]),
1986 AC_ARG_WITH(external-hyph-dir,
1987     AS_HELP_STRING([--with-external-hyph-dir],
1988         [Specify external hyphenation pattern dir.]),
1991 AC_ARG_WITH(external-thes-dir,
1992     AS_HELP_STRING([--with-external-thes-dir],
1993         [Specify external thesaurus dir.]),
1996 AC_ARG_WITH(system-zlib,
1997     AS_HELP_STRING([--with-system-zlib],
1998         [Use zlib already on system.]),,
1999     [with_system_zlib=auto])
2001 AC_ARG_WITH(system-jpeg,
2002     AS_HELP_STRING([--with-system-jpeg],
2003         [Use jpeg already on system.]),,
2004     [with_system_jpeg="$with_system_libs"])
2006 AC_ARG_WITH(system-clucene,
2007     AS_HELP_STRING([--with-system-clucene],
2008         [Use clucene already on system.]),,
2009     [with_system_clucene="$with_system_libs"])
2011 AC_ARG_WITH(system-expat,
2012     AS_HELP_STRING([--with-system-expat],
2013         [Use expat already on system.]),,
2014     [with_system_expat="$with_system_libs"])
2016 AC_ARG_WITH(system-libxml,
2017     AS_HELP_STRING([--with-system-libxml],
2018         [Use libxml/libxslt already on system.]),,
2019     [with_system_libxml=auto])
2021 AC_ARG_WITH(system-icu,
2022     AS_HELP_STRING([--with-system-icu],
2023         [Use icu already on system.]),,
2024     [with_system_icu="$with_system_libs"])
2026 AC_ARG_WITH(system-ucpp,
2027     AS_HELP_STRING([--with-system-ucpp],
2028         [Use ucpp already on system.]),,
2029     [])
2031 AC_ARG_WITH(system-openldap,
2032     AS_HELP_STRING([--with-system-openldap],
2033         [Use the OpenLDAP LDAP SDK already on system.]),,
2034     [with_system_openldap="$with_system_libs"])
2036 libo_FUZZ_ARG_ENABLE(poppler,
2037     AS_HELP_STRING([--disable-poppler],
2038         [Disable building Poppler.])
2041 AC_ARG_WITH(system-poppler,
2042     AS_HELP_STRING([--with-system-poppler],
2043         [Use system poppler (only needed for PDF import).]),,
2044     [with_system_poppler="$with_system_libs"])
2046 libo_FUZZ_ARG_ENABLE(gpgmepp,
2047     AS_HELP_STRING([--disable-gpgmepp],
2048         [Disable building gpgmepp. Do not use in normal cases unless you want to fix potential problems it causes.])
2051 AC_ARG_WITH(system-gpgmepp,
2052     AS_HELP_STRING([--with-system-gpgmepp],
2053         [Use gpgmepp already on system]),,
2054     [with_system_gpgmepp="$with_system_libs"])
2056 AC_ARG_WITH(system-mariadb,
2057     AS_HELP_STRING([--with-system-mariadb],
2058         [Use MariaDB/MySQL libraries already on system.]),,
2059     [with_system_mariadb="$with_system_libs"])
2061 AC_ARG_ENABLE(bundle-mariadb,
2062     AS_HELP_STRING([--enable-bundle-mariadb],
2063         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
2066 AC_ARG_WITH(system-postgresql,
2067     AS_HELP_STRING([--with-system-postgresql],
2068         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
2069          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
2070     [with_system_postgresql="$with_system_libs"])
2072 AC_ARG_WITH(libpq-path,
2073     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
2074         [Use this PostgreSQL C interface (libpq) installation for building
2075          the PostgreSQL-SDBC extension.]),
2078 AC_ARG_WITH(system-firebird,
2079     AS_HELP_STRING([--with-system-firebird],
2080         [Use Firebird libraries already on system, for building the Firebird-SDBC
2081          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
2082     [with_system_firebird="$with_system_libs"])
2084 AC_ARG_WITH(system-libtommath,
2085             AS_HELP_STRING([--with-system-libtommath],
2086                            [Use libtommath already on system]),,
2087             [with_system_libtommath="$with_system_libs"])
2089 AC_ARG_WITH(system-hsqldb,
2090     AS_HELP_STRING([--with-system-hsqldb],
2091         [Use hsqldb already on system.]))
2093 AC_ARG_WITH(hsqldb-jar,
2094     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
2095         [Specify path to jarfile manually.]),
2096     HSQLDB_JAR=$withval)
2098 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
2099     AS_HELP_STRING([--disable-scripting-beanshell],
2100         [Disable support for scripts in BeanShell.]),
2104 AC_ARG_WITH(system-beanshell,
2105     AS_HELP_STRING([--with-system-beanshell],
2106         [Use beanshell already on system.]),,
2107     [with_system_beanshell="$with_system_jars"])
2109 AC_ARG_WITH(beanshell-jar,
2110     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
2111         [Specify path to jarfile manually.]),
2112     BSH_JAR=$withval)
2114 libo_FUZZ_ARG_ENABLE(scripting-javascript,
2115     AS_HELP_STRING([--disable-scripting-javascript],
2116         [Disable support for scripts in JavaScript.]),
2120 AC_ARG_WITH(system-rhino,
2121     AS_HELP_STRING([--with-system-rhino],
2122         [Use rhino already on system.]),,)
2123 #    [with_system_rhino="$with_system_jars"])
2124 # Above is not used as we have different debug interface
2125 # patched into internal rhino. This code needs to be fixed
2126 # before we can enable it by default.
2128 AC_ARG_WITH(rhino-jar,
2129     AS_HELP_STRING([--with-rhino-jar=JARFILE],
2130         [Specify path to jarfile manually.]),
2131     RHINO_JAR=$withval)
2133 AC_ARG_WITH(system-jfreereport,
2134     AS_HELP_STRING([--with-system-jfreereport],
2135         [Use JFreeReport already on system.]),,
2136     [with_system_jfreereport="$with_system_jars"])
2138 AC_ARG_WITH(sac-jar,
2139     AS_HELP_STRING([--with-sac-jar=JARFILE],
2140         [Specify path to jarfile manually.]),
2141     SAC_JAR=$withval)
2143 AC_ARG_WITH(libxml-jar,
2144     AS_HELP_STRING([--with-libxml-jar=JARFILE],
2145         [Specify path to jarfile manually.]),
2146     LIBXML_JAR=$withval)
2148 AC_ARG_WITH(flute-jar,
2149     AS_HELP_STRING([--with-flute-jar=JARFILE],
2150         [Specify path to jarfile manually.]),
2151     FLUTE_JAR=$withval)
2153 AC_ARG_WITH(jfreereport-jar,
2154     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
2155         [Specify path to jarfile manually.]),
2156     JFREEREPORT_JAR=$withval)
2158 AC_ARG_WITH(liblayout-jar,
2159     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
2160         [Specify path to jarfile manually.]),
2161     LIBLAYOUT_JAR=$withval)
2163 AC_ARG_WITH(libloader-jar,
2164     AS_HELP_STRING([--with-libloader-jar=JARFILE],
2165         [Specify path to jarfile manually.]),
2166     LIBLOADER_JAR=$withval)
2168 AC_ARG_WITH(libformula-jar,
2169     AS_HELP_STRING([--with-libformula-jar=JARFILE],
2170         [Specify path to jarfile manually.]),
2171     LIBFORMULA_JAR=$withval)
2173 AC_ARG_WITH(librepository-jar,
2174     AS_HELP_STRING([--with-librepository-jar=JARFILE],
2175         [Specify path to jarfile manually.]),
2176     LIBREPOSITORY_JAR=$withval)
2178 AC_ARG_WITH(libfonts-jar,
2179     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
2180         [Specify path to jarfile manually.]),
2181     LIBFONTS_JAR=$withval)
2183 AC_ARG_WITH(libserializer-jar,
2184     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
2185         [Specify path to jarfile manually.]),
2186     LIBSERIALIZER_JAR=$withval)
2188 AC_ARG_WITH(libbase-jar,
2189     AS_HELP_STRING([--with-libbase-jar=JARFILE],
2190         [Specify path to jarfile manually.]),
2191     LIBBASE_JAR=$withval)
2193 AC_ARG_WITH(system-odbc,
2194     AS_HELP_STRING([--with-system-odbc],
2195         [Use the odbc headers already on system.]),,
2196     [with_system_odbc="auto"])
2198 AC_ARG_WITH(system-sane,
2199     AS_HELP_STRING([--with-system-sane],
2200         [Use sane.h already on system.]),,
2201     [with_system_sane="$with_system_headers"])
2203 AC_ARG_WITH(system-bluez,
2204     AS_HELP_STRING([--with-system-bluez],
2205         [Use bluetooth.h already on system.]),,
2206     [with_system_bluez="$with_system_headers"])
2208 AC_ARG_WITH(system-curl,
2209     AS_HELP_STRING([--with-system-curl],
2210         [Use curl already on system.]),,
2211     [with_system_curl=auto])
2213 AC_ARG_WITH(system-boost,
2214     AS_HELP_STRING([--with-system-boost],
2215         [Use boost already on system.]),,
2216     [with_system_boost="$with_system_headers"])
2218 AC_ARG_WITH(system-glm,
2219     AS_HELP_STRING([--with-system-glm],
2220         [Use glm already on system.]),,
2221     [with_system_glm="$with_system_headers"])
2223 AC_ARG_WITH(system-hunspell,
2224     AS_HELP_STRING([--with-system-hunspell],
2225         [Use libhunspell already on system.]),,
2226     [with_system_hunspell="$with_system_libs"])
2228 libo_FUZZ_ARG_ENABLE(zxing,
2229     AS_HELP_STRING([--disable-zxing],
2230        [Disable use of zxing external library.]))
2232 AC_ARG_WITH(system-zxing,
2233     AS_HELP_STRING([--with-system-zxing],
2234         [Use libzxing already on system.]),,
2235     [with_system_zxing="$with_system_libs"])
2237 AC_ARG_WITH(system-box2d,
2238     AS_HELP_STRING([--with-system-box2d],
2239         [Use box2d already on system.]),,
2240     [with_system_box2d="$with_system_libs"])
2242 AC_ARG_WITH(system-mythes,
2243     AS_HELP_STRING([--with-system-mythes],
2244         [Use mythes already on system.]),,
2245     [with_system_mythes="$with_system_libs"])
2247 AC_ARG_WITH(system-altlinuxhyph,
2248     AS_HELP_STRING([--with-system-altlinuxhyph],
2249         [Use ALTLinuxhyph already on system.]),,
2250     [with_system_altlinuxhyph="$with_system_libs"])
2252 AC_ARG_WITH(system-lpsolve,
2253     AS_HELP_STRING([--with-system-lpsolve],
2254         [Use lpsolve already on system.]),,
2255     [with_system_lpsolve="$with_system_libs"])
2257 AC_ARG_WITH(system-coinmp,
2258     AS_HELP_STRING([--with-system-coinmp],
2259         [Use CoinMP already on system.]),,
2260     [with_system_coinmp="$with_system_libs"])
2262 AC_ARG_WITH(system-liblangtag,
2263     AS_HELP_STRING([--with-system-liblangtag],
2264         [Use liblangtag library already on system.]),,
2265     [with_system_liblangtag="$with_system_libs"])
2267 AC_ARG_WITH(webdav,
2268     AS_HELP_STRING([--with-webdav],
2269         [Specify which library to use for webdav implementation.
2270          Possible values: "neon", "serf", "no". The default value is "neon".
2271          Example: --with-webdav="serf"]),
2272     WITH_WEBDAV=$withval,
2273     WITH_WEBDAV="neon")
2275 AC_ARG_WITH(linker-hash-style,
2276     AS_HELP_STRING([--with-linker-hash-style],
2277         [Use linker with --hash-style=<style> when linking shared objects.
2278          Possible values: "sysv", "gnu", "both". The default value is "gnu"
2279          if supported on the build system, and "sysv" otherwise.]))
2281 AC_ARG_WITH(jdk-home,
2282     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
2283         [If you have installed JDK 9 or later on your system please supply the
2284          path here. Note that this is not the location of the java command but the
2285          location of the entire distribution. In case of cross-compiling, this
2286          is the JDK of the host os. Use --with-build-platform-configure-options
2287          to point to a different build platform JDK.]),
2290 AC_ARG_WITH(help,
2291     AS_HELP_STRING([--with-help],
2292         [Enable the build of help. There is a special parameter "common" that
2293          can be used to bundle only the common part, .e.g help-specific icons.
2294          This is useful when you build the helpcontent separately.])
2295     [
2296                           Usage:     --with-help    build the old local help
2297                                  --without-help     no local help (default)
2298                                  --with-help=html   build the new HTML local help
2299                                  --with-help=online build the new HTML online help
2300     ],
2303 AC_ARG_WITH(omindex,
2304    AS_HELP_STRING([--with-omindex],
2305         [Enable the support of xapian-omega index for online help.])
2306    [
2307                          Usage: --with-omindex=server prepare the pages for omindex
2308                                 but let xapian-omega be built in server.
2309                                 --with-omindex=noxap do not prepare online pages
2310                                 for xapian-omega
2311   ],
2314 libo_FUZZ_ARG_WITH(java,
2315     AS_HELP_STRING([--with-java=<java command>],
2316         [Specify the name of the Java interpreter command. Typically "java"
2317          which is the default.
2319          To build without support for Java components, applets, accessibility
2320          or the XML filters written in Java, use --without-java or --with-java=no.]),
2321     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2322     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2325 AC_ARG_WITH(jvm-path,
2326     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2327         [Use a specific JVM search path at runtime.
2328          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2331 AC_ARG_WITH(ant-home,
2332     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2333         [If you have installed Apache Ant on your system, please supply the path here.
2334          Note that this is not the location of the Ant binary but the location
2335          of the entire distribution.]),
2338 AC_ARG_WITH(symbol-config,
2339     AS_HELP_STRING([--with-symbol-config],
2340         [Configuration for the crashreport symbol upload]),
2341         [],
2342         [with_symbol_config=no])
2344 AC_ARG_WITH(export-validation,
2345     AS_HELP_STRING([--without-export-validation],
2346         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2347 ,with_export_validation=auto)
2349 AC_ARG_WITH(bffvalidator,
2350     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2351         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2352          Requires installed Microsoft Office Binary File Format Validator.
2353          Note: export-validation (--with-export-validation) is required to be turned on.
2354          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2355 ,with_bffvalidator=no)
2357 libo_FUZZ_ARG_WITH(junit,
2358     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2359         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2360          --without-junit disables those tests. Not relevant in the --without-java case.]),
2361 ,with_junit=yes)
2363 AC_ARG_WITH(hamcrest,
2364     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2365         [Specifies the hamcrest jar file to use for JUnit-based tests.
2366          --without-junit disables those tests. Not relevant in the --without-java case.]),
2367 ,with_hamcrest=yes)
2369 AC_ARG_WITH(perl-home,
2370     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2371         [If you have installed Perl 5 Distribution, on your system, please
2372          supply the path here. Note that this is not the location of the Perl
2373          binary but the location of the entire distribution.]),
2376 libo_FUZZ_ARG_WITH(doxygen,
2377     AS_HELP_STRING(
2378         [--with-doxygen=<absolute path to doxygen executable>],
2379         [Specifies the doxygen executable to use when generating ODK C/C++
2380          documentation. --without-doxygen disables generation of ODK C/C++
2381          documentation. Not relevant in the --disable-odk case.]),
2382 ,with_doxygen=yes)
2384 AC_ARG_WITH(visual-studio,
2385     AS_HELP_STRING([--with-visual-studio=<2019>],
2386         [Specify which Visual Studio version to use in case several are
2387          installed. Currently only 2019 (default) is supported.]),
2390 AC_ARG_WITH(windows-sdk,
2391     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10.0>],
2392         [Specify which Windows SDK, or "Windows Kit", version to use
2393          in case the one that came with the selected Visual Studio
2394          is not what you want for some reason. Note that not all compiler/SDK
2395          combinations are supported. The intent is that this option should not
2396          be needed.]),
2399 AC_ARG_WITH(lang,
2400     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2401         [Use this option to build LibreOffice with additional UI language support.
2402          English (US) is always included by default.
2403          Separate multiple languages with space.
2404          For all languages, use --with-lang=ALL.]),
2407 AC_ARG_WITH(locales,
2408     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2409         [Use this option to limit the locale information built in.
2410          Separate multiple locales with space.
2411          Very experimental and might well break stuff.
2412          Just a desperate measure to shrink code and data size.
2413          By default all the locales available is included.
2414          This option is completely unrelated to --with-lang.])
2415     [
2416                           Affects also our character encoding conversion
2417                           tables for encodings mainly targeted for a
2418                           particular locale, like EUC-CN and EUC-TW for
2419                           zh, ISO-2022-JP for ja.
2421                           Affects also our add-on break iterator data for
2422                           some languages.
2424                           For the default, all locales, don't use this switch at all.
2425                           Specifying just the language part of a locale means all matching
2426                           locales will be included.
2427     ],
2430 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2431 libo_FUZZ_ARG_WITH(krb5,
2432     AS_HELP_STRING([--with-krb5],
2433         [Enable MIT Kerberos 5 support in modules that support it.
2434          By default automatically enabled on platforms
2435          where a good system Kerberos 5 is available.]),
2438 libo_FUZZ_ARG_WITH(gssapi,
2439     AS_HELP_STRING([--with-gssapi],
2440         [Enable GSSAPI support in modules that support it.
2441          By default automatically enabled on platforms
2442          where a good system GSSAPI is available.]),
2445 AC_ARG_WITH(iwyu,
2446     AS_HELP_STRING([--with-iwyu],
2447         [Use given IWYU binary path to check unneeded includes instead of building.
2448          Use only if you are hacking on it.]),
2451 libo_FUZZ_ARG_WITH(lxml,
2452     AS_HELP_STRING([--without-lxml],
2453         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2454          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2455          report widget classes and ids.]),
2458 libo_FUZZ_ARG_WITH(latest-c++,
2459     AS_HELP_STRING([--with-latest-c++],
2460         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2461          published standard.]),,
2462         [with_latest_c__=no])
2464 dnl ===================================================================
2465 dnl Branding
2466 dnl ===================================================================
2468 AC_ARG_WITH(branding,
2469     AS_HELP_STRING([--with-branding=/path/to/images],
2470         [Use given path to retrieve branding images set.])
2471     [
2472                           Search for intro.png about.svg and logo.svg.
2473                           If any is missing, default ones will be used instead.
2475                           Search also progress.conf for progress
2476                           settings on intro screen :
2478                           PROGRESSBARCOLOR="255,255,255" Set color of
2479                           progress bar. Comma separated RGB decimal values.
2480                           PROGRESSSIZE="407,6" Set size of progress bar.
2481                           Comma separated decimal values (width, height).
2482                           PROGRESSPOSITION="61,317" Set position of progress
2483                           bar from left,top. Comma separated decimal values.
2484                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2485                           bar frame. Comma separated RGB decimal values.
2486                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2487                           bar text. Comma separated RGB decimal values.
2488                           PROGRESSTEXTBASELINE="287" Set vertical position of
2489                           progress bar text from top. Decimal value.
2491                           Default values will be used if not found.
2492     ],
2496 AC_ARG_WITH(extra-buildid,
2497     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2498         [Show addition build identification in about dialog.]),
2502 AC_ARG_WITH(vendor,
2503     AS_HELP_STRING([--with-vendor="John the Builder"],
2504         [Set vendor of the build.]),
2507 AC_ARG_WITH(android-package-name,
2508     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2509         [Set Android package name of the build.]),
2512 AC_ARG_WITH(compat-oowrappers,
2513     AS_HELP_STRING([--with-compat-oowrappers],
2514         [Install oo* wrappers in parallel with
2515          lo* ones to keep backward compatibility.
2516          Has effect only with make distro-pack-install]),
2519 AC_ARG_WITH(os-version,
2520     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2521         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2524 AC_ARG_WITH(idlc-cpp,
2525     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2526         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2529 AC_ARG_WITH(parallelism,
2530     AS_HELP_STRING([--with-parallelism],
2531         [Number of jobs to run simultaneously during build. Parallel builds can
2532         save a lot of time on multi-cpu machines. Defaults to the number of
2533         CPUs on the machine, unless you configure --enable-icecream - then to
2534         40.]),
2537 AC_ARG_WITH(all-tarballs,
2538     AS_HELP_STRING([--with-all-tarballs],
2539         [Download all external tarballs unconditionally]))
2541 AC_ARG_WITH(gdrive-client-id,
2542     AS_HELP_STRING([--with-gdrive-client-id],
2543         [Provides the client id of the application for OAuth2 authentication
2544         on Google Drive. If either this or --with-gdrive-client-secret is
2545         empty, the feature will be disabled]),
2548 AC_ARG_WITH(gdrive-client-secret,
2549     AS_HELP_STRING([--with-gdrive-client-secret],
2550         [Provides the client secret of the application for OAuth2
2551         authentication on Google Drive. If either this or
2552         --with-gdrive-client-id is empty, the feature will be disabled]),
2555 AC_ARG_WITH(alfresco-cloud-client-id,
2556     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2557         [Provides the client id of the application for OAuth2 authentication
2558         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2559         empty, the feature will be disabled]),
2562 AC_ARG_WITH(alfresco-cloud-client-secret,
2563     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2564         [Provides the client secret of the application for OAuth2
2565         authentication on Alfresco Cloud. If either this or
2566         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2569 AC_ARG_WITH(onedrive-client-id,
2570     AS_HELP_STRING([--with-onedrive-client-id],
2571         [Provides the client id of the application for OAuth2 authentication
2572         on OneDrive. If either this or --with-onedrive-client-secret is
2573         empty, the feature will be disabled]),
2576 AC_ARG_WITH(onedrive-client-secret,
2577     AS_HELP_STRING([--with-onedrive-client-secret],
2578         [Provides the client secret of the application for OAuth2
2579         authentication on OneDrive. If either this or
2580         --with-onedrive-client-id is empty, the feature will be disabled]),
2582 dnl ===================================================================
2583 dnl Do we want to use pre-build binary tarball for recompile
2584 dnl ===================================================================
2586 if test "$enable_library_bin_tar" = "yes" ; then
2587     USE_LIBRARY_BIN_TAR=TRUE
2588 else
2589     USE_LIBRARY_BIN_TAR=
2591 AC_SUBST(USE_LIBRARY_BIN_TAR)
2593 dnl ===================================================================
2594 dnl Test whether build target is Release Build
2595 dnl ===================================================================
2596 AC_MSG_CHECKING([whether build target is Release Build])
2597 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2598     AC_MSG_RESULT([no])
2599     ENABLE_RELEASE_BUILD=
2600     GET_TASK_ALLOW_ENTITLEMENT='
2601         <!-- We want to be able to debug a hardened process when not building for release -->
2602         <key>com.apple.security.get-task-allow</key>
2603         <true/>'
2604 else
2605     AC_MSG_RESULT([yes])
2606     ENABLE_RELEASE_BUILD=TRUE
2607     GET_TASK_ALLOW_ENTITLEMENT=''
2609 AC_SUBST(ENABLE_RELEASE_BUILD)
2610 AC_SUBST(GET_TASK_ALLOW_ENTITLEMENT)
2612 AC_MSG_CHECKING([whether to build a Community flavor])
2613 if test -z "$enable_community_flavor" -o "$enable_community_flavor" == "yes"; then
2614     AC_DEFINE(HAVE_FEATURE_COMMUNITY_FLAVOR)
2615     AC_MSG_RESULT([yes])
2616 else
2617     AC_MSG_RESULT([no])
2620 dnl ===================================================================
2621 dnl Test whether to sign Windows Build
2622 dnl ===================================================================
2623 AC_MSG_CHECKING([whether to sign windows build])
2624 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2625     AC_MSG_RESULT([yes])
2626     WINDOWS_BUILD_SIGNING="TRUE"
2627 else
2628     AC_MSG_RESULT([no])
2629     WINDOWS_BUILD_SIGNING="FALSE"
2631 AC_SUBST(WINDOWS_BUILD_SIGNING)
2633 dnl ===================================================================
2634 dnl MacOSX build and runtime environment options
2635 dnl ===================================================================
2637 AC_ARG_WITH(macosx-sdk,
2638     AS_HELP_STRING([--with-macosx-sdk=<version>],
2639         [Prefer a specific SDK for building.])
2640     [
2641                           If the requested SDK is not available, a search for the oldest one will be done.
2642                           With current Xcode versions, only the latest SDK is included, so this option is
2643                           not terribly useful. It works fine to build with a new SDK and run the result
2644                           on an older OS.
2646                           e. g.: --with-macosx-sdk=10.10
2648                           there are 3 options to control the MacOSX build:
2649                           --with-macosx-sdk (referred as 'sdk' below)
2650                           --with-macosx-version-min-required (referred as 'min' below)
2651                           --with-macosx-version-max-allowed (referred as 'max' below)
2653                           the connection between these value and the default they take is as follow:
2654                           ( ? means not specified on the command line, s means the SDK version found,
2655                           constraint: 8 <= x <= y <= z)
2657                           ==========================================
2658                            command line      || config result
2659                           ==========================================
2660                           min  | max  | sdk  || min   | max  | sdk  |
2661                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2662                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2663                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2664                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2665                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2666                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2667                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2668                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2671                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2672                           for a detailed technical explanation of these variables
2674                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2675     ],
2678 AC_ARG_WITH(macosx-version-min-required,
2679     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2680         [set the minimum OS version needed to run the built LibreOffice])
2681     [
2682                           e. g.: --with-macosx-version-min-required=10.10
2683                           see --with-macosx-sdk for more info
2684     ],
2687 AC_ARG_WITH(macosx-version-max-allowed,
2688     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2689         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2690     [
2691                           e. g.: --with-macosx-version-max-allowed=10.10
2692                           see --with-macosx-sdk for more info
2693     ],
2697 dnl ===================================================================
2698 dnl options for stuff used during cross-compilation build
2699 dnl Not quite superseded by --with-build-platform-configure-options.
2700 dnl TODO: check, if the "force" option is still needed anywhere.
2701 dnl ===================================================================
2703 AC_ARG_WITH(system-icu-for-build,
2704     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2705         [Use icu already on system for build tools (cross-compilation only).]))
2708 dnl ===================================================================
2709 dnl Check for incompatible options set by fuzzing, and reset those
2710 dnl automatically to working combinations
2711 dnl ===================================================================
2713 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2714         "$enable_dbus" != "$enable_avahi"; then
2715     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2716     enable_avahi=$enable_dbus
2719 add_lopath_after ()
2721     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2722         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2723     fi
2726 add_lopath_before ()
2728     local IFS=${P_SEP}
2729     local path_cleanup
2730     local dir
2731     for dir in $LO_PATH ; do
2732         if test "$dir" != "$1" ; then
2733             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2734         fi
2735     done
2736     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2739 dnl ===================================================================
2740 dnl check for required programs (grep, awk, sed, bash)
2741 dnl ===================================================================
2743 pathmunge ()
2745     local new_path
2746     if test -n "$1"; then
2747         if test "$build_os" = "cygwin"; then
2748             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2749                 PathFormat "$1"
2750                 new_path=`cygpath -sm "$formatted_path"`
2751             else
2752                 PathFormat "$1"
2753                 new_path=`cygpath -u "$formatted_path"`
2754             fi
2755         else
2756             new_path="$1"
2757         fi
2758         if test "$2" = "after"; then
2759             add_lopath_after "$new_path"
2760         else
2761             add_lopath_before "$new_path"
2762         fi
2763     fi
2766 AC_PROG_AWK
2767 AC_PATH_PROG( AWK, $AWK)
2768 if test -z "$AWK"; then
2769     AC_MSG_ERROR([install awk to run this script])
2772 AC_PATH_PROG(BASH, bash)
2773 if test -z "$BASH"; then
2774     AC_MSG_ERROR([bash not found in \$PATH])
2776 AC_SUBST(BASH)
2778 AC_MSG_CHECKING([for GNU or BSD tar])
2779 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2780     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2781     if test $? -eq 0;  then
2782         GNUTAR=$a
2783         break
2784     fi
2785 done
2786 AC_MSG_RESULT($GNUTAR)
2787 if test -z "$GNUTAR"; then
2788     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2790 AC_SUBST(GNUTAR)
2792 AC_MSG_CHECKING([for tar's option to strip components])
2793 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2794 if test $? -eq 0; then
2795     STRIP_COMPONENTS="--strip-components"
2796 else
2797     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2798     if test $? -eq 0; then
2799         STRIP_COMPONENTS="--strip-path"
2800     else
2801         STRIP_COMPONENTS="unsupported"
2802     fi
2804 AC_MSG_RESULT($STRIP_COMPONENTS)
2805 if test x$STRIP_COMPONENTS = xunsupported; then
2806     AC_MSG_ERROR([you need a tar that is able to strip components.])
2808 AC_SUBST(STRIP_COMPONENTS)
2810 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2811 dnl desktop OSes from "mobile" ones.
2813 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2814 dnl In other words, that when building for an OS that is not a
2815 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2817 dnl Note the direction of the implication; there is no assumption that
2818 dnl cross-compiling would imply a non-desktop OS.
2820 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2821     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2822     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2823     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2826 # Whether to build "avmedia" functionality or not.
2828 if test -z "$enable_avmedia"; then
2829     enable_avmedia=yes
2832 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2833 if test "$enable_avmedia" = yes; then
2834     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2835 else
2836     USE_AVMEDIA_DUMMY='TRUE'
2838 AC_SUBST(USE_AVMEDIA_DUMMY)
2840 # Decide whether to build database connectivity stuff (including
2841 # Base) or not. We probably don't want to on non-desktop OSes.
2842 if test -z "$enable_database_connectivity"; then
2843     # --disable-database-connectivity is unfinished work in progress
2844     # and the iOS test app doesn't link if we actually try to use it.
2845     # if test $_os != iOS -a $_os != Android; then
2846     if test $_os != iOS; then
2847         enable_database_connectivity=yes
2848     fi
2851 if test "$enable_database_connectivity" = yes; then
2852     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2853     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2856 if test -z "$enable_extensions"; then
2857     # For iOS and Android Viewer, disable extensions unless specifically overridden with --enable-extensions.
2858     if test $_os != iOS && test $_os != Android -o "$ENABLE_ANDROID_LOK" = TRUE ; then
2859         enable_extensions=yes
2860     fi
2863 if test "$enable_extensions" = yes; then
2864     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2865     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2868 if test -z "$enable_scripting"; then
2869     # Disable scripting for iOS unless specifically overridden
2870     # with --enable-scripting.
2871     if test $_os != iOS; then
2872         enable_scripting=yes
2873     fi
2876 DISABLE_SCRIPTING=''
2877 if test "$enable_scripting" = yes; then
2878     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2879     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2880 else
2881     DISABLE_SCRIPTING='TRUE'
2882     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2885 if test $_os = iOS -o $_os = Android; then
2886     # Disable dynamic_loading always for iOS and Android
2887     enable_dynamic_loading=no
2888 elif test -z "$enable_dynamic_loading"; then
2889     # Otherwise enable it unless specifically disabled
2890     enable_dynamic_loading=yes
2893 DISABLE_DYNLOADING=''
2894 if test "$enable_dynamic_loading" = yes; then
2895     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2896 else
2897     DISABLE_DYNLOADING='TRUE'
2899 AC_SUBST(DISABLE_DYNLOADING)
2901 # remember SYSBASE value
2902 AC_SUBST(SYSBASE)
2904 dnl ===================================================================
2905 dnl  Sort out various gallery compilation options
2906 dnl ===================================================================
2907 WITH_GALLERY_BUILD=TRUE
2908 AC_MSG_CHECKING([how to build and package galleries])
2909 if test -n "${with_galleries}"; then
2910     if test "$with_galleries" = "build"; then
2911         AC_MSG_RESULT([build from source images internally])
2912     elif test "$with_galleries" = "no"; then
2913         WITH_GALLERY_BUILD=
2914         AC_MSG_RESULT([disable non-internal gallery build])
2915     else
2916         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2917     fi
2918 else
2919     if test $_os != iOS -a $_os != Android; then
2920         AC_MSG_RESULT([internal src images for desktop])
2921     else
2922         WITH_GALLERY_BUILD=
2923         AC_MSG_RESULT([disable src image build])
2924     fi
2926 AC_SUBST(WITH_GALLERY_BUILD)
2928 dnl ===================================================================
2929 dnl  Checks if ccache is available
2930 dnl ===================================================================
2931 CCACHE_DEPEND_MODE=
2932 if test "$enable_ccache" = "no"; then
2933     CCACHE=""
2934 elif test "$_os" = "WINNT"; then
2935     # on windows/VC build do not use ccache - but perhaps sccache is around?
2936     case "%$CC%$CXX%" in
2937     # If $CC and/or $CXX already contain "sccache" (possibly suffixed with some version number etc),
2938     # assume that's good then
2939     *%sccache[[-_' ']]*|*/sccache[[-_' ']]*)
2940         AC_MSG_NOTICE([sccache seems to be included in a pre-defined CC and/or CXX])
2941         CCACHE_DEPEND_MODE=1
2942         ;;
2943     *)
2944         # for sharing code below, reuse CCACHE env var
2945         AC_PATH_PROG([CCACHE],[sccache],[not found])
2946         if test "$CCACHE" = "not found"; then
2947             CCACHE=""
2948         else
2949             CCACHE=`win_short_path_for_make "$CCACHE"`
2950             CCACHE_DEPEND_MODE=1
2951         fi
2952         ;;
2953     esac
2954 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2955     case "%$CC%$CXX%" in
2956     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2957     # assume that's good then
2958     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2959         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2960         CCACHE_DEPEND_MODE=1
2961         ;;
2962     *)
2963         AC_PATH_PROG([CCACHE],[ccache],[not found])
2964         if test "$CCACHE" = "not found"; then
2965             CCACHE=""
2966         else
2967             CCACHE_DEPEND_MODE=1
2968             # Need to check for ccache version: otherwise prevents
2969             # caching of the results (like "-x objective-c++" for Mac)
2970             if test $_os = Darwin -o $_os = iOS; then
2971                 # Check ccache version
2972                 AC_MSG_CHECKING([whether version of ccache is suitable])
2973                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2974                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2975                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2976                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2977                 else
2978                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2979                     CCACHE=""
2980                     CCACHE_DEPEND_MODE=
2981                 fi
2982             fi
2983         fi
2984         ;;
2985     esac
2986 else
2987     CCACHE=""
2989 if test "$enable_ccache" = "nodepend"; then
2990     CCACHE_DEPEND_MODE=""
2992 AC_SUBST(CCACHE_DEPEND_MODE)
2994 # skip on windows - sccache defaults are good enough
2995 if test "$CCACHE" != "" -a "$_os" != "WINNT"; then
2996     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2997     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2998     if test "$ccache_size" = ""; then
2999         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
3000         if test "$ccache_size" = ""; then
3001             ccache_size=0
3002         fi
3003         # we could not determine the size or it was less than 1GB -> disable auto-ccache
3004         if test $ccache_size -lt 1024; then
3005             CCACHE=""
3006             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
3007             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
3008         else
3009             # warn that ccache may be too small for debug build
3010             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3011             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3012         fi
3013     else
3014         if test $ccache_size -lt 5; then
3015             #warn that ccache may be too small for debug build
3016             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3017             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3018         fi
3019     fi
3022 dnl ===================================================================
3023 dnl  Checks for C compiler,
3024 dnl  The check for the C++ compiler is later on.
3025 dnl ===================================================================
3026 if test "$_os" != "WINNT"; then
3027     GCC_HOME_SET="true"
3028     AC_MSG_CHECKING([gcc home])
3029     if test -z "$with_gcc_home"; then
3030         if test "$enable_icecream" = "yes"; then
3031             if test -d "/usr/lib/icecc/bin"; then
3032                 GCC_HOME="/usr/lib/icecc/"
3033             elif test -d "/usr/libexec/icecc/bin"; then
3034                 GCC_HOME="/usr/libexec/icecc/"
3035             elif test -d "/opt/icecream/bin"; then
3036                 GCC_HOME="/opt/icecream/"
3037             else
3038                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
3040             fi
3041         else
3042             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
3043             GCC_HOME_SET="false"
3044         fi
3045     else
3046         GCC_HOME="$with_gcc_home"
3047     fi
3048     AC_MSG_RESULT($GCC_HOME)
3049     AC_SUBST(GCC_HOME)
3051     if test "$GCC_HOME_SET" = "true"; then
3052         if test -z "$CC"; then
3053             CC="$GCC_HOME/bin/gcc"
3054             CC_BASE="gcc"
3055         fi
3056         if test -z "$CXX"; then
3057             CXX="$GCC_HOME/bin/g++"
3058             CXX_BASE="g++"
3059         fi
3060     fi
3063 COMPATH=`dirname "$CC"`
3064 if test "$COMPATH" = "."; then
3065     AC_PATH_PROGS(COMPATH, $CC)
3066     dnl double square bracket to get single because of M4 quote...
3067     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
3069 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
3071 dnl ===================================================================
3072 dnl Java support
3073 dnl ===================================================================
3074 AC_MSG_CHECKING([whether to build with Java support])
3075 if test "$with_java" != "no"; then
3076     if test "$DISABLE_SCRIPTING" = TRUE; then
3077         AC_MSG_RESULT([no, overridden by --disable-scripting])
3078         ENABLE_JAVA=""
3079         with_java=no
3080     else
3081         AC_MSG_RESULT([yes])
3082         ENABLE_JAVA="TRUE"
3083         AC_DEFINE(HAVE_FEATURE_JAVA)
3084     fi
3085 else
3086     AC_MSG_RESULT([no])
3087     ENABLE_JAVA=""
3090 AC_SUBST(ENABLE_JAVA)
3092 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
3094 dnl ENABLE_JAVA="" indicate no Java support at all
3096 dnl ===================================================================
3097 dnl Check macOS SDK and compiler
3098 dnl ===================================================================
3100 if test $_os = Darwin; then
3102     # If no --with-macosx-sdk option is given, look for one
3104     # The intent is that for "most" Mac-based developers, a suitable
3105     # SDK will be found automatically without any configure options.
3107     # For developers with a current Xcode, the lowest-numbered SDK
3108     # higher than or equal to the minimum required should be found.
3110     AC_MSG_CHECKING([what macOS SDK to use])
3111     for _macosx_sdk in ${with_macosx_sdk-11.3 11.1 11.0 10.15 10.14 10.13}; do
3112         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
3113         if test -d "$MACOSX_SDK_PATH"; then
3114             with_macosx_sdk="${_macosx_sdk}"
3115             break
3116         else
3117             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
3118             if test -d "$MACOSX_SDK_PATH"; then
3119                 with_macosx_sdk="${_macosx_sdk}"
3120                 break
3121             fi
3122         fi
3123     done
3124     if test ! -d "$MACOSX_SDK_PATH"; then
3125         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
3126     fi
3128     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
3130     case $with_macosx_sdk in
3131     10.13)
3132         MACOSX_SDK_VERSION=101300
3133         ;;
3134     10.14)
3135         MACOSX_SDK_VERSION=101400
3136         ;;
3137     10.15)
3138         MACOSX_SDK_VERSION=101500
3139         ;;
3140     11.0)
3141         MACOSX_SDK_VERSION=110000
3142         ;;
3143     11.1)
3144         MACOSX_SDK_VERSION=110100
3145         ;;
3146     11.3)
3147         MACOSX_SDK_VERSION=110300
3148         ;;
3149     *)
3150         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.13--11.3])
3151         ;;
3152     esac
3154     if test "$host_cpu" = arm64 -a $MACOSX_SDK_VERSION -lt 110000; then
3155         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value for Apple Silicon])
3156     fi
3158     if test "$with_macosx_version_min_required" = "" ; then
3159         if test "$host_cpu" = x86_64; then
3160             with_macosx_version_min_required="10.10";
3161         else
3162             with_macosx_version_min_required="11.0";
3163         fi
3164     fi
3166     if test "$with_macosx_version_max_allowed" = "" ; then
3167         with_macosx_version_max_allowed="$with_macosx_sdk"
3168     fi
3170     # export this so that "xcrun" invocations later return matching values
3171     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
3172     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
3173     export DEVELOPER_DIR
3174     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
3175     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
3177     AC_MSG_CHECKING([whether Xcode is new enough])
3178     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
3179     my_xcode_ver2=${my_xcode_ver1#Xcode }
3180     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
3181     if test "$my_xcode_ver3" -ge 1103; then
3182         AC_MSG_RESULT([yes ($my_xcode_ver2)])
3183     else
3184         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 11.3])
3185     fi
3187     case "$with_macosx_version_min_required" in
3188     10.10)
3189         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
3190         ;;
3191     10.11)
3192         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
3193         ;;
3194     10.12)
3195         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
3196         ;;
3197     10.13)
3198         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
3199         ;;
3200     10.14)
3201         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
3202         ;;
3203     10.15)
3204         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
3205         ;;
3206     10.16)
3207         MAC_OS_X_VERSION_MIN_REQUIRED="101600"
3208         ;;
3209     11.0)
3210         MAC_OS_X_VERSION_MIN_REQUIRED="110000"
3211         ;;
3212     11.1)
3213         MAC_OS_X_VERSION_MIN_REQUIRED="110100"
3214         ;;
3215     11.3)
3216         MAC_OS_X_VERSION_MIN_REQUIRED="110300"
3217         ;;
3218     *)
3219         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])
3220         ;;
3221     esac
3223     LIBTOOL=/usr/bin/libtool
3224     INSTALL_NAME_TOOL=install_name_tool
3225     if test -z "$save_CC"; then
3226         stdlib=-stdlib=libc++
3228         AC_MSG_CHECKING([what C compiler to use])
3229         CC="`xcrun -find clang`"
3230         CC_BASE=`first_arg_basename "$CC"`
3231         if test "$host_cpu" = x86_64; then
3232             CC+=" -target x86_64-apple-macos"
3233         else
3234             CC+=" -target arm64-apple-macos"
3235         fi
3236         CC+=" -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3237         AC_MSG_RESULT([$CC])
3239         AC_MSG_CHECKING([what C++ compiler to use])
3240         CXX="`xcrun -find clang++`"
3241         CXX_BASE=`first_arg_basename "$CXX"`
3242         if test "$host_cpu" = x86_64; then
3243             CXX+=" -target x86_64-apple-macos"
3244         else
3245             CXX+=" -target arm64-apple-macos"
3246         fi
3247         CXX+=" $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3248         AC_MSG_RESULT([$CXX])
3250         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3251         AR=`xcrun -find ar`
3252         NM=`xcrun -find nm`
3253         STRIP=`xcrun -find strip`
3254         LIBTOOL=`xcrun -find libtool`
3255         RANLIB=`xcrun -find ranlib`
3256     fi
3258     case "$with_macosx_version_max_allowed" in
3259     10.10)
3260         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
3261         ;;
3262     10.11)
3263         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
3264         ;;
3265     10.12)
3266         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
3267         ;;
3268     10.13)
3269         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
3270         ;;
3271     10.14)
3272         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
3273         ;;
3274     10.15)
3275         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
3276         ;;
3277     11.0)
3278         MAC_OS_X_VERSION_MAX_ALLOWED="110000"
3279         ;;
3280     11.1)
3281         MAC_OS_X_VERSION_MAX_ALLOWED="110100"
3282         ;;
3283     11.3)
3284         MAC_OS_X_VERSION_MAX_ALLOWED="110300"
3285         ;;
3286     *)
3287         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])
3288         ;;
3289     esac
3291     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
3292     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
3293         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])
3294     else
3295         AC_MSG_RESULT([ok])
3296     fi
3298     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
3299     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
3300         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
3301     else
3302         AC_MSG_RESULT([ok])
3303     fi
3304     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
3305     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
3307     AC_MSG_CHECKING([whether to do code signing])
3309     if test "$enable_macosx_code_signing" = yes; then
3310         # By default use the first suitable certificate (?).
3312         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
3313         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
3314         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
3315         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
3316         # "Developer ID Application" one.
3318         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
3319         if test -n "$identity"; then
3320             MACOSX_CODESIGNING_IDENTITY=$identity
3321             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3322             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3323         else
3324             AC_MSG_ERROR([cannot determine identity to use])
3325         fi
3326     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
3327         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
3328         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3329         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3330     else
3331         AC_MSG_RESULT([no])
3332     fi
3334     AC_MSG_CHECKING([whether to create a Mac App Store package])
3336     if test -z "$enable_macosx_package_signing" || test "$enable_macosx_package_signing" == no; then
3337         AC_MSG_RESULT([no])
3338     elif test -z "$MACOSX_CODESIGNING_IDENTITY"; then
3339         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3340     elif test "$enable_macosx_package_signing" = yes; then
3341         # By default use the first suitable certificate.
3342         # It should be a "3rd Party Mac Developer Installer" one
3344         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
3345         if test -n "$identity"; then
3346             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3347             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3348             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3349         else
3350             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3351         fi
3352     else
3353         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
3354         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3355         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3356     fi
3358     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3359         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3360     fi
3362     AC_MSG_CHECKING([whether to sandbox the application])
3364     if test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3365         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3366     elif test "$enable_macosx_sandbox" = yes; then
3367         ENABLE_MACOSX_SANDBOX=TRUE
3368         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3369         AC_MSG_RESULT([yes])
3370     else
3371         AC_MSG_RESULT([no])
3372     fi
3374     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3375     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3376     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3378 AC_SUBST(MACOSX_SDK_PATH)
3379 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3380 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3381 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3382 AC_SUBST(INSTALL_NAME_TOOL)
3383 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3384 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3385 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3386 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3387 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3389 dnl ===================================================================
3390 dnl Check iOS SDK and compiler
3391 dnl ===================================================================
3393 if test $_os = iOS; then
3394     AC_MSG_CHECKING([what iOS SDK to use])
3395     current_sdk_ver=14.5
3396     older_sdk_vers="14.4 14.3 14.2 14.1 14.0 13.7"
3397     if test "$enable_ios_simulator" = "yes"; then
3398         platform=iPhoneSimulator
3399         versionmin=-mios-simulator-version-min=12.2
3400     else
3401         platform=iPhoneOS
3402         versionmin=-miphoneos-version-min=12.2
3403     fi
3404     xcode_developer=`xcode-select -print-path`
3406     for sdkver in $current_sdk_ver $older_sdk_vers; do
3407         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3408         if test -d $t; then
3409             sysroot=$t
3410             break
3411         fi
3412     done
3414     if test -z "$sysroot"; then
3415         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3416     fi
3418     AC_MSG_RESULT($sysroot)
3420     stdlib="-stdlib=libc++"
3422     AC_MSG_CHECKING([what C compiler to use])
3423     CC="`xcrun -find clang`"
3424     CC_BASE=`first_arg_basename "$CC"`
3425     CC+=" -arch $host_cpu_for_clang -isysroot $sysroot $versionmin"
3426     AC_MSG_RESULT([$CC])
3428     AC_MSG_CHECKING([what C++ compiler to use])
3429     CXX="`xcrun -find clang++`"
3430     CXX_BASE=`first_arg_basename "$CXX"`
3431     CXX+=" -arch $host_cpu_for_clang $stdlib -isysroot $sysroot $versionmin"
3432     AC_MSG_RESULT([$CXX])
3434     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3435     AR=`xcrun -find ar`
3436     NM=`xcrun -find nm`
3437     STRIP=`xcrun -find strip`
3438     LIBTOOL=`xcrun -find libtool`
3439     RANLIB=`xcrun -find ranlib`
3442 AC_MSG_CHECKING([whether to treat the installation as read-only])
3444 if test $_os = Darwin; then
3445     enable_readonly_installset=yes
3446 elif test "$enable_extensions" != yes; then
3447     enable_readonly_installset=yes
3449 if test "$enable_readonly_installset" = yes; then
3450     AC_MSG_RESULT([yes])
3451     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3452 else
3453     AC_MSG_RESULT([no])
3456 dnl ===================================================================
3457 dnl Structure of install set
3458 dnl ===================================================================
3460 if test $_os = Darwin; then
3461     LIBO_BIN_FOLDER=MacOS
3462     LIBO_ETC_FOLDER=Resources
3463     LIBO_LIBEXEC_FOLDER=MacOS
3464     LIBO_LIB_FOLDER=Frameworks
3465     LIBO_LIB_PYUNO_FOLDER=Resources
3466     LIBO_SHARE_FOLDER=Resources
3467     LIBO_SHARE_HELP_FOLDER=Resources/help
3468     LIBO_SHARE_JAVA_FOLDER=Resources/java
3469     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3470     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3471     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3472     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3473     LIBO_URE_BIN_FOLDER=MacOS
3474     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3475     LIBO_URE_LIB_FOLDER=Frameworks
3476     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3477     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3478 elif test $_os = WINNT; then
3479     LIBO_BIN_FOLDER=program
3480     LIBO_ETC_FOLDER=program
3481     LIBO_LIBEXEC_FOLDER=program
3482     LIBO_LIB_FOLDER=program
3483     LIBO_LIB_PYUNO_FOLDER=program
3484     LIBO_SHARE_FOLDER=share
3485     LIBO_SHARE_HELP_FOLDER=help
3486     LIBO_SHARE_JAVA_FOLDER=program/classes
3487     LIBO_SHARE_PRESETS_FOLDER=presets
3488     LIBO_SHARE_READMES_FOLDER=readmes
3489     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3490     LIBO_SHARE_SHELL_FOLDER=program/shell
3491     LIBO_URE_BIN_FOLDER=program
3492     LIBO_URE_ETC_FOLDER=program
3493     LIBO_URE_LIB_FOLDER=program
3494     LIBO_URE_MISC_FOLDER=program
3495     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3496 else
3497     LIBO_BIN_FOLDER=program
3498     LIBO_ETC_FOLDER=program
3499     LIBO_LIBEXEC_FOLDER=program
3500     LIBO_LIB_FOLDER=program
3501     LIBO_LIB_PYUNO_FOLDER=program
3502     LIBO_SHARE_FOLDER=share
3503     LIBO_SHARE_HELP_FOLDER=help
3504     LIBO_SHARE_JAVA_FOLDER=program/classes
3505     LIBO_SHARE_PRESETS_FOLDER=presets
3506     LIBO_SHARE_READMES_FOLDER=readmes
3507     if test "$enable_fuzzers" != yes; then
3508         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3509     else
3510         LIBO_SHARE_RESOURCE_FOLDER=resource
3511     fi
3512     LIBO_SHARE_SHELL_FOLDER=program/shell
3513     LIBO_URE_BIN_FOLDER=program
3514     LIBO_URE_ETC_FOLDER=program
3515     LIBO_URE_LIB_FOLDER=program
3516     LIBO_URE_MISC_FOLDER=program
3517     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3519 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3520 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3521 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3522 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3523 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3524 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3525 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3526 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3527 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3528 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3529 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3530 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3531 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3532 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3533 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3534 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3536 # Not all of them needed in config_host.mk, add more if need arises
3537 AC_SUBST(LIBO_BIN_FOLDER)
3538 AC_SUBST(LIBO_ETC_FOLDER)
3539 AC_SUBST(LIBO_LIB_FOLDER)
3540 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3541 AC_SUBST(LIBO_SHARE_FOLDER)
3542 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3543 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3544 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3545 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3546 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3547 AC_SUBST(LIBO_URE_BIN_FOLDER)
3548 AC_SUBST(LIBO_URE_ETC_FOLDER)
3549 AC_SUBST(LIBO_URE_LIB_FOLDER)
3550 AC_SUBST(LIBO_URE_MISC_FOLDER)
3551 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3553 dnl ===================================================================
3554 dnl Windows specific tests and stuff
3555 dnl ===================================================================
3557 reg_get_value()
3559     # Return value: $regvalue
3560     unset regvalue
3562     if test "$build_os" = "wsl"; then
3563         regvalue=$($BUILDDIR/solenv/wsl/wsl-lo-helper.exe --read-registry $1 "$2" 2>/dev/null)
3564         return
3565     fi
3567     local _regentry="/proc/registry${1}/${2}"
3568     if test -f "$_regentry"; then
3569         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3570         # Registry keys read via /proc/registry* are always \0 terminated!
3571         local _regvalue=$(tr -d '\0' < "$_regentry")
3572         if test $? -eq 0; then
3573             regvalue=$_regvalue
3574         fi
3575     fi
3578 # Get a value from the 32-bit side of the Registry
3579 reg_get_value_32()
3581     reg_get_value "32" "$1"
3584 # Get a value from the 64-bit side of the Registry
3585 reg_get_value_64()
3587     reg_get_value "64" "$1"
3590 case "$host_os" in
3591 cygwin*|wsl*)
3592     COM=MSC
3593     USING_X11=
3594     OS=WNT
3595     RTL_OS=Windows
3596     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3597         P_SEP=";"
3598     else
3599         P_SEP=:
3600     fi
3601     case "$host_cpu" in
3602     x86_64)
3603         CPUNAME=X86_64
3604         RTL_ARCH=X86_64
3605         PLATFORMID=windows_x86_64
3606         WINDOWS_X64=1
3607         SCPDEFS="$SCPDEFS -DWINDOWS_X64"
3608         WIN_HOST_ARCH="x64"
3609         WIN_MULTI_ARCH="x86"
3610         WIN_HOST_BITS=64
3611         ;;
3612     i*86)
3613         CPUNAME=INTEL
3614         RTL_ARCH=x86
3615         PLATFORMID=windows_x86
3616         WIN_HOST_ARCH="x86"
3617         WIN_HOST_BITS=32
3618         WIN_OTHER_ARCH="x64"
3619         ;;
3620     aarch64)
3621         CPUNAME=AARCH64
3622         RTL_ARCH=AARCH64
3623         PLATFORMID=windows_aarch64
3624         WINDOWS_X64=1
3625         SCPDEFS="$SCPDEFS -DWINDOWS_AARCH64"
3626         WIN_HOST_ARCH="arm64"
3627         WIN_HOST_BITS=64
3628         with_ucrt_dir=no
3629         ;;
3630     *)
3631         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3632         ;;
3633     esac
3635     case "$build_cpu" in
3636     x86_64) WIN_BUILD_ARCH="x64" ;;
3637     i*86) WIN_BUILD_ARCH="x86" ;;
3638     aarch64) WIN_BUILD_ARCH="arm64" ;;
3639     *)
3640         AC_MSG_ERROR([Unsupported build_cpu $build_cpu for host_os $host_os])
3641         ;;
3642     esac
3644     SCPDEFS="$SCPDEFS -D_MSC_VER"
3645     ;;
3646 esac
3648 # multi-arch is an arch, which can execute on the host (x86 on x64), while
3649 # other-arch won't, but wouldn't break the build (x64 on x86).
3650 if test -n "$WIN_MULTI_ARCH" -a -n "$WIN_OTHER_ARCH"; then
3651     AC_MSG_ERROR([Broken configure.ac file: can't have set \$WIN_MULTI_ARCH and $WIN_OTHER_ARCH])
3655 if test "$_os" = "iOS" -o "$build_cpu" != "$host_cpu"; then
3656     # To allow building Windows multi-arch releases without cross-tooling
3657     if test -z "$WIN_MULTI_ARCH" -a -z "$WIN_OTHER_ARCH"; then
3658         cross_compiling="yes"
3659     fi
3661 if test "$cross_compiling" = "yes"; then
3662     export CROSS_COMPILING=TRUE
3663 else
3664     CROSS_COMPILING=
3665     BUILD_TYPE="$BUILD_TYPE NATIVE"
3667 AC_SUBST(CROSS_COMPILING)
3669 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3670 # NOTE: must _not_ be used for bundled external libraries!
3671 ISYSTEM=
3672 if test "$GCC" = "yes"; then
3673     AC_MSG_CHECKING( for -isystem )
3674     save_CFLAGS=$CFLAGS
3675     CFLAGS="$CFLAGS -Werror"
3676     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3677     CFLAGS=$save_CFLAGS
3678     if test -n "$ISYSTEM"; then
3679         AC_MSG_RESULT(yes)
3680     else
3681         AC_MSG_RESULT(no)
3682     fi
3684 if test -z "$ISYSTEM"; then
3685     # fall back to using -I
3686     ISYSTEM=-I
3688 AC_SUBST(ISYSTEM)
3690 dnl ===================================================================
3691 dnl  Check which Visual Studio compiler is used
3692 dnl ===================================================================
3694 map_vs_year_to_version()
3696     # Return value: $vsversion
3698     unset vsversion
3700     case $1 in
3701     2019)
3702         vsversion=16;;
3703     *)
3704         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3705     esac
3708 vs_versions_to_check()
3710     # Args: $1 (optional) : versions to check, in the order of preference
3711     # Return value: $vsversions
3713     unset vsversions
3715     if test -n "$1"; then
3716         map_vs_year_to_version "$1"
3717         vsversions=$vsversion
3718     else
3719         # We accept only 2019
3720         vsversions="16"
3721     fi
3724 win_get_env_from_vsvars32bat()
3726     local WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3727     # Also seems to be located in another directory under the same name: vsvars32.bat
3728     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3729     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3730     # use 'echo.%ENV%' syntax (instead of 'echo %ENV%') to avoid outputting "ECHO is off." in case when ENV is empty or a space
3731     printf '@setlocal\r\n@echo.%%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3732     local result
3733     if test "$build_os" = "wsl"; then
3734         result=$(cd /mnt/c && cmd.exe /c $(wslpath -w $WRAPPERBATCHFILEPATH) | tr -d '\r')
3735     else
3736         chmod +x $WRAPPERBATCHFILEPATH
3737         result=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3738     fi
3739     rm -f $WRAPPERBATCHFILEPATH
3740     printf '%s' "$result"
3743 find_ucrt()
3745     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3746     if test -n "$regvalue"; then
3747         PathFormat "$regvalue"
3748         UCRTSDKDIR=$formatted_path_unix
3749         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3750         UCRTVERSION=$regvalue
3751         # Rest if not exist
3752         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3753           UCRTSDKDIR=
3754         fi
3755     fi
3756     if test -z "$UCRTSDKDIR"; then
3757         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3758         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3759         if test -f "$ide_env_file"; then
3760             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3761             UCRTSDKDIR=$formatted_path
3762             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3763             dnl Hack needed at least by tml:
3764             if test "$UCRTVERSION" = 10.0.15063.0 \
3765                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3766                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3767             then
3768                 UCRTVERSION=10.0.14393.0
3769             fi
3770         else
3771           AC_MSG_ERROR([No UCRT found])
3772         fi
3773     fi
3776 find_msvc()
3778     # Find Visual C++ 2019
3779     # Args: $1 (optional) : The VS version year
3780     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3782     unset vctest vcnum vcnumwithdot vcbuildnumber
3784     vs_versions_to_check "$1"
3785     if test "$build_os" = wsl; then
3786         vswhere="$PROGRAMFILESX86"
3787     else
3788         vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3789     fi
3790     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3791     PathFormat "$vswhere"
3792     vswhere=$formatted_path_unix
3793     for ver in $vsversions; do
3794         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3795         # Fall back to all MS products (this includes VC++ Build Tools)
3796         if ! test -n "$vswhereoutput"; then
3797             AC_MSG_CHECKING([VC++ Build Tools and similar])
3798             vswhereoutput=`$vswhere -products \* -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3799         fi
3800         if test -n "$vswhereoutput"; then
3801             PathFormat "$vswhereoutput"
3802             vctest=$formatted_path_unix
3803             break
3804         fi
3805     done
3807     if test -n "$vctest"; then
3808         vcnumwithdot="$ver.0"
3809         case "$vcnumwithdot" in
3810         16.0)
3811             vcyear=2019
3812             vcnum=160
3813             ;;
3814         esac
3815         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3817     fi
3820 test_cl_exe()
3822     AC_MSG_CHECKING([$1 compiler])
3824     CL_EXE_PATH="$2/cl.exe"
3826     if test ! -f "$CL_EXE_PATH"; then
3827         if test "$1" = "multi-arch"; then
3828             AC_MSG_WARN([no compiler (cl.exe) in $2])
3829             return 1
3830         else
3831             AC_MSG_ERROR([no compiler (cl.exe) in $2])
3832         fi
3833     fi
3835     dnl ===========================================================
3836     dnl  Check for the corresponding mspdb*.dll
3837     dnl ===========================================================
3839     # MSVC 15.0 has libraries from 14.0?
3840     mspdbnum="140"
3842     if test ! -e "$2/mspdb${mspdbnum}.dll"; then
3843         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $2, Visual Studio installation broken?])
3844     fi
3846     # The compiles has to find its shared libraries
3847     OLD_PATH="$PATH"
3848     TEMP_PATH=`cygpath -d "$2"`
3849     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3851     if ! "$CL_EXE_PATH" -? </dev/null >/dev/null 2>&1; then
3852         AC_MSG_ERROR([no compiler (cl.exe) in $2])
3853     fi
3855     PATH="$OLD_PATH"
3857     AC_MSG_RESULT([$CL_EXE_PATH])
3860 SOLARINC=
3861 MSBUILD_PATH=
3862 DEVENV=
3863 if test "$_os" = "WINNT"; then
3864     AC_MSG_CHECKING([Visual C++])
3865     find_msvc "$with_visual_studio"
3866     if test -z "$vctest"; then
3867         if test -n "$with_visual_studio"; then
3868             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
3869         else
3870             AC_MSG_ERROR([no Visual Studio 2019 installation found])
3871         fi
3872     fi
3873     AC_MSG_RESULT([])
3875     VC_PRODUCT_DIR="$vctest/VC"
3876     COMPATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber"
3878     # $WIN_OTHER_ARCH is a hack to test the x64 compiler on x86, even if it's not multi-arch
3879     if test -n "$WIN_MULTI_ARCH" -o -n "$WIN_OTHER_ARCH"; then
3880         MSVC_MULTI_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/${WIN_MULTI_ARCH}${WIN_OTHER_ARCH}"
3881         test_cl_exe "multi-arch" "$MSVC_MULTI_PATH"
3882         if test $? -ne 0; then
3883             WIN_MULTI_ARCH=""
3884             WIN_OTHER_ARCH=""
3885         fi
3886     fi
3888     if test "$WIN_BUILD_ARCH" = "$WIN_HOST_ARCH"; then
3889         MSVC_BUILD_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_BUILD_ARCH"
3890         test_cl_exe "build" "$MSVC_BUILD_PATH"
3891     fi
3893     if test "$WIN_BUILD_ARCH" != "$WIN_HOST_ARCH"; then
3894         MSVC_HOST_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_HOST_ARCH"
3895         test_cl_exe "host" "$MSVC_HOST_PATH"
3896     else
3897         MSVC_HOST_PATH="$MSVC_BUILD_PATH"
3898     fi
3900     AC_MSG_CHECKING([for short pathname of VC product directory])
3901     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3902     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3904     UCRTSDKDIR=
3905     UCRTVERSION=
3907     AC_MSG_CHECKING([for UCRT location])
3908     find_ucrt
3909     # find_ucrt errors out if it doesn't find it
3910     AC_MSG_RESULT([$UCRTSDKDIR ($UCRTVERSION)])
3911     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3912     ucrtincpath_formatted=$formatted_path
3913     # SOLARINC is used for external modules and must be set too.
3914     # And no, it's not sufficient to set SOLARINC only, as configure
3915     # itself doesn't honour it.
3916     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3917     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3918     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3919     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3921     AC_SUBST(UCRTSDKDIR)
3922     AC_SUBST(UCRTVERSION)
3924     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3925     # Find the proper version of MSBuild.exe to use based on the VS version
3926     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3927     if test -n "$regvalue" ; then
3928         AC_MSG_RESULT([found: $regvalue])
3929         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3930     else
3931         if test "$vcnumwithdot" = "16.0"; then
3932             if test "$WIN_BUILD_ARCH" != "x64"; then
3933                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3934             else
3935                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3936             fi
3937         else
3938             if test "$WIN_BUILD_ARCH" != "x64"; then
3939                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3940             else
3941                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3942             fi
3943         fi
3944         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3945         AC_MSG_RESULT([$regvalue])
3946     fi
3948     # Find the version of devenv.exe
3949     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3950     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3951     DEVENV_unix=$(cygpath -u "$DEVENV")
3952     if test ! -e "$DEVENV_unix"; then
3953         AC_MSG_WARN([No devenv.exe found - this is expected for VC++ Build Tools])
3954     fi
3956     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3957     dnl needed when building CLR code:
3958     if test -z "$MSVC_CXX"; then
3959         # This gives us a posix path with 8.3 filename restrictions
3960         MSVC_CXX=`win_short_path_for_make "$MSVC_HOST_PATH/cl.exe"`
3961     fi
3963     if test -z "$CC"; then
3964         CC=$MSVC_CXX
3965         CC_BASE=`first_arg_basename "$CC"`
3966     fi
3967     if test -z "$CXX"; then
3968         CXX=$MSVC_CXX
3969         CXX_BASE=`first_arg_basename "$CXX"`
3970     fi
3972     if test -n "$CC"; then
3973         # Remove /cl.exe from CC case insensitive
3974         AC_MSG_NOTICE([found Visual C++ $vcyear])
3976         main_include_dir=`cygpath -d -m "$COMPATH/Include"`
3977         CPPFLAGS="$CPPFLAGS -I$main_include_dir"
3979         PathFormat "$COMPATH"
3980         COMPATH=`win_short_path_for_make "$formatted_path"`
3982         VCVER=$vcnum
3984         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3985         # are always "better", we list them in reverse chronological order.
3987         case "$vcnum" in
3988         160)
3989             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
3990             ;;
3991         esac
3993         # The expectation is that --with-windows-sdk should not need to be used
3994         if test -n "$with_windows_sdk"; then
3995             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3996             *" "$with_windows_sdk" "*)
3997                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3998                 ;;
3999             *)
4000                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $vcyear])
4001                 ;;
4002             esac
4003         fi
4005         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
4006         ac_objext=obj
4007         ac_exeext=exe
4009     else
4010         AC_MSG_ERROR([Visual C++ not found after all, huh])
4011     fi
4013     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.5])
4014     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4015         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
4016         // between Visual Studio versions and _MSC_VER:
4017         #if _MSC_VER < 1925
4018         #error
4019         #endif
4020     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
4022     # Check for 64-bit (cross-)compiler to use to build the 64-bit
4023     # version of the Explorer extension (and maybe other small
4024     # bits, too) needed when installing a 32-bit LibreOffice on a
4025     # 64-bit OS. The 64-bit Explorer extension is a feature that
4026     # has been present since long in OOo. Don't confuse it with
4027     # building LibreOffice itself as 64-bit code.
4029     BUILD_X64=
4030     CXX_X64_BINARY=
4032     if test "$WIN_HOST_ARCH" = "x86" -a -n "$WIN_OTHER_ARCH"; then
4033         AC_MSG_CHECKING([for the libraries to build the 64-bit Explorer extensions])
4034         if test -f "$COMPATH/atlmfc/lib/x64/atls.lib" -o \
4035              -f "$COMPATH/atlmfc/lib/spectre/x64/atls.lib"
4036         then
4037             BUILD_X64=TRUE
4038             CXX_X64_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4039             AC_MSG_RESULT([found])
4040         else
4041             AC_MSG_RESULT([not found])
4042             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
4043         fi
4044     elif test "$WIN_HOST_ARCH" = "x64"; then
4045         CXX_X64_BINARY=$CXX
4046     fi
4047     AC_SUBST(BUILD_X64)
4049     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
4050     AC_SUBST(CXX_X64_BINARY)
4052     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
4053     # needed to support TWAIN scan on both 32- and 64-bit systems
4055     case "$WIN_HOST_ARCH" in
4056     x64)
4057         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
4058         if test -n "$CXX_X86_BINARY"; then
4059             BUILD_X86=TRUE
4060             AC_MSG_RESULT([preset])
4061         elif test -n "$WIN_MULTI_ARCH"; then
4062             BUILD_X86=TRUE
4063             CXX_X86_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4064             CXX_X86_BINARY+=" /arch:SSE"
4065             AC_MSG_RESULT([found])
4066         else
4067             AC_MSG_RESULT([not found])
4068             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
4069         fi
4070         ;;
4071     x86)
4072         BUILD_X86=TRUE
4073         CXX_X86_BINARY=$MSVC_CXX
4074         ;;
4075     esac
4076     AC_SUBST(BUILD_X86)
4077     AC_SUBST(CXX_X86_BINARY)
4079 AC_SUBST(VCVER)
4080 AC_SUBST(DEVENV)
4081 AC_SUBST(MSVC_CXX)
4083 COM_IS_CLANG=
4084 AC_MSG_CHECKING([whether the compiler is actually Clang])
4085 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4086     #ifndef __clang__
4087     you lose
4088     #endif
4089     int foo=42;
4090     ]])],
4091     [AC_MSG_RESULT([yes])
4092      COM_IS_CLANG=TRUE],
4093     [AC_MSG_RESULT([no])])
4094 AC_SUBST(COM_IS_CLANG)
4096 CC_PLAIN=$CC
4097 CLANGVER=
4098 if test "$COM_IS_CLANG" = TRUE; then
4099     AC_MSG_CHECKING([whether Clang is new enough])
4100     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4101         #if !defined __apple_build_version__
4102         #error
4103         #endif
4104         ]])],
4105         [my_apple_clang=yes],[my_apple_clang=])
4106     if test "$my_apple_clang" = yes; then
4107         AC_MSG_RESULT([assumed yes (Apple Clang)])
4108     else
4109         if test "$_os" = WINNT; then
4110             dnl In which case, assume clang-cl:
4111             my_args="/EP /TC"
4112             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
4113             dnl clang-cl:
4114             CC_PLAIN=
4115             for i in $CC; do
4116                 case $i in
4117                 -FIIntrin.h)
4118                     ;;
4119                 *)
4120                     CC_PLAIN="$CC_PLAIN $i"
4121                     ;;
4122                 esac
4123             done
4124         else
4125             my_args="-E -P"
4126         fi
4127         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
4128         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
4129         CLANGVER=`echo $clang_version \
4130             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
4131         if test "$CLANGVER" -ge 50002; then
4132             AC_MSG_RESULT([yes ($clang_version)])
4133         else
4134             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
4135         fi
4136         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
4137         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
4138     fi
4141 SHOWINCLUDES_PREFIX=
4142 if test "$_os" = WINNT; then
4143     dnl We need to guess the prefix of the -showIncludes output, it can be
4144     dnl localized
4145     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
4146     echo "#include <stdlib.h>" > conftest.c
4147     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
4148         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
4149     rm -f conftest.c conftest.obj
4150     if test -z "$SHOWINCLUDES_PREFIX"; then
4151         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
4152     else
4153         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
4154     fi
4156 AC_SUBST(SHOWINCLUDES_PREFIX)
4159 # prefix C with ccache if needed
4161 UNCACHED_CC="$CC"
4162 if test "$CCACHE" != ""; then
4163     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
4165     AC_LANG_PUSH([C])
4166     save_CFLAGS=$CFLAGS
4167     CFLAGS="$CFLAGS --ccache-skip -O2"
4168     dnl an empty program will do, we're checking the compiler flags
4169     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
4170                       [use_ccache=yes], [use_ccache=no])
4171     CFLAGS=$save_CFLAGS
4172     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
4173         AC_MSG_RESULT([yes])
4174     else
4175         CC="$CCACHE $CC"
4176         CC_BASE="ccache $CC_BASE"
4177         AC_MSG_RESULT([no])
4178     fi
4179     AC_LANG_POP([C])
4182 # ===================================================================
4183 # check various GCC options that Clang does not support now but maybe
4184 # will somewhen in the future, check them even for GCC, so that the
4185 # flags are set
4186 # ===================================================================
4188 HAVE_GCC_GGDB2=
4189 if test "$GCC" = "yes"; then
4190     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
4191     save_CFLAGS=$CFLAGS
4192     CFLAGS="$CFLAGS -Werror -ggdb2"
4193     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
4194     CFLAGS=$save_CFLAGS
4195     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
4196         AC_MSG_RESULT([yes])
4197     else
4198         AC_MSG_RESULT([no])
4199     fi
4201     if test "$host_cpu" = "m68k"; then
4202         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
4203         save_CFLAGS=$CFLAGS
4204         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
4205         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
4206         CFLAGS=$save_CFLAGS
4207         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
4208             AC_MSG_RESULT([yes])
4209         else
4210             AC_MSG_ERROR([no])
4211         fi
4212     fi
4214 AC_SUBST(HAVE_GCC_GGDB2)
4216 dnl ===================================================================
4217 dnl  Test the gcc version
4218 dnl ===================================================================
4219 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
4220     AC_MSG_CHECKING([the GCC version])
4221     _gcc_version=`$CC -dumpversion`
4222     gcc_full_version=$(printf '%s' "$_gcc_version" | \
4223         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
4224     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
4226     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
4228     if test "$gcc_full_version" -lt 70000; then
4229         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
4230     fi
4231 else
4232     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
4233     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
4234     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
4235     # (which reports itself as GCC 4.2.1).
4236     GCC_VERSION=
4238 AC_SUBST(GCC_VERSION)
4240 dnl Set the ENABLE_DBGUTIL variable
4241 dnl ===================================================================
4242 AC_MSG_CHECKING([whether to build with additional debug utilities])
4243 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
4244     ENABLE_DBGUTIL="TRUE"
4245     # this is an extra var so it can have different default on different MSVC
4246     # versions (in case there are version specific problems with it)
4247     MSVC_USE_DEBUG_RUNTIME="TRUE"
4249     AC_MSG_RESULT([yes])
4250     # cppunit and graphite expose STL in public headers
4251     if test "$with_system_cppunit" = "yes"; then
4252         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
4253     else
4254         with_system_cppunit=no
4255     fi
4256     if test "$with_system_graphite" = "yes"; then
4257         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
4258     else
4259         with_system_graphite=no
4260     fi
4261     if test "$with_system_orcus" = "yes"; then
4262         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
4263     else
4264         with_system_orcus=no
4265     fi
4266     if test "$with_system_libcmis" = "yes"; then
4267         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
4268     else
4269         with_system_libcmis=no
4270     fi
4271     if test "$with_system_hunspell" = "yes"; then
4272         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
4273     else
4274         with_system_hunspell=no
4275     fi
4276     if test "$with_system_gpgmepp" = "yes"; then
4277         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
4278     else
4279         with_system_gpgmepp=no
4280     fi
4281     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
4282     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
4283     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
4284     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
4285     # of those two is using the system variant:
4286     if test "$with_system_libnumbertext" = "yes"; then
4287         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
4288     else
4289         with_system_libnumbertext=no
4290     fi
4291     if test "$with_system_libwps" = "yes"; then
4292         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
4293     else
4294         with_system_libwps=no
4295     fi
4296 else
4297     ENABLE_DBGUTIL=""
4298     MSVC_USE_DEBUG_RUNTIME=""
4299     AC_MSG_RESULT([no])
4301 AC_SUBST(ENABLE_DBGUTIL)
4302 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
4304 dnl Set the ENABLE_DEBUG variable.
4305 dnl ===================================================================
4306 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
4307     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
4309 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
4310     if test -z "$libo_fuzzed_enable_debug"; then
4311         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
4312     else
4313         AC_MSG_NOTICE([Resetting --enable-debug=yes])
4314         enable_debug=yes
4315     fi
4318 AC_MSG_CHECKING([whether to do a debug build])
4319 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
4320     ENABLE_DEBUG="TRUE"
4321     if test -n "$ENABLE_DBGUTIL" ; then
4322         AC_MSG_RESULT([yes (dbgutil)])
4323     else
4324         AC_MSG_RESULT([yes])
4325     fi
4326 else
4327     ENABLE_DEBUG=""
4328     AC_MSG_RESULT([no])
4330 AC_SUBST(ENABLE_DEBUG)
4332 dnl ===================================================================
4333 dnl Select the linker to use (gold/lld/ld.bfd).
4334 dnl This is done only after compiler checks (need to know if Clang is
4335 dnl used, for different defaults) and after checking if a debug build
4336 dnl is wanted (non-debug builds get the default linker if not explicitly
4337 dnl specified otherwise).
4338 dnl All checks for linker features/options should come after this.
4339 dnl ===================================================================
4340 check_use_ld()
4342     use_ld=-fuse-ld=${1%%:*}
4343     use_ld_path=${1#*:}
4344     if test "$use_ld_path" != "$1"; then
4345         use_ld="$use_ld --ld-path=$use_ld_path"
4346     fi
4347     use_ld_fail_if_error=$2
4348     use_ld_ok=
4349     AC_MSG_CHECKING([for $use_ld linker support])
4350     use_ld_ldflags_save="$LDFLAGS"
4351     LDFLAGS="$LDFLAGS $use_ld"
4352     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4353 #include <stdio.h>
4354         ],[
4355 printf ("hello world\n");
4356         ])], USE_LD=$use_ld, [])
4357     if test -n "$USE_LD"; then
4358         AC_MSG_RESULT( yes )
4359         use_ld_ok=yes
4360     else
4361         if test -n "$use_ld_fail_if_error"; then
4362             AC_MSG_ERROR( no )
4363         else
4364             AC_MSG_RESULT( no )
4365         fi
4366     fi
4367     if test -n "$use_ld_ok"; then
4368         dnl keep the value of LDFLAGS
4369         return 0
4370     fi
4371     LDFLAGS="$use_ld_ldflags_save"
4372     return 1
4374 USE_LD=
4375 if test "$enable_ld" != "no"; then
4376     if test "$GCC" = "yes"; then
4377         if test -n "$enable_ld"; then
4378             check_use_ld "$enable_ld" fail_if_error
4379         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4380             dnl non-debug builds default to the default linker
4381             true
4382         elif test -n "$COM_IS_CLANG"; then
4383             check_use_ld lld
4384             if test $? -ne 0; then
4385                 check_use_ld gold
4386             fi
4387         else
4388             # For gcc first try gold, new versions also support lld.
4389             check_use_ld gold
4390             if test $? -ne 0; then
4391                 check_use_ld lld
4392             fi
4393         fi
4394         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4395         rm conftest.out
4396         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4397         if test -z "$ld_used"; then
4398             ld_used="unknown"
4399         fi
4400         AC_MSG_CHECKING([for linker that is used])
4401         AC_MSG_RESULT([$ld_used])
4402         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4403             if echo "$ld_used" | grep -q "^GNU ld"; then
4404                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4405                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4406             fi
4407         fi
4408     else
4409         if test "$enable_ld" = "yes"; then
4410             AC_MSG_ERROR([--enable-ld not supported])
4411         fi
4412     fi
4414 AC_SUBST(USE_LD)
4416 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4417 if test "$GCC" = "yes"; then
4418     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4419     bsymbolic_functions_ldflags_save=$LDFLAGS
4420     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4421     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4422 #include <stdio.h>
4423         ],[
4424 printf ("hello world\n");
4425         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4426     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4427         AC_MSG_RESULT( found )
4428     else
4429         AC_MSG_RESULT( not found )
4430     fi
4431     LDFLAGS=$bsymbolic_functions_ldflags_save
4433 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4435 LD_GC_SECTIONS=
4436 if test "$GCC" = "yes"; then
4437     for flag in "--gc-sections" "-dead_strip"; do
4438         AC_MSG_CHECKING([for $flag linker support])
4439         ldflags_save=$LDFLAGS
4440         LDFLAGS="$LDFLAGS -Wl,$flag"
4441         AC_LINK_IFELSE([AC_LANG_PROGRAM([
4442 #include <stdio.h>
4443             ],[
4444 printf ("hello world\n");
4445             ])],[
4446             LD_GC_SECTIONS="-Wl,$flag"
4447             AC_MSG_RESULT( found )
4448             ], [
4449             AC_MSG_RESULT( not found )
4450             ])
4451         LDFLAGS=$ldflags_save
4452         if test -n "$LD_GC_SECTIONS"; then
4453             break
4454         fi
4455     done
4457 AC_SUBST(LD_GC_SECTIONS)
4459 HAVE_GSPLIT_DWARF=
4460 if test "$enable_split_debug" != no; then
4461     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4462     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4463         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4464         save_CFLAGS=$CFLAGS
4465         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4466         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4467         CFLAGS=$save_CFLAGS
4468         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4469             AC_MSG_RESULT([yes])
4470         else
4471             if test "$enable_split_debug" = yes; then
4472                 AC_MSG_ERROR([no])
4473             else
4474                 AC_MSG_RESULT([no])
4475             fi
4476         fi
4477     fi
4478     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4479         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4480         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4481     fi
4483 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4485 HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=
4486 AC_MSG_CHECKING([whether $CC_BASE supports -Xclang -debug-info-kind=constructor])
4487 save_CFLAGS=$CFLAGS
4488 CFLAGS="$CFLAGS -Werror -Xclang -debug-info-kind=constructor"
4489 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=TRUE ],[])
4490 CFLAGS=$save_CFLAGS
4491 if test "$HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR" = "TRUE"; then
4492     AC_MSG_RESULT([yes])
4493 else
4494     AC_MSG_RESULT([no])
4496 AC_SUBST(HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR)
4498 ENABLE_GDB_INDEX=
4499 if test "$enable_gdb_index" != "no"; then
4500     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4501     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4502         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4503         save_CFLAGS=$CFLAGS
4504         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4505         have_ggnu_pubnames=
4506         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4507         if test "$have_ggnu_pubnames" != "TRUE"; then
4508             if test "$enable_gdb_index" = "yes"; then
4509                 AC_MSG_ERROR([no, --enable-gdb-index not supported])
4510             else
4511                 AC_MSG_RESULT( no )
4512             fi
4513         else
4514             AC_MSG_RESULT( yes )
4515             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4516             ldflags_save=$LDFLAGS
4517             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4518             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4519 #include <stdio.h>
4520                 ],[
4521 printf ("hello world\n");
4522                 ])], ENABLE_GDB_INDEX=TRUE, [])
4523             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4524                 AC_MSG_RESULT( yes )
4525             else
4526                 if test "$enable_gdb_index" = "yes"; then
4527                     AC_MSG_ERROR( no )
4528                 else
4529                     AC_MSG_RESULT( no )
4530                 fi
4531             fi
4532             LDFLAGS=$ldflags_save
4533         fi
4534         CFLAGS=$save_CFLAGS
4535         fi
4536     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4537         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4538         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4539     fi
4541 AC_SUBST(ENABLE_GDB_INDEX)
4543 if test -z "$enable_sal_log" && test "$ENABLE_DEBUG" = TRUE; then
4544     enable_sal_log=yes
4546 if test "$enable_sal_log" = yes; then
4547     ENABLE_SAL_LOG=TRUE
4549 AC_SUBST(ENABLE_SAL_LOG)
4551 dnl Check for enable symbols option
4552 dnl ===================================================================
4553 AC_MSG_CHECKING([whether to generate debug information])
4554 if test -z "$enable_symbols"; then
4555     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4556         enable_symbols=yes
4557     else
4558         enable_symbols=no
4559     fi
4561 if test "$enable_symbols" = yes; then
4562     ENABLE_SYMBOLS_FOR=all
4563     AC_MSG_RESULT([yes])
4564 elif test "$enable_symbols" = no; then
4565     ENABLE_SYMBOLS_FOR=
4566     AC_MSG_RESULT([no])
4567 else
4568     # Selective debuginfo.
4569     ENABLE_SYMBOLS_FOR="$enable_symbols"
4570     AC_MSG_RESULT([for "$enable_symbols"])
4572 AC_SUBST(ENABLE_SYMBOLS_FOR)
4574 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4575     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4576     AC_MSG_CHECKING([whether enough memory is available for linking])
4577     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4578     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4579     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4580         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4581     else
4582         AC_MSG_RESULT([yes])
4583     fi
4586 ENABLE_OPTIMIZED=
4587 ENABLE_OPTIMIZED_DEBUG=
4588 AC_MSG_CHECKING([whether to compile with optimization flags])
4589 if test -z "$enable_optimized"; then
4590     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4591         enable_optimized=no
4592     else
4593         enable_optimized=yes
4594     fi
4596 if test "$enable_optimized" = yes; then
4597     ENABLE_OPTIMIZED=TRUE
4598     AC_MSG_RESULT([yes])
4599 elif test "$enable_optimized" = debug; then
4600     ENABLE_OPTIMIZED_DEBUG=TRUE
4601     AC_MSG_RESULT([yes (debug)])
4602     HAVE_GCC_OG=
4603     if test "$GCC" = "yes"; then
4604         AC_MSG_CHECKING([whether $CC_BASE supports -Og])
4605         save_CFLAGS=$CFLAGS
4606         CFLAGS="$CFLAGS -Werror -Og"
4607         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[])
4608         CFLAGS=$save_CFLAGS
4609         if test "$HAVE_GCC_OG" = "TRUE"; then
4610             AC_MSG_RESULT([yes])
4611         else
4612             AC_MSG_RESULT([no])
4613         fi
4614     fi
4615     if test -z "$HAVE_GCC_OG"; then
4616         AC_MSG_ERROR([The compiler does not support optimizations suitable for debugging.])
4617     fi
4618 else
4619     AC_MSG_RESULT([no])
4621 AC_SUBST(ENABLE_OPTIMIZED)
4622 AC_SUBST(ENABLE_OPTIMIZED_DEBUG)
4625 # determine CPUNAME, OS, ...
4626 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4628 case "$host_os" in
4630 aix*)
4631     COM=GCC
4632     CPUNAME=POWERPC
4633     USING_X11=TRUE
4634     OS=AIX
4635     RTL_OS=AIX
4636     RTL_ARCH=PowerPC
4637     PLATFORMID=aix_powerpc
4638     P_SEP=:
4639     ;;
4641 cygwin*|wsl*)
4642     # Already handled
4643     ;;
4645 darwin*|macos*)
4646     COM=GCC
4647     USING_X11=
4648     OS=MACOSX
4649     RTL_OS=MacOSX
4650     P_SEP=:
4652     case "$host_cpu" in
4653     aarch64|arm64)
4654         if test "$enable_ios_simulator" = "yes"; then
4655             OS=iOS
4656         else
4657             CPUNAME=AARCH64
4658             RTL_ARCH=AARCH64
4659             PLATFORMID=macosx_aarch64
4660         fi
4661         ;;
4662     x86_64)
4663         if test "$enable_ios_simulator" = "yes"; then
4664             OS=iOS
4665         fi
4666         CPUNAME=X86_64
4667         RTL_ARCH=X86_64
4668         PLATFORMID=macosx_x86_64
4669         ;;
4670     *)
4671         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4672         ;;
4673     esac
4674     ;;
4676 ios*)
4677     COM=GCC
4678     USING_X11=
4679     OS=iOS
4680     RTL_OS=iOS
4681     P_SEP=:
4683     case "$host_cpu" in
4684     aarch64|arm64)
4685         if test "$enable_ios_simulator" = "yes"; then
4686             AC_MSG_ERROR([iOS simulator is only available in macOS not iOS])
4687         fi
4688         ;;
4689     *)
4690         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4691         ;;
4692     esac
4693     CPUNAME=AARCH64
4694     RTL_ARCH=AARCH64
4695     PLATFORMID=ios_arm64
4696     ;;
4698 dragonfly*)
4699     COM=GCC
4700     USING_X11=TRUE
4701     OS=DRAGONFLY
4702     RTL_OS=DragonFly
4703     P_SEP=:
4705     case "$host_cpu" in
4706     i*86)
4707         CPUNAME=INTEL
4708         RTL_ARCH=x86
4709         PLATFORMID=dragonfly_x86
4710         ;;
4711     x86_64)
4712         CPUNAME=X86_64
4713         RTL_ARCH=X86_64
4714         PLATFORMID=dragonfly_x86_64
4715         ;;
4716     *)
4717         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4718         ;;
4719     esac
4720     ;;
4722 freebsd*)
4723     COM=GCC
4724     USING_X11=TRUE
4725     RTL_OS=FreeBSD
4726     OS=FREEBSD
4727     P_SEP=:
4729     case "$host_cpu" in
4730     aarch64)
4731         CPUNAME=AARCH64
4732         PLATFORMID=freebsd_aarch64
4733         RTL_ARCH=AARCH64
4734         ;;
4735     i*86)
4736         CPUNAME=INTEL
4737         RTL_ARCH=x86
4738         PLATFORMID=freebsd_x86
4739         ;;
4740     x86_64|amd64)
4741         CPUNAME=X86_64
4742         RTL_ARCH=X86_64
4743         PLATFORMID=freebsd_x86_64
4744         ;;
4745     powerpc64)
4746         CPUNAME=POWERPC64
4747         RTL_ARCH=PowerPC_64
4748         PLATFORMID=freebsd_powerpc64
4749         ;;
4750     powerpc|powerpcspe)
4751         CPUNAME=POWERPC
4752         RTL_ARCH=PowerPC
4753         PLATFORMID=freebsd_powerpc
4754         ;;
4755     *)
4756         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4757         ;;
4758     esac
4759     ;;
4761 haiku*)
4762     COM=GCC
4763     USING_X11=
4764     GUIBASE=haiku
4765     RTL_OS=Haiku
4766     OS=HAIKU
4767     P_SEP=:
4769     case "$host_cpu" in
4770     i*86)
4771         CPUNAME=INTEL
4772         RTL_ARCH=x86
4773         PLATFORMID=haiku_x86
4774         ;;
4775     x86_64|amd64)
4776         CPUNAME=X86_64
4777         RTL_ARCH=X86_64
4778         PLATFORMID=haiku_x86_64
4779         ;;
4780     *)
4781         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4782         ;;
4783     esac
4784     ;;
4786 kfreebsd*)
4787     COM=GCC
4788     USING_X11=TRUE
4789     OS=LINUX
4790     RTL_OS=kFreeBSD
4791     P_SEP=:
4793     case "$host_cpu" in
4795     i*86)
4796         CPUNAME=INTEL
4797         RTL_ARCH=x86
4798         PLATFORMID=kfreebsd_x86
4799         ;;
4800     x86_64)
4801         CPUNAME=X86_64
4802         RTL_ARCH=X86_64
4803         PLATFORMID=kfreebsd_x86_64
4804         ;;
4805     *)
4806         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4807         ;;
4808     esac
4809     ;;
4811 linux-gnu*)
4812     COM=GCC
4813     USING_X11=TRUE
4814     OS=LINUX
4815     RTL_OS=Linux
4816     P_SEP=:
4818     case "$host_cpu" in
4820     aarch64)
4821         CPUNAME=AARCH64
4822         PLATFORMID=linux_aarch64
4823         RTL_ARCH=AARCH64
4824         EPM_FLAGS="-a arm64"
4825         ;;
4826     alpha)
4827         CPUNAME=AXP
4828         RTL_ARCH=ALPHA
4829         PLATFORMID=linux_alpha
4830         ;;
4831     arm*)
4832         CPUNAME=ARM
4833         EPM_FLAGS="-a arm"
4834         RTL_ARCH=ARM_EABI
4835         PLATFORMID=linux_arm_eabi
4836         case "$host_cpu" in
4837         arm*-linux)
4838             RTL_ARCH=ARM_OABI
4839             PLATFORMID=linux_arm_oabi
4840             ;;
4841         esac
4842         ;;
4843     hppa)
4844         CPUNAME=HPPA
4845         RTL_ARCH=HPPA
4846         EPM_FLAGS="-a hppa"
4847         PLATFORMID=linux_hppa
4848         ;;
4849     i*86)
4850         CPUNAME=INTEL
4851         RTL_ARCH=x86
4852         PLATFORMID=linux_x86
4853         ;;
4854     ia64)
4855         CPUNAME=IA64
4856         RTL_ARCH=IA64
4857         PLATFORMID=linux_ia64
4858         ;;
4859     mips)
4860         CPUNAME=GODSON
4861         RTL_ARCH=MIPS_EB
4862         EPM_FLAGS="-a mips"
4863         PLATFORMID=linux_mips_eb
4864         ;;
4865     mips64)
4866         CPUNAME=GODSON64
4867         RTL_ARCH=MIPS64_EB
4868         EPM_FLAGS="-a mips64"
4869         PLATFORMID=linux_mips64_eb
4870         ;;
4871     mips64el)
4872         CPUNAME=GODSON64
4873         RTL_ARCH=MIPS64_EL
4874         EPM_FLAGS="-a mips64el"
4875         PLATFORMID=linux_mips64_el
4876         ;;
4877     mipsel)
4878         CPUNAME=GODSON
4879         RTL_ARCH=MIPS_EL
4880         EPM_FLAGS="-a mipsel"
4881         PLATFORMID=linux_mips_el
4882         ;;
4883     m68k)
4884         CPUNAME=M68K
4885         RTL_ARCH=M68K
4886         PLATFORMID=linux_m68k
4887         ;;
4888     powerpc)
4889         CPUNAME=POWERPC
4890         RTL_ARCH=PowerPC
4891         PLATFORMID=linux_powerpc
4892         ;;
4893     powerpc64)
4894         CPUNAME=POWERPC64
4895         RTL_ARCH=PowerPC_64
4896         PLATFORMID=linux_powerpc64
4897         ;;
4898     powerpc64le)
4899         CPUNAME=POWERPC64
4900         RTL_ARCH=PowerPC_64_LE
4901         PLATFORMID=linux_powerpc64_le
4902         ;;
4903     sparc)
4904         CPUNAME=SPARC
4905         RTL_ARCH=SPARC
4906         PLATFORMID=linux_sparc
4907         ;;
4908     sparc64)
4909         CPUNAME=SPARC64
4910         RTL_ARCH=SPARC64
4911         PLATFORMID=linux_sparc64
4912         ;;
4913     s390)
4914         CPUNAME=S390
4915         RTL_ARCH=S390
4916         PLATFORMID=linux_s390
4917         ;;
4918     s390x)
4919         CPUNAME=S390X
4920         RTL_ARCH=S390x
4921         PLATFORMID=linux_s390x
4922         ;;
4923     x86_64)
4924         CPUNAME=X86_64
4925         RTL_ARCH=X86_64
4926         PLATFORMID=linux_x86_64
4927         ;;
4928     *)
4929         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4930         ;;
4931     esac
4932     ;;
4934 linux-android*)
4935     COM=GCC
4936     USING_X11=
4937     OS=ANDROID
4938     RTL_OS=Android
4939     P_SEP=:
4941     case "$host_cpu" in
4943     arm|armel)
4944         CPUNAME=ARM
4945         RTL_ARCH=ARM_EABI
4946         PLATFORMID=android_arm_eabi
4947         ;;
4948     aarch64)
4949         CPUNAME=AARCH64
4950         RTL_ARCH=AARCH64
4951         PLATFORMID=android_aarch64
4952         ;;
4953     i*86)
4954         CPUNAME=INTEL
4955         RTL_ARCH=x86
4956         PLATFORMID=android_x86
4957         ;;
4958     x86_64)
4959         CPUNAME=X86_64
4960         RTL_ARCH=X86_64
4961         PLATFORMID=android_x86_64
4962         ;;
4963     *)
4964         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4965         ;;
4966     esac
4967     ;;
4969 *netbsd*)
4970     COM=GCC
4971     USING_X11=TRUE
4972     OS=NETBSD
4973     RTL_OS=NetBSD
4974     P_SEP=:
4976     case "$host_cpu" in
4977     i*86)
4978         CPUNAME=INTEL
4979         RTL_ARCH=x86
4980         PLATFORMID=netbsd_x86
4981         ;;
4982     powerpc)
4983         CPUNAME=POWERPC
4984         RTL_ARCH=PowerPC
4985         PLATFORMID=netbsd_powerpc
4986         ;;
4987     sparc)
4988         CPUNAME=SPARC
4989         RTL_ARCH=SPARC
4990         PLATFORMID=netbsd_sparc
4991         ;;
4992     x86_64)
4993         CPUNAME=X86_64
4994         RTL_ARCH=X86_64
4995         PLATFORMID=netbsd_x86_64
4996         ;;
4997     *)
4998         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4999         ;;
5000     esac
5001     ;;
5003 openbsd*)
5004     COM=GCC
5005     USING_X11=TRUE
5006     OS=OPENBSD
5007     RTL_OS=OpenBSD
5008     P_SEP=:
5010     case "$host_cpu" in
5011     i*86)
5012         CPUNAME=INTEL
5013         RTL_ARCH=x86
5014         PLATFORMID=openbsd_x86
5015         ;;
5016     x86_64)
5017         CPUNAME=X86_64
5018         RTL_ARCH=X86_64
5019         PLATFORMID=openbsd_x86_64
5020         ;;
5021     *)
5022         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5023         ;;
5024     esac
5025     SOLARINC="$SOLARINC -I/usr/local/include"
5026     ;;
5028 solaris*)
5029     COM=GCC
5030     USING_X11=TRUE
5031     OS=SOLARIS
5032     RTL_OS=Solaris
5033     P_SEP=:
5035     case "$host_cpu" in
5036     i*86)
5037         CPUNAME=INTEL
5038         RTL_ARCH=x86
5039         PLATFORMID=solaris_x86
5040         ;;
5041     sparc)
5042         CPUNAME=SPARC
5043         RTL_ARCH=SPARC
5044         PLATFORMID=solaris_sparc
5045         ;;
5046     sparc64)
5047         CPUNAME=SPARC64
5048         RTL_ARCH=SPARC64
5049         PLATFORMID=solaris_sparc64
5050         ;;
5051     *)
5052         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5053         ;;
5054     esac
5055     SOLARINC="$SOLARINC -I/usr/local/include"
5056     ;;
5059     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
5060     ;;
5061 esac
5063 if test "$with_x" = "no"; then
5064     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
5067 DISABLE_GUI=""
5068 if test "$enable_gui" = "no"; then
5069     if test "$USING_X11" != TRUE; then
5070         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
5071     fi
5072     USING_X11=
5073     DISABLE_GUI=TRUE
5074     AC_DEFINE(HAVE_FEATURE_UI,0)
5075     test_cairo=yes
5077 AC_SUBST(DISABLE_GUI)
5079 WORKDIR="${BUILDDIR}/workdir"
5080 INSTDIR="${BUILDDIR}/instdir"
5081 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
5082 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
5083 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
5084 AC_SUBST(COM)
5085 AC_SUBST(CPUNAME)
5086 AC_SUBST(RTL_OS)
5087 AC_SUBST(RTL_ARCH)
5088 AC_SUBST(EPM_FLAGS)
5089 AC_SUBST(USING_X11)
5090 AC_SUBST([INSTDIR])
5091 AC_SUBST([INSTROOT])
5092 AC_SUBST([INSTROOTBASE])
5093 AC_SUBST(OS)
5094 AC_SUBST(P_SEP)
5095 AC_SUBST(WORKDIR)
5096 AC_SUBST(PLATFORMID)
5097 AC_SUBST(WINDOWS_X64)
5098 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
5100 dnl ===================================================================
5101 dnl Test which package format to use
5102 dnl ===================================================================
5103 AC_MSG_CHECKING([which package format to use])
5104 if test -n "$with_package_format" -a "$with_package_format" != no; then
5105     for i in $with_package_format; do
5106         case "$i" in
5107         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
5108             ;;
5109         *)
5110             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
5111 aix - AIX software distribution
5112 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
5113 deb - Debian software distribution
5114 pkg - Solaris software distribution
5115 rpm - RedHat software distribution
5117 LibreOffice additionally supports:
5118 archive - .tar.gz or .zip
5119 dmg - macOS .dmg
5120 installed - installation tree
5121 msi - Windows .msi
5122         ])
5123             ;;
5124         esac
5125     done
5126     # fakeroot is needed to ensure correct file ownerships/permissions
5127     # inside deb packages and tar archives created on Linux and Solaris.
5128     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
5129         AC_PATH_PROG(FAKEROOT, fakeroot, no)
5130         if test "$FAKEROOT" = "no"; then
5131             AC_MSG_ERROR(
5132                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
5133         fi
5134     fi
5135     PKGFORMAT="$with_package_format"
5136     AC_MSG_RESULT([$PKGFORMAT])
5137 else
5138     PKGFORMAT=
5139     AC_MSG_RESULT([none])
5141 AC_SUBST(PKGFORMAT)
5143 dnl ===================================================================
5144 dnl Set up a different compiler to produce tools to run on the build
5145 dnl machine when doing cross-compilation
5146 dnl ===================================================================
5148 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
5149 m4_pattern_allow([PKG_CONFIG_LIBDIR])
5150 if test "$cross_compiling" = "yes"; then
5151     AC_MSG_CHECKING([for BUILD platform configuration])
5152     echo
5153     rm -rf CONF-FOR-BUILD config_build.mk
5154     mkdir CONF-FOR-BUILD
5155     # Here must be listed all files needed when running the configure script. In particular, also
5156     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
5157     # keep them in the same order as there.
5158     (cd $SRC_ROOT && tar cf - \
5159         config.guess \
5160         bin/get_config_variables \
5161         solenv/bin/getcompver.awk \
5162         solenv/inc/langlist.mk \
5163         download.lst \
5164         config_host.mk.in \
5165         config_host_lang.mk.in \
5166         Makefile.in \
5167         bin/bffvalidator.sh.in \
5168         bin/odfvalidator.sh.in \
5169         bin/officeotron.sh.in \
5170         hardened_runtime.xcent.in \
5171         instsetoo_native/util/openoffice.lst.in \
5172         config_host/*.in \
5173         sysui/desktop/macosx/Info.plist.in \
5174         .vscode/vs-code-template.code-workspace.in \
5175         ) \
5176     | (cd CONF-FOR-BUILD && tar xf -)
5177     cp configure CONF-FOR-BUILD
5178     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
5179     (
5180     unset COM USING_X11 OS CPUNAME
5181     unset CC CXX SYSBASE CFLAGS
5182     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
5183     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
5184     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
5185     if test -n "$CC_FOR_BUILD"; then
5186         export CC="$CC_FOR_BUILD"
5187         CC_BASE=`first_arg_basename "$CC"`
5188     fi
5189     if test -n "$CXX_FOR_BUILD"; then
5190         export CXX="$CXX_FOR_BUILD"
5191         CXX_BASE=`first_arg_basename "$CXX"`
5192     fi
5193     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
5194     cd CONF-FOR-BUILD
5196     sub_conf_opts=""
5197     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
5198     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
5199     test "$with_junit" = "no" && sub_conf_opts="$sub_conf_opts --without-junit"
5200     if test -n "$ENABLE_JAVA"; then
5201         case "$_os" in
5202         iOS) sub_conf_opts="$sub_conf_opts --without-java" ;; # force it off, like it used to be
5203         Android)
5204             # Hack for Android - the build doesn't need a host JDK, so just forward to build for convenience
5205             test -n "$with_jdk_home" && sub_conf_opts="$sub_conf_opts --with-jdk-home=$with_jdk_home"
5206             ;;
5207         *)
5208             if test -z "$with_jdk_home"; then
5209                 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.])
5210             fi
5211             ;;
5212         esac
5213     else
5214         sub_conf_opts="$sub_conf_opts --without-java"
5215     fi
5216     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
5217     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
5218     test "$with_galleries" = "no" -o -z "$WITH_GALLERY_BUILD" && sub_conf_opts="$sub_conf_opts --with-galleries=no"
5219     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
5221     # Don't bother having configure look for stuff not needed for the build platform anyway
5222     ./configure \
5223         --build="$build_alias" \
5224         --disable-cups \
5225         --disable-firebird-sdbc \
5226         --disable-gpgmepp \
5227         --disable-gstreamer-1-0 \
5228         --disable-gtk3 \
5229         --disable-mariadb-sdbc \
5230         --disable-online-update \
5231         --disable-opencl \
5232         --disable-pdfimport \
5233         --disable-postgresql-sdbc \
5234         --disable-skia \
5235         --enable-icecream="$enable_icecream" \
5236         --without-doxygen \
5237         --without-webdav \
5238         --with-parallelism="$with_parallelism" \
5239         --with-theme="$with_theme" \
5240         --with-tls=openssl \
5241         $sub_conf_opts \
5242         --srcdir=$srcdir \
5243         2>&1 | sed -e 's/^/    /'
5244     if test [${PIPESTATUS[0]}] -ne 0; then
5245         AC_MSG_ERROR([Running the configure script for BUILD side failed, see CONF-FOR-BUILD/config.log])
5246     fi
5248     # filter permitted build targets
5249     PERMITTED_BUILD_TARGETS="
5250         AVMEDIA
5251         BOOST
5252         CLUCENE
5253         DBCONNECTIVITY
5254         DESKTOP
5255         DYNLOADING
5256         EPOXY
5257         EXPAT
5258         GLM
5259         GRAPHITE
5260         HARFBUZZ
5261         ICU
5262         LCMS2
5263         LIBJPEG_TURBO
5264         LIBLANGTAG
5265         LibO
5266         LIBFFI
5267         LIBPN
5268         LIBXML2
5269         LIBXSLT
5270         MDDS
5271         NATIVE
5272         OPENSSL
5273         ORCUS
5274         PYTHON
5275         SCRIPTING
5276         ZLIB
5278     # converts BUILD_TYPE and PERMITTED_BUILD_TARGETS into non-whitespace,
5279     # newlined lists, to use grep as a filter
5280     PERMITTED_BUILD_TARGETS=$(echo "$PERMITTED_BUILD_TARGETS" | sed -e '/^ *$/d' -e 's/ *//')
5281     BUILD_TARGETS="$(sed -n -e '/^export BUILD_TYPE=/ s/.*=//p' config_host.mk | tr ' ' '\n')"
5282     BUILD_TARGETS="$(echo "$BUILD_TARGETS" | grep -F "$PERMITTED_BUILD_TARGETS" | tr '\n' ' ')"
5283     sed -i -e "s/ BUILD_TYPE=.*$/ BUILD_TYPE=$BUILD_TARGETS/" config_host.mk
5285     cp config_host.mk ../config_build.mk
5286     cp config_host_lang.mk ../config_build_lang.mk
5287     mv config.log ../config.Build.log
5288     mkdir -p ../config_build
5289     mv config_host/*.h ../config_build
5291     # all these will get a _FOR_BUILD postfix
5292     DIRECT_FOR_BUILD_SETTINGS="
5293         CC
5294         CXX
5295         ILIB
5296         JAVA_HOME
5297         JAVAIFLAGS
5298         JDK
5299         LIBO_BIN_FOLDER
5300         LIBO_LIB_FOLDER
5301         LIBO_URE_LIB_FOLDER
5302         LIBO_URE_MISC_FOLDER
5303         OS
5304         SDKDIRNAME
5305         SYSTEM_LIBXML
5306         SYSTEM_LIBXSLT
5308     # these overwrite host config with build config
5309     OVERWRITING_SETTINGS="
5310         ANT
5311         ANT_HOME
5312         ANT_LIB
5313         HSQLDB_USE_JDBC_4_1
5314         JAVA_CLASSPATH_NOT_SET
5315         JAVA_SOURCE_VER
5316         JAVA_TARGET_VER
5317         JAVACFLAGS
5318         JAVACOMPILER
5319         JAVADOC
5320         JAVADOCISGJDOC
5322     # these need some special handling
5323     EXTRA_HANDLED_SETTINGS="
5324         INSTDIR
5325         INSTROOT
5326         PATH
5327         WORKDIR
5329     OLD_PATH=$PATH
5330     . ./bin/get_config_variables $DIRECT_FOR_BUILD_SETTINGS $OVERWRITING_SETTINGS $EXTRA_HANDLED_SETTINGS
5331     BUILD_PATH=$PATH
5332     PATH=$OLD_PATH
5334     line=`echo "LO_PATH_FOR_BUILD='${BUILD_PATH}'" | sed -e 's,/CONF-FOR-BUILD,,g'`
5335     echo "$line" >>build-config
5337     for V in $DIRECT_FOR_BUILD_SETTINGS; do
5338         VV='$'$V
5339         VV=`eval "echo $VV"`
5340         if test -n "$VV"; then
5341             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
5342             echo "$line" >>build-config
5343         fi
5344     done
5346     for V in $OVERWRITING_SETTINGS; do
5347         VV='$'$V
5348         VV=`eval "echo $VV"`
5349         if test -n "$VV"; then
5350             line=${V}='${'${V}:-$VV'}'
5351             echo "$line" >>build-config
5352         fi
5353     done
5355     for V in INSTDIR INSTROOT WORKDIR; do
5356         VV='$'$V
5357         VV=`eval "echo $VV"`
5358         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
5359         if test -n "$VV"; then
5360             line="${V}_FOR_BUILD='$VV'"
5361             echo "$line" >>build-config
5362         fi
5363     done
5365     )
5366     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([setup/configure for BUILD side failed, see CONF-FOR-BUILD/config.log])
5367     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])
5368     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
5369              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
5371     eval `cat CONF-FOR-BUILD/build-config`
5373     AC_MSG_RESULT([checking for BUILD platform configuration... done])
5375     rm -rf CONF-FOR-BUILD
5376 else
5377     OS_FOR_BUILD="$OS"
5378     CC_FOR_BUILD="$CC"
5379     CXX_FOR_BUILD="$CXX"
5380     INSTDIR_FOR_BUILD="$INSTDIR"
5381     INSTROOT_FOR_BUILD="$INSTROOT"
5382     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
5383     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
5384     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
5385     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
5386     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
5387     WORKDIR_FOR_BUILD="$WORKDIR"
5389 AC_SUBST(OS_FOR_BUILD)
5390 AC_SUBST(INSTDIR_FOR_BUILD)
5391 AC_SUBST(INSTROOT_FOR_BUILD)
5392 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
5393 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
5394 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
5395 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
5396 AC_SUBST(SDKDIRNAME_FOR_BUILD)
5397 AC_SUBST(WORKDIR_FOR_BUILD)
5398 AC_SUBST(CC_FOR_BUILD)
5399 AC_SUBST(CXX_FOR_BUILD)
5401 dnl ===================================================================
5402 dnl Check for syslog header
5403 dnl ===================================================================
5404 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
5406 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
5407 dnl ===================================================================
5408 AC_MSG_CHECKING([whether to turn warnings to errors])
5409 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
5410     ENABLE_WERROR="TRUE"
5411     PYTHONWARNINGS="error"
5412     AC_MSG_RESULT([yes])
5413 else
5414     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
5415         ENABLE_WERROR="TRUE"
5416         PYTHONWARNINGS="error"
5417         AC_MSG_RESULT([yes])
5418     else
5419         AC_MSG_RESULT([no])
5420     fi
5422 AC_SUBST(ENABLE_WERROR)
5423 AC_SUBST(PYTHONWARNINGS)
5425 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
5426 dnl ===================================================================
5427 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
5428 if test -z "$enable_assert_always_abort"; then
5429    if test "$ENABLE_DEBUG" = TRUE; then
5430        enable_assert_always_abort=yes
5431    else
5432        enable_assert_always_abort=no
5433    fi
5435 if test "$enable_assert_always_abort" = "yes"; then
5436     ASSERT_ALWAYS_ABORT="TRUE"
5437     AC_MSG_RESULT([yes])
5438 else
5439     ASSERT_ALWAYS_ABORT="FALSE"
5440     AC_MSG_RESULT([no])
5442 AC_SUBST(ASSERT_ALWAYS_ABORT)
5444 # Determine whether to use ooenv for the instdir installation
5445 # ===================================================================
5446 if test $_os != "WINNT" -a $_os != "Darwin"; then
5447     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
5448     if test -z "$enable_ooenv"; then
5449         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5450             enable_ooenv=yes
5451         else
5452             enable_ooenv=no
5453         fi
5454     fi
5455     if test "$enable_ooenv" = "no"; then
5456         AC_MSG_RESULT([no])
5457     else
5458         ENABLE_OOENV="TRUE"
5459         AC_MSG_RESULT([yes])
5460     fi
5462 AC_SUBST(ENABLE_OOENV)
5464 if test "$USING_X11" != TRUE; then
5465     # be sure to do not mess with unneeded stuff
5466     test_randr=no
5467     test_xrender=no
5468     test_cups=no
5469     test_dbus=no
5470     build_gstreamer_1_0=no
5471     test_kf5=no
5472     test_qt5=no
5473     test_gtk3_kde5=no
5474     enable_cairo_canvas=no
5477 if test "$OS" = "HAIKU"; then
5478     enable_cairo_canvas=yes
5479     test_kf5=yes
5482 if test "$test_kf5" = "yes" -a "$enable_kde5" = "yes"; then
5483     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!])
5484     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!"
5485     enable_kf5=yes
5488 if test "$test_kf5" = "yes"; then
5489     test_qt5=yes
5492 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
5493     if test "$enable_qt5" = "no"; then
5494         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
5495     else
5496         enable_qt5=yes
5497     fi
5500 dnl ===================================================================
5501 dnl check for cups support
5502 dnl ===================================================================
5503 ENABLE_CUPS=""
5505 if test "$enable_cups" = "no"; then
5506     test_cups=no
5509 AC_MSG_CHECKING([whether to enable CUPS support])
5510 if test "$test_cups" = "yes"; then
5511     ENABLE_CUPS="TRUE"
5512     AC_MSG_RESULT([yes])
5514     AC_MSG_CHECKING([whether cups support is present])
5515     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
5516     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
5517     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
5518         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
5519     fi
5521 else
5522     AC_MSG_RESULT([no])
5525 AC_SUBST(ENABLE_CUPS)
5527 # fontconfig checks
5528 if test "$test_fontconfig" = "yes"; then
5529     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
5530     SYSTEM_FONTCONFIG=TRUE
5531     FilterLibs "${FONTCONFIG_LIBS}"
5532     FONTCONFIG_LIBS="${filteredlibs}"
5534 AC_SUBST(FONTCONFIG_CFLAGS)
5535 AC_SUBST(FONTCONFIG_LIBS)
5536 AC_SUBST([SYSTEM_FONTCONFIG])
5538 dnl whether to find & fetch external tarballs?
5539 dnl ===================================================================
5540 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
5541    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5542        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
5543    else
5544        TARFILE_LOCATION="$LODE_HOME/ext_tar"
5545    fi
5547 if test -z "$TARFILE_LOCATION"; then
5548     if test -d "$SRC_ROOT/src" ; then
5549         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
5550         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
5551     fi
5552     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
5553 else
5554     AbsolutePath "$TARFILE_LOCATION"
5555     PathFormat "${absolute_path}"
5556     TARFILE_LOCATION="${formatted_path}"
5558 AC_SUBST(TARFILE_LOCATION)
5560 AC_MSG_CHECKING([whether we want to fetch tarballs])
5561 if test "$enable_fetch_external" != "no"; then
5562     if test "$with_all_tarballs" = "yes"; then
5563         AC_MSG_RESULT([yes, all of them])
5564         DO_FETCH_TARBALLS="ALL"
5565     else
5566         AC_MSG_RESULT([yes, if we use them])
5567         DO_FETCH_TARBALLS="TRUE"
5568     fi
5569 else
5570     AC_MSG_RESULT([no])
5571     DO_FETCH_TARBALLS=
5573 AC_SUBST(DO_FETCH_TARBALLS)
5575 AC_MSG_CHECKING([whether to build help])
5576 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
5577     BUILD_TYPE="$BUILD_TYPE HELP"
5578     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5579     case "$with_help" in
5580     "html")
5581         ENABLE_HTMLHELP=TRUE
5582         SCPDEFS="$SCPDEFS -DWITH_HELP"
5583         AC_MSG_RESULT([HTML])
5584         ;;
5585     "online")
5586         ENABLE_HTMLHELP=TRUE
5587         HELP_ONLINE=TRUE
5588         AC_MSG_RESULT([HTML])
5589         ;;
5590     yes)
5591         SCPDEFS="$SCPDEFS -DWITH_HELP"
5592         AC_MSG_RESULT([yes])
5593         ;;
5594     *)
5595         AC_MSG_ERROR([Unknown --with-help=$with_help])
5596         ;;
5597     esac
5598 else
5599     AC_MSG_RESULT([no])
5601 AC_SUBST([ENABLE_HTMLHELP])
5602 AC_SUBST([HELP_ONLINE])
5604 AC_MSG_CHECKING([whether to enable xapian-omega support for help])
5605 if test -n "$with_omindex" -a "$with_omindex" != "no" -a $_os != iOS -a $_os != Android; then
5606     BUILD_TYPE="$BUILD_TYPE HELP"
5607     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5608     case "$with_omindex" in
5609     "server")
5610         ENABLE_HTMLHELP=TRUE
5611         HELP_ONLINE=TRUE
5612         HELP_OMINDEX_PAGE=TRUE
5613         AC_MSG_RESULT([SERVER])
5614         ;;
5615     "noxap")
5616         ENABLE_HTMLHELP=TRUE
5617         HELP_ONLINE=TRUE
5618         HELP_OMINDEX_PAGE=FALSE
5619         AC_MSG_RESULT([NOXAP])
5620         ;;
5621     *)
5622         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5623         ;;
5624     esac
5625 else
5626     HELP_OMINDEX_PAGE=FALSE
5627     AC_MSG_RESULT([no])
5629 AC_SUBST([ENABLE_HTMLHELP])
5630 AC_SUBST([HELP_OMINDEX_PAGE])
5631 AC_SUBST([HELP_ONLINE])
5634 dnl Test whether to include MySpell dictionaries
5635 dnl ===================================================================
5636 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5637 if test "$with_myspell_dicts" = "yes"; then
5638     AC_MSG_RESULT([yes])
5639     WITH_MYSPELL_DICTS=TRUE
5640     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5641     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5642 else
5643     AC_MSG_RESULT([no])
5644     WITH_MYSPELL_DICTS=
5646 AC_SUBST(WITH_MYSPELL_DICTS)
5648 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5649 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5650     if test "$with_system_dicts" = yes; then
5651         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5652     fi
5653     with_system_dicts=no
5656 AC_MSG_CHECKING([whether to use dicts from external paths])
5657 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5658     AC_MSG_RESULT([yes])
5659     SYSTEM_DICTS=TRUE
5660     AC_MSG_CHECKING([for spelling dictionary directory])
5661     if test -n "$with_external_dict_dir"; then
5662         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5663     else
5664         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5665         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5666             DICT_SYSTEM_DIR=file:///usr/share/myspell
5667         fi
5668     fi
5669     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5670     AC_MSG_CHECKING([for hyphenation patterns directory])
5671     if test -n "$with_external_hyph_dir"; then
5672         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5673     else
5674         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5675     fi
5676     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5677     AC_MSG_CHECKING([for thesaurus directory])
5678     if test -n "$with_external_thes_dir"; then
5679         THES_SYSTEM_DIR=file://$with_external_thes_dir
5680     else
5681         THES_SYSTEM_DIR=file:///usr/share/mythes
5682     fi
5683     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5684 else
5685     AC_MSG_RESULT([no])
5686     SYSTEM_DICTS=
5688 AC_SUBST(SYSTEM_DICTS)
5689 AC_SUBST(DICT_SYSTEM_DIR)
5690 AC_SUBST(HYPH_SYSTEM_DIR)
5691 AC_SUBST(THES_SYSTEM_DIR)
5693 dnl ===================================================================
5694 dnl Precompiled headers.
5695 ENABLE_PCH=""
5696 AC_MSG_CHECKING([whether to enable pch feature])
5697 if test -z "$enable_pch"; then
5698     if test "$_os" = "WINNT"; then
5699         # Enabled by default on Windows.
5700         enable_pch=yes
5701     else
5702         enable_pch=no
5703     fi
5705 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5706     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5708 if test "$enable_pch" = "system"; then
5709     ENABLE_PCH="1"
5710     AC_MSG_RESULT([yes (system headers)])
5711 elif test "$enable_pch" = "base"; then
5712     ENABLE_PCH="2"
5713     AC_MSG_RESULT([yes (system and base headers)])
5714 elif test "$enable_pch" = "normal"; then
5715     ENABLE_PCH="3"
5716     AC_MSG_RESULT([yes (normal)])
5717 elif test "$enable_pch" = "full"; then
5718     ENABLE_PCH="4"
5719     AC_MSG_RESULT([yes (full)])
5720 elif test "$enable_pch" = "yes"; then
5721     # Pick a suitable default.
5722     if test "$GCC" = "yes"; then
5723         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5724         # while making the PCHs larger and rebuilds more likely.
5725         ENABLE_PCH="2"
5726         AC_MSG_RESULT([yes (system and base headers)])
5727     else
5728         # With MSVC the highest level makes a significant difference,
5729         # and it was the default when there used to be no PCH levels.
5730         ENABLE_PCH="4"
5731         AC_MSG_RESULT([yes (full)])
5732     fi
5733 elif test "$enable_pch" = "no"; then
5734     AC_MSG_RESULT([no])
5735 else
5736     AC_MSG_ERROR([Unknown value for --enable-pch])
5738 AC_SUBST(ENABLE_PCH)
5739 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5740 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5741     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5742     if test "$CCACHE_BIN" != "not found"; then
5743         AC_MSG_CHECKING([ccache version])
5744         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5745         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5746         AC_MSG_RESULT([$CCACHE_VERSION])
5747         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5748         if test "$CCACHE_NUMVER" -gt "030701"; then
5749             AC_MSG_RESULT([yes])
5750         else
5751             AC_MSG_RESULT([no (not newer than 3.7.1)])
5752             CCACHE_DEPEND_MODE=
5753         fi
5754     fi
5757 PCH_INSTANTIATE_TEMPLATES=
5758 if test -n "$ENABLE_PCH"; then
5759     AC_MSG_CHECKING([whether $CC supports -fpch-instantiate-templates])
5760     save_CFLAGS=$CFLAGS
5761     CFLAGS="$CFLAGS -Werror -fpch-instantiate-templates"
5762     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_INSTANTIATE_TEMPLATES="-fpch-instantiate-templates" ],[])
5763     CFLAGS=$save_CFLAGS
5764     if test -n "$PCH_INSTANTIATE_TEMPLATES"; then
5765         AC_MSG_RESULT(yes)
5766     else
5767         AC_MSG_RESULT(no)
5768     fi
5770 AC_SUBST(PCH_INSTANTIATE_TEMPLATES)
5772 BUILDING_PCH_WITH_OBJ=
5773 if test -n "$ENABLE_PCH"; then
5774     AC_MSG_CHECKING([whether $CC supports -Xclang -building-pch-with-obj])
5775     save_CFLAGS=$CFLAGS
5776     CFLAGS="$CFLAGS -Werror -Xclang -building-pch-with-obj"
5777     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ BUILDING_PCH_WITH_OBJ="-Xclang -building-pch-with-obj" ],[])
5778     CFLAGS=$save_CFLAGS
5779     if test -n "$BUILDING_PCH_WITH_OBJ"; then
5780         AC_MSG_RESULT(yes)
5781     else
5782         AC_MSG_RESULT(no)
5783     fi
5785 AC_SUBST(BUILDING_PCH_WITH_OBJ)
5787 PCH_CODEGEN=
5788 PCH_NO_CODEGEN=
5789 if test -n "$BUILDING_PCH_WITH_OBJ"; then
5790     AC_MSG_CHECKING([whether $CC supports -fpch-codegen])
5791     save_CFLAGS=$CFLAGS
5792     CFLAGS="$CFLAGS -Werror -fpch-codegen"
5793     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
5794         [
5795         PCH_CODEGEN="-fpch-codegen"
5796         PCH_NO_CODEGEN="-fno-pch-codegen"
5797         ],[])
5798     CFLAGS=$save_CFLAGS
5799     if test -n "$PCH_CODEGEN"; then
5800         AC_MSG_RESULT(yes)
5801     else
5802         AC_MSG_RESULT(no)
5803     fi
5805 AC_SUBST(PCH_CODEGEN)
5806 AC_SUBST(PCH_NO_CODEGEN)
5807 PCH_DEBUGINFO=
5808 if test -n "$BUILDING_PCH_WITH_OBJ"; then
5809     AC_MSG_CHECKING([whether $CC supports -fpch-debuginfo])
5810     save_CFLAGS=$CFLAGS
5811     CFLAGS="$CFLAGS -Werror -fpch-debuginfo"
5812     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_DEBUGINFO="-fpch-debuginfo" ],[])
5813     CFLAGS=$save_CFLAGS
5814     if test -n "$PCH_DEBUGINFO"; then
5815         AC_MSG_RESULT(yes)
5816     else
5817         AC_MSG_RESULT(no)
5818     fi
5820 AC_SUBST(PCH_DEBUGINFO)
5822 TAB=`printf '\t'`
5824 AC_MSG_CHECKING([the GNU Make version])
5825 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5826 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5827 if test "$_make_longver" -ge "038200"; then
5828     AC_MSG_RESULT([$GNUMAKE $_make_version])
5830 elif test "$_make_longver" -ge "038100"; then
5831     if test "$build_os" = "cygwin"; then
5832         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5833     fi
5834     AC_MSG_RESULT([$GNUMAKE $_make_version])
5836     dnl ===================================================================
5837     dnl Search all the common names for sha1sum
5838     dnl ===================================================================
5839     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5840     if test -z "$SHA1SUM"; then
5841         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5842     elif test "$SHA1SUM" = "openssl"; then
5843         SHA1SUM="openssl sha1"
5844     fi
5845     AC_MSG_CHECKING([for GNU Make bug 20033])
5846     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5847     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5848 A := \$(wildcard *.a)
5850 .PHONY: all
5851 all: \$(A:.a=.b)
5852 <TAB>@echo survived bug20033.
5854 .PHONY: setup
5855 setup:
5856 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5858 define d1
5859 @echo lala \$(1)
5860 @sleep 1
5861 endef
5863 define d2
5864 @echo tyty \$(1)
5865 @sleep 1
5866 endef
5868 %.b : %.a
5869 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5870 <TAB>\$(call d1,\$(CHECKSUM)),\
5871 <TAB>\$(call d2,\$(CHECKSUM)))
5873     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5874         no_parallelism_make="YES"
5875         AC_MSG_RESULT([yes, disable parallelism])
5876     else
5877         AC_MSG_RESULT([no, keep parallelism enabled])
5878     fi
5879     rm -rf $TESTGMAKEBUG20033
5880 else
5881     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5884 # find if gnumake support file function
5885 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5886 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5887 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5888     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5890 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5891 \$(file >test.txt,Success )
5893 .PHONY: all
5894 all:
5895 <TAB>@cat test.txt
5898 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5899 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5900     HAVE_GNUMAKE_FILE_FUNC=TRUE
5901     AC_MSG_RESULT([yes])
5902 else
5903     AC_MSG_RESULT([no])
5905 rm -rf $TESTGMAKEFILEFUNC
5906 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5907 AC_SUBST(GNUMAKE_WIN_NATIVE)
5909 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5910 STALE_MAKE=
5911 if test "$_make_ver_check" = ""; then
5912    STALE_MAKE=TRUE
5915 HAVE_LD_HASH_STYLE=FALSE
5916 WITH_LINKER_HASH_STYLE=
5917 AC_MSG_CHECKING([for --hash-style gcc linker support])
5918 if test "$GCC" = "yes"; then
5919     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5920         hash_styles="gnu sysv"
5921     elif test "$with_linker_hash_style" = "no"; then
5922         hash_styles=
5923     else
5924         hash_styles="$with_linker_hash_style"
5925     fi
5927     for hash_style in $hash_styles; do
5928         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5929         hash_style_ldflags_save=$LDFLAGS
5930         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5932         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5933             [
5934 #include <stdio.h>
5935             ],[
5936 printf ("");
5937             ])],
5938             [
5939                   HAVE_LD_HASH_STYLE=TRUE
5940                   WITH_LINKER_HASH_STYLE=$hash_style
5941             ],
5942             [HAVE_LD_HASH_STYLE=FALSE],
5943             [HAVE_LD_HASH_STYLE=FALSE])
5944         LDFLAGS=$hash_style_ldflags_save
5945     done
5947     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5948         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5949     else
5950         AC_MSG_RESULT( no )
5951     fi
5952     LDFLAGS=$hash_style_ldflags_save
5953 else
5954     AC_MSG_RESULT( no )
5956 AC_SUBST(HAVE_LD_HASH_STYLE)
5957 AC_SUBST(WITH_LINKER_HASH_STYLE)
5959 dnl ===================================================================
5960 dnl Check whether there's a Perl version available.
5961 dnl ===================================================================
5962 if test -z "$with_perl_home"; then
5963     AC_PATH_PROG(PERL, perl)
5964 else
5965     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5966     _perl_path="$with_perl_home/bin/perl"
5967     if test -x "$_perl_path"; then
5968         PERL=$_perl_path
5969     else
5970         AC_MSG_ERROR([$_perl_path not found])
5971     fi
5974 dnl ===================================================================
5975 dnl Testing for Perl version 5 or greater.
5976 dnl $] is the Perl version variable, it is returned as an integer
5977 dnl ===================================================================
5978 if test "$PERL"; then
5979     AC_MSG_CHECKING([the Perl version])
5980     ${PERL} -e "exit($]);"
5981     _perl_version=$?
5982     if test "$_perl_version" -lt 5; then
5983         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5984     fi
5985     AC_MSG_RESULT([Perl $_perl_version])
5986 else
5987     AC_MSG_ERROR([Perl not found, install Perl 5])
5990 dnl ===================================================================
5991 dnl Testing for required Perl modules
5992 dnl ===================================================================
5994 AC_MSG_CHECKING([for required Perl modules])
5995 perl_use_string="use Cwd ; use Digest::MD5"
5996 if test "$_os" = "WINNT"; then
5997     if test -n "$PKGFORMAT"; then
5998         for i in $PKGFORMAT; do
5999             case "$i" in
6000             msi)
6001                 # for getting fonts versions to use in MSI
6002                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
6003                 ;;
6004             esac
6005         done
6006     fi
6008 if test "$with_system_hsqldb" = "yes"; then
6009     perl_use_string="$perl_use_string ; use Archive::Zip"
6011 if test "$enable_openssl" = "yes" -a "$with_system_openssl" != "yes"; then
6012     # OpenSSL needs that to build
6013     perl_use_string="$perl_use_string ; use FindBin"
6015 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
6016     AC_MSG_RESULT([all modules found])
6017 else
6018     AC_MSG_RESULT([failed to find some modules])
6019     # Find out which modules are missing.
6020     for i in $perl_use_string; do
6021         if test "$i" != "use" -a "$i" != ";"; then
6022             if ! $PERL -e "use $i;">/dev/null 2>&1; then
6023                 missing_perl_modules="$missing_perl_modules $i"
6024             fi
6025         fi
6026     done
6027     AC_MSG_ERROR([
6028     The missing Perl modules are: $missing_perl_modules
6029     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
6032 dnl ===================================================================
6033 dnl Check for pkg-config
6034 dnl ===================================================================
6035 if test "$_os" != "WINNT"; then
6036     PKG_PROG_PKG_CONFIG
6039 if test "$_os" != "WINNT"; then
6041     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
6042     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
6043     # explicitly. Or put /path/to/compiler in PATH yourself.
6045     # Use wrappers for LTO
6046     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
6047         AC_CHECK_TOOL(AR,gcc-ar)
6048         AC_CHECK_TOOL(NM,gcc-nm)
6049         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
6050     else
6051         AC_CHECK_TOOL(AR,ar)
6052         AC_CHECK_TOOL(NM,nm)
6053         AC_CHECK_TOOL(RANLIB,ranlib)
6054     fi
6055     AC_CHECK_TOOL(OBJDUMP,objdump)
6056     AC_CHECK_TOOL(READELF,readelf)
6057     AC_CHECK_TOOL(STRIP,strip)
6058     if test "$_os" = "WINNT"; then
6059         AC_CHECK_TOOL(DLLTOOL,dlltool)
6060         AC_CHECK_TOOL(WINDRES,windres)
6061     fi
6063 AC_SUBST(AR)
6064 AC_SUBST(DLLTOOL)
6065 AC_SUBST(NM)
6066 AC_SUBST(OBJDUMP)
6067 AC_SUBST(PKG_CONFIG)
6068 AC_SUBST(RANLIB)
6069 AC_SUBST(READELF)
6070 AC_SUBST(STRIP)
6071 AC_SUBST(WINDRES)
6073 dnl ===================================================================
6074 dnl pkg-config checks on macOS
6075 dnl ===================================================================
6077 if test $_os = Darwin; then
6078     AC_MSG_CHECKING([for bogus pkg-config])
6079     if test -n "$PKG_CONFIG"; then
6080         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
6081             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
6082         else
6083             if test "$enable_bogus_pkg_config" = "yes"; then
6084                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
6085             else
6086                 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.])
6087             fi
6088         fi
6089     else
6090         AC_MSG_RESULT([no, good])
6091     fi
6094 find_csc()
6096     # Return value: $csctest
6098     unset csctest
6100     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
6101     if test -n "$regvalue"; then
6102         csctest=$regvalue
6103         return
6104     fi
6107 find_al()
6109     # Return value: $altest
6111     unset altest
6113     # We need this check to detect 4.6.1 or above.
6114     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
6115         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
6116         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
6117             altest=$regvalue
6118             return
6119         fi
6120     done
6122     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
6123         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
6124         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
6125             altest=$regvalue
6126             return
6127         fi
6128     done
6131 find_dotnetsdk46()
6133     unset frametest
6135     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
6136         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
6137         if test -n "$regvalue"; then
6138             frametest=$regvalue
6139             return
6140         fi
6141     done
6144 find_winsdk_version()
6146     # Args: $1 : SDK version as in "8.0", "8.1A" etc
6147     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
6149     unset winsdktest winsdkbinsubdir winsdklibsubdir
6151     case "$1" in
6152     8.0|8.0A)
6153         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
6154         if test -n "$regvalue"; then
6155             winsdktest=$regvalue
6156             winsdklibsubdir=win8
6157             return
6158         fi
6159         ;;
6160     8.1|8.1A)
6161         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
6162         if test -n "$regvalue"; then
6163             winsdktest=$regvalue
6164             winsdklibsubdir=winv6.3
6165             return
6166         fi
6167         ;;
6168     10.0)
6169         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
6170         if test -n "$regvalue"; then
6171             winsdktest=$regvalue
6172             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
6173             if test -n "$regvalue"; then
6174                 winsdkbinsubdir="$regvalue".0
6175                 winsdklibsubdir=$winsdkbinsubdir
6176                 local tmppath="$winsdktest\\Include\\$winsdklibsubdir"
6177                 local tmppath_unix=$(cygpath -u "$tmppath")
6178                 # test exist the SDK path
6179                 if test -d "$tmppath_unix"; then
6180                    # when path is convertible to a short path then path is okay
6181                    cygpath -d "$tmppath" >/dev/null 2>&1
6182                    if test $? -ne 0; then
6183                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
6184                    fi
6185                 else
6186                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
6187                 fi
6188             fi
6189             return
6190         fi
6191         ;;
6192     esac
6195 find_winsdk()
6197     # Return value: From find_winsdk_version
6199     unset winsdktest
6201     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
6202         find_winsdk_version $ver
6203         if test -n "$winsdktest"; then
6204             return
6205         fi
6206     done
6209 find_msms()
6211     # Return value: $msmdir
6213     AC_MSG_CHECKING([for MSVC merge modules directory])
6214     local my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
6215     local my_msm_dir
6217     case "$VCVER" in
6218         160)
6219         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
6220         ;;
6221     esac
6222     for f in $my_msm_files; do
6223         echo "$as_me:$LINENO: searching for $f" >&5
6224     done
6226     msmdir=
6227     for ver in 14.0 15.0; do
6228         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
6229         if test -n "$regvalue"; then
6230             for f in ${my_msm_files}; do
6231                 if test -e "$regvalue/${f}"; then
6232                     msmdir=$regvalue
6233                     break
6234                 fi
6235             done
6236         fi
6237     done
6238     dnl Is the following fallback really necessary, or was it added in response
6239     dnl to never having started Visual Studio on a given machine, so the
6240     dnl registry keys checked above had presumably not yet been created?
6241     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
6242     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
6243     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
6244     dnl expanding to "C:\Program Files\Common Files"), which would need
6245     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
6246     dnl obtain its value from cygwin:
6247     if test -z "$msmdir"; then
6248         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
6249         for f in ${my_msm_files}; do
6250             if test -e "$my_msm_dir/${f}"; then
6251                 msmdir=$my_msm_dir
6252             fi
6253         done
6254     fi
6256     dnl Starting from MSVC 15.0, merge modules are located in different directory
6257     case "$VCVER" in
6258     160)
6259         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6260             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
6261             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
6262             for f in ${my_msm_files}; do
6263                 if test -e "$my_msm_dir/${f}"; then
6264                     msmdir=$my_msm_dir
6265                     break
6266                 fi
6267             done
6268         done
6269         ;;
6270     esac
6272     if test -n "$msmdir"; then
6273         msmdir=`cygpath -m "$msmdir"`
6274         AC_MSG_RESULT([$msmdir])
6275     else
6276         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
6277             AC_MSG_FAILURE([not found])
6278         else
6279             AC_MSG_WARN([not found (check config.log)])
6280             add_warning "MSM none of ${my_msm_files} found"
6281         fi
6282     fi
6285 find_msvc_x64_dlls()
6287     # Return value: $msvcdllpath, $msvcdlls
6289     AC_MSG_CHECKING([for MSVC x64 DLL path])
6290     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
6291     case "$VCVER" in
6292     160)
6293         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6294             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
6295             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
6296                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
6297                 break
6298             fi
6299             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
6300             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
6301                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
6302                 break
6303             fi
6304         done
6305         ;;
6306     esac
6307     AC_MSG_RESULT([$msvcdllpath])
6308     AC_MSG_CHECKING([for MSVC x64 DLLs])
6309     msvcdlls="msvcp140.dll vcruntime140.dll"
6310     for dll in $msvcdlls; do
6311         if ! test -f "$msvcdllpath/$dll"; then
6312             AC_MSG_FAILURE([missing $dll])
6313         fi
6314     done
6315     AC_MSG_RESULT([found all ($msvcdlls)])
6318 dnl =========================================
6319 dnl Check for the Windows  SDK.
6320 dnl =========================================
6321 if test "$_os" = "WINNT"; then
6322     AC_MSG_CHECKING([for Windows SDK])
6323     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6324         find_winsdk
6325         WINDOWS_SDK_HOME=$winsdktest
6327         # normalize if found
6328         if test -n "$WINDOWS_SDK_HOME"; then
6329             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
6330             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
6331         fi
6333         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
6334     fi
6336     if test -n "$WINDOWS_SDK_HOME"; then
6337         # Remove a possible trailing backslash
6338         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
6340         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
6341              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
6342              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
6343             have_windows_sdk_headers=yes
6344         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
6345              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
6346              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
6347             have_windows_sdk_headers=yes
6348         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
6349              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
6350              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
6351             have_windows_sdk_headers=yes
6352         else
6353             have_windows_sdk_headers=no
6354         fi
6356         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
6357             have_windows_sdk_libs=yes
6358         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/user32.lib"; then
6359             have_windows_sdk_libs=yes
6360         else
6361             have_windows_sdk_libs=no
6362         fi
6364         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
6365             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
6366 the  Windows SDK are installed.])
6367         fi
6368     fi
6370     if test -z "$WINDOWS_SDK_HOME"; then
6371         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
6372     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
6373         WINDOWS_SDK_VERSION=80
6374         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
6375     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
6376         WINDOWS_SDK_VERSION=81
6377         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
6378     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
6379         WINDOWS_SDK_VERSION=10
6380         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
6381     else
6382         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
6383     fi
6384     PathFormat "$WINDOWS_SDK_HOME"
6385     WINDOWS_SDK_HOME="$formatted_path"
6386     WINDOWS_SDK_HOME_unix="$formatted_path_unix"
6387     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6388         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
6389         if test -d "$WINDOWS_SDK_HOME/include/um"; then
6390             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
6391         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
6392             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
6393         fi
6394     fi
6396     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
6397     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
6398     dnl but not in v8.0), so allow this to be overridden with a
6399     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
6400     dnl and configuration error if no WiLangId.vbs is found would arguably be
6401     dnl better, but I do not know under which conditions exactly it is needed by
6402     dnl msiglobal.pm:
6403     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
6404         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
6405         WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6406         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6407             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WIN_BUILD_ARCH}/WiLangId.vbs"
6408             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6409         fi
6410         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6411             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WIN_BUILD_ARCH/WiLangId.vbs
6412             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6413         fi
6414         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6415             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WIN_BUILD_ARCH/WiLangId.vbs")
6416             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6417         fi
6418     fi
6419     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
6420         if test -n "$with_package_format" -a "$with_package_format" != no; then
6421             for i in "$with_package_format"; do
6422                 if test "$i" = "msi"; then
6423                     if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6424                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
6425                     fi
6426                 fi
6427             done
6428         fi
6429     fi
6431 AC_SUBST(WINDOWS_SDK_HOME)
6432 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
6433 AC_SUBST(WINDOWS_SDK_VERSION)
6434 AC_SUBST(WINDOWS_SDK_WILANGID)
6436 if test "$build_os" = "cygwin"; then
6437     dnl Check midl.exe; this being the first check for a tool in the SDK bin
6438     dnl dir, it also determines that dir's path w/o an arch segment if any,
6439     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
6440     AC_MSG_CHECKING([for midl.exe])
6442     find_winsdk
6443     if test -n "$winsdkbinsubdir" \
6444         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/midl.exe"
6445     then
6446         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH
6447         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
6448     elif test -f "$winsdktest/Bin/$WIN_BUILD_ARCH/midl.exe"; then
6449         MIDL_PATH=$winsdktest/Bin/$WIN_BUILD_ARCH
6450         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
6451     elif test -f "$winsdktest/Bin/midl.exe"; then
6452         MIDL_PATH=$winsdktest/Bin
6453         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
6454     fi
6455     if test ! -f "$MIDL_PATH/midl.exe"; then
6456         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WIN_BUILD_ARCH, Windows SDK installation broken?])
6457     else
6458         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
6459     fi
6461     # Convert to posix path with 8.3 filename restrictions ( No spaces )
6462     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
6464     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
6465          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
6466          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
6467          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
6468     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
6469          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
6470          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6471          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
6472     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
6473          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
6474          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6475          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
6476     else
6477         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
6478     fi
6480     dnl Check csc.exe
6481     AC_MSG_CHECKING([for csc.exe])
6482     find_csc
6483     if test -f "$csctest/csc.exe"; then
6484         CSC_PATH="$csctest"
6485     fi
6486     if test ! -f "$CSC_PATH/csc.exe"; then
6487         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
6488     else
6489         AC_MSG_RESULT([$CSC_PATH/csc.exe])
6490     fi
6492     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
6494     dnl Check al.exe
6495     AC_MSG_CHECKING([for al.exe])
6496     find_winsdk
6497     if test -n "$winsdkbinsubdir" \
6498         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/al.exe"
6499     then
6500         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH"
6501     elif test -f "$winsdktest/Bin/$WIN_BUILD_ARCH/al.exe"; then
6502         AL_PATH="$winsdktest/Bin/$WIN_BUILD_ARCH"
6503     elif test -f "$winsdktest/Bin/al.exe"; then
6504         AL_PATH="$winsdktest/Bin"
6505     fi
6507     if test -z "$AL_PATH"; then
6508         find_al
6509         if test -f "$altest/bin/al.exe"; then
6510             AL_PATH="$altest/bin"
6511         elif test -f "$altest/al.exe"; then
6512             AL_PATH="$altest"
6513         fi
6514     fi
6515     if test ! -f "$AL_PATH/al.exe"; then
6516         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
6517     else
6518         AC_MSG_RESULT([$AL_PATH/al.exe])
6519     fi
6521     AL_PATH=`win_short_path_for_make "$AL_PATH"`
6523     dnl Check mscoree.lib / .NET Framework dir
6524     AC_MSG_CHECKING(.NET Framework)
6525     find_dotnetsdk46
6526     PathFormat "$frametest"
6527     frametest="$formatted_path"
6528     if test -f "$frametest/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6529         DOTNET_FRAMEWORK_HOME="$frametest"
6530     else
6531         find_winsdk
6532         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6533             DOTNET_FRAMEWORK_HOME="$winsdktest"
6534         fi
6535     fi
6536     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
6537         AC_MSG_ERROR([mscoree.lib not found])
6538     fi
6539     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
6541     PathFormat "$MIDL_PATH"
6542     MIDL_PATH="$formatted_path"
6544     PathFormat "$AL_PATH"
6545     AL_PATH="$formatted_path"
6547     PathFormat "$DOTNET_FRAMEWORK_HOME"
6548     DOTNET_FRAMEWORK_HOME="$formatted_path"
6550     PathFormat "$CSC_PATH"
6551     CSC_PATH="$formatted_path"
6554 dnl ===================================================================
6555 dnl Testing for C++ compiler and version...
6556 dnl ===================================================================
6558 if test "$_os" != "WINNT"; then
6559     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
6560     save_CXXFLAGS=$CXXFLAGS
6561     AC_PROG_CXX
6562     CXXFLAGS=$save_CXXFLAGS
6563     if test -z "$CXX_BASE"; then
6564         CXX_BASE=`first_arg_basename "$CXX"`
6565     fi
6568 dnl check for GNU C++ compiler version
6569 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
6570     AC_MSG_CHECKING([the GNU C++ compiler version])
6572     _gpp_version=`$CXX -dumpversion`
6573     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
6575     if test "$_gpp_majmin" -lt "700"; then
6576         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
6577     else
6578         AC_MSG_RESULT([ok (g++ $_gpp_version)])
6579     fi
6581     dnl see https://code.google.com/p/android/issues/detail?id=41770
6582         glibcxx_threads=no
6583         AC_LANG_PUSH([C++])
6584         AC_REQUIRE_CPP
6585         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
6586         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
6587             #include <bits/c++config.h>]],[[
6588             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
6589             && !defined(_GLIBCXX__PTHREADS) \
6590             && !defined(_GLIBCXX_HAS_GTHREADS)
6591             choke me
6592             #endif
6593         ]])],[AC_MSG_RESULT([yes])
6594         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
6595         AC_LANG_POP([C++])
6596         if test $glibcxx_threads = yes; then
6597             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
6598         fi
6600 AC_SUBST(BOOST_CXXFLAGS)
6603 # prefx CXX with ccache if needed
6605 UNCACHED_CXX="$CXX"
6606 if test "$CCACHE" != ""; then
6607     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
6608     AC_LANG_PUSH([C++])
6609     save_CXXFLAGS=$CXXFLAGS
6610     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
6611     dnl an empty program will do, we're checking the compiler flags
6612     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
6613                       [use_ccache=yes], [use_ccache=no])
6614     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
6615         AC_MSG_RESULT([yes])
6616     else
6617         CXX="$CCACHE $CXX"
6618         CXX_BASE="ccache $CXX_BASE"
6619         AC_MSG_RESULT([no])
6620     fi
6621     CXXFLAGS=$save_CXXFLAGS
6622     AC_LANG_POP([C++])
6625 dnl ===================================================================
6626 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
6627 dnl ===================================================================
6629 if test "$_os" != "WINNT"; then
6630     AC_PROG_CXXCPP
6632     dnl Check whether there's a C pre-processor.
6633     AC_PROG_CPP
6637 dnl ===================================================================
6638 dnl Find integral type sizes and alignments
6639 dnl ===================================================================
6641 if test "$_os" != "WINNT"; then
6643     AC_CHECK_SIZEOF(long)
6644     AC_CHECK_SIZEOF(short)
6645     AC_CHECK_SIZEOF(int)
6646     AC_CHECK_SIZEOF(long long)
6647     AC_CHECK_SIZEOF(double)
6648     AC_CHECK_SIZEOF(void*)
6650     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
6651     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
6652     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
6653     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
6654     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6656     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6657     m4_pattern_allow([AC_CHECK_ALIGNOF])
6658     m4_ifdef([AC_CHECK_ALIGNOF],
6659         [
6660             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6661             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6662             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6663             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6664         ],
6665         [
6666             case "$_os-$host_cpu" in
6667             Linux-i686)
6668                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6669                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6670                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6671                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6672                 ;;
6673             Linux-x86_64)
6674                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6675                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6676                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6677                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6678                 ;;
6679             *)
6680                 if test -z "$ac_cv_alignof_short" -o \
6681                         -z "$ac_cv_alignof_int" -o \
6682                         -z "$ac_cv_alignof_long" -o \
6683                         -z "$ac_cv_alignof_double"; then
6684                    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.])
6685                 fi
6686                 ;;
6687             esac
6688         ])
6690     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6691     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6692     if test $ac_cv_sizeof_long -eq 8; then
6693         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6694     elif test $ac_cv_sizeof_double -eq 8; then
6695         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6696     else
6697         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6698     fi
6700     dnl Check for large file support
6701     AC_SYS_LARGEFILE
6702     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6703         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6704     fi
6705     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6706         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6707     fi
6708 else
6709     # Hardcode for MSVC
6710     SAL_TYPES_SIZEOFSHORT=2
6711     SAL_TYPES_SIZEOFINT=4
6712     SAL_TYPES_SIZEOFLONG=4
6713     SAL_TYPES_SIZEOFLONGLONG=8
6714     if test $WIN_HOST_BITS -eq 32; then
6715         SAL_TYPES_SIZEOFPOINTER=4
6716     else
6717         SAL_TYPES_SIZEOFPOINTER=8
6718     fi
6719     SAL_TYPES_ALIGNMENT2=2
6720     SAL_TYPES_ALIGNMENT4=4
6721     SAL_TYPES_ALIGNMENT8=8
6722     LFS_CFLAGS=''
6724 AC_SUBST(LFS_CFLAGS)
6726 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6727 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6728 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6729 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6730 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6731 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6732 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6733 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6735 dnl ===================================================================
6736 dnl Check whether to enable runtime optimizations
6737 dnl ===================================================================
6738 ENABLE_RUNTIME_OPTIMIZATIONS=
6739 AC_MSG_CHECKING([whether to enable runtime optimizations])
6740 if test -z "$enable_runtime_optimizations"; then
6741     for i in $CC; do
6742         case $i in
6743         -fsanitize=*)
6744             enable_runtime_optimizations=no
6745             break
6746             ;;
6747         esac
6748     done
6750 if test "$enable_runtime_optimizations" != no; then
6751     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6752     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6753     AC_MSG_RESULT([yes])
6754 else
6755     AC_MSG_RESULT([no])
6757 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6759 dnl ===================================================================
6760 dnl Check if valgrind headers are available
6761 dnl ===================================================================
6762 ENABLE_VALGRIND=
6763 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6764     prev_cppflags=$CPPFLAGS
6765     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6766     # or where does it come from?
6767     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6768     AC_CHECK_HEADER([valgrind/valgrind.h],
6769         [ENABLE_VALGRIND=TRUE])
6770     CPPFLAGS=$prev_cppflags
6772 AC_SUBST([ENABLE_VALGRIND])
6773 if test -z "$ENABLE_VALGRIND"; then
6774     if test "$with_valgrind" = yes; then
6775         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6776     fi
6777     VALGRIND_CFLAGS=
6779 AC_SUBST([VALGRIND_CFLAGS])
6782 dnl ===================================================================
6783 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6784 dnl ===================================================================
6786 # We need at least the sys/sdt.h include header.
6787 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6788 if test "$SDT_H_FOUND" = "TRUE"; then
6789     # Found sys/sdt.h header, now make sure the c++ compiler works.
6790     # Old g++ versions had problems with probes in constructors/destructors.
6791     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6792     AC_LANG_PUSH([C++])
6793     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6794     #include <sys/sdt.h>
6795     class ProbeClass
6796     {
6797     private:
6798       int& ref;
6799       const char *name;
6801     public:
6802       ProbeClass(int& v, const char *n) : ref(v), name(n)
6803       {
6804         DTRACE_PROBE2(_test_, cons, name, ref);
6805       }
6807       void method(int min)
6808       {
6809         DTRACE_PROBE3(_test_, meth, name, ref, min);
6810         ref -= min;
6811       }
6813       ~ProbeClass()
6814       {
6815         DTRACE_PROBE2(_test_, dest, name, ref);
6816       }
6817     };
6818     ]],[[
6819     int i = 64;
6820     DTRACE_PROBE1(_test_, call, i);
6821     ProbeClass inst = ProbeClass(i, "call");
6822     inst.method(24);
6823     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6824           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6825     AC_LANG_POP([C++])
6827 AC_CONFIG_HEADERS([config_host/config_probes.h])
6829 dnl ===================================================================
6830 dnl GCC features
6831 dnl ===================================================================
6832 HAVE_GCC_STACK_CLASH_PROTECTION=
6833 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6834     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
6835     save_CFLAGS=$CFLAGS
6836     CFLAGS="$CFLAGS -Werror -fstack-clash-protection"
6837     AC_LINK_IFELSE(
6838         [AC_LANG_PROGRAM(, [[return 0;]])],
6839         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
6840         [AC_MSG_RESULT([no])])
6841     CFLAGS=$save_CFLAGS
6843     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6844     save_CFLAGS=$CFLAGS
6845     CFLAGS="$CFLAGS -Werror -mno-avx"
6846     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6847     CFLAGS=$save_CFLAGS
6848     if test "$HAVE_GCC_AVX" = "TRUE"; then
6849         AC_MSG_RESULT([yes])
6850     else
6851         AC_MSG_RESULT([no])
6852     fi
6854     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
6855     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6856     int v = 0;
6857     if (__sync_add_and_fetch(&v, 1) != 1 ||
6858         __sync_sub_and_fetch(&v, 1) != 0)
6859         return 1;
6860     __sync_synchronize();
6861     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6862         v != 1)
6863         return 1;
6864     return 0;
6865 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6866     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6867         AC_MSG_RESULT([yes])
6868         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6869     else
6870         AC_MSG_RESULT([no])
6871     fi
6873     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
6874     AC_LANG_PUSH([C++])
6875     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6876             #include <cstddef>
6877             #include <cxxabi.h>
6878             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6879         ])], [
6880             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6881             AC_MSG_RESULT([yes])
6882         ], [AC_MSG_RESULT([no])])
6883     AC_LANG_POP([C++])
6885     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
6886     AC_LANG_PUSH([C++])
6887     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6888             #include <cstddef>
6889             #include <cxxabi.h>
6890             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6891         ])], [
6892             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6893             AC_MSG_RESULT([yes])
6894         ], [AC_MSG_RESULT([no])])
6895     AC_LANG_POP([C++])
6897     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
6898     AC_LANG_PUSH([C++])
6899     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6900             #include <cxxabi.h>
6901             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6902         ])], [
6903             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6904             AC_MSG_RESULT([yes])
6905         ], [AC_MSG_RESULT([no])])
6906     AC_LANG_POP([C++])
6908     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
6909     AC_LANG_PUSH([C++])
6910     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6911             #include <cstddef>
6912             #include <cxxabi.h>
6913             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6914         ])], [
6915             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6916             AC_MSG_RESULT([yes])
6917         ], [AC_MSG_RESULT([no])])
6918     AC_LANG_POP([C++])
6920     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exception in cxxabi.h])
6921     AC_LANG_PUSH([C++])
6922     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6923             #include <cstddef>
6924             #include <cxxabi.h>
6925             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exception); }
6926         ])], [
6927             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTION],[1])
6928             AC_MSG_RESULT([yes])
6929         ], [AC_MSG_RESULT([no])])
6930     AC_LANG_POP([C++])
6932     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
6933     AC_LANG_PUSH([C++])
6934     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6935             #include <cxxabi.h>
6936             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6937         ])], [
6938             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6939             AC_MSG_RESULT([yes])
6940         ], [AC_MSG_RESULT([no])])
6941     AC_LANG_POP([C++])
6943     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
6944     AC_LANG_PUSH([C++])
6945     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6946             #include <cxxabi.h>
6947             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6948         ])], [
6949             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6950             AC_MSG_RESULT([yes])
6951         ], [AC_MSG_RESULT([no])])
6952     AC_LANG_POP([C++])
6954     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
6955     AC_LANG_PUSH([C++])
6956     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6957             #include <cxxabi.h>
6958             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6959         ])], [
6960             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6961             AC_MSG_RESULT([yes])
6962         ], [AC_MSG_RESULT([no])])
6963     AC_LANG_POP([C++])
6965     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
6966     AC_LANG_PUSH([C++])
6967     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6968             #include <cstddef>
6969             #include <cxxabi.h>
6970             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6971         ])], [
6972             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6973             AC_MSG_RESULT([yes])
6974         ], [AC_MSG_RESULT([no])])
6975     AC_LANG_POP([C++])
6977     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
6978     AC_LANG_PUSH([C++])
6979     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6980             #include <cstddef>
6981             #include <cxxabi.h>
6982             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6983         ])], [
6984             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6985             AC_MSG_RESULT([yes])
6986         ], [AC_MSG_RESULT([no])])
6987     AC_LANG_POP([C++])
6990 AC_SUBST(HAVE_GCC_AVX)
6991 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6992 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
6994 dnl ===================================================================
6995 dnl Identify the C++ library
6996 dnl ===================================================================
6998 AC_MSG_CHECKING([what the C++ library is])
6999 AC_LANG_PUSH([C++])
7000 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7001 #include <utility>
7002 #ifndef __GLIBCXX__
7003 foo bar
7004 #endif
7005 ]])],
7006     [CPP_LIBRARY=GLIBCXX
7007      cpp_library_name="GNU libstdc++"
7008     ],
7009     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7010 #include <utility>
7011 #ifndef _LIBCPP_VERSION
7012 foo bar
7013 #endif
7014 ]])],
7015     [CPP_LIBRARY=LIBCPP
7016      cpp_library_name="LLVM libc++"
7017      AC_DEFINE([HAVE_LIBCXX])
7018     ],
7019     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7020 #include <utility>
7021 #ifndef _MSC_VER
7022 foo bar
7023 #endif
7024 ]])],
7025     [CPP_LIBRARY=MSVCRT
7026      cpp_library_name="Microsoft"
7027     ],
7028     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
7029 AC_MSG_RESULT([$cpp_library_name])
7030 AC_LANG_POP([C++])
7032 dnl ===================================================================
7033 dnl Check for gperf
7034 dnl ===================================================================
7035 AC_PATH_PROG(GPERF, gperf)
7036 if test -z "$GPERF"; then
7037     AC_MSG_ERROR([gperf not found but needed. Install it.])
7039 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7040     GPERF=`cygpath -m $GPERF`
7042 AC_MSG_CHECKING([whether gperf is new enough])
7043 my_gperf_ver1=$($GPERF --version | head -n 1)
7044 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
7045 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
7046 if test "$my_gperf_ver3" -ge 301; then
7047     AC_MSG_RESULT([yes ($my_gperf_ver2)])
7048 else
7049     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
7051 AC_SUBST(GPERF)
7053 dnl ===================================================================
7054 dnl Check for system libcmis
7055 dnl ===================================================================
7056 # libcmis requires curl and we can't build curl for iOS
7057 if test $_os != iOS; then
7058     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
7059     ENABLE_LIBCMIS=TRUE
7060 else
7061     ENABLE_LIBCMIS=
7063 AC_SUBST(ENABLE_LIBCMIS)
7065 dnl ===================================================================
7066 dnl C++11
7067 dnl ===================================================================
7069 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
7070 CXXFLAGS_CXX11=
7071 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
7072     if test "$with_latest_c__" = yes; then
7073         CXXFLAGS_CXX11=-std:c++latest
7074     else
7075         CXXFLAGS_CXX11=-std:c++17
7076     fi
7077     CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -permissive- -Zc:__cplusplus"
7078 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7079     my_flags='-std=c++17 -std=c++1z'
7080     if test "$with_latest_c__" = yes; then
7081         my_flags="-std=c++23 -std=c++2b -std=c++20 -std=c++2a $my_flags"
7082     fi
7083     for flag in $my_flags; do
7084         if test "$COM" = MSC; then
7085             flag="-Xclang $flag"
7086         fi
7087         save_CXXFLAGS=$CXXFLAGS
7088         CXXFLAGS="$CXXFLAGS $flag -Werror"
7089         if test "$SYSTEM_LIBCMIS" = TRUE; then
7090             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
7091         fi
7092         AC_LANG_PUSH([C++])
7093         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7094             #include <algorithm>
7095             #include <functional>
7096             #include <vector>
7098             #if defined SYSTEM_LIBCMIS
7099             // See ucb/source/ucp/cmis/auth_provider.hxx:
7100             #if !defined __clang__
7101             #pragma GCC diagnostic push
7102             #pragma GCC diagnostic ignored "-Wdeprecated"
7103             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
7104             #endif
7105             #include <libcmis/libcmis.hxx>
7106             #if !defined __clang__
7107             #pragma GCC diagnostic pop
7108             #endif
7109             #endif
7111             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
7112                 std::sort(v.begin(), v.end(), fn);
7113             }
7114             ]])],[CXXFLAGS_CXX11=$flag])
7115         AC_LANG_POP([C++])
7116         CXXFLAGS=$save_CXXFLAGS
7117         if test -n "$CXXFLAGS_CXX11"; then
7118             break
7119         fi
7120     done
7122 if test -n "$CXXFLAGS_CXX11"; then
7123     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
7124 else
7125     AC_MSG_ERROR(no)
7127 AC_SUBST(CXXFLAGS_CXX11)
7129 if test "$GCC" = "yes"; then
7130     save_CXXFLAGS=$CXXFLAGS
7131     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7132     CHECK_L_ATOMIC
7133     CXXFLAGS=$save_CXXFLAGS
7134     AC_SUBST(ATOMIC_LIB)
7137 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
7138 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
7139 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
7140 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
7141 dnl again towards 4.7.2:
7142 if test $CPP_LIBRARY = GLIBCXX; then
7143     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
7144     AC_LANG_PUSH([C++])
7145     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7146 #include <list>
7147 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
7148     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
7149     //   GCC 4.7.0: 20120322
7150     //   GCC 4.7.1: 20120614
7151     // and using a range check is not possible as the mapping between
7152     // __GLIBCXX__ values and GCC versions is not monotonic
7153 /* ok */
7154 #else
7155 abi broken
7156 #endif
7157         ]])], [AC_MSG_RESULT(no, ok)],
7158         [AC_MSG_ERROR(yes)])
7159     AC_LANG_POP([C++])
7162 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
7163 save_CXXFLAGS=$CXXFLAGS
7164 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7165 AC_LANG_PUSH([C++])
7167 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7168 #include <stddef.h>
7170 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
7172 namespace
7174         struct b
7175         {
7176                 int i;
7177                 int j;
7178         };
7180 ]], [[
7181 struct a
7183         int i;
7184         int j;
7186 a thinga[]={{0,0}, {1,1}};
7187 b thingb[]={{0,0}, {1,1}};
7188 size_t i = sizeof(sal_n_array_size(thinga));
7189 size_t j = sizeof(sal_n_array_size(thingb));
7190 return !(i != 0 && j != 0);
7192     ], [ AC_MSG_RESULT(yes) ],
7193     [ AC_MSG_ERROR(no)])
7194 AC_LANG_POP([C++])
7195 CXXFLAGS=$save_CXXFLAGS
7197 HAVE_GCC_FNO_SIZED_DEALLOCATION=
7198 if test "$GCC" = yes; then
7199     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
7200     AC_LANG_PUSH([C++])
7201     save_CXXFLAGS=$CXXFLAGS
7202     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
7203     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
7204     CXXFLAGS=$save_CXXFLAGS
7205     AC_LANG_POP([C++])
7206     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
7207         AC_MSG_RESULT([yes])
7208     else
7209         AC_MSG_RESULT([no])
7210     fi
7212 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
7214 AC_MSG_CHECKING([whether $CXX_BASE supports a working C++20 consteval])
7215 dnl ...that does not suffer from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96994> "Missing code
7216 dnl from consteval constructor initializing const variable",
7217 dnl <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98752> "wrong 'error: â€˜this’ is not a constant
7218 dnl expression' with consteval constructor", or <https://bugs.llvm.org/show_bug.cgi?id=50063> "code
7219 dnl using consteval: 'clang/lib/CodeGen/Address.h:38: llvm::Value*
7220 dnl clang::CodeGen::Address::getPointer() const: Assertion `isValid()' failed.'":
7221 AC_LANG_PUSH([C++])
7222 save_CXXFLAGS=$CXXFLAGS
7223 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7224 AC_RUN_IFELSE([AC_LANG_PROGRAM([
7225         struct S {
7226             consteval S() { i = 1; }
7227             int i = 0;
7228         };
7229         S const s;
7231         struct S1 { consteval S1(int) {} };
7232         struct S2 {
7233             S1 x;
7234             S2(): x(0) {}
7235         };
7237         struct S3 {
7238             consteval S3() {}
7239             union {
7240                 int a;
7241                 unsigned b = 0;
7242             };
7243         };
7244         void f() { S3(); }
7245     ], [
7246         return (s.i == 1) ? 0 : 1;
7247     ])], [
7248         AC_DEFINE([HAVE_CPP_CONSTEVAL],[1])
7249         AC_MSG_RESULT([yes])
7250     ], [AC_MSG_RESULT([no])], [AC_MSG_RESULT([assumed no (cross compiling)])])
7251 CXXFLAGS=$save_CXXFLAGS
7252 AC_LANG_POP([C++])
7254 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
7255 AC_LANG_PUSH([C++])
7256 save_CXXFLAGS=$CXXFLAGS
7257 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7258 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7259         #include <algorithm>
7260         #include <initializer_list>
7261         #include <vector>
7262         template<typename T> class S {
7263         private:
7264             std::vector<T> v_;
7265         public:
7266             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
7267         };
7268         constinit S<int> s{3, 2, 1};
7269     ])], [
7270         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
7271         AC_MSG_RESULT([yes])
7272     ], [AC_MSG_RESULT([no])])
7273 CXXFLAGS=$save_CXXFLAGS
7274 AC_LANG_POP([C++])
7276 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
7277 AC_LANG_PUSH([C++])
7278 save_CXXFLAGS=$CXXFLAGS
7279 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7280 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7281         #include <span>
7282         #include <type_traits>
7283         // Don't check size_type directly, as it was called index_type before P1872R0:
7284         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
7285     ])], [
7286         AC_DEFINE([HAVE_CPP_SPAN],[1])
7287         AC_MSG_RESULT([yes])
7288     ], [AC_MSG_RESULT([no])])
7289 CXXFLAGS=$save_CXXFLAGS
7290 AC_LANG_POP([C++])
7292 AC_MSG_CHECKING([whether $CXX_BASE implements C++ DR P1155R3])
7293 AC_LANG_PUSH([C++])
7294 save_CXXFLAGS=$CXXFLAGS
7295 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7296 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7297         struct S1 { S1(S1 &&); };
7298         struct S2: S1 {};
7299         S1 f(S2 s) { return s; }
7300     ])], [
7301         AC_DEFINE([HAVE_P1155R3],[1])
7302         AC_MSG_RESULT([yes])
7303     ], [AC_MSG_RESULT([no])])
7304 CXXFLAGS=$save_CXXFLAGS
7305 AC_LANG_POP([C++])
7307 dnl Supported since GCC 9 and Clang 10 (which each also started to support -Wdeprecated-copy, but
7308 dnl which is included in -Wextra anyway):
7309 HAVE_WDEPRECATED_COPY_DTOR=
7310 if test "$GCC" = yes; then
7311     AC_MSG_CHECKING([whether $CXX_BASE supports -Wdeprecated-copy-dtor])
7312     AC_LANG_PUSH([C++])
7313     save_CXXFLAGS=$CXXFLAGS
7314     CXXFLAGS="$CXXFLAGS -Werror -Wdeprecated-copy-dtor"
7315     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
7316             HAVE_WDEPRECATED_COPY_DTOR=TRUE
7317             AC_MSG_RESULT([yes])
7318         ], [AC_MSG_RESULT([no])])
7319     CXXFLAGS=$save_CXXFLAGS
7320     AC_LANG_POP([C++])
7322 AC_SUBST([HAVE_WDEPRECATED_COPY_DTOR])
7324 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
7325 dnl uninitialized warning for code like
7327 dnl   OString f();
7328 dnl   boost::optional<OString> * g(bool b) {
7329 dnl       boost::optional<OString> o;
7330 dnl       if (b) o = f();
7331 dnl       return new boost::optional<OString>(o);
7332 dnl   }
7334 dnl (as is e.g. present, in a slightly more elaborate form, in
7335 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
7336 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
7337 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
7338 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7339     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
7340     AC_LANG_PUSH([C++])
7341     save_CXXFLAGS=$CXXFLAGS
7342     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
7343     if test "$ENABLE_OPTIMIZED" = TRUE; then
7344         CXXFLAGS="$CXXFLAGS -O2"
7345     else
7346         CXXFLAGS="$CXXFLAGS -O0"
7347     fi
7348     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7349             #include <new>
7350             void f1(int);
7351             struct S1 {
7352                 ~S1() { f1(n); }
7353                 int n = 0;
7354             };
7355             struct S2 {
7356                 S2() {}
7357                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
7358                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
7359                 void set(S1 s) {
7360                     new (stg) S1(s);
7361                     init = true;
7362                 }
7363                 bool init = false;
7364                 char stg[sizeof (S1)];
7365             } ;
7366             S1 f2();
7367             S2 * f3(bool b) {
7368                 S2 o;
7369                 if (b) o.set(f2());
7370                 return new S2(o);
7371             }
7372         ]])], [AC_MSG_RESULT([no])], [
7373             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
7374             AC_MSG_RESULT([yes])
7375         ])
7376     CXXFLAGS=$save_CXXFLAGS
7377     AC_LANG_POP([C++])
7379 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
7381 dnl Check for <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c5> "[8/9/10/11 Regression]
7382 dnl -Wstringop-overflow false positive due to using MEM_REF type of &MEM" (fixed in GCC 11), which
7383 dnl hits us e.g. with GCC 10 and --enable-optimized at
7385 dnl   In file included from include/rtl/string.hxx:49,
7386 dnl                    from include/rtl/ustring.hxx:43,
7387 dnl                    from include/osl/file.hxx:35,
7388 dnl                    from include/codemaker/global.hxx:28,
7389 dnl                    from include/codemaker/options.hxx:23,
7390 dnl                    from codemaker/source/commoncpp/commoncpp.cxx:24:
7391 dnl   In function â€˜char* rtl::addDataHelper(char*, const char*, std::size_t)’,
7392 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,
7393 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,
7394 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,
7395 dnl       inlined from â€˜rtl::OString codemaker::cpp::scopedCppName(const rtl::OString&, bool)’ at codemaker/source/commoncpp/commoncpp.cxx:53:55:
7396 dnl   include/rtl/stringconcat.hxx:78:15: error: writing 2 bytes into a region of size 1 [-Werror=stringop-overflow=]
7397 dnl      78 |         memcpy( buffer, data, length );
7398 dnl         |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
7399 HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=
7400 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7401     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=stringop-overflow=])
7402     AC_LANG_PUSH([C++])
7403     save_CXXFLAGS=$CXXFLAGS
7404     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wstringop-overflow"
7405     if test "$ENABLE_OPTIMIZED" = TRUE; then
7406         CXXFLAGS="$CXXFLAGS -O2"
7407     else
7408         CXXFLAGS="$CXXFLAGS -O0"
7409     fi
7410     dnl Test code taken from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c0>:
7411     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7412             void fill(char const * begin, char const * end, char c);
7413             struct q {
7414                 char ids[4];
7415                 char username[6];
7416             };
7417             void test(q & c) {
7418                 fill(c.ids, c.ids + sizeof(c.ids), '\0');
7419                 __builtin_strncpy(c.username, "root", sizeof(c.username));
7420             }
7421         ]])], [AC_MSG_RESULT([no])], [
7422             HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=TRUE
7423             AC_MSG_RESULT([yes])
7424         ])
7425     CXXFLAGS=$save_CXXFLAGS
7426     AC_LANG_POP([C++])
7428 AC_SUBST([HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW])
7430 dnl ===================================================================
7431 dnl CPU Intrinsics support - SSE, AVX
7432 dnl ===================================================================
7434 CXXFLAGS_INTRINSICS_SSE2=
7435 CXXFLAGS_INTRINSICS_SSSE3=
7436 CXXFLAGS_INTRINSICS_SSE41=
7437 CXXFLAGS_INTRINSICS_SSE42=
7438 CXXFLAGS_INTRINSICS_AVX=
7439 CXXFLAGS_INTRINSICS_AVX2=
7440 CXXFLAGS_INTRINSICS_AVX512=
7441 CXXFLAGS_INTRINSICS_F16C=
7442 CXXFLAGS_INTRINSICS_FMA=
7444 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7445     # GCC, Clang or Clang-cl (clang-cl + MSVC's -arch options don't work well together)
7446     flag_sse2=-msse2
7447     flag_ssse3=-mssse3
7448     flag_sse41=-msse4.1
7449     flag_sse42=-msse4.2
7450     flag_avx=-mavx
7451     flag_avx2=-mavx2
7452     flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
7453     flag_f16c=-mf16c
7454     flag_fma=-mfma
7455 else
7456     # https://docs.microsoft.com/en-us/cpp/build/reference/arch-x86
7457     # MSVC seems to differentiate only between SSE and SSE2, where in fact
7458     # SSE2 seems to be SSE2+.
7459     # Even if -arch:SSE2 is the default, set it explicitly, so that the variable
7460     # is not empty (and can be tested in gbuild).
7461     flag_sse2=-arch:SSE2
7462     flag_ssse3=-arch:SSE2
7463     flag_sse41=-arch:SSE2
7464     flag_sse42=-arch:SSE2
7465     flag_avx=-arch:AVX
7466     flag_avx2=-arch:AVX2
7467     flag_avx512=-arch:AVX512
7468     # These are part of -arch:AVX2
7469     flag_f16c=-arch:AVX2
7470     flag_fma=-arch:AVX2
7473 AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
7474 AC_LANG_PUSH([C++])
7475 save_CXXFLAGS=$CXXFLAGS
7476 CXXFLAGS="$CXXFLAGS $flag_sse2"
7477 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7478     #include <emmintrin.h>
7479     int main () {
7480         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7481         c = _mm_xor_si128 (a, b);
7482         return 0;
7483     }
7484     ])],
7485     [can_compile_sse2=yes],
7486     [can_compile_sse2=no])
7487 AC_LANG_POP([C++])
7488 CXXFLAGS=$save_CXXFLAGS
7489 AC_MSG_RESULT([${can_compile_sse2}])
7490 if test "${can_compile_sse2}" = "yes" ; then
7491     CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
7494 AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
7495 AC_LANG_PUSH([C++])
7496 save_CXXFLAGS=$CXXFLAGS
7497 CXXFLAGS="$CXXFLAGS $flag_ssse3"
7498 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7499     #include <tmmintrin.h>
7500     int main () {
7501         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7502         c = _mm_maddubs_epi16 (a, b);
7503         return 0;
7504     }
7505     ])],
7506     [can_compile_ssse3=yes],
7507     [can_compile_ssse3=no])
7508 AC_LANG_POP([C++])
7509 CXXFLAGS=$save_CXXFLAGS
7510 AC_MSG_RESULT([${can_compile_ssse3}])
7511 if test "${can_compile_ssse3}" = "yes" ; then
7512     CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
7515 AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
7516 AC_LANG_PUSH([C++])
7517 save_CXXFLAGS=$CXXFLAGS
7518 CXXFLAGS="$CXXFLAGS $flag_sse41"
7519 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7520     #include <smmintrin.h>
7521     int main () {
7522         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7523         c = _mm_cmpeq_epi64 (a, b);
7524         return 0;
7525     }
7526     ])],
7527     [can_compile_sse41=yes],
7528     [can_compile_sse41=no])
7529 AC_LANG_POP([C++])
7530 CXXFLAGS=$save_CXXFLAGS
7531 AC_MSG_RESULT([${can_compile_sse41}])
7532 if test "${can_compile_sse41}" = "yes" ; then
7533     CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
7536 AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
7537 AC_LANG_PUSH([C++])
7538 save_CXXFLAGS=$CXXFLAGS
7539 CXXFLAGS="$CXXFLAGS $flag_sse42"
7540 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7541     #include <nmmintrin.h>
7542     int main () {
7543         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7544         c = _mm_cmpgt_epi64 (a, b);
7545         return 0;
7546     }
7547     ])],
7548     [can_compile_sse42=yes],
7549     [can_compile_sse42=no])
7550 AC_LANG_POP([C++])
7551 CXXFLAGS=$save_CXXFLAGS
7552 AC_MSG_RESULT([${can_compile_sse42}])
7553 if test "${can_compile_sse42}" = "yes" ; then
7554     CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
7557 AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
7558 AC_LANG_PUSH([C++])
7559 save_CXXFLAGS=$CXXFLAGS
7560 CXXFLAGS="$CXXFLAGS $flag_avx"
7561 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7562     #include <immintrin.h>
7563     int main () {
7564         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
7565         c = _mm256_xor_ps(a, b);
7566         return 0;
7567     }
7568     ])],
7569     [can_compile_avx=yes],
7570     [can_compile_avx=no])
7571 AC_LANG_POP([C++])
7572 CXXFLAGS=$save_CXXFLAGS
7573 AC_MSG_RESULT([${can_compile_avx}])
7574 if test "${can_compile_avx}" = "yes" ; then
7575     CXXFLAGS_INTRINSICS_AVX="$flag_avx"
7578 AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
7579 AC_LANG_PUSH([C++])
7580 save_CXXFLAGS=$CXXFLAGS
7581 CXXFLAGS="$CXXFLAGS $flag_avx2"
7582 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7583     #include <immintrin.h>
7584     int main () {
7585         __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
7586         c = _mm256_maddubs_epi16(a, b);
7587         return 0;
7588     }
7589     ])],
7590     [can_compile_avx2=yes],
7591     [can_compile_avx2=no])
7592 AC_LANG_POP([C++])
7593 CXXFLAGS=$save_CXXFLAGS
7594 AC_MSG_RESULT([${can_compile_avx2}])
7595 if test "${can_compile_avx2}" = "yes" ; then
7596     CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
7599 AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
7600 AC_LANG_PUSH([C++])
7601 save_CXXFLAGS=$CXXFLAGS
7602 CXXFLAGS="$CXXFLAGS $flag_avx512"
7603 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7604     #include <immintrin.h>
7605     int main () {
7606         __m512i a = _mm512_loadu_si512(0);
7607         return 0;
7608     }
7609     ])],
7610     [can_compile_avx512=yes],
7611     [can_compile_avx512=no])
7612 AC_LANG_POP([C++])
7613 CXXFLAGS=$save_CXXFLAGS
7614 AC_MSG_RESULT([${can_compile_avx512}])
7615 if test "${can_compile_avx512}" = "yes" ; then
7616     CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
7619 AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
7620 AC_LANG_PUSH([C++])
7621 save_CXXFLAGS=$CXXFLAGS
7622 CXXFLAGS="$CXXFLAGS $flag_f16c"
7623 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7624     #include <immintrin.h>
7625     int main () {
7626         __m128i a = _mm_set1_epi32 (0);
7627         __m128 c;
7628         c = _mm_cvtph_ps(a);
7629         return 0;
7630     }
7631     ])],
7632     [can_compile_f16c=yes],
7633     [can_compile_f16c=no])
7634 AC_LANG_POP([C++])
7635 CXXFLAGS=$save_CXXFLAGS
7636 AC_MSG_RESULT([${can_compile_f16c}])
7637 if test "${can_compile_f16c}" = "yes" ; then
7638     CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
7641 AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
7642 AC_LANG_PUSH([C++])
7643 save_CXXFLAGS=$CXXFLAGS
7644 CXXFLAGS="$CXXFLAGS $flag_fma"
7645 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7646     #include <immintrin.h>
7647     int main () {
7648         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
7649         d = _mm256_fmadd_ps(a, b, c);
7650         return 0;
7651     }
7652     ])],
7653     [can_compile_fma=yes],
7654     [can_compile_fma=no])
7655 AC_LANG_POP([C++])
7656 CXXFLAGS=$save_CXXFLAGS
7657 AC_MSG_RESULT([${can_compile_fma}])
7658 if test "${can_compile_fma}" = "yes" ; then
7659     CXXFLAGS_INTRINSICS_FMA="$flag_fma"
7662 AC_SUBST([CXXFLAGS_INTRINSICS_SSE2])
7663 AC_SUBST([CXXFLAGS_INTRINSICS_SSSE3])
7664 AC_SUBST([CXXFLAGS_INTRINSICS_SSE41])
7665 AC_SUBST([CXXFLAGS_INTRINSICS_SSE42])
7666 AC_SUBST([CXXFLAGS_INTRINSICS_AVX])
7667 AC_SUBST([CXXFLAGS_INTRINSICS_AVX2])
7668 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512])
7669 AC_SUBST([CXXFLAGS_INTRINSICS_F16C])
7670 AC_SUBST([CXXFLAGS_INTRINSICS_FMA])
7672 dnl ===================================================================
7673 dnl system stl sanity tests
7674 dnl ===================================================================
7675 if test "$_os" != "WINNT"; then
7677     AC_LANG_PUSH([C++])
7679     save_CPPFLAGS="$CPPFLAGS"
7680     if test -n "$MACOSX_SDK_PATH"; then
7681         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
7682     fi
7684     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
7685     # only.
7686     if test "$CPP_LIBRARY" = GLIBCXX; then
7687         dnl gcc#19664, gcc#22482, rhbz#162935
7688         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
7689         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
7690         AC_MSG_RESULT([$stlvisok])
7691         if test "$stlvisok" = "no"; then
7692             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
7693         fi
7694     fi
7696     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
7697     # when we don't make any dynamic libraries?
7698     if test "$DISABLE_DYNLOADING" = ""; then
7699         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
7700         cat > conftestlib1.cc <<_ACEOF
7701 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7702 struct S2: S1<int> { virtual ~S2(); };
7703 S2::~S2() {}
7704 _ACEOF
7705         cat > conftestlib2.cc <<_ACEOF
7706 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7707 struct S2: S1<int> { virtual ~S2(); };
7708 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
7709 _ACEOF
7710         gccvisinlineshiddenok=yes
7711         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
7712             gccvisinlineshiddenok=no
7713         else
7714             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
7715             dnl known to not work with -z defs (unsetting which makes the test
7716             dnl moot, though):
7717             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
7718             if test "$COM_IS_CLANG" = TRUE; then
7719                 for i in $CXX $CXXFLAGS; do
7720                     case $i in
7721                     -fsanitize=*)
7722                         my_linkflagsnoundefs=
7723                         break
7724                         ;;
7725                     esac
7726                 done
7727             fi
7728             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
7729                 gccvisinlineshiddenok=no
7730             fi
7731         fi
7733         rm -fr libconftest*
7734         AC_MSG_RESULT([$gccvisinlineshiddenok])
7735         if test "$gccvisinlineshiddenok" = "no"; then
7736             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
7737         fi
7738     fi
7740    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
7741     cat >visibility.cxx <<_ACEOF
7742 #pragma GCC visibility push(hidden)
7743 struct __attribute__ ((visibility ("default"))) TestStruct {
7744   static void Init();
7746 __attribute__ ((visibility ("default"))) void TestFunc() {
7747   TestStruct::Init();
7749 _ACEOF
7750     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
7751         gccvisbroken=yes
7752     else
7753         case "$host_cpu" in
7754         i?86|x86_64)
7755             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
7756                 gccvisbroken=no
7757             else
7758                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
7759                     gccvisbroken=no
7760                 else
7761                     gccvisbroken=yes
7762                 fi
7763             fi
7764             ;;
7765         *)
7766             gccvisbroken=no
7767             ;;
7768         esac
7769     fi
7770     rm -f visibility.s visibility.cxx
7772     AC_MSG_RESULT([$gccvisbroken])
7773     if test "$gccvisbroken" = "yes"; then
7774         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
7775     fi
7777     CPPFLAGS="$save_CPPFLAGS"
7779     AC_LANG_POP([C++])
7782 dnl ===================================================================
7783 dnl  Clang++ tests
7784 dnl ===================================================================
7786 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
7787 if test "$GCC" = "yes"; then
7788     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
7789     AC_LANG_PUSH([C++])
7790     save_CXXFLAGS=$CXXFLAGS
7791     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
7792     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
7793     CXXFLAGS=$save_CXXFLAGS
7794     AC_LANG_POP([C++])
7795     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
7796         AC_MSG_RESULT([yes])
7797     else
7798         AC_MSG_RESULT([no])
7799     fi
7801 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
7803 dnl ===================================================================
7804 dnl Compiler plugins
7805 dnl ===================================================================
7807 COMPILER_PLUGINS=
7808 # currently only Clang
7810 if test "$COM_IS_CLANG" != "TRUE"; then
7811     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
7812         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
7813         enable_compiler_plugins=no
7814     fi
7817 COMPILER_PLUGINS_COM_IS_CLANG=
7818 if test "$COM_IS_CLANG" = "TRUE"; then
7819     if test -n "$enable_compiler_plugins"; then
7820         compiler_plugins="$enable_compiler_plugins"
7821     elif test -n "$ENABLE_DBGUTIL"; then
7822         compiler_plugins=test
7823     else
7824         compiler_plugins=no
7825     fi
7826     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
7827         if test "$CLANGVER" -lt 50002; then
7828             if test "$compiler_plugins" = yes; then
7829                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
7830             else
7831                 compiler_plugins=no
7832             fi
7833         fi
7834     fi
7835     if test "$compiler_plugins" != "no"; then
7836         dnl The prefix where Clang resides, override to where Clang resides if
7837         dnl using a source build:
7838         if test -z "$CLANGDIR"; then
7839             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $(printf '%s\n' $CXX | grep clang | head -n 1)))))
7840         fi
7841         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
7842         if test -z "$COMPILER_PLUGINS_CXX"; then
7843             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
7844         fi
7845         clangbindir=$CLANGDIR/bin
7846         if test "$build_os" = "cygwin"; then
7847             clangbindir=$(cygpath -u "$clangbindir")
7848         fi
7849         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
7850         if test -n "$LLVM_CONFIG"; then
7851             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
7852             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
7853             if test -z "$CLANGLIBDIR"; then
7854                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
7855             fi
7856             # Try if clang is built from source (in which case its includes are not together with llvm includes).
7857             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
7858             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
7859             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
7860                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
7861             fi
7862             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
7863             clangobjdir=$($LLVM_CONFIG --obj-root)
7864             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
7865                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
7866             fi
7867         fi
7868         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
7869         AC_LANG_PUSH([C++])
7870         save_CXX=$CXX
7871         save_CXXCPP=$CXXCPP
7872         save_CPPFLAGS=$CPPFLAGS
7873         save_CXXFLAGS=$CXXFLAGS
7874         save_LDFLAGS=$LDFLAGS
7875         save_LIBS=$LIBS
7876         CXX=$COMPILER_PLUGINS_CXX
7877         CXXCPP="$COMPILER_PLUGINS_CXX -E"
7878         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7879         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7880         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
7881             [COMPILER_PLUGINS=TRUE],
7882             [
7883             if test "$compiler_plugins" = "yes"; then
7884                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
7885             else
7886                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
7887                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
7888             fi
7889             ])
7890         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
7891         dnl comment in compilerplugins/Makefile-clang.mk:
7892         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
7893             LDFLAGS=""
7894             AC_MSG_CHECKING([for clang libraries to use])
7895             if test -z "$CLANGTOOLLIBS"; then
7896                 LIBS="-lclangTooling -lclangFrontend -lclangDriver -lclangParse -lclangSema -lclangEdit \
7897  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
7898                 AC_LINK_IFELSE([
7899                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7900                         [[ clang::FullSourceLoc().dump(); ]])
7901                 ],[CLANGTOOLLIBS="$LIBS"],[])
7902             fi
7903             if test -z "$CLANGTOOLLIBS"; then
7904                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
7905                 AC_LINK_IFELSE([
7906                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7907                         [[ clang::FullSourceLoc().dump(); ]])
7908                 ],[CLANGTOOLLIBS="$LIBS"],[])
7909             fi
7910             AC_MSG_RESULT([$CLANGTOOLLIBS])
7911             if test -z "$CLANGTOOLLIBS"; then
7912                 if test "$compiler_plugins" = "yes"; then
7913                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
7914                 else
7915                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
7916                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
7917                 fi
7918                 COMPILER_PLUGINS=
7919             fi
7920             if test -n "$COMPILER_PLUGINS"; then
7921                 if test -z "$CLANGSYSINCLUDE"; then
7922                     if test -n "$LLVM_CONFIG"; then
7923                         # Path to the clang system headers (no idea if there's a better way to get it).
7924                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/git\|svn//')/include
7925                     fi
7926                 fi
7927             fi
7928         fi
7929         CXX=$save_CXX
7930         CXXCPP=$save_CXXCPP
7931         CPPFLAGS=$save_CPPFLAGS
7932         CXXFLAGS=$save_CXXFLAGS
7933         LDFLAGS=$save_LDFLAGS
7934         LIBS="$save_LIBS"
7935         AC_LANG_POP([C++])
7937         AC_MSG_CHECKING([whether the compiler for building compilerplugins is actually Clang])
7938         AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7939             #ifndef __clang__
7940             you lose
7941             #endif
7942             int foo=42;
7943             ]])],
7944             [AC_MSG_RESULT([yes])
7945              COMPILER_PLUGINS_COM_IS_CLANG=TRUE],
7946             [AC_MSG_RESULT([no])])
7947         AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
7948     fi
7949 else
7950     if test "$enable_compiler_plugins" = "yes"; then
7951         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
7952     fi
7954 COMPILER_PLUGINS_ANALYZER_PCH=
7955 if test "$enable_compiler_plugins_analyzer_pch" != no; then
7956     COMPILER_PLUGINS_ANALYZER_PCH=TRUE
7958 AC_SUBST(COMPILER_PLUGINS)
7959 AC_SUBST(COMPILER_PLUGINS_ANALYZER_PCH)
7960 AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
7961 AC_SUBST(COMPILER_PLUGINS_CXX)
7962 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
7963 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
7964 AC_SUBST(COMPILER_PLUGINS_DEBUG)
7965 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
7966 AC_SUBST(CLANGDIR)
7967 AC_SUBST(CLANGLIBDIR)
7968 AC_SUBST(CLANGTOOLLIBS)
7969 AC_SUBST(CLANGSYSINCLUDE)
7971 # Plugin to help linker.
7972 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
7973 # This makes --enable-lto build with clang work.
7974 AC_SUBST(LD_PLUGIN)
7976 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
7977 AC_SUBST(HAVE_POSIX_FALLOCATE)
7979 JITC_PROCESSOR_TYPE=""
7980 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
7981     # IBMs JDK needs this...
7982     JITC_PROCESSOR_TYPE=6
7983     export JITC_PROCESSOR_TYPE
7985 AC_SUBST([JITC_PROCESSOR_TYPE])
7987 # Misc Windows Stuff
7988 AC_ARG_WITH(ucrt-dir,
7989     AS_HELP_STRING([--with-ucrt-dir],
7990         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
7991         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
7992         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
7993             Windows6.1-KB2999226-x64.msu
7994             Windows6.1-KB2999226-x86.msu
7995             Windows8.1-KB2999226-x64.msu
7996             Windows8.1-KB2999226-x86.msu
7997             Windows8-RT-KB2999226-x64.msu
7998             Windows8-RT-KB2999226-x86.msu
7999         A zip archive including those files is available from Microsoft site:
8000         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
8003 UCRT_REDISTDIR="$with_ucrt_dir"
8004 if test $_os = "WINNT"; then
8005     find_msvc_x64_dlls
8006     for i in $PKGFORMAT; do
8007         if test "$i" = msi; then
8008             find_msms
8009             break
8010         fi
8011     done
8012     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
8013     MSVC_DLLS="$msvcdlls"
8014     test -n "$msmdir" && MSM_PATH=`win_short_path_for_make "$msmdir"`
8015     # MSVC 15.3 changed it to VC141
8016     if echo "$msvcdllpath" | grep -q "VC142.CRT$"; then
8017         SCPDEFS="$SCPDEFS -DWITH_VC142_REDIST"
8018     elif echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
8019         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
8020     else
8021         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
8022     fi
8024     if test "$UCRT_REDISTDIR" = "no"; then
8025         dnl explicitly disabled
8026         UCRT_REDISTDIR=""
8027     else
8028         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
8029                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
8030                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
8031                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
8032                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
8033                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
8034             UCRT_REDISTDIR=""
8035             if test -n "$PKGFORMAT"; then
8036                for i in $PKGFORMAT; do
8037                    case "$i" in
8038                    msi)
8039                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
8040                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
8041                        ;;
8042                    esac
8043                done
8044             fi
8045         fi
8046     fi
8049 AC_SUBST(UCRT_REDISTDIR)
8050 AC_SUBST(MSVC_DLL_PATH)
8051 AC_SUBST(MSVC_DLLS)
8052 AC_SUBST(MSM_PATH)
8055 dnl ===================================================================
8056 dnl Checks for Java
8057 dnl ===================================================================
8058 if test "$ENABLE_JAVA" != ""; then
8060     # Windows-specific tests
8061     if test "$build_os" = "cygwin"; then
8062         if test -z "$with_jdk_home"; then
8063             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
8064             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
8065             reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
8066             if test -n "$regvalue"; then
8067                 ver=$regvalue
8068                 reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
8069                 with_jdk_home=$regvalue
8070             fi
8071             howfound="found automatically"
8072         else
8073             with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
8074             howfound="you passed"
8075         fi
8077         if ! test -f "$with_jdk_home/lib/jvm.lib" -a -f "$with_jdk_home/bin/java.exe"; then
8078             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])
8079         fi
8080     fi
8082     # 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.
8083     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
8084     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
8085         with_jdk_home=`/usr/libexec/java_home`
8086     fi
8088     JAVA_HOME=; export JAVA_HOME
8089     if test -z "$with_jdk_home"; then
8090         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
8091     else
8092         _java_path="$with_jdk_home/bin/$with_java"
8093         dnl Check if there is a Java interpreter at all.
8094         if test -x "$_java_path"; then
8095             JAVAINTERPRETER=$_java_path
8096         else
8097             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
8098         fi
8099     fi
8101     dnl Check that the JDK found is correct architecture (at least 2 reasons to
8102     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
8103     dnl loaded by java to run JunitTests:
8104     if test "$build_os" = "cygwin" -a "$cross_compiling" != "yes"; then
8105         shortjdkhome=`cygpath -d "$with_jdk_home"`
8106         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
8107             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
8108             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8109         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
8110             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8111             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8112         fi
8114         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
8115             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
8116         fi
8117         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
8118     elif test "$cross_compiling" != "yes"; then
8119         case $CPUNAME in
8120             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
8121                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
8122                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
8123                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8124                 fi
8125                 ;;
8126             *) # assumption: everything else 32-bit
8127                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
8128                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8129                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8130                 fi
8131                 ;;
8132         esac
8133     fi
8136 dnl ===================================================================
8137 dnl Checks for JDK.
8138 dnl ===================================================================
8140 # Whether all the complexity here actually is needed any more or not, no idea.
8142 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8143     _gij_longver=0
8144     AC_MSG_CHECKING([the installed JDK])
8145     if test -n "$JAVAINTERPRETER"; then
8146         dnl java -version sends output to stderr!
8147         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
8148             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8149         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
8150             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8151         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
8152             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8153         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
8154             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8155         else
8156             JDK=sun
8158             dnl Sun JDK specific tests
8159             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
8160             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
8162             if test "$_jdk_ver" -lt 10900; then
8163                 AC_MSG_ERROR([JDK is too old, you need at least 9 ($_jdk_ver < 10900)])
8164             fi
8165             if test "$_jdk_ver" -gt 10900; then
8166                 JAVA_CLASSPATH_NOT_SET=TRUE
8167             fi
8169             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
8170             if test "$_os" = "WINNT"; then
8171                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
8172             fi
8173             AC_MSG_RESULT([found $JAVA_HOME (JDK $_jdk)])
8175             # set to limit VM usage for JunitTests
8176             JAVAIFLAGS=-Xmx64M
8177             # set to limit VM usage for javac
8178             JAVACFLAGS=-J-Xmx128M
8179         fi
8180     else
8181         AC_MSG_ERROR([Java not found. You need at least JDK 9])
8182     fi
8183 else
8184     if test -z "$ENABLE_JAVA"; then
8185         dnl Java disabled
8186         JAVA_HOME=
8187         export JAVA_HOME
8188     elif test "$cross_compiling" = "yes"; then
8189         # Just assume compatibility of build and host JDK
8190         JDK=$JDK_FOR_BUILD
8191         JAVAIFLAGS=$JAVAIFLAGS_FOR_BUILD
8192     fi
8195 dnl ===================================================================
8196 dnl Checks for javac
8197 dnl ===================================================================
8198 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8199     javacompiler="javac"
8200     : ${JAVA_SOURCE_VER=8}
8201     : ${JAVA_TARGET_VER=8}
8202     if test -z "$with_jdk_home"; then
8203         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
8204     else
8205         _javac_path="$with_jdk_home/bin/$javacompiler"
8206         dnl Check if there is a Java compiler at all.
8207         if test -x "$_javac_path"; then
8208             JAVACOMPILER=$_javac_path
8209         fi
8210     fi
8211     if test -z "$JAVACOMPILER"; then
8212         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
8213     fi
8214     if test "$build_os" = "cygwin"; then
8215         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
8216             JAVACOMPILER="${JAVACOMPILER}.exe"
8217         fi
8218         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
8219     fi
8222 dnl ===================================================================
8223 dnl Checks for javadoc
8224 dnl ===================================================================
8225 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8226     if test -z "$with_jdk_home"; then
8227         AC_PATH_PROG(JAVADOC, javadoc)
8228     else
8229         _javadoc_path="$with_jdk_home/bin/javadoc"
8230         dnl Check if there is a javadoc at all.
8231         if test -x "$_javadoc_path"; then
8232             JAVADOC=$_javadoc_path
8233         else
8234             AC_PATH_PROG(JAVADOC, javadoc)
8235         fi
8236     fi
8237     if test -z "$JAVADOC"; then
8238         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
8239     fi
8240     if test "$build_os" = "cygwin"; then
8241         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
8242             JAVADOC="${JAVADOC}.exe"
8243         fi
8244         JAVADOC=`win_short_path_for_make "$JAVADOC"`
8245     fi
8247     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
8248     JAVADOCISGJDOC="yes"
8249     fi
8251 AC_SUBST(JAVADOC)
8252 AC_SUBST(JAVADOCISGJDOC)
8254 if test "$ENABLE_JAVA" != "" -a \( "$cross_compiling" != "yes" -o -n "$with_jdk_home" \); then
8255     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
8256     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
8257         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
8258            # try to recover first by looking whether we have an alternative
8259            # system as in Debian or newer SuSEs where following /usr/bin/javac
8260            # over /etc/alternatives/javac leads to the right bindir where we
8261            # just need to strip a bit away to get a valid JAVA_HOME
8262            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
8263         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
8264             # maybe only one level of symlink (e.g. on Mac)
8265             JAVA_HOME=$(readlink $JAVACOMPILER)
8266             if test "$(dirname $JAVA_HOME)" = "."; then
8267                 # we've got no path to trim back
8268                 JAVA_HOME=""
8269             fi
8270         else
8271             # else warn
8272             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
8273             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
8274             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
8275             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
8276         fi
8277         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
8278         if test "$JAVA_HOME" != "/usr"; then
8279             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8280                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
8281                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
8282                 dnl Tiger already returns a JDK path...
8283                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
8284             else
8285                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
8286                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
8287                 dnl that checks which version to run
8288                 if test -f "$JAVA_HOME"; then
8289                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
8290                 fi
8291             fi
8292         fi
8293     fi
8294     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
8296     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
8297     if test -z "$JAVA_HOME"; then
8298         if test "x$with_jdk_home" = "x"; then
8299             cat > findhome.java <<_ACEOF
8300 [import java.io.File;
8302 class findhome
8304     public static void main(String args[])
8305     {
8306         String jrelocation = System.getProperty("java.home");
8307         File jre = new File(jrelocation);
8308         System.out.println(jre.getParent());
8309     }
8311 _ACEOF
8312             AC_MSG_CHECKING([if javac works])
8313             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
8314             AC_TRY_EVAL(javac_cmd)
8315             if test $? = 0 -a -f ./findhome.class; then
8316                 AC_MSG_RESULT([javac works])
8317             else
8318                 echo "configure: javac test failed" >&5
8319                 cat findhome.java >&5
8320                 AC_MSG_ERROR([javac does not work - java projects will not build!])
8321             fi
8322             AC_MSG_CHECKING([if gij knows its java.home])
8323             JAVA_HOME=`$JAVAINTERPRETER findhome`
8324             if test $? = 0 -a "$JAVA_HOME" != ""; then
8325                 AC_MSG_RESULT([$JAVA_HOME])
8326             else
8327                 echo "configure: java test failed" >&5
8328                 cat findhome.java >&5
8329                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
8330             fi
8331             # clean-up after ourselves
8332             rm -f ./findhome.java ./findhome.class
8333         else
8334             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
8335         fi
8336     fi
8338     # now check if $JAVA_HOME is really valid
8339     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8340         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
8341             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
8342             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
8343             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
8344             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
8345             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
8346             add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
8347         fi
8348     fi
8349     PathFormat "$JAVA_HOME"
8350     JAVA_HOME="$formatted_path"
8353 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
8354     "$_os" != Darwin
8355 then
8356     AC_MSG_CHECKING([for JAWT lib])
8357     if test "$_os" = WINNT; then
8358         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
8359         JAWTLIB=jawt.lib
8360     else
8361         case "$host_cpu" in
8362         arm*)
8363             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
8364             JAVA_ARCH=$my_java_arch
8365             ;;
8366         i*86)
8367             my_java_arch=i386
8368             ;;
8369         m68k)
8370             my_java_arch=m68k
8371             ;;
8372         powerpc)
8373             my_java_arch=ppc
8374             ;;
8375         powerpc64)
8376             my_java_arch=ppc64
8377             ;;
8378         powerpc64le)
8379             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
8380             JAVA_ARCH=$my_java_arch
8381             ;;
8382         sparc64)
8383             my_java_arch=sparcv9
8384             ;;
8385         x86_64)
8386             my_java_arch=amd64
8387             ;;
8388         *)
8389             my_java_arch=$host_cpu
8390             ;;
8391         esac
8392         # This is where JDK9 puts the library
8393         if test -e "$JAVA_HOME/lib/libjawt.so"; then
8394             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
8395         else
8396             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
8397         fi
8398         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
8399     fi
8400     AC_MSG_RESULT([$JAWTLIB])
8402 AC_SUBST(JAWTLIB)
8404 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
8405     case "$host_os" in
8407     aix*)
8408         JAVAINC="-I$JAVA_HOME/include"
8409         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
8410         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8411         ;;
8413     cygwin*|wsl*)
8414         JAVAINC="-I$JAVA_HOME/include/win32"
8415         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
8416         ;;
8418     darwin*|macos*)
8419         if test -d "$JAVA_HOME/include/darwin"; then
8420             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
8421         else
8422             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
8423         fi
8424         ;;
8426     dragonfly*)
8427         JAVAINC="-I$JAVA_HOME/include"
8428         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8429         ;;
8431     freebsd*)
8432         JAVAINC="-I$JAVA_HOME/include"
8433         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
8434         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
8435         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8436         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8437         ;;
8439     k*bsd*-gnu*)
8440         JAVAINC="-I$JAVA_HOME/include"
8441         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8442         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8443         ;;
8445     linux-gnu*)
8446         JAVAINC="-I$JAVA_HOME/include"
8447         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8448         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8449         ;;
8451     *netbsd*)
8452         JAVAINC="-I$JAVA_HOME/include"
8453         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
8454         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8455        ;;
8457     openbsd*)
8458         JAVAINC="-I$JAVA_HOME/include"
8459         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
8460         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8461         ;;
8463     solaris*)
8464         JAVAINC="-I$JAVA_HOME/include"
8465         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
8466         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8467         ;;
8468     esac
8470 SOLARINC="$SOLARINC $JAVAINC"
8472 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8473     JAVA_HOME_FOR_BUILD=$JAVA_HOME
8474     JAVAIFLAGS_FOR_BUILD=$JAVAIFLAGS
8475     JDK_FOR_BUILD=$JDK
8478 AC_SUBST(JAVACFLAGS)
8479 AC_SUBST(JAVACOMPILER)
8480 AC_SUBST(JAVAINTERPRETER)
8481 AC_SUBST(JAVAIFLAGS)
8482 AC_SUBST(JAVAIFLAGS_FOR_BUILD)
8483 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
8484 AC_SUBST(JAVA_HOME)
8485 AC_SUBST(JAVA_HOME_FOR_BUILD)
8486 AC_SUBST(JDK)
8487 AC_SUBST(JDK_FOR_BUILD)
8488 AC_SUBST(JAVA_SOURCE_VER)
8489 AC_SUBST(JAVA_TARGET_VER)
8492 dnl ===================================================================
8493 dnl Export file validation
8494 dnl ===================================================================
8495 AC_MSG_CHECKING([whether to enable export file validation])
8496 if test "$with_export_validation" != "no"; then
8497     if test -z "$ENABLE_JAVA"; then
8498         if test "$with_export_validation" = "yes"; then
8499             AC_MSG_ERROR([requested, but Java is disabled])
8500         else
8501             AC_MSG_RESULT([no, as Java is disabled])
8502         fi
8503     elif ! test -d "${SRC_ROOT}/schema"; then
8504         if test "$with_export_validation" = "yes"; then
8505             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
8506         else
8507             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
8508         fi
8509     else
8510         AC_MSG_RESULT([yes])
8511         AC_DEFINE(HAVE_EXPORT_VALIDATION)
8513         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
8514         if test -z "$ODFVALIDATOR"; then
8515             # remember to download the ODF toolkit with validator later
8516             AC_MSG_NOTICE([no odfvalidator found, will download it])
8517             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
8518             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
8520             # and fetch name of odfvalidator jar name from download.lst
8521             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
8522             AC_SUBST(ODFVALIDATOR_JAR)
8524             if test -z "$ODFVALIDATOR_JAR"; then
8525                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
8526             fi
8527         fi
8528         if test "$build_os" = "cygwin"; then
8529             # In case of Cygwin it will be executed from Windows,
8530             # so we need to run bash and absolute path to validator
8531             # so instead of "odfvalidator" it will be
8532             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
8533             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
8534         else
8535             ODFVALIDATOR="sh $ODFVALIDATOR"
8536         fi
8537         AC_SUBST(ODFVALIDATOR)
8540         AC_PATH_PROGS(OFFICEOTRON, officeotron)
8541         if test -z "$OFFICEOTRON"; then
8542             # remember to download the officeotron with validator later
8543             AC_MSG_NOTICE([no officeotron found, will download it])
8544             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
8545             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
8547             # and fetch name of officeotron jar name from download.lst
8548             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
8549             AC_SUBST(OFFICEOTRON_JAR)
8551             if test -z "$OFFICEOTRON_JAR"; then
8552                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
8553             fi
8554         else
8555             # check version of existing officeotron
8556             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
8557             if test 0"$OFFICEOTRON_VER" -lt 704; then
8558                 AC_MSG_ERROR([officeotron too old])
8559             fi
8560         fi
8561         if test "$build_os" = "cygwin"; then
8562             # In case of Cygwin it will be executed from Windows,
8563             # so we need to run bash and absolute path to validator
8564             # so instead of "odfvalidator" it will be
8565             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
8566             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
8567         else
8568             OFFICEOTRON="sh $OFFICEOTRON"
8569         fi
8570     fi
8571     AC_SUBST(OFFICEOTRON)
8572 else
8573     AC_MSG_RESULT([no])
8576 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
8577 if test "$with_bffvalidator" != "no"; then
8578     AC_DEFINE(HAVE_BFFVALIDATOR)
8580     if test "$with_export_validation" = "no"; then
8581         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
8582     fi
8584     if test "$with_bffvalidator" = "yes"; then
8585         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
8586     else
8587         BFFVALIDATOR="$with_bffvalidator"
8588     fi
8590     if test "$build_os" = "cygwin"; then
8591         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
8592             AC_MSG_RESULT($BFFVALIDATOR)
8593         else
8594             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8595         fi
8596     elif test -n "$BFFVALIDATOR"; then
8597         # We are not in Cygwin but need to run Windows binary with wine
8598         AC_PATH_PROGS(WINE, wine)
8600         # so swap in a shell wrapper that converts paths transparently
8601         BFFVALIDATOR_EXE="$BFFVALIDATOR"
8602         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
8603         AC_SUBST(BFFVALIDATOR_EXE)
8604         AC_MSG_RESULT($BFFVALIDATOR)
8605     else
8606         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8607     fi
8608     AC_SUBST(BFFVALIDATOR)
8609 else
8610     AC_MSG_RESULT([no])
8613 dnl ===================================================================
8614 dnl Check for C preprocessor to use
8615 dnl ===================================================================
8616 AC_MSG_CHECKING([which C preprocessor to use in idlc])
8617 if test -n "$with_idlc_cpp"; then
8618     AC_MSG_RESULT([$with_idlc_cpp])
8619     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
8620 else
8621     AC_MSG_RESULT([ucpp])
8622     AC_MSG_CHECKING([which ucpp tp use])
8623     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
8624         AC_MSG_RESULT([external])
8625         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
8626     else
8627         AC_MSG_RESULT([internal])
8628         BUILD_TYPE="$BUILD_TYPE UCPP"
8629     fi
8631 AC_SUBST(SYSTEM_UCPP)
8633 dnl ===================================================================
8634 dnl Check for epm (not needed for Windows)
8635 dnl ===================================================================
8636 AC_MSG_CHECKING([whether to enable EPM for packing])
8637 if test "$enable_epm" = "yes"; then
8638     AC_MSG_RESULT([yes])
8639     if test "$_os" != "WINNT"; then
8640         if test $_os = Darwin; then
8641             EPM=internal
8642         elif test -n "$with_epm"; then
8643             EPM=$with_epm
8644         else
8645             AC_PATH_PROG(EPM, epm, no)
8646         fi
8647         if test "$EPM" = "no" -o "$EPM" = "internal"; then
8648             AC_MSG_NOTICE([EPM will be built.])
8649             BUILD_TYPE="$BUILD_TYPE EPM"
8650             EPM=${WORKDIR}/UnpackedTarball/epm/epm
8651         else
8652             # Gentoo has some epm which is something different...
8653             AC_MSG_CHECKING([whether the found epm is the right epm])
8654             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
8655                 AC_MSG_RESULT([yes])
8656             else
8657                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8658             fi
8659             AC_MSG_CHECKING([epm version])
8660             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
8661             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
8662                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
8663                 AC_MSG_RESULT([OK, >= 3.7])
8664             else
8665                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
8666                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8667             fi
8668         fi
8669     fi
8671     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
8672         AC_MSG_CHECKING([for rpm])
8673         for a in "$RPM" rpmbuild rpm; do
8674             $a --usage >/dev/null 2> /dev/null
8675             if test $? -eq 0; then
8676                 RPM=$a
8677                 break
8678             else
8679                 $a --version >/dev/null 2> /dev/null
8680                 if test $? -eq 0; then
8681                     RPM=$a
8682                     break
8683                 fi
8684             fi
8685         done
8686         if test -z "$RPM"; then
8687             AC_MSG_ERROR([not found])
8688         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
8689             RPM_PATH=`which $RPM`
8690             AC_MSG_RESULT([$RPM_PATH])
8691             SCPDEFS="$SCPDEFS -DWITH_RPM"
8692         else
8693             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
8694         fi
8695     fi
8696     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
8697         AC_PATH_PROG(DPKG, dpkg, no)
8698         if test "$DPKG" = "no"; then
8699             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
8700         fi
8701     fi
8702     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
8703        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8704         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
8705             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
8706                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
8707                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
8708                     AC_MSG_RESULT([yes])
8709                 else
8710                     AC_MSG_RESULT([no])
8711                     if echo "$PKGFORMAT" | $GREP -q rpm; then
8712                         _pt="rpm"
8713                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
8714                         add_warning "the rpms will need to be installed with --nodeps"
8715                     else
8716                         _pt="pkg"
8717                     fi
8718                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
8719                     add_warning "the ${_pt}s will not be relocatable"
8720                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
8721                                  relocation will work, you need to patch your epm with the
8722                                  patch in epm/epm-3.7.patch or build with
8723                                  --with-epm=internal which will build a suitable epm])
8724                 fi
8725             fi
8726         fi
8727     fi
8728     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8729         AC_PATH_PROG(PKGMK, pkgmk, no)
8730         if test "$PKGMK" = "no"; then
8731             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
8732         fi
8733     fi
8734     AC_SUBST(RPM)
8735     AC_SUBST(DPKG)
8736     AC_SUBST(PKGMK)
8737 else
8738     for i in $PKGFORMAT; do
8739         case "$i" in
8740         aix | bsd | deb | pkg | rpm | native | portable)
8741             AC_MSG_ERROR(
8742                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
8743             ;;
8744         esac
8745     done
8746     AC_MSG_RESULT([no])
8747     EPM=NO
8749 AC_SUBST(EPM)
8751 ENABLE_LWP=
8752 if test "$enable_lotuswordpro" = "yes"; then
8753     ENABLE_LWP="TRUE"
8755 AC_SUBST(ENABLE_LWP)
8757 dnl ===================================================================
8758 dnl Check for building ODK
8759 dnl ===================================================================
8760 if test "$enable_odk" = no; then
8761     unset DOXYGEN
8762 else
8763     if test "$with_doxygen" = no; then
8764         AC_MSG_CHECKING([for doxygen])
8765         unset DOXYGEN
8766         AC_MSG_RESULT([no])
8767     else
8768         if test "$with_doxygen" = yes; then
8769             AC_PATH_PROG([DOXYGEN], [doxygen])
8770             if test -z "$DOXYGEN"; then
8771                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
8772             fi
8773             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
8774                 if ! dot -V 2>/dev/null; then
8775                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
8776                 fi
8777             fi
8778         else
8779             AC_MSG_CHECKING([for doxygen])
8780             DOXYGEN=$with_doxygen
8781             AC_MSG_RESULT([$DOXYGEN])
8782         fi
8783         if test -n "$DOXYGEN"; then
8784             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
8785             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
8786             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
8787                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
8788             fi
8789         fi
8790     fi
8792 AC_SUBST([DOXYGEN])
8794 AC_MSG_CHECKING([whether to build the ODK])
8795 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
8796     AC_MSG_RESULT([yes])
8797     BUILD_TYPE="$BUILD_TYPE ODK"
8798 else
8799     AC_MSG_RESULT([no])
8802 dnl ===================================================================
8803 dnl Check for system zlib
8804 dnl ===================================================================
8805 if test "$with_system_zlib" = "auto"; then
8806     case "$_os" in
8807     WINNT)
8808         with_system_zlib="$with_system_libs"
8809         ;;
8810     *)
8811         if test "$enable_fuzzers" != "yes"; then
8812             with_system_zlib=yes
8813         else
8814             with_system_zlib=no
8815         fi
8816         ;;
8817     esac
8820 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8821 dnl and has no pkg-config for it at least on some tinderboxes,
8822 dnl so leaving that out for now
8823 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8824 AC_MSG_CHECKING([which zlib to use])
8825 if test "$with_system_zlib" = "yes"; then
8826     AC_MSG_RESULT([external])
8827     SYSTEM_ZLIB=TRUE
8828     AC_CHECK_HEADER(zlib.h, [],
8829         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8830     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8831         [AC_MSG_ERROR(zlib not found or functional)], [])
8832 else
8833     AC_MSG_RESULT([internal])
8834     SYSTEM_ZLIB=
8835     BUILD_TYPE="$BUILD_TYPE ZLIB"
8836     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8837     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8839 AC_SUBST(ZLIB_CFLAGS)
8840 AC_SUBST(ZLIB_LIBS)
8841 AC_SUBST(SYSTEM_ZLIB)
8843 dnl ===================================================================
8844 dnl Check for system jpeg
8845 dnl ===================================================================
8846 AC_MSG_CHECKING([which libjpeg to use])
8847 if test "$with_system_jpeg" = "yes"; then
8848     AC_MSG_RESULT([external])
8849     SYSTEM_LIBJPEG=TRUE
8850     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8851         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8852     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8853         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8854 else
8855     SYSTEM_LIBJPEG=
8856     AC_MSG_RESULT([internal, libjpeg-turbo])
8857     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8858     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
8859     if test "$COM" = "MSC"; then
8860         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
8861     else
8862         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
8863     fi
8865     case "$host_cpu" in
8866     x86_64 | amd64 | i*86 | x86 | ia32)
8867         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8868         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8869             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8870                 NASM="$LODE_HOME/opt/bin/nasm"
8871             elif test -x "/opt/lo/bin/nasm"; then
8872                 NASM="/opt/lo/bin/nasm"
8873             fi
8874         fi
8876         if test -n "$NASM"; then
8877             AC_MSG_CHECKING([for object file format of host system])
8878             case "$host_os" in
8879               cygwin* | mingw* | pw32* | wsl*)
8880                 case "$host_cpu" in
8881                   x86_64)
8882                     objfmt='Win64-COFF'
8883                     ;;
8884                   *)
8885                     objfmt='Win32-COFF'
8886                     ;;
8887                 esac
8888               ;;
8889               msdosdjgpp* | go32*)
8890                 objfmt='COFF'
8891               ;;
8892               os2-emx*) # not tested
8893                 objfmt='MSOMF' # obj
8894               ;;
8895               linux*coff* | linux*oldld*)
8896                 objfmt='COFF' # ???
8897               ;;
8898               linux*aout*)
8899                 objfmt='a.out'
8900               ;;
8901               linux*)
8902                 case "$host_cpu" in
8903                   x86_64)
8904                     objfmt='ELF64'
8905                     ;;
8906                   *)
8907                     objfmt='ELF'
8908                     ;;
8909                 esac
8910               ;;
8911               kfreebsd* | freebsd* | netbsd* | openbsd*)
8912                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
8913                   objfmt='BSD-a.out'
8914                 else
8915                   case "$host_cpu" in
8916                     x86_64 | amd64)
8917                       objfmt='ELF64'
8918                       ;;
8919                     *)
8920                       objfmt='ELF'
8921                       ;;
8922                   esac
8923                 fi
8924               ;;
8925               solaris* | sunos* | sysv* | sco*)
8926                 case "$host_cpu" in
8927                   x86_64)
8928                     objfmt='ELF64'
8929                     ;;
8930                   *)
8931                     objfmt='ELF'
8932                     ;;
8933                 esac
8934               ;;
8935               darwin* | rhapsody* | nextstep* | openstep* | macos*)
8936                 case "$host_cpu" in
8937                   x86_64)
8938                     objfmt='Mach-O64'
8939                     ;;
8940                   *)
8941                     objfmt='Mach-O'
8942                     ;;
8943                 esac
8944               ;;
8945               *)
8946                 objfmt='ELF ?'
8947               ;;
8948             esac
8950             AC_MSG_RESULT([$objfmt])
8951             if test "$objfmt" = 'ELF ?'; then
8952               objfmt='ELF'
8953               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
8954             fi
8956             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
8957             case "$objfmt" in
8958               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
8959               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
8960               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
8961               COFF)       NAFLAGS='-fcoff -DCOFF';;
8962               a.out)      NAFLAGS='-faout -DAOUT';;
8963               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
8964               ELF)        NAFLAGS='-felf -DELF';;
8965               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
8966               RDF)        NAFLAGS='-frdf -DRDF';;
8967               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
8968               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
8969             esac
8970             AC_MSG_RESULT([$NAFLAGS])
8972             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
8973             cat > conftest.asm << EOF
8974             [%line __oline__ "configure"
8975                     section .text
8976                     global  _main,main
8977             _main:
8978             main:   xor     eax,eax
8979                     ret
8980             ]
8982             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
8983             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
8984               AC_MSG_RESULT(yes)
8985             else
8986               echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
8987               cat conftest.asm >&AS_MESSAGE_LOG_FD
8988               rm -rf conftest*
8989               AC_MSG_RESULT(no)
8990               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
8991               NASM=""
8992             fi
8994         fi
8996         if test -z "$NASM"; then
8997 cat << _EOS
8998 ****************************************************************************
8999 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
9000 To get one please:
9002 _EOS
9003             if test "$build_os" = "cygwin"; then
9004 cat << _EOS
9005 install a pre-compiled binary for Win32
9007 mkdir -p /opt/lo/bin
9008 cd /opt/lo/bin
9009 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
9010 chmod +x nasm
9012 or get and install one from http://www.nasm.us/
9014 Then re-run autogen.sh
9016 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
9017 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
9019 _EOS
9020             else
9021 cat << _EOS
9022 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
9024 _EOS
9025             fi
9026             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
9027             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
9028         fi
9029       ;;
9030     esac
9033 AC_SUBST(NASM)
9034 AC_SUBST(LIBJPEG_CFLAGS)
9035 AC_SUBST(LIBJPEG_LIBS)
9036 AC_SUBST(SYSTEM_LIBJPEG)
9038 dnl ===================================================================
9039 dnl Check for system clucene
9040 dnl ===================================================================
9041 dnl we should rather be using
9042 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
9043 dnl but the contribs-lib check seems tricky
9044 AC_MSG_CHECKING([which clucene to use])
9045 if test "$with_system_clucene" = "yes"; then
9046     AC_MSG_RESULT([external])
9047     SYSTEM_CLUCENE=TRUE
9048     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
9049     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
9050     FilterLibs "${CLUCENE_LIBS}"
9051     CLUCENE_LIBS="${filteredlibs}"
9052     AC_LANG_PUSH([C++])
9053     save_CXXFLAGS=$CXXFLAGS
9054     save_CPPFLAGS=$CPPFLAGS
9055     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
9056     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
9057     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
9058     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
9059     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
9060                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
9061     CXXFLAGS=$save_CXXFLAGS
9062     CPPFLAGS=$save_CPPFLAGS
9063     AC_LANG_POP([C++])
9065     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
9066 else
9067     AC_MSG_RESULT([internal])
9068     SYSTEM_CLUCENE=
9069     BUILD_TYPE="$BUILD_TYPE CLUCENE"
9071 AC_SUBST(SYSTEM_CLUCENE)
9072 AC_SUBST(CLUCENE_CFLAGS)
9073 AC_SUBST(CLUCENE_LIBS)
9075 dnl ===================================================================
9076 dnl Check for system expat
9077 dnl ===================================================================
9078 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
9080 dnl ===================================================================
9081 dnl Check for system xmlsec
9082 dnl ===================================================================
9083 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
9085 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
9086 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
9087     ENABLE_EOT="TRUE"
9088     AC_DEFINE([ENABLE_EOT])
9089     AC_MSG_RESULT([yes])
9091     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
9092 else
9093     ENABLE_EOT=
9094     AC_MSG_RESULT([no])
9096 AC_SUBST([ENABLE_EOT])
9098 dnl ===================================================================
9099 dnl Check for DLP libs
9100 dnl ===================================================================
9101 AS_IF([test "$COM" = "MSC"],
9102       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
9103       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
9105 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
9107 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
9109 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
9111 AS_IF([test "$COM" = "MSC"],
9112       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
9113       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
9115 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
9117 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
9119 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
9120 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.12])
9122 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
9124 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
9126 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
9128 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
9129 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.18])
9131 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
9132 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
9134 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
9136 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
9137 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
9139 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
9141 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
9143 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
9145 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
9147 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
9148 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.7])
9150 dnl ===================================================================
9151 dnl Check for system lcms2
9152 dnl ===================================================================
9153 if test "$with_system_lcms2" != "yes"; then
9154     SYSTEM_LCMS2=
9156 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
9157 if test "$GCC" = "yes"; then
9158     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
9160 if test "$COM" = "MSC"; then # override the above
9161     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
9164 dnl ===================================================================
9165 dnl Check for system cppunit
9166 dnl ===================================================================
9167 if test "$_os" != "Android" ; then
9168     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
9171 dnl ===================================================================
9172 dnl Check whether freetype is available
9173 dnl ===================================================================
9174 if test  "$test_freetype" = "yes"; then
9175     AC_MSG_CHECKING([whether freetype is available])
9176     # FreeType has 3 different kinds of versions
9177     # * release, like 2.4.10
9178     # * libtool, like 13.0.7 (this what pkg-config returns)
9179     # * soname
9180     # FreeType's docs/VERSION.DLL provides a table mapping between the three
9181     #
9182     # 9.9.3 is 2.2.0
9183     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
9184     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9185     FilterLibs "${FREETYPE_LIBS}"
9186     FREETYPE_LIBS="${filteredlibs}"
9187     SYSTEM_FREETYPE=TRUE
9188 else
9189     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
9190     if test "x$ac_config_site_64bit_host" = xYES; then
9191         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
9192     else
9193         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
9194     fi
9196 AC_SUBST(FREETYPE_CFLAGS)
9197 AC_SUBST(FREETYPE_LIBS)
9198 AC_SUBST([SYSTEM_FREETYPE])
9200 # ===================================================================
9201 # Check for system libxslt
9202 # to prevent incompatibilities between internal libxml2 and external libxslt,
9203 # or vice versa, use with_system_libxml here
9204 # ===================================================================
9205 if test "$with_system_libxml" = "auto"; then
9206     case "$_os" in
9207     WINNT|iOS|Android)
9208         with_system_libxml="$with_system_libs"
9209         ;;
9210     *)
9211         if test "$enable_fuzzers" != "yes"; then
9212             with_system_libxml=yes
9213         else
9214             with_system_libxml=no
9215         fi
9216         ;;
9217     esac
9220 AC_MSG_CHECKING([which libxslt to use])
9221 if test "$with_system_libxml" = "yes"; then
9222     AC_MSG_RESULT([external])
9223     SYSTEM_LIBXSLT=TRUE
9224     if test "$_os" = "Darwin"; then
9225         dnl make sure to use SDK path
9226         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9227         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
9228         dnl omit -L/usr/lib
9229         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
9230         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
9231     else
9232         PKG_CHECK_MODULES(LIBXSLT, libxslt)
9233         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9234         FilterLibs "${LIBXSLT_LIBS}"
9235         LIBXSLT_LIBS="${filteredlibs}"
9236         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
9237         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9238         FilterLibs "${LIBEXSLT_LIBS}"
9239         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
9240     fi
9242     dnl Check for xsltproc
9243     AC_PATH_PROG(XSLTPROC, xsltproc, no)
9244     if test "$XSLTPROC" = "no"; then
9245         AC_MSG_ERROR([xsltproc is required])
9246     fi
9247 else
9248     AC_MSG_RESULT([internal])
9249     SYSTEM_LIBXSLT=
9250     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
9252 AC_SUBST(SYSTEM_LIBXSLT)
9253 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
9254     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
9256 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
9258 AC_SUBST(LIBEXSLT_CFLAGS)
9259 AC_SUBST(LIBEXSLT_LIBS)
9260 AC_SUBST(LIBXSLT_CFLAGS)
9261 AC_SUBST(LIBXSLT_LIBS)
9262 AC_SUBST(XSLTPROC)
9264 # ===================================================================
9265 # Check for system libxml
9266 # ===================================================================
9267 AC_MSG_CHECKING([which libxml to use])
9268 if test "$with_system_libxml" = "yes"; then
9269     AC_MSG_RESULT([external])
9270     SYSTEM_LIBXML=TRUE
9271     if test "$_os" = "Darwin"; then
9272         dnl make sure to use SDK path
9273         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9274         dnl omit -L/usr/lib
9275         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
9276     elif test $_os = iOS; then
9277         dnl make sure to use SDK path
9278         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
9279         LIBXML_CFLAGS="-I$usr/include/libxml2"
9280         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
9281     else
9282         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
9283         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9284         FilterLibs "${LIBXML_LIBS}"
9285         LIBXML_LIBS="${filteredlibs}"
9286     fi
9288     dnl Check for xmllint
9289     AC_PATH_PROG(XMLLINT, xmllint, no)
9290     if test "$XMLLINT" = "no"; then
9291         AC_MSG_ERROR([xmllint is required])
9292     fi
9293 else
9294     AC_MSG_RESULT([internal])
9295     SYSTEM_LIBXML=
9296     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
9297     if test "$COM" = "MSC"; then
9298         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9299     fi
9300     if test "$COM" = "MSC"; then
9301         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
9302     else
9303         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
9304         if test "$_os" = Android; then
9305             LIBXML_LIBS="$LIBXML_LIBS -lm"
9306         fi
9307     fi
9308     BUILD_TYPE="$BUILD_TYPE LIBXML2"
9310 AC_SUBST(SYSTEM_LIBXML)
9311 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
9312     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
9314 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
9315 AC_SUBST(LIBXML_CFLAGS)
9316 AC_SUBST(LIBXML_LIBS)
9317 AC_SUBST(XMLLINT)
9319 # =====================================================================
9320 # Checking for a Python interpreter with version >= 3.3.
9321 # Optionally user can pass an option to configure, i. e.
9322 # ./configure PYTHON=/usr/bin/python
9323 # =====================================================================
9324 if test $_os = Darwin -a "$enable_python" != no -a "$enable_python" != fully-internal -a "$enable_python" != internal -a "$enable_python" != system; then
9325     # Only allowed choices for macOS are 'no', 'internal' (default), and 'fully-internal'
9326     # unless PYTHON is defined as above which allows 'system'
9327     enable_python=internal
9329 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
9330     if test -n "$PYTHON"; then
9331         PYTHON_FOR_BUILD=$PYTHON
9332     else
9333         # This allows a lack of system python with no error, we use internal one in that case.
9334         AM_PATH_PYTHON([3.3],, [:])
9335         # Clean PYTHON_VERSION checked below if cross-compiling
9336         PYTHON_VERSION=""
9337         if test "$PYTHON" != ":"; then
9338             PYTHON_FOR_BUILD=$PYTHON
9339         fi
9340     fi
9342 AC_SUBST(PYTHON_FOR_BUILD)
9344 # Checks for Python to use for Pyuno
9345 AC_MSG_CHECKING([which Python to use for Pyuno])
9346 case "$enable_python" in
9347 no|disable)
9348     if test -z $PYTHON_FOR_BUILD; then
9349         # Python is required to build LibreOffice. In theory we could separate the build-time Python
9350         # requirement from the choice whether to include Python stuff in the installer, but why
9351         # bother?
9352         AC_MSG_ERROR([Python is required at build time.])
9353     fi
9354     enable_python=no
9355     AC_MSG_RESULT([none])
9356     ;;
9357 ""|yes|auto)
9358     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
9359         AC_MSG_RESULT([no, overridden by --disable-scripting])
9360         enable_python=no
9361     elif test $build_os = cygwin; then
9362         dnl When building on Windows we don't attempt to use any installed
9363         dnl "system"  Python.
9364         AC_MSG_RESULT([fully internal])
9365         enable_python=internal
9366     elif test "$cross_compiling" = yes; then
9367         AC_MSG_RESULT([system])
9368         enable_python=system
9369     else
9370         # Unset variables set by the above AM_PATH_PYTHON so that
9371         # we actually do check anew.
9372         AC_MSG_RESULT([])
9373         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
9374         AM_PATH_PYTHON([3.3],, [:])
9375         AC_MSG_CHECKING([which Python to use for Pyuno])
9376         if test "$PYTHON" = ":"; then
9377             if test -z "$PYTHON_FOR_BUILD"; then
9378                 AC_MSG_RESULT([fully internal])
9379             else
9380                 AC_MSG_RESULT([internal])
9381             fi
9382             enable_python=internal
9383         else
9384             AC_MSG_RESULT([system])
9385             enable_python=system
9386         fi
9387     fi
9388     ;;
9389 internal)
9390     AC_MSG_RESULT([internal])
9391     ;;
9392 fully-internal)
9393     AC_MSG_RESULT([fully internal])
9394     enable_python=internal
9395     ;;
9396 system)
9397     AC_MSG_RESULT([system])
9398     if test "$_os" = Darwin -a -z "$PYTHON"; then
9399         AC_MSG_ERROR([--enable-python=system doesn't work on macOS because the version provided is obsolete])
9400     fi
9401     ;;
9403     AC_MSG_ERROR([Incorrect --enable-python option])
9404     ;;
9405 esac
9407 if test $enable_python != no; then
9408     BUILD_TYPE="$BUILD_TYPE PYUNO"
9411 if test $enable_python = system; then
9412     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
9413         # Fallback: Accept these in the environment, or as set above
9414         # for MacOSX.
9415         :
9416     elif test "$cross_compiling" != yes; then
9417         # Unset variables set by the above AM_PATH_PYTHON so that
9418         # we actually do check anew.
9419         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
9420         # This causes an error if no python command is found
9421         AM_PATH_PYTHON([3.3])
9422         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
9423         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
9424         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
9425         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
9426         if test -z "$PKG_CONFIG"; then
9427             PYTHON_CFLAGS="-I$python_include"
9428             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
9429         elif $PKG_CONFIG --exists python-$python_version-embed; then
9430             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
9431             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
9432         elif $PKG_CONFIG --exists python-$python_version; then
9433             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
9434             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
9435         else
9436             PYTHON_CFLAGS="-I$python_include"
9437             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
9438         fi
9439         FilterLibs "${PYTHON_LIBS}"
9440         PYTHON_LIBS="${filteredlibs}"
9441     else
9442         dnl How to find out the cross-compilation Python installation path?
9443         AC_MSG_CHECKING([for python version])
9444         AS_IF([test -n "$PYTHON_VERSION"],
9445               [AC_MSG_RESULT([$PYTHON_VERSION])],
9446               [AC_MSG_RESULT([not found])
9447                AC_MSG_ERROR([no usable python found])])
9448         test -n "$PYTHON_CFLAGS" && break
9449     fi
9451     dnl Check if the headers really work
9452     save_CPPFLAGS="$CPPFLAGS"
9453     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
9454     AC_CHECK_HEADER(Python.h)
9455     CPPFLAGS="$save_CPPFLAGS"
9457     # let the PYTHON_FOR_BUILD match the same python installation that
9458     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
9459     # better for PythonTests.
9460     PYTHON_FOR_BUILD=$PYTHON
9463 if test "$with_lxml" != no; then
9464     if test -z "$PYTHON_FOR_BUILD"; then
9465         case $build_os in
9466             cygwin)
9467                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
9468                 ;;
9469             *)
9470                 if test "$cross_compiling" != yes ; then
9471                     BUILD_TYPE="$BUILD_TYPE LXML"
9472                 fi
9473                 ;;
9474         esac
9475     else
9476         AC_MSG_CHECKING([for python lxml])
9477         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
9478             AC_MSG_RESULT([yes])
9479         else
9480             case $build_os in
9481                 cygwin)
9482                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
9483                     ;;
9484                 *)
9485                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
9486                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
9487                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
9488                         else
9489                             BUILD_TYPE="$BUILD_TYPE LXML"
9490                             AC_MSG_RESULT([no, using internal lxml])
9491                         fi
9492                     else
9493                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
9494                     fi
9495                     ;;
9496             esac
9497         fi
9498     fi
9501 dnl By now enable_python should be "system", "internal" or "no"
9502 case $enable_python in
9503 system)
9504     SYSTEM_PYTHON=TRUE
9506     if test "x$ac_cv_header_Python_h" != "xyes"; then
9507        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
9508     fi
9510     AC_LANG_PUSH(C)
9511     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
9512     AC_MSG_CHECKING([for correct python library version])
9513        AC_RUN_IFELSE([AC_LANG_SOURCE([[
9514 #include <Python.h>
9516 int main(int argc, char **argv) {
9517    if ((PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
9518    else return 1;
9520        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3])],[AC_MSG_RESULT([skipped; cross-compiling])])
9521     AC_LANG_POP(C)
9523     dnl FIXME Check if the Python library can be linked with, too?
9524     ;;
9526 internal)
9527     SYSTEM_PYTHON=
9528     PYTHON_VERSION_MAJOR=3
9529     PYTHON_VERSION_MINOR=8
9530     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.8
9531     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
9532         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
9533     fi
9534     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
9535     BUILD_TYPE="$BUILD_TYPE PYTHON"
9536     if test "$OS" = LINUX -o "$OS" = WNT ; then
9537         BUILD_TYPE="$BUILD_TYPE LIBFFI"
9538     fi
9539     # Embedded Python dies without Home set
9540     if test "$HOME" = ""; then
9541         export HOME=""
9542     fi
9543     ;;
9545     DISABLE_PYTHON=TRUE
9546     SYSTEM_PYTHON=
9547     ;;
9549     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
9550     ;;
9551 esac
9553 AC_SUBST(DISABLE_PYTHON)
9554 AC_SUBST(SYSTEM_PYTHON)
9555 AC_SUBST(PYTHON_CFLAGS)
9556 AC_SUBST(PYTHON_LIBS)
9557 AC_SUBST(PYTHON_VERSION)
9558 AC_SUBST(PYTHON_VERSION_MAJOR)
9559 AC_SUBST(PYTHON_VERSION_MINOR)
9561 AC_MSG_CHECKING([whether to build LibreLogo])
9562 case "$enable_python" in
9563 no|disable)
9564     AC_MSG_RESULT([no; Python disabled])
9565     ;;
9567     if test "${enable_librelogo}" = "no"; then
9568         AC_MSG_RESULT([no])
9569     else
9570         AC_MSG_RESULT([yes])
9571         BUILD_TYPE="${BUILD_TYPE} LIBRELOGO"
9572         AC_DEFINE([ENABLE_LIBRELOGO],1)
9573     fi
9574     ;;
9575 esac
9576 AC_SUBST(ENABLE_LIBRELOGO)
9578 ENABLE_MARIADBC=
9579 MARIADBC_MAJOR=1
9580 MARIADBC_MINOR=0
9581 MARIADBC_MICRO=2
9582 AC_MSG_CHECKING([whether to build the MariaDB/MySQL SDBC driver])
9583 if test "x$enable_mariadb_sdbc" != "xno" -a "$enable_mpl_subset" != "yes"; then
9584     ENABLE_MARIADBC=TRUE
9585     AC_MSG_RESULT([yes])
9586     BUILD_TYPE="$BUILD_TYPE MARIADBC"
9587 else
9588     AC_MSG_RESULT([no])
9590 AC_SUBST(ENABLE_MARIADBC)
9591 AC_SUBST(MARIADBC_MAJOR)
9592 AC_SUBST(MARIADBC_MINOR)
9593 AC_SUBST(MARIADBC_MICRO)
9595 if test "$ENABLE_MARIADBC" = "TRUE"; then
9596     dnl ===================================================================
9597     dnl Check for system MariaDB
9598     dnl ===================================================================
9599     AC_MSG_CHECKING([which MariaDB to use])
9600     if test "$with_system_mariadb" = "yes"; then
9601         AC_MSG_RESULT([external])
9602         SYSTEM_MARIADB_CONNECTOR_C=TRUE
9603         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
9604         if test -z "$MARIADBCONFIG"; then
9605             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
9606             if test -z "$MARIADBCONFIG"; then
9607                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
9608                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
9609             fi
9610         fi
9611         AC_MSG_CHECKING([MariaDB version])
9612         MARIADB_VERSION=`$MARIADBCONFIG --version`
9613         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
9614         if test "$MARIADB_MAJOR" -ge "5"; then
9615             AC_MSG_RESULT([OK])
9616         else
9617             AC_MSG_ERROR([too old, use 5.0.x or later])
9618         fi
9619         AC_MSG_CHECKING([for MariaDB Client library])
9620         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
9621         if test "$COM_IS_CLANG" = TRUE; then
9622             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
9623         fi
9624         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
9625         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
9626         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
9627         dnl linux32:
9628         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
9629             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
9630             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
9631                 | sed -e 's|/lib64/|/lib/|')
9632         fi
9633         FilterLibs "${MARIADB_LIBS}"
9634         MARIADB_LIBS="${filteredlibs}"
9635         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
9636         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
9637         if test "$enable_bundle_mariadb" = "yes"; then
9638             AC_MSG_RESULT([yes])
9639             BUNDLE_MARIADB_CONNECTOR_C=TRUE
9640             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
9642 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
9644 /g' | grep -E '(mysqlclient|mariadb)')
9645             if test "$_os" = "Darwin"; then
9646                 LIBMARIADB=${LIBMARIADB}.dylib
9647             elif test "$_os" = "WINNT"; then
9648                 LIBMARIADB=${LIBMARIADB}.dll
9649             else
9650                 LIBMARIADB=${LIBMARIADB}.so
9651             fi
9652             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
9653             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
9654             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
9655                 AC_MSG_RESULT([found.])
9656                 PathFormat "$LIBMARIADB_PATH"
9657                 LIBMARIADB_PATH="$formatted_path"
9658             else
9659                 AC_MSG_ERROR([not found.])
9660             fi
9661         else
9662             AC_MSG_RESULT([no])
9663             BUNDLE_MARIADB_CONNECTOR_C=
9664         fi
9665     else
9666         AC_MSG_RESULT([internal])
9667         SYSTEM_MARIADB_CONNECTOR_C=
9668         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
9669         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
9670         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
9671     fi
9673     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
9674     AC_SUBST(MARIADB_CFLAGS)
9675     AC_SUBST(MARIADB_LIBS)
9676     AC_SUBST(LIBMARIADB)
9677     AC_SUBST(LIBMARIADB_PATH)
9678     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
9681 dnl ===================================================================
9682 dnl Check for system hsqldb
9683 dnl ===================================================================
9684 if test "$with_java" != "no" -a "$cross_compiling" != "yes"; then
9685     HSQLDB_USE_JDBC_4_1=
9686     AC_MSG_CHECKING([which hsqldb to use])
9687     if test "$with_system_hsqldb" = "yes"; then
9688         AC_MSG_RESULT([external])
9689         SYSTEM_HSQLDB=TRUE
9690         if test -z $HSQLDB_JAR; then
9691             HSQLDB_JAR=/usr/share/java/hsqldb.jar
9692         fi
9693         if ! test -f $HSQLDB_JAR; then
9694                AC_MSG_ERROR(hsqldb.jar not found.)
9695         fi
9696         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
9697         export HSQLDB_JAR
9698         if $PERL -e \
9699            'use Archive::Zip;
9700             my $file = "$ENV{'HSQLDB_JAR'}";
9701             my $zip = Archive::Zip->new( $file );
9702             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
9703             if ( $mf =~ m/Specification-Version: 1.8.*/ )
9704             {
9705                 push @l, split(/\n/, $mf);
9706                 foreach my $line (@l)
9707                 {
9708                     if ($line =~ m/Specification-Version:/)
9709                     {
9710                         ($t, $version) = split (/:/,$line);
9711                         $version =~ s/^\s//;
9712                         ($a, $b, $c, $d) = split (/\./,$version);
9713                         if ($c == "0" && $d > "8")
9714                         {
9715                             exit 0;
9716                         }
9717                         else
9718                         {
9719                             exit 1;
9720                         }
9721                     }
9722                 }
9723             }
9724             else
9725             {
9726                 exit 1;
9727             }'; then
9728             AC_MSG_RESULT([yes])
9729         else
9730             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
9731         fi
9732     else
9733         AC_MSG_RESULT([internal])
9734         SYSTEM_HSQLDB=
9735         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9736         NEED_ANT=TRUE
9737         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
9738         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
9739         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
9740             AC_MSG_RESULT([yes])
9741             HSQLDB_USE_JDBC_4_1=TRUE
9742         else
9743             AC_MSG_RESULT([no])
9744         fi
9745     fi
9746 else
9747     if test "$with_java" != "no" -a -z "$HSQLDB_JAR"; then
9748         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9749     fi
9751 AC_SUBST(SYSTEM_HSQLDB)
9752 AC_SUBST(HSQLDB_JAR)
9753 AC_SUBST([HSQLDB_USE_JDBC_4_1])
9755 dnl ===================================================================
9756 dnl Check for PostgreSQL stuff
9757 dnl ===================================================================
9758 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
9759 if test "x$enable_postgresql_sdbc" != "xno"; then
9760     AC_MSG_RESULT([yes])
9761     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
9763     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
9764         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
9765     fi
9766     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
9767         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
9768     fi
9770     postgres_interface=""
9771     if test "$with_system_postgresql" = "yes"; then
9772         postgres_interface="external PostgreSQL"
9773         SYSTEM_POSTGRESQL=TRUE
9774         if test "$_os" = Darwin; then
9775             supp_path=''
9776             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
9777                 pg_supp_path="$P_SEP$d$pg_supp_path"
9778             done
9779         fi
9780         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
9781         if test -n "$PGCONFIG"; then
9782             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
9783             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
9784         else
9785             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
9786               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
9787               POSTGRESQL_LIB=$POSTGRESQL_LIBS
9788             ],[
9789               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
9790             ])
9791         fi
9792         FilterLibs "${POSTGRESQL_LIB}"
9793         POSTGRESQL_LIB="${filteredlibs}"
9794     else
9795         # if/when anything else than PostgreSQL uses Kerberos,
9796         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
9797         WITH_KRB5=
9798         WITH_GSSAPI=
9799         case "$_os" in
9800         Darwin)
9801             # macOS has system MIT Kerberos 5 since 10.4
9802             if test "$with_krb5" != "no"; then
9803                 WITH_KRB5=TRUE
9804                 save_LIBS=$LIBS
9805                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
9806                 # that the libraries where these functions are located on macOS will change, is it?
9807                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9808                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9809                 KRB5_LIBS=$LIBS
9810                 LIBS=$save_LIBS
9811                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9812                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9813                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9814                 LIBS=$save_LIBS
9815             fi
9816             if test "$with_gssapi" != "no"; then
9817                 WITH_GSSAPI=TRUE
9818                 save_LIBS=$LIBS
9819                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9820                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9821                 GSSAPI_LIBS=$LIBS
9822                 LIBS=$save_LIBS
9823             fi
9824             ;;
9825         WINNT)
9826             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
9827                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
9828             fi
9829             ;;
9830         Linux|GNU|*BSD|DragonFly)
9831             if test "$with_krb5" != "no"; then
9832                 WITH_KRB5=TRUE
9833                 save_LIBS=$LIBS
9834                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9835                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9836                 KRB5_LIBS=$LIBS
9837                 LIBS=$save_LIBS
9838                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9839                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9840                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9841                 LIBS=$save_LIBS
9842             fi
9843             if test "$with_gssapi" != "no"; then
9844                 WITH_GSSAPI=TRUE
9845                 save_LIBS=$LIBS
9846                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9847                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9848                 GSSAPI_LIBS=$LIBS
9849                 LIBS=$save_LIBS
9850             fi
9851             ;;
9852         *)
9853             if test "$with_krb5" = "yes"; then
9854                 WITH_KRB5=TRUE
9855                 save_LIBS=$LIBS
9856                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9857                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9858                 KRB5_LIBS=$LIBS
9859                 LIBS=$save_LIBS
9860                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9861                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9862                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9863                 LIBS=$save_LIBS
9864             fi
9865             if test "$with_gssapi" = "yes"; then
9866                 WITH_GSSAPI=TRUE
9867                 save_LIBS=$LIBS
9868                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9869                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9870                 LIBS=$save_LIBS
9871                 GSSAPI_LIBS=$LIBS
9872             fi
9873         esac
9875         if test -n "$with_libpq_path"; then
9876             SYSTEM_POSTGRESQL=TRUE
9877             postgres_interface="external libpq"
9878             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
9879             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
9880         else
9881             SYSTEM_POSTGRESQL=
9882             postgres_interface="internal"
9883             POSTGRESQL_LIB=""
9884             POSTGRESQL_INC="%OVERRIDE_ME%"
9885             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
9886         fi
9887     fi
9889     AC_MSG_CHECKING([PostgreSQL C interface])
9890     AC_MSG_RESULT([$postgres_interface])
9892     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
9893         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
9894         save_CFLAGS=$CFLAGS
9895         save_CPPFLAGS=$CPPFLAGS
9896         save_LIBS=$LIBS
9897         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
9898         LIBS="${LIBS} ${POSTGRESQL_LIB}"
9899         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
9900         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
9901             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
9902         CFLAGS=$save_CFLAGS
9903         CPPFLAGS=$save_CPPFLAGS
9904         LIBS=$save_LIBS
9905     fi
9906     BUILD_POSTGRESQL_SDBC=TRUE
9907 else
9908     AC_MSG_RESULT([no])
9910 AC_SUBST(WITH_KRB5)
9911 AC_SUBST(WITH_GSSAPI)
9912 AC_SUBST(GSSAPI_LIBS)
9913 AC_SUBST(KRB5_LIBS)
9914 AC_SUBST(BUILD_POSTGRESQL_SDBC)
9915 AC_SUBST(SYSTEM_POSTGRESQL)
9916 AC_SUBST(POSTGRESQL_INC)
9917 AC_SUBST(POSTGRESQL_LIB)
9919 dnl ===================================================================
9920 dnl Check for Firebird stuff
9921 dnl ===================================================================
9922 ENABLE_FIREBIRD_SDBC=
9923 if test "$enable_firebird_sdbc" = "yes" ; then
9924     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
9926     dnl ===================================================================
9927     dnl Check for system Firebird
9928     dnl ===================================================================
9929     AC_MSG_CHECKING([which Firebird to use])
9930     if test "$with_system_firebird" = "yes"; then
9931         AC_MSG_RESULT([external])
9932         SYSTEM_FIREBIRD=TRUE
9933         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
9934         if test -z "$FIREBIRDCONFIG"; then
9935             AC_MSG_NOTICE([No fb_config -- using pkg-config])
9936             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
9937                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
9938             ])
9939             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
9940         else
9941             AC_MSG_NOTICE([fb_config found])
9942             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
9943             AC_MSG_CHECKING([for Firebird Client library])
9944             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
9945             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
9946             FilterLibs "${FIREBIRD_LIBS}"
9947             FIREBIRD_LIBS="${filteredlibs}"
9948         fi
9949         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
9950         AC_MSG_CHECKING([Firebird version])
9951         if test -n "${FIREBIRD_VERSION}"; then
9952             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
9953             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
9954             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
9955                 AC_MSG_RESULT([OK])
9956             else
9957                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
9958             fi
9959         else
9960             save_CFLAGS="${CFLAGS}"
9961             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
9962             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
9963 #if defined(FB_API_VER) && FB_API_VER == 30
9964 int fb_api_is_30(void) { return 0; }
9965 #else
9966 #error "Wrong Firebird API version"
9967 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
9968             CFLAGS="$save_CFLAGS"
9969         fi
9970         ENABLE_FIREBIRD_SDBC=TRUE
9971         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9972     elif test "$enable_database_connectivity" != yes; then
9973         AC_MSG_RESULT([none])
9974     elif test "$cross_compiling" = "yes"; then
9975         AC_MSG_RESULT([none])
9976     else
9977         dnl Embedded Firebird has version 3.0
9978         AC_DEFINE(HAVE_FIREBIRD_30, 1)
9979         dnl We need libatomic_ops for any non X86/X64 system
9980         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
9981             dnl ===================================================================
9982             dnl Check for system libatomic_ops
9983             dnl ===================================================================
9984             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[LIBATOMIC_OPS],[atomic_ops >= 0.7.2])
9985             if test "$with_system_libatomic_ops" = "yes"; then
9986                 SYSTEM_LIBATOMIC_OPS=TRUE
9987                 AC_CHECK_HEADERS(atomic_ops.h, [],
9988                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
9989             else
9990                 SYSTEM_LIBATOMIC_OPS=
9991                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
9992                 LIBATOMIC_OPS_LIBS="-latomic_ops"
9993                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
9994             fi
9995         fi
9997         AC_MSG_RESULT([internal])
9998         SYSTEM_FIREBIRD=
9999         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
10000         FIREBIRD_LIBS="-lfbclient"
10002         if test "$with_system_libtommath" = "yes"; then
10003             SYSTEM_LIBTOMMATH=TRUE
10004             dnl check for tommath presence
10005             save_LIBS=$LIBS
10006             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
10007             AC_CHECK_LIB(tommath, mp_init, LIBTOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
10008             LIBS=$save_LIBS
10009         else
10010             SYSTEM_LIBTOMMATH=
10011             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
10012             LIBTOMMATH_LIBS="-ltommath"
10013             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
10014         fi
10016         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
10017         ENABLE_FIREBIRD_SDBC=TRUE
10018         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
10019     fi
10021 AC_SUBST(ENABLE_FIREBIRD_SDBC)
10022 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
10023 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
10024 AC_SUBST(LIBATOMIC_OPS_LIBS)
10025 AC_SUBST(SYSTEM_FIREBIRD)
10026 AC_SUBST(FIREBIRD_CFLAGS)
10027 AC_SUBST(FIREBIRD_LIBS)
10028 AC_SUBST(SYSTEM_LIBTOMMATH)
10029 AC_SUBST(LIBTOMMATH_CFLAGS)
10030 AC_SUBST(LIBTOMMATH_LIBS)
10032 dnl ===================================================================
10033 dnl Check for system curl
10034 dnl ===================================================================
10035 AC_MSG_CHECKING([which libcurl to use])
10036 if test "$with_system_curl" = "auto"; then
10037     with_system_curl="$with_system_libs"
10040 if test "$with_system_curl" = "yes"; then
10041     AC_MSG_RESULT([external])
10042     SYSTEM_CURL=TRUE
10044     # First try PKGCONFIG and then fall back
10045     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
10047     if test -n "$CURL_PKG_ERRORS"; then
10048         AC_PATH_PROG(CURLCONFIG, curl-config)
10049         if test -z "$CURLCONFIG"; then
10050             AC_MSG_ERROR([curl development files not found])
10051         fi
10052         CURL_LIBS=`$CURLCONFIG --libs`
10053         FilterLibs "${CURL_LIBS}"
10054         CURL_LIBS="${filteredlibs}"
10055         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
10056         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
10058         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
10059         case $curl_version in
10060         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
10061         dnl so they need to be doubled to end up in the configure script
10062         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
10063             AC_MSG_RESULT([yes])
10064             ;;
10065         *)
10066             AC_MSG_ERROR([no, you have $curl_version])
10067             ;;
10068         esac
10069     fi
10071     ENABLE_CURL=TRUE
10072 else
10073     AC_MSG_RESULT([internal])
10074     SYSTEM_CURL=
10075     BUILD_TYPE="$BUILD_TYPE CURL"
10076     ENABLE_CURL=TRUE
10078 AC_SUBST(SYSTEM_CURL)
10079 AC_SUBST(CURL_CFLAGS)
10080 AC_SUBST(CURL_LIBS)
10081 AC_SUBST(ENABLE_CURL)
10083 dnl ===================================================================
10084 dnl Check for system boost
10085 dnl ===================================================================
10086 AC_MSG_CHECKING([which boost to use])
10087 if test "$with_system_boost" = "yes"; then
10088     AC_MSG_RESULT([external])
10089     SYSTEM_BOOST=TRUE
10090     AX_BOOST_BASE([1.66],,[AC_MSG_ERROR([no suitable Boost found])])
10091     AX_BOOST_DATE_TIME
10092     AX_BOOST_FILESYSTEM
10093     AX_BOOST_IOSTREAMS
10094     AX_BOOST_LOCALE
10095     AC_LANG_PUSH([C++])
10096     save_CXXFLAGS=$CXXFLAGS
10097     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
10098     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
10099        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
10100     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
10101        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
10102     CXXFLAGS=$save_CXXFLAGS
10103     AC_LANG_POP([C++])
10104     # this is in m4/ax_boost_base.m4
10105     FilterLibs "${BOOST_LDFLAGS}"
10106     BOOST_LDFLAGS="${filteredlibs}"
10107 else
10108     AC_MSG_RESULT([internal])
10109     BUILD_TYPE="$BUILD_TYPE BOOST"
10110     SYSTEM_BOOST=
10111     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
10112         # use warning-suppressing wrapper headers
10113         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
10114     else
10115         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
10116     fi
10118 AC_SUBST(SYSTEM_BOOST)
10120 dnl ===================================================================
10121 dnl Check for system mdds
10122 dnl ===================================================================
10123 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
10125 dnl ===================================================================
10126 dnl Check for system glm
10127 dnl ===================================================================
10128 AC_MSG_CHECKING([which glm to use])
10129 if test "$with_system_glm" = "yes"; then
10130     AC_MSG_RESULT([external])
10131     SYSTEM_GLM=TRUE
10132     AC_LANG_PUSH([C++])
10133     AC_CHECK_HEADER([glm/glm.hpp], [],
10134        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
10135     AC_LANG_POP([C++])
10136 else
10137     AC_MSG_RESULT([internal])
10138     BUILD_TYPE="$BUILD_TYPE GLM"
10139     SYSTEM_GLM=
10140     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
10142 AC_SUBST([GLM_CFLAGS])
10143 AC_SUBST([SYSTEM_GLM])
10145 dnl ===================================================================
10146 dnl Check for system odbc
10147 dnl ===================================================================
10148 AC_MSG_CHECKING([which odbc headers to use])
10149 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
10150     AC_MSG_RESULT([external])
10151     SYSTEM_ODBC_HEADERS=TRUE
10153     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
10154         save_CPPFLAGS=$CPPFLAGS
10155         find_winsdk
10156         PathFormat "$winsdktest"
10157         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"
10158         AC_CHECK_HEADER(sqlext.h, [],
10159             [AC_MSG_ERROR(odbc not found. install odbc)],
10160             [#include <windows.h>])
10161         CPPFLAGS=$save_CPPFLAGS
10162     else
10163         AC_CHECK_HEADER(sqlext.h, [],
10164             [AC_MSG_ERROR(odbc not found. install odbc)],[])
10165     fi
10166 elif test "$enable_database_connectivity" != yes; then
10167     AC_MSG_RESULT([none])
10168 else
10169     AC_MSG_RESULT([internal])
10170     SYSTEM_ODBC_HEADERS=
10172 AC_SUBST(SYSTEM_ODBC_HEADERS)
10174 dnl ===================================================================
10175 dnl Enable LDAP support
10176 dnl ===================================================================
10178 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
10179 AC_MSG_CHECKING([whether to enable LDAP support])
10180     if test "$enable_ldap" != "yes"; then
10181         AC_MSG_RESULT([no])
10182         ENABLE_LDAP=""
10183         enable_ldap=no
10184     else
10185         AC_MSG_RESULT([yes])
10186         ENABLE_LDAP="TRUE"
10187     fi
10189 AC_SUBST(ENABLE_LDAP)
10191 dnl ===================================================================
10192 dnl Check for system openldap
10193 dnl ===================================================================
10195 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
10196 AC_MSG_CHECKING([which openldap library to use])
10197 if test "$with_system_openldap" = "yes"; then
10198     AC_MSG_RESULT([external])
10199     SYSTEM_OPENLDAP=TRUE
10200     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
10201     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10202     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10203 else
10204     AC_MSG_RESULT([internal])
10205     SYSTEM_OPENLDAP=
10206     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
10209 AC_SUBST(SYSTEM_OPENLDAP)
10211 dnl ===================================================================
10212 dnl Check for system NSS
10213 dnl ===================================================================
10214 if test "$enable_fuzzers" != "yes"; then
10215     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
10216     AC_DEFINE(HAVE_FEATURE_NSS)
10217     ENABLE_NSS="TRUE"
10218     AC_DEFINE(ENABLE_NSS)
10219 elif test $_os != iOS ; then
10220     with_tls=openssl
10222 AC_SUBST(ENABLE_NSS)
10224 dnl ===================================================================
10225 dnl Check for TLS/SSL and cryptographic implementation to use
10226 dnl ===================================================================
10227 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
10228 if test -n "$with_tls"; then
10229     case $with_tls in
10230     openssl)
10231         AC_DEFINE(USE_TLS_OPENSSL)
10232         TLS=OPENSSL
10233         AC_MSG_RESULT([$TLS])
10235         if test "$enable_openssl" != "yes"; then
10236             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
10237         fi
10239         # warn that OpenSSL has been selected but not all TLS code has this option
10240         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
10241         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
10242         ;;
10243     nss)
10244         AC_DEFINE(USE_TLS_NSS)
10245         TLS=NSS
10246         AC_MSG_RESULT([$TLS])
10247         ;;
10248     no)
10249         AC_MSG_RESULT([none])
10250         AC_MSG_WARN([Skipping TLS/SSL])
10251         ;;
10252     *)
10253         AC_MSG_RESULT([])
10254         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
10255 openssl - OpenSSL
10256 nss - Mozilla's Network Security Services (NSS)
10257     ])
10258         ;;
10259     esac
10260 else
10261     # default to using NSS, it results in smaller oox lib
10262     AC_DEFINE(USE_TLS_NSS)
10263     TLS=NSS
10264     AC_MSG_RESULT([$TLS])
10266 AC_SUBST(TLS)
10268 dnl ===================================================================
10269 dnl Check for system sane
10270 dnl ===================================================================
10271 AC_MSG_CHECKING([which sane header to use])
10272 if test "$with_system_sane" = "yes"; then
10273     AC_MSG_RESULT([external])
10274     AC_CHECK_HEADER(sane/sane.h, [],
10275       [AC_MSG_ERROR(sane not found. install sane)], [])
10276 else
10277     AC_MSG_RESULT([internal])
10278     BUILD_TYPE="$BUILD_TYPE SANE"
10281 dnl ===================================================================
10282 dnl Check for system icu
10283 dnl ===================================================================
10284 SYSTEM_GENBRK=
10285 SYSTEM_GENCCODE=
10286 SYSTEM_GENCMN=
10288 ICU_MAJOR=68
10289 ICU_MINOR=1
10290 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
10291 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
10292 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
10293 AC_MSG_CHECKING([which icu to use])
10294 if test "$with_system_icu" = "yes"; then
10295     AC_MSG_RESULT([external])
10296     SYSTEM_ICU=TRUE
10297     AC_LANG_PUSH([C++])
10298     AC_MSG_CHECKING([for unicode/rbbi.h])
10299     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
10300     AC_LANG_POP([C++])
10302     if test "$cross_compiling" != "yes"; then
10303         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
10304         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
10305         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
10306         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
10307     fi
10309     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
10310         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
10311         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
10312         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
10313         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
10314         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
10315             AC_MSG_RESULT([yes])
10316         else
10317             AC_MSG_RESULT([no])
10318             if test "$with_system_icu_for_build" != "force"; then
10319                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
10320 You can use --with-system-icu-for-build=force to use it anyway.])
10321             fi
10322         fi
10323     fi
10325     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
10326         # using the system icu tools can lead to version confusion, use the
10327         # ones from the build environment when cross-compiling
10328         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
10329         if test -z "$SYSTEM_GENBRK"; then
10330             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
10331         fi
10332         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
10333         if test -z "$SYSTEM_GENCCODE"; then
10334             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
10335         fi
10336         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
10337         if test -z "$SYSTEM_GENCMN"; then
10338             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
10339         fi
10340         if test "$ICU_MAJOR" -ge "49"; then
10341             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
10342             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
10343             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
10344         else
10345             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
10346             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
10347             ICU_RECLASSIFIED_HEBREW_LETTER=
10348         fi
10349     fi
10351     if test "$cross_compiling" = "yes"; then
10352         if test "$ICU_MAJOR" -ge "50"; then
10353             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
10354             ICU_MINOR=""
10355         fi
10356     fi
10357 else
10358     AC_MSG_RESULT([internal])
10359     SYSTEM_ICU=
10360     BUILD_TYPE="$BUILD_TYPE ICU"
10361     # surprisingly set these only for "internal" (to be used by various other
10362     # external libs): the system icu-config is quite unhelpful and spits out
10363     # dozens of weird flags and also default path -I/usr/include
10364     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
10365     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
10367 if test "$ICU_MAJOR" -ge "59"; then
10368     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
10369     # with -std=c++11 but not all external libraries can be built with that,
10370     # for those use a bit-compatible typedef uint16_t UChar; see
10371     # icu/source/common/unicode/umachine.h
10372     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
10373 else
10374     ICU_UCHAR_TYPE=""
10376 AC_SUBST(SYSTEM_ICU)
10377 AC_SUBST(SYSTEM_GENBRK)
10378 AC_SUBST(SYSTEM_GENCCODE)
10379 AC_SUBST(SYSTEM_GENCMN)
10380 AC_SUBST(ICU_MAJOR)
10381 AC_SUBST(ICU_MINOR)
10382 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
10383 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
10384 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
10385 AC_SUBST(ICU_CFLAGS)
10386 AC_SUBST(ICU_LIBS)
10387 AC_SUBST(ICU_UCHAR_TYPE)
10389 dnl ==================================================================
10390 dnl Breakpad
10391 dnl ==================================================================
10392 DEFAULT_CRASHDUMP_VALUE="true"
10393 AC_MSG_CHECKING([whether to enable breakpad])
10394 if test "$enable_breakpad" != yes; then
10395     AC_MSG_RESULT([no])
10396 else
10397     AC_MSG_RESULT([yes])
10398     ENABLE_BREAKPAD="TRUE"
10399     AC_DEFINE(ENABLE_BREAKPAD)
10400     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
10401     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
10403     AC_MSG_CHECKING([for disable crash dump])
10404     if test "$enable_crashdump" = no; then
10405         DEFAULT_CRASHDUMP_VALUE="false"
10406         AC_MSG_RESULT([yes])
10407     else
10408        AC_MSG_RESULT([no])
10409     fi
10411     AC_MSG_CHECKING([for crashreport config])
10412     if test "$with_symbol_config" = "no"; then
10413         BREAKPAD_SYMBOL_CONFIG="invalid"
10414         AC_MSG_RESULT([no])
10415     else
10416         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
10417         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
10418         AC_MSG_RESULT([yes])
10419     fi
10420     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
10422 AC_SUBST(ENABLE_BREAKPAD)
10423 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
10425 dnl ==================================================================
10426 dnl libfuzzer
10427 dnl ==================================================================
10428 AC_MSG_CHECKING([whether to enable fuzzers])
10429 if test "$enable_fuzzers" != yes; then
10430     AC_MSG_RESULT([no])
10431 else
10432     if test $LIB_FUZZING_ENGINE == ""; then
10433       AC_MSG_ERROR(['LIB_FUZZING_ENGINE' must be set when using --enable-fuzzers. Examples include '-fsanitize=fuzzer'.])
10434     fi
10435     AC_MSG_RESULT([yes])
10436     ENABLE_FUZZERS="TRUE"
10437     AC_DEFINE([ENABLE_FUZZERS],1)
10438     BUILD_TYPE="$BUILD_TYPE FUZZERS"
10440 AC_SUBST(LIB_FUZZING_ENGINE)
10441 AC_SUBST(ENABLE_FUZZERS)
10443 dnl ===================================================================
10444 dnl Orcus
10445 dnl ===================================================================
10446 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.16 >= 0.16.0])
10447 if test "$with_system_orcus" != "yes"; then
10448     if test "$SYSTEM_BOOST" = "TRUE"; then
10449         # ===========================================================
10450         # Determine if we are going to need to link with Boost.System
10451         # ===========================================================
10452         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
10453         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
10454         dnl in documentation has no effect.
10455         AC_MSG_CHECKING([if we need to link with Boost.System])
10456         AC_LANG_PUSH([C++])
10457         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
10458                 @%:@include <boost/version.hpp>
10459             ]],[[
10460                 #if BOOST_VERSION >= 105000
10461                 #   error yes, we need to link with Boost.System
10462                 #endif
10463             ]])],[
10464                 AC_MSG_RESULT([no])
10465             ],[
10466                 AC_MSG_RESULT([yes])
10467                 AX_BOOST_SYSTEM
10468         ])
10469         AC_LANG_POP([C++])
10470     fi
10472 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
10473 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
10474 AC_SUBST([BOOST_SYSTEM_LIB])
10475 AC_SUBST(SYSTEM_LIBORCUS)
10477 dnl ===================================================================
10478 dnl HarfBuzz
10479 dnl ===================================================================
10480 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
10481                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
10482                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
10484 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
10485                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
10486                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
10488 if test "$COM" = "MSC"; then # override the above
10489     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
10490     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
10493 if test "$with_system_harfbuzz" = "yes"; then
10494     if test "$with_system_graphite" = "no"; then
10495         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
10496     fi
10497     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
10498     save_LIBS="$LIBS"
10499     save_CFLAGS="$CFLAGS"
10500     LIBS="$LIBS $HARFBUZZ_LIBS"
10501     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
10502     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
10503     LIBS="$save_LIBS"
10504     CFLAGS="$save_CFLAGS"
10505 else
10506     if test "$with_system_graphite" = "yes"; then
10507         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
10508     fi
10511 AC_MSG_CHECKING([whether to use X11])
10512 dnl ***************************************
10513 dnl testing for X libraries and includes...
10514 dnl ***************************************
10515 if test "$USING_X11" = TRUE; then
10516     AC_DEFINE(HAVE_FEATURE_X11)
10518 AC_MSG_RESULT([$USING_X11])
10520 if test "$USING_X11" = TRUE; then
10521     AC_PATH_X
10522     AC_PATH_XTRA
10523     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
10525     if test -z "$x_includes"; then
10526         x_includes="default_x_includes"
10527     fi
10528     if test -z "$x_libraries"; then
10529         x_libraries="default_x_libraries"
10530     fi
10531     CFLAGS="$CFLAGS $X_CFLAGS"
10532     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
10533     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
10534 else
10535     x_includes="no_x_includes"
10536     x_libraries="no_x_libraries"
10539 if test "$USING_X11" = TRUE; then
10540     dnl ===================================================================
10541     dnl Check for extension headers
10542     dnl ===================================================================
10543     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
10544      [#include <X11/extensions/shape.h>])
10546     # vcl needs ICE and SM
10547     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
10548     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
10549         [AC_MSG_ERROR(ICE library not found)])
10550     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
10551     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
10552         [AC_MSG_ERROR(SM library not found)])
10555 if test "$USING_X11" = TRUE -a "$ENABLE_JAVA" != ""; then
10556     # bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c needs Xt
10557     AC_CHECK_HEADERS(X11/Intrinsic.h,[],[AC_MSG_ERROR([libXt headers not found])])
10560 dnl ===================================================================
10561 dnl Check for system Xrender
10562 dnl ===================================================================
10563 AC_MSG_CHECKING([whether to use Xrender])
10564 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
10565     AC_MSG_RESULT([yes])
10566     PKG_CHECK_MODULES(XRENDER, xrender)
10567     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10568     FilterLibs "${XRENDER_LIBS}"
10569     XRENDER_LIBS="${filteredlibs}"
10570     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
10571       [AC_MSG_ERROR(libXrender not found or functional)], [])
10572     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
10573       [AC_MSG_ERROR(Xrender not found. install X)], [])
10574 else
10575     AC_MSG_RESULT([no])
10577 AC_SUBST(XRENDER_CFLAGS)
10578 AC_SUBST(XRENDER_LIBS)
10580 dnl ===================================================================
10581 dnl Check for XRandr
10582 dnl ===================================================================
10583 AC_MSG_CHECKING([whether to enable RandR support])
10584 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
10585     AC_MSG_RESULT([yes])
10586     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
10587     if test "$ENABLE_RANDR" != "TRUE"; then
10588         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
10589                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
10590         XRANDR_CFLAGS=" "
10591         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
10592           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
10593         XRANDR_LIBS="-lXrandr "
10594         ENABLE_RANDR="TRUE"
10595     fi
10596     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10597     FilterLibs "${XRANDR_LIBS}"
10598     XRANDR_LIBS="${filteredlibs}"
10599 else
10600     ENABLE_RANDR=""
10601     AC_MSG_RESULT([no])
10603 AC_SUBST(XRANDR_CFLAGS)
10604 AC_SUBST(XRANDR_LIBS)
10605 AC_SUBST(ENABLE_RANDR)
10607 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
10608     if test -z "$WITH_WEBDAV"; then
10609         WITH_WEBDAV="serf"
10610     fi
10612 if test $_os = iOS -o $_os = Android; then
10613     WITH_WEBDAV="no"
10615 AC_MSG_CHECKING([for webdav library])
10616 case "$WITH_WEBDAV" in
10617 serf)
10618     AC_MSG_RESULT([serf])
10619     # Check for system apr-util
10620     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
10621                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
10622                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
10623     if test "$COM" = "MSC"; then
10624         APR_LIB_DIR="LibR"
10625         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
10626         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
10627     fi
10629     # Check for system serf
10630     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.3.9])
10631     ;;
10632 neon)
10633     AC_MSG_RESULT([neon])
10634     # Check for system neon
10635     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.31.2])
10636     if test "$with_system_neon" = "yes"; then
10637         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
10638     else
10639         NEON_VERSION=0312
10640     fi
10641     AC_SUBST(NEON_VERSION)
10642     ;;
10644     AC_MSG_RESULT([none, disabled])
10645     WITH_WEBDAV=""
10646     ;;
10647 esac
10648 AC_SUBST(WITH_WEBDAV)
10650 dnl ===================================================================
10651 dnl Check for disabling cve_tests
10652 dnl ===================================================================
10653 AC_MSG_CHECKING([whether to execute CVE tests])
10654 # If not explicitly enabled or disabled, default
10655 if test -z "$enable_cve_tests"; then
10656     case "$OS" in
10657     WNT)
10658         # Default cves off for Windows with its wild and wonderful
10659         # variety of AV software kicking in and panicking
10660         enable_cve_tests=no
10661         ;;
10662     *)
10663         # otherwise yes
10664         enable_cve_tests=yes
10665         ;;
10666     esac
10668 if test "$enable_cve_tests" = "no"; then
10669     AC_MSG_RESULT([no])
10670     DISABLE_CVE_TESTS=TRUE
10671     AC_SUBST(DISABLE_CVE_TESTS)
10672 else
10673     AC_MSG_RESULT([yes])
10676 dnl ===================================================================
10677 dnl Check for enabling chart XShape tests
10678 dnl ===================================================================
10679 AC_MSG_CHECKING([whether to execute chart XShape tests])
10680 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
10681     AC_MSG_RESULT([yes])
10682     ENABLE_CHART_TESTS=TRUE
10683     AC_SUBST(ENABLE_CHART_TESTS)
10684 else
10685     AC_MSG_RESULT([no])
10688 dnl ===================================================================
10689 dnl Check for system openssl
10690 dnl ===================================================================
10691 DISABLE_OPENSSL=
10692 AC_MSG_CHECKING([whether to disable OpenSSL usage])
10693 if test "$enable_openssl" = "yes"; then
10694     AC_MSG_RESULT([no])
10695     if test "$_os" = Darwin ; then
10696         # OpenSSL is deprecated when building for 10.7 or later.
10697         #
10698         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
10699         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
10701         with_system_openssl=no
10702         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10703     elif test "$_os" = "FreeBSD" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
10704             && test "$with_system_openssl" != "no"; then
10705         with_system_openssl=yes
10706         SYSTEM_OPENSSL=TRUE
10707         OPENSSL_CFLAGS=
10708         OPENSSL_LIBS="-lssl -lcrypto"
10709     else
10710         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10711     fi
10712     if test "$with_system_openssl" = "yes"; then
10713         AC_MSG_CHECKING([whether openssl supports SHA512])
10714         AC_LANG_PUSH([C])
10715         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
10716             SHA512_CTX context;
10717 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
10718         AC_LANG_POP(C)
10719     fi
10720 else
10721     AC_MSG_RESULT([yes])
10722     DISABLE_OPENSSL=TRUE
10724     # warn that although OpenSSL is disabled, system libraries may depend on it
10725     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
10726     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
10729 AC_SUBST([DISABLE_OPENSSL])
10731 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
10732     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
10733         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
10734         enable_cipher_openssl_backend=no
10735     else
10736         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
10737     fi
10739 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
10740 ENABLE_CIPHER_OPENSSL_BACKEND=
10741 if test "$enable_cipher_openssl_backend" = yes; then
10742     AC_MSG_RESULT([yes])
10743     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
10744 else
10745     AC_MSG_RESULT([no])
10747 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
10749 dnl ===================================================================
10750 dnl Check for building gnutls
10751 dnl ===================================================================
10752 AC_MSG_CHECKING([whether to use gnutls])
10753 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
10754     AC_MSG_RESULT([yes])
10755     AM_PATH_LIBGCRYPT()
10756     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
10757         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
10758                       available in the system to use as replacement.]]))
10759     FilterLibs "${LIBGCRYPT_LIBS}"
10760     LIBGCRYPT_LIBS="${filteredlibs}"
10761 else
10762     AC_MSG_RESULT([no])
10765 AC_SUBST([LIBGCRYPT_CFLAGS])
10766 AC_SUBST([LIBGCRYPT_LIBS])
10768 dnl ===================================================================
10769 dnl Check for system redland
10770 dnl ===================================================================
10771 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
10772 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
10773 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
10774 if test "$with_system_redland" = "yes"; then
10775     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
10776             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
10777 else
10778     RAPTOR_MAJOR="0"
10779     RASQAL_MAJOR="3"
10780     REDLAND_MAJOR="0"
10782 AC_SUBST(RAPTOR_MAJOR)
10783 AC_SUBST(RASQAL_MAJOR)
10784 AC_SUBST(REDLAND_MAJOR)
10786 dnl ===================================================================
10787 dnl Check for system hunspell
10788 dnl ===================================================================
10789 AC_MSG_CHECKING([which libhunspell to use])
10790 if test "$with_system_hunspell" = "yes"; then
10791     AC_MSG_RESULT([external])
10792     SYSTEM_HUNSPELL=TRUE
10793     AC_LANG_PUSH([C++])
10794     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
10795     if test "$HUNSPELL_PC" != "TRUE"; then
10796         AC_CHECK_HEADER(hunspell.hxx, [],
10797             [
10798             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
10799             [AC_MSG_ERROR(hunspell headers not found.)], [])
10800             ], [])
10801         AC_CHECK_LIB([hunspell], [main], [:],
10802            [ AC_MSG_ERROR(hunspell library not found.) ], [])
10803         HUNSPELL_LIBS=-lhunspell
10804     fi
10805     AC_LANG_POP([C++])
10806     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10807     FilterLibs "${HUNSPELL_LIBS}"
10808     HUNSPELL_LIBS="${filteredlibs}"
10809 else
10810     AC_MSG_RESULT([internal])
10811     SYSTEM_HUNSPELL=
10812     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
10813     if test "$COM" = "MSC"; then
10814         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
10815     else
10816         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
10817     fi
10818     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
10820 AC_SUBST(SYSTEM_HUNSPELL)
10821 AC_SUBST(HUNSPELL_CFLAGS)
10822 AC_SUBST(HUNSPELL_LIBS)
10824 dnl ===================================================================
10825 dnl Check for system zxing
10826 dnl ===================================================================
10827 AC_MSG_CHECKING([whether to use zxing])
10828 if test "$enable_zxing" = "no"; then
10829     AC_MSG_RESULT([no])
10830     ENABLE_ZXING=
10831     SYSTEM_ZXING=
10832 else
10833     AC_MSG_RESULT([yes])
10834     ENABLE_ZXING=TRUE
10835     AC_MSG_CHECKING([which libzxing to use])
10836     if test "$with_system_zxing" = "yes"; then
10837         AC_MSG_RESULT([external])
10838         SYSTEM_ZXING=TRUE
10839         AC_LANG_PUSH([C++])
10840         AC_CHECK_HEADER(ZXing/MultiFormatWriter.h, [],
10841             [AC_MSG_ERROR(zxing headers not found.)], [#include <stdexcept>])
10842         ZXING_CFLAGS=-I/usr/include/ZXing
10843         AC_CHECK_LIB([ZXing], [main], [ZXING_LIBS=-lZXing],
10844             [ AC_CHECK_LIB([ZXingCore], [main], [ZXING_LIBS=-lZXingCore],
10845             [ AC_MSG_ERROR(zxing C++ library not found.) ])], [])
10846         AC_LANG_POP([C++])
10847         ZXING_CFLAGS=$(printf '%s' "$ZXING_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10848         FilterLibs "${ZXING_LIBS}"
10849         ZXING_LIBS="${filteredlibs}"
10850     else
10851         AC_MSG_RESULT([internal])
10852         SYSTEM_ZXING=
10853         BUILD_TYPE="$BUILD_TYPE ZXING"
10854     fi
10855     if test "$ENABLE_ZXING" = TRUE; then
10856         AC_DEFINE(ENABLE_ZXING)
10857     fi
10859 AC_SUBST(SYSTEM_ZXING)
10860 AC_SUBST(ENABLE_ZXING)
10861 AC_SUBST(ZXING_CFLAGS)
10862 AC_SUBST(ZXING_LIBS)
10864 dnl ===================================================================
10865 dnl Check for system box2d
10866 dnl ===================================================================
10867 AC_MSG_CHECKING([which box2d to use])
10868 if test "$with_system_box2d" = "yes"; then
10869     AC_MSG_RESULT([external])
10870     SYSTEM_BOX2D=TRUE
10871     AC_LANG_PUSH([C++])
10872     AC_CHECK_HEADER(box2d/box2d.h, [BOX2D_H_FOUND='TRUE'],
10873         [BOX2D_H_FOUND='FALSE'])
10874     if test "$BOX2D_H_FOUND" = "TRUE"; then # 2.4.0+
10875         _BOX2D_LIB=box2d
10876         AC_DEFINE(BOX2D_HEADER,<box2d/box2d.h>)
10877     else
10878         # fail this. there's no other alternative to check when we are here.
10879         AC_CHECK_HEADER([Box2D/Box2D.h], [],
10880                 [AC_MSG_ERROR(box2d headers not found.)])
10881         _BOX2D_LIB=Box2D
10882         AC_DEFINE(BOX2D_HEADER,<Box2D/Box2D.h>)
10883     fi
10884     AC_CHECK_LIB([$_BOX2D_LIB], [main], [:],
10885         [ AC_MSG_ERROR(box2d library not found.) ], [])
10886     BOX2D_LIBS=-l$_BOX2D_LIB
10887     AC_LANG_POP([C++])
10888     BOX2D_CFLAGS=$(printf '%s' "$BOX2D_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10889     FilterLibs "${BOX2D_LIBS}"
10890     BOX2D_LIBS="${filteredlibs}"
10891 else
10892     AC_MSG_RESULT([internal])
10893     SYSTEM_BOX2D=
10894     BUILD_TYPE="$BUILD_TYPE BOX2D"
10896 AC_SUBST(SYSTEM_BOX2D)
10897 AC_SUBST(BOX2D_CFLAGS)
10898 AC_SUBST(BOX2D_LIBS)
10900 dnl ===================================================================
10901 dnl Checking for altlinuxhyph
10902 dnl ===================================================================
10903 AC_MSG_CHECKING([which altlinuxhyph to use])
10904 if test "$with_system_altlinuxhyph" = "yes"; then
10905     AC_MSG_RESULT([external])
10906     SYSTEM_HYPH=TRUE
10907     AC_CHECK_HEADER(hyphen.h, [],
10908        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
10909     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
10910        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
10911        [#include <hyphen.h>])
10912     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
10913         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10914     if test -z "$HYPHEN_LIB"; then
10915         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
10916            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10917     fi
10918     if test -z "$HYPHEN_LIB"; then
10919         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
10920            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10921     fi
10922 else
10923     AC_MSG_RESULT([internal])
10924     SYSTEM_HYPH=
10925     BUILD_TYPE="$BUILD_TYPE HYPHEN"
10926     if test "$COM" = "MSC"; then
10927         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
10928     else
10929         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
10930     fi
10932 AC_SUBST(SYSTEM_HYPH)
10933 AC_SUBST(HYPHEN_LIB)
10935 dnl ===================================================================
10936 dnl Checking for mythes
10937 dnl ===================================================================
10938 AC_MSG_CHECKING([which mythes to use])
10939 if test "$with_system_mythes" = "yes"; then
10940     AC_MSG_RESULT([external])
10941     SYSTEM_MYTHES=TRUE
10942     AC_LANG_PUSH([C++])
10943     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
10944     if test "$MYTHES_PKGCONFIG" = "no"; then
10945         AC_CHECK_HEADER(mythes.hxx, [],
10946             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
10947         AC_CHECK_LIB([mythes-1.2], [main], [:],
10948             [ MYTHES_FOUND=no], [])
10949     if test "$MYTHES_FOUND" = "no"; then
10950         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
10951                 [ MYTHES_FOUND=no], [])
10952     fi
10953     if test "$MYTHES_FOUND" = "no"; then
10954         AC_MSG_ERROR([mythes library not found!.])
10955     fi
10956     fi
10957     AC_LANG_POP([C++])
10958     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10959     FilterLibs "${MYTHES_LIBS}"
10960     MYTHES_LIBS="${filteredlibs}"
10961 else
10962     AC_MSG_RESULT([internal])
10963     SYSTEM_MYTHES=
10964     BUILD_TYPE="$BUILD_TYPE MYTHES"
10965     if test "$COM" = "MSC"; then
10966         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
10967     else
10968         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
10969     fi
10971 AC_SUBST(SYSTEM_MYTHES)
10972 AC_SUBST(MYTHES_CFLAGS)
10973 AC_SUBST(MYTHES_LIBS)
10975 dnl ===================================================================
10976 dnl How should we build the linear programming solver ?
10977 dnl ===================================================================
10979 ENABLE_COINMP=
10980 AC_MSG_CHECKING([whether to build with CoinMP])
10981 if test "$enable_coinmp" != "no"; then
10982     ENABLE_COINMP=TRUE
10983     AC_MSG_RESULT([yes])
10984     if test "$with_system_coinmp" = "yes"; then
10985         SYSTEM_COINMP=TRUE
10986         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
10987         FilterLibs "${COINMP_LIBS}"
10988         COINMP_LIBS="${filteredlibs}"
10989     else
10990         BUILD_TYPE="$BUILD_TYPE COINMP"
10991     fi
10992 else
10993     AC_MSG_RESULT([no])
10995 AC_SUBST(ENABLE_COINMP)
10996 AC_SUBST(SYSTEM_COINMP)
10997 AC_SUBST(COINMP_CFLAGS)
10998 AC_SUBST(COINMP_LIBS)
11000 ENABLE_LPSOLVE=
11001 AC_MSG_CHECKING([whether to build with lpsolve])
11002 if test "$enable_lpsolve" != "no"; then
11003     ENABLE_LPSOLVE=TRUE
11004     AC_MSG_RESULT([yes])
11005 else
11006     AC_MSG_RESULT([no])
11008 AC_SUBST(ENABLE_LPSOLVE)
11010 if test "$ENABLE_LPSOLVE" = TRUE; then
11011     AC_MSG_CHECKING([which lpsolve to use])
11012     if test "$with_system_lpsolve" = "yes"; then
11013         AC_MSG_RESULT([external])
11014         SYSTEM_LPSOLVE=TRUE
11015         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
11016            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
11017         save_LIBS=$LIBS
11018         # some systems need this. Like Ubuntu...
11019         AC_CHECK_LIB(m, floor)
11020         AC_CHECK_LIB(dl, dlopen)
11021         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
11022             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
11023         LIBS=$save_LIBS
11024     else
11025         AC_MSG_RESULT([internal])
11026         SYSTEM_LPSOLVE=
11027         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
11028     fi
11030 AC_SUBST(SYSTEM_LPSOLVE)
11032 dnl ===================================================================
11033 dnl Checking for libexttextcat
11034 dnl ===================================================================
11035 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
11036 if test "$with_system_libexttextcat" = "yes"; then
11037     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
11039 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
11041 dnl ===================================================================
11042 dnl Checking for libnumbertext
11043 dnl ===================================================================
11044 libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.6])
11045 if test "$with_system_libnumbertext" = "yes"; then
11046     SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
11047     SYSTEM_LIBNUMBERTEXT=YES
11048 else
11049     SYSTEM_LIBNUMBERTEXT=
11050     AC_LANG_PUSH([C++])
11051     save_CPPFLAGS=$CPPFLAGS
11052     CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
11053     AC_CHECK_HEADERS([codecvt regex])
11054     AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
11055             [ LIBNUMBERTEXT_CFLAGS=''
11056               AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
11057                            Enable libnumbertext fallback (missing number to number name conversion).])
11058             ])
11059     CPPFLAGS=$save_CPPFLAGS
11060     AC_LANG_POP([C++])
11062 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
11063 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
11064 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
11066 dnl ***************************************
11067 dnl testing libc version for Linux...
11068 dnl ***************************************
11069 if test "$_os" = "Linux"; then
11070     AC_MSG_CHECKING([whether libc is >= 2.1.1])
11071     exec 6>/dev/null # no output
11072     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
11073     exec 6>&1 # output on again
11074     if test "$HAVE_LIBC"; then
11075         AC_MSG_RESULT([yes])
11076     else
11077         AC_MSG_ERROR([no, upgrade libc])
11078     fi
11081 dnl =========================================
11082 dnl Check for uuidgen
11083 dnl =========================================
11084 if test "$_os" = "WINNT"; then
11085     # we must use the uuidgen from the Windows SDK, which will be in the LO_PATH, but isn't in
11086     # the PATH for AC_PATH_PROG. It is already tested above in the WINDOWS_SDK_HOME check.
11087     UUIDGEN=uuidgen.exe
11088     AC_SUBST(UUIDGEN)
11089 else
11090     AC_PATH_PROG([UUIDGEN], [uuidgen])
11091     if test -z "$UUIDGEN"; then
11092         AC_MSG_WARN([uuid is needed for building installation sets])
11093     fi
11096 dnl ***************************************
11097 dnl Checking for bison and flex
11098 dnl ***************************************
11099 AC_PATH_PROG(BISON, bison)
11100 if test -z "$BISON"; then
11101     AC_MSG_ERROR([no bison found in \$PATH, install it])
11102 else
11103     AC_MSG_CHECKING([the bison version])
11104     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
11105     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
11106     dnl Accept newer than 2.0; for --enable-compiler-plugins at least 2.3 is known to be bad and
11107     dnl cause
11108     dnl
11109     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]
11110     dnl   typedef union YYSTYPE
11111     dnl           ~~~~~~^~~~~~~
11112     dnl
11113     dnl while at least 3.4.1 is know to be good:
11114     if test "$COMPILER_PLUGINS" = TRUE; then
11115         if test "$_bison_longver" -lt 2004; then
11116             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.4+ for --enable-compiler-plugins)])
11117         fi
11118     else
11119         if test "$_bison_longver" -lt 2000; then
11120             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
11121         fi
11122     fi
11124 AC_SUBST([BISON])
11126 AC_PATH_PROG(FLEX, flex)
11127 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11128     FLEX=`cygpath -m $FLEX`
11130 if test -z "$FLEX"; then
11131     AC_MSG_ERROR([no flex found in \$PATH, install it])
11132 else
11133     AC_MSG_CHECKING([the flex version])
11134     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
11135     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
11136         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
11137     fi
11139 AC_SUBST([FLEX])
11140 dnl ***************************************
11141 dnl Checking for patch
11142 dnl ***************************************
11143 AC_PATH_PROG(PATCH, patch)
11144 if test -z "$PATCH"; then
11145     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
11148 dnl On Solaris or macOS, check if --with-gnu-patch was used
11149 if test "$_os" = "SunOS" -o "$_os" = "Darwin"; then
11150     if test -z "$with_gnu_patch"; then
11151         GNUPATCH=$PATCH
11152     else
11153         if test -x "$with_gnu_patch"; then
11154             GNUPATCH=$with_gnu_patch
11155         else
11156             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
11157         fi
11158     fi
11160     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
11161     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
11162         AC_MSG_RESULT([yes])
11163     else
11164         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
11165     fi
11166 else
11167     GNUPATCH=$PATCH
11170 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11171     GNUPATCH=`cygpath -m $GNUPATCH`
11174 dnl We also need to check for --with-gnu-cp
11176 if test -z "$with_gnu_cp"; then
11177     # check the place where the good stuff is hidden on Solaris...
11178     if test -x /usr/gnu/bin/cp; then
11179         GNUCP=/usr/gnu/bin/cp
11180     else
11181         AC_PATH_PROGS(GNUCP, gnucp cp)
11182     fi
11183     if test -z $GNUCP; then
11184         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
11185     fi
11186 else
11187     if test -x "$with_gnu_cp"; then
11188         GNUCP=$with_gnu_cp
11189     else
11190         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
11191     fi
11194 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11195     GNUCP=`cygpath -m $GNUCP`
11198 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
11199 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
11200     AC_MSG_RESULT([yes])
11201 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
11202     AC_MSG_RESULT([yes])
11203 else
11204     case "$build_os" in
11205     darwin*|macos*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
11206         x_GNUCP=[\#]
11207         GNUCP=''
11208         AC_MSG_RESULT([no gnucp found - using the system's cp command])
11209         ;;
11210     *)
11211         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
11212         ;;
11213     esac
11216 AC_SUBST(GNUPATCH)
11217 AC_SUBST(GNUCP)
11218 AC_SUBST(x_GNUCP)
11220 dnl ***************************************
11221 dnl testing assembler path
11222 dnl ***************************************
11223 ML_EXE=""
11224 if test "$_os" = "WINNT"; then
11225     case "$WIN_HOST_ARCH" in
11226     x86) assembler=ml.exe ;;
11227     x64) assembler=ml64.exe ;;
11228     arm64) assembler=armasm64.exe ;;
11229     esac
11231     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
11232     if test -f "$MSVC_HOST_PATH/$assembler"; then
11233         ML_EXE=`win_short_path_for_make "$MSVC_HOST_PATH/$assembler"`
11234         AC_MSG_RESULT([$ML_EXE])
11235     else
11236         AC_MSG_ERROR([not found in $MSVC_HOST_PATH])
11237     fi
11240 AC_SUBST(ML_EXE)
11242 dnl ===================================================================
11243 dnl We need zip and unzip
11244 dnl ===================================================================
11245 AC_PATH_PROG(ZIP, zip)
11246 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
11247 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
11248     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],,)
11251 AC_PATH_PROG(UNZIP, unzip)
11252 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
11254 dnl ===================================================================
11255 dnl Zip must be a specific type for different build types.
11256 dnl ===================================================================
11257 if test $build_os = cygwin; then
11258     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
11259         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
11260     fi
11263 dnl ===================================================================
11264 dnl We need touch with -h option support.
11265 dnl ===================================================================
11266 AC_PATH_PROG(TOUCH, touch)
11267 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
11268 touch warn
11269 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
11270     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],,)
11273 dnl ===================================================================
11274 dnl Check for system epoxy
11275 dnl ===================================================================
11276 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
11278 dnl ===================================================================
11279 dnl Set vcl option: coordinate device in double or sal_Int32
11280 dnl ===================================================================
11282 dnl disabled for now, we don't want subtle differences between OSs
11283 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
11284 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
11285 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
11286 dnl     AC_MSG_RESULT([double])
11287 dnl else
11288 dnl     AC_MSG_RESULT([sal_Int32])
11289 dnl fi
11291 dnl ===================================================================
11292 dnl Test which vclplugs have to be built.
11293 dnl ===================================================================
11294 R=""
11295 if test "$USING_X11" != TRUE; then
11296     enable_gtk3=no
11299 ENABLE_GTK3=""
11300 if test "x$enable_gtk3" = "xyes"; then
11301     ENABLE_GTK3="TRUE"
11302     AC_DEFINE(ENABLE_GTK3)
11303     R="$R gtk3"
11305 AC_SUBST(ENABLE_GTK3)
11307 ENABLE_GTK3_KDE5=""
11308 if test "x$enable_gtk3_kde5" = "xyes"; then
11309     ENABLE_GTK3_KDE5="TRUE"
11310     AC_DEFINE(ENABLE_GTK3_KDE5)
11311     R="$R gtk3_kde5"
11313 AC_SUBST(ENABLE_GTK3_KDE5)
11315 ENABLE_QT5=""
11316 if test "x$enable_qt5" = "xyes"; then
11317     ENABLE_QT5="TRUE"
11318     AC_DEFINE(ENABLE_QT5)
11319     R="$R qt5"
11321 AC_SUBST(ENABLE_QT5)
11323 ENABLE_KF5=""
11324 if test "x$enable_kf5" = "xyes"; then
11325     ENABLE_KF5="TRUE"
11326     AC_DEFINE(ENABLE_KF5)
11327     R="$R kf5"
11329 AC_SUBST(ENABLE_KF5)
11331 GTK3_CFLAGS=""
11332 GTK3_LIBS=""
11333 if test "x$enable_gtk3" = "xyes" -o "x$enable_gtk3_kde5" = "xyes"; then
11334     if test "$with_system_cairo" = no; then
11335         add_warning 'Non-system cairo combined with gtk3 is assumed to cause trouble; proceed at your own risk.'
11336     fi
11337     : ${with_system_cairo:=yes}
11338     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)
11339     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11340     GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
11341     FilterLibs "${GTK3_LIBS}"
11342     GTK3_LIBS="${filteredlibs}"
11344     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
11345     if test "$with_system_epoxy" != "yes"; then
11346         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
11347         AC_CHECK_HEADER(EGL/eglplatform.h, [],
11348                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
11349     fi
11351 AC_SUBST(GTK3_LIBS)
11352 AC_SUBST(GTK3_CFLAGS)
11354 if test "$enable_introspection" = yes; then
11355     if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
11356         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
11357     else
11358         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
11359     fi
11362 if test "$_os" = "WINNT"; then
11363     R="$R win"
11364 elif test "$_os" = "Darwin"; then
11365     R="$R osx"
11366 elif test "$_os" = "iOS"; then
11367     R="ios (builtin)"
11370 build_vcl_plugins="$R"
11371 if test -z "$build_vcl_plugins"; then
11372     build_vcl_plugins="none"
11374 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
11376 dnl ===================================================================
11377 dnl check for dbus support
11378 dnl ===================================================================
11379 ENABLE_DBUS=""
11380 DBUS_CFLAGS=""
11381 DBUS_LIBS=""
11382 DBUS_GLIB_CFLAGS=""
11383 DBUS_GLIB_LIBS=""
11384 DBUS_HAVE_GLIB=""
11386 if test "$enable_dbus" = "no"; then
11387     test_dbus=no
11390 AC_MSG_CHECKING([whether to enable DBUS support])
11391 if test "$test_dbus" = "yes"; then
11392     ENABLE_DBUS="TRUE"
11393     AC_MSG_RESULT([yes])
11394     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
11395     AC_DEFINE(ENABLE_DBUS)
11396     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11397     FilterLibs "${DBUS_LIBS}"
11398     DBUS_LIBS="${filteredlibs}"
11400     # Glib is needed for BluetoothServer
11401     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
11402     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
11403         [
11404             DBUS_HAVE_GLIB="TRUE"
11405             AC_DEFINE(DBUS_HAVE_GLIB,1)
11406         ],
11407         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
11408     )
11409 else
11410     AC_MSG_RESULT([no])
11413 AC_SUBST(ENABLE_DBUS)
11414 AC_SUBST(DBUS_CFLAGS)
11415 AC_SUBST(DBUS_LIBS)
11416 AC_SUBST(DBUS_GLIB_CFLAGS)
11417 AC_SUBST(DBUS_GLIB_LIBS)
11418 AC_SUBST(DBUS_HAVE_GLIB)
11420 AC_MSG_CHECKING([whether to enable Impress remote control])
11421 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
11422     AC_MSG_RESULT([yes])
11423     ENABLE_SDREMOTE=TRUE
11424     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
11426     if test $OS = MACOSX && test "$MACOSX_SDK_VERSION" -ge 101500; then
11427         # The Bluetooth code doesn't compile with macOS SDK 10.15
11428         if test "$enable_sdremote_bluetooth" = yes; then
11429             AC_MSG_ERROR([macOS SDK $with_macosx_sdk does not currently support --enable-sdremote-bluetooth])
11430         fi
11431         enable_sdremote_bluetooth=no
11432     fi
11433     # If not explicitly enabled or disabled, default
11434     if test -z "$enable_sdremote_bluetooth"; then
11435         case "$OS" in
11436         LINUX|MACOSX|WNT)
11437             # Default to yes for these
11438             enable_sdremote_bluetooth=yes
11439             ;;
11440         *)
11441             # otherwise no
11442             enable_sdremote_bluetooth=no
11443             ;;
11444         esac
11445     fi
11446     # $enable_sdremote_bluetooth is guaranteed non-empty now
11448     if test "$enable_sdremote_bluetooth" != "no"; then
11449         if test "$OS" = "LINUX"; then
11450             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
11451                 AC_MSG_RESULT([yes])
11452                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
11453                 dnl ===================================================================
11454                 dnl Check for system bluez
11455                 dnl ===================================================================
11456                 AC_MSG_CHECKING([which Bluetooth header to use])
11457                 if test "$with_system_bluez" = "yes"; then
11458                     AC_MSG_RESULT([external])
11459                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
11460                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
11461                     SYSTEM_BLUEZ=TRUE
11462                 else
11463                     AC_MSG_RESULT([internal])
11464                     SYSTEM_BLUEZ=
11465                 fi
11466             else
11467                 AC_MSG_RESULT([no, dbus disabled])
11468                 ENABLE_SDREMOTE_BLUETOOTH=
11469                 SYSTEM_BLUEZ=
11470             fi
11471         else
11472             AC_MSG_RESULT([yes])
11473             ENABLE_SDREMOTE_BLUETOOTH=TRUE
11474             SYSTEM_BLUEZ=
11475         fi
11476     else
11477         AC_MSG_RESULT([no])
11478         ENABLE_SDREMOTE_BLUETOOTH=
11479         SYSTEM_BLUEZ=
11480     fi
11481 else
11482     ENABLE_SDREMOTE=
11483     SYSTEM_BLUEZ=
11484     AC_MSG_RESULT([no])
11486 AC_SUBST(ENABLE_SDREMOTE)
11487 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
11488 AC_SUBST(SYSTEM_BLUEZ)
11490 dnl ===================================================================
11491 dnl Check whether to enable GIO support
11492 dnl ===================================================================
11493 if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
11494     AC_MSG_CHECKING([whether to enable GIO support])
11495     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
11496         dnl Need at least 2.26 for the dbus support.
11497         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
11498                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
11499         if test "$ENABLE_GIO" = "TRUE"; then
11500             AC_DEFINE(ENABLE_GIO)
11501             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11502             FilterLibs "${GIO_LIBS}"
11503             GIO_LIBS="${filteredlibs}"
11504         fi
11505     else
11506         AC_MSG_RESULT([no])
11507     fi
11509 AC_SUBST(ENABLE_GIO)
11510 AC_SUBST(GIO_CFLAGS)
11511 AC_SUBST(GIO_LIBS)
11514 dnl ===================================================================
11516 SPLIT_APP_MODULES=""
11517 if test "$enable_split_app_modules" = "yes"; then
11518     SPLIT_APP_MODULES="TRUE"
11520 AC_SUBST(SPLIT_APP_MODULES)
11522 SPLIT_OPT_FEATURES=""
11523 if test "$enable_split_opt_features" = "yes"; then
11524     SPLIT_OPT_FEATURES="TRUE"
11526 AC_SUBST(SPLIT_OPT_FEATURES)
11528 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
11529     if test "$enable_cairo_canvas" = yes; then
11530         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
11531     fi
11532     enable_cairo_canvas=no
11533 elif test -z "$enable_cairo_canvas"; then
11534     enable_cairo_canvas=yes
11537 ENABLE_CAIRO_CANVAS=""
11538 if test "$enable_cairo_canvas" = "yes"; then
11539     test_cairo=yes
11540     ENABLE_CAIRO_CANVAS="TRUE"
11541     AC_DEFINE(ENABLE_CAIRO_CANVAS)
11543 AC_SUBST(ENABLE_CAIRO_CANVAS)
11545 dnl ===================================================================
11546 dnl Check whether the GStreamer libraries are available.
11547 dnl ===================================================================
11549 ENABLE_GSTREAMER_1_0=""
11551 if test "$build_gstreamer_1_0" = "yes"; then
11553     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
11554     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
11555         ENABLE_GSTREAMER_1_0="TRUE"
11556         AC_MSG_RESULT([yes])
11557         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
11558         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11559         FilterLibs "${GSTREAMER_1_0_LIBS}"
11560         GSTREAMER_1_0_LIBS="${filteredlibs}"
11561         AC_DEFINE(ENABLE_GSTREAMER_1_0)
11562     else
11563         AC_MSG_RESULT([no])
11564     fi
11566 AC_SUBST(GSTREAMER_1_0_CFLAGS)
11567 AC_SUBST(GSTREAMER_1_0_LIBS)
11568 AC_SUBST(ENABLE_GSTREAMER_1_0)
11570 ENABLE_OPENGL_TRANSITIONS=
11571 ENABLE_OPENGL_CANVAS=
11572 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
11573    : # disable
11574 elif test "$_os" = "Darwin"; then
11575     # We use frameworks on macOS, no need for detail checks
11576     ENABLE_OPENGL_TRANSITIONS=TRUE
11577     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11578     ENABLE_OPENGL_CANVAS=TRUE
11579 elif test $_os = WINNT; then
11580     ENABLE_OPENGL_TRANSITIONS=TRUE
11581     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11582     ENABLE_OPENGL_CANVAS=TRUE
11583 else
11584     if test "$USING_X11" = TRUE; then
11585         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
11586         ENABLE_OPENGL_TRANSITIONS=TRUE
11587         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11588         ENABLE_OPENGL_CANVAS=TRUE
11589     fi
11592 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
11593 AC_SUBST(ENABLE_OPENGL_CANVAS)
11595 dnl =================================================
11596 dnl Check whether to build with OpenCL support.
11597 dnl =================================================
11599 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE" -a "$enable_opencl" = "yes"; then
11600     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
11601     # platform (optional at run-time, used through clew).
11602     BUILD_TYPE="$BUILD_TYPE OPENCL"
11603     AC_DEFINE(HAVE_FEATURE_OPENCL)
11606 dnl =================================================
11607 dnl Check whether to build with dconf support.
11608 dnl =================================================
11610 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
11611     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
11612         if test "$enable_dconf" = yes; then
11613             AC_MSG_ERROR([dconf not found])
11614         else
11615             enable_dconf=no
11616         fi])
11618 AC_MSG_CHECKING([whether to enable dconf])
11619 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
11620     DCONF_CFLAGS=
11621     DCONF_LIBS=
11622     ENABLE_DCONF=
11623     AC_MSG_RESULT([no])
11624 else
11625     ENABLE_DCONF=TRUE
11626     AC_DEFINE(ENABLE_DCONF)
11627     AC_MSG_RESULT([yes])
11629 AC_SUBST([DCONF_CFLAGS])
11630 AC_SUBST([DCONF_LIBS])
11631 AC_SUBST([ENABLE_DCONF])
11633 # pdf import?
11634 AC_MSG_CHECKING([whether to build the PDF import feature])
11635 ENABLE_PDFIMPORT=
11636 if test -z "$enable_pdfimport" -o "$enable_pdfimport" = yes; then
11637     AC_MSG_RESULT([yes])
11638     ENABLE_PDFIMPORT=TRUE
11639     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
11640 else
11641     AC_MSG_RESULT([no])
11644 # Pdfium?
11645 AC_MSG_CHECKING([whether to build PDFium])
11646 ENABLE_PDFIUM=
11647 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
11648     AC_MSG_RESULT([yes])
11649     ENABLE_PDFIUM=TRUE
11650     BUILD_TYPE="$BUILD_TYPE PDFIUM"
11651 else
11652     AC_MSG_RESULT([no])
11654 AC_SUBST(ENABLE_PDFIUM)
11656 dnl ===================================================================
11657 dnl Check for poppler
11658 dnl ===================================================================
11659 ENABLE_POPPLER=
11660 AC_MSG_CHECKING([whether to build Poppler])
11661 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" -a $_os != Android \) -o "$enable_poppler" = yes; then
11662     AC_MSG_RESULT([yes])
11663     ENABLE_POPPLER=TRUE
11664     AC_DEFINE(HAVE_FEATURE_POPPLER)
11665 else
11666     AC_MSG_RESULT([no])
11668 AC_SUBST(ENABLE_POPPLER)
11670 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
11671     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
11674 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
11675     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
11678 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
11679     dnl ===================================================================
11680     dnl Check for system poppler
11681     dnl ===================================================================
11682     AC_MSG_CHECKING([which PDF import poppler to use])
11683     if test "$with_system_poppler" = "yes"; then
11684         AC_MSG_RESULT([external])
11685         SYSTEM_POPPLER=TRUE
11686         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
11687         AC_LANG_PUSH([C++])
11688         save_CXXFLAGS=$CXXFLAGS
11689         save_CPPFLAGS=$CPPFLAGS
11690         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
11691         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
11692         AC_CHECK_HEADER([cpp/poppler-version.h],
11693             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
11694             [])
11695         CXXFLAGS=$save_CXXFLAGS
11696         CPPFLAGS=$save_CPPFLAGS
11697         AC_LANG_POP([C++])
11698         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11700         FilterLibs "${POPPLER_LIBS}"
11701         POPPLER_LIBS="${filteredlibs}"
11702     else
11703         AC_MSG_RESULT([internal])
11704         SYSTEM_POPPLER=
11705         BUILD_TYPE="$BUILD_TYPE POPPLER"
11706         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
11707     fi
11708     AC_DEFINE([ENABLE_PDFIMPORT],1)
11710 AC_SUBST(ENABLE_PDFIMPORT)
11711 AC_SUBST(SYSTEM_POPPLER)
11712 AC_SUBST(POPPLER_CFLAGS)
11713 AC_SUBST(POPPLER_LIBS)
11715 # Skia?
11716 AC_MSG_CHECKING([whether to build Skia])
11717 ENABLE_SKIA=
11718 if test "$enable_skia" != "no" -a "$build_skia" = "yes" -a -z "$DISABLE_GUI"; then
11719     if test "$enable_skia" = "debug"; then
11720         AC_MSG_RESULT([yes (debug)])
11721         ENABLE_SKIA_DEBUG=TRUE
11722     else
11723         AC_MSG_RESULT([yes])
11724         ENABLE_SKIA_DEBUG=
11725     fi
11726     ENABLE_SKIA=TRUE
11727     AC_DEFINE(HAVE_FEATURE_SKIA)
11728     BUILD_TYPE="$BUILD_TYPE SKIA"
11729 else
11730     AC_MSG_RESULT([no])
11732 AC_SUBST(ENABLE_SKIA)
11733 AC_SUBST(ENABLE_SKIA_DEBUG)
11735 LO_CLANG_CXXFLAGS_INTRINSICS_SSE2=
11736 LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3=
11737 LO_CLANG_CXXFLAGS_INTRINSICS_SSE41=
11738 LO_CLANG_CXXFLAGS_INTRINSICS_SSE42=
11739 LO_CLANG_CXXFLAGS_INTRINSICS_AVX=
11740 LO_CLANG_CXXFLAGS_INTRINSICS_AVX2=
11741 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512=
11742 LO_CLANG_CXXFLAGS_INTRINSICS_F16C=
11743 LO_CLANG_CXXFLAGS_INTRINSICS_FMA=
11745 if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE -a ! \( "$_os" = "WINNT" -a "$CPUNAME" = "AARCH64" \); then
11746     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
11747         AC_MSG_CHECKING([for Clang])
11748         AC_MSG_RESULT([$LO_CLANG_CC / $LO_CLANG_CXX])
11749     else
11750         if test "$_os" = "WINNT"; then
11751             AC_MSG_CHECKING([for clang-cl])
11752             if test -x "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"; then
11753                 LO_CLANG_CC=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"`
11754                 dnl explicitly set -m32/-m64
11755                 LO_CLANG_CC="$LO_CLANG_CC -m$WIN_HOST_BITS"
11756                 LO_CLANG_CXX="$LO_CLANG_CC"
11757                 AC_MSG_RESULT([$LO_CLANG_CC])
11758             else
11759                 AC_MSG_RESULT([no])
11760             fi
11761         else
11762             AC_CHECK_PROG(LO_CLANG_CC,clang,clang,[])
11763             AC_CHECK_PROG(LO_CLANG_CXX,clang++,clang++,[])
11764         fi
11765     fi
11766     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
11767         clang2_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $LO_CLANG_CC -E - | tail -1 | sed 's/ //g'`
11768         clang2_ver=`echo "$clang2_version" | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
11769         if test "$clang2_ver" -lt 50002; then
11770             AC_MSG_WARN(["$clang2_version" is too old or unrecognized, must be at least Clang 5.0.2])
11771             LO_CLANG_CC=
11772             LO_CLANG_CXX=
11773         fi
11774     fi
11775     if test -z "$LO_CLANG_CC" -o -z "$LO_CLANG_CXX"; then
11776         # Skia is the default on Windows, so hard-require Clang.
11777         # Elsewhere it's used just by the 'gen' VCL backend which is rarely used.
11778         if test "$_os" = "WINNT"; then
11779             AC_MSG_ERROR([Clang compiler not found. The Skia library needs to be built using Clang.])
11780         else
11781             AC_MSG_WARN([Clang compiler not found.])
11782         fi
11783     else
11785         save_CXX="$CXX"
11786         CXX="$LO_CLANG_CXX"
11787         # copy&paste (and adjust) of intrinsics checks, since MSVC's -arch doesn't work well for Clang-cl
11788         flag_sse2=-msse2
11789         flag_ssse3=-mssse3
11790         flag_sse41=-msse4.1
11791         flag_sse42=-msse4.2
11792         flag_avx=-mavx
11793         flag_avx2=-mavx2
11794         flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
11795         flag_f16c=-mf16c
11796         flag_fma=-mfma
11798         AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
11799         AC_LANG_PUSH([C++])
11800         save_CXXFLAGS=$CXXFLAGS
11801         CXXFLAGS="$CXXFLAGS $flag_sse2"
11802         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11803             #include <emmintrin.h>
11804             int main () {
11805                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11806                 c = _mm_xor_si128 (a, b);
11807                 return 0;
11808             }
11809             ])],
11810             [can_compile_sse2=yes],
11811             [can_compile_sse2=no])
11812         AC_LANG_POP([C++])
11813         CXXFLAGS=$save_CXXFLAGS
11814         AC_MSG_RESULT([${can_compile_sse2}])
11815         if test "${can_compile_sse2}" = "yes" ; then
11816             LO_CLANG_CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
11817         fi
11819         AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
11820         AC_LANG_PUSH([C++])
11821         save_CXXFLAGS=$CXXFLAGS
11822         CXXFLAGS="$CXXFLAGS $flag_ssse3"
11823         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11824             #include <tmmintrin.h>
11825             int main () {
11826                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11827                 c = _mm_maddubs_epi16 (a, b);
11828                 return 0;
11829             }
11830             ])],
11831             [can_compile_ssse3=yes],
11832             [can_compile_ssse3=no])
11833         AC_LANG_POP([C++])
11834         CXXFLAGS=$save_CXXFLAGS
11835         AC_MSG_RESULT([${can_compile_ssse3}])
11836         if test "${can_compile_ssse3}" = "yes" ; then
11837             LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
11838         fi
11840         AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
11841         AC_LANG_PUSH([C++])
11842         save_CXXFLAGS=$CXXFLAGS
11843         CXXFLAGS="$CXXFLAGS $flag_sse41"
11844         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11845             #include <smmintrin.h>
11846             int main () {
11847                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11848                 c = _mm_cmpeq_epi64 (a, b);
11849                 return 0;
11850             }
11851             ])],
11852             [can_compile_sse41=yes],
11853             [can_compile_sse41=no])
11854         AC_LANG_POP([C++])
11855         CXXFLAGS=$save_CXXFLAGS
11856         AC_MSG_RESULT([${can_compile_sse41}])
11857         if test "${can_compile_sse41}" = "yes" ; then
11858             LO_CLANG_CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
11859         fi
11861         AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
11862         AC_LANG_PUSH([C++])
11863         save_CXXFLAGS=$CXXFLAGS
11864         CXXFLAGS="$CXXFLAGS $flag_sse42"
11865         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11866             #include <nmmintrin.h>
11867             int main () {
11868                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11869                 c = _mm_cmpgt_epi64 (a, b);
11870                 return 0;
11871             }
11872             ])],
11873             [can_compile_sse42=yes],
11874             [can_compile_sse42=no])
11875         AC_LANG_POP([C++])
11876         CXXFLAGS=$save_CXXFLAGS
11877         AC_MSG_RESULT([${can_compile_sse42}])
11878         if test "${can_compile_sse42}" = "yes" ; then
11879             LO_CLANG_CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
11880         fi
11882         AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
11883         AC_LANG_PUSH([C++])
11884         save_CXXFLAGS=$CXXFLAGS
11885         CXXFLAGS="$CXXFLAGS $flag_avx"
11886         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11887             #include <immintrin.h>
11888             int main () {
11889                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
11890                 c = _mm256_xor_ps(a, b);
11891                 return 0;
11892             }
11893             ])],
11894             [can_compile_avx=yes],
11895             [can_compile_avx=no])
11896         AC_LANG_POP([C++])
11897         CXXFLAGS=$save_CXXFLAGS
11898         AC_MSG_RESULT([${can_compile_avx}])
11899         if test "${can_compile_avx}" = "yes" ; then
11900             LO_CLANG_CXXFLAGS_INTRINSICS_AVX="$flag_avx"
11901         fi
11903         AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
11904         AC_LANG_PUSH([C++])
11905         save_CXXFLAGS=$CXXFLAGS
11906         CXXFLAGS="$CXXFLAGS $flag_avx2"
11907         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11908             #include <immintrin.h>
11909             int main () {
11910                 __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
11911                 c = _mm256_maddubs_epi16(a, b);
11912                 return 0;
11913             }
11914             ])],
11915             [can_compile_avx2=yes],
11916             [can_compile_avx2=no])
11917         AC_LANG_POP([C++])
11918         CXXFLAGS=$save_CXXFLAGS
11919         AC_MSG_RESULT([${can_compile_avx2}])
11920         if test "${can_compile_avx2}" = "yes" ; then
11921             LO_CLANG_CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
11922         fi
11924         AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
11925         AC_LANG_PUSH([C++])
11926         save_CXXFLAGS=$CXXFLAGS
11927         CXXFLAGS="$CXXFLAGS $flag_avx512"
11928         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11929             #include <immintrin.h>
11930             int main () {
11931                 __m512i a = _mm512_loadu_si512(0);
11932                 return 0;
11933             }
11934             ])],
11935             [can_compile_avx512=yes],
11936             [can_compile_avx512=no])
11937         AC_LANG_POP([C++])
11938         CXXFLAGS=$save_CXXFLAGS
11939         AC_MSG_RESULT([${can_compile_avx512}])
11940         if test "${can_compile_avx512}" = "yes" ; then
11941             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
11942         fi
11944         AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
11945         AC_LANG_PUSH([C++])
11946         save_CXXFLAGS=$CXXFLAGS
11947         CXXFLAGS="$CXXFLAGS $flag_f16c"
11948         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11949             #include <immintrin.h>
11950             int main () {
11951                 __m128i a = _mm_set1_epi32 (0);
11952                 __m128 c;
11953                 c = _mm_cvtph_ps(a);
11954                 return 0;
11955             }
11956             ])],
11957             [can_compile_f16c=yes],
11958             [can_compile_f16c=no])
11959         AC_LANG_POP([C++])
11960         CXXFLAGS=$save_CXXFLAGS
11961         AC_MSG_RESULT([${can_compile_f16c}])
11962         if test "${can_compile_f16c}" = "yes" ; then
11963             LO_CLANG_CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
11964         fi
11966         AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
11967         AC_LANG_PUSH([C++])
11968         save_CXXFLAGS=$CXXFLAGS
11969         CXXFLAGS="$CXXFLAGS $flag_fma"
11970         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11971             #include <immintrin.h>
11972             int main () {
11973                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
11974                 d = _mm256_fmadd_ps(a, b, c);
11975                 return 0;
11976             }
11977             ])],
11978             [can_compile_fma=yes],
11979             [can_compile_fma=no])
11980         AC_LANG_POP([C++])
11981         CXXFLAGS=$save_CXXFLAGS
11982         AC_MSG_RESULT([${can_compile_fma}])
11983         if test "${can_compile_fma}" = "yes" ; then
11984             LO_CLANG_CXXFLAGS_INTRINSICS_FMA="$flag_fma"
11985         fi
11987         CXX="$save_CXX"
11988     fi
11991 # prefix LO_CLANG_CC/LO_CLANG_CXX with ccache if needed
11993 UNCACHED_CLANG_CC="$LO_CLANG_CC"
11994 UNCACHED_CLANG_CXX="$LO_CLANG_CXX"
11995 if test "$CCACHE" != "" -a -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
11996     AC_MSG_CHECKING([whether $LO_CLANG_CC is already ccached])
11997     AC_LANG_PUSH([C])
11998     save_CC="$CC"
11999     CC="$LO_CLANG_CC"
12000     save_CFLAGS=$CFLAGS
12001     CFLAGS="$CFLAGS --ccache-skip -O2"
12002     dnl an empty program will do, we're checking the compiler flags
12003     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12004                       [use_ccache=yes], [use_ccache=no])
12005     CFLAGS=$save_CFLAGS
12006     CC=$save_CC
12007     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12008         AC_MSG_RESULT([yes])
12009     else
12010         LO_CLANG_CC="$CCACHE $LO_CLANG_CC"
12011         AC_MSG_RESULT([no])
12012     fi
12013     AC_LANG_POP([C])
12015     AC_MSG_CHECKING([whether $LO_CLANG_CXX is already ccached])
12016     AC_LANG_PUSH([C++])
12017     save_CXX="$CXX"
12018     CXX="$LO_CLANG_CXX"
12019     save_CXXFLAGS=$CXXFLAGS
12020     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
12021     dnl an empty program will do, we're checking the compiler flags
12022     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
12023                       [use_ccache=yes], [use_ccache=no])
12024     if test $use_ccache = yes -a "${CCACHE/*sccache*/}" != ""; then
12025         AC_MSG_RESULT([yes])
12026     else
12027         LO_CLANG_CXX="$CCACHE $LO_CLANG_CXX"
12028         AC_MSG_RESULT([no])
12029     fi
12030     CXXFLAGS=$save_CXXFLAGS
12031     CXX=$save_CXX
12032     AC_LANG_POP([C++])
12035 AC_SUBST(UNCACHED_CC)
12036 AC_SUBST(UNCACHED_CXX)
12037 AC_SUBST(LO_CLANG_CC)
12038 AC_SUBST(LO_CLANG_CXX)
12039 AC_SUBST(UNCACHED_CLANG_CC)
12040 AC_SUBST(UNCACHED_CLANG_CXX)
12041 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE2)
12042 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3)
12043 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE41)
12044 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE42)
12045 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX)
12046 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX2)
12047 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512)
12048 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_F16C)
12049 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_FMA)
12050 AC_SUBST(CLANG_USE_LD)
12052 SYSTEM_GPGMEPP=
12054 if test "$enable_gpgmepp" = no; then
12055     AC_MSG_CHECKING([whether to enable gpgmepp])
12056     AC_MSG_RESULT([no])
12057 elif test "$enable_mpl_subset" = "yes"; then
12058     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
12059     AC_MSG_RESULT([yes])
12060 elif test "$enable_fuzzers" = "yes"; then
12061     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
12062     AC_MSG_RESULT([yes])
12063 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
12064     dnl ===================================================================
12065     dnl Check for system gpgme
12066     dnl ===================================================================
12067     AC_MSG_CHECKING([which gpgmepp to use])
12068     if test "$with_system_gpgmepp" = "yes"; then
12069         AC_MSG_RESULT([external])
12070         SYSTEM_GPGMEPP=TRUE
12072         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
12073         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
12074             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
12075         # progress_callback is the only func with plain C linkage
12076         # checking for it also filters out older, KDE-dependent libgpgmepp versions
12077         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
12078             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
12079         AC_CHECK_HEADER(gpgme.h, [],
12080             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
12081     else
12082         AC_MSG_RESULT([internal])
12083         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
12084         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
12086         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
12087         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
12088         if test "$_os" != "WINNT"; then
12089             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
12090             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
12091         fi
12092     fi
12093     ENABLE_GPGMEPP=TRUE
12094     AC_DEFINE([HAVE_FEATURE_GPGME])
12095     AC_PATH_PROG(GPG, gpg)
12096     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
12097     # so let's exclude that manually for the moment
12098     if test -n "$GPG" -a "$_os" != "WINNT"; then
12099         # make sure we not only have a working gpgme, but a full working
12100         # gpg installation to run OpenPGP signature verification
12101         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
12102     fi
12103     if test "$_os" = "Linux"; then
12104       uid=`id -u`
12105       AC_MSG_CHECKING([for /run/user/$uid])
12106       if test -d /run/user/$uid; then
12107         AC_MSG_RESULT([yes])
12108         AC_PATH_PROG(GPGCONF, gpgconf)
12110         # Older versions of gpgconf are not working as expected, since
12111         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
12112         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
12113         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
12114         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
12115         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
12116         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
12117         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
12118           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
12119           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
12120           if $GPGCONF --dump-options > /dev/null ; then
12121             if $GPGCONF --dump-options | grep -q create-socketdir ; then
12122               AC_MSG_RESULT([yes])
12123               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
12124               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
12125             else
12126               AC_MSG_RESULT([no])
12127             fi
12128           else
12129             AC_MSG_RESULT([no. missing or broken gpgconf?])
12130           fi
12131         else
12132           AC_MSG_RESULT([no, $GPGCONF_VERSION])
12133         fi
12134       else
12135         AC_MSG_RESULT([no])
12136      fi
12137    fi
12139 AC_SUBST(ENABLE_GPGMEPP)
12140 AC_SUBST(SYSTEM_GPGMEPP)
12141 AC_SUBST(GPG_ERROR_CFLAGS)
12142 AC_SUBST(GPG_ERROR_LIBS)
12143 AC_SUBST(LIBASSUAN_CFLAGS)
12144 AC_SUBST(LIBASSUAN_LIBS)
12145 AC_SUBST(GPGMEPP_CFLAGS)
12146 AC_SUBST(GPGMEPP_LIBS)
12148 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
12149 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
12150     AC_MSG_RESULT([yes])
12151     ENABLE_MEDIAWIKI=TRUE
12152     BUILD_TYPE="$BUILD_TYPE XSLTML"
12153     if test  "x$with_java" = "xno"; then
12154         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
12155     fi
12156 else
12157     AC_MSG_RESULT([no])
12158     ENABLE_MEDIAWIKI=
12159     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
12161 AC_SUBST(ENABLE_MEDIAWIKI)
12163 AC_MSG_CHECKING([whether to build the Report Builder])
12164 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12165     AC_MSG_RESULT([yes])
12166     ENABLE_REPORTBUILDER=TRUE
12167     AC_MSG_CHECKING([which jfreereport libs to use])
12168     if test "$with_system_jfreereport" = "yes"; then
12169         SYSTEM_JFREEREPORT=TRUE
12170         AC_MSG_RESULT([external])
12171         if test -z $SAC_JAR; then
12172             SAC_JAR=/usr/share/java/sac.jar
12173         fi
12174         if ! test -f $SAC_JAR; then
12175              AC_MSG_ERROR(sac.jar not found.)
12176         fi
12178         if test -z $LIBXML_JAR; then
12179             if test -f /usr/share/java/libxml-1.0.0.jar; then
12180                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
12181             elif test -f /usr/share/java/libxml.jar; then
12182                 LIBXML_JAR=/usr/share/java/libxml.jar
12183             else
12184                 AC_MSG_ERROR(libxml.jar replacement not found.)
12185             fi
12186         elif ! test -f $LIBXML_JAR; then
12187             AC_MSG_ERROR(libxml.jar not found.)
12188         fi
12190         if test -z $FLUTE_JAR; then
12191             if test -f /usr/share/java/flute-1.3.0.jar; then
12192                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
12193             elif test -f /usr/share/java/flute.jar; then
12194                 FLUTE_JAR=/usr/share/java/flute.jar
12195             else
12196                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
12197             fi
12198         elif ! test -f $FLUTE_JAR; then
12199             AC_MSG_ERROR(flute-1.3.0.jar not found.)
12200         fi
12202         if test -z $JFREEREPORT_JAR; then
12203             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
12204                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
12205             elif test -f /usr/share/java/flow-engine.jar; then
12206                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
12207             else
12208                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
12209             fi
12210         elif ! test -f  $JFREEREPORT_JAR; then
12211                 AC_MSG_ERROR(jfreereport.jar not found.)
12212         fi
12214         if test -z $LIBLAYOUT_JAR; then
12215             if test -f /usr/share/java/liblayout-0.2.9.jar; then
12216                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
12217             elif test -f /usr/share/java/liblayout.jar; then
12218                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
12219             else
12220                 AC_MSG_ERROR(liblayout.jar replacement not found.)
12221             fi
12222         elif ! test -f $LIBLAYOUT_JAR; then
12223                 AC_MSG_ERROR(liblayout.jar not found.)
12224         fi
12226         if test -z $LIBLOADER_JAR; then
12227             if test -f /usr/share/java/libloader-1.0.0.jar; then
12228                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
12229             elif test -f /usr/share/java/libloader.jar; then
12230                 LIBLOADER_JAR=/usr/share/java/libloader.jar
12231             else
12232                 AC_MSG_ERROR(libloader.jar replacement not found.)
12233             fi
12234         elif ! test -f  $LIBLOADER_JAR; then
12235             AC_MSG_ERROR(libloader.jar not found.)
12236         fi
12238         if test -z $LIBFORMULA_JAR; then
12239             if test -f /usr/share/java/libformula-0.2.0.jar; then
12240                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
12241             elif test -f /usr/share/java/libformula.jar; then
12242                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
12243             else
12244                 AC_MSG_ERROR(libformula.jar replacement not found.)
12245             fi
12246         elif ! test -f $LIBFORMULA_JAR; then
12247                 AC_MSG_ERROR(libformula.jar not found.)
12248         fi
12250         if test -z $LIBREPOSITORY_JAR; then
12251             if test -f /usr/share/java/librepository-1.0.0.jar; then
12252                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
12253             elif test -f /usr/share/java/librepository.jar; then
12254                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
12255             else
12256                 AC_MSG_ERROR(librepository.jar replacement not found.)
12257             fi
12258         elif ! test -f $LIBREPOSITORY_JAR; then
12259             AC_MSG_ERROR(librepository.jar not found.)
12260         fi
12262         if test -z $LIBFONTS_JAR; then
12263             if test -f /usr/share/java/libfonts-1.0.0.jar; then
12264                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
12265             elif test -f /usr/share/java/libfonts.jar; then
12266                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
12267             else
12268                 AC_MSG_ERROR(libfonts.jar replacement not found.)
12269             fi
12270         elif ! test -f $LIBFONTS_JAR; then
12271                 AC_MSG_ERROR(libfonts.jar not found.)
12272         fi
12274         if test -z $LIBSERIALIZER_JAR; then
12275             if test -f /usr/share/java/libserializer-1.0.0.jar; then
12276                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
12277             elif test -f /usr/share/java/libserializer.jar; then
12278                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
12279             else
12280                 AC_MSG_ERROR(libserializer.jar replacement not found.)
12281             fi
12282         elif ! test -f $LIBSERIALIZER_JAR; then
12283                 AC_MSG_ERROR(libserializer.jar not found.)
12284         fi
12286         if test -z $LIBBASE_JAR; then
12287             if test -f /usr/share/java/libbase-1.0.0.jar; then
12288                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
12289             elif test -f /usr/share/java/libbase.jar; then
12290                 LIBBASE_JAR=/usr/share/java/libbase.jar
12291             else
12292                 AC_MSG_ERROR(libbase.jar replacement not found.)
12293             fi
12294         elif ! test -f $LIBBASE_JAR; then
12295             AC_MSG_ERROR(libbase.jar not found.)
12296         fi
12298     else
12299         AC_MSG_RESULT([internal])
12300         SYSTEM_JFREEREPORT=
12301         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
12302         NEED_ANT=TRUE
12303     fi
12304 else
12305     AC_MSG_RESULT([no])
12306     ENABLE_REPORTBUILDER=
12307     SYSTEM_JFREEREPORT=
12309 AC_SUBST(ENABLE_REPORTBUILDER)
12310 AC_SUBST(SYSTEM_JFREEREPORT)
12311 AC_SUBST(SAC_JAR)
12312 AC_SUBST(LIBXML_JAR)
12313 AC_SUBST(FLUTE_JAR)
12314 AC_SUBST(JFREEREPORT_JAR)
12315 AC_SUBST(LIBBASE_JAR)
12316 AC_SUBST(LIBLAYOUT_JAR)
12317 AC_SUBST(LIBLOADER_JAR)
12318 AC_SUBST(LIBFORMULA_JAR)
12319 AC_SUBST(LIBREPOSITORY_JAR)
12320 AC_SUBST(LIBFONTS_JAR)
12321 AC_SUBST(LIBSERIALIZER_JAR)
12323 # scripting provider for BeanShell?
12324 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
12325 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
12326     AC_MSG_RESULT([yes])
12327     ENABLE_SCRIPTING_BEANSHELL=TRUE
12329     dnl ===================================================================
12330     dnl Check for system beanshell
12331     dnl ===================================================================
12332     AC_MSG_CHECKING([which beanshell to use])
12333     if test "$with_system_beanshell" = "yes"; then
12334         AC_MSG_RESULT([external])
12335         SYSTEM_BSH=TRUE
12336         if test -z $BSH_JAR; then
12337             BSH_JAR=/usr/share/java/bsh.jar
12338         fi
12339         if ! test -f $BSH_JAR; then
12340             AC_MSG_ERROR(bsh.jar not found.)
12341         fi
12342     else
12343         AC_MSG_RESULT([internal])
12344         SYSTEM_BSH=
12345         BUILD_TYPE="$BUILD_TYPE BSH"
12346     fi
12347 else
12348     AC_MSG_RESULT([no])
12349     ENABLE_SCRIPTING_BEANSHELL=
12350     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
12352 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
12353 AC_SUBST(SYSTEM_BSH)
12354 AC_SUBST(BSH_JAR)
12356 # scripting provider for JavaScript?
12357 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
12358 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
12359     AC_MSG_RESULT([yes])
12360     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
12362     dnl ===================================================================
12363     dnl Check for system rhino
12364     dnl ===================================================================
12365     AC_MSG_CHECKING([which rhino to use])
12366     if test "$with_system_rhino" = "yes"; then
12367         AC_MSG_RESULT([external])
12368         SYSTEM_RHINO=TRUE
12369         if test -z $RHINO_JAR; then
12370             RHINO_JAR=/usr/share/java/js.jar
12371         fi
12372         if ! test -f $RHINO_JAR; then
12373             AC_MSG_ERROR(js.jar not found.)
12374         fi
12375     else
12376         AC_MSG_RESULT([internal])
12377         SYSTEM_RHINO=
12378         BUILD_TYPE="$BUILD_TYPE RHINO"
12379         NEED_ANT=TRUE
12380     fi
12381 else
12382     AC_MSG_RESULT([no])
12383     ENABLE_SCRIPTING_JAVASCRIPT=
12384     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
12386 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
12387 AC_SUBST(SYSTEM_RHINO)
12388 AC_SUBST(RHINO_JAR)
12390 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
12391 # paths should be added to library search path. So lets put all 64-bit
12392 # platforms there.
12393 supports_multilib=
12394 case "$host_cpu" in
12395 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
12396     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
12397         supports_multilib="yes"
12398     fi
12399     ;;
12401     ;;
12402 esac
12404 dnl ===================================================================
12405 dnl QT5 Integration
12406 dnl ===================================================================
12408 QT5_CFLAGS=""
12409 QT5_LIBS=""
12410 QMAKE5="qmake"
12411 MOC5="moc"
12412 QT5_GOBJECT_CFLAGS=""
12413 QT5_GOBJECT_LIBS=""
12414 QT5_HAVE_GOBJECT=""
12415 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
12416         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
12417         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
12418 then
12419     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
12420     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
12422     if test -n "$supports_multilib"; then
12423         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
12424     fi
12426     qt5_test_include="QtWidgets/qapplication.h"
12427     qt5_test_library="libQt5Widgets.so"
12429     dnl Check for qmake5
12430     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH])
12431     if test "$QMAKE5" = "no"; then
12432         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12433     else
12434         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
12435         if test -z "$qmake5_test_ver"; then
12436             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12437         fi
12438         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
12439         qt5_minimal_minor="6"
12440         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
12441             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
12442         else
12443             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
12444         fi
12445     fi
12447     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
12448     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
12450     AC_MSG_CHECKING([for Qt5 headers])
12451     qt5_incdir="no"
12452     for inc_dir in $qt5_incdirs; do
12453         if test -r "$inc_dir/$qt5_test_include"; then
12454             qt5_incdir="$inc_dir"
12455             break
12456         fi
12457     done
12458     AC_MSG_RESULT([$qt5_incdir])
12459     if test "x$qt5_incdir" = "xno"; then
12460         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12461     fi
12462     # check for scenario: qt5-qtbase-devel-*.86_64 installed but host is i686
12463     AC_LANG_PUSH([C++])
12464     save_CPPFLAGS=$CPPFLAGS
12465     CPPFLAGS="${CPPFLAGS} -I${qt5_incdir}"
12466     AC_CHECK_HEADER(QtCore/qconfig.h, [],
12467         [AC_MSG_ERROR(qconfig.h header not found.)], [])
12468     CPPFLAGS=$save_CPPFLAGS
12469     AC_LANG_POP([C++])
12471     AC_MSG_CHECKING([for Qt5 libraries])
12472     qt5_libdir="no"
12473     for lib_dir in $qt5_libdirs; do
12474         if test -r "$lib_dir/$qt5_test_library"; then
12475             qt5_libdir="$lib_dir"
12476             break
12477         fi
12478     done
12479     AC_MSG_RESULT([$qt5_libdir])
12480     if test "x$qt5_libdir" = "xno"; then
12481         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
12482     fi
12484     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
12485     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12486     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
12488     if test "$USING_X11" = TRUE; then
12489         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
12490         PKG_CHECK_MODULES(QT5_XCB_ICCCM,[xcb-icccm],[
12491             QT5_HAVE_XCB_ICCCM=1
12492             AC_DEFINE(QT5_HAVE_XCB_ICCCM)
12493         ],[
12494             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)])
12495             add_warning "XCB ICCCM not found, which is needed for Qt versions (< 5.12) on some WMs to correctly group dialogs (like QTBUG-46626)"
12496         ])
12497         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS $QT5_XCB_ICCCM_CFLAGS"
12498         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS $QT5_XCB_ICCCM_LIBS -lQt5X11Extras"
12499         QT5_USING_X11=1
12500         AC_DEFINE(QT5_USING_X11)
12501     fi
12503     dnl Check for Meta Object Compiler
12505     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH])
12506     if test "$MOC5" = "no"; then
12507         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
12508 the root of your Qt installation by exporting QT5DIR before running "configure".])
12509     fi
12511     if test "$build_gstreamer_1_0" = "yes"; then
12512         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
12513                 QT5_HAVE_GOBJECT=1
12514                 AC_DEFINE(QT5_HAVE_GOBJECT)
12515             ],
12516             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
12517         )
12518     fi
12520 AC_SUBST(QT5_CFLAGS)
12521 AC_SUBST(QT5_LIBS)
12522 AC_SUBST(MOC5)
12523 AC_SUBST(QT5_GOBJECT_CFLAGS)
12524 AC_SUBST(QT5_GOBJECT_LIBS)
12525 AC_SUBST(QT5_HAVE_GOBJECT)
12527 dnl ===================================================================
12528 dnl KF5 Integration
12529 dnl ===================================================================
12531 KF5_CFLAGS=""
12532 KF5_LIBS=""
12533 KF5_CONFIG="kf5-config"
12534 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
12535         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
12536 then
12537     if test "$OS" = "HAIKU"; then
12538         haiku_arch="`echo $RTL_ARCH | tr X x`"
12539         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
12540         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
12541     fi
12543     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
12544     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
12545     if test -n "$supports_multilib"; then
12546         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
12547     fi
12549     kf5_test_include="KF5/kcoreaddons_version.h"
12550     kf5_test_library="libKF5CoreAddons.so"
12551     kf5_libdirs="$qt5_libdir $kf5_libdirs"
12553     dnl kf5 KDE4 support compatibility installed
12554     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
12555     if test "$KF5_CONFIG" != "no"; then
12556         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
12557         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
12558     fi
12560     dnl Check for KF5 headers
12561     AC_MSG_CHECKING([for KF5 headers])
12562     kf5_incdir="no"
12563     for kf5_check in $kf5_incdirs; do
12564         if test -r "$kf5_check/$kf5_test_include"; then
12565             kf5_incdir="$kf5_check/KF5"
12566             break
12567         fi
12568     done
12569     AC_MSG_RESULT([$kf5_incdir])
12570     if test "x$kf5_incdir" = "xno"; then
12571         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
12572     fi
12574     dnl Check for KF5 libraries
12575     AC_MSG_CHECKING([for KF5 libraries])
12576     kf5_libdir="no"
12577     for kf5_check in $kf5_libdirs; do
12578         if test -r "$kf5_check/$kf5_test_library"; then
12579             kf5_libdir="$kf5_check"
12580             break
12581         fi
12582     done
12584     AC_MSG_RESULT([$kf5_libdir])
12585     if test "x$kf5_libdir" = "xno"; then
12586         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
12587     fi
12589     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"
12590     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
12591     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12593     if test "$USING_X11" = TRUE; then
12594         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
12595     fi
12597     AC_LANG_PUSH([C++])
12598     save_CXXFLAGS=$CXXFLAGS
12599     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
12600     AC_MSG_CHECKING([whether KDE is >= 5.0])
12601        AC_RUN_IFELSE([AC_LANG_SOURCE([[
12602 #include <kcoreaddons_version.h>
12604 int main(int argc, char **argv) {
12605        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
12606        else return 1;
12608        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
12609     CXXFLAGS=$save_CXXFLAGS
12610     AC_LANG_POP([C++])
12612 AC_SUBST(KF5_CFLAGS)
12613 AC_SUBST(KF5_LIBS)
12615 dnl ===================================================================
12616 dnl Test whether to include Evolution 2 support
12617 dnl ===================================================================
12618 AC_MSG_CHECKING([whether to enable evolution 2 support])
12619 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
12620     AC_MSG_RESULT([yes])
12621     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
12622     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12623     FilterLibs "${GOBJECT_LIBS}"
12624     GOBJECT_LIBS="${filteredlibs}"
12625     ENABLE_EVOAB2="TRUE"
12626 else
12627     ENABLE_EVOAB2=""
12628     AC_MSG_RESULT([no])
12630 AC_SUBST(ENABLE_EVOAB2)
12631 AC_SUBST(GOBJECT_CFLAGS)
12632 AC_SUBST(GOBJECT_LIBS)
12634 dnl ===================================================================
12635 dnl Test which themes to include
12636 dnl ===================================================================
12637 AC_MSG_CHECKING([which themes to include])
12638 # if none given use default subset of available themes
12639 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
12640     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"
12643 WITH_THEMES=""
12644 if test "x$with_theme" != "xno"; then
12645     for theme in $with_theme; do
12646         case $theme in
12647         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" ;;
12648         default) real_theme=colibre ;;
12649         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
12650         esac
12651         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
12652     done
12654 AC_MSG_RESULT([$WITH_THEMES])
12655 AC_SUBST([WITH_THEMES])
12656 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
12657 for theme in $with_theme; do
12658     case $theme in
12659     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
12660     *) ;;
12661     esac
12662 done
12664 dnl ===================================================================
12665 dnl Test whether to integrate helppacks into the product's installer
12666 dnl ===================================================================
12667 AC_MSG_CHECKING([for helppack integration])
12668 if test "$with_helppack_integration" = "no"; then
12669     AC_MSG_RESULT([no integration])
12670 else
12671     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
12672     AC_MSG_RESULT([integration])
12675 ###############################################################################
12676 # Extensions checking
12677 ###############################################################################
12678 AC_MSG_CHECKING([for extensions integration])
12679 if test "x$enable_extension_integration" != "xno"; then
12680     WITH_EXTENSION_INTEGRATION=TRUE
12681     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
12682     AC_MSG_RESULT([yes, use integration])
12683 else
12684     WITH_EXTENSION_INTEGRATION=
12685     AC_MSG_RESULT([no, do not integrate])
12687 AC_SUBST(WITH_EXTENSION_INTEGRATION)
12689 dnl Should any extra extensions be included?
12690 dnl There are standalone tests for each of these below.
12691 WITH_EXTRA_EXTENSIONS=
12692 AC_SUBST([WITH_EXTRA_EXTENSIONS])
12694 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
12695 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
12696 if test "x$with_java" != "xno"; then
12697     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
12698     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
12701 AC_MSG_CHECKING([whether to build opens___.ttf])
12702 if test "$enable_build_opensymbol" = "yes"; then
12703     AC_MSG_RESULT([yes])
12704     AC_PATH_PROG(FONTFORGE, fontforge)
12705     if test -z "$FONTFORGE"; then
12706         AC_MSG_ERROR([fontforge not installed])
12707     fi
12708 else
12709     AC_MSG_RESULT([no])
12710     OPENSYMBOL_TTF=f543e6e2d7275557a839a164941c0a86e5f2c3f2a0042bfc434c88c6dde9e140-opens___.ttf
12711     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
12713 AC_SUBST(OPENSYMBOL_TTF)
12714 AC_SUBST(FONTFORGE)
12716 dnl ===================================================================
12717 dnl Test whether to include fonts
12718 dnl ===================================================================
12719 AC_MSG_CHECKING([whether to include third-party fonts])
12720 if test "$with_fonts" != "no"; then
12721     AC_MSG_RESULT([yes])
12722     WITH_FONTS=TRUE
12723     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
12724     AC_DEFINE(HAVE_MORE_FONTS)
12725 else
12726     AC_MSG_RESULT([no])
12727     WITH_FONTS=
12728     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
12730 AC_SUBST(WITH_FONTS)
12733 dnl ===================================================================
12734 dnl Test whether to enable online update service
12735 dnl ===================================================================
12736 AC_MSG_CHECKING([whether to enable online update])
12737 ENABLE_ONLINE_UPDATE=
12738 ENABLE_ONLINE_UPDATE_MAR=
12739 UPDATE_CONFIG=
12740 if test "$enable_online_update" = ""; then
12741     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
12742         AC_MSG_RESULT([yes])
12743         ENABLE_ONLINE_UPDATE="TRUE"
12744     else
12745         AC_MSG_RESULT([no])
12746     fi
12747 else
12748     if test "$enable_online_update" = "mar"; then
12749         AC_MSG_RESULT([yes - MAR-based online update])
12750         ENABLE_ONLINE_UPDATE_MAR="TRUE"
12751         if test "$with_update_config" = ""; then
12752             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
12753         fi
12754         UPDATE_CONFIG="$with_update_config"
12755         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
12756     elif test "$enable_online_update" = "yes"; then
12757         AC_MSG_RESULT([yes])
12758         ENABLE_ONLINE_UPDATE="TRUE"
12759     else
12760         AC_MSG_RESULT([no])
12761     fi
12763 AC_SUBST(ENABLE_ONLINE_UPDATE)
12764 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
12765 AC_SUBST(UPDATE_CONFIG)
12767 dnl ===================================================================
12768 dnl Test whether we need bzip2
12769 dnl ===================================================================
12770 SYSTEM_BZIP2=
12771 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
12772     AC_MSG_CHECKING([whether to use system bzip2])
12773     if test "$with_system_bzip2" = yes; then
12774         SYSTEM_BZIP2=TRUE
12775         AC_MSG_RESULT([yes])
12776         PKG_CHECK_MODULES(BZIP2, bzip2)
12777         FilterLibs "${BZIP2_LIBS}"
12778         BZIP2_LIBS="${filteredlibs}"
12779     else
12780         AC_MSG_RESULT([no])
12781         BUILD_TYPE="$BUILD_TYPE BZIP2"
12782     fi
12784 AC_SUBST(SYSTEM_BZIP2)
12785 AC_SUBST(BZIP2_CFLAGS)
12786 AC_SUBST(BZIP2_LIBS)
12788 dnl ===================================================================
12789 dnl Test whether to enable extension update
12790 dnl ===================================================================
12791 AC_MSG_CHECKING([whether to enable extension update])
12792 ENABLE_EXTENSION_UPDATE=
12793 if test "x$enable_extension_update" = "xno"; then
12794     AC_MSG_RESULT([no])
12795 else
12796     AC_MSG_RESULT([yes])
12797     ENABLE_EXTENSION_UPDATE="TRUE"
12798     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
12799     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
12801 AC_SUBST(ENABLE_EXTENSION_UPDATE)
12804 dnl ===================================================================
12805 dnl Test whether to create MSI with LIMITUI=1 (silent install)
12806 dnl ===================================================================
12807 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
12808 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
12809     AC_MSG_RESULT([no])
12810     ENABLE_SILENT_MSI=
12811 else
12812     AC_MSG_RESULT([yes])
12813     ENABLE_SILENT_MSI=TRUE
12814     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
12816 AC_SUBST(ENABLE_SILENT_MSI)
12818 AC_MSG_CHECKING([whether and how to use Xinerama])
12819 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
12820     if test "$x_libraries" = "default_x_libraries"; then
12821         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
12822         if test "x$XINERAMALIB" = x; then
12823            XINERAMALIB="/usr/lib"
12824         fi
12825     else
12826         XINERAMALIB="$x_libraries"
12827     fi
12828     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
12829         # we have both versions, let the user decide but use the dynamic one
12830         # per default
12831         USE_XINERAMA=TRUE
12832         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
12833             XINERAMA_LINK=dynamic
12834         else
12835             XINERAMA_LINK=static
12836         fi
12837     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
12838         # we have only the dynamic version
12839         USE_XINERAMA=TRUE
12840         XINERAMA_LINK=dynamic
12841     elif test -e "$XINERAMALIB/libXinerama.a"; then
12842         # static version
12843         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
12844             USE_XINERAMA=TRUE
12845             XINERAMA_LINK=static
12846         else
12847             USE_XINERAMA=
12848             XINERAMA_LINK=none
12849         fi
12850     else
12851         # no Xinerama
12852         USE_XINERAMA=
12853         XINERAMA_LINK=none
12854     fi
12855     if test "$USE_XINERAMA" = "TRUE"; then
12856         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
12857         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
12858             [AC_MSG_ERROR(Xinerama header not found.)], [])
12859         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
12860         if test "x$XEXTLIB" = x; then
12861            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
12862         fi
12863         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
12864         if test "$_os" = "FreeBSD"; then
12865             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
12866         fi
12867         if test "$_os" = "Linux"; then
12868             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
12869         fi
12870         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
12871             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
12872     else
12873         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
12874     fi
12875 else
12876     USE_XINERAMA=
12877     XINERAMA_LINK=none
12878     AC_MSG_RESULT([no])
12880 AC_SUBST(USE_XINERAMA)
12881 AC_SUBST(XINERAMA_LINK)
12883 dnl ===================================================================
12884 dnl Test whether to build cairo or rely on the system version
12885 dnl ===================================================================
12887 if test "$USING_X11" = TRUE; then
12888     # Used in vcl/Library_vclplug_gen.mk
12889     test_cairo=yes
12892 if test "$test_cairo" = "yes"; then
12893     AC_MSG_CHECKING([whether to use the system cairo])
12895     : ${with_system_cairo:=$with_system_libs}
12896     if test "$with_system_cairo" = "yes"; then
12897         SYSTEM_CAIRO=TRUE
12898         AC_MSG_RESULT([yes])
12900         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
12901         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12902         FilterLibs "${CAIRO_LIBS}"
12903         CAIRO_LIBS="${filteredlibs}"
12905         if test "$test_xrender" = "yes"; then
12906             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
12907             AC_LANG_PUSH([C])
12908             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
12909 #ifdef PictStandardA8
12910 #else
12911       return fail;
12912 #endif
12913 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
12915             AC_LANG_POP([C])
12916         fi
12917     else
12918         SYSTEM_CAIRO=
12919         AC_MSG_RESULT([no])
12921         BUILD_TYPE="$BUILD_TYPE CAIRO"
12922     fi
12925 AC_SUBST(SYSTEM_CAIRO)
12926 AC_SUBST(CAIRO_CFLAGS)
12927 AC_SUBST(CAIRO_LIBS)
12929 dnl ===================================================================
12930 dnl Test whether to use avahi
12931 dnl ===================================================================
12932 if test "$_os" = "WINNT"; then
12933     # Windows uses bundled mDNSResponder
12934     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
12935 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
12936     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
12937                       [ENABLE_AVAHI="TRUE"])
12938     AC_DEFINE(HAVE_FEATURE_AVAHI)
12939     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12940     FilterLibs "${AVAHI_LIBS}"
12941     AVAHI_LIBS="${filteredlibs}"
12944 AC_SUBST(ENABLE_AVAHI)
12945 AC_SUBST(AVAHI_CFLAGS)
12946 AC_SUBST(AVAHI_LIBS)
12948 dnl ===================================================================
12949 dnl Test whether to use liblangtag
12950 dnl ===================================================================
12951 SYSTEM_LIBLANGTAG=
12952 AC_MSG_CHECKING([whether to use system liblangtag])
12953 if test "$with_system_liblangtag" = yes; then
12954     SYSTEM_LIBLANGTAG=TRUE
12955     AC_MSG_RESULT([yes])
12956     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
12957     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
12958     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
12959     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
12960     FilterLibs "${LIBLANGTAG_LIBS}"
12961     LIBLANGTAG_LIBS="${filteredlibs}"
12962 else
12963     SYSTEM_LIBLANGTAG=
12964     AC_MSG_RESULT([no])
12965     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
12966     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
12967     if test "$COM" = "MSC"; then
12968         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
12969     else
12970         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
12971     fi
12973 AC_SUBST(SYSTEM_LIBLANGTAG)
12974 AC_SUBST(LIBLANGTAG_CFLAGS)
12975 AC_SUBST(LIBLANGTAG_LIBS)
12977 dnl ===================================================================
12978 dnl Test whether to build libpng or rely on the system version
12979 dnl ===================================================================
12981 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
12983 dnl ===================================================================
12984 dnl Check for runtime JVM search path
12985 dnl ===================================================================
12986 if test "$ENABLE_JAVA" != ""; then
12987     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
12988     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
12989         AC_MSG_RESULT([yes])
12990         if ! test -d "$with_jvm_path"; then
12991             AC_MSG_ERROR(["$with_jvm_path" not a directory])
12992         fi
12993         if ! test -d "$with_jvm_path"jvm; then
12994             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
12995         fi
12996         JVM_ONE_PATH_CHECK="$with_jvm_path"
12997         AC_SUBST(JVM_ONE_PATH_CHECK)
12998     else
12999         AC_MSG_RESULT([no])
13000     fi
13003 dnl ===================================================================
13004 dnl Test for the presence of Ant and that it works
13005 dnl ===================================================================
13007 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE" -a "$cross_compiling" != "yes"; then
13008     ANT_HOME=; export ANT_HOME
13009     WITH_ANT_HOME=; export WITH_ANT_HOME
13010     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
13011         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
13012             if test "$_os" = "WINNT"; then
13013                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
13014             else
13015                 with_ant_home="$LODE_HOME/opt/ant"
13016             fi
13017         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
13018             with_ant_home="$LODE_HOME/opt/ant"
13019         fi
13020     fi
13021     if test -z "$with_ant_home"; then
13022         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
13023     else
13024         if test "$_os" = "WINNT"; then
13025             # AC_PATH_PROGS needs unix path
13026             with_ant_home=`cygpath -u "$with_ant_home"`
13027         fi
13028         AbsolutePath "$with_ant_home"
13029         with_ant_home=$absolute_path
13030         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
13031         WITH_ANT_HOME=$with_ant_home
13032         ANT_HOME=$with_ant_home
13033     fi
13035     if test -z "$ANT"; then
13036         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
13037     else
13038         # resolve relative or absolute symlink
13039         while test -h "$ANT"; do
13040             a_cwd=`pwd`
13041             a_basename=`basename "$ANT"`
13042             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
13043             cd "`dirname "$ANT"`"
13044             cd "`dirname "$a_script"`"
13045             ANT="`pwd`"/"`basename "$a_script"`"
13046             cd "$a_cwd"
13047         done
13049         AC_MSG_CHECKING([if $ANT works])
13050         mkdir -p conftest.dir
13051         a_cwd=$(pwd)
13052         cd conftest.dir
13053         cat > conftest.java << EOF
13054         public class conftest {
13055             int testmethod(int a, int b) {
13056                     return a + b;
13057             }
13058         }
13061         cat > conftest.xml << EOF
13062         <project name="conftest" default="conftest">
13063         <target name="conftest">
13064             <javac srcdir="." includes="conftest.java">
13065             </javac>
13066         </target>
13067         </project>
13070         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
13071         if test $? = 0 -a -f ./conftest.class; then
13072             AC_MSG_RESULT([Ant works])
13073             if test -z "$WITH_ANT_HOME"; then
13074                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
13075                 if test -z "$ANT_HOME"; then
13076                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
13077                 fi
13078             else
13079                 ANT_HOME="$WITH_ANT_HOME"
13080             fi
13081         else
13082             echo "configure: Ant test failed" >&5
13083             cat conftest.java >&5
13084             cat conftest.xml >&5
13085             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
13086         fi
13087         cd "$a_cwd"
13088         rm -fr conftest.dir
13089     fi
13090     if test -z "$ANT_HOME"; then
13091         ANT_HOME="NO_ANT_HOME"
13092     else
13093         PathFormat "$ANT_HOME"
13094         ANT_HOME="$formatted_path"
13095         PathFormat "$ANT"
13096         ANT="$formatted_path"
13097     fi
13099     dnl Checking for ant.jar
13100     if test "$ANT_HOME" != "NO_ANT_HOME"; then
13101         AC_MSG_CHECKING([Ant lib directory])
13102         if test -f $ANT_HOME/lib/ant.jar; then
13103             ANT_LIB="$ANT_HOME/lib"
13104         else
13105             if test -f $ANT_HOME/ant.jar; then
13106                 ANT_LIB="$ANT_HOME"
13107             else
13108                 if test -f /usr/share/java/ant.jar; then
13109                     ANT_LIB=/usr/share/java
13110                 else
13111                     if test -f /usr/share/ant-core/lib/ant.jar; then
13112                         ANT_LIB=/usr/share/ant-core/lib
13113                     else
13114                         if test -f $ANT_HOME/lib/ant/ant.jar; then
13115                             ANT_LIB="$ANT_HOME/lib/ant"
13116                         else
13117                             if test -f /usr/share/lib/ant/ant.jar; then
13118                                 ANT_LIB=/usr/share/lib/ant
13119                             else
13120                                 AC_MSG_ERROR([Ant libraries not found!])
13121                             fi
13122                         fi
13123                     fi
13124                 fi
13125             fi
13126         fi
13127         PathFormat "$ANT_LIB"
13128         ANT_LIB="$formatted_path"
13129         AC_MSG_RESULT([Ant lib directory found.])
13130     fi
13132     ant_minver=1.6.0
13133     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
13135     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
13136     ant_version=`"$ANT" -version | $AWK '$3 == "version" { print $4; }'`
13137     ant_version_major=`echo $ant_version | cut -d. -f1`
13138     ant_version_minor=`echo $ant_version | cut -d. -f2`
13139     echo "configure: ant_version $ant_version " >&5
13140     echo "configure: ant_version_major $ant_version_major " >&5
13141     echo "configure: ant_version_minor $ant_version_minor " >&5
13142     if test "$ant_version_major" -ge "2"; then
13143         AC_MSG_RESULT([yes, $ant_version])
13144     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
13145         AC_MSG_RESULT([yes, $ant_version])
13146     else
13147         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
13148     fi
13150     rm -f conftest* core core.* *.core
13152 AC_SUBST(ANT)
13153 AC_SUBST(ANT_HOME)
13154 AC_SUBST(ANT_LIB)
13156 OOO_JUNIT_JAR=
13157 HAMCREST_JAR=
13158 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no" -a "$cross_compiling" != "yes"; then
13159     AC_MSG_CHECKING([for JUnit 4])
13160     if test "$with_junit" = "yes"; then
13161         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
13162             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
13163         elif test -e /usr/share/java/junit4.jar; then
13164             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
13165         else
13166            if test -e /usr/share/lib/java/junit.jar; then
13167               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
13168            else
13169               OOO_JUNIT_JAR=/usr/share/java/junit.jar
13170            fi
13171         fi
13172     else
13173         OOO_JUNIT_JAR=$with_junit
13174     fi
13175     if test "$_os" = "WINNT"; then
13176         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
13177     fi
13178     printf 'import org.junit.Before;' > conftest.java
13179     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
13180         AC_MSG_RESULT([$OOO_JUNIT_JAR])
13181     else
13182         AC_MSG_ERROR(
13183 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
13184  specify its pathname via --with-junit=..., or disable it via --without-junit])
13185     fi
13186     rm -f conftest.class conftest.java
13187     if test $OOO_JUNIT_JAR != ""; then
13188         BUILD_TYPE="$BUILD_TYPE QADEVOOO"
13189     fi
13191     AC_MSG_CHECKING([for included Hamcrest])
13192     printf 'import org.hamcrest.BaseDescription;' > conftest.java
13193     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
13194         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
13195     else
13196         AC_MSG_RESULT([Not included])
13197         AC_MSG_CHECKING([for standalone hamcrest jar.])
13198         if test "$with_hamcrest" = "yes"; then
13199             if test -e /usr/share/lib/java/hamcrest.jar; then
13200                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
13201             elif test -e /usr/share/java/hamcrest/core.jar; then
13202                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
13203             else
13204                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
13205             fi
13206         else
13207             HAMCREST_JAR=$with_hamcrest
13208         fi
13209         if test "$_os" = "WINNT"; then
13210             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
13211         fi
13212         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
13213             AC_MSG_RESULT([$HAMCREST_JAR])
13214         else
13215             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),
13216                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
13217         fi
13218     fi
13219     rm -f conftest.class conftest.java
13221 AC_SUBST(OOO_JUNIT_JAR)
13222 AC_SUBST(HAMCREST_JAR)
13225 AC_SUBST(SCPDEFS)
13228 # check for wget and curl
13230 WGET=
13231 CURL=
13233 if test "$enable_fetch_external" != "no"; then
13235 CURL=`which curl 2>/dev/null`
13237 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
13238     # wget new enough?
13239     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
13240     if test $? -eq 0; then
13241         WGET=$i
13242         break
13243     fi
13244 done
13246 if test -z "$WGET" -a -z "$CURL"; then
13247     AC_MSG_ERROR([neither wget nor curl found!])
13252 AC_SUBST(WGET)
13253 AC_SUBST(CURL)
13256 # check for sha256sum
13258 SHA256SUM=
13260 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
13261     eval "$i -a 256 --version" > /dev/null 2>&1
13262     ret=$?
13263     if test $ret -eq 0; then
13264         SHA256SUM="$i -a 256"
13265         break
13266     fi
13267 done
13269 if test -z "$SHA256SUM"; then
13270     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
13271         eval "$i --version" > /dev/null 2>&1
13272         ret=$?
13273         if test $ret -eq 0; then
13274             SHA256SUM=$i
13275             break
13276         fi
13277     done
13280 if test -z "$SHA256SUM"; then
13281     AC_MSG_ERROR([no sha256sum found!])
13284 AC_SUBST(SHA256SUM)
13286 dnl ===================================================================
13287 dnl Dealing with l10n options
13288 dnl ===================================================================
13289 AC_MSG_CHECKING([which languages to be built])
13290 # get list of all languages
13291 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
13292 # the sed command does the following:
13293 #   + if a line ends with a backslash, append the next line to it
13294 #   + adds " on the beginning of the value (after =)
13295 #   + adds " at the end of the value
13296 #   + removes en-US; we want to put it on the beginning
13297 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
13298 [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)]
13299 ALL_LANGS="en-US $completelangiso"
13300 # check the configured localizations
13301 WITH_LANG="$with_lang"
13303 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
13304 # (Norwegian is "nb" and "nn".)
13305 if test "$WITH_LANG" = "no"; then
13306     WITH_LANG=
13309 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
13310     AC_MSG_RESULT([en-US])
13311 else
13312     AC_MSG_RESULT([$WITH_LANG])
13313     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
13314     if test -z "$MSGFMT"; then
13315         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
13316             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
13317         elif test -x "/opt/lo/bin/msgfmt"; then
13318             MSGFMT="/opt/lo/bin/msgfmt"
13319         else
13320             AC_CHECK_PROGS(MSGFMT, [msgfmt])
13321             if test -z "$MSGFMT"; then
13322                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
13323             fi
13324         fi
13325     fi
13326     if test -z "$MSGUNIQ"; then
13327         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
13328             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
13329         elif test -x "/opt/lo/bin/msguniq"; then
13330             MSGUNIQ="/opt/lo/bin/msguniq"
13331         else
13332             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
13333             if test -z "$MSGUNIQ"; then
13334                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
13335             fi
13336         fi
13337     fi
13339 AC_SUBST(MSGFMT)
13340 AC_SUBST(MSGUNIQ)
13341 # check that the list is valid
13342 for lang in $WITH_LANG; do
13343     test "$lang" = "ALL" && continue
13344     # need to check for the exact string, so add space before and after the list of all languages
13345     for vl in $ALL_LANGS; do
13346         if test "$vl" = "$lang"; then
13347            break
13348         fi
13349     done
13350     if test "$vl" != "$lang"; then
13351         # if you're reading this - you prolly quoted your languages remove the quotes ...
13352         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
13353     fi
13354 done
13355 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
13356     echo $WITH_LANG | grep -q en-US
13357     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
13359 # list with substituted ALL
13360 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
13361 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
13362 test "$WITH_LANG" = "en-US" && WITH_LANG=
13363 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
13364     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
13365     ALL_LANGS=`echo $ALL_LANGS qtz`
13367 AC_SUBST(ALL_LANGS)
13368 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
13369 AC_SUBST(WITH_LANG)
13370 AC_SUBST(WITH_LANG_LIST)
13371 AC_SUBST(GIT_NEEDED_SUBMODULES)
13373 WITH_POOR_HELP_LOCALIZATIONS=
13374 if test -d "$SRC_ROOT/translations/source"; then
13375     for l in `ls -1 $SRC_ROOT/translations/source`; do
13376         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
13377             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
13378         fi
13379     done
13381 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
13383 if test -n "$with_locales"; then
13384     WITH_LOCALES="$with_locales"
13386     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
13387     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
13388     # config_host/config_locales.h.in
13389     for locale in $WITH_LOCALES; do
13390         lang=${locale%_*}
13392         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
13394         case $lang in
13395         hi|mr*ne)
13396             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
13397             ;;
13398         bg|ru)
13399             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
13400             ;;
13401         esac
13402     done
13403 else
13404     AC_DEFINE(WITH_LOCALE_ALL)
13406 AC_SUBST(WITH_LOCALES)
13408 dnl git submodule update --reference
13409 dnl ===================================================================
13410 if test -n "${GIT_REFERENCE_SRC}"; then
13411     for repo in ${GIT_NEEDED_SUBMODULES}; do
13412         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
13413             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
13414         fi
13415     done
13417 AC_SUBST(GIT_REFERENCE_SRC)
13419 dnl git submodules linked dirs
13420 dnl ===================================================================
13421 if test -n "${GIT_LINK_SRC}"; then
13422     for repo in ${GIT_NEEDED_SUBMODULES}; do
13423         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
13424             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
13425         fi
13426     done
13428 AC_SUBST(GIT_LINK_SRC)
13430 dnl branding
13431 dnl ===================================================================
13432 AC_MSG_CHECKING([for alternative branding images directory])
13433 # initialize mapped arrays
13434 BRAND_INTRO_IMAGES="intro.png intro-highres.png"
13435 brand_files="$BRAND_INTRO_IMAGES logo.svg logo_inverted.svg logo-sc.svg logo-sc_inverted.svg about.svg"
13437 if test -z "$with_branding" -o "$with_branding" = "no"; then
13438     AC_MSG_RESULT([none])
13439     DEFAULT_BRAND_IMAGES="$brand_files"
13440 else
13441     if ! test -d $with_branding ; then
13442         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
13443     else
13444         AC_MSG_RESULT([$with_branding])
13445         CUSTOM_BRAND_DIR="$with_branding"
13446         for lfile in $brand_files
13447         do
13448             if ! test -f $with_branding/$lfile ; then
13449                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
13450                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
13451             else
13452                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
13453             fi
13454         done
13455         check_for_progress="yes"
13456     fi
13458 AC_SUBST([BRAND_INTRO_IMAGES])
13459 AC_SUBST([CUSTOM_BRAND_DIR])
13460 AC_SUBST([CUSTOM_BRAND_IMAGES])
13461 AC_SUBST([DEFAULT_BRAND_IMAGES])
13464 AC_MSG_CHECKING([for 'intro' progress settings])
13465 PROGRESSBARCOLOR=
13466 PROGRESSSIZE=
13467 PROGRESSPOSITION=
13468 PROGRESSFRAMECOLOR=
13469 PROGRESSTEXTCOLOR=
13470 PROGRESSTEXTBASELINE=
13472 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
13473     source "$with_branding/progress.conf"
13474     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
13475 else
13476     AC_MSG_RESULT([none])
13479 AC_SUBST(PROGRESSBARCOLOR)
13480 AC_SUBST(PROGRESSSIZE)
13481 AC_SUBST(PROGRESSPOSITION)
13482 AC_SUBST(PROGRESSFRAMECOLOR)
13483 AC_SUBST(PROGRESSTEXTCOLOR)
13484 AC_SUBST(PROGRESSTEXTBASELINE)
13487 dnl ===================================================================
13488 dnl Custom build version
13489 dnl ===================================================================
13490 AC_MSG_CHECKING([for extra build ID])
13491 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
13492     EXTRA_BUILDID="$with_extra_buildid"
13494 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
13495 if test -n "$EXTRA_BUILDID" ; then
13496     AC_MSG_RESULT([$EXTRA_BUILDID])
13497 else
13498     AC_MSG_RESULT([not set])
13500 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
13502 OOO_VENDOR=
13503 AC_MSG_CHECKING([for vendor])
13504 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
13505     OOO_VENDOR="$USERNAME"
13507     if test -z "$OOO_VENDOR"; then
13508         OOO_VENDOR="$USER"
13509     fi
13511     if test -z "$OOO_VENDOR"; then
13512         OOO_VENDOR="`id -u -n`"
13513     fi
13515     AC_MSG_RESULT([not set, using $OOO_VENDOR])
13516 else
13517     OOO_VENDOR="$with_vendor"
13518     AC_MSG_RESULT([$OOO_VENDOR])
13520 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
13521 AC_SUBST(OOO_VENDOR)
13523 if test "$_os" = "Android" ; then
13524     ANDROID_PACKAGE_NAME=
13525     AC_MSG_CHECKING([for Android package name])
13526     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
13527         if test -n "$ENABLE_DEBUG"; then
13528             # Default to the package name that makes ndk-gdb happy.
13529             ANDROID_PACKAGE_NAME="org.libreoffice"
13530         else
13531             ANDROID_PACKAGE_NAME="org.example.libreoffice"
13532         fi
13534         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
13535     else
13536         ANDROID_PACKAGE_NAME="$with_android_package_name"
13537         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
13538     fi
13539     AC_SUBST(ANDROID_PACKAGE_NAME)
13542 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
13543 if test "$with_compat_oowrappers" = "yes"; then
13544     WITH_COMPAT_OOWRAPPERS=TRUE
13545     AC_MSG_RESULT(yes)
13546 else
13547     WITH_COMPAT_OOWRAPPERS=
13548     AC_MSG_RESULT(no)
13550 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
13552 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
13553 AC_MSG_CHECKING([for install dirname])
13554 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
13555     INSTALLDIRNAME="$with_install_dirname"
13557 AC_MSG_RESULT([$INSTALLDIRNAME])
13558 AC_SUBST(INSTALLDIRNAME)
13560 AC_MSG_CHECKING([for prefix])
13561 test "x$prefix" = xNONE && prefix=$ac_default_prefix
13562 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
13563 PREFIXDIR="$prefix"
13564 AC_MSG_RESULT([$PREFIXDIR])
13565 AC_SUBST(PREFIXDIR)
13567 LIBDIR=[$(eval echo $(eval echo $libdir))]
13568 AC_SUBST(LIBDIR)
13570 DATADIR=[$(eval echo $(eval echo $datadir))]
13571 AC_SUBST(DATADIR)
13573 MANDIR=[$(eval echo $(eval echo $mandir))]
13574 AC_SUBST(MANDIR)
13576 DOCDIR=[$(eval echo $(eval echo $docdir))]
13577 AC_SUBST(DOCDIR)
13579 BINDIR=[$(eval echo $(eval echo $bindir))]
13580 AC_SUBST(BINDIR)
13582 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
13583 AC_SUBST(INSTALLDIR)
13585 TESTINSTALLDIR="${BUILDDIR}/test-install"
13586 AC_SUBST(TESTINSTALLDIR)
13589 # ===================================================================
13590 # OAuth2 id and secrets
13591 # ===================================================================
13593 AC_MSG_CHECKING([for Google Drive client id and secret])
13594 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
13595     AC_MSG_RESULT([not set])
13596     GDRIVE_CLIENT_ID="\"\""
13597     GDRIVE_CLIENT_SECRET="\"\""
13598 else
13599     AC_MSG_RESULT([set])
13600     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
13601     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
13603 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
13604 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
13606 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
13607 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
13608     AC_MSG_RESULT([not set])
13609     ALFRESCO_CLOUD_CLIENT_ID="\"\""
13610     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
13611 else
13612     AC_MSG_RESULT([set])
13613     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
13614     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
13616 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
13617 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
13619 AC_MSG_CHECKING([for OneDrive client id and secret])
13620 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
13621     AC_MSG_RESULT([not set])
13622     ONEDRIVE_CLIENT_ID="\"\""
13623     ONEDRIVE_CLIENT_SECRET="\"\""
13624 else
13625     AC_MSG_RESULT([set])
13626     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
13627     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
13629 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
13630 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
13633 dnl ===================================================================
13634 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
13635 dnl --enable-dependency-tracking configure option
13636 dnl ===================================================================
13637 AC_MSG_CHECKING([whether to enable dependency tracking])
13638 if test "$enable_dependency_tracking" = "no"; then
13639     nodep=TRUE
13640     AC_MSG_RESULT([no])
13641 else
13642     AC_MSG_RESULT([yes])
13644 AC_SUBST(nodep)
13646 dnl ===================================================================
13647 dnl Number of CPUs to use during the build
13648 dnl ===================================================================
13649 AC_MSG_CHECKING([for number of processors to use])
13650 # plain --with-parallelism is just the default
13651 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
13652     if test "$with_parallelism" = "no"; then
13653         PARALLELISM=0
13654     else
13655         PARALLELISM=$with_parallelism
13656     fi
13657 else
13658     if test "$enable_icecream" = "yes"; then
13659         PARALLELISM="40"
13660     else
13661         case `uname -s` in
13663         Darwin|FreeBSD|NetBSD|OpenBSD)
13664             PARALLELISM=`sysctl -n hw.ncpu`
13665             ;;
13667         Linux)
13668             PARALLELISM=`getconf _NPROCESSORS_ONLN`
13669         ;;
13670         # what else than above does profit here *and* has /proc?
13671         *)
13672             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
13673             ;;
13674         esac
13676         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
13677         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
13678     fi
13681 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
13682     if test -z "$with_parallelism"; then
13683             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
13684             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
13685             PARALLELISM="1"
13686     else
13687         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."
13688     fi
13691 if test $PARALLELISM -eq 0; then
13692     AC_MSG_RESULT([explicit make -j option needed])
13693 else
13694     AC_MSG_RESULT([$PARALLELISM])
13696 AC_SUBST(PARALLELISM)
13698 IWYU_PATH="$with_iwyu"
13699 AC_SUBST(IWYU_PATH)
13700 if test ! -z "$IWYU_PATH"; then
13701     if test ! -f "$IWYU_PATH"; then
13702         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
13703     fi
13707 # Set up ILIB for MSVC build
13709 ILIB1=
13710 if test "$build_os" = "cygwin"; then
13711     ILIB="."
13712     if test -n "$JAVA_HOME"; then
13713         ILIB="$ILIB;$JAVA_HOME/lib"
13714     fi
13715     ILIB1=-link
13716     ILIB="$ILIB;$COMPATH/lib/$WIN_HOST_ARCH"
13717     ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/$WIN_HOST_ARCH"
13718     ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
13719     ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$WIN_HOST_ARCH"
13720     if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
13721         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
13722         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_HOST_ARCH"
13723     fi
13724     PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/$WIN_HOST_ARCH"
13725     ucrtlibpath_formatted=$formatted_path
13726     ILIB="$ILIB;$ucrtlibpath_formatted"
13727     ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
13728     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
13729         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
13730     else
13731         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WIN_HOST_ARCH"
13732     fi
13734     if test "$cross_compiling" != "yes"; then
13735         ILIB_FOR_BUILD="$ILIB"
13736     fi
13738 AC_SUBST(ILIB)
13739 AC_SUBST(ILIB_FOR_BUILD)
13741 # ===================================================================
13742 # Creating bigger shared library to link against
13743 # ===================================================================
13744 AC_MSG_CHECKING([whether to create huge library])
13745 MERGELIBS=
13747 if test $_os = iOS -o $_os = Android; then
13748     # Never any point in mergelibs for these as we build just static
13749     # libraries anyway...
13750     enable_mergelibs=no
13753 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
13754     if test $_os != Linux -a $_os != WINNT; then
13755         add_warning "--enable-mergelibs is not tested for this platform"
13756     fi
13757     MERGELIBS="TRUE"
13758     AC_MSG_RESULT([yes])
13759     AC_DEFINE(ENABLE_MERGELIBS)
13760 else
13761     AC_MSG_RESULT([no])
13763 AC_SUBST([MERGELIBS])
13765 dnl ===================================================================
13766 dnl icerun is a wrapper that stops us spawning tens of processes
13767 dnl locally - for tools that can't be executed on the compile cluster
13768 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
13769 dnl ===================================================================
13770 AC_MSG_CHECKING([whether to use icerun wrapper])
13771 ICECREAM_RUN=
13772 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
13773     ICECREAM_RUN=icerun
13774     AC_MSG_RESULT([yes])
13775 else
13776     AC_MSG_RESULT([no])
13778 AC_SUBST(ICECREAM_RUN)
13780 dnl ===================================================================
13781 dnl Setup the ICECC_VERSION for the build the same way it was set for
13782 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
13783 dnl ===================================================================
13784 x_ICECC_VERSION=[\#]
13785 if test -n "$ICECC_VERSION" ; then
13786     x_ICECC_VERSION=
13788 AC_SUBST(x_ICECC_VERSION)
13789 AC_SUBST(ICECC_VERSION)
13791 dnl ===================================================================
13793 AC_MSG_CHECKING([MPL subset])
13794 MPL_SUBSET=
13796 if test "$enable_mpl_subset" = "yes"; then
13797     warn_report=false
13798     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
13799         warn_report=true
13800     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
13801         warn_report=true
13802     fi
13803     if test "$warn_report" = "true"; then
13804         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
13805     fi
13806     if test "x$enable_postgresql_sdbc" != "xno"; then
13807         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
13808     fi
13809     if test "$enable_lotuswordpro" = "yes"; then
13810         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
13811     fi
13812     if test "$WITH_WEBDAV" = "neon"; then
13813         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
13814     fi
13815     if test -n "$ENABLE_POPPLER"; then
13816         if test "x$SYSTEM_POPPLER" = "x"; then
13817             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
13818         fi
13819     fi
13820     # cf. m4/libo_check_extension.m4
13821     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
13822         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
13823     fi
13824     for theme in $WITH_THEMES; do
13825         case $theme in
13826         breeze|breeze_dark|breeze_dark_svg|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #denylist of icon themes under GPL or LGPL
13827             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=colibre]) ;;
13828         *) : ;;
13829         esac
13830     done
13832     ENABLE_OPENGL_TRANSITIONS=
13834     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
13835         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
13836     fi
13838     MPL_SUBSET="TRUE"
13839     AC_DEFINE(MPL_HAVE_SUBSET)
13840     AC_MSG_RESULT([only])
13841 else
13842     AC_MSG_RESULT([no restrictions])
13844 AC_SUBST(MPL_SUBSET)
13846 dnl ===================================================================
13848 AC_MSG_CHECKING([formula logger])
13849 ENABLE_FORMULA_LOGGER=
13851 if test "x$enable_formula_logger" = "xyes"; then
13852     AC_MSG_RESULT([yes])
13853     AC_DEFINE(ENABLE_FORMULA_LOGGER)
13854     ENABLE_FORMULA_LOGGER=TRUE
13855 elif test -n "$ENABLE_DBGUTIL" ; then
13856     AC_MSG_RESULT([yes])
13857     AC_DEFINE(ENABLE_FORMULA_LOGGER)
13858     ENABLE_FORMULA_LOGGER=TRUE
13859 else
13860     AC_MSG_RESULT([no])
13863 AC_SUBST(ENABLE_FORMULA_LOGGER)
13865 dnl ===================================================================
13866 dnl Checking for active Antivirus software.
13867 dnl ===================================================================
13869 if test $_os = WINNT -a -f "$SRC_ROOT/antivirusDetection.vbs" ; then
13870     AC_MSG_CHECKING([for active Antivirus software])
13871     ANTIVIRUS_LIST=`cscript.exe //Nologo $SRC_ROOT/antivirusDetection.vbs`
13872     if [ [ "$ANTIVIRUS_LIST" != "NULL" ] ]; then
13873         if [ [ "$ANTIVIRUS_LIST" != "NOT_FOUND" ] ]; then
13874             AC_MSG_RESULT([found])
13875             EICAR_STRING='X5O!P%@AP@<:@4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'
13876             echo $EICAR_STRING > $SRC_ROOT/eicar
13877             EICAR_TEMP_FILE_CONTENTS=`cat $SRC_ROOT/eicar`
13878             rm $SRC_ROOT/eicar
13879             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
13880                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
13881             fi
13882             echo $EICAR_STRING > $BUILDDIR/eicar
13883             EICAR_TEMP_FILE_CONTENTS=`cat $BUILDDIR/eicar`
13884             rm $BUILDDIR/eicar
13885             if [ [ "$EICAR_STRING" != "$EICAR_TEMP_FILE_CONTENTS" ] ]; then
13886                 AC_MSG_ERROR([Exclude the build and source directories associated with LibreOffice in the following Antivirus software: $ANTIVIRUS_LIST])
13887             fi
13888             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"
13889         else
13890             AC_MSG_RESULT([not found])
13891         fi
13892     else
13893         AC_MSG_RESULT([n/a])
13894     fi
13897 dnl ===================================================================
13898 dnl Setting up the environment.
13899 dnl ===================================================================
13900 AC_MSG_NOTICE([setting up the build environment variables...])
13902 AC_SUBST(COMPATH)
13904 if test "$build_os" = "cygwin"; then
13905     if test -d "$COMPATH/atlmfc/lib/spectre"; then
13906         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
13907         ATL_INCLUDE="$COMPATH/atlmfc/include"
13908     elif test -d "$COMPATH/atlmfc/lib"; then
13909         ATL_LIB="$COMPATH/atlmfc/lib"
13910         ATL_INCLUDE="$COMPATH/atlmfc/include"
13911     else
13912         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
13913         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
13914     fi
13915     ATL_LIB="$ATL_LIB/$WIN_HOST_ARCH"
13916     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
13917     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
13919     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
13920     PathFormat "/usr/bin/find.exe"
13921     FIND="$formatted_path"
13922     PathFormat "/usr/bin/sort.exe"
13923     SORT="$formatted_path"
13924     PathFormat "/usr/bin/grep.exe"
13925     WIN_GREP="$formatted_path"
13926     PathFormat "/usr/bin/ls.exe"
13927     WIN_LS="$formatted_path"
13928     PathFormat "/usr/bin/touch.exe"
13929     WIN_TOUCH="$formatted_path"
13930 else
13931     FIND=find
13932     SORT=sort
13935 AC_SUBST(ATL_INCLUDE)
13936 AC_SUBST(ATL_LIB)
13937 AC_SUBST(FIND)
13938 AC_SUBST(SORT)
13939 AC_SUBST(WIN_GREP)
13940 AC_SUBST(WIN_LS)
13941 AC_SUBST(WIN_TOUCH)
13943 AC_SUBST(BUILD_TYPE)
13945 AC_SUBST(SOLARINC)
13947 PathFormat "$PERL"
13948 PERL="$formatted_path"
13949 AC_SUBST(PERL)
13951 if test -n "$TMPDIR"; then
13952     TEMP_DIRECTORY="$TMPDIR"
13953 else
13954     TEMP_DIRECTORY="/tmp"
13956 if test "$build_os" = "cygwin"; then
13957     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
13959 AC_SUBST(TEMP_DIRECTORY)
13961 # setup the PATH for the environment
13962 if test -n "$LO_PATH_FOR_BUILD"; then
13963     LO_PATH="$LO_PATH_FOR_BUILD"
13964     case "$host_os" in
13965     cygwin*|wsl*)
13966         pathmunge "$MSVC_HOST_PATH" "before"
13967         ;;
13968     esac
13969 else
13970     LO_PATH="$PATH"
13972     case "$host_os" in
13974     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
13975         if test "$ENABLE_JAVA" != ""; then
13976             pathmunge "$JAVA_HOME/bin" "after"
13977         fi
13978         ;;
13980     cygwin*|wsl*)
13981         # Win32 make needs native paths
13982         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
13983             LO_PATH=`cygpath -p -m "$PATH"`
13984         fi
13985         if test "$WIN_BUILD_ARCH" = "x64"; then
13986             # needed for msi packaging
13987             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
13988         fi
13989         # .NET 4.6 and higher don't have bin directory
13990         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
13991             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
13992         fi
13993         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
13994         pathmunge "$CSC_PATH" "before"
13995         pathmunge "$MIDL_PATH" "before"
13996         pathmunge "$AL_PATH" "before"
13997         pathmunge "$MSVC_MULTI_PATH" "before"
13998         pathmunge "$MSVC_BUILD_PATH" "before"
13999         if test -n "$MSBUILD_PATH" ; then
14000             pathmunge "$MSBUILD_PATH" "before"
14001         fi
14002         pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/$WIN_BUILD_ARCH" "before"
14003         if test "$ENABLE_JAVA" != ""; then
14004             if test -d "$JAVA_HOME/jre/bin/client"; then
14005                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
14006             fi
14007             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
14008                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
14009             fi
14010             pathmunge "$JAVA_HOME/bin" "before"
14011         fi
14012         pathmunge "$MSVC_HOST_PATH" "before"
14013         ;;
14015     solaris*)
14016         pathmunge "/usr/css/bin" "before"
14017         if test "$ENABLE_JAVA" != ""; then
14018             pathmunge "$JAVA_HOME/bin" "after"
14019         fi
14020         ;;
14021     esac
14024 AC_SUBST(LO_PATH)
14026 # Allow to pass LO_ELFCHECK_ALLOWLIST from autogen.input to bin/check-elf-dynamic-objects:
14027 if test "$LO_ELFCHECK_ALLOWLIST" = x || test "${LO_ELFCHECK_ALLOWLIST-x}" != x; then
14028     x_LO_ELFCHECK_ALLOWLIST=
14029 else
14030     x_LO_ELFCHECK_ALLOWLIST=[\#]
14032 AC_SUBST(x_LO_ELFCHECK_ALLOWLIST)
14033 AC_SUBST(LO_ELFCHECK_ALLOWLIST)
14035 libo_FUZZ_SUMMARY
14037 # Generate a configuration sha256 we can use for deps
14038 if test -f config_host.mk; then
14039     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
14041 if test -f config_host_lang.mk; then
14042     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
14045 CFLAGS=$my_original_CFLAGS
14046 CXXFLAGS=$my_original_CXXFLAGS
14047 CPPFLAGS=$my_original_CPPFLAGS
14049 AC_CONFIG_LINKS([include:include])
14051 # Keep in sync with list of files far up, at AC_MSG_CHECKING([for
14052 # BUILD platform configuration] - otherwise breaks cross building
14053 AC_CONFIG_FILES([config_host.mk
14054                  config_host_lang.mk
14055                  Makefile
14056                  bin/bffvalidator.sh
14057                  bin/odfvalidator.sh
14058                  bin/officeotron.sh
14059                  hardened_runtime.xcent
14060                  instsetoo_native/util/openoffice.lst
14061                  sysui/desktop/macosx/Info.plist
14062                  vs-code-template.code-workspace:.vscode/vs-code-template.code-workspace.in])
14063 AC_CONFIG_HEADERS([config_host/config_buildid.h])
14064 AC_CONFIG_HEADERS([config_host/config_box2d.h])
14065 AC_CONFIG_HEADERS([config_host/config_clang.h])
14066 AC_CONFIG_HEADERS([config_host/config_dconf.h])
14067 AC_CONFIG_HEADERS([config_host/config_eot.h])
14068 AC_CONFIG_HEADERS([config_host/config_extensions.h])
14069 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
14070 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
14071 AC_CONFIG_HEADERS([config_host/config_dbus.h])
14072 AC_CONFIG_HEADERS([config_host/config_features.h])
14073 AC_CONFIG_HEADERS([config_host/config_feature_desktop.h])
14074 AC_CONFIG_HEADERS([config_host/config_feature_opencl.h])
14075 AC_CONFIG_HEADERS([config_host/config_firebird.h])
14076 AC_CONFIG_HEADERS([config_host/config_folders.h])
14077 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
14078 AC_CONFIG_HEADERS([config_host/config_gio.h])
14079 AC_CONFIG_HEADERS([config_host/config_global.h])
14080 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
14081 AC_CONFIG_HEADERS([config_host/config_java.h])
14082 AC_CONFIG_HEADERS([config_host/config_langs.h])
14083 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
14084 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
14085 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
14086 AC_CONFIG_HEADERS([config_host/config_locales.h])
14087 AC_CONFIG_HEADERS([config_host/config_mpl.h])
14088 AC_CONFIG_HEADERS([config_host/config_oox.h])
14089 AC_CONFIG_HEADERS([config_host/config_options.h])
14090 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
14091 AC_CONFIG_HEADERS([config_host/config_zxing.h])
14092 AC_CONFIG_HEADERS([config_host/config_skia.h])
14093 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
14094 AC_CONFIG_HEADERS([config_host/config_vendor.h])
14095 AC_CONFIG_HEADERS([config_host/config_vcl.h])
14096 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
14097 AC_CONFIG_HEADERS([config_host/config_version.h])
14098 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
14099 AC_CONFIG_HEADERS([config_host/config_poppler.h])
14100 AC_CONFIG_HEADERS([config_host/config_python.h])
14101 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
14102 AC_OUTPUT
14104 if test "$CROSS_COMPILING" = TRUE; then
14105     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
14108 # touch the config timestamp file
14109 if test ! -f config_host.mk.stamp; then
14110     echo > config_host.mk.stamp
14111 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
14112     echo "Host Configuration unchanged - avoiding scp2 stamp update"
14113 else
14114     echo > config_host.mk.stamp
14117 # touch the config lang timestamp file
14118 if test ! -f config_host_lang.mk.stamp; then
14119     echo > config_host_lang.mk.stamp
14120 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
14121     echo "Language Configuration unchanged - avoiding scp2 stamp update"
14122 else
14123     echo > config_host_lang.mk.stamp
14127 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
14128         -a "$build_os" = "cygwin"; then
14130 cat << _EOS
14131 ****************************************************************************
14132 WARNING:
14133 Your make version is known to be horribly slow, and hard to debug
14134 problems with. To get a reasonably functional make please do:
14136 to install a pre-compiled binary make for Win32
14138  mkdir -p /opt/lo/bin
14139  cd /opt/lo/bin
14140  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
14141  cp make-4.2.1-msvc.exe make
14142  chmod +x make
14144 to install from source:
14145 place yourself in a working directory of you choice.
14147  git clone git://git.savannah.gnu.org/make.git
14149  [go to Start menu, open "Visual Studio 2019", click "x86 Native Tools Command Prompt" or "x64 Native Tools Command Prompt"]
14150  set PATH=%PATH%;C:\Cygwin\bin
14151  [or Cygwin64, if that is what you have]
14152  cd path-to-make-repo-you-cloned-above
14153  build_w32.bat --without-guile
14155 should result in a WinRel/gnumake.exe.
14156 Copy it to the Cygwin /opt/lo/bin directory as make.exe
14158 Then re-run autogen.sh
14160 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
14161 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
14163 _EOS
14164 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
14165     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
14170 cat << _EOF
14171 ****************************************************************************
14173 To build, run:
14174 $GNUMAKE
14176 To view some help, run:
14177 $GNUMAKE help
14179 _EOF
14181 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
14182     cat << _EOF
14183 After the build has finished successfully, you can immediately run what you built using the command:
14184 _EOF
14186     if test $_os = Darwin; then
14187         echo open instdir/$PRODUCTNAME_WITHOUT_SPACES.app
14188     else
14189         echo instdir/program/soffice
14190     fi
14191     cat << _EOF
14193 If you want to run the smoketest, run:
14194 $GNUMAKE check
14196 _EOF
14199 if test -f warn; then
14200     cat warn
14201     rm warn
14204 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: