tdf#140936 statusbar selection mode control improvements
[LibreOffice.git] / configure.ac
blob7900e9051f9250a81a9c76b9392c98742a1b46ee
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-apache-commons,
2057     AS_HELP_STRING([--with-system-apache-commons],
2058         [Use Apache commons libraries already on system.]),,
2059     [with_system_apache_commons="$with_system_jars"])
2061 AC_ARG_WITH(system-mariadb,
2062     AS_HELP_STRING([--with-system-mariadb],
2063         [Use MariaDB/MySQL libraries already on system.]),,
2064     [with_system_mariadb="$with_system_libs"])
2066 AC_ARG_ENABLE(bundle-mariadb,
2067     AS_HELP_STRING([--enable-bundle-mariadb],
2068         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
2071 AC_ARG_WITH(system-postgresql,
2072     AS_HELP_STRING([--with-system-postgresql],
2073         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
2074          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
2075     [with_system_postgresql="$with_system_libs"])
2077 AC_ARG_WITH(libpq-path,
2078     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
2079         [Use this PostgreSQL C interface (libpq) installation for building
2080          the PostgreSQL-SDBC extension.]),
2083 AC_ARG_WITH(system-firebird,
2084     AS_HELP_STRING([--with-system-firebird],
2085         [Use Firebird libraries already on system, for building the Firebird-SDBC
2086          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
2087     [with_system_firebird="$with_system_libs"])
2089 AC_ARG_WITH(system-libtommath,
2090             AS_HELP_STRING([--with-system-libtommath],
2091                            [Use libtommath already on system]),,
2092             [with_system_libtommath="$with_system_libs"])
2094 AC_ARG_WITH(system-hsqldb,
2095     AS_HELP_STRING([--with-system-hsqldb],
2096         [Use hsqldb already on system.]))
2098 AC_ARG_WITH(hsqldb-jar,
2099     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
2100         [Specify path to jarfile manually.]),
2101     HSQLDB_JAR=$withval)
2103 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
2104     AS_HELP_STRING([--disable-scripting-beanshell],
2105         [Disable support for scripts in BeanShell.]),
2109 AC_ARG_WITH(system-beanshell,
2110     AS_HELP_STRING([--with-system-beanshell],
2111         [Use beanshell already on system.]),,
2112     [with_system_beanshell="$with_system_jars"])
2114 AC_ARG_WITH(beanshell-jar,
2115     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
2116         [Specify path to jarfile manually.]),
2117     BSH_JAR=$withval)
2119 libo_FUZZ_ARG_ENABLE(scripting-javascript,
2120     AS_HELP_STRING([--disable-scripting-javascript],
2121         [Disable support for scripts in JavaScript.]),
2125 AC_ARG_WITH(system-rhino,
2126     AS_HELP_STRING([--with-system-rhino],
2127         [Use rhino already on system.]),,)
2128 #    [with_system_rhino="$with_system_jars"])
2129 # Above is not used as we have different debug interface
2130 # patched into internal rhino. This code needs to be fixed
2131 # before we can enable it by default.
2133 AC_ARG_WITH(rhino-jar,
2134     AS_HELP_STRING([--with-rhino-jar=JARFILE],
2135         [Specify path to jarfile manually.]),
2136     RHINO_JAR=$withval)
2138 AC_ARG_WITH(commons-logging-jar,
2139     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
2140         [Specify path to jarfile manually.]),
2141     COMMONS_LOGGING_JAR=$withval)
2143 AC_ARG_WITH(system-jfreereport,
2144     AS_HELP_STRING([--with-system-jfreereport],
2145         [Use JFreeReport already on system.]),,
2146     [with_system_jfreereport="$with_system_jars"])
2148 AC_ARG_WITH(sac-jar,
2149     AS_HELP_STRING([--with-sac-jar=JARFILE],
2150         [Specify path to jarfile manually.]),
2151     SAC_JAR=$withval)
2153 AC_ARG_WITH(libxml-jar,
2154     AS_HELP_STRING([--with-libxml-jar=JARFILE],
2155         [Specify path to jarfile manually.]),
2156     LIBXML_JAR=$withval)
2158 AC_ARG_WITH(flute-jar,
2159     AS_HELP_STRING([--with-flute-jar=JARFILE],
2160         [Specify path to jarfile manually.]),
2161     FLUTE_JAR=$withval)
2163 AC_ARG_WITH(jfreereport-jar,
2164     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
2165         [Specify path to jarfile manually.]),
2166     JFREEREPORT_JAR=$withval)
2168 AC_ARG_WITH(liblayout-jar,
2169     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
2170         [Specify path to jarfile manually.]),
2171     LIBLAYOUT_JAR=$withval)
2173 AC_ARG_WITH(libloader-jar,
2174     AS_HELP_STRING([--with-libloader-jar=JARFILE],
2175         [Specify path to jarfile manually.]),
2176     LIBLOADER_JAR=$withval)
2178 AC_ARG_WITH(libformula-jar,
2179     AS_HELP_STRING([--with-libformula-jar=JARFILE],
2180         [Specify path to jarfile manually.]),
2181     LIBFORMULA_JAR=$withval)
2183 AC_ARG_WITH(librepository-jar,
2184     AS_HELP_STRING([--with-librepository-jar=JARFILE],
2185         [Specify path to jarfile manually.]),
2186     LIBREPOSITORY_JAR=$withval)
2188 AC_ARG_WITH(libfonts-jar,
2189     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
2190         [Specify path to jarfile manually.]),
2191     LIBFONTS_JAR=$withval)
2193 AC_ARG_WITH(libserializer-jar,
2194     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
2195         [Specify path to jarfile manually.]),
2196     LIBSERIALIZER_JAR=$withval)
2198 AC_ARG_WITH(libbase-jar,
2199     AS_HELP_STRING([--with-libbase-jar=JARFILE],
2200         [Specify path to jarfile manually.]),
2201     LIBBASE_JAR=$withval)
2203 AC_ARG_WITH(system-odbc,
2204     AS_HELP_STRING([--with-system-odbc],
2205         [Use the odbc headers already on system.]),,
2206     [with_system_odbc="auto"])
2208 AC_ARG_WITH(system-sane,
2209     AS_HELP_STRING([--with-system-sane],
2210         [Use sane.h already on system.]),,
2211     [with_system_sane="$with_system_headers"])
2213 AC_ARG_WITH(system-bluez,
2214     AS_HELP_STRING([--with-system-bluez],
2215         [Use bluetooth.h already on system.]),,
2216     [with_system_bluez="$with_system_headers"])
2218 AC_ARG_WITH(system-curl,
2219     AS_HELP_STRING([--with-system-curl],
2220         [Use curl already on system.]),,
2221     [with_system_curl=auto])
2223 AC_ARG_WITH(system-boost,
2224     AS_HELP_STRING([--with-system-boost],
2225         [Use boost already on system.]),,
2226     [with_system_boost="$with_system_headers"])
2228 AC_ARG_WITH(system-glm,
2229     AS_HELP_STRING([--with-system-glm],
2230         [Use glm already on system.]),,
2231     [with_system_glm="$with_system_headers"])
2233 AC_ARG_WITH(system-hunspell,
2234     AS_HELP_STRING([--with-system-hunspell],
2235         [Use libhunspell already on system.]),,
2236     [with_system_hunspell="$with_system_libs"])
2238 libo_FUZZ_ARG_ENABLE(zxing,
2239     AS_HELP_STRING([--disable-zxing],
2240        [Disable use of zxing external library.]))
2242 AC_ARG_WITH(system-zxing,
2243     AS_HELP_STRING([--with-system-zxing],
2244         [Use libzxing already on system.]),,
2245     [with_system_zxing="$with_system_libs"])
2247 AC_ARG_WITH(system-box2d,
2248     AS_HELP_STRING([--with-system-box2d],
2249         [Use box2d already on system.]),,
2250     [with_system_box2d="$with_system_libs"])
2252 AC_ARG_WITH(system-mythes,
2253     AS_HELP_STRING([--with-system-mythes],
2254         [Use mythes already on system.]),,
2255     [with_system_mythes="$with_system_libs"])
2257 AC_ARG_WITH(system-altlinuxhyph,
2258     AS_HELP_STRING([--with-system-altlinuxhyph],
2259         [Use ALTLinuxhyph already on system.]),,
2260     [with_system_altlinuxhyph="$with_system_libs"])
2262 AC_ARG_WITH(system-lpsolve,
2263     AS_HELP_STRING([--with-system-lpsolve],
2264         [Use lpsolve already on system.]),,
2265     [with_system_lpsolve="$with_system_libs"])
2267 AC_ARG_WITH(system-coinmp,
2268     AS_HELP_STRING([--with-system-coinmp],
2269         [Use CoinMP already on system.]),,
2270     [with_system_coinmp="$with_system_libs"])
2272 AC_ARG_WITH(system-liblangtag,
2273     AS_HELP_STRING([--with-system-liblangtag],
2274         [Use liblangtag library already on system.]),,
2275     [with_system_liblangtag="$with_system_libs"])
2277 AC_ARG_WITH(webdav,
2278     AS_HELP_STRING([--with-webdav],
2279         [Specify which library to use for webdav implementation.
2280          Possible values: "neon", "serf", "no". The default value is "neon".
2281          Example: --with-webdav="serf"]),
2282     WITH_WEBDAV=$withval,
2283     WITH_WEBDAV="neon")
2285 AC_ARG_WITH(linker-hash-style,
2286     AS_HELP_STRING([--with-linker-hash-style],
2287         [Use linker with --hash-style=<style> when linking shared objects.
2288          Possible values: "sysv", "gnu", "both". The default value is "gnu"
2289          if supported on the build system, and "sysv" otherwise.]))
2291 AC_ARG_WITH(jdk-home,
2292     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
2293         [If you have installed JDK 9 or later on your system please supply the
2294          path here. Note that this is not the location of the java command but the
2295          location of the entire distribution. In case of cross-compiling, this
2296          is the JDK of the host os. Use --with-build-platform-configure-options
2297          to point to a different build platform JDK.]),
2300 AC_ARG_WITH(help,
2301     AS_HELP_STRING([--with-help],
2302         [Enable the build of help. There is a special parameter "common" that
2303          can be used to bundle only the common part, .e.g help-specific icons.
2304          This is useful when you build the helpcontent separately.])
2305     [
2306                           Usage:     --with-help    build the old local help
2307                                  --without-help     no local help (default)
2308                                  --with-help=html   build the new HTML local help
2309                                  --with-help=online build the new HTML online help
2310     ],
2313 AC_ARG_WITH(omindex,
2314    AS_HELP_STRING([--with-omindex],
2315         [Enable the support of xapian-omega index for online help.])
2316    [
2317                          Usage: --with-omindex=server prepare the pages for omindex
2318                                 but let xapian-omega be built in server.
2319                                 --with-omindex=noxap do not prepare online pages
2320                                 for xapian-omega
2321   ],
2324 libo_FUZZ_ARG_WITH(java,
2325     AS_HELP_STRING([--with-java=<java command>],
2326         [Specify the name of the Java interpreter command. Typically "java"
2327          which is the default.
2329          To build without support for Java components, applets, accessibility
2330          or the XML filters written in Java, use --without-java or --with-java=no.]),
2331     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
2332     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
2335 AC_ARG_WITH(jvm-path,
2336     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
2337         [Use a specific JVM search path at runtime.
2338          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
2341 AC_ARG_WITH(ant-home,
2342     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2343         [If you have installed Apache Ant on your system, please supply the path here.
2344          Note that this is not the location of the Ant binary but the location
2345          of the entire distribution.]),
2348 AC_ARG_WITH(symbol-config,
2349     AS_HELP_STRING([--with-symbol-config],
2350         [Configuration for the crashreport symbol upload]),
2351         [],
2352         [with_symbol_config=no])
2354 AC_ARG_WITH(export-validation,
2355     AS_HELP_STRING([--without-export-validation],
2356         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2357 ,with_export_validation=auto)
2359 AC_ARG_WITH(bffvalidator,
2360     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2361         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2362          Requires installed Microsoft Office Binary File Format Validator.
2363          Note: export-validation (--with-export-validation) is required to be turned on.
2364          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2365 ,with_bffvalidator=no)
2367 libo_FUZZ_ARG_WITH(junit,
2368     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2369         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2370          --without-junit disables those tests. Not relevant in the --without-java case.]),
2371 ,with_junit=yes)
2373 AC_ARG_WITH(hamcrest,
2374     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2375         [Specifies the hamcrest jar file to use for JUnit-based tests.
2376          --without-junit disables those tests. Not relevant in the --without-java case.]),
2377 ,with_hamcrest=yes)
2379 AC_ARG_WITH(perl-home,
2380     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2381         [If you have installed Perl 5 Distribution, on your system, please
2382          supply the path here. Note that this is not the location of the Perl
2383          binary but the location of the entire distribution.]),
2386 libo_FUZZ_ARG_WITH(doxygen,
2387     AS_HELP_STRING(
2388         [--with-doxygen=<absolute path to doxygen executable>],
2389         [Specifies the doxygen executable to use when generating ODK C/C++
2390          documentation. --without-doxygen disables generation of ODK C/C++
2391          documentation. Not relevant in the --disable-odk case.]),
2392 ,with_doxygen=yes)
2394 AC_ARG_WITH(visual-studio,
2395     AS_HELP_STRING([--with-visual-studio=<2019>],
2396         [Specify which Visual Studio version to use in case several are
2397          installed. Currently only 2019 (default) is supported.]),
2400 AC_ARG_WITH(windows-sdk,
2401     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10.0>],
2402         [Specify which Windows SDK, or "Windows Kit", version to use
2403          in case the one that came with the selected Visual Studio
2404          is not what you want for some reason. Note that not all compiler/SDK
2405          combinations are supported. The intent is that this option should not
2406          be needed.]),
2409 AC_ARG_WITH(lang,
2410     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2411         [Use this option to build LibreOffice with additional UI language support.
2412          English (US) is always included by default.
2413          Separate multiple languages with space.
2414          For all languages, use --with-lang=ALL.]),
2417 AC_ARG_WITH(locales,
2418     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2419         [Use this option to limit the locale information built in.
2420          Separate multiple locales with space.
2421          Very experimental and might well break stuff.
2422          Just a desperate measure to shrink code and data size.
2423          By default all the locales available is included.
2424          This option is completely unrelated to --with-lang.])
2425     [
2426                           Affects also our character encoding conversion
2427                           tables for encodings mainly targeted for a
2428                           particular locale, like EUC-CN and EUC-TW for
2429                           zh, ISO-2022-JP for ja.
2431                           Affects also our add-on break iterator data for
2432                           some languages.
2434                           For the default, all locales, don't use this switch at all.
2435                           Specifying just the language part of a locale means all matching
2436                           locales will be included.
2437     ],
2440 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2441 libo_FUZZ_ARG_WITH(krb5,
2442     AS_HELP_STRING([--with-krb5],
2443         [Enable MIT Kerberos 5 support in modules that support it.
2444          By default automatically enabled on platforms
2445          where a good system Kerberos 5 is available.]),
2448 libo_FUZZ_ARG_WITH(gssapi,
2449     AS_HELP_STRING([--with-gssapi],
2450         [Enable GSSAPI support in modules that support it.
2451          By default automatically enabled on platforms
2452          where a good system GSSAPI is available.]),
2455 AC_ARG_WITH(iwyu,
2456     AS_HELP_STRING([--with-iwyu],
2457         [Use given IWYU binary path to check unneeded includes instead of building.
2458          Use only if you are hacking on it.]),
2461 libo_FUZZ_ARG_WITH(lxml,
2462     AS_HELP_STRING([--without-lxml],
2463         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2464          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2465          report widget classes and ids.]),
2468 libo_FUZZ_ARG_WITH(latest-c++,
2469     AS_HELP_STRING([--with-latest-c++],
2470         [Try to enable the latest features of the C++ compiler, even if they are not yet part of a
2471          published standard.]),,
2472         [with_latest_c__=no])
2474 dnl ===================================================================
2475 dnl Branding
2476 dnl ===================================================================
2478 AC_ARG_WITH(branding,
2479     AS_HELP_STRING([--with-branding=/path/to/images],
2480         [Use given path to retrieve branding images set.])
2481     [
2482                           Search for intro.png about.svg and logo.svg.
2483                           If any is missing, default ones will be used instead.
2485                           Search also progress.conf for progress
2486                           settings on intro screen :
2488                           PROGRESSBARCOLOR="255,255,255" Set color of
2489                           progress bar. Comma separated RGB decimal values.
2490                           PROGRESSSIZE="407,6" Set size of progress bar.
2491                           Comma separated decimal values (width, height).
2492                           PROGRESSPOSITION="61,317" Set position of progress
2493                           bar from left,top. Comma separated decimal values.
2494                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2495                           bar frame. Comma separated RGB decimal values.
2496                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2497                           bar text. Comma separated RGB decimal values.
2498                           PROGRESSTEXTBASELINE="287" Set vertical position of
2499                           progress bar text from top. Decimal value.
2501                           Default values will be used if not found.
2502     ],
2506 AC_ARG_WITH(extra-buildid,
2507     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2508         [Show addition build identification in about dialog.]),
2512 AC_ARG_WITH(vendor,
2513     AS_HELP_STRING([--with-vendor="John the Builder"],
2514         [Set vendor of the build.]),
2517 AC_ARG_WITH(android-package-name,
2518     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2519         [Set Android package name of the build.]),
2522 AC_ARG_WITH(compat-oowrappers,
2523     AS_HELP_STRING([--with-compat-oowrappers],
2524         [Install oo* wrappers in parallel with
2525          lo* ones to keep backward compatibility.
2526          Has effect only with make distro-pack-install]),
2529 AC_ARG_WITH(os-version,
2530     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2531         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2534 AC_ARG_WITH(idlc-cpp,
2535     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2536         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2539 AC_ARG_WITH(parallelism,
2540     AS_HELP_STRING([--with-parallelism],
2541         [Number of jobs to run simultaneously during build. Parallel builds can
2542         save a lot of time on multi-cpu machines. Defaults to the number of
2543         CPUs on the machine, unless you configure --enable-icecream - then to
2544         40.]),
2547 AC_ARG_WITH(all-tarballs,
2548     AS_HELP_STRING([--with-all-tarballs],
2549         [Download all external tarballs unconditionally]))
2551 AC_ARG_WITH(gdrive-client-id,
2552     AS_HELP_STRING([--with-gdrive-client-id],
2553         [Provides the client id of the application for OAuth2 authentication
2554         on Google Drive. If either this or --with-gdrive-client-secret is
2555         empty, the feature will be disabled]),
2558 AC_ARG_WITH(gdrive-client-secret,
2559     AS_HELP_STRING([--with-gdrive-client-secret],
2560         [Provides the client secret of the application for OAuth2
2561         authentication on Google Drive. If either this or
2562         --with-gdrive-client-id is empty, the feature will be disabled]),
2565 AC_ARG_WITH(alfresco-cloud-client-id,
2566     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2567         [Provides the client id of the application for OAuth2 authentication
2568         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2569         empty, the feature will be disabled]),
2572 AC_ARG_WITH(alfresco-cloud-client-secret,
2573     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2574         [Provides the client secret of the application for OAuth2
2575         authentication on Alfresco Cloud. If either this or
2576         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2579 AC_ARG_WITH(onedrive-client-id,
2580     AS_HELP_STRING([--with-onedrive-client-id],
2581         [Provides the client id of the application for OAuth2 authentication
2582         on OneDrive. If either this or --with-onedrive-client-secret is
2583         empty, the feature will be disabled]),
2586 AC_ARG_WITH(onedrive-client-secret,
2587     AS_HELP_STRING([--with-onedrive-client-secret],
2588         [Provides the client secret of the application for OAuth2
2589         authentication on OneDrive. If either this or
2590         --with-onedrive-client-id is empty, the feature will be disabled]),
2592 dnl ===================================================================
2593 dnl Do we want to use pre-build binary tarball for recompile
2594 dnl ===================================================================
2596 if test "$enable_library_bin_tar" = "yes" ; then
2597     USE_LIBRARY_BIN_TAR=TRUE
2598 else
2599     USE_LIBRARY_BIN_TAR=
2601 AC_SUBST(USE_LIBRARY_BIN_TAR)
2603 dnl ===================================================================
2604 dnl Test whether build target is Release Build
2605 dnl ===================================================================
2606 AC_MSG_CHECKING([whether build target is Release Build])
2607 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2608     AC_MSG_RESULT([no])
2609     ENABLE_RELEASE_BUILD=
2610     GET_TASK_ALLOW_ENTITLEMENT='
2611         <!-- We want to be able to debug a hardened process when not building for release -->
2612         <key>com.apple.security.get-task-allow</key>
2613         <true/>'
2614 else
2615     AC_MSG_RESULT([yes])
2616     ENABLE_RELEASE_BUILD=TRUE
2617     GET_TASK_ALLOW_ENTITLEMENT=''
2619 AC_SUBST(ENABLE_RELEASE_BUILD)
2620 AC_SUBST(GET_TASK_ALLOW_ENTITLEMENT)
2622 AC_MSG_CHECKING([whether to build a Community flavor])
2623 if test -z "$enable_community_flavor" -o "$enable_community_flavor" == "yes"; then
2624     AC_DEFINE(HAVE_FEATURE_COMMUNITY_FLAVOR)
2625     AC_MSG_RESULT([yes])
2626 else
2627     AC_MSG_RESULT([no])
2630 dnl ===================================================================
2631 dnl Test whether to sign Windows Build
2632 dnl ===================================================================
2633 AC_MSG_CHECKING([whether to sign windows build])
2634 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2635     AC_MSG_RESULT([yes])
2636     WINDOWS_BUILD_SIGNING="TRUE"
2637 else
2638     AC_MSG_RESULT([no])
2639     WINDOWS_BUILD_SIGNING="FALSE"
2641 AC_SUBST(WINDOWS_BUILD_SIGNING)
2643 dnl ===================================================================
2644 dnl MacOSX build and runtime environment options
2645 dnl ===================================================================
2647 AC_ARG_WITH(macosx-sdk,
2648     AS_HELP_STRING([--with-macosx-sdk=<version>],
2649         [Prefer a specific SDK for building.])
2650     [
2651                           If the requested SDK is not available, a search for the oldest one will be done.
2652                           With current Xcode versions, only the latest SDK is included, so this option is
2653                           not terribly useful. It works fine to build with a new SDK and run the result
2654                           on an older OS.
2656                           e. g.: --with-macosx-sdk=10.10
2658                           there are 3 options to control the MacOSX build:
2659                           --with-macosx-sdk (referred as 'sdk' below)
2660                           --with-macosx-version-min-required (referred as 'min' below)
2661                           --with-macosx-version-max-allowed (referred as 'max' below)
2663                           the connection between these value and the default they take is as follow:
2664                           ( ? means not specified on the command line, s means the SDK version found,
2665                           constraint: 8 <= x <= y <= z)
2667                           ==========================================
2668                            command line      || config result
2669                           ==========================================
2670                           min  | max  | sdk  || min   | max  | sdk  |
2671                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2672                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2673                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2674                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2675                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2676                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2677                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2678                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2681                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2682                           for a detailed technical explanation of these variables
2684                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2685     ],
2688 AC_ARG_WITH(macosx-version-min-required,
2689     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2690         [set the minimum OS version needed to run the built LibreOffice])
2691     [
2692                           e. g.: --with-macosx-version-min-required=10.10
2693                           see --with-macosx-sdk for more info
2694     ],
2697 AC_ARG_WITH(macosx-version-max-allowed,
2698     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2699         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2700     [
2701                           e. g.: --with-macosx-version-max-allowed=10.10
2702                           see --with-macosx-sdk for more info
2703     ],
2707 dnl ===================================================================
2708 dnl options for stuff used during cross-compilation build
2709 dnl Not quite superseded by --with-build-platform-configure-options.
2710 dnl TODO: check, if the "force" option is still needed anywhere.
2711 dnl ===================================================================
2713 AC_ARG_WITH(system-icu-for-build,
2714     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2715         [Use icu already on system for build tools (cross-compilation only).]))
2718 dnl ===================================================================
2719 dnl Check for incompatible options set by fuzzing, and reset those
2720 dnl automatically to working combinations
2721 dnl ===================================================================
2723 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2724         "$enable_dbus" != "$enable_avahi"; then
2725     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2726     enable_avahi=$enable_dbus
2729 add_lopath_after ()
2731     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2732         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2733     fi
2736 add_lopath_before ()
2738     local IFS=${P_SEP}
2739     local path_cleanup
2740     local dir
2741     for dir in $LO_PATH ; do
2742         if test "$dir" != "$1" ; then
2743             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2744         fi
2745     done
2746     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2749 dnl ===================================================================
2750 dnl check for required programs (grep, awk, sed, bash)
2751 dnl ===================================================================
2753 pathmunge ()
2755     local new_path
2756     if test -n "$1"; then
2757         if test "$build_os" = "cygwin"; then
2758             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2759                 PathFormat "$1"
2760                 new_path=`cygpath -sm "$formatted_path"`
2761             else
2762                 PathFormat "$1"
2763                 new_path=`cygpath -u "$formatted_path"`
2764             fi
2765         else
2766             new_path="$1"
2767         fi
2768         if test "$2" = "after"; then
2769             add_lopath_after "$new_path"
2770         else
2771             add_lopath_before "$new_path"
2772         fi
2773     fi
2776 AC_PROG_AWK
2777 AC_PATH_PROG( AWK, $AWK)
2778 if test -z "$AWK"; then
2779     AC_MSG_ERROR([install awk to run this script])
2782 AC_PATH_PROG(BASH, bash)
2783 if test -z "$BASH"; then
2784     AC_MSG_ERROR([bash not found in \$PATH])
2786 AC_SUBST(BASH)
2788 AC_MSG_CHECKING([for GNU or BSD tar])
2789 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2790     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2791     if test $? -eq 0;  then
2792         GNUTAR=$a
2793         break
2794     fi
2795 done
2796 AC_MSG_RESULT($GNUTAR)
2797 if test -z "$GNUTAR"; then
2798     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2800 AC_SUBST(GNUTAR)
2802 AC_MSG_CHECKING([for tar's option to strip components])
2803 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2804 if test $? -eq 0; then
2805     STRIP_COMPONENTS="--strip-components"
2806 else
2807     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2808     if test $? -eq 0; then
2809         STRIP_COMPONENTS="--strip-path"
2810     else
2811         STRIP_COMPONENTS="unsupported"
2812     fi
2814 AC_MSG_RESULT($STRIP_COMPONENTS)
2815 if test x$STRIP_COMPONENTS = xunsupported; then
2816     AC_MSG_ERROR([you need a tar that is able to strip components.])
2818 AC_SUBST(STRIP_COMPONENTS)
2820 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2821 dnl desktop OSes from "mobile" ones.
2823 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2824 dnl In other words, that when building for an OS that is not a
2825 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2827 dnl Note the direction of the implication; there is no assumption that
2828 dnl cross-compiling would imply a non-desktop OS.
2830 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2831     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2832     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2833     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2836 # Whether to build "avmedia" functionality or not.
2838 if test -z "$enable_avmedia"; then
2839     enable_avmedia=yes
2842 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2843 if test "$enable_avmedia" = yes; then
2844     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2845 else
2846     USE_AVMEDIA_DUMMY='TRUE'
2848 AC_SUBST(USE_AVMEDIA_DUMMY)
2850 # Decide whether to build database connectivity stuff (including
2851 # Base) or not. We probably don't want to on non-desktop OSes.
2852 if test -z "$enable_database_connectivity"; then
2853     # --disable-database-connectivity is unfinished work in progress
2854     # and the iOS test app doesn't link if we actually try to use it.
2855     # if test $_os != iOS -a $_os != Android; then
2856     if test $_os != iOS; then
2857         enable_database_connectivity=yes
2858     fi
2861 if test "$enable_database_connectivity" = yes; then
2862     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2863     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2866 if test -z "$enable_extensions"; then
2867     # For iOS and Android Viewer, disable extensions unless specifically overridden with --enable-extensions.
2868     if test $_os != iOS && test $_os != Android -o "$ENABLE_ANDROID_LOK" = TRUE ; then
2869         enable_extensions=yes
2870     fi
2873 if test "$enable_extensions" = yes; then
2874     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2875     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2878 if test -z "$enable_scripting"; then
2879     # Disable scripting for iOS unless specifically overridden
2880     # with --enable-scripting.
2881     if test $_os != iOS; then
2882         enable_scripting=yes
2883     fi
2886 DISABLE_SCRIPTING=''
2887 if test "$enable_scripting" = yes; then
2888     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2889     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2890 else
2891     DISABLE_SCRIPTING='TRUE'
2892     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2895 if test $_os = iOS -o $_os = Android; then
2896     # Disable dynamic_loading always for iOS and Android
2897     enable_dynamic_loading=no
2898 elif test -z "$enable_dynamic_loading"; then
2899     # Otherwise enable it unless specifically disabled
2900     enable_dynamic_loading=yes
2903 DISABLE_DYNLOADING=''
2904 if test "$enable_dynamic_loading" = yes; then
2905     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2906 else
2907     DISABLE_DYNLOADING='TRUE'
2909 AC_SUBST(DISABLE_DYNLOADING)
2911 # remember SYSBASE value
2912 AC_SUBST(SYSBASE)
2914 dnl ===================================================================
2915 dnl  Sort out various gallery compilation options
2916 dnl ===================================================================
2917 WITH_GALLERY_BUILD=TRUE
2918 AC_MSG_CHECKING([how to build and package galleries])
2919 if test -n "${with_galleries}"; then
2920     if test "$with_galleries" = "build"; then
2921         AC_MSG_RESULT([build from source images internally])
2922     elif test "$with_galleries" = "no"; then
2923         WITH_GALLERY_BUILD=
2924         AC_MSG_RESULT([disable non-internal gallery build])
2925     else
2926         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2927     fi
2928 else
2929     if test $_os != iOS -a $_os != Android; then
2930         AC_MSG_RESULT([internal src images for desktop])
2931     else
2932         WITH_GALLERY_BUILD=
2933         AC_MSG_RESULT([disable src image build])
2934     fi
2936 AC_SUBST(WITH_GALLERY_BUILD)
2938 dnl ===================================================================
2939 dnl  Checks if ccache is available
2940 dnl ===================================================================
2941 CCACHE_DEPEND_MODE=
2942 if test "$_os" = "WINNT"; then
2943     # on windows/VC build do not use ccache
2944     CCACHE=""
2945 elif test "$enable_ccache" = "no"; then
2946     CCACHE=""
2947 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2948     case "%$CC%$CXX%" in
2949     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2950     # assume that's good then
2951     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2952         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2953         CCACHE_DEPEND_MODE=1
2954         ;;
2955     *)
2956         AC_PATH_PROG([CCACHE],[ccache],[not found])
2957         if test "$CCACHE" = "not found"; then
2958             CCACHE=""
2959         else
2960             CCACHE_DEPEND_MODE=1
2961             # Need to check for ccache version: otherwise prevents
2962             # caching of the results (like "-x objective-c++" for Mac)
2963             if test $_os = Darwin -o $_os = iOS; then
2964                 # Check ccache version
2965                 AC_MSG_CHECKING([whether version of ccache is suitable])
2966                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2967                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2968                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2969                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2970                 else
2971                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2972                     CCACHE=""
2973                     CCACHE_DEPEND_MODE=
2974                 fi
2975             fi
2976         fi
2977         ;;
2978     esac
2979 else
2980     CCACHE=""
2982 if test "$enable_ccache" = "nodepend"; then
2983     CCACHE_DEPEND_MODE=""
2985 AC_SUBST(CCACHE_DEPEND_MODE)
2987 if test "$CCACHE" != ""; then
2988     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2989     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2990     if test "$ccache_size" = ""; then
2991         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2992         if test "$ccache_size" = ""; then
2993             ccache_size=0
2994         fi
2995         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2996         if test $ccache_size -lt 1024; then
2997             CCACHE=""
2998             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2999             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
3000         else
3001             # warn that ccache may be too small for debug build
3002             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3003             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3004         fi
3005     else
3006         if test $ccache_size -lt 5; then
3007             #warn that ccache may be too small for debug build
3008             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
3009             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
3010         fi
3011     fi
3014 dnl ===================================================================
3015 dnl  Checks for C compiler,
3016 dnl  The check for the C++ compiler is later on.
3017 dnl ===================================================================
3018 if test "$_os" != "WINNT"; then
3019     GCC_HOME_SET="true"
3020     AC_MSG_CHECKING([gcc home])
3021     if test -z "$with_gcc_home"; then
3022         if test "$enable_icecream" = "yes"; then
3023             if test -d "/usr/lib/icecc/bin"; then
3024                 GCC_HOME="/usr/lib/icecc/"
3025             elif test -d "/usr/libexec/icecc/bin"; then
3026                 GCC_HOME="/usr/libexec/icecc/"
3027             elif test -d "/opt/icecream/bin"; then
3028                 GCC_HOME="/opt/icecream/"
3029             else
3030                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
3032             fi
3033         else
3034             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
3035             GCC_HOME_SET="false"
3036         fi
3037     else
3038         GCC_HOME="$with_gcc_home"
3039     fi
3040     AC_MSG_RESULT($GCC_HOME)
3041     AC_SUBST(GCC_HOME)
3043     if test "$GCC_HOME_SET" = "true"; then
3044         if test -z "$CC"; then
3045             CC="$GCC_HOME/bin/gcc"
3046             CC_BASE="gcc"
3047         fi
3048         if test -z "$CXX"; then
3049             CXX="$GCC_HOME/bin/g++"
3050             CXX_BASE="g++"
3051         fi
3052     fi
3055 COMPATH=`dirname "$CC"`
3056 if test "$COMPATH" = "."; then
3057     AC_PATH_PROGS(COMPATH, $CC)
3058     dnl double square bracket to get single because of M4 quote...
3059     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
3061 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
3063 dnl ===================================================================
3064 dnl Java support
3065 dnl ===================================================================
3066 AC_MSG_CHECKING([whether to build with Java support])
3067 if test "$with_java" != "no"; then
3068     if test "$DISABLE_SCRIPTING" = TRUE; then
3069         AC_MSG_RESULT([no, overridden by --disable-scripting])
3070         ENABLE_JAVA=""
3071         with_java=no
3072     else
3073         AC_MSG_RESULT([yes])
3074         ENABLE_JAVA="TRUE"
3075         AC_DEFINE(HAVE_FEATURE_JAVA)
3076     fi
3077 else
3078     AC_MSG_RESULT([no])
3079     ENABLE_JAVA=""
3082 AC_SUBST(ENABLE_JAVA)
3084 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
3086 dnl ENABLE_JAVA="" indicate no Java support at all
3088 dnl ===================================================================
3089 dnl Check macOS SDK and compiler
3090 dnl ===================================================================
3092 if test $_os = Darwin; then
3094     # If no --with-macosx-sdk option is given, look for one
3096     # The intent is that for "most" Mac-based developers, a suitable
3097     # SDK will be found automatically without any configure options.
3099     # For developers with a current Xcode, the lowest-numbered SDK
3100     # higher than or equal to the minimum required should be found.
3102     AC_MSG_CHECKING([what macOS SDK to use])
3103     for _macosx_sdk in ${with_macosx_sdk-11.1 11.0 10.15 10.14 10.13}; do
3104         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
3105         if test -d "$MACOSX_SDK_PATH"; then
3106             with_macosx_sdk="${_macosx_sdk}"
3107             break
3108         else
3109             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
3110             if test -d "$MACOSX_SDK_PATH"; then
3111                 with_macosx_sdk="${_macosx_sdk}"
3112                 break
3113             fi
3114         fi
3115     done
3116     if test ! -d "$MACOSX_SDK_PATH"; then
3117         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
3118     fi
3120     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
3122     case $with_macosx_sdk in
3123     10.13)
3124         MACOSX_SDK_VERSION=101300
3125         ;;
3126     10.14)
3127         MACOSX_SDK_VERSION=101400
3128         ;;
3129     10.15)
3130         MACOSX_SDK_VERSION=101500
3131         ;;
3132     11.0)
3133         MACOSX_SDK_VERSION=110000
3134         ;;
3135     11.1)
3136         MACOSX_SDK_VERSION=110100
3137         ;;
3138     *)
3139         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.13--11.1])
3140         ;;
3141     esac
3143     if test "$host_cpu" = arm64 -a $MACOSX_SDK_VERSION -lt 110000; then
3144         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value for Apple Silicon])
3145     fi
3147     if test "$with_macosx_version_min_required" = "" ; then
3148         if test "$host_cpu" = x86_64; then
3149             with_macosx_version_min_required="10.10";
3150         else
3151             with_macosx_version_min_required="11.0";
3152         fi
3153     fi
3155     if test "$with_macosx_version_max_allowed" = "" ; then
3156         with_macosx_version_max_allowed="$with_macosx_sdk"
3157     fi
3159     # export this so that "xcrun" invocations later return matching values
3160     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
3161     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
3162     export DEVELOPER_DIR
3163     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
3164     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
3166     AC_MSG_CHECKING([whether Xcode is new enough])
3167     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
3168     my_xcode_ver2=${my_xcode_ver1#Xcode }
3169     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
3170     if test "$my_xcode_ver3" -ge 1103; then
3171         AC_MSG_RESULT([yes ($my_xcode_ver2)])
3172     else
3173         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 11.3])
3174     fi
3176     case "$with_macosx_version_min_required" in
3177     10.10)
3178         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
3179         ;;
3180     10.11)
3181         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
3182         ;;
3183     10.12)
3184         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
3185         ;;
3186     10.13)
3187         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
3188         ;;
3189     10.14)
3190         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
3191         ;;
3192     10.15)
3193         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
3194         ;;
3195     10.16)
3196         MAC_OS_X_VERSION_MIN_REQUIRED="101600"
3197         ;;
3198     11.0)
3199         MAC_OS_X_VERSION_MIN_REQUIRED="110000"
3200         ;;
3201     11.1)
3202         MAC_OS_X_VERSION_MIN_REQUIRED="110100"
3203         ;;
3204     *)
3205         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--11.1])
3206         ;;
3207     esac
3209     LIBTOOL=/usr/bin/libtool
3210     INSTALL_NAME_TOOL=install_name_tool
3211     if test -z "$save_CC"; then
3212         stdlib=-stdlib=libc++
3214         AC_MSG_CHECKING([what C compiler to use])
3215         CC="`xcrun -find clang`"
3216         CC_BASE=`first_arg_basename "$CC"`
3217         if test "$host_cpu" = x86_64; then
3218             CC+=" -target x86_64-apple-macos"
3219         else
3220             CC+=" -target arm64-apple-macos"
3221         fi
3222         CC+=" -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3223         AC_MSG_RESULT([$CC])
3225         AC_MSG_CHECKING([what C++ compiler to use])
3226         CXX="`xcrun -find clang++`"
3227         CXX_BASE=`first_arg_basename "$CXX"`
3228         if test "$host_cpu" = x86_64; then
3229             CXX+=" -target x86_64-apple-macos"
3230         else
3231             CXX+=" -target arm64-apple-macos"
3232         fi
3233         CXX+=" $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
3234         AC_MSG_RESULT([$CXX])
3236         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3237         AR=`xcrun -find ar`
3238         NM=`xcrun -find nm`
3239         STRIP=`xcrun -find strip`
3240         LIBTOOL=`xcrun -find libtool`
3241         RANLIB=`xcrun -find ranlib`
3242     fi
3244     case "$with_macosx_version_max_allowed" in
3245     10.10)
3246         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
3247         ;;
3248     10.11)
3249         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
3250         ;;
3251     10.12)
3252         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
3253         ;;
3254     10.13)
3255         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
3256         ;;
3257     10.14)
3258         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
3259         ;;
3260     10.15)
3261         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
3262         ;;
3263     11.0)
3264         MAC_OS_X_VERSION_MAX_ALLOWED="110000"
3265         ;;
3266     11.1)
3267         MAC_OS_X_VERSION_MAX_ALLOWED="110100"
3268         ;;
3269     *)
3270         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--11.1])
3271         ;;
3272     esac
3274     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
3275     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
3276         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])
3277     else
3278         AC_MSG_RESULT([ok])
3279     fi
3281     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
3282     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
3283         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
3284     else
3285         AC_MSG_RESULT([ok])
3286     fi
3287     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
3288     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
3290     AC_MSG_CHECKING([whether to do code signing])
3292     if test "$enable_macosx_code_signing" = yes; then
3293         # By default use the first suitable certificate (?).
3295         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
3296         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
3297         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
3298         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
3299         # "Developer ID Application" one.
3301         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
3302         if test -n "$identity"; then
3303             MACOSX_CODESIGNING_IDENTITY=$identity
3304             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3305             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3306         else
3307             AC_MSG_ERROR([cannot determine identity to use])
3308         fi
3309     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
3310         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
3311         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3312         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
3313     else
3314         AC_MSG_RESULT([no])
3315     fi
3317     AC_MSG_CHECKING([whether to create a Mac App Store package])
3319     if test -z "$enable_macosx_package_signing" || test "$enable_macosx_package_signing" == no; then
3320         AC_MSG_RESULT([no])
3321     elif test -z "$MACOSX_CODESIGNING_IDENTITY"; then
3322         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
3323     elif test "$enable_macosx_package_signing" = yes; then
3324         # By default use the first suitable certificate.
3325         # It should be a "3rd Party Mac Developer Installer" one
3327         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
3328         if test -n "$identity"; then
3329             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
3330             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3331             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3332         else
3333             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
3334         fi
3335     else
3336         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
3337         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
3338         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
3339     fi
3341     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
3342         AC_MSG_ERROR([You should not use the same identity for code and package signing])
3343     fi
3345     AC_MSG_CHECKING([whether to sandbox the application])
3347     if test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
3348         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
3349     elif test "$enable_macosx_sandbox" = yes; then
3350         ENABLE_MACOSX_SANDBOX=TRUE
3351         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
3352         AC_MSG_RESULT([yes])
3353     else
3354         AC_MSG_RESULT([no])
3355     fi
3357     AC_MSG_CHECKING([what macOS app bundle identifier to use])
3358     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
3359     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
3361 AC_SUBST(MACOSX_SDK_PATH)
3362 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
3363 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
3364 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
3365 AC_SUBST(INSTALL_NAME_TOOL)
3366 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3367 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3368 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3369 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3370 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3372 dnl ===================================================================
3373 dnl Check iOS SDK and compiler
3374 dnl ===================================================================
3376 if test $_os = iOS; then
3377     AC_MSG_CHECKING([what iOS SDK to use])
3378     current_sdk_ver=14.4
3379     older_sdk_vers="14.3 14.2 14.1 14.0 13.7 13.6 13.5 13.4 13.2 13.1 13.0 12.4 12.2"
3380     if test "$enable_ios_simulator" = "yes"; then
3381         platform=iPhoneSimulator
3382         versionmin=-mios-simulator-version-min=12.2
3383     else
3384         platform=iPhoneOS
3385         versionmin=-miphoneos-version-min=12.2
3386     fi
3387     xcode_developer=`xcode-select -print-path`
3389     for sdkver in $current_sdk_ver $older_sdk_vers; do
3390         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3391         if test -d $t; then
3392             sysroot=$t
3393             break
3394         fi
3395     done
3397     if test -z "$sysroot"; then
3398         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3399     fi
3401     AC_MSG_RESULT($sysroot)
3403     stdlib="-stdlib=libc++"
3405     AC_MSG_CHECKING([what C compiler to use])
3406     CC="`xcrun -find clang`"
3407     CC_BASE=`first_arg_basename "$CC"`
3408     CC+=" -arch $host_cpu_for_clang -isysroot $sysroot $versionmin"
3409     AC_MSG_RESULT([$CC])
3411     AC_MSG_CHECKING([what C++ compiler to use])
3412     CXX="`xcrun -find clang++`"
3413     CXX_BASE=`first_arg_basename "$CXX"`
3414     CXX+=" -arch $host_cpu_for_clang $stdlib -isysroot $sysroot $versionmin"
3415     AC_MSG_RESULT([$CXX])
3417     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3418     AR=`xcrun -find ar`
3419     NM=`xcrun -find nm`
3420     STRIP=`xcrun -find strip`
3421     LIBTOOL=`xcrun -find libtool`
3422     RANLIB=`xcrun -find ranlib`
3425 AC_MSG_CHECKING([whether to treat the installation as read-only])
3427 if test $_os = Darwin; then
3428     enable_readonly_installset=yes
3429 elif test "$enable_extensions" != yes; then
3430     enable_readonly_installset=yes
3432 if test "$enable_readonly_installset" = yes; then
3433     AC_MSG_RESULT([yes])
3434     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3435 else
3436     AC_MSG_RESULT([no])
3439 dnl ===================================================================
3440 dnl Structure of install set
3441 dnl ===================================================================
3443 if test $_os = Darwin; then
3444     LIBO_BIN_FOLDER=MacOS
3445     LIBO_ETC_FOLDER=Resources
3446     LIBO_LIBEXEC_FOLDER=MacOS
3447     LIBO_LIB_FOLDER=Frameworks
3448     LIBO_LIB_PYUNO_FOLDER=Resources
3449     LIBO_SHARE_FOLDER=Resources
3450     LIBO_SHARE_HELP_FOLDER=Resources/help
3451     LIBO_SHARE_JAVA_FOLDER=Resources/java
3452     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3453     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3454     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3455     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3456     LIBO_URE_BIN_FOLDER=MacOS
3457     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3458     LIBO_URE_LIB_FOLDER=Frameworks
3459     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3460     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3461 elif test $_os = WINNT; then
3462     LIBO_BIN_FOLDER=program
3463     LIBO_ETC_FOLDER=program
3464     LIBO_LIBEXEC_FOLDER=program
3465     LIBO_LIB_FOLDER=program
3466     LIBO_LIB_PYUNO_FOLDER=program
3467     LIBO_SHARE_FOLDER=share
3468     LIBO_SHARE_HELP_FOLDER=help
3469     LIBO_SHARE_JAVA_FOLDER=program/classes
3470     LIBO_SHARE_PRESETS_FOLDER=presets
3471     LIBO_SHARE_READMES_FOLDER=readmes
3472     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3473     LIBO_SHARE_SHELL_FOLDER=program/shell
3474     LIBO_URE_BIN_FOLDER=program
3475     LIBO_URE_ETC_FOLDER=program
3476     LIBO_URE_LIB_FOLDER=program
3477     LIBO_URE_MISC_FOLDER=program
3478     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3479 else
3480     LIBO_BIN_FOLDER=program
3481     LIBO_ETC_FOLDER=program
3482     LIBO_LIBEXEC_FOLDER=program
3483     LIBO_LIB_FOLDER=program
3484     LIBO_LIB_PYUNO_FOLDER=program
3485     LIBO_SHARE_FOLDER=share
3486     LIBO_SHARE_HELP_FOLDER=help
3487     LIBO_SHARE_JAVA_FOLDER=program/classes
3488     LIBO_SHARE_PRESETS_FOLDER=presets
3489     LIBO_SHARE_READMES_FOLDER=readmes
3490     if test "$enable_fuzzers" != yes; then
3491         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3492     else
3493         LIBO_SHARE_RESOURCE_FOLDER=resource
3494     fi
3495     LIBO_SHARE_SHELL_FOLDER=program/shell
3496     LIBO_URE_BIN_FOLDER=program
3497     LIBO_URE_ETC_FOLDER=program
3498     LIBO_URE_LIB_FOLDER=program
3499     LIBO_URE_MISC_FOLDER=program
3500     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3502 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3503 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3504 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3505 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3506 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3507 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3508 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3509 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3510 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3511 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3512 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3513 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3514 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3515 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3516 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3517 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3519 # Not all of them needed in config_host.mk, add more if need arises
3520 AC_SUBST(LIBO_BIN_FOLDER)
3521 AC_SUBST(LIBO_ETC_FOLDER)
3522 AC_SUBST(LIBO_LIB_FOLDER)
3523 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3524 AC_SUBST(LIBO_SHARE_FOLDER)
3525 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3526 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3527 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3528 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3529 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3530 AC_SUBST(LIBO_URE_BIN_FOLDER)
3531 AC_SUBST(LIBO_URE_ETC_FOLDER)
3532 AC_SUBST(LIBO_URE_LIB_FOLDER)
3533 AC_SUBST(LIBO_URE_MISC_FOLDER)
3534 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3536 dnl ===================================================================
3537 dnl Windows specific tests and stuff
3538 dnl ===================================================================
3540 reg_get_value()
3542     # Return value: $regvalue
3543     unset regvalue
3545     if test "$build_os" = "wsl"; then
3546         regvalue=$($BUILDDIR/solenv/wsl/wsl-lo-helper.exe --read-registry $1 "$2" 2>/dev/null)
3547         return
3548     fi
3550     local _regentry="/proc/registry${1}/${2}"
3551     if test -f "$_regentry"; then
3552         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3553         # Registry keys read via /proc/registry* are always \0 terminated!
3554         local _regvalue=$(tr -d '\0' < "$_regentry")
3555         if test $? -eq 0; then
3556             regvalue=$_regvalue
3557         fi
3558     fi
3561 # Get a value from the 32-bit side of the Registry
3562 reg_get_value_32()
3564     reg_get_value "32" "$1"
3567 # Get a value from the 64-bit side of the Registry
3568 reg_get_value_64()
3570     reg_get_value "64" "$1"
3573 case "$host_os" in
3574 cygwin*|wsl*)
3575     COM=MSC
3576     USING_X11=
3577     OS=WNT
3578     RTL_OS=Windows
3579     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
3580         P_SEP=";"
3581     else
3582         P_SEP=:
3583     fi
3584     case "$host_cpu" in
3585     x86_64)
3586         CPUNAME=X86_64
3587         RTL_ARCH=X86_64
3588         PLATFORMID=windows_x86_64
3589         WINDOWS_X64=1
3590         SCPDEFS="$SCPDEFS -DWINDOWS_X64"
3591         WIN_HOST_ARCH="x64"
3592         WIN_MULTI_ARCH="x86"
3593         WIN_HOST_BITS=64
3594         ;;
3595     i*86)
3596         CPUNAME=INTEL
3597         RTL_ARCH=x86
3598         PLATFORMID=windows_x86
3599         WIN_HOST_ARCH="x86"
3600         WIN_HOST_BITS=32
3601         WIN_OTHER_ARCH="x64"
3602         ;;
3603     aarch64)
3604         CPUNAME=AARCH64
3605         RTL_ARCH=AARCH64
3606         PLATFORMID=windows_aarch64
3607         WINDOWS_X64=1
3608         SCPDEFS="$SCPDEFS -DWINDOWS_AARCH64"
3609         WIN_HOST_ARCH="arm64"
3610         WIN_HOST_BITS=64
3611         with_ucrt_dir=no
3612         ;;
3613     *)
3614         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
3615         ;;
3616     esac
3618     case "$build_cpu" in
3619     x86_64) WIN_BUILD_ARCH="x64" ;;
3620     i*86) WIN_BUILD_ARCH="x86" ;;
3621     aarch64) WIN_BUILD_ARCH="arm64" ;;
3622     *)
3623         AC_MSG_ERROR([Unsupported build_cpu $build_cpu for host_os $host_os])
3624         ;;
3625     esac
3627     SCPDEFS="$SCPDEFS -D_MSC_VER"
3628     ;;
3629 esac
3631 # multi-arch is an arch, which can execute on the host (x86 on x64), while
3632 # other-arch won't, but wouldn't break the build (x64 on x86).
3633 if test -n "$WIN_MULTI_ARCH" -a -n "$WIN_OTHER_ARCH"; then
3634     AC_MSG_ERROR([Broken configure.ac file: can't have set \$WIN_MULTI_ARCH and $WIN_OTHER_ARCH])
3638 if test "$_os" = "iOS" -o "$build_cpu" != "$host_cpu"; then
3639     # To allow building Windows multi-arch releases without cross-tooling
3640     if test -z "$WIN_MULTI_ARCH" -a -z "$WIN_OTHER_ARCH"; then
3641         cross_compiling="yes"
3642     fi
3644 if test "$cross_compiling" = "yes"; then
3645     export CROSS_COMPILING=TRUE
3646 else
3647     CROSS_COMPILING=
3648     BUILD_TYPE="$BUILD_TYPE NATIVE"
3650 AC_SUBST(CROSS_COMPILING)
3652 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3653 # NOTE: must _not_ be used for bundled external libraries!
3654 ISYSTEM=
3655 if test "$GCC" = "yes"; then
3656     AC_MSG_CHECKING( for -isystem )
3657     save_CFLAGS=$CFLAGS
3658     CFLAGS="$CFLAGS -Werror"
3659     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3660     CFLAGS=$save_CFLAGS
3661     if test -n "$ISYSTEM"; then
3662         AC_MSG_RESULT(yes)
3663     else
3664         AC_MSG_RESULT(no)
3665     fi
3667 if test -z "$ISYSTEM"; then
3668     # fall back to using -I
3669     ISYSTEM=-I
3671 AC_SUBST(ISYSTEM)
3673 dnl ===================================================================
3674 dnl  Check which Visual Studio compiler is used
3675 dnl ===================================================================
3677 map_vs_year_to_version()
3679     # Return value: $vsversion
3681     unset vsversion
3683     case $1 in
3684     2019)
3685         vsversion=16;;
3686     *)
3687         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3688     esac
3691 vs_versions_to_check()
3693     # Args: $1 (optional) : versions to check, in the order of preference
3694     # Return value: $vsversions
3696     unset vsversions
3698     if test -n "$1"; then
3699         map_vs_year_to_version "$1"
3700         vsversions=$vsversion
3701     else
3702         # We accept only 2019
3703         vsversions="16"
3704     fi
3707 win_get_env_from_vsvars32bat()
3709     local WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3710     # Also seems to be located in another directory under the same name: vsvars32.bat
3711     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3712     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3713     # use 'echo.%ENV%' syntax (instead of 'echo %ENV%') to avoid outputting "ECHO is off." in case when ENV is empty or a space
3714     printf '@setlocal\r\n@echo.%%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3715     local result
3716     if test "$build_os" = "wsl"; then
3717         result=$(cd /mnt/c && cmd.exe /c $(wslpath -w $WRAPPERBATCHFILEPATH) | tr -d '\r')
3718     else
3719         chmod +x $WRAPPERBATCHFILEPATH
3720         result=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3721     fi
3722     rm -f $WRAPPERBATCHFILEPATH
3723     printf '%s' "$result"
3726 find_ucrt()
3728     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3729     if test -n "$regvalue"; then
3730         PathFormat "$regvalue"
3731         UCRTSDKDIR=$formatted_path_unix
3732         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3733         UCRTVERSION=$regvalue
3734         # Rest if not exist
3735         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3736           UCRTSDKDIR=
3737         fi
3738     fi
3739     if test -z "$UCRTSDKDIR"; then
3740         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3741         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3742         if test -f "$ide_env_file"; then
3743             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3744             UCRTSDKDIR=$formatted_path
3745             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3746             dnl Hack needed at least by tml:
3747             if test "$UCRTVERSION" = 10.0.15063.0 \
3748                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3749                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3750             then
3751                 UCRTVERSION=10.0.14393.0
3752             fi
3753         else
3754           AC_MSG_ERROR([No UCRT found])
3755         fi
3756     fi
3759 find_msvc()
3761     # Find Visual C++ 2019
3762     # Args: $1 (optional) : The VS version year
3763     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3765     unset vctest vcnum vcnumwithdot vcbuildnumber
3767     vs_versions_to_check "$1"
3768     if test "$build_os" = wsl; then
3769         vswhere="$PROGRAMFILESX86"
3770     else
3771         vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3772     fi
3773     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3774     PathFormat "$vswhere"
3775     vswhere=$formatted_path_unix
3776     for ver in $vsversions; do
3777         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3778         # Fall back to all MS products (this includes VC++ Build Tools)
3779         if ! test -n "$vswhereoutput"; then
3780             AC_MSG_CHECKING([VC++ Build Tools and similar])
3781             vswhereoutput=`$vswhere -products \* -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3782         fi
3783         if test -n "$vswhereoutput"; then
3784             PathFormat "$vswhereoutput"
3785             vctest=$formatted_path_unix
3786             break
3787         fi
3788     done
3790     if test -n "$vctest"; then
3791         vcnumwithdot="$ver.0"
3792         case "$vcnumwithdot" in
3793         16.0)
3794             vcyear=2019
3795             vcnum=160
3796             ;;
3797         esac
3798         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3800     fi
3803 test_cl_exe()
3805     AC_MSG_CHECKING([$1 compiler])
3807     CL_EXE_PATH="$2/cl.exe"
3809     if test ! -f "$CL_EXE_PATH"; then
3810         if test "$1" = "multi-arch"; then
3811             AC_MSG_WARN([no compiler (cl.exe) in $2])
3812             return 1
3813         else
3814             AC_MSG_ERROR([no compiler (cl.exe) in $2])
3815         fi
3816     fi
3818     dnl ===========================================================
3819     dnl  Check for the corresponding mspdb*.dll
3820     dnl ===========================================================
3822     # MSVC 15.0 has libraries from 14.0?
3823     mspdbnum="140"
3825     if test ! -e "$2/mspdb${mspdbnum}.dll"; then
3826         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $2, Visual Studio installation broken?])
3827     fi
3829     # The compiles has to find its shared libraries
3830     OLD_PATH="$PATH"
3831     TEMP_PATH=`cygpath -d "$2"`
3832     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3834     if ! "$CL_EXE_PATH" -? </dev/null >/dev/null 2>&1; then
3835         AC_MSG_ERROR([no compiler (cl.exe) in $2])
3836     fi
3838     PATH="$OLD_PATH"
3840     AC_MSG_RESULT([$CL_EXE_PATH])
3843 SOLARINC=
3844 MSBUILD_PATH=
3845 DEVENV=
3846 if test "$_os" = "WINNT"; then
3847     AC_MSG_CHECKING([Visual C++])
3848     find_msvc "$with_visual_studio"
3849     if test -z "$vctest"; then
3850         if test -n "$with_visual_studio"; then
3851             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
3852         else
3853             AC_MSG_ERROR([no Visual Studio 2019 installation found])
3854         fi
3855     fi
3856     AC_MSG_RESULT([])
3858     VC_PRODUCT_DIR="$vctest/VC"
3859     COMPATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber"
3861     # $WIN_OTHER_ARCH is a hack to test the x64 compiler on x86, even if it's not multi-arch
3862     if test -n "$WIN_MULTI_ARCH" -o -n "$WIN_OTHER_ARCH"; then
3863         MSVC_MULTI_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/${WIN_MULTI_ARCH}${WIN_OTHER_ARCH}"
3864         test_cl_exe "multi-arch" "$MSVC_MULTI_PATH"
3865         if test $? -ne 0; then
3866             WIN_MULTI_ARCH=""
3867             WIN_OTHER_ARCH=""
3868         fi
3869     fi
3871     if test "$WIN_BUILD_ARCH" = "$WIN_HOST_ARCH"; then
3872         MSVC_BUILD_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_BUILD_ARCH"
3873         test_cl_exe "build" "$MSVC_BUILD_PATH"
3874     fi
3876     if test "$WIN_BUILD_ARCH" != "$WIN_HOST_ARCH"; then
3877         MSVC_HOST_PATH="$COMPATH/bin/Host$WIN_BUILD_ARCH/$WIN_HOST_ARCH"
3878         test_cl_exe "host" "$MSVC_HOST_PATH"
3879     else
3880         MSVC_HOST_PATH="$MSVC_BUILD_PATH"
3881     fi
3883     AC_MSG_CHECKING([for short pathname of VC product directory])
3884     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3885     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3887     UCRTSDKDIR=
3888     UCRTVERSION=
3890     AC_MSG_CHECKING([for UCRT location])
3891     find_ucrt
3892     # find_ucrt errors out if it doesn't find it
3893     AC_MSG_RESULT([$UCRTSDKDIR ($UCRTVERSION)])
3894     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3895     ucrtincpath_formatted=$formatted_path
3896     # SOLARINC is used for external modules and must be set too.
3897     # And no, it's not sufficient to set SOLARINC only, as configure
3898     # itself doesn't honour it.
3899     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3900     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3901     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3902     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3904     AC_SUBST(UCRTSDKDIR)
3905     AC_SUBST(UCRTVERSION)
3907     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3908     # Find the proper version of MSBuild.exe to use based on the VS version
3909     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3910     if test -n "$regvalue" ; then
3911         AC_MSG_RESULT([found: $regvalue])
3912         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3913     else
3914         if test "$vcnumwithdot" = "16.0"; then
3915             if test "$WIN_BUILD_ARCH" != "x64"; then
3916                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3917             else
3918                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3919             fi
3920         else
3921             if test "$WIN_BUILD_ARCH" != "x64"; then
3922                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3923             else
3924                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3925             fi
3926         fi
3927         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3928         AC_MSG_RESULT([$regvalue])
3929     fi
3931     # Find the version of devenv.exe
3932     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3933     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3934     DEVENV_unix=$(cygpath -u "$DEVENV")
3935     if test ! -e "$DEVENV_unix"; then
3936         AC_MSG_WARN([No devenv.exe found - this is expected for VC++ Build Tools])
3937     fi
3939     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3940     dnl needed when building CLR code:
3941     if test -z "$MSVC_CXX"; then
3942         # This gives us a posix path with 8.3 filename restrictions
3943         MSVC_CXX=`win_short_path_for_make "$MSVC_HOST_PATH/cl.exe"`
3944     fi
3946     if test -z "$CC"; then
3947         CC=$MSVC_CXX
3948         CC_BASE=`first_arg_basename "$CC"`
3949     fi
3950     if test -z "$CXX"; then
3951         CXX=$MSVC_CXX
3952         CXX_BASE=`first_arg_basename "$CXX"`
3953     fi
3955     if test -n "$CC"; then
3956         # Remove /cl.exe from CC case insensitive
3957         AC_MSG_NOTICE([found Visual C++ $vcyear])
3959         main_include_dir=`cygpath -d -m "$COMPATH/Include"`
3960         CPPFLAGS="$CPPFLAGS -I$main_include_dir"
3962         PathFormat "$COMPATH"
3963         COMPATH=`win_short_path_for_make "$formatted_path"`
3965         VCVER=$vcnum
3967         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3968         # are always "better", we list them in reverse chronological order.
3970         case "$vcnum" in
3971         160)
3972             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
3973             ;;
3974         esac
3976         # The expectation is that --with-windows-sdk should not need to be used
3977         if test -n "$with_windows_sdk"; then
3978             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3979             *" "$with_windows_sdk" "*)
3980                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3981                 ;;
3982             *)
3983                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $vcyear])
3984                 ;;
3985             esac
3986         fi
3988         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3989         ac_objext=obj
3990         ac_exeext=exe
3992     else
3993         AC_MSG_ERROR([Visual C++ not found after all, huh])
3994     fi
3996     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.5])
3997     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3998         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
3999         // between Visual Studio versions and _MSC_VER:
4000         #if _MSC_VER < 1925
4001         #error
4002         #endif
4003     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
4005     # Check for 64-bit (cross-)compiler to use to build the 64-bit
4006     # version of the Explorer extension (and maybe other small
4007     # bits, too) needed when installing a 32-bit LibreOffice on a
4008     # 64-bit OS. The 64-bit Explorer extension is a feature that
4009     # has been present since long in OOo. Don't confuse it with
4010     # building LibreOffice itself as 64-bit code.
4012     BUILD_X64=
4013     CXX_X64_BINARY=
4015     if test "$WIN_HOST_ARCH" = "x86" -a -n "$WIN_OTHER_ARCH"; then
4016         AC_MSG_CHECKING([for the libraries to build the 64-bit Explorer extensions])
4017         if test -f "$COMPATH/atlmfc/lib/x64/atls.lib" -o \
4018              -f "$COMPATH/atlmfc/lib/spectre/x64/atls.lib"
4019         then
4020             BUILD_X64=TRUE
4021             CXX_X64_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4022             AC_MSG_RESULT([found])
4023         else
4024             AC_MSG_RESULT([not found])
4025             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
4026         fi
4027     elif test "$WIN_HOST_ARCH" = "x64"; then
4028         CXX_X64_BINARY=$CXX
4029     fi
4030     AC_SUBST(BUILD_X64)
4032     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
4033     AC_SUBST(CXX_X64_BINARY)
4035     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
4036     # needed to support TWAIN scan on both 32- and 64-bit systems
4038     case "$WIN_HOST_ARCH" in
4039     x64)
4040         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
4041         if test -n "$CXX_X86_BINARY"; then
4042             BUILD_X86=TRUE
4043             AC_MSG_RESULT([preset])
4044         elif test -n "$WIN_MULTI_ARCH"; then
4045             BUILD_X86=TRUE
4046             CXX_X86_BINARY=`win_short_path_for_make "$MSVC_MULTI_PATH/cl.exe"`
4047             CXX_X86_BINARY+=" /arch:SSE"
4048             AC_MSG_RESULT([found])
4049         else
4050             AC_MSG_RESULT([not found])
4051             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
4052         fi
4053         ;;
4054     x86)
4055         BUILD_X86=TRUE
4056         CXX_X86_BINARY=$MSVC_CXX
4057         ;;
4058     esac
4059     AC_SUBST(BUILD_X86)
4060     AC_SUBST(CXX_X86_BINARY)
4062 AC_SUBST(VCVER)
4063 AC_SUBST(DEVENV)
4064 AC_SUBST(MSVC_CXX)
4066 COM_IS_CLANG=
4067 AC_MSG_CHECKING([whether the compiler is actually Clang])
4068 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4069     #ifndef __clang__
4070     you lose
4071     #endif
4072     int foo=42;
4073     ]])],
4074     [AC_MSG_RESULT([yes])
4075      COM_IS_CLANG=TRUE],
4076     [AC_MSG_RESULT([no])])
4077 AC_SUBST(COM_IS_CLANG)
4079 CC_PLAIN=$CC
4080 CLANGVER=
4081 if test "$COM_IS_CLANG" = TRUE; then
4082     AC_MSG_CHECKING([whether Clang is new enough])
4083     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
4084         #if !defined __apple_build_version__
4085         #error
4086         #endif
4087         ]])],
4088         [my_apple_clang=yes],[my_apple_clang=])
4089     if test "$my_apple_clang" = yes; then
4090         AC_MSG_RESULT([assumed yes (Apple Clang)])
4091     else
4092         if test "$_os" = WINNT; then
4093             dnl In which case, assume clang-cl:
4094             my_args="/EP /TC"
4095             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
4096             dnl clang-cl:
4097             CC_PLAIN=
4098             for i in $CC; do
4099                 case $i in
4100                 -FIIntrin.h)
4101                     ;;
4102                 *)
4103                     CC_PLAIN="$CC_PLAIN $i"
4104                     ;;
4105                 esac
4106             done
4107         else
4108             my_args="-E -P"
4109         fi
4110         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
4111         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
4112         CLANGVER=`echo $clang_version \
4113             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
4114         if test "$CLANGVER" -ge 50002; then
4115             AC_MSG_RESULT([yes ($clang_version)])
4116         else
4117             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
4118         fi
4119         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
4120         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
4121     fi
4124 SHOWINCLUDES_PREFIX=
4125 if test "$_os" = WINNT; then
4126     dnl We need to guess the prefix of the -showIncludes output, it can be
4127     dnl localized
4128     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
4129     echo "#include <stdlib.h>" > conftest.c
4130     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
4131         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
4132     rm -f conftest.c conftest.obj
4133     if test -z "$SHOWINCLUDES_PREFIX"; then
4134         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
4135     else
4136         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
4137     fi
4139 AC_SUBST(SHOWINCLUDES_PREFIX)
4142 # prefix C with ccache if needed
4144 if test "$CCACHE" != ""; then
4145     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
4147     AC_LANG_PUSH([C])
4148     save_CFLAGS=$CFLAGS
4149     CFLAGS="$CFLAGS --ccache-skip -O2"
4150     dnl an empty program will do, we're checking the compiler flags
4151     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
4152                       [use_ccache=yes], [use_ccache=no])
4153     CFLAGS=$save_CFLAGS
4154     if test $use_ccache = yes; then
4155         AC_MSG_RESULT([yes])
4156     else
4157         CC="$CCACHE $CC"
4158         CC_BASE="ccache $CC_BASE"
4159         AC_MSG_RESULT([no])
4160     fi
4161     AC_LANG_POP([C])
4164 # ===================================================================
4165 # check various GCC options that Clang does not support now but maybe
4166 # will somewhen in the future, check them even for GCC, so that the
4167 # flags are set
4168 # ===================================================================
4170 HAVE_GCC_GGDB2=
4171 if test "$GCC" = "yes"; then
4172     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
4173     save_CFLAGS=$CFLAGS
4174     CFLAGS="$CFLAGS -Werror -ggdb2"
4175     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
4176     CFLAGS=$save_CFLAGS
4177     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
4178         AC_MSG_RESULT([yes])
4179     else
4180         AC_MSG_RESULT([no])
4181     fi
4183     if test "$host_cpu" = "m68k"; then
4184         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
4185         save_CFLAGS=$CFLAGS
4186         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
4187         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
4188         CFLAGS=$save_CFLAGS
4189         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
4190             AC_MSG_RESULT([yes])
4191         else
4192             AC_MSG_ERROR([no])
4193         fi
4194     fi
4196 AC_SUBST(HAVE_GCC_GGDB2)
4198 dnl ===================================================================
4199 dnl  Test the gcc version
4200 dnl ===================================================================
4201 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
4202     AC_MSG_CHECKING([the GCC version])
4203     _gcc_version=`$CC -dumpversion`
4204     gcc_full_version=$(printf '%s' "$_gcc_version" | \
4205         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
4206     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
4208     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
4210     if test "$gcc_full_version" -lt 70000; then
4211         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
4212     fi
4213 else
4214     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
4215     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
4216     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
4217     # (which reports itself as GCC 4.2.1).
4218     GCC_VERSION=
4220 AC_SUBST(GCC_VERSION)
4222 dnl Set the ENABLE_DBGUTIL variable
4223 dnl ===================================================================
4224 AC_MSG_CHECKING([whether to build with additional debug utilities])
4225 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
4226     ENABLE_DBGUTIL="TRUE"
4227     # this is an extra var so it can have different default on different MSVC
4228     # versions (in case there are version specific problems with it)
4229     MSVC_USE_DEBUG_RUNTIME="TRUE"
4231     AC_MSG_RESULT([yes])
4232     # cppunit and graphite expose STL in public headers
4233     if test "$with_system_cppunit" = "yes"; then
4234         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
4235     else
4236         with_system_cppunit=no
4237     fi
4238     if test "$with_system_graphite" = "yes"; then
4239         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
4240     else
4241         with_system_graphite=no
4242     fi
4243     if test "$with_system_orcus" = "yes"; then
4244         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
4245     else
4246         with_system_orcus=no
4247     fi
4248     if test "$with_system_libcmis" = "yes"; then
4249         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
4250     else
4251         with_system_libcmis=no
4252     fi
4253     if test "$with_system_hunspell" = "yes"; then
4254         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
4255     else
4256         with_system_hunspell=no
4257     fi
4258     if test "$with_system_gpgmepp" = "yes"; then
4259         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
4260     else
4261         with_system_gpgmepp=no
4262     fi
4263     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
4264     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
4265     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
4266     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
4267     # of those two is using the system variant:
4268     if test "$with_system_libnumbertext" = "yes"; then
4269         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
4270     else
4271         with_system_libnumbertext=no
4272     fi
4273     if test "$with_system_libwps" = "yes"; then
4274         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
4275     else
4276         with_system_libwps=no
4277     fi
4278 else
4279     ENABLE_DBGUTIL=""
4280     MSVC_USE_DEBUG_RUNTIME=""
4281     AC_MSG_RESULT([no])
4283 AC_SUBST(ENABLE_DBGUTIL)
4284 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
4286 dnl Set the ENABLE_DEBUG variable.
4287 dnl ===================================================================
4288 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
4289     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
4291 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
4292     if test -z "$libo_fuzzed_enable_debug"; then
4293         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
4294     else
4295         AC_MSG_NOTICE([Resetting --enable-debug=yes])
4296         enable_debug=yes
4297     fi
4300 AC_MSG_CHECKING([whether to do a debug build])
4301 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
4302     ENABLE_DEBUG="TRUE"
4303     if test -n "$ENABLE_DBGUTIL" ; then
4304         AC_MSG_RESULT([yes (dbgutil)])
4305     else
4306         AC_MSG_RESULT([yes])
4307     fi
4308 else
4309     ENABLE_DEBUG=""
4310     AC_MSG_RESULT([no])
4312 AC_SUBST(ENABLE_DEBUG)
4314 dnl ===================================================================
4315 dnl Select the linker to use (gold/lld/ld.bfd).
4316 dnl This is done only after compiler checks (need to know if Clang is
4317 dnl used, for different defaults) and after checking if a debug build
4318 dnl is wanted (non-debug builds get the default linker if not explicitly
4319 dnl specified otherwise).
4320 dnl All checks for linker features/options should come after this.
4321 dnl ===================================================================
4322 check_use_ld()
4324     use_ld=-fuse-ld=${1%%:*}
4325     use_ld_path=${1#*:}
4326     if test "$use_ld_path" != "$1"; then
4327         use_ld="$use_ld --ld-path=$use_ld_path"
4328     fi
4329     use_ld_fail_if_error=$2
4330     use_ld_ok=
4331     AC_MSG_CHECKING([for $use_ld linker support])
4332     use_ld_ldflags_save="$LDFLAGS"
4333     LDFLAGS="$LDFLAGS $use_ld"
4334     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4335 #include <stdio.h>
4336         ],[
4337 printf ("hello world\n");
4338         ])], USE_LD=$use_ld, [])
4339     if test -n "$USE_LD"; then
4340         AC_MSG_RESULT( yes )
4341         use_ld_ok=yes
4342     else
4343         if test -n "$use_ld_fail_if_error"; then
4344             AC_MSG_ERROR( no )
4345         else
4346             AC_MSG_RESULT( no )
4347         fi
4348     fi
4349     if test -n "$use_ld_ok"; then
4350         dnl keep the value of LDFLAGS
4351         return 0
4352     fi
4353     LDFLAGS="$use_ld_ldflags_save"
4354     return 1
4356 USE_LD=
4357 if test "$enable_ld" != "no"; then
4358     if test "$GCC" = "yes"; then
4359         if test -n "$enable_ld"; then
4360             check_use_ld "$enable_ld" fail_if_error
4361         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4362             dnl non-debug builds default to the default linker
4363             true
4364         elif test -n "$COM_IS_CLANG"; then
4365             check_use_ld lld
4366             if test $? -ne 0; then
4367                 check_use_ld gold
4368             fi
4369         else
4370             # For gcc first try gold, new versions also support lld.
4371             check_use_ld gold
4372             if test $? -ne 0; then
4373                 check_use_ld lld
4374             fi
4375         fi
4376         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4377         rm conftest.out
4378         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4379         if test -z "$ld_used"; then
4380             ld_used="unknown"
4381         fi
4382         AC_MSG_CHECKING([for linker that is used])
4383         AC_MSG_RESULT([$ld_used])
4384         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4385             if echo "$ld_used" | grep -q "^GNU ld"; then
4386                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4387                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4388             fi
4389         fi
4390     else
4391         if test "$enable_ld" = "yes"; then
4392             AC_MSG_ERROR([--enable-ld not supported])
4393         fi
4394     fi
4396 AC_SUBST(USE_LD)
4398 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4399 if test "$GCC" = "yes"; then
4400     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4401     bsymbolic_functions_ldflags_save=$LDFLAGS
4402     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4403     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4404 #include <stdio.h>
4405         ],[
4406 printf ("hello world\n");
4407         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4408     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4409         AC_MSG_RESULT( found )
4410     else
4411         AC_MSG_RESULT( not found )
4412     fi
4413     LDFLAGS=$bsymbolic_functions_ldflags_save
4415 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4417 LD_GC_SECTIONS=
4418 if test "$GCC" = "yes"; then
4419     for flag in "--gc-sections" "-dead_strip"; do
4420         AC_MSG_CHECKING([for $flag linker support])
4421         ldflags_save=$LDFLAGS
4422         LDFLAGS="$LDFLAGS -Wl,$flag"
4423         AC_LINK_IFELSE([AC_LANG_PROGRAM([
4424 #include <stdio.h>
4425             ],[
4426 printf ("hello world\n");
4427             ])],[
4428             LD_GC_SECTIONS="-Wl,$flag"
4429             AC_MSG_RESULT( found )
4430             ], [
4431             AC_MSG_RESULT( not found )
4432             ])
4433         LDFLAGS=$ldflags_save
4434         if test -n "$LD_GC_SECTIONS"; then
4435             break
4436         fi
4437     done
4439 AC_SUBST(LD_GC_SECTIONS)
4441 HAVE_GSPLIT_DWARF=
4442 if test "$enable_split_debug" != no; then
4443     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4444     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4445         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4446         save_CFLAGS=$CFLAGS
4447         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4448         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4449         CFLAGS=$save_CFLAGS
4450         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4451             AC_MSG_RESULT([yes])
4452         else
4453             if test "$enable_split_debug" = yes; then
4454                 AC_MSG_ERROR([no])
4455             else
4456                 AC_MSG_RESULT([no])
4457             fi
4458         fi
4459     fi
4460     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4461         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4462         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4463     fi
4465 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4467 HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=
4468 AC_MSG_CHECKING([whether $CC_BASE supports -Xclang -debug-info-kind=constructor])
4469 save_CFLAGS=$CFLAGS
4470 CFLAGS="$CFLAGS -Werror -Xclang -debug-info-kind=constructor"
4471 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR=TRUE ],[])
4472 CFLAGS=$save_CFLAGS
4473 if test "$HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR" = "TRUE"; then
4474     AC_MSG_RESULT([yes])
4475 else
4476     AC_MSG_RESULT([no])
4478 AC_SUBST(HAVE_CLANG_DEBUG_INFO_KIND_CONSTRUCTOR)
4480 ENABLE_GDB_INDEX=
4481 if test "$enable_gdb_index" != "no"; then
4482     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4483     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4484         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4485         save_CFLAGS=$CFLAGS
4486         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4487         have_ggnu_pubnames=
4488         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4489         if test "$have_ggnu_pubnames" != "TRUE"; then
4490             if test "$enable_gdb_index" = "yes"; then
4491                 AC_MSG_ERROR([no, --enable-gdb-index not supported])
4492             else
4493                 AC_MSG_RESULT( no )
4494             fi
4495         else
4496             AC_MSG_RESULT( yes )
4497             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4498             ldflags_save=$LDFLAGS
4499             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4500             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4501 #include <stdio.h>
4502                 ],[
4503 printf ("hello world\n");
4504                 ])], ENABLE_GDB_INDEX=TRUE, [])
4505             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4506                 AC_MSG_RESULT( yes )
4507             else
4508                 if test "$enable_gdb_index" = "yes"; then
4509                     AC_MSG_ERROR( no )
4510                 else
4511                     AC_MSG_RESULT( no )
4512                 fi
4513             fi
4514             LDFLAGS=$ldflags_save
4515         fi
4516         CFLAGS=$save_CFLAGS
4517         fi
4518     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4519         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4520         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4521     fi
4523 AC_SUBST(ENABLE_GDB_INDEX)
4525 if test -z "$enable_sal_log" && test "$ENABLE_DEBUG" = TRUE; then
4526     enable_sal_log=yes
4528 if test "$enable_sal_log" = yes; then
4529     ENABLE_SAL_LOG=TRUE
4531 AC_SUBST(ENABLE_SAL_LOG)
4533 dnl Check for enable symbols option
4534 dnl ===================================================================
4535 AC_MSG_CHECKING([whether to generate debug information])
4536 if test -z "$enable_symbols"; then
4537     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4538         enable_symbols=yes
4539     else
4540         enable_symbols=no
4541     fi
4543 if test "$enable_symbols" = yes; then
4544     ENABLE_SYMBOLS_FOR=all
4545     AC_MSG_RESULT([yes])
4546 elif test "$enable_symbols" = no; then
4547     ENABLE_SYMBOLS_FOR=
4548     AC_MSG_RESULT([no])
4549 else
4550     # Selective debuginfo.
4551     ENABLE_SYMBOLS_FOR="$enable_symbols"
4552     AC_MSG_RESULT([for "$enable_symbols"])
4554 AC_SUBST(ENABLE_SYMBOLS_FOR)
4556 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4557     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4558     AC_MSG_CHECKING([whether enough memory is available for linking])
4559     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4560     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4561     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4562         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4563     else
4564         AC_MSG_RESULT([yes])
4565     fi
4568 ENABLE_OPTIMIZED=
4569 ENABLE_OPTIMIZED_DEBUG=
4570 AC_MSG_CHECKING([whether to compile with optimization flags])
4571 if test -z "$enable_optimized"; then
4572     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4573         enable_optimized=no
4574     else
4575         enable_optimized=yes
4576     fi
4578 if test "$enable_optimized" = yes; then
4579     ENABLE_OPTIMIZED=TRUE
4580     AC_MSG_RESULT([yes])
4581 elif test "$enable_optimized" = debug; then
4582     ENABLE_OPTIMIZED_DEBUG=TRUE
4583     AC_MSG_RESULT([yes (debug)])
4584     HAVE_GCC_OG=
4585     if test "$GCC" = "yes"; then
4586         AC_MSG_CHECKING([whether $CC_BASE supports -Og])
4587         save_CFLAGS=$CFLAGS
4588         CFLAGS="$CFLAGS -Werror -Og"
4589         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[])
4590         CFLAGS=$save_CFLAGS
4591         if test "$HAVE_GCC_OG" = "TRUE"; then
4592             AC_MSG_RESULT([yes])
4593         else
4594             AC_MSG_RESULT([no])
4595         fi
4596     fi
4597     if test -z "$HAVE_GCC_OG"; then
4598         AC_MSG_ERROR([The compiler does not support optimizations suitable for debugging.])
4599     fi
4600 else
4601     AC_MSG_RESULT([no])
4603 AC_SUBST(ENABLE_OPTIMIZED)
4604 AC_SUBST(ENABLE_OPTIMIZED_DEBUG)
4607 # determine CPUNAME, OS, ...
4608 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4610 case "$host_os" in
4612 aix*)
4613     COM=GCC
4614     CPUNAME=POWERPC
4615     USING_X11=TRUE
4616     OS=AIX
4617     RTL_OS=AIX
4618     RTL_ARCH=PowerPC
4619     PLATFORMID=aix_powerpc
4620     P_SEP=:
4621     ;;
4623 cygwin*|wsl*)
4624     # Already handled
4625     ;;
4627 darwin*|macos*)
4628     COM=GCC
4629     USING_X11=
4630     OS=MACOSX
4631     RTL_OS=MacOSX
4632     P_SEP=:
4634     case "$host_cpu" in
4635     aarch64|arm64)
4636         if test "$enable_ios_simulator" = "yes"; then
4637             OS=iOS
4638         else
4639             CPUNAME=AARCH64
4640             RTL_ARCH=AARCH64
4641             PLATFORMID=macosx_aarch64
4642         fi
4643         ;;
4644     x86_64)
4645         if test "$enable_ios_simulator" = "yes"; then
4646             OS=iOS
4647         fi
4648         CPUNAME=X86_64
4649         RTL_ARCH=X86_64
4650         PLATFORMID=macosx_x86_64
4651         ;;
4652     *)
4653         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4654         ;;
4655     esac
4656     ;;
4658 ios*)
4659     COM=GCC
4660     USING_X11=
4661     OS=iOS
4662     RTL_OS=iOS
4663     P_SEP=:
4665     case "$host_cpu" in
4666     aarch64|arm64)
4667         if test "$enable_ios_simulator" = "yes"; then
4668             AC_MSG_ERROR([iOS simulator is only available in macOS not iOS])
4669         fi
4670         ;;
4671     *)
4672         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4673         ;;
4674     esac
4675     CPUNAME=AARCH64
4676     RTL_ARCH=AARCH64
4677     PLATFORMID=ios_arm64
4678     ;;
4680 dragonfly*)
4681     COM=GCC
4682     USING_X11=TRUE
4683     OS=DRAGONFLY
4684     RTL_OS=DragonFly
4685     P_SEP=:
4687     case "$host_cpu" in
4688     i*86)
4689         CPUNAME=INTEL
4690         RTL_ARCH=x86
4691         PLATFORMID=dragonfly_x86
4692         ;;
4693     x86_64)
4694         CPUNAME=X86_64
4695         RTL_ARCH=X86_64
4696         PLATFORMID=dragonfly_x86_64
4697         ;;
4698     *)
4699         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4700         ;;
4701     esac
4702     ;;
4704 freebsd*)
4705     COM=GCC
4706     USING_X11=TRUE
4707     RTL_OS=FreeBSD
4708     OS=FREEBSD
4709     P_SEP=:
4711     case "$host_cpu" in
4712     aarch64)
4713         CPUNAME=AARCH64
4714         PLATFORMID=freebsd_aarch64
4715         RTL_ARCH=AARCH64
4716         ;;
4717     i*86)
4718         CPUNAME=INTEL
4719         RTL_ARCH=x86
4720         PLATFORMID=freebsd_x86
4721         ;;
4722     x86_64|amd64)
4723         CPUNAME=X86_64
4724         RTL_ARCH=X86_64
4725         PLATFORMID=freebsd_x86_64
4726         ;;
4727     powerpc64)
4728         CPUNAME=POWERPC64
4729         RTL_ARCH=PowerPC_64
4730         PLATFORMID=freebsd_powerpc64
4731         ;;
4732     powerpc|powerpcspe)
4733         CPUNAME=POWERPC
4734         RTL_ARCH=PowerPC
4735         PLATFORMID=freebsd_powerpc
4736         ;;
4737     *)
4738         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4739         ;;
4740     esac
4741     ;;
4743 haiku*)
4744     COM=GCC
4745     USING_X11=
4746     GUIBASE=haiku
4747     RTL_OS=Haiku
4748     OS=HAIKU
4749     P_SEP=:
4751     case "$host_cpu" in
4752     i*86)
4753         CPUNAME=INTEL
4754         RTL_ARCH=x86
4755         PLATFORMID=haiku_x86
4756         ;;
4757     x86_64|amd64)
4758         CPUNAME=X86_64
4759         RTL_ARCH=X86_64
4760         PLATFORMID=haiku_x86_64
4761         ;;
4762     *)
4763         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4764         ;;
4765     esac
4766     ;;
4768 kfreebsd*)
4769     COM=GCC
4770     USING_X11=TRUE
4771     OS=LINUX
4772     RTL_OS=kFreeBSD
4773     P_SEP=:
4775     case "$host_cpu" in
4777     i*86)
4778         CPUNAME=INTEL
4779         RTL_ARCH=x86
4780         PLATFORMID=kfreebsd_x86
4781         ;;
4782     x86_64)
4783         CPUNAME=X86_64
4784         RTL_ARCH=X86_64
4785         PLATFORMID=kfreebsd_x86_64
4786         ;;
4787     *)
4788         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4789         ;;
4790     esac
4791     ;;
4793 linux-gnu*)
4794     COM=GCC
4795     USING_X11=TRUE
4796     OS=LINUX
4797     RTL_OS=Linux
4798     P_SEP=:
4800     case "$host_cpu" in
4802     aarch64)
4803         CPUNAME=AARCH64
4804         PLATFORMID=linux_aarch64
4805         RTL_ARCH=AARCH64
4806         EPM_FLAGS="-a arm64"
4807         ;;
4808     alpha)
4809         CPUNAME=AXP
4810         RTL_ARCH=ALPHA
4811         PLATFORMID=linux_alpha
4812         ;;
4813     arm*)
4814         CPUNAME=ARM
4815         EPM_FLAGS="-a arm"
4816         RTL_ARCH=ARM_EABI
4817         PLATFORMID=linux_arm_eabi
4818         case "$host_cpu" in
4819         arm*-linux)
4820             RTL_ARCH=ARM_OABI
4821             PLATFORMID=linux_arm_oabi
4822             ;;
4823         esac
4824         ;;
4825     hppa)
4826         CPUNAME=HPPA
4827         RTL_ARCH=HPPA
4828         EPM_FLAGS="-a hppa"
4829         PLATFORMID=linux_hppa
4830         ;;
4831     i*86)
4832         CPUNAME=INTEL
4833         RTL_ARCH=x86
4834         PLATFORMID=linux_x86
4835         ;;
4836     ia64)
4837         CPUNAME=IA64
4838         RTL_ARCH=IA64
4839         PLATFORMID=linux_ia64
4840         ;;
4841     mips)
4842         CPUNAME=GODSON
4843         RTL_ARCH=MIPS_EB
4844         EPM_FLAGS="-a mips"
4845         PLATFORMID=linux_mips_eb
4846         ;;
4847     mips64)
4848         CPUNAME=GODSON64
4849         RTL_ARCH=MIPS64_EB
4850         EPM_FLAGS="-a mips64"
4851         PLATFORMID=linux_mips64_eb
4852         ;;
4853     mips64el)
4854         CPUNAME=GODSON64
4855         RTL_ARCH=MIPS64_EL
4856         EPM_FLAGS="-a mips64el"
4857         PLATFORMID=linux_mips64_el
4858         ;;
4859     mipsel)
4860         CPUNAME=GODSON
4861         RTL_ARCH=MIPS_EL
4862         EPM_FLAGS="-a mipsel"
4863         PLATFORMID=linux_mips_el
4864         ;;
4865     m68k)
4866         CPUNAME=M68K
4867         RTL_ARCH=M68K
4868         PLATFORMID=linux_m68k
4869         ;;
4870     powerpc)
4871         CPUNAME=POWERPC
4872         RTL_ARCH=PowerPC
4873         PLATFORMID=linux_powerpc
4874         ;;
4875     powerpc64)
4876         CPUNAME=POWERPC64
4877         RTL_ARCH=PowerPC_64
4878         PLATFORMID=linux_powerpc64
4879         ;;
4880     powerpc64le)
4881         CPUNAME=POWERPC64
4882         RTL_ARCH=PowerPC_64_LE
4883         PLATFORMID=linux_powerpc64_le
4884         ;;
4885     sparc)
4886         CPUNAME=SPARC
4887         RTL_ARCH=SPARC
4888         PLATFORMID=linux_sparc
4889         ;;
4890     sparc64)
4891         CPUNAME=SPARC64
4892         RTL_ARCH=SPARC64
4893         PLATFORMID=linux_sparc64
4894         ;;
4895     s390)
4896         CPUNAME=S390
4897         RTL_ARCH=S390
4898         PLATFORMID=linux_s390
4899         ;;
4900     s390x)
4901         CPUNAME=S390X
4902         RTL_ARCH=S390x
4903         PLATFORMID=linux_s390x
4904         ;;
4905     x86_64)
4906         CPUNAME=X86_64
4907         RTL_ARCH=X86_64
4908         PLATFORMID=linux_x86_64
4909         ;;
4910     *)
4911         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4912         ;;
4913     esac
4914     ;;
4916 linux-android*)
4917     COM=GCC
4918     USING_X11=
4919     OS=ANDROID
4920     RTL_OS=Android
4921     P_SEP=:
4923     case "$host_cpu" in
4925     arm|armel)
4926         CPUNAME=ARM
4927         RTL_ARCH=ARM_EABI
4928         PLATFORMID=android_arm_eabi
4929         ;;
4930     aarch64)
4931         CPUNAME=AARCH64
4932         RTL_ARCH=AARCH64
4933         PLATFORMID=android_aarch64
4934         ;;
4935     i*86)
4936         CPUNAME=INTEL
4937         RTL_ARCH=x86
4938         PLATFORMID=android_x86
4939         ;;
4940     x86_64)
4941         CPUNAME=X86_64
4942         RTL_ARCH=X86_64
4943         PLATFORMID=android_x86_64
4944         ;;
4945     *)
4946         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4947         ;;
4948     esac
4949     ;;
4951 *netbsd*)
4952     COM=GCC
4953     USING_X11=TRUE
4954     OS=NETBSD
4955     RTL_OS=NetBSD
4956     P_SEP=:
4958     case "$host_cpu" in
4959     i*86)
4960         CPUNAME=INTEL
4961         RTL_ARCH=x86
4962         PLATFORMID=netbsd_x86
4963         ;;
4964     powerpc)
4965         CPUNAME=POWERPC
4966         RTL_ARCH=PowerPC
4967         PLATFORMID=netbsd_powerpc
4968         ;;
4969     sparc)
4970         CPUNAME=SPARC
4971         RTL_ARCH=SPARC
4972         PLATFORMID=netbsd_sparc
4973         ;;
4974     x86_64)
4975         CPUNAME=X86_64
4976         RTL_ARCH=X86_64
4977         PLATFORMID=netbsd_x86_64
4978         ;;
4979     *)
4980         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4981         ;;
4982     esac
4983     ;;
4985 openbsd*)
4986     COM=GCC
4987     USING_X11=TRUE
4988     OS=OPENBSD
4989     RTL_OS=OpenBSD
4990     P_SEP=:
4992     case "$host_cpu" in
4993     i*86)
4994         CPUNAME=INTEL
4995         RTL_ARCH=x86
4996         PLATFORMID=openbsd_x86
4997         ;;
4998     x86_64)
4999         CPUNAME=X86_64
5000         RTL_ARCH=X86_64
5001         PLATFORMID=openbsd_x86_64
5002         ;;
5003     *)
5004         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5005         ;;
5006     esac
5007     SOLARINC="$SOLARINC -I/usr/local/include"
5008     ;;
5010 solaris*)
5011     COM=GCC
5012     USING_X11=TRUE
5013     OS=SOLARIS
5014     RTL_OS=Solaris
5015     P_SEP=:
5017     case "$host_cpu" in
5018     i*86)
5019         CPUNAME=INTEL
5020         RTL_ARCH=x86
5021         PLATFORMID=solaris_x86
5022         ;;
5023     sparc)
5024         CPUNAME=SPARC
5025         RTL_ARCH=SPARC
5026         PLATFORMID=solaris_sparc
5027         ;;
5028     sparc64)
5029         CPUNAME=SPARC64
5030         RTL_ARCH=SPARC64
5031         PLATFORMID=solaris_sparc64
5032         ;;
5033     *)
5034         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
5035         ;;
5036     esac
5037     SOLARINC="$SOLARINC -I/usr/local/include"
5038     ;;
5041     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
5042     ;;
5043 esac
5045 if test "$with_x" = "no"; then
5046     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
5049 DISABLE_GUI=""
5050 if test "$enable_gui" = "no"; then
5051     if test "$USING_X11" != TRUE; then
5052         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
5053     fi
5054     USING_X11=
5055     DISABLE_GUI=TRUE
5056     AC_DEFINE(HAVE_FEATURE_UI,0)
5057     test_cairo=yes
5059 AC_SUBST(DISABLE_GUI)
5061 WORKDIR="${BUILDDIR}/workdir"
5062 INSTDIR="${BUILDDIR}/instdir"
5063 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
5064 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
5065 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
5066 AC_SUBST(COM)
5067 AC_SUBST(CPUNAME)
5068 AC_SUBST(RTL_OS)
5069 AC_SUBST(RTL_ARCH)
5070 AC_SUBST(EPM_FLAGS)
5071 AC_SUBST(USING_X11)
5072 AC_SUBST([INSTDIR])
5073 AC_SUBST([INSTROOT])
5074 AC_SUBST([INSTROOTBASE])
5075 AC_SUBST(OS)
5076 AC_SUBST(P_SEP)
5077 AC_SUBST(WORKDIR)
5078 AC_SUBST(PLATFORMID)
5079 AC_SUBST(WINDOWS_X64)
5080 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
5082 dnl ===================================================================
5083 dnl Test which package format to use
5084 dnl ===================================================================
5085 AC_MSG_CHECKING([which package format to use])
5086 if test -n "$with_package_format" -a "$with_package_format" != no; then
5087     for i in $with_package_format; do
5088         case "$i" in
5089         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
5090             ;;
5091         *)
5092             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
5093 aix - AIX software distribution
5094 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
5095 deb - Debian software distribution
5096 pkg - Solaris software distribution
5097 rpm - RedHat software distribution
5099 LibreOffice additionally supports:
5100 archive - .tar.gz or .zip
5101 dmg - macOS .dmg
5102 installed - installation tree
5103 msi - Windows .msi
5104         ])
5105             ;;
5106         esac
5107     done
5108     # fakeroot is needed to ensure correct file ownerships/permissions
5109     # inside deb packages and tar archives created on Linux and Solaris.
5110     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
5111         AC_PATH_PROG(FAKEROOT, fakeroot, no)
5112         if test "$FAKEROOT" = "no"; then
5113             AC_MSG_ERROR(
5114                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
5115         fi
5116     fi
5117     PKGFORMAT="$with_package_format"
5118     AC_MSG_RESULT([$PKGFORMAT])
5119 else
5120     PKGFORMAT=
5121     AC_MSG_RESULT([none])
5123 AC_SUBST(PKGFORMAT)
5125 dnl ===================================================================
5126 dnl Set up a different compiler to produce tools to run on the build
5127 dnl machine when doing cross-compilation
5128 dnl ===================================================================
5130 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
5131 m4_pattern_allow([PKG_CONFIG_LIBDIR])
5132 if test "$cross_compiling" = "yes"; then
5133     AC_MSG_CHECKING([for BUILD platform configuration])
5134     echo
5135     rm -rf CONF-FOR-BUILD config_build.mk
5136     mkdir CONF-FOR-BUILD
5137     # Here must be listed all files needed when running the configure script. In particular, also
5138     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
5139     # keep them in the same order as there.
5140     (cd $SRC_ROOT && tar cf - \
5141         config.guess \
5142         bin/get_config_variables \
5143         solenv/bin/getcompver.awk \
5144         solenv/inc/langlist.mk \
5145         download.lst \
5146         config_host.mk.in \
5147         config_host_lang.mk.in \
5148         Makefile.in \
5149         bin/bffvalidator.sh.in \
5150         bin/odfvalidator.sh.in \
5151         bin/officeotron.sh.in \
5152         hardened_runtime.xcent.in \
5153         instsetoo_native/util/openoffice.lst.in \
5154         config_host/*.in \
5155         sysui/desktop/macosx/Info.plist.in \
5156         .vscode/vs-code-template.code-workspace.in \
5157         ) \
5158     | (cd CONF-FOR-BUILD && tar xf -)
5159     cp configure CONF-FOR-BUILD
5160     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
5161     (
5162     unset COM USING_X11 OS CPUNAME
5163     unset CC CXX SYSBASE CFLAGS
5164     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
5165     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
5166     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
5167     if test -n "$CC_FOR_BUILD"; then
5168         export CC="$CC_FOR_BUILD"
5169         CC_BASE=`first_arg_basename "$CC"`
5170     fi
5171     if test -n "$CXX_FOR_BUILD"; then
5172         export CXX="$CXX_FOR_BUILD"
5173         CXX_BASE=`first_arg_basename "$CXX"`
5174     fi
5175     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
5176     cd CONF-FOR-BUILD
5178     sub_conf_opts=""
5179     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
5180     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
5181     test "$with_junit" = "no" && sub_conf_opts="$sub_conf_opts --without-junit"
5182     if test -n "$ENABLE_JAVA"; then
5183         case "$_os" in
5184         iOS) sub_conf_opts="$sub_conf_opts --without-java" ;; # force it off, like it used to be
5185         Android)
5186             # Hack for Android - the build doesn't need a host JDK, so just forward to build for convenience
5187             test -n "$with_jdk_home" && sub_conf_opts="$sub_conf_opts --with-jdk-home=$with_jdk_home"
5188             ;;
5189         *)
5190             if test -z "$with_jdk_home"; then
5191                 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.])
5192             fi
5193             ;;
5194         esac
5195     else
5196         sub_conf_opts="$sub_conf_opts --without-java"
5197     fi
5198     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
5199     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
5200     test "$with_galleries" = "no" -o -z "$WITH_GALLERY_BUILD" && sub_conf_opts="$sub_conf_opts --with-galleries=no"
5201     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
5203     # Don't bother having configure look for stuff not needed for the build platform anyway
5204     ./configure \
5205         --build="$build_alias" \
5206         --disable-cups \
5207         --disable-firebird-sdbc \
5208         --disable-gpgmepp \
5209         --disable-gstreamer-1-0 \
5210         --disable-gtk3 \
5211         --disable-mariadb-sdbc \
5212         --disable-online-update \
5213         --disable-opencl \
5214         --disable-pdfimport \
5215         --disable-postgresql-sdbc \
5216         --disable-skia \
5217         --enable-icecream="$enable_icecream" \
5218         --without-doxygen \
5219         --without-webdav \
5220         --with-parallelism="$with_parallelism" \
5221         --with-theme="$with_theme" \
5222         --with-tls=openssl \
5223         $sub_conf_opts \
5224         --srcdir=$srcdir \
5225         2>&1 | sed -e 's/^/    /'
5226     if test [${PIPESTATUS[0]}] -ne 0; then
5227         AC_MSG_ERROR([Running the configure script for BUILD side failed, see CONF-FOR-BUILD/config.log])
5228     fi
5230     # filter permitted build targets
5231     PERMITTED_BUILD_TARGETS="
5232         AVMEDIA
5233         BOOST
5234         CLUCENE
5235         DBCONNECTIVITY
5236         DESKTOP
5237         DYNLOADING
5238         EPOXY
5239         EXPAT
5240         GLM
5241         GRAPHITE
5242         HARFBUZZ
5243         ICU
5244         LCMS2
5245         LIBJPEG_TURBO
5246         LIBLANGTAG
5247         LibO
5248         LIBFFI
5249         LIBPN
5250         LIBXML2
5251         LIBXSLT
5252         MDDS
5253         NATIVE
5254         OPENSSL
5255         ORCUS
5256         PYTHON
5257         SCRIPTING
5258         ZLIB
5260     # converts BUILD_TYPE and PERMITTED_BUILD_TARGETS into non-whitespace,
5261     # newlined lists, to use grep as a filter
5262     PERMITTED_BUILD_TARGETS=$(echo "$PERMITTED_BUILD_TARGETS" | sed -e '/^ *$/d' -e 's/ *//')
5263     BUILD_TARGETS="$(sed -n -e '/^export BUILD_TYPE=/ s/.*=//p' config_host.mk | tr ' ' '\n')"
5264     BUILD_TARGETS="$(echo "$BUILD_TARGETS" | grep -F "$PERMITTED_BUILD_TARGETS" | tr '\n' ' ')"
5265     sed -i -e "s/ BUILD_TYPE=.*$/ BUILD_TYPE=$BUILD_TARGETS/" config_host.mk
5267     cp config_host.mk ../config_build.mk
5268     cp config_host_lang.mk ../config_build_lang.mk
5269     mv config.log ../config.Build.log
5270     mkdir -p ../config_build
5271     mv config_host/*.h ../config_build
5273     # all these will get a _FOR_BUILD postfix
5274     DIRECT_FOR_BUILD_SETTINGS="
5275         CC
5276         CXX
5277         ILIB
5278         JAVA_HOME
5279         JAVAIFLAGS
5280         JDK
5281         LIBO_BIN_FOLDER
5282         LIBO_LIB_FOLDER
5283         LIBO_URE_LIB_FOLDER
5284         LIBO_URE_MISC_FOLDER
5285         OS
5286         SDKDIRNAME
5287         SYSTEM_LIBXML
5288         SYSTEM_LIBXSLT
5290     # these overwrite host config with build config
5291     OVERWRITING_SETTINGS="
5292         ANT
5293         ANT_HOME
5294         ANT_LIB
5295         HSQLDB_USE_JDBC_4_1
5296         JAVA_CLASSPATH_NOT_SET
5297         JAVA_SOURCE_VER
5298         JAVA_TARGET_VER
5299         JAVACFLAGS
5300         JAVACOMPILER
5301         JAVADOC
5302         JAVADOCISGJDOC
5304     # these need some special handling
5305     EXTRA_HANDLED_SETTINGS="
5306         INSTDIR
5307         INSTROOT
5308         PATH
5309         WORKDIR
5311     OLD_PATH=$PATH
5312     . ./bin/get_config_variables $DIRECT_FOR_BUILD_SETTINGS $OVERWRITING_SETTINGS $EXTRA_HANDLED_SETTINGS
5313     BUILD_PATH=$PATH
5314     PATH=$OLD_PATH
5316     line=`echo "LO_PATH_FOR_BUILD='${BUILD_PATH}'" | sed -e 's,/CONF-FOR-BUILD,,g'`
5317     echo "$line" >>build-config
5319     for V in $DIRECT_FOR_BUILD_SETTINGS; do
5320         VV='$'$V
5321         VV=`eval "echo $VV"`
5322         if test -n "$VV"; then
5323             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
5324             echo "$line" >>build-config
5325         fi
5326     done
5328     for V in $OVERWRITING_SETTINGS; do
5329         VV='$'$V
5330         VV=`eval "echo $VV"`
5331         if test -n "$VV"; then
5332             line=${V}='${'${V}:-$VV'}'
5333             echo "$line" >>build-config
5334         fi
5335     done
5337     for V in INSTDIR INSTROOT WORKDIR; do
5338         VV='$'$V
5339         VV=`eval "echo $VV"`
5340         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
5341         if test -n "$VV"; then
5342             line="${V}_FOR_BUILD='$VV'"
5343             echo "$line" >>build-config
5344         fi
5345     done
5347     )
5348     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([setup/configure for BUILD side failed, see CONF-FOR-BUILD/config.log])
5349     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])
5350     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
5351              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
5353     eval `cat CONF-FOR-BUILD/build-config`
5355     AC_MSG_RESULT([checking for BUILD platform configuration... done])
5357     rm -rf CONF-FOR-BUILD
5358 else
5359     OS_FOR_BUILD="$OS"
5360     CC_FOR_BUILD="$CC"
5361     CXX_FOR_BUILD="$CXX"
5362     INSTDIR_FOR_BUILD="$INSTDIR"
5363     INSTROOT_FOR_BUILD="$INSTROOT"
5364     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
5365     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
5366     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
5367     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
5368     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
5369     WORKDIR_FOR_BUILD="$WORKDIR"
5371 AC_SUBST(OS_FOR_BUILD)
5372 AC_SUBST(INSTDIR_FOR_BUILD)
5373 AC_SUBST(INSTROOT_FOR_BUILD)
5374 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
5375 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
5376 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
5377 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
5378 AC_SUBST(SDKDIRNAME_FOR_BUILD)
5379 AC_SUBST(WORKDIR_FOR_BUILD)
5380 AC_SUBST(CC_FOR_BUILD)
5381 AC_SUBST(CXX_FOR_BUILD)
5383 dnl ===================================================================
5384 dnl Check for syslog header
5385 dnl ===================================================================
5386 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
5388 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
5389 dnl ===================================================================
5390 AC_MSG_CHECKING([whether to turn warnings to errors])
5391 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
5392     ENABLE_WERROR="TRUE"
5393     PYTHONWARNINGS="error"
5394     AC_MSG_RESULT([yes])
5395 else
5396     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
5397         ENABLE_WERROR="TRUE"
5398         PYTHONWARNINGS="error"
5399         AC_MSG_RESULT([yes])
5400     else
5401         AC_MSG_RESULT([no])
5402     fi
5404 AC_SUBST(ENABLE_WERROR)
5405 AC_SUBST(PYTHONWARNINGS)
5407 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
5408 dnl ===================================================================
5409 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
5410 if test -z "$enable_assert_always_abort"; then
5411    if test "$ENABLE_DEBUG" = TRUE; then
5412        enable_assert_always_abort=yes
5413    else
5414        enable_assert_always_abort=no
5415    fi
5417 if test "$enable_assert_always_abort" = "yes"; then
5418     ASSERT_ALWAYS_ABORT="TRUE"
5419     AC_MSG_RESULT([yes])
5420 else
5421     ASSERT_ALWAYS_ABORT="FALSE"
5422     AC_MSG_RESULT([no])
5424 AC_SUBST(ASSERT_ALWAYS_ABORT)
5426 # Determine whether to use ooenv for the instdir installation
5427 # ===================================================================
5428 if test $_os != "WINNT" -a $_os != "Darwin"; then
5429     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
5430     if test -z "$enable_ooenv"; then
5431         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
5432             enable_ooenv=yes
5433         else
5434             enable_ooenv=no
5435         fi
5436     fi
5437     if test "$enable_ooenv" = "no"; then
5438         AC_MSG_RESULT([no])
5439     else
5440         ENABLE_OOENV="TRUE"
5441         AC_MSG_RESULT([yes])
5442     fi
5444 AC_SUBST(ENABLE_OOENV)
5446 if test "$USING_X11" != TRUE; then
5447     # be sure to do not mess with unneeded stuff
5448     test_randr=no
5449     test_xrender=no
5450     test_cups=no
5451     test_dbus=no
5452     build_gstreamer_1_0=no
5453     test_kf5=no
5454     test_qt5=no
5455     test_gtk3_kde5=no
5456     enable_cairo_canvas=no
5459 if test "$OS" = "HAIKU"; then
5460     enable_cairo_canvas=yes
5461     test_kf5=yes
5464 if test "$test_kf5" = "yes" -a "$enable_kde5" = "yes"; then
5465     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!])
5466     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!"
5467     enable_kf5=yes
5470 if test "$test_kf5" = "yes"; then
5471     test_qt5=yes
5474 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
5475     if test "$enable_qt5" = "no"; then
5476         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
5477     else
5478         enable_qt5=yes
5479     fi
5482 dnl ===================================================================
5483 dnl check for cups support
5484 dnl ===================================================================
5485 ENABLE_CUPS=""
5487 if test "$enable_cups" = "no"; then
5488     test_cups=no
5491 AC_MSG_CHECKING([whether to enable CUPS support])
5492 if test "$test_cups" = "yes"; then
5493     ENABLE_CUPS="TRUE"
5494     AC_MSG_RESULT([yes])
5496     AC_MSG_CHECKING([whether cups support is present])
5497     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
5498     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
5499     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
5500         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
5501     fi
5503 else
5504     AC_MSG_RESULT([no])
5507 AC_SUBST(ENABLE_CUPS)
5509 # fontconfig checks
5510 if test "$test_fontconfig" = "yes"; then
5511     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
5512     SYSTEM_FONTCONFIG=TRUE
5513     FilterLibs "${FONTCONFIG_LIBS}"
5514     FONTCONFIG_LIBS="${filteredlibs}"
5516 AC_SUBST(FONTCONFIG_CFLAGS)
5517 AC_SUBST(FONTCONFIG_LIBS)
5518 AC_SUBST([SYSTEM_FONTCONFIG])
5520 dnl whether to find & fetch external tarballs?
5521 dnl ===================================================================
5522 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
5523    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5524        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
5525    else
5526        TARFILE_LOCATION="$LODE_HOME/ext_tar"
5527    fi
5529 if test -z "$TARFILE_LOCATION"; then
5530     if test -d "$SRC_ROOT/src" ; then
5531         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
5532         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
5533     fi
5534     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
5535 else
5536     AbsolutePath "$TARFILE_LOCATION"
5537     PathFormat "${absolute_path}"
5538     TARFILE_LOCATION="${formatted_path}"
5540 AC_SUBST(TARFILE_LOCATION)
5542 AC_MSG_CHECKING([whether we want to fetch tarballs])
5543 if test "$enable_fetch_external" != "no"; then
5544     if test "$with_all_tarballs" = "yes"; then
5545         AC_MSG_RESULT([yes, all of them])
5546         DO_FETCH_TARBALLS="ALL"
5547     else
5548         AC_MSG_RESULT([yes, if we use them])
5549         DO_FETCH_TARBALLS="TRUE"
5550     fi
5551 else
5552     AC_MSG_RESULT([no])
5553     DO_FETCH_TARBALLS=
5555 AC_SUBST(DO_FETCH_TARBALLS)
5557 AC_MSG_CHECKING([whether to build help])
5558 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
5559     BUILD_TYPE="$BUILD_TYPE HELP"
5560     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5561     case "$with_help" in
5562     "html")
5563         ENABLE_HTMLHELP=TRUE
5564         SCPDEFS="$SCPDEFS -DWITH_HELP"
5565         AC_MSG_RESULT([HTML])
5566         ;;
5567     "online")
5568         ENABLE_HTMLHELP=TRUE
5569         HELP_ONLINE=TRUE
5570         AC_MSG_RESULT([HTML])
5571         ;;
5572     yes)
5573         SCPDEFS="$SCPDEFS -DWITH_HELP"
5574         AC_MSG_RESULT([yes])
5575         ;;
5576     *)
5577         AC_MSG_ERROR([Unknown --with-help=$with_help])
5578         ;;
5579     esac
5580 else
5581     AC_MSG_RESULT([no])
5583 AC_SUBST([ENABLE_HTMLHELP])
5584 AC_SUBST([HELP_ONLINE])
5586 AC_MSG_CHECKING([whether to enable xapian-omega support for help])
5587 if test -n "$with_omindex" -a "$with_omindex" != "no" -a $_os != iOS -a $_os != Android; then
5588     BUILD_TYPE="$BUILD_TYPE HELP"
5589     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5590     case "$with_omindex" in
5591     "server")
5592         ENABLE_HTMLHELP=TRUE
5593         HELP_ONLINE=TRUE
5594         HELP_OMINDEX_PAGE=TRUE
5595         AC_MSG_RESULT([SERVER])
5596         ;;
5597     "noxap")
5598         ENABLE_HTMLHELP=TRUE
5599         HELP_ONLINE=TRUE
5600         HELP_OMINDEX_PAGE=FALSE
5601         AC_MSG_RESULT([NOXAP])
5602         ;;
5603     *)
5604         AC_MSG_ERROR([Unknown --with-omindex=$with_omindex])
5605         ;;
5606     esac
5607 else
5608     HELP_OMINDEX_PAGE=FALSE
5609     AC_MSG_RESULT([no])
5611 AC_SUBST([ENABLE_HTMLHELP])
5612 AC_SUBST([HELP_OMINDEX_PAGE])
5613 AC_SUBST([HELP_ONLINE])
5616 dnl Test whether to include MySpell dictionaries
5617 dnl ===================================================================
5618 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5619 if test "$with_myspell_dicts" = "yes"; then
5620     AC_MSG_RESULT([yes])
5621     WITH_MYSPELL_DICTS=TRUE
5622     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5623     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5624 else
5625     AC_MSG_RESULT([no])
5626     WITH_MYSPELL_DICTS=
5628 AC_SUBST(WITH_MYSPELL_DICTS)
5630 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5631 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5632     if test "$with_system_dicts" = yes; then
5633         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5634     fi
5635     with_system_dicts=no
5638 AC_MSG_CHECKING([whether to use dicts from external paths])
5639 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5640     AC_MSG_RESULT([yes])
5641     SYSTEM_DICTS=TRUE
5642     AC_MSG_CHECKING([for spelling dictionary directory])
5643     if test -n "$with_external_dict_dir"; then
5644         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5645     else
5646         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5647         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5648             DICT_SYSTEM_DIR=file:///usr/share/myspell
5649         fi
5650     fi
5651     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5652     AC_MSG_CHECKING([for hyphenation patterns directory])
5653     if test -n "$with_external_hyph_dir"; then
5654         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5655     else
5656         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5657     fi
5658     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5659     AC_MSG_CHECKING([for thesaurus directory])
5660     if test -n "$with_external_thes_dir"; then
5661         THES_SYSTEM_DIR=file://$with_external_thes_dir
5662     else
5663         THES_SYSTEM_DIR=file:///usr/share/mythes
5664     fi
5665     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5666 else
5667     AC_MSG_RESULT([no])
5668     SYSTEM_DICTS=
5670 AC_SUBST(SYSTEM_DICTS)
5671 AC_SUBST(DICT_SYSTEM_DIR)
5672 AC_SUBST(HYPH_SYSTEM_DIR)
5673 AC_SUBST(THES_SYSTEM_DIR)
5675 dnl ===================================================================
5676 dnl Precompiled headers.
5677 ENABLE_PCH=""
5678 AC_MSG_CHECKING([whether to enable pch feature])
5679 if test -z "$enable_pch"; then
5680     if test "$_os" = "WINNT"; then
5681         # Enabled by default on Windows.
5682         enable_pch=yes
5683     else
5684         enable_pch=no
5685     fi
5687 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5688     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5690 if test "$enable_pch" = "system"; then
5691     ENABLE_PCH="1"
5692     AC_MSG_RESULT([yes (system headers)])
5693 elif test "$enable_pch" = "base"; then
5694     ENABLE_PCH="2"
5695     AC_MSG_RESULT([yes (system and base headers)])
5696 elif test "$enable_pch" = "normal"; then
5697     ENABLE_PCH="3"
5698     AC_MSG_RESULT([yes (normal)])
5699 elif test "$enable_pch" = "full"; then
5700     ENABLE_PCH="4"
5701     AC_MSG_RESULT([yes (full)])
5702 elif test "$enable_pch" = "yes"; then
5703     # Pick a suitable default.
5704     if test "$GCC" = "yes"; then
5705         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5706         # while making the PCHs larger and rebuilds more likely.
5707         ENABLE_PCH="2"
5708         AC_MSG_RESULT([yes (system and base headers)])
5709     else
5710         # With MSVC the highest level makes a significant difference,
5711         # and it was the default when there used to be no PCH levels.
5712         ENABLE_PCH="4"
5713         AC_MSG_RESULT([yes (full)])
5714     fi
5715 elif test "$enable_pch" = "no"; then
5716     AC_MSG_RESULT([no])
5717 else
5718     AC_MSG_ERROR([Unknown value for --enable-pch])
5720 AC_SUBST(ENABLE_PCH)
5721 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5722 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5723     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5724     if test "$CCACHE_BIN" != "not found"; then
5725         AC_MSG_CHECKING([ccache version])
5726         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5727         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5728         AC_MSG_RESULT([$CCACHE_VERSION])
5729         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5730         if test "$CCACHE_NUMVER" -gt "030701"; then
5731             AC_MSG_RESULT([yes])
5732         else
5733             AC_MSG_RESULT([no (not newer than 3.7.1)])
5734             CCACHE_DEPEND_MODE=
5735         fi
5736     fi
5739 PCH_INSTANTIATE_TEMPLATES=
5740 if test -n "$ENABLE_PCH"; then
5741     AC_MSG_CHECKING([whether $CC supports -fpch-instantiate-templates])
5742     save_CFLAGS=$CFLAGS
5743     CFLAGS="$CFLAGS -Werror -fpch-instantiate-templates"
5744     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_INSTANTIATE_TEMPLATES="-fpch-instantiate-templates" ],[])
5745     CFLAGS=$save_CFLAGS
5746     if test -n "$PCH_INSTANTIATE_TEMPLATES"; then
5747         AC_MSG_RESULT(yes)
5748     else
5749         AC_MSG_RESULT(no)
5750     fi
5752 AC_SUBST(PCH_INSTANTIATE_TEMPLATES)
5754 BUILDING_PCH_WITH_OBJ=
5755 if test -n "$ENABLE_PCH"; then
5756     AC_MSG_CHECKING([whether $CC supports -Xclang -building-pch-with-obj])
5757     save_CFLAGS=$CFLAGS
5758     CFLAGS="$CFLAGS -Werror -Xclang -building-pch-with-obj"
5759     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ BUILDING_PCH_WITH_OBJ="-Xclang -building-pch-with-obj" ],[])
5760     CFLAGS=$save_CFLAGS
5761     if test -n "$BUILDING_PCH_WITH_OBJ"; then
5762         AC_MSG_RESULT(yes)
5763     else
5764         AC_MSG_RESULT(no)
5765     fi
5767 AC_SUBST(BUILDING_PCH_WITH_OBJ)
5769 PCH_CODEGEN=
5770 PCH_NO_CODEGEN=
5771 if test -n "$BUILDING_PCH_WITH_OBJ"; then
5772     AC_MSG_CHECKING([whether $CC supports -fpch-codegen])
5773     save_CFLAGS=$CFLAGS
5774     CFLAGS="$CFLAGS -Werror -fpch-codegen"
5775     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],
5776         [
5777         PCH_CODEGEN="-fpch-codegen"
5778         PCH_NO_CODEGEN="-fno-pch-codegen"
5779         ],[])
5780     CFLAGS=$save_CFLAGS
5781     if test -n "$PCH_CODEGEN"; then
5782         AC_MSG_RESULT(yes)
5783     else
5784         AC_MSG_RESULT(no)
5785     fi
5787 AC_SUBST(PCH_CODEGEN)
5788 AC_SUBST(PCH_NO_CODEGEN)
5789 PCH_DEBUGINFO=
5790 if test -n "$BUILDING_PCH_WITH_OBJ"; then
5791     AC_MSG_CHECKING([whether $CC supports -fpch-debuginfo])
5792     save_CFLAGS=$CFLAGS
5793     CFLAGS="$CFLAGS -Werror -fpch-debuginfo"
5794     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ PCH_DEBUGINFO="-fpch-debuginfo" ],[])
5795     CFLAGS=$save_CFLAGS
5796     if test -n "$PCH_DEBUGINFO"; then
5797         AC_MSG_RESULT(yes)
5798     else
5799         AC_MSG_RESULT(no)
5800     fi
5802 AC_SUBST(PCH_DEBUGINFO)
5804 TAB=`printf '\t'`
5806 AC_MSG_CHECKING([the GNU Make version])
5807 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5808 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5809 if test "$_make_longver" -ge "038200"; then
5810     AC_MSG_RESULT([$GNUMAKE $_make_version])
5812 elif test "$_make_longver" -ge "038100"; then
5813     if test "$build_os" = "cygwin"; then
5814         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5815     fi
5816     AC_MSG_RESULT([$GNUMAKE $_make_version])
5818     dnl ===================================================================
5819     dnl Search all the common names for sha1sum
5820     dnl ===================================================================
5821     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5822     if test -z "$SHA1SUM"; then
5823         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5824     elif test "$SHA1SUM" = "openssl"; then
5825         SHA1SUM="openssl sha1"
5826     fi
5827     AC_MSG_CHECKING([for GNU Make bug 20033])
5828     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5829     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5830 A := \$(wildcard *.a)
5832 .PHONY: all
5833 all: \$(A:.a=.b)
5834 <TAB>@echo survived bug20033.
5836 .PHONY: setup
5837 setup:
5838 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5840 define d1
5841 @echo lala \$(1)
5842 @sleep 1
5843 endef
5845 define d2
5846 @echo tyty \$(1)
5847 @sleep 1
5848 endef
5850 %.b : %.a
5851 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5852 <TAB>\$(call d1,\$(CHECKSUM)),\
5853 <TAB>\$(call d2,\$(CHECKSUM)))
5855     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5856         no_parallelism_make="YES"
5857         AC_MSG_RESULT([yes, disable parallelism])
5858     else
5859         AC_MSG_RESULT([no, keep parallelism enabled])
5860     fi
5861     rm -rf $TESTGMAKEBUG20033
5862 else
5863     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5866 # find if gnumake support file function
5867 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5868 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5869 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5870     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5872 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5873 \$(file >test.txt,Success )
5875 .PHONY: all
5876 all:
5877 <TAB>@cat test.txt
5880 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5881 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5882     HAVE_GNUMAKE_FILE_FUNC=TRUE
5883     AC_MSG_RESULT([yes])
5884 else
5885     AC_MSG_RESULT([no])
5887 rm -rf $TESTGMAKEFILEFUNC
5888 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5889 AC_SUBST(GNUMAKE_WIN_NATIVE)
5891 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5892 STALE_MAKE=
5893 if test "$_make_ver_check" = ""; then
5894    STALE_MAKE=TRUE
5897 HAVE_LD_HASH_STYLE=FALSE
5898 WITH_LINKER_HASH_STYLE=
5899 AC_MSG_CHECKING([for --hash-style gcc linker support])
5900 if test "$GCC" = "yes"; then
5901     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5902         hash_styles="gnu sysv"
5903     elif test "$with_linker_hash_style" = "no"; then
5904         hash_styles=
5905     else
5906         hash_styles="$with_linker_hash_style"
5907     fi
5909     for hash_style in $hash_styles; do
5910         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5911         hash_style_ldflags_save=$LDFLAGS
5912         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5914         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5915             [
5916 #include <stdio.h>
5917             ],[
5918 printf ("");
5919             ])],
5920             [
5921                   HAVE_LD_HASH_STYLE=TRUE
5922                   WITH_LINKER_HASH_STYLE=$hash_style
5923             ],
5924             [HAVE_LD_HASH_STYLE=FALSE],
5925             [HAVE_LD_HASH_STYLE=FALSE])
5926         LDFLAGS=$hash_style_ldflags_save
5927     done
5929     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5930         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5931     else
5932         AC_MSG_RESULT( no )
5933     fi
5934     LDFLAGS=$hash_style_ldflags_save
5935 else
5936     AC_MSG_RESULT( no )
5938 AC_SUBST(HAVE_LD_HASH_STYLE)
5939 AC_SUBST(WITH_LINKER_HASH_STYLE)
5941 dnl ===================================================================
5942 dnl Check whether there's a Perl version available.
5943 dnl ===================================================================
5944 if test -z "$with_perl_home"; then
5945     AC_PATH_PROG(PERL, perl)
5946 else
5947     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5948     _perl_path="$with_perl_home/bin/perl"
5949     if test -x "$_perl_path"; then
5950         PERL=$_perl_path
5951     else
5952         AC_MSG_ERROR([$_perl_path not found])
5953     fi
5956 dnl ===================================================================
5957 dnl Testing for Perl version 5 or greater.
5958 dnl $] is the Perl version variable, it is returned as an integer
5959 dnl ===================================================================
5960 if test "$PERL"; then
5961     AC_MSG_CHECKING([the Perl version])
5962     ${PERL} -e "exit($]);"
5963     _perl_version=$?
5964     if test "$_perl_version" -lt 5; then
5965         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5966     fi
5967     AC_MSG_RESULT([Perl $_perl_version])
5968 else
5969     AC_MSG_ERROR([Perl not found, install Perl 5])
5972 dnl ===================================================================
5973 dnl Testing for required Perl modules
5974 dnl ===================================================================
5976 AC_MSG_CHECKING([for required Perl modules])
5977 perl_use_string="use Cwd ; use Digest::MD5"
5978 if test "$_os" = "WINNT"; then
5979     if test -n "$PKGFORMAT"; then
5980         for i in $PKGFORMAT; do
5981             case "$i" in
5982             msi)
5983                 # for getting fonts versions to use in MSI
5984                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5985                 ;;
5986             esac
5987         done
5988     fi
5990 if test "$with_system_hsqldb" = "yes"; then
5991     perl_use_string="$perl_use_string ; use Archive::Zip"
5993 if test "$enable_openssl" = "yes" -a "$with_system_openssl" != "yes"; then
5994     # OpenSSL needs that to build
5995     perl_use_string="$perl_use_string ; use FindBin"
5997 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5998     AC_MSG_RESULT([all modules found])
5999 else
6000     AC_MSG_RESULT([failed to find some modules])
6001     # Find out which modules are missing.
6002     for i in $perl_use_string; do
6003         if test "$i" != "use" -a "$i" != ";"; then
6004             if ! $PERL -e "use $i;">/dev/null 2>&1; then
6005                 missing_perl_modules="$missing_perl_modules $i"
6006             fi
6007         fi
6008     done
6009     AC_MSG_ERROR([
6010     The missing Perl modules are: $missing_perl_modules
6011     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
6014 dnl ===================================================================
6015 dnl Check for pkg-config
6016 dnl ===================================================================
6017 if test "$_os" != "WINNT"; then
6018     PKG_PROG_PKG_CONFIG
6021 if test "$_os" != "WINNT"; then
6023     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
6024     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
6025     # explicitly. Or put /path/to/compiler in PATH yourself.
6027     # Use wrappers for LTO
6028     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
6029         AC_CHECK_TOOL(AR,gcc-ar)
6030         AC_CHECK_TOOL(NM,gcc-nm)
6031         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
6032     else
6033         AC_CHECK_TOOL(AR,ar)
6034         AC_CHECK_TOOL(NM,nm)
6035         AC_CHECK_TOOL(RANLIB,ranlib)
6036     fi
6037     AC_CHECK_TOOL(OBJDUMP,objdump)
6038     AC_CHECK_TOOL(READELF,readelf)
6039     AC_CHECK_TOOL(STRIP,strip)
6040     if test "$_os" = "WINNT"; then
6041         AC_CHECK_TOOL(DLLTOOL,dlltool)
6042         AC_CHECK_TOOL(WINDRES,windres)
6043     fi
6045 AC_SUBST(AR)
6046 AC_SUBST(DLLTOOL)
6047 AC_SUBST(NM)
6048 AC_SUBST(OBJDUMP)
6049 AC_SUBST(PKG_CONFIG)
6050 AC_SUBST(RANLIB)
6051 AC_SUBST(READELF)
6052 AC_SUBST(STRIP)
6053 AC_SUBST(WINDRES)
6055 dnl ===================================================================
6056 dnl pkg-config checks on macOS
6057 dnl ===================================================================
6059 if test $_os = Darwin; then
6060     AC_MSG_CHECKING([for bogus pkg-config])
6061     if test -n "$PKG_CONFIG"; then
6062         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
6063             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
6064         else
6065             if test "$enable_bogus_pkg_config" = "yes"; then
6066                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
6067             else
6068                 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.])
6069             fi
6070         fi
6071     else
6072         AC_MSG_RESULT([no, good])
6073     fi
6076 find_csc()
6078     # Return value: $csctest
6080     unset csctest
6082     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
6083     if test -n "$regvalue"; then
6084         csctest=$regvalue
6085         return
6086     fi
6089 find_al()
6091     # Return value: $altest
6093     unset altest
6095     # We need this check to detect 4.6.1 or above.
6096     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
6097         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
6098         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
6099             altest=$regvalue
6100             return
6101         fi
6102     done
6104     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
6105         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
6106         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
6107             altest=$regvalue
6108             return
6109         fi
6110     done
6113 find_dotnetsdk46()
6115     unset frametest
6117     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
6118         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
6119         if test -n "$regvalue"; then
6120             frametest=$regvalue
6121             return
6122         fi
6123     done
6126 find_winsdk_version()
6128     # Args: $1 : SDK version as in "8.0", "8.1A" etc
6129     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
6131     unset winsdktest winsdkbinsubdir winsdklibsubdir
6133     case "$1" in
6134     8.0|8.0A)
6135         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
6136         if test -n "$regvalue"; then
6137             winsdktest=$regvalue
6138             winsdklibsubdir=win8
6139             return
6140         fi
6141         ;;
6142     8.1|8.1A)
6143         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
6144         if test -n "$regvalue"; then
6145             winsdktest=$regvalue
6146             winsdklibsubdir=winv6.3
6147             return
6148         fi
6149         ;;
6150     10.0)
6151         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
6152         if test -n "$regvalue"; then
6153             winsdktest=$regvalue
6154             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
6155             if test -n "$regvalue"; then
6156                 winsdkbinsubdir="$regvalue".0
6157                 winsdklibsubdir=$winsdkbinsubdir
6158                 local tmppath="$winsdktest\\Include\\$winsdklibsubdir"
6159                 local tmppath_unix=$(cygpath -u "$tmppath")
6160                 # test exist the SDK path
6161                 if test -d "$tmppath_unix"; then
6162                    # when path is convertible to a short path then path is okay
6163                    cygpath -d "$tmppath" >/dev/null 2>&1
6164                    if test $? -ne 0; then
6165                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
6166                    fi
6167                 else
6168                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
6169                 fi
6170             fi
6171             return
6172         fi
6173         ;;
6174     esac
6177 find_winsdk()
6179     # Return value: From find_winsdk_version
6181     unset winsdktest
6183     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
6184         find_winsdk_version $ver
6185         if test -n "$winsdktest"; then
6186             return
6187         fi
6188     done
6191 find_msms()
6193     # Return value: $msmdir
6195     AC_MSG_CHECKING([for MSVC merge modules directory])
6196     local my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
6197     local my_msm_dir
6199     case "$VCVER" in
6200         160)
6201         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
6202         ;;
6203     esac
6204     for f in $my_msm_files; do
6205         echo "$as_me:$LINENO: searching for $f" >&5
6206     done
6208     msmdir=
6209     for ver in 14.0 15.0; do
6210         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
6211         if test -n "$regvalue"; then
6212             for f in ${my_msm_files}; do
6213                 if test -e "$regvalue/${f}"; then
6214                     msmdir=$regvalue
6215                     break
6216                 fi
6217             done
6218         fi
6219     done
6220     dnl Is the following fallback really necessary, or was it added in response
6221     dnl to never having started Visual Studio on a given machine, so the
6222     dnl registry keys checked above had presumably not yet been created?
6223     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
6224     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
6225     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
6226     dnl expanding to "C:\Program Files\Common Files"), which would need
6227     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
6228     dnl obtain its value from cygwin:
6229     if test -z "$msmdir"; then
6230         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
6231         for f in ${my_msm_files}; do
6232             if test -e "$my_msm_dir/${f}"; then
6233                 msmdir=$my_msm_dir
6234             fi
6235         done
6236     fi
6238     dnl Starting from MSVC 15.0, merge modules are located in different directory
6239     case "$VCVER" in
6240     160)
6241         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6242             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
6243             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
6244             for f in ${my_msm_files}; do
6245                 if test -e "$my_msm_dir/${f}"; then
6246                     msmdir=$my_msm_dir
6247                     break
6248                 fi
6249             done
6250         done
6251         ;;
6252     esac
6254     if test -n "$msmdir"; then
6255         msmdir=`cygpath -m "$msmdir"`
6256         AC_MSG_RESULT([$msmdir])
6257     else
6258         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
6259             AC_MSG_FAILURE([not found])
6260         else
6261             AC_MSG_WARN([not found (check config.log)])
6262             add_warning "MSM none of ${my_msm_files} found"
6263         fi
6264     fi
6267 find_msvc_x64_dlls()
6269     # Return value: $msvcdllpath, $msvcdlls
6271     AC_MSG_CHECKING([for MSVC x64 DLL path])
6272     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
6273     case "$VCVER" in
6274     160)
6275         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
6276             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
6277             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
6278                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
6279                 break
6280             fi
6281             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
6282             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
6283                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
6284                 break
6285             fi
6286         done
6287         ;;
6288     esac
6289     AC_MSG_RESULT([$msvcdllpath])
6290     AC_MSG_CHECKING([for MSVC x64 DLLs])
6291     msvcdlls="msvcp140.dll vcruntime140.dll"
6292     for dll in $msvcdlls; do
6293         if ! test -f "$msvcdllpath/$dll"; then
6294             AC_MSG_FAILURE([missing $dll])
6295         fi
6296     done
6297     AC_MSG_RESULT([found all ($msvcdlls)])
6300 dnl =========================================
6301 dnl Check for the Windows  SDK.
6302 dnl =========================================
6303 if test "$_os" = "WINNT"; then
6304     AC_MSG_CHECKING([for Windows SDK])
6305     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6306         find_winsdk
6307         WINDOWS_SDK_HOME=$winsdktest
6309         # normalize if found
6310         if test -n "$WINDOWS_SDK_HOME"; then
6311             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
6312             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
6313         fi
6315         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
6316     fi
6318     if test -n "$WINDOWS_SDK_HOME"; then
6319         # Remove a possible trailing backslash
6320         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
6322         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
6323              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
6324              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
6325             have_windows_sdk_headers=yes
6326         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
6327              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
6328              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
6329             have_windows_sdk_headers=yes
6330         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
6331              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
6332              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
6333             have_windows_sdk_headers=yes
6334         else
6335             have_windows_sdk_headers=no
6336         fi
6338         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
6339             have_windows_sdk_libs=yes
6340         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/user32.lib"; then
6341             have_windows_sdk_libs=yes
6342         else
6343             have_windows_sdk_libs=no
6344         fi
6346         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
6347             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
6348 the  Windows SDK are installed.])
6349         fi
6350     fi
6352     if test -z "$WINDOWS_SDK_HOME"; then
6353         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
6354     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
6355         WINDOWS_SDK_VERSION=80
6356         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
6357     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
6358         WINDOWS_SDK_VERSION=81
6359         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
6360     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
6361         WINDOWS_SDK_VERSION=10
6362         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
6363     else
6364         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
6365     fi
6366     PathFormat "$WINDOWS_SDK_HOME"
6367     WINDOWS_SDK_HOME="$formatted_path"
6368     WINDOWS_SDK_HOME_unix="$formatted_path_unix"
6369     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
6370         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
6371         if test -d "$WINDOWS_SDK_HOME/include/um"; then
6372             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
6373         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
6374             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
6375         fi
6376     fi
6378     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
6379     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
6380     dnl but not in v8.0), so allow this to be overridden with a
6381     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
6382     dnl and configuration error if no WiLangId.vbs is found would arguably be
6383     dnl better, but I do not know under which conditions exactly it is needed by
6384     dnl msiglobal.pm:
6385     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
6386         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
6387         WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6388         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6389             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WIN_BUILD_ARCH}/WiLangId.vbs"
6390             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6391         fi
6392         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6393             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WIN_BUILD_ARCH/WiLangId.vbs
6394             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6395         fi
6396         if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6397             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WIN_BUILD_ARCH/WiLangId.vbs")
6398             WINDOWS_SDK_WILANGID_unix=$(cygpath -u "$WINDOWS_SDK_WILANGID")
6399         fi
6400     fi
6401     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
6402         if test -n "$with_package_format" -a "$with_package_format" != no; then
6403             for i in "$with_package_format"; do
6404                 if test "$i" = "msi"; then
6405                     if ! test -e "$WINDOWS_SDK_WILANGID_unix" ; then
6406                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
6407                     fi
6408                 fi
6409             done
6410         fi
6411     fi
6413 AC_SUBST(WINDOWS_SDK_HOME)
6414 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
6415 AC_SUBST(WINDOWS_SDK_VERSION)
6416 AC_SUBST(WINDOWS_SDK_WILANGID)
6418 if test "$build_os" = "cygwin"; then
6419     dnl Check midl.exe; this being the first check for a tool in the SDK bin
6420     dnl dir, it also determines that dir's path w/o an arch segment if any,
6421     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
6422     AC_MSG_CHECKING([for midl.exe])
6424     find_winsdk
6425     if test -n "$winsdkbinsubdir" \
6426         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/midl.exe"
6427     then
6428         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH
6429         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
6430     elif test -f "$winsdktest/Bin/$WIN_BUILD_ARCH/midl.exe"; then
6431         MIDL_PATH=$winsdktest/Bin/$WIN_BUILD_ARCH
6432         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
6433     elif test -f "$winsdktest/Bin/midl.exe"; then
6434         MIDL_PATH=$winsdktest/Bin
6435         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
6436     fi
6437     if test ! -f "$MIDL_PATH/midl.exe"; then
6438         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WIN_BUILD_ARCH, Windows SDK installation broken?])
6439     else
6440         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
6441     fi
6443     # Convert to posix path with 8.3 filename restrictions ( No spaces )
6444     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
6446     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
6447          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
6448          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
6449          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
6450     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
6451          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
6452          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6453          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
6454     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
6455          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
6456          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
6457          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
6458     else
6459         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
6460     fi
6462     dnl Check csc.exe
6463     AC_MSG_CHECKING([for csc.exe])
6464     find_csc
6465     if test -f "$csctest/csc.exe"; then
6466         CSC_PATH="$csctest"
6467     fi
6468     if test ! -f "$CSC_PATH/csc.exe"; then
6469         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
6470     else
6471         AC_MSG_RESULT([$CSC_PATH/csc.exe])
6472     fi
6474     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
6476     dnl Check al.exe
6477     AC_MSG_CHECKING([for al.exe])
6478     find_winsdk
6479     if test -n "$winsdkbinsubdir" \
6480         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/al.exe"
6481     then
6482         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH"
6483     elif test -f "$winsdktest/Bin/$WIN_BUILD_ARCH/al.exe"; then
6484         AL_PATH="$winsdktest/Bin/$WIN_BUILD_ARCH"
6485     elif test -f "$winsdktest/Bin/al.exe"; then
6486         AL_PATH="$winsdktest/Bin"
6487     fi
6489     if test -z "$AL_PATH"; then
6490         find_al
6491         if test -f "$altest/bin/al.exe"; then
6492             AL_PATH="$altest/bin"
6493         elif test -f "$altest/al.exe"; then
6494             AL_PATH="$altest"
6495         fi
6496     fi
6497     if test ! -f "$AL_PATH/al.exe"; then
6498         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
6499     else
6500         AC_MSG_RESULT([$AL_PATH/al.exe])
6501     fi
6503     AL_PATH=`win_short_path_for_make "$AL_PATH"`
6505     dnl Check mscoree.lib / .NET Framework dir
6506     AC_MSG_CHECKING(.NET Framework)
6507     find_dotnetsdk46
6508     PathFormat "$frametest"
6509     frametest="$formatted_path"
6510     if test -f "$frametest/Lib/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6511         DOTNET_FRAMEWORK_HOME="$frametest"
6512     else
6513         find_winsdk
6514         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WIN_BUILD_ARCH/mscoree.lib"; then
6515             DOTNET_FRAMEWORK_HOME="$winsdktest"
6516         fi
6517     fi
6518     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
6519         AC_MSG_ERROR([mscoree.lib not found])
6520     fi
6521     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
6523     PathFormat "$MIDL_PATH"
6524     MIDL_PATH="$formatted_path"
6526     PathFormat "$AL_PATH"
6527     AL_PATH="$formatted_path"
6529     PathFormat "$DOTNET_FRAMEWORK_HOME"
6530     DOTNET_FRAMEWORK_HOME="$formatted_path"
6532     PathFormat "$CSC_PATH"
6533     CSC_PATH="$formatted_path"
6536 dnl ===================================================================
6537 dnl Testing for C++ compiler and version...
6538 dnl ===================================================================
6540 if test "$_os" != "WINNT"; then
6541     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
6542     save_CXXFLAGS=$CXXFLAGS
6543     AC_PROG_CXX
6544     CXXFLAGS=$save_CXXFLAGS
6545     if test -z "$CXX_BASE"; then
6546         CXX_BASE=`first_arg_basename "$CXX"`
6547     fi
6550 dnl check for GNU C++ compiler version
6551 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
6552     AC_MSG_CHECKING([the GNU C++ compiler version])
6554     _gpp_version=`$CXX -dumpversion`
6555     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
6557     if test "$_gpp_majmin" -lt "700"; then
6558         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
6559     else
6560         AC_MSG_RESULT([ok (g++ $_gpp_version)])
6561     fi
6563     dnl see https://code.google.com/p/android/issues/detail?id=41770
6564         glibcxx_threads=no
6565         AC_LANG_PUSH([C++])
6566         AC_REQUIRE_CPP
6567         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
6568         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
6569             #include <bits/c++config.h>]],[[
6570             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
6571             && !defined(_GLIBCXX__PTHREADS) \
6572             && !defined(_GLIBCXX_HAS_GTHREADS)
6573             choke me
6574             #endif
6575         ]])],[AC_MSG_RESULT([yes])
6576         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
6577         AC_LANG_POP([C++])
6578         if test $glibcxx_threads = yes; then
6579             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
6580         fi
6582 AC_SUBST(BOOST_CXXFLAGS)
6585 # prefx CXX with ccache if needed
6587 if test "$CCACHE" != ""; then
6588     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
6589     AC_LANG_PUSH([C++])
6590     save_CXXFLAGS=$CXXFLAGS
6591     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
6592     dnl an empty program will do, we're checking the compiler flags
6593     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
6594                       [use_ccache=yes], [use_ccache=no])
6595     if test $use_ccache = yes; then
6596         AC_MSG_RESULT([yes])
6597     else
6598         CXX="$CCACHE $CXX"
6599         CXX_BASE="ccache $CXX_BASE"
6600         AC_MSG_RESULT([no])
6601     fi
6602     CXXFLAGS=$save_CXXFLAGS
6603     AC_LANG_POP([C++])
6606 dnl ===================================================================
6607 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
6608 dnl ===================================================================
6610 if test "$_os" != "WINNT"; then
6611     AC_PROG_CXXCPP
6613     dnl Check whether there's a C pre-processor.
6614     AC_PROG_CPP
6618 dnl ===================================================================
6619 dnl Find integral type sizes and alignments
6620 dnl ===================================================================
6622 if test "$_os" != "WINNT"; then
6624     AC_CHECK_SIZEOF(long)
6625     AC_CHECK_SIZEOF(short)
6626     AC_CHECK_SIZEOF(int)
6627     AC_CHECK_SIZEOF(long long)
6628     AC_CHECK_SIZEOF(double)
6629     AC_CHECK_SIZEOF(void*)
6631     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
6632     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
6633     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
6634     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
6635     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6637     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6638     m4_pattern_allow([AC_CHECK_ALIGNOF])
6639     m4_ifdef([AC_CHECK_ALIGNOF],
6640         [
6641             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6642             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6643             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6644             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6645         ],
6646         [
6647             case "$_os-$host_cpu" in
6648             Linux-i686)
6649                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6650                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6651                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6652                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6653                 ;;
6654             Linux-x86_64)
6655                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6656                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6657                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6658                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6659                 ;;
6660             *)
6661                 if test -z "$ac_cv_alignof_short" -o \
6662                         -z "$ac_cv_alignof_int" -o \
6663                         -z "$ac_cv_alignof_long" -o \
6664                         -z "$ac_cv_alignof_double"; then
6665                    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.])
6666                 fi
6667                 ;;
6668             esac
6669         ])
6671     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6672     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6673     if test $ac_cv_sizeof_long -eq 8; then
6674         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6675     elif test $ac_cv_sizeof_double -eq 8; then
6676         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6677     else
6678         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6679     fi
6681     dnl Check for large file support
6682     AC_SYS_LARGEFILE
6683     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6684         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6685     fi
6686     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6687         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6688     fi
6689 else
6690     # Hardcode for MSVC
6691     SAL_TYPES_SIZEOFSHORT=2
6692     SAL_TYPES_SIZEOFINT=4
6693     SAL_TYPES_SIZEOFLONG=4
6694     SAL_TYPES_SIZEOFLONGLONG=8
6695     if test $WIN_HOST_BITS -eq 32; then
6696         SAL_TYPES_SIZEOFPOINTER=4
6697     else
6698         SAL_TYPES_SIZEOFPOINTER=8
6699     fi
6700     SAL_TYPES_ALIGNMENT2=2
6701     SAL_TYPES_ALIGNMENT4=4
6702     SAL_TYPES_ALIGNMENT8=8
6703     LFS_CFLAGS=''
6705 AC_SUBST(LFS_CFLAGS)
6707 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6708 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6709 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6710 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6711 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6712 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6713 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6714 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6716 dnl ===================================================================
6717 dnl Check whether to enable runtime optimizations
6718 dnl ===================================================================
6719 ENABLE_RUNTIME_OPTIMIZATIONS=
6720 AC_MSG_CHECKING([whether to enable runtime optimizations])
6721 if test -z "$enable_runtime_optimizations"; then
6722     for i in $CC; do
6723         case $i in
6724         -fsanitize=*)
6725             enable_runtime_optimizations=no
6726             break
6727             ;;
6728         esac
6729     done
6731 if test "$enable_runtime_optimizations" != no; then
6732     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6733     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6734     AC_MSG_RESULT([yes])
6735 else
6736     AC_MSG_RESULT([no])
6738 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6740 dnl ===================================================================
6741 dnl Check if valgrind headers are available
6742 dnl ===================================================================
6743 ENABLE_VALGRIND=
6744 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6745     prev_cppflags=$CPPFLAGS
6746     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6747     # or where does it come from?
6748     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6749     AC_CHECK_HEADER([valgrind/valgrind.h],
6750         [ENABLE_VALGRIND=TRUE])
6751     CPPFLAGS=$prev_cppflags
6753 AC_SUBST([ENABLE_VALGRIND])
6754 if test -z "$ENABLE_VALGRIND"; then
6755     if test "$with_valgrind" = yes; then
6756         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6757     fi
6758     VALGRIND_CFLAGS=
6760 AC_SUBST([VALGRIND_CFLAGS])
6763 dnl ===================================================================
6764 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6765 dnl ===================================================================
6767 # We need at least the sys/sdt.h include header.
6768 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6769 if test "$SDT_H_FOUND" = "TRUE"; then
6770     # Found sys/sdt.h header, now make sure the c++ compiler works.
6771     # Old g++ versions had problems with probes in constructors/destructors.
6772     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6773     AC_LANG_PUSH([C++])
6774     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6775     #include <sys/sdt.h>
6776     class ProbeClass
6777     {
6778     private:
6779       int& ref;
6780       const char *name;
6782     public:
6783       ProbeClass(int& v, const char *n) : ref(v), name(n)
6784       {
6785         DTRACE_PROBE2(_test_, cons, name, ref);
6786       }
6788       void method(int min)
6789       {
6790         DTRACE_PROBE3(_test_, meth, name, ref, min);
6791         ref -= min;
6792       }
6794       ~ProbeClass()
6795       {
6796         DTRACE_PROBE2(_test_, dest, name, ref);
6797       }
6798     };
6799     ]],[[
6800     int i = 64;
6801     DTRACE_PROBE1(_test_, call, i);
6802     ProbeClass inst = ProbeClass(i, "call");
6803     inst.method(24);
6804     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6805           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6806     AC_LANG_POP([C++])
6808 AC_CONFIG_HEADERS([config_host/config_probes.h])
6810 dnl ===================================================================
6811 dnl GCC features
6812 dnl ===================================================================
6813 HAVE_GCC_STACK_CLASH_PROTECTION=
6814 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6815     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-clash-protection])
6816     save_CFLAGS=$CFLAGS
6817     CFLAGS="$CFLAGS -Werror -fstack-clash-protection"
6818     AC_LINK_IFELSE(
6819         [AC_LANG_PROGRAM(, [[return 0;]])],
6820         [AC_MSG_RESULT([yes]); HAVE_GCC_STACK_CLASH_PROTECTION=TRUE],
6821         [AC_MSG_RESULT([no])])
6822     CFLAGS=$save_CFLAGS
6824     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6825     save_CFLAGS=$CFLAGS
6826     CFLAGS="$CFLAGS -Werror -mno-avx"
6827     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6828     CFLAGS=$save_CFLAGS
6829     if test "$HAVE_GCC_AVX" = "TRUE"; then
6830         AC_MSG_RESULT([yes])
6831     else
6832         AC_MSG_RESULT([no])
6833     fi
6835     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
6836     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6837     int v = 0;
6838     if (__sync_add_and_fetch(&v, 1) != 1 ||
6839         __sync_sub_and_fetch(&v, 1) != 0)
6840         return 1;
6841     __sync_synchronize();
6842     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6843         v != 1)
6844         return 1;
6845     return 0;
6846 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6847     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6848         AC_MSG_RESULT([yes])
6849         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6850     else
6851         AC_MSG_RESULT([no])
6852     fi
6854     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
6855     AC_LANG_PUSH([C++])
6856     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6857             #include <cstddef>
6858             #include <cxxabi.h>
6859             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6860         ])], [
6861             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6862             AC_MSG_RESULT([yes])
6863         ], [AC_MSG_RESULT([no])])
6864     AC_LANG_POP([C++])
6866     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
6867     AC_LANG_PUSH([C++])
6868     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6869             #include <cstddef>
6870             #include <cxxabi.h>
6871             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6872         ])], [
6873             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6874             AC_MSG_RESULT([yes])
6875         ], [AC_MSG_RESULT([no])])
6876     AC_LANG_POP([C++])
6878     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
6879     AC_LANG_PUSH([C++])
6880     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6881             #include <cxxabi.h>
6882             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6883         ])], [
6884             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6885             AC_MSG_RESULT([yes])
6886         ], [AC_MSG_RESULT([no])])
6887     AC_LANG_POP([C++])
6889     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
6890     AC_LANG_PUSH([C++])
6891     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6892             #include <cstddef>
6893             #include <cxxabi.h>
6894             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6895         ])], [
6896             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6897             AC_MSG_RESULT([yes])
6898         ], [AC_MSG_RESULT([no])])
6899     AC_LANG_POP([C++])
6901     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exception in cxxabi.h])
6902     AC_LANG_PUSH([C++])
6903     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6904             #include <cstddef>
6905             #include <cxxabi.h>
6906             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exception); }
6907         ])], [
6908             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTION],[1])
6909             AC_MSG_RESULT([yes])
6910         ], [AC_MSG_RESULT([no])])
6911     AC_LANG_POP([C++])
6913     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
6914     AC_LANG_PUSH([C++])
6915     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6916             #include <cxxabi.h>
6917             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6918         ])], [
6919             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6920             AC_MSG_RESULT([yes])
6921         ], [AC_MSG_RESULT([no])])
6922     AC_LANG_POP([C++])
6924     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
6925     AC_LANG_PUSH([C++])
6926     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6927             #include <cxxabi.h>
6928             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6929         ])], [
6930             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6931             AC_MSG_RESULT([yes])
6932         ], [AC_MSG_RESULT([no])])
6933     AC_LANG_POP([C++])
6935     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
6936     AC_LANG_PUSH([C++])
6937     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6938             #include <cxxabi.h>
6939             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6940         ])], [
6941             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6942             AC_MSG_RESULT([yes])
6943         ], [AC_MSG_RESULT([no])])
6944     AC_LANG_POP([C++])
6946     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
6947     AC_LANG_PUSH([C++])
6948     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6949             #include <cstddef>
6950             #include <cxxabi.h>
6951             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6952         ])], [
6953             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6954             AC_MSG_RESULT([yes])
6955         ], [AC_MSG_RESULT([no])])
6956     AC_LANG_POP([C++])
6958     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
6959     AC_LANG_PUSH([C++])
6960     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6961             #include <cstddef>
6962             #include <cxxabi.h>
6963             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6964         ])], [
6965             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6966             AC_MSG_RESULT([yes])
6967         ], [AC_MSG_RESULT([no])])
6968     AC_LANG_POP([C++])
6971 AC_SUBST(HAVE_GCC_AVX)
6972 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6973 AC_SUBST(HAVE_GCC_STACK_CLASH_PROTECTION)
6975 dnl ===================================================================
6976 dnl Identify the C++ library
6977 dnl ===================================================================
6979 AC_MSG_CHECKING([what the C++ library is])
6980 AC_LANG_PUSH([C++])
6981 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6982 #include <utility>
6983 #ifndef __GLIBCXX__
6984 foo bar
6985 #endif
6986 ]])],
6987     [CPP_LIBRARY=GLIBCXX
6988      cpp_library_name="GNU libstdc++"
6989     ],
6990     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6991 #include <utility>
6992 #ifndef _LIBCPP_VERSION
6993 foo bar
6994 #endif
6995 ]])],
6996     [CPP_LIBRARY=LIBCPP
6997      cpp_library_name="LLVM libc++"
6998      AC_DEFINE([HAVE_LIBCXX])
6999     ],
7000     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7001 #include <utility>
7002 #ifndef _MSC_VER
7003 foo bar
7004 #endif
7005 ]])],
7006     [CPP_LIBRARY=MSVCRT
7007      cpp_library_name="Microsoft"
7008     ],
7009     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
7010 AC_MSG_RESULT([$cpp_library_name])
7011 AC_LANG_POP([C++])
7013 dnl ===================================================================
7014 dnl Check for gperf
7015 dnl ===================================================================
7016 AC_PATH_PROG(GPERF, gperf)
7017 if test -z "$GPERF"; then
7018     AC_MSG_ERROR([gperf not found but needed. Install it.])
7020 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
7021     GPERF=`cygpath -m $GPERF`
7023 AC_MSG_CHECKING([whether gperf is new enough])
7024 my_gperf_ver1=$($GPERF --version | head -n 1)
7025 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
7026 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
7027 if test "$my_gperf_ver3" -ge 301; then
7028     AC_MSG_RESULT([yes ($my_gperf_ver2)])
7029 else
7030     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
7032 AC_SUBST(GPERF)
7034 dnl ===================================================================
7035 dnl Check for system libcmis
7036 dnl ===================================================================
7037 # libcmis requires curl and we can't build curl for iOS
7038 if test $_os != iOS; then
7039     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
7040     ENABLE_LIBCMIS=TRUE
7041 else
7042     ENABLE_LIBCMIS=
7044 AC_SUBST(ENABLE_LIBCMIS)
7046 dnl ===================================================================
7047 dnl C++11
7048 dnl ===================================================================
7050 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
7051 CXXFLAGS_CXX11=
7052 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
7053     if test "$with_latest_c__" = yes; then
7054         CXXFLAGS_CXX11=-std:c++latest
7055     else
7056         CXXFLAGS_CXX11=-std:c++17
7057     fi
7058     CXXFLAGS_CXX11="$CXXFLAGS_CXX11 -permissive- -Zc:__cplusplus"
7059 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7060     my_flags='-std=c++17 -std=c++1z'
7061     if test "$with_latest_c__" = yes; then
7062         my_flags="-std=c++23 -std=c++2b -std=c++20 -std=c++2a $my_flags"
7063     fi
7064     for flag in $my_flags; do
7065         if test "$COM" = MSC; then
7066             flag="-Xclang $flag"
7067         fi
7068         save_CXXFLAGS=$CXXFLAGS
7069         CXXFLAGS="$CXXFLAGS $flag -Werror"
7070         if test "$SYSTEM_LIBCMIS" = TRUE; then
7071             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
7072         fi
7073         AC_LANG_PUSH([C++])
7074         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7075             #include <algorithm>
7076             #include <functional>
7077             #include <vector>
7079             #if defined SYSTEM_LIBCMIS
7080             // See ucb/source/ucp/cmis/auth_provider.hxx:
7081             #if !defined __clang__
7082             #pragma GCC diagnostic push
7083             #pragma GCC diagnostic ignored "-Wdeprecated"
7084             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
7085             #endif
7086             #include <libcmis/libcmis.hxx>
7087             #if !defined __clang__
7088             #pragma GCC diagnostic pop
7089             #endif
7090             #endif
7092             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
7093                 std::sort(v.begin(), v.end(), fn);
7094             }
7095             ]])],[CXXFLAGS_CXX11=$flag])
7096         AC_LANG_POP([C++])
7097         CXXFLAGS=$save_CXXFLAGS
7098         if test -n "$CXXFLAGS_CXX11"; then
7099             break
7100         fi
7101     done
7103 if test -n "$CXXFLAGS_CXX11"; then
7104     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
7105 else
7106     AC_MSG_ERROR(no)
7108 AC_SUBST(CXXFLAGS_CXX11)
7110 if test "$GCC" = "yes"; then
7111     save_CXXFLAGS=$CXXFLAGS
7112     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7113     CHECK_L_ATOMIC
7114     CXXFLAGS=$save_CXXFLAGS
7115     AC_SUBST(ATOMIC_LIB)
7118 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
7119 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
7120 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
7121 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
7122 dnl again towards 4.7.2:
7123 if test $CPP_LIBRARY = GLIBCXX; then
7124     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
7125     AC_LANG_PUSH([C++])
7126     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7127 #include <list>
7128 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
7129     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
7130     //   GCC 4.7.0: 20120322
7131     //   GCC 4.7.1: 20120614
7132     // and using a range check is not possible as the mapping between
7133     // __GLIBCXX__ values and GCC versions is not monotonic
7134 /* ok */
7135 #else
7136 abi broken
7137 #endif
7138         ]])], [AC_MSG_RESULT(no, ok)],
7139         [AC_MSG_ERROR(yes)])
7140     AC_LANG_POP([C++])
7143 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
7144 save_CXXFLAGS=$CXXFLAGS
7145 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7146 AC_LANG_PUSH([C++])
7148 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
7149 #include <stddef.h>
7151 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
7153 namespace
7155         struct b
7156         {
7157                 int i;
7158                 int j;
7159         };
7161 ]], [[
7162 struct a
7164         int i;
7165         int j;
7167 a thinga[]={{0,0}, {1,1}};
7168 b thingb[]={{0,0}, {1,1}};
7169 size_t i = sizeof(sal_n_array_size(thinga));
7170 size_t j = sizeof(sal_n_array_size(thingb));
7171 return !(i != 0 && j != 0);
7173     ], [ AC_MSG_RESULT(yes) ],
7174     [ AC_MSG_ERROR(no)])
7175 AC_LANG_POP([C++])
7176 CXXFLAGS=$save_CXXFLAGS
7178 HAVE_GCC_FNO_SIZED_DEALLOCATION=
7179 if test "$GCC" = yes; then
7180     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
7181     AC_LANG_PUSH([C++])
7182     save_CXXFLAGS=$CXXFLAGS
7183     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
7184     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
7185     CXXFLAGS=$save_CXXFLAGS
7186     AC_LANG_POP([C++])
7187     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
7188         AC_MSG_RESULT([yes])
7189     else
7190         AC_MSG_RESULT([no])
7191     fi
7193 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
7195 AC_MSG_CHECKING([whether $CXX_BASE supports a working C++20 consteval])
7196 dnl ...that does not suffer from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96994> "Missing code
7197 dnl from consteval constructor initializing const variable" or
7198 dnl <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98752> "wrong 'error: â€˜this’ is not a constant
7199 dnl expression' with consteval constructor":
7200 AC_LANG_PUSH([C++])
7201 save_CXXFLAGS=$CXXFLAGS
7202 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7203 AC_RUN_IFELSE([AC_LANG_PROGRAM([
7204         struct S {
7205             consteval S() { i = 1; }
7206             int i = 0;
7207         };
7208         S const s;
7210         struct S1 { consteval S1(int) {} };
7211         struct S2 {
7212             S1 x;
7213             S2(): x(0) {}
7214         };
7215     ], [
7216         return (s.i == 1) ? 0 : 1;
7217     ])], [
7218         AC_DEFINE([HAVE_CPP_CONSTEVAL],[1])
7219         AC_MSG_RESULT([yes])
7220     ], [AC_MSG_RESULT([no])], [AC_MSG_RESULT([assumed no (cross compiling)])])
7221 CXXFLAGS=$save_CXXFLAGS
7222 AC_LANG_POP([C++])
7224 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a constinit sorted vectors])
7225 AC_LANG_PUSH([C++])
7226 save_CXXFLAGS=$CXXFLAGS
7227 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7228 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7229         #include <algorithm>
7230         #include <initializer_list>
7231         #include <vector>
7232         template<typename T> class S {
7233         private:
7234             std::vector<T> v_;
7235         public:
7236             constexpr S(std::initializer_list<T> i): v_(i) { std::sort(v_.begin(), v_.end()); }
7237         };
7238         constinit S<int> s{3, 2, 1};
7239     ])], [
7240         AC_DEFINE([HAVE_CPP_CONSTINIT_SORTED_VECTOR],[1])
7241         AC_MSG_RESULT([yes])
7242     ], [AC_MSG_RESULT([no])])
7243 CXXFLAGS=$save_CXXFLAGS
7244 AC_LANG_POP([C++])
7246 AC_MSG_CHECKING([whether $CXX_BASE supports C++2a <span> with unsigned size_type])
7247 AC_LANG_PUSH([C++])
7248 save_CXXFLAGS=$CXXFLAGS
7249 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7250 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7251         #include <span>
7252         #include <type_traits>
7253         // Don't check size_type directly, as it was called index_type before P1872R0:
7254         void f(std::span<int> s) { static_assert(std::is_unsigned_v<decltype(s.size())>); };
7255     ])], [
7256         AC_DEFINE([HAVE_CPP_SPAN],[1])
7257         AC_MSG_RESULT([yes])
7258     ], [AC_MSG_RESULT([no])])
7259 CXXFLAGS=$save_CXXFLAGS
7260 AC_LANG_POP([C++])
7262 AC_MSG_CHECKING([whether $CXX_BASE implements C++ DR P1155R3])
7263 AC_LANG_PUSH([C++])
7264 save_CXXFLAGS=$CXXFLAGS
7265 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
7266 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7267         struct S1 { S1(S1 &&); };
7268         struct S2: S1 {};
7269         S1 f(S2 s) { return s; }
7270     ])], [
7271         AC_DEFINE([HAVE_P1155R3],[1])
7272         AC_MSG_RESULT([yes])
7273     ], [AC_MSG_RESULT([no])])
7274 CXXFLAGS=$save_CXXFLAGS
7275 AC_LANG_POP([C++])
7277 dnl Supported since GCC 9 and Clang 10 (which each also started to support -Wdeprecated-copy, but
7278 dnl which is included in -Wextra anyway):
7279 HAVE_WDEPRECATED_COPY_DTOR=
7280 if test "$GCC" = yes; then
7281     AC_MSG_CHECKING([whether $CXX_BASE supports -Wdeprecated-copy-dtor])
7282     AC_LANG_PUSH([C++])
7283     save_CXXFLAGS=$CXXFLAGS
7284     CXXFLAGS="$CXXFLAGS -Werror -Wdeprecated-copy-dtor"
7285     AC_COMPILE_IFELSE([AC_LANG_SOURCE()], [
7286             HAVE_WDEPRECATED_COPY_DTOR=TRUE
7287             AC_MSG_RESULT([yes])
7288         ], [AC_MSG_RESULT([no])])
7289     CXXFLAGS=$save_CXXFLAGS
7290     AC_LANG_POP([C++])
7292 AC_SUBST([HAVE_WDEPRECATED_COPY_DTOR])
7294 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
7295 dnl uninitialized warning for code like
7297 dnl   OString f();
7298 dnl   boost::optional<OString> * g(bool b) {
7299 dnl       boost::optional<OString> o;
7300 dnl       if (b) o = f();
7301 dnl       return new boost::optional<OString>(o);
7302 dnl   }
7304 dnl (as is e.g. present, in a slightly more elaborate form, in
7305 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
7306 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
7307 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
7308 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7309     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
7310     AC_LANG_PUSH([C++])
7311     save_CXXFLAGS=$CXXFLAGS
7312     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
7313     if test "$ENABLE_OPTIMIZED" = TRUE; then
7314         CXXFLAGS="$CXXFLAGS -O2"
7315     else
7316         CXXFLAGS="$CXXFLAGS -O0"
7317     fi
7318     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7319             #include <new>
7320             void f1(int);
7321             struct S1 {
7322                 ~S1() { f1(n); }
7323                 int n = 0;
7324             };
7325             struct S2 {
7326                 S2() {}
7327                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
7328                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
7329                 void set(S1 s) {
7330                     new (stg) S1(s);
7331                     init = true;
7332                 }
7333                 bool init = false;
7334                 char stg[sizeof (S1)];
7335             } ;
7336             S1 f2();
7337             S2 * f3(bool b) {
7338                 S2 o;
7339                 if (b) o.set(f2());
7340                 return new S2(o);
7341             }
7342         ]])], [AC_MSG_RESULT([no])], [
7343             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
7344             AC_MSG_RESULT([yes])
7345         ])
7346     CXXFLAGS=$save_CXXFLAGS
7347     AC_LANG_POP([C++])
7349 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
7351 dnl Check for <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c5> "[8/9/10/11 Regression]
7352 dnl -Wstringop-overflow false positive due to using MEM_REF type of &MEM" (fixed in GCC 11), which
7353 dnl hits us e.g. with GCC 10 and --enable-optimized at
7355 dnl   In file included from include/rtl/string.hxx:49,
7356 dnl                    from include/rtl/ustring.hxx:43,
7357 dnl                    from include/osl/file.hxx:35,
7358 dnl                    from include/codemaker/global.hxx:28,
7359 dnl                    from include/codemaker/options.hxx:23,
7360 dnl                    from codemaker/source/commoncpp/commoncpp.cxx:24:
7361 dnl   In function â€˜char* rtl::addDataHelper(char*, const char*, std::size_t)’,
7362 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,
7363 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,
7364 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,
7365 dnl       inlined from â€˜rtl::OString codemaker::cpp::scopedCppName(const rtl::OString&, bool)’ at codemaker/source/commoncpp/commoncpp.cxx:53:55:
7366 dnl   include/rtl/stringconcat.hxx:78:15: error: writing 2 bytes into a region of size 1 [-Werror=stringop-overflow=]
7367 dnl      78 |         memcpy( buffer, data, length );
7368 dnl         |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
7369 HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=
7370 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
7371     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=stringop-overflow=])
7372     AC_LANG_PUSH([C++])
7373     save_CXXFLAGS=$CXXFLAGS
7374     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wstringop-overflow"
7375     if test "$ENABLE_OPTIMIZED" = TRUE; then
7376         CXXFLAGS="$CXXFLAGS -O2"
7377     else
7378         CXXFLAGS="$CXXFLAGS -O0"
7379     fi
7380     dnl Test code taken from <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87296#c0>:
7381     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7382             void fill(char const * begin, char const * end, char c);
7383             struct q {
7384                 char ids[4];
7385                 char username[6];
7386             };
7387             void test(q & c) {
7388                 fill(c.ids, c.ids + sizeof(c.ids), '\0');
7389                 __builtin_strncpy(c.username, "root", sizeof(c.username));
7390             }
7391         ]])], [AC_MSG_RESULT([no])], [
7392             HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW=TRUE
7393             AC_MSG_RESULT([yes])
7394         ])
7395     CXXFLAGS=$save_CXXFLAGS
7396     AC_LANG_POP([C++])
7398 AC_SUBST([HAVE_BROKEN_GCC_WSTRINGOP_OVERFLOW])
7400 dnl ===================================================================
7401 dnl CPU Intrinsics support - SSE, AVX
7402 dnl ===================================================================
7404 CXXFLAGS_INTRINSICS_SSE2=
7405 CXXFLAGS_INTRINSICS_SSSE3=
7406 CXXFLAGS_INTRINSICS_SSE41=
7407 CXXFLAGS_INTRINSICS_SSE42=
7408 CXXFLAGS_INTRINSICS_AVX=
7409 CXXFLAGS_INTRINSICS_AVX2=
7410 CXXFLAGS_INTRINSICS_AVX512=
7411 CXXFLAGS_INTRINSICS_F16C=
7412 CXXFLAGS_INTRINSICS_FMA=
7414 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
7415     # GCC, Clang or Clang-cl (clang-cl + MSVC's -arch options don't work well together)
7416     flag_sse2=-msse2
7417     flag_ssse3=-mssse3
7418     flag_sse41=-msse4.1
7419     flag_sse42=-msse4.2
7420     flag_avx=-mavx
7421     flag_avx2=-mavx2
7422     flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
7423     flag_f16c=-mf16c
7424     flag_fma=-mfma
7425 else
7426     # https://docs.microsoft.com/en-us/cpp/build/reference/arch-x86
7427     # MSVC seems to differentiate only between SSE and SSE2, where in fact
7428     # SSE2 seems to be SSE2+.
7429     # Even if -arch:SSE2 is the default, set it explicitly, so that the variable
7430     # is not empty (and can be tested in gbuild).
7431     flag_sse2=-arch:SSE2
7432     flag_ssse3=-arch:SSE2
7433     flag_sse41=-arch:SSE2
7434     flag_sse42=-arch:SSE2
7435     flag_avx=-arch:AVX
7436     flag_avx2=-arch:AVX2
7437     flag_avx512=-arch:AVX512
7438     # These are part of -arch:AVX2
7439     flag_f16c=-arch:AVX2
7440     flag_fma=-arch:AVX2
7443 AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
7444 AC_LANG_PUSH([C++])
7445 save_CXXFLAGS=$CXXFLAGS
7446 CXXFLAGS="$CXXFLAGS $flag_sse2"
7447 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7448     #include <emmintrin.h>
7449     int main () {
7450         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7451         c = _mm_xor_si128 (a, b);
7452         return 0;
7453     }
7454     ])],
7455     [can_compile_sse2=yes],
7456     [can_compile_sse2=no])
7457 AC_LANG_POP([C++])
7458 CXXFLAGS=$save_CXXFLAGS
7459 AC_MSG_RESULT([${can_compile_sse2}])
7460 if test "${can_compile_sse2}" = "yes" ; then
7461     CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
7464 AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
7465 AC_LANG_PUSH([C++])
7466 save_CXXFLAGS=$CXXFLAGS
7467 CXXFLAGS="$CXXFLAGS $flag_ssse3"
7468 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7469     #include <tmmintrin.h>
7470     int main () {
7471         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7472         c = _mm_maddubs_epi16 (a, b);
7473         return 0;
7474     }
7475     ])],
7476     [can_compile_ssse3=yes],
7477     [can_compile_ssse3=no])
7478 AC_LANG_POP([C++])
7479 CXXFLAGS=$save_CXXFLAGS
7480 AC_MSG_RESULT([${can_compile_ssse3}])
7481 if test "${can_compile_ssse3}" = "yes" ; then
7482     CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
7485 AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
7486 AC_LANG_PUSH([C++])
7487 save_CXXFLAGS=$CXXFLAGS
7488 CXXFLAGS="$CXXFLAGS $flag_sse41"
7489 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7490     #include <smmintrin.h>
7491     int main () {
7492         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7493         c = _mm_cmpeq_epi64 (a, b);
7494         return 0;
7495     }
7496     ])],
7497     [can_compile_sse41=yes],
7498     [can_compile_sse41=no])
7499 AC_LANG_POP([C++])
7500 CXXFLAGS=$save_CXXFLAGS
7501 AC_MSG_RESULT([${can_compile_sse41}])
7502 if test "${can_compile_sse41}" = "yes" ; then
7503     CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
7506 AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
7507 AC_LANG_PUSH([C++])
7508 save_CXXFLAGS=$CXXFLAGS
7509 CXXFLAGS="$CXXFLAGS $flag_sse42"
7510 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7511     #include <nmmintrin.h>
7512     int main () {
7513         __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
7514         c = _mm_cmpgt_epi64 (a, b);
7515         return 0;
7516     }
7517     ])],
7518     [can_compile_sse42=yes],
7519     [can_compile_sse42=no])
7520 AC_LANG_POP([C++])
7521 CXXFLAGS=$save_CXXFLAGS
7522 AC_MSG_RESULT([${can_compile_sse42}])
7523 if test "${can_compile_sse42}" = "yes" ; then
7524     CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
7527 AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
7528 AC_LANG_PUSH([C++])
7529 save_CXXFLAGS=$CXXFLAGS
7530 CXXFLAGS="$CXXFLAGS $flag_avx"
7531 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7532     #include <immintrin.h>
7533     int main () {
7534         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
7535         c = _mm256_xor_ps(a, b);
7536         return 0;
7537     }
7538     ])],
7539     [can_compile_avx=yes],
7540     [can_compile_avx=no])
7541 AC_LANG_POP([C++])
7542 CXXFLAGS=$save_CXXFLAGS
7543 AC_MSG_RESULT([${can_compile_avx}])
7544 if test "${can_compile_avx}" = "yes" ; then
7545     CXXFLAGS_INTRINSICS_AVX="$flag_avx"
7548 AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
7549 AC_LANG_PUSH([C++])
7550 save_CXXFLAGS=$CXXFLAGS
7551 CXXFLAGS="$CXXFLAGS $flag_avx2"
7552 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7553     #include <immintrin.h>
7554     int main () {
7555         __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
7556         c = _mm256_maddubs_epi16(a, b);
7557         return 0;
7558     }
7559     ])],
7560     [can_compile_avx2=yes],
7561     [can_compile_avx2=no])
7562 AC_LANG_POP([C++])
7563 CXXFLAGS=$save_CXXFLAGS
7564 AC_MSG_RESULT([${can_compile_avx2}])
7565 if test "${can_compile_avx2}" = "yes" ; then
7566     CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
7569 AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
7570 AC_LANG_PUSH([C++])
7571 save_CXXFLAGS=$CXXFLAGS
7572 CXXFLAGS="$CXXFLAGS $flag_avx512"
7573 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7574     #include <immintrin.h>
7575     int main () {
7576         __m512i a = _mm512_loadu_si512(0);
7577         return 0;
7578     }
7579     ])],
7580     [can_compile_avx512=yes],
7581     [can_compile_avx512=no])
7582 AC_LANG_POP([C++])
7583 CXXFLAGS=$save_CXXFLAGS
7584 AC_MSG_RESULT([${can_compile_avx512}])
7585 if test "${can_compile_avx512}" = "yes" ; then
7586     CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
7589 AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
7590 AC_LANG_PUSH([C++])
7591 save_CXXFLAGS=$CXXFLAGS
7592 CXXFLAGS="$CXXFLAGS $flag_f16c"
7593 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7594     #include <immintrin.h>
7595     int main () {
7596         __m128i a = _mm_set1_epi32 (0);
7597         __m128 c;
7598         c = _mm_cvtph_ps(a);
7599         return 0;
7600     }
7601     ])],
7602     [can_compile_f16c=yes],
7603     [can_compile_f16c=no])
7604 AC_LANG_POP([C++])
7605 CXXFLAGS=$save_CXXFLAGS
7606 AC_MSG_RESULT([${can_compile_f16c}])
7607 if test "${can_compile_f16c}" = "yes" ; then
7608     CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
7611 AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
7612 AC_LANG_PUSH([C++])
7613 save_CXXFLAGS=$CXXFLAGS
7614 CXXFLAGS="$CXXFLAGS $flag_fma"
7615 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
7616     #include <immintrin.h>
7617     int main () {
7618         __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
7619         d = _mm256_fmadd_ps(a, b, c);
7620         return 0;
7621     }
7622     ])],
7623     [can_compile_fma=yes],
7624     [can_compile_fma=no])
7625 AC_LANG_POP([C++])
7626 CXXFLAGS=$save_CXXFLAGS
7627 AC_MSG_RESULT([${can_compile_fma}])
7628 if test "${can_compile_fma}" = "yes" ; then
7629     CXXFLAGS_INTRINSICS_FMA="$flag_fma"
7632 AC_SUBST([CXXFLAGS_INTRINSICS_SSE2])
7633 AC_SUBST([CXXFLAGS_INTRINSICS_SSSE3])
7634 AC_SUBST([CXXFLAGS_INTRINSICS_SSE41])
7635 AC_SUBST([CXXFLAGS_INTRINSICS_SSE42])
7636 AC_SUBST([CXXFLAGS_INTRINSICS_AVX])
7637 AC_SUBST([CXXFLAGS_INTRINSICS_AVX2])
7638 AC_SUBST([CXXFLAGS_INTRINSICS_AVX512])
7639 AC_SUBST([CXXFLAGS_INTRINSICS_F16C])
7640 AC_SUBST([CXXFLAGS_INTRINSICS_FMA])
7642 dnl ===================================================================
7643 dnl system stl sanity tests
7644 dnl ===================================================================
7645 if test "$_os" != "WINNT"; then
7647     AC_LANG_PUSH([C++])
7649     save_CPPFLAGS="$CPPFLAGS"
7650     if test -n "$MACOSX_SDK_PATH"; then
7651         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
7652     fi
7654     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
7655     # only.
7656     if test "$CPP_LIBRARY" = GLIBCXX; then
7657         dnl gcc#19664, gcc#22482, rhbz#162935
7658         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
7659         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
7660         AC_MSG_RESULT([$stlvisok])
7661         if test "$stlvisok" = "no"; then
7662             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
7663         fi
7664     fi
7666     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
7667     # when we don't make any dynamic libraries?
7668     if test "$DISABLE_DYNLOADING" = ""; then
7669         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
7670         cat > conftestlib1.cc <<_ACEOF
7671 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7672 struct S2: S1<int> { virtual ~S2(); };
7673 S2::~S2() {}
7674 _ACEOF
7675         cat > conftestlib2.cc <<_ACEOF
7676 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
7677 struct S2: S1<int> { virtual ~S2(); };
7678 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
7679 _ACEOF
7680         gccvisinlineshiddenok=yes
7681         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
7682             gccvisinlineshiddenok=no
7683         else
7684             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
7685             dnl known to not work with -z defs (unsetting which makes the test
7686             dnl moot, though):
7687             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
7688             if test "$COM_IS_CLANG" = TRUE; then
7689                 for i in $CXX $CXXFLAGS; do
7690                     case $i in
7691                     -fsanitize=*)
7692                         my_linkflagsnoundefs=
7693                         break
7694                         ;;
7695                     esac
7696                 done
7697             fi
7698             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
7699                 gccvisinlineshiddenok=no
7700             fi
7701         fi
7703         rm -fr libconftest*
7704         AC_MSG_RESULT([$gccvisinlineshiddenok])
7705         if test "$gccvisinlineshiddenok" = "no"; then
7706             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
7707         fi
7708     fi
7710    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
7711     cat >visibility.cxx <<_ACEOF
7712 #pragma GCC visibility push(hidden)
7713 struct __attribute__ ((visibility ("default"))) TestStruct {
7714   static void Init();
7716 __attribute__ ((visibility ("default"))) void TestFunc() {
7717   TestStruct::Init();
7719 _ACEOF
7720     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
7721         gccvisbroken=yes
7722     else
7723         case "$host_cpu" in
7724         i?86|x86_64)
7725             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
7726                 gccvisbroken=no
7727             else
7728                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
7729                     gccvisbroken=no
7730                 else
7731                     gccvisbroken=yes
7732                 fi
7733             fi
7734             ;;
7735         *)
7736             gccvisbroken=no
7737             ;;
7738         esac
7739     fi
7740     rm -f visibility.s visibility.cxx
7742     AC_MSG_RESULT([$gccvisbroken])
7743     if test "$gccvisbroken" = "yes"; then
7744         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
7745     fi
7747     CPPFLAGS="$save_CPPFLAGS"
7749     AC_LANG_POP([C++])
7752 dnl ===================================================================
7753 dnl  Clang++ tests
7754 dnl ===================================================================
7756 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
7757 if test "$GCC" = "yes"; then
7758     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
7759     AC_LANG_PUSH([C++])
7760     save_CXXFLAGS=$CXXFLAGS
7761     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
7762     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
7763     CXXFLAGS=$save_CXXFLAGS
7764     AC_LANG_POP([C++])
7765     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
7766         AC_MSG_RESULT([yes])
7767     else
7768         AC_MSG_RESULT([no])
7769     fi
7771 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
7773 dnl ===================================================================
7774 dnl Compiler plugins
7775 dnl ===================================================================
7777 COMPILER_PLUGINS=
7778 # currently only Clang
7780 if test "$COM_IS_CLANG" != "TRUE"; then
7781     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
7782         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
7783         enable_compiler_plugins=no
7784     fi
7787 COMPILER_PLUGINS_COM_IS_CLANG=
7788 if test "$COM_IS_CLANG" = "TRUE"; then
7789     if test -n "$enable_compiler_plugins"; then
7790         compiler_plugins="$enable_compiler_plugins"
7791     elif test -n "$ENABLE_DBGUTIL"; then
7792         compiler_plugins=test
7793     else
7794         compiler_plugins=no
7795     fi
7796     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
7797         if test "$CLANGVER" -lt 50002; then
7798             if test "$compiler_plugins" = yes; then
7799                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
7800             else
7801                 compiler_plugins=no
7802             fi
7803         fi
7804     fi
7805     if test "$compiler_plugins" != "no"; then
7806         dnl The prefix where Clang resides, override to where Clang resides if
7807         dnl using a source build:
7808         if test -z "$CLANGDIR"; then
7809             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $(printf '%s\n' $CXX | grep clang | head -n 1)))))
7810         fi
7811         # Assume Clang is self-built, but allow overriding COMPILER_PLUGINS_CXX to the compiler Clang was built with.
7812         if test -z "$COMPILER_PLUGINS_CXX"; then
7813             COMPILER_PLUGINS_CXX=[$(echo $CXX | sed -e 's/-fsanitize=[^ ]*//g')]
7814         fi
7815         clangbindir=$CLANGDIR/bin
7816         if test "$build_os" = "cygwin"; then
7817             clangbindir=$(cygpath -u "$clangbindir")
7818         fi
7819         AC_PATH_PROG(LLVM_CONFIG, llvm-config,[],"$clangbindir" $PATH)
7820         if test -n "$LLVM_CONFIG"; then
7821             COMPILER_PLUGINS_CXXFLAGS=$($LLVM_CONFIG --cxxflags)
7822             COMPILER_PLUGINS_LINKFLAGS=$($LLVM_CONFIG --ldflags --libs --system-libs | tr '\n' ' ')
7823             if test -z "$CLANGLIBDIR"; then
7824                 CLANGLIBDIR=$($LLVM_CONFIG --libdir)
7825             fi
7826             # Try if clang is built from source (in which case its includes are not together with llvm includes).
7827             # src-root is [llvm-toplevel-src-dir]/llvm, clang is [llvm-toplevel-src-dir]/clang
7828             clangsrcdir=$(dirname $($LLVM_CONFIG --src-root))
7829             if test -n "$clangsrcdir" -a -d "$clangsrcdir" -a -d "$clangsrcdir/clang/include"; then
7830                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangsrcdir/clang/include"
7831             fi
7832             # obj-root is [llvm-toplevel-obj-dir]/, clang is [llvm-toplevel-obj-dir]/tools/clang
7833             clangobjdir=$($LLVM_CONFIG --obj-root)
7834             if test -n "$clangobjdir" -a -d "$clangobjdir" -a -d "$clangobjdir/tools/clang/include"; then
7835                 COMPILER_PLUGINS_CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS -I$clangobjdir/tools/clang/include"
7836             fi
7837         fi
7838         AC_MSG_NOTICE([compiler plugins compile flags: $COMPILER_PLUGINS_CXXFLAGS])
7839         AC_LANG_PUSH([C++])
7840         save_CXX=$CXX
7841         save_CXXCPP=$CXXCPP
7842         save_CPPFLAGS=$CPPFLAGS
7843         save_CXXFLAGS=$CXXFLAGS
7844         save_LDFLAGS=$LDFLAGS
7845         save_LIBS=$LIBS
7846         CXX=$COMPILER_PLUGINS_CXX
7847         CXXCPP="$COMPILER_PLUGINS_CXX -E"
7848         CPPFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7849         CXXFLAGS="$COMPILER_PLUGINS_CXXFLAGS"
7850         AC_CHECK_HEADER(clang/Basic/SourceLocation.h,
7851             [COMPILER_PLUGINS=TRUE],
7852             [
7853             if test "$compiler_plugins" = "yes"; then
7854                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
7855             else
7856                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
7857                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
7858             fi
7859             ])
7860         dnl TODO: Windows doesn't use LO_CLANG_SHARED_PLUGINS for now, see corresponding TODO
7861         dnl comment in compilerplugins/Makefile-clang.mk:
7862         if test -n "$COMPILER_PLUGINS" && test "$_os" != "WINNT"; then
7863             LDFLAGS=""
7864             AC_MSG_CHECKING([for clang libraries to use])
7865             if test -z "$CLANGTOOLLIBS"; then
7866                 LIBS="-lclangTooling -lclangFrontend -lclangDriver -lclangParse -lclangSema -lclangEdit \
7867  -lclangAnalysis -lclangAST -lclangLex -lclangSerialization -lclangBasic $COMPILER_PLUGINS_LINKFLAGS"
7868                 AC_LINK_IFELSE([
7869                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7870                         [[ clang::FullSourceLoc().dump(); ]])
7871                 ],[CLANGTOOLLIBS="$LIBS"],[])
7872             fi
7873             if test -z "$CLANGTOOLLIBS"; then
7874                 LIBS="-lclang-cpp $COMPILER_PLUGINS_LINKFLAGS"
7875                 AC_LINK_IFELSE([
7876                     AC_LANG_PROGRAM([[#include "clang/Basic/SourceLocation.h"]],
7877                         [[ clang::FullSourceLoc().dump(); ]])
7878                 ],[CLANGTOOLLIBS="$LIBS"],[])
7879             fi
7880             AC_MSG_RESULT([$CLANGTOOLLIBS])
7881             if test -z "$CLANGTOOLLIBS"; then
7882                 if test "$compiler_plugins" = "yes"; then
7883                     AC_MSG_ERROR([Cannot find Clang libraries to build compiler plugins.])
7884                 else
7885                     AC_MSG_WARN([Cannot find Clang libraries to build compiler plugins, plugins disabled])
7886                     add_warning "Cannot find Clang libraries to build compiler plugins, plugins disabled."
7887                 fi
7888                 COMPILER_PLUGINS=
7889             fi
7890             if test -n "$COMPILER_PLUGINS"; then
7891                 if test -z "$CLANGSYSINCLUDE"; then
7892                     if test -n "$LLVM_CONFIG"; then
7893                         # Path to the clang system headers (no idea if there's a better way to get it).
7894                         CLANGSYSINCLUDE=$($LLVM_CONFIG --libdir)/clang/$($LLVM_CONFIG --version | sed 's/git\|svn//')/include
7895                     fi
7896                 fi
7897             fi
7898         fi
7899         CXX=$save_CXX
7900         CXXCPP=$save_CXXCPP
7901         CPPFLAGS=$save_CPPFLAGS
7902         CXXFLAGS=$save_CXXFLAGS
7903         LDFLAGS=$save_LDFLAGS
7904         LIBS="$save_LIBS"
7905         AC_LANG_POP([C++])
7907         AC_MSG_CHECKING([whether the compiler for building compilerplugins is actually Clang])
7908         AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
7909             #ifndef __clang__
7910             you lose
7911             #endif
7912             int foo=42;
7913             ]])],
7914             [AC_MSG_RESULT([yes])
7915              COMPILER_PLUGINS_COM_IS_CLANG=TRUE],
7916             [AC_MSG_RESULT([no])])
7917         AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
7918     fi
7919 else
7920     if test "$enable_compiler_plugins" = "yes"; then
7921         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
7922     fi
7924 COMPILER_PLUGINS_ANALYZER_PCH=
7925 if test "$enable_compiler_plugins_analyzer_pch" != no; then
7926     COMPILER_PLUGINS_ANALYZER_PCH=TRUE
7928 AC_SUBST(COMPILER_PLUGINS)
7929 AC_SUBST(COMPILER_PLUGINS_ANALYZER_PCH)
7930 AC_SUBST(COMPILER_PLUGINS_COM_IS_CLANG)
7931 AC_SUBST(COMPILER_PLUGINS_CXX)
7932 AC_SUBST(COMPILER_PLUGINS_CXXFLAGS)
7933 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
7934 AC_SUBST(COMPILER_PLUGINS_DEBUG)
7935 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
7936 AC_SUBST(CLANGDIR)
7937 AC_SUBST(CLANGLIBDIR)
7938 AC_SUBST(CLANGTOOLLIBS)
7939 AC_SUBST(CLANGSYSINCLUDE)
7941 # Plugin to help linker.
7942 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
7943 # This makes --enable-lto build with clang work.
7944 AC_SUBST(LD_PLUGIN)
7946 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
7947 AC_SUBST(HAVE_POSIX_FALLOCATE)
7949 JITC_PROCESSOR_TYPE=""
7950 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
7951     # IBMs JDK needs this...
7952     JITC_PROCESSOR_TYPE=6
7953     export JITC_PROCESSOR_TYPE
7955 AC_SUBST([JITC_PROCESSOR_TYPE])
7957 # Misc Windows Stuff
7958 AC_ARG_WITH(ucrt-dir,
7959     AS_HELP_STRING([--with-ucrt-dir],
7960         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
7961         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
7962         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
7963             Windows6.1-KB2999226-x64.msu
7964             Windows6.1-KB2999226-x86.msu
7965             Windows8.1-KB2999226-x64.msu
7966             Windows8.1-KB2999226-x86.msu
7967             Windows8-RT-KB2999226-x64.msu
7968             Windows8-RT-KB2999226-x86.msu
7969         A zip archive including those files is available from Microsoft site:
7970         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
7973 UCRT_REDISTDIR="$with_ucrt_dir"
7974 if test $_os = "WINNT"; then
7975     find_msvc_x64_dlls
7976     for i in $PKGFORMAT; do
7977         if test "$i" = msi; then
7978             find_msms
7979             break
7980         fi
7981     done
7982     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
7983     MSVC_DLLS="$msvcdlls"
7984     test -n "$msmdir" && MSM_PATH=`win_short_path_for_make "$msmdir"`
7985     # MSVC 15.3 changed it to VC141
7986     if echo "$msvcdllpath" | grep -q "VC142.CRT$"; then
7987         SCPDEFS="$SCPDEFS -DWITH_VC142_REDIST"
7988     elif echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
7989         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
7990     else
7991         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
7992     fi
7994     if test "$UCRT_REDISTDIR" = "no"; then
7995         dnl explicitly disabled
7996         UCRT_REDISTDIR=""
7997     else
7998         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
7999                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
8000                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
8001                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
8002                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
8003                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
8004             UCRT_REDISTDIR=""
8005             if test -n "$PKGFORMAT"; then
8006                for i in $PKGFORMAT; do
8007                    case "$i" in
8008                    msi)
8009                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
8010                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
8011                        ;;
8012                    esac
8013                done
8014             fi
8015         fi
8016     fi
8019 AC_SUBST(UCRT_REDISTDIR)
8020 AC_SUBST(MSVC_DLL_PATH)
8021 AC_SUBST(MSVC_DLLS)
8022 AC_SUBST(MSM_PATH)
8024 dnl ===================================================================
8025 dnl Checks for Java
8026 dnl ===================================================================
8027 if test "$ENABLE_JAVA" != ""; then
8029     # Windows-specific tests
8030     if test "$build_os" = "cygwin"; then
8031         if test -z "$with_jdk_home"; then
8032             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
8033             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
8034             reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
8035             if test -n "$regvalue"; then
8036                 ver=$regvalue
8037                 reg_get_value "$WIN_HOST_BITS" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
8038                 with_jdk_home=$regvalue
8039             fi
8040             howfound="found automatically"
8041         else
8042             with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
8043             howfound="you passed"
8044         fi
8046         if ! test -f "$with_jdk_home/lib/jvm.lib" -a -f "$with_jdk_home/bin/java.exe"; then
8047             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])
8048         fi
8049     fi
8051     # 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.
8052     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
8053     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
8054         with_jdk_home=`/usr/libexec/java_home`
8055     fi
8057     JAVA_HOME=; export JAVA_HOME
8058     if test -z "$with_jdk_home"; then
8059         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
8060     else
8061         _java_path="$with_jdk_home/bin/$with_java"
8062         dnl Check if there is a Java interpreter at all.
8063         if test -x "$_java_path"; then
8064             JAVAINTERPRETER=$_java_path
8065         else
8066             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
8067         fi
8068     fi
8070     dnl Check that the JDK found is correct architecture (at least 2 reasons to
8071     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
8072     dnl loaded by java to run JunitTests:
8073     if test "$build_os" = "cygwin" -a "$cross_compiling" != "yes"; then
8074         shortjdkhome=`cygpath -d "$with_jdk_home"`
8075         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
8076             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
8077             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8078         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
8079             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8080             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8081         fi
8083         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
8084             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
8085         fi
8086         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
8087     elif test "$cross_compiling" != "yes"; then
8088         case $CPUNAME in
8089             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
8090                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
8091                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
8092                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
8093                 fi
8094                 ;;
8095             *) # assumption: everything else 32-bit
8096                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
8097                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
8098                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
8099                 fi
8100                 ;;
8101         esac
8102     fi
8105 dnl ===================================================================
8106 dnl Checks for JDK.
8107 dnl ===================================================================
8109 # Whether all the complexity here actually is needed any more or not, no idea.
8111 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8112     _gij_longver=0
8113     AC_MSG_CHECKING([the installed JDK])
8114     if test -n "$JAVAINTERPRETER"; then
8115         dnl java -version sends output to stderr!
8116         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
8117             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8118         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
8119             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8120         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
8121             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8122         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
8123             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
8124         else
8125             JDK=sun
8127             dnl Sun JDK specific tests
8128             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
8129             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
8131             if test "$_jdk_ver" -lt 10900; then
8132                 AC_MSG_ERROR([JDK is too old, you need at least 9 ($_jdk_ver < 10900)])
8133             fi
8134             if test "$_jdk_ver" -gt 10900; then
8135                 JAVA_CLASSPATH_NOT_SET=TRUE
8136             fi
8138             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
8139             if test "$_os" = "WINNT"; then
8140                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
8141             fi
8142             AC_MSG_RESULT([found $JAVA_HOME (JDK $_jdk)])
8144             # set to limit VM usage for JunitTests
8145             JAVAIFLAGS=-Xmx64M
8146             # set to limit VM usage for javac
8147             JAVACFLAGS=-J-Xmx128M
8148         fi
8149     else
8150         AC_MSG_ERROR([Java not found. You need at least JDK 9])
8151     fi
8152 else
8153     if test -z "$ENABLE_JAVA"; then
8154         dnl Java disabled
8155         JAVA_HOME=
8156         export JAVA_HOME
8157     elif test "$cross_compiling" = "yes"; then
8158         # Just assume compatibility of build and host JDK
8159         JDK=$JDK_FOR_BUILD
8160         JAVAIFLAGS=$JAVAIFLAGS_FOR_BUILD
8161     fi
8164 dnl ===================================================================
8165 dnl Checks for javac
8166 dnl ===================================================================
8167 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8168     javacompiler="javac"
8169     : ${JAVA_SOURCE_VER=8}
8170     : ${JAVA_TARGET_VER=8}
8171     if test -z "$with_jdk_home"; then
8172         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
8173     else
8174         _javac_path="$with_jdk_home/bin/$javacompiler"
8175         dnl Check if there is a Java compiler at all.
8176         if test -x "$_javac_path"; then
8177             JAVACOMPILER=$_javac_path
8178         fi
8179     fi
8180     if test -z "$JAVACOMPILER"; then
8181         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
8182     fi
8183     if test "$build_os" = "cygwin"; then
8184         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
8185             JAVACOMPILER="${JAVACOMPILER}.exe"
8186         fi
8187         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
8188     fi
8191 dnl ===================================================================
8192 dnl Checks for javadoc
8193 dnl ===================================================================
8194 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8195     if test -z "$with_jdk_home"; then
8196         AC_PATH_PROG(JAVADOC, javadoc)
8197     else
8198         _javadoc_path="$with_jdk_home/bin/javadoc"
8199         dnl Check if there is a javadoc at all.
8200         if test -x "$_javadoc_path"; then
8201             JAVADOC=$_javadoc_path
8202         else
8203             AC_PATH_PROG(JAVADOC, javadoc)
8204         fi
8205     fi
8206     if test -z "$JAVADOC"; then
8207         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
8208     fi
8209     if test "$build_os" = "cygwin"; then
8210         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
8211             JAVADOC="${JAVADOC}.exe"
8212         fi
8213         JAVADOC=`win_short_path_for_make "$JAVADOC"`
8214     fi
8216     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
8217     JAVADOCISGJDOC="yes"
8218     fi
8220 AC_SUBST(JAVADOC)
8221 AC_SUBST(JAVADOCISGJDOC)
8223 if test "$ENABLE_JAVA" != "" -a \( "$cross_compiling" != "yes" -o -n "$with_jdk_home" \); then
8224     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
8225     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
8226         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
8227            # try to recover first by looking whether we have an alternative
8228            # system as in Debian or newer SuSEs where following /usr/bin/javac
8229            # over /etc/alternatives/javac leads to the right bindir where we
8230            # just need to strip a bit away to get a valid JAVA_HOME
8231            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
8232         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
8233             # maybe only one level of symlink (e.g. on Mac)
8234             JAVA_HOME=$(readlink $JAVACOMPILER)
8235             if test "$(dirname $JAVA_HOME)" = "."; then
8236                 # we've got no path to trim back
8237                 JAVA_HOME=""
8238             fi
8239         else
8240             # else warn
8241             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
8242             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
8243             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
8244             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
8245         fi
8246         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
8247         if test "$JAVA_HOME" != "/usr"; then
8248             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8249                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
8250                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
8251                 dnl Tiger already returns a JDK path...
8252                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
8253             else
8254                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
8255                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
8256                 dnl that checks which version to run
8257                 if test -f "$JAVA_HOME"; then
8258                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
8259                 fi
8260             fi
8261         fi
8262     fi
8263     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
8265     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
8266     if test -z "$JAVA_HOME"; then
8267         if test "x$with_jdk_home" = "x"; then
8268             cat > findhome.java <<_ACEOF
8269 [import java.io.File;
8271 class findhome
8273     public static void main(String args[])
8274     {
8275         String jrelocation = System.getProperty("java.home");
8276         File jre = new File(jrelocation);
8277         System.out.println(jre.getParent());
8278     }
8280 _ACEOF
8281             AC_MSG_CHECKING([if javac works])
8282             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
8283             AC_TRY_EVAL(javac_cmd)
8284             if test $? = 0 -a -f ./findhome.class; then
8285                 AC_MSG_RESULT([javac works])
8286             else
8287                 echo "configure: javac test failed" >&5
8288                 cat findhome.java >&5
8289                 AC_MSG_ERROR([javac does not work - java projects will not build!])
8290             fi
8291             AC_MSG_CHECKING([if gij knows its java.home])
8292             JAVA_HOME=`$JAVAINTERPRETER findhome`
8293             if test $? = 0 -a "$JAVA_HOME" != ""; then
8294                 AC_MSG_RESULT([$JAVA_HOME])
8295             else
8296                 echo "configure: java test failed" >&5
8297                 cat findhome.java >&5
8298                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
8299             fi
8300             # clean-up after ourselves
8301             rm -f ./findhome.java ./findhome.class
8302         else
8303             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
8304         fi
8305     fi
8307     # now check if $JAVA_HOME is really valid
8308     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
8309         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
8310             AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
8311             AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
8312             AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
8313             add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
8314             add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
8315             add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
8316         fi
8317     fi
8318     PathFormat "$JAVA_HOME"
8319     JAVA_HOME="$formatted_path"
8322 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
8323     "$_os" != Darwin
8324 then
8325     AC_MSG_CHECKING([for JAWT lib])
8326     if test "$_os" = WINNT; then
8327         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
8328         JAWTLIB=jawt.lib
8329     else
8330         case "$host_cpu" in
8331         arm*)
8332             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
8333             JAVA_ARCH=$my_java_arch
8334             ;;
8335         i*86)
8336             my_java_arch=i386
8337             ;;
8338         m68k)
8339             my_java_arch=m68k
8340             ;;
8341         powerpc)
8342             my_java_arch=ppc
8343             ;;
8344         powerpc64)
8345             my_java_arch=ppc64
8346             ;;
8347         powerpc64le)
8348             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
8349             JAVA_ARCH=$my_java_arch
8350             ;;
8351         sparc64)
8352             my_java_arch=sparcv9
8353             ;;
8354         x86_64)
8355             my_java_arch=amd64
8356             ;;
8357         *)
8358             my_java_arch=$host_cpu
8359             ;;
8360         esac
8361         # This is where JDK9 puts the library
8362         if test -e "$JAVA_HOME/lib/libjawt.so"; then
8363             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
8364         else
8365             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
8366         fi
8367         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
8368     fi
8369     AC_MSG_RESULT([$JAWTLIB])
8371 AC_SUBST(JAWTLIB)
8373 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
8374     case "$host_os" in
8376     aix*)
8377         JAVAINC="-I$JAVA_HOME/include"
8378         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
8379         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8380         ;;
8382     cygwin*|wsl*)
8383         JAVAINC="-I$JAVA_HOME/include/win32"
8384         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
8385         ;;
8387     darwin*|macos*)
8388         if test -d "$JAVA_HOME/include/darwin"; then
8389             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
8390         else
8391             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
8392         fi
8393         ;;
8395     dragonfly*)
8396         JAVAINC="-I$JAVA_HOME/include"
8397         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8398         ;;
8400     freebsd*)
8401         JAVAINC="-I$JAVA_HOME/include"
8402         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
8403         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
8404         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8405         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8406         ;;
8408     k*bsd*-gnu*)
8409         JAVAINC="-I$JAVA_HOME/include"
8410         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8411         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8412         ;;
8414     linux-gnu*)
8415         JAVAINC="-I$JAVA_HOME/include"
8416         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
8417         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8418         ;;
8420     *netbsd*)
8421         JAVAINC="-I$JAVA_HOME/include"
8422         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
8423         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8424        ;;
8426     openbsd*)
8427         JAVAINC="-I$JAVA_HOME/include"
8428         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
8429         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8430         ;;
8432     solaris*)
8433         JAVAINC="-I$JAVA_HOME/include"
8434         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
8435         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
8436         ;;
8437     esac
8439 SOLARINC="$SOLARINC $JAVAINC"
8441 if test "$ENABLE_JAVA" != "" -a "$cross_compiling" != "yes"; then
8442     JAVA_HOME_FOR_BUILD=$JAVA_HOME
8443     JAVAIFLAGS_FOR_BUILD=$JAVAIFLAGS
8444     JDK_FOR_BUILD=$JDK
8447 AC_SUBST(JAVACFLAGS)
8448 AC_SUBST(JAVACOMPILER)
8449 AC_SUBST(JAVAINTERPRETER)
8450 AC_SUBST(JAVAIFLAGS)
8451 AC_SUBST(JAVAIFLAGS_FOR_BUILD)
8452 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
8453 AC_SUBST(JAVA_HOME)
8454 AC_SUBST(JAVA_HOME_FOR_BUILD)
8455 AC_SUBST(JDK)
8456 AC_SUBST(JDK_FOR_BUILD)
8457 AC_SUBST(JAVA_SOURCE_VER)
8458 AC_SUBST(JAVA_TARGET_VER)
8461 dnl ===================================================================
8462 dnl Export file validation
8463 dnl ===================================================================
8464 AC_MSG_CHECKING([whether to enable export file validation])
8465 if test "$with_export_validation" != "no"; then
8466     if test -z "$ENABLE_JAVA"; then
8467         if test "$with_export_validation" = "yes"; then
8468             AC_MSG_ERROR([requested, but Java is disabled])
8469         else
8470             AC_MSG_RESULT([no, as Java is disabled])
8471         fi
8472     elif ! test -d "${SRC_ROOT}/schema"; then
8473         if test "$with_export_validation" = "yes"; then
8474             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
8475         else
8476             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
8477         fi
8478     else
8479         AC_MSG_RESULT([yes])
8480         AC_DEFINE(HAVE_EXPORT_VALIDATION)
8482         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
8483         if test -z "$ODFVALIDATOR"; then
8484             # remember to download the ODF toolkit with validator later
8485             AC_MSG_NOTICE([no odfvalidator found, will download it])
8486             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
8487             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
8489             # and fetch name of odfvalidator jar name from download.lst
8490             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
8491             AC_SUBST(ODFVALIDATOR_JAR)
8493             if test -z "$ODFVALIDATOR_JAR"; then
8494                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
8495             fi
8496         fi
8497         if test "$build_os" = "cygwin"; then
8498             # In case of Cygwin it will be executed from Windows,
8499             # so we need to run bash and absolute path to validator
8500             # so instead of "odfvalidator" it will be
8501             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
8502             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
8503         else
8504             ODFVALIDATOR="sh $ODFVALIDATOR"
8505         fi
8506         AC_SUBST(ODFVALIDATOR)
8509         AC_PATH_PROGS(OFFICEOTRON, officeotron)
8510         if test -z "$OFFICEOTRON"; then
8511             # remember to download the officeotron with validator later
8512             AC_MSG_NOTICE([no officeotron found, will download it])
8513             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
8514             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
8516             # and fetch name of officeotron jar name from download.lst
8517             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
8518             AC_SUBST(OFFICEOTRON_JAR)
8520             if test -z "$OFFICEOTRON_JAR"; then
8521                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
8522             fi
8523         else
8524             # check version of existing officeotron
8525             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
8526             if test 0"$OFFICEOTRON_VER" -lt 704; then
8527                 AC_MSG_ERROR([officeotron too old])
8528             fi
8529         fi
8530         if test "$build_os" = "cygwin"; then
8531             # In case of Cygwin it will be executed from Windows,
8532             # so we need to run bash and absolute path to validator
8533             # so instead of "odfvalidator" it will be
8534             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
8535             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
8536         else
8537             OFFICEOTRON="sh $OFFICEOTRON"
8538         fi
8539     fi
8540     AC_SUBST(OFFICEOTRON)
8541 else
8542     AC_MSG_RESULT([no])
8545 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
8546 if test "$with_bffvalidator" != "no"; then
8547     AC_DEFINE(HAVE_BFFVALIDATOR)
8549     if test "$with_export_validation" = "no"; then
8550         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
8551     fi
8553     if test "$with_bffvalidator" = "yes"; then
8554         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
8555     else
8556         BFFVALIDATOR="$with_bffvalidator"
8557     fi
8559     if test "$build_os" = "cygwin"; then
8560         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
8561             AC_MSG_RESULT($BFFVALIDATOR)
8562         else
8563             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8564         fi
8565     elif test -n "$BFFVALIDATOR"; then
8566         # We are not in Cygwin but need to run Windows binary with wine
8567         AC_PATH_PROGS(WINE, wine)
8569         # so swap in a shell wrapper that converts paths transparently
8570         BFFVALIDATOR_EXE="$BFFVALIDATOR"
8571         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
8572         AC_SUBST(BFFVALIDATOR_EXE)
8573         AC_MSG_RESULT($BFFVALIDATOR)
8574     else
8575         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
8576     fi
8577     AC_SUBST(BFFVALIDATOR)
8578 else
8579     AC_MSG_RESULT([no])
8582 dnl ===================================================================
8583 dnl Check for C preprocessor to use
8584 dnl ===================================================================
8585 AC_MSG_CHECKING([which C preprocessor to use in idlc])
8586 if test -n "$with_idlc_cpp"; then
8587     AC_MSG_RESULT([$with_idlc_cpp])
8588     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
8589 else
8590     AC_MSG_RESULT([ucpp])
8591     AC_MSG_CHECKING([which ucpp tp use])
8592     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
8593         AC_MSG_RESULT([external])
8594         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
8595     else
8596         AC_MSG_RESULT([internal])
8597         BUILD_TYPE="$BUILD_TYPE UCPP"
8598     fi
8600 AC_SUBST(SYSTEM_UCPP)
8602 dnl ===================================================================
8603 dnl Check for epm (not needed for Windows)
8604 dnl ===================================================================
8605 AC_MSG_CHECKING([whether to enable EPM for packing])
8606 if test "$enable_epm" = "yes"; then
8607     AC_MSG_RESULT([yes])
8608     if test "$_os" != "WINNT"; then
8609         if test $_os = Darwin; then
8610             EPM=internal
8611         elif test -n "$with_epm"; then
8612             EPM=$with_epm
8613         else
8614             AC_PATH_PROG(EPM, epm, no)
8615         fi
8616         if test "$EPM" = "no" -o "$EPM" = "internal"; then
8617             AC_MSG_NOTICE([EPM will be built.])
8618             BUILD_TYPE="$BUILD_TYPE EPM"
8619             EPM=${WORKDIR}/UnpackedTarball/epm/epm
8620         else
8621             # Gentoo has some epm which is something different...
8622             AC_MSG_CHECKING([whether the found epm is the right epm])
8623             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
8624                 AC_MSG_RESULT([yes])
8625             else
8626                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8627             fi
8628             AC_MSG_CHECKING([epm version])
8629             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
8630             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
8631                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
8632                 AC_MSG_RESULT([OK, >= 3.7])
8633             else
8634                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
8635                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
8636             fi
8637         fi
8638     fi
8640     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
8641         AC_MSG_CHECKING([for rpm])
8642         for a in "$RPM" rpmbuild rpm; do
8643             $a --usage >/dev/null 2> /dev/null
8644             if test $? -eq 0; then
8645                 RPM=$a
8646                 break
8647             else
8648                 $a --version >/dev/null 2> /dev/null
8649                 if test $? -eq 0; then
8650                     RPM=$a
8651                     break
8652                 fi
8653             fi
8654         done
8655         if test -z "$RPM"; then
8656             AC_MSG_ERROR([not found])
8657         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
8658             RPM_PATH=`which $RPM`
8659             AC_MSG_RESULT([$RPM_PATH])
8660             SCPDEFS="$SCPDEFS -DWITH_RPM"
8661         else
8662             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
8663         fi
8664     fi
8665     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
8666         AC_PATH_PROG(DPKG, dpkg, no)
8667         if test "$DPKG" = "no"; then
8668             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
8669         fi
8670     fi
8671     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
8672        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8673         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
8674             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
8675                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
8676                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
8677                     AC_MSG_RESULT([yes])
8678                 else
8679                     AC_MSG_RESULT([no])
8680                     if echo "$PKGFORMAT" | $GREP -q rpm; then
8681                         _pt="rpm"
8682                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
8683                         add_warning "the rpms will need to be installed with --nodeps"
8684                     else
8685                         _pt="pkg"
8686                     fi
8687                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
8688                     add_warning "the ${_pt}s will not be relocatable"
8689                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
8690                                  relocation will work, you need to patch your epm with the
8691                                  patch in epm/epm-3.7.patch or build with
8692                                  --with-epm=internal which will build a suitable epm])
8693                 fi
8694             fi
8695         fi
8696     fi
8697     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
8698         AC_PATH_PROG(PKGMK, pkgmk, no)
8699         if test "$PKGMK" = "no"; then
8700             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
8701         fi
8702     fi
8703     AC_SUBST(RPM)
8704     AC_SUBST(DPKG)
8705     AC_SUBST(PKGMK)
8706 else
8707     for i in $PKGFORMAT; do
8708         case "$i" in
8709         aix | bsd | deb | pkg | rpm | native | portable)
8710             AC_MSG_ERROR(
8711                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
8712             ;;
8713         esac
8714     done
8715     AC_MSG_RESULT([no])
8716     EPM=NO
8718 AC_SUBST(EPM)
8720 ENABLE_LWP=
8721 if test "$enable_lotuswordpro" = "yes"; then
8722     ENABLE_LWP="TRUE"
8724 AC_SUBST(ENABLE_LWP)
8726 dnl ===================================================================
8727 dnl Check for building ODK
8728 dnl ===================================================================
8729 if test "$enable_odk" = no; then
8730     unset DOXYGEN
8731 else
8732     if test "$with_doxygen" = no; then
8733         AC_MSG_CHECKING([for doxygen])
8734         unset DOXYGEN
8735         AC_MSG_RESULT([no])
8736     else
8737         if test "$with_doxygen" = yes; then
8738             AC_PATH_PROG([DOXYGEN], [doxygen])
8739             if test -z "$DOXYGEN"; then
8740                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
8741             fi
8742             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
8743                 if ! dot -V 2>/dev/null; then
8744                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
8745                 fi
8746             fi
8747         else
8748             AC_MSG_CHECKING([for doxygen])
8749             DOXYGEN=$with_doxygen
8750             AC_MSG_RESULT([$DOXYGEN])
8751         fi
8752         if test -n "$DOXYGEN"; then
8753             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
8754             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
8755             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
8756                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
8757             fi
8758         fi
8759     fi
8761 AC_SUBST([DOXYGEN])
8763 AC_MSG_CHECKING([whether to build the ODK])
8764 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
8765     AC_MSG_RESULT([yes])
8766     BUILD_TYPE="$BUILD_TYPE ODK"
8767 else
8768     AC_MSG_RESULT([no])
8771 dnl ===================================================================
8772 dnl Check for system zlib
8773 dnl ===================================================================
8774 if test "$with_system_zlib" = "auto"; then
8775     case "$_os" in
8776     WINNT)
8777         with_system_zlib="$with_system_libs"
8778         ;;
8779     *)
8780         if test "$enable_fuzzers" != "yes"; then
8781             with_system_zlib=yes
8782         else
8783             with_system_zlib=no
8784         fi
8785         ;;
8786     esac
8789 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8790 dnl and has no pkg-config for it at least on some tinderboxes,
8791 dnl so leaving that out for now
8792 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8793 AC_MSG_CHECKING([which zlib to use])
8794 if test "$with_system_zlib" = "yes"; then
8795     AC_MSG_RESULT([external])
8796     SYSTEM_ZLIB=TRUE
8797     AC_CHECK_HEADER(zlib.h, [],
8798         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8799     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8800         [AC_MSG_ERROR(zlib not found or functional)], [])
8801 else
8802     AC_MSG_RESULT([internal])
8803     SYSTEM_ZLIB=
8804     BUILD_TYPE="$BUILD_TYPE ZLIB"
8805     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8806     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8808 AC_SUBST(ZLIB_CFLAGS)
8809 AC_SUBST(ZLIB_LIBS)
8810 AC_SUBST(SYSTEM_ZLIB)
8812 dnl ===================================================================
8813 dnl Check for system jpeg
8814 dnl ===================================================================
8815 AC_MSG_CHECKING([which libjpeg to use])
8816 if test "$with_system_jpeg" = "yes"; then
8817     AC_MSG_RESULT([external])
8818     SYSTEM_LIBJPEG=TRUE
8819     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8820         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8821     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8822         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8823 else
8824     SYSTEM_LIBJPEG=
8825     AC_MSG_RESULT([internal, libjpeg-turbo])
8826     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8827     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
8828     if test "$COM" = "MSC"; then
8829         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
8830     else
8831         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
8832     fi
8834     case "$host_cpu" in
8835     x86_64 | amd64 | i*86 | x86 | ia32)
8836         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8837         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8838             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8839                 NASM="$LODE_HOME/opt/bin/nasm"
8840             elif test -x "/opt/lo/bin/nasm"; then
8841                 NASM="/opt/lo/bin/nasm"
8842             fi
8843         fi
8845         if test -n "$NASM"; then
8846             AC_MSG_CHECKING([for object file format of host system])
8847             case "$host_os" in
8848               cygwin* | mingw* | pw32* | wsl*)
8849                 case "$host_cpu" in
8850                   x86_64)
8851                     objfmt='Win64-COFF'
8852                     ;;
8853                   *)
8854                     objfmt='Win32-COFF'
8855                     ;;
8856                 esac
8857               ;;
8858               msdosdjgpp* | go32*)
8859                 objfmt='COFF'
8860               ;;
8861               os2-emx*) # not tested
8862                 objfmt='MSOMF' # obj
8863               ;;
8864               linux*coff* | linux*oldld*)
8865                 objfmt='COFF' # ???
8866               ;;
8867               linux*aout*)
8868                 objfmt='a.out'
8869               ;;
8870               linux*)
8871                 case "$host_cpu" in
8872                   x86_64)
8873                     objfmt='ELF64'
8874                     ;;
8875                   *)
8876                     objfmt='ELF'
8877                     ;;
8878                 esac
8879               ;;
8880               kfreebsd* | freebsd* | netbsd* | openbsd*)
8881                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
8882                   objfmt='BSD-a.out'
8883                 else
8884                   case "$host_cpu" in
8885                     x86_64 | amd64)
8886                       objfmt='ELF64'
8887                       ;;
8888                     *)
8889                       objfmt='ELF'
8890                       ;;
8891                   esac
8892                 fi
8893               ;;
8894               solaris* | sunos* | sysv* | sco*)
8895                 case "$host_cpu" in
8896                   x86_64)
8897                     objfmt='ELF64'
8898                     ;;
8899                   *)
8900                     objfmt='ELF'
8901                     ;;
8902                 esac
8903               ;;
8904               darwin* | rhapsody* | nextstep* | openstep* | macos*)
8905                 case "$host_cpu" in
8906                   x86_64)
8907                     objfmt='Mach-O64'
8908                     ;;
8909                   *)
8910                     objfmt='Mach-O'
8911                     ;;
8912                 esac
8913               ;;
8914               *)
8915                 objfmt='ELF ?'
8916               ;;
8917             esac
8919             AC_MSG_RESULT([$objfmt])
8920             if test "$objfmt" = 'ELF ?'; then
8921               objfmt='ELF'
8922               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
8923             fi
8925             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
8926             case "$objfmt" in
8927               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
8928               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
8929               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
8930               COFF)       NAFLAGS='-fcoff -DCOFF';;
8931               a.out)      NAFLAGS='-faout -DAOUT';;
8932               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
8933               ELF)        NAFLAGS='-felf -DELF';;
8934               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
8935               RDF)        NAFLAGS='-frdf -DRDF';;
8936               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
8937               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
8938             esac
8939             AC_MSG_RESULT([$NAFLAGS])
8941             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
8942             cat > conftest.asm << EOF
8943             [%line __oline__ "configure"
8944                     section .text
8945                     global  _main,main
8946             _main:
8947             main:   xor     eax,eax
8948                     ret
8949             ]
8951             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
8952             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
8953               AC_MSG_RESULT(yes)
8954             else
8955               echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
8956               cat conftest.asm >&AS_MESSAGE_LOG_FD
8957               rm -rf conftest*
8958               AC_MSG_RESULT(no)
8959               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
8960               NASM=""
8961             fi
8963         fi
8965         if test -z "$NASM"; then
8966 cat << _EOS
8967 ****************************************************************************
8968 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
8969 To get one please:
8971 _EOS
8972             if test "$build_os" = "cygwin"; then
8973 cat << _EOS
8974 install a pre-compiled binary for Win32
8976 mkdir -p /opt/lo/bin
8977 cd /opt/lo/bin
8978 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
8979 chmod +x nasm
8981 or get and install one from http://www.nasm.us/
8983 Then re-run autogen.sh
8985 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
8986 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
8988 _EOS
8989             else
8990 cat << _EOS
8991 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
8993 _EOS
8994             fi
8995             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
8996             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
8997         fi
8998       ;;
8999     esac
9002 AC_SUBST(NASM)
9003 AC_SUBST(LIBJPEG_CFLAGS)
9004 AC_SUBST(LIBJPEG_LIBS)
9005 AC_SUBST(SYSTEM_LIBJPEG)
9007 dnl ===================================================================
9008 dnl Check for system clucene
9009 dnl ===================================================================
9010 dnl we should rather be using
9011 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
9012 dnl but the contribs-lib check seems tricky
9013 AC_MSG_CHECKING([which clucene to use])
9014 if test "$with_system_clucene" = "yes"; then
9015     AC_MSG_RESULT([external])
9016     SYSTEM_CLUCENE=TRUE
9017     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
9018     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
9019     FilterLibs "${CLUCENE_LIBS}"
9020     CLUCENE_LIBS="${filteredlibs}"
9021     AC_LANG_PUSH([C++])
9022     save_CXXFLAGS=$CXXFLAGS
9023     save_CPPFLAGS=$CPPFLAGS
9024     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
9025     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
9026     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
9027     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
9028     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
9029                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
9030     CXXFLAGS=$save_CXXFLAGS
9031     CPPFLAGS=$save_CPPFLAGS
9032     AC_LANG_POP([C++])
9034     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
9035 else
9036     AC_MSG_RESULT([internal])
9037     SYSTEM_CLUCENE=
9038     BUILD_TYPE="$BUILD_TYPE CLUCENE"
9040 AC_SUBST(SYSTEM_CLUCENE)
9041 AC_SUBST(CLUCENE_CFLAGS)
9042 AC_SUBST(CLUCENE_LIBS)
9044 dnl ===================================================================
9045 dnl Check for system expat
9046 dnl ===================================================================
9047 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
9049 dnl ===================================================================
9050 dnl Check for system xmlsec
9051 dnl ===================================================================
9052 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
9054 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
9055 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
9056     ENABLE_EOT="TRUE"
9057     AC_DEFINE([ENABLE_EOT])
9058     AC_MSG_RESULT([yes])
9060     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
9061 else
9062     ENABLE_EOT=
9063     AC_MSG_RESULT([no])
9065 AC_SUBST([ENABLE_EOT])
9067 dnl ===================================================================
9068 dnl Check for DLP libs
9069 dnl ===================================================================
9070 AS_IF([test "$COM" = "MSC"],
9071       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
9072       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
9074 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
9076 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
9078 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
9080 AS_IF([test "$COM" = "MSC"],
9081       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
9082       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
9084 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
9086 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
9088 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
9089 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.12])
9091 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
9093 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
9095 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
9097 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
9098 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.17])
9100 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
9101 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
9103 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
9105 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
9106 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
9108 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
9110 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
9112 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
9114 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
9116 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
9117 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.7])
9119 dnl ===================================================================
9120 dnl Check for system lcms2
9121 dnl ===================================================================
9122 if test "$with_system_lcms2" != "yes"; then
9123     SYSTEM_LCMS2=
9125 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
9126 if test "$GCC" = "yes"; then
9127     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
9129 if test "$COM" = "MSC"; then # override the above
9130     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
9133 dnl ===================================================================
9134 dnl Check for system cppunit
9135 dnl ===================================================================
9136 if test "$_os" != "Android" ; then
9137     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
9140 dnl ===================================================================
9141 dnl Check whether freetype is available
9142 dnl ===================================================================
9143 if test  "$test_freetype" = "yes"; then
9144     AC_MSG_CHECKING([whether freetype is available])
9145     # FreeType has 3 different kinds of versions
9146     # * release, like 2.4.10
9147     # * libtool, like 13.0.7 (this what pkg-config returns)
9148     # * soname
9149     # FreeType's docs/VERSION.DLL provides a table mapping between the three
9150     #
9151     # 9.9.3 is 2.2.0
9152     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
9153     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9154     FilterLibs "${FREETYPE_LIBS}"
9155     FREETYPE_LIBS="${filteredlibs}"
9156     SYSTEM_FREETYPE=TRUE
9157 else
9158     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
9159     if test "x$ac_config_site_64bit_host" = xYES; then
9160         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib64 -lfreetype"
9161     else
9162         FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
9163     fi
9165 AC_SUBST(FREETYPE_CFLAGS)
9166 AC_SUBST(FREETYPE_LIBS)
9167 AC_SUBST([SYSTEM_FREETYPE])
9169 # ===================================================================
9170 # Check for system libxslt
9171 # to prevent incompatibilities between internal libxml2 and external libxslt,
9172 # or vice versa, use with_system_libxml here
9173 # ===================================================================
9174 if test "$with_system_libxml" = "auto"; then
9175     case "$_os" in
9176     WINNT|iOS|Android)
9177         with_system_libxml="$with_system_libs"
9178         ;;
9179     *)
9180         if test "$enable_fuzzers" != "yes"; then
9181             with_system_libxml=yes
9182         else
9183             with_system_libxml=no
9184         fi
9185         ;;
9186     esac
9189 AC_MSG_CHECKING([which libxslt to use])
9190 if test "$with_system_libxml" = "yes"; then
9191     AC_MSG_RESULT([external])
9192     SYSTEM_LIBXSLT=TRUE
9193     if test "$_os" = "Darwin"; then
9194         dnl make sure to use SDK path
9195         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9196         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
9197         dnl omit -L/usr/lib
9198         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
9199         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
9200     else
9201         PKG_CHECK_MODULES(LIBXSLT, libxslt)
9202         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9203         FilterLibs "${LIBXSLT_LIBS}"
9204         LIBXSLT_LIBS="${filteredlibs}"
9205         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
9206         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9207         FilterLibs "${LIBEXSLT_LIBS}"
9208         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
9209     fi
9211     dnl Check for xsltproc
9212     AC_PATH_PROG(XSLTPROC, xsltproc, no)
9213     if test "$XSLTPROC" = "no"; then
9214         AC_MSG_ERROR([xsltproc is required])
9215     fi
9216 else
9217     AC_MSG_RESULT([internal])
9218     SYSTEM_LIBXSLT=
9219     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
9221 AC_SUBST(SYSTEM_LIBXSLT)
9222 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
9223     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
9225 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
9227 AC_SUBST(LIBEXSLT_CFLAGS)
9228 AC_SUBST(LIBEXSLT_LIBS)
9229 AC_SUBST(LIBXSLT_CFLAGS)
9230 AC_SUBST(LIBXSLT_LIBS)
9231 AC_SUBST(XSLTPROC)
9233 # ===================================================================
9234 # Check for system libxml
9235 # ===================================================================
9236 AC_MSG_CHECKING([which libxml to use])
9237 if test "$with_system_libxml" = "yes"; then
9238     AC_MSG_RESULT([external])
9239     SYSTEM_LIBXML=TRUE
9240     if test "$_os" = "Darwin"; then
9241         dnl make sure to use SDK path
9242         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
9243         dnl omit -L/usr/lib
9244         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
9245     elif test $_os = iOS; then
9246         dnl make sure to use SDK path
9247         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
9248         LIBXML_CFLAGS="-I$usr/include/libxml2"
9249         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
9250     else
9251         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
9252         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9253         FilterLibs "${LIBXML_LIBS}"
9254         LIBXML_LIBS="${filteredlibs}"
9255     fi
9257     dnl Check for xmllint
9258     AC_PATH_PROG(XMLLINT, xmllint, no)
9259     if test "$XMLLINT" = "no"; then
9260         AC_MSG_ERROR([xmllint is required])
9261     fi
9262 else
9263     AC_MSG_RESULT([internal])
9264     SYSTEM_LIBXML=
9265     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
9266     if test "$COM" = "MSC"; then
9267         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9268     fi
9269     if test "$COM" = "MSC"; then
9270         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
9271     else
9272         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
9273         if test "$_os" = Android; then
9274             LIBXML_LIBS="$LIBXML_LIBS -lm"
9275         fi
9276     fi
9277     BUILD_TYPE="$BUILD_TYPE LIBXML2"
9279 AC_SUBST(SYSTEM_LIBXML)
9280 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
9281     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
9283 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
9284 AC_SUBST(LIBXML_CFLAGS)
9285 AC_SUBST(LIBXML_LIBS)
9286 AC_SUBST(XMLLINT)
9288 # =====================================================================
9289 # Checking for a Python interpreter with version >= 3.3.
9290 # Optionally user can pass an option to configure, i. e.
9291 # ./configure PYTHON=/usr/bin/python
9292 # =====================================================================
9293 if test $_os = Darwin -a "$enable_python" != no -a "$enable_python" != fully-internal -a "$enable_python" != internal -a "$enable_python" != system; then
9294     # Only allowed choices for macOS are 'no', 'internal' (default), and 'fully-internal'
9295     # unless PYTHON is defined as above which allows 'system'
9296     enable_python=internal
9298 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
9299     if test -n "$PYTHON"; then
9300         PYTHON_FOR_BUILD=$PYTHON
9301     else
9302         # This allows a lack of system python with no error, we use internal one in that case.
9303         AM_PATH_PYTHON([3.3],, [:])
9304         # Clean PYTHON_VERSION checked below if cross-compiling
9305         PYTHON_VERSION=""
9306         if test "$PYTHON" != ":"; then
9307             PYTHON_FOR_BUILD=$PYTHON
9308         fi
9309     fi
9311 AC_SUBST(PYTHON_FOR_BUILD)
9313 # Checks for Python to use for Pyuno
9314 AC_MSG_CHECKING([which Python to use for Pyuno])
9315 case "$enable_python" in
9316 no|disable)
9317     if test -z $PYTHON_FOR_BUILD; then
9318         # Python is required to build LibreOffice. In theory we could separate the build-time Python
9319         # requirement from the choice whether to include Python stuff in the installer, but why
9320         # bother?
9321         AC_MSG_ERROR([Python is required at build time.])
9322     fi
9323     enable_python=no
9324     AC_MSG_RESULT([none])
9325     ;;
9326 ""|yes|auto)
9327     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
9328         AC_MSG_RESULT([no, overridden by --disable-scripting])
9329         enable_python=no
9330     elif test $build_os = cygwin; then
9331         dnl When building on Windows we don't attempt to use any installed
9332         dnl "system"  Python.
9333         AC_MSG_RESULT([fully internal])
9334         enable_python=internal
9335     elif test "$cross_compiling" = yes; then
9336         AC_MSG_RESULT([system])
9337         enable_python=system
9338     else
9339         # Unset variables set by the above AM_PATH_PYTHON so that
9340         # we actually do check anew.
9341         AC_MSG_RESULT([])
9342         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
9343         AM_PATH_PYTHON([3.3],, [:])
9344         AC_MSG_CHECKING([which Python to use for Pyuno])
9345         if test "$PYTHON" = ":"; then
9346             if test -z "$PYTHON_FOR_BUILD"; then
9347                 AC_MSG_RESULT([fully internal])
9348             else
9349                 AC_MSG_RESULT([internal])
9350             fi
9351             enable_python=internal
9352         else
9353             AC_MSG_RESULT([system])
9354             enable_python=system
9355         fi
9356     fi
9357     ;;
9358 internal)
9359     AC_MSG_RESULT([internal])
9360     ;;
9361 fully-internal)
9362     AC_MSG_RESULT([fully internal])
9363     enable_python=internal
9364     ;;
9365 system)
9366     AC_MSG_RESULT([system])
9367     if test "$_os" = Darwin -a -z "$PYTHON"; then
9368         AC_MSG_ERROR([--enable-python=system doesn't work on macOS because the version provided is obsolete])
9369     fi
9370     ;;
9372     AC_MSG_ERROR([Incorrect --enable-python option])
9373     ;;
9374 esac
9376 if test $enable_python != no; then
9377     BUILD_TYPE="$BUILD_TYPE PYUNO"
9380 if test $enable_python = system; then
9381     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
9382         # Fallback: Accept these in the environment, or as set above
9383         # for MacOSX.
9384         :
9385     elif test "$cross_compiling" != yes; then
9386         # Unset variables set by the above AM_PATH_PYTHON so that
9387         # we actually do check anew.
9388         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
9389         # This causes an error if no python command is found
9390         AM_PATH_PYTHON([3.3])
9391         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
9392         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
9393         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
9394         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
9395         if test -z "$PKG_CONFIG"; then
9396             PYTHON_CFLAGS="-I$python_include"
9397             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
9398         elif $PKG_CONFIG --exists python-$python_version-embed; then
9399             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
9400             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
9401         elif $PKG_CONFIG --exists python-$python_version; then
9402             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
9403             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
9404         else
9405             PYTHON_CFLAGS="-I$python_include"
9406             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
9407         fi
9408         FilterLibs "${PYTHON_LIBS}"
9409         PYTHON_LIBS="${filteredlibs}"
9410     else
9411         dnl How to find out the cross-compilation Python installation path?
9412         AC_MSG_CHECKING([for python version])
9413         AS_IF([test -n "$PYTHON_VERSION"],
9414               [AC_MSG_RESULT([$PYTHON_VERSION])],
9415               [AC_MSG_RESULT([not found])
9416                AC_MSG_ERROR([no usable python found])])
9417         test -n "$PYTHON_CFLAGS" && break
9418     fi
9420     dnl Check if the headers really work
9421     save_CPPFLAGS="$CPPFLAGS"
9422     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
9423     AC_CHECK_HEADER(Python.h)
9424     CPPFLAGS="$save_CPPFLAGS"
9426     # let the PYTHON_FOR_BUILD match the same python installation that
9427     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
9428     # better for PythonTests.
9429     PYTHON_FOR_BUILD=$PYTHON
9432 if test "$with_lxml" != no; then
9433     if test -z "$PYTHON_FOR_BUILD"; then
9434         case $build_os in
9435             cygwin)
9436                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
9437                 ;;
9438             *)
9439                 if test "$cross_compiling" != yes ; then
9440                     BUILD_TYPE="$BUILD_TYPE LXML"
9441                 fi
9442                 ;;
9443         esac
9444     else
9445         AC_MSG_CHECKING([for python lxml])
9446         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
9447             AC_MSG_RESULT([yes])
9448         else
9449             case $build_os in
9450                 cygwin)
9451                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
9452                     ;;
9453                 *)
9454                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
9455                         if test -n ${SYSTEM_LIBXSLT} -o -n ${SYSTEM_LIBXML}; then
9456                             AC_MSG_RESULT([no, and no system libxml/libxslt, gla11y will only report widget classes and ids])
9457                         else
9458                             BUILD_TYPE="$BUILD_TYPE LXML"
9459                             AC_MSG_RESULT([no, using internal lxml])
9460                         fi
9461                     else
9462                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
9463                     fi
9464                     ;;
9465             esac
9466         fi
9467     fi
9470 dnl By now enable_python should be "system", "internal" or "no"
9471 case $enable_python in
9472 system)
9473     SYSTEM_PYTHON=TRUE
9475     if test "x$ac_cv_header_Python_h" != "xyes"; then
9476        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
9477     fi
9479     AC_LANG_PUSH(C)
9480     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
9481     AC_MSG_CHECKING([for correct python library version])
9482        AC_RUN_IFELSE([AC_LANG_SOURCE([[
9483 #include <Python.h>
9485 int main(int argc, char **argv) {
9486    if ((PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
9487    else return 1;
9489        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3])],[AC_MSG_RESULT([skipped; cross-compiling])])
9490     AC_LANG_POP(C)
9492     dnl FIXME Check if the Python library can be linked with, too?
9493     ;;
9495 internal)
9496     SYSTEM_PYTHON=
9497     PYTHON_VERSION_MAJOR=3
9498     PYTHON_VERSION_MINOR=8
9499     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.8
9500     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
9501         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
9502     fi
9503     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
9504     BUILD_TYPE="$BUILD_TYPE PYTHON"
9505     if test "$OS" = LINUX -o "$OS" = WNT ; then
9506         BUILD_TYPE="$BUILD_TYPE LIBFFI"
9507     fi
9508     # Embedded Python dies without Home set
9509     if test "$HOME" = ""; then
9510         export HOME=""
9511     fi
9512     ;;
9514     DISABLE_PYTHON=TRUE
9515     SYSTEM_PYTHON=
9516     ;;
9518     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
9519     ;;
9520 esac
9522 AC_SUBST(DISABLE_PYTHON)
9523 AC_SUBST(SYSTEM_PYTHON)
9524 AC_SUBST(PYTHON_CFLAGS)
9525 AC_SUBST(PYTHON_LIBS)
9526 AC_SUBST(PYTHON_VERSION)
9527 AC_SUBST(PYTHON_VERSION_MAJOR)
9528 AC_SUBST(PYTHON_VERSION_MINOR)
9530 AC_MSG_CHECKING([whether to build LibreLogo])
9531 case "$enable_python" in
9532 no|disable)
9533     AC_MSG_RESULT([no; Python disabled])
9534     ;;
9536     if test "${enable_librelogo}" = "no"; then
9537         AC_MSG_RESULT([no])
9538     else
9539         AC_MSG_RESULT([yes])
9540         BUILD_TYPE="${BUILD_TYPE} LIBRELOGO"
9541         AC_DEFINE([ENABLE_LIBRELOGO],1)
9542     fi
9543     ;;
9544 esac
9545 AC_SUBST(ENABLE_LIBRELOGO)
9547 ENABLE_MARIADBC=
9548 MARIADBC_MAJOR=1
9549 MARIADBC_MINOR=0
9550 MARIADBC_MICRO=2
9551 AC_MSG_CHECKING([whether to build the MariaDB/MySQL SDBC driver])
9552 if test "x$enable_mariadb_sdbc" != "xno" -a "$enable_mpl_subset" != "yes"; then
9553     ENABLE_MARIADBC=TRUE
9554     AC_MSG_RESULT([yes])
9555     BUILD_TYPE="$BUILD_TYPE MARIADBC"
9556 else
9557     AC_MSG_RESULT([no])
9559 AC_SUBST(ENABLE_MARIADBC)
9560 AC_SUBST(MARIADBC_MAJOR)
9561 AC_SUBST(MARIADBC_MINOR)
9562 AC_SUBST(MARIADBC_MICRO)
9564 if test "$ENABLE_MARIADBC" = "TRUE"; then
9565     dnl ===================================================================
9566     dnl Check for system MariaDB
9567     dnl ===================================================================
9568     AC_MSG_CHECKING([which MariaDB to use])
9569     if test "$with_system_mariadb" = "yes"; then
9570         AC_MSG_RESULT([external])
9571         SYSTEM_MARIADB_CONNECTOR_C=TRUE
9572         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
9573         if test -z "$MARIADBCONFIG"; then
9574             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
9575             if test -z "$MARIADBCONFIG"; then
9576                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
9577                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
9578             fi
9579         fi
9580         AC_MSG_CHECKING([MariaDB version])
9581         MARIADB_VERSION=`$MARIADBCONFIG --version`
9582         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
9583         if test "$MARIADB_MAJOR" -ge "5"; then
9584             AC_MSG_RESULT([OK])
9585         else
9586             AC_MSG_ERROR([too old, use 5.0.x or later])
9587         fi
9588         AC_MSG_CHECKING([for MariaDB Client library])
9589         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
9590         if test "$COM_IS_CLANG" = TRUE; then
9591             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
9592         fi
9593         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
9594         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
9595         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
9596         dnl linux32:
9597         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
9598             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
9599             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
9600                 | sed -e 's|/lib64/|/lib/|')
9601         fi
9602         FilterLibs "${MARIADB_LIBS}"
9603         MARIADB_LIBS="${filteredlibs}"
9604         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
9605         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
9606         if test "$enable_bundle_mariadb" = "yes"; then
9607             AC_MSG_RESULT([yes])
9608             BUNDLE_MARIADB_CONNECTOR_C=TRUE
9609             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
9611 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
9613 /g' | grep -E '(mysqlclient|mariadb)')
9614             if test "$_os" = "Darwin"; then
9615                 LIBMARIADB=${LIBMARIADB}.dylib
9616             elif test "$_os" = "WINNT"; then
9617                 LIBMARIADB=${LIBMARIADB}.dll
9618             else
9619                 LIBMARIADB=${LIBMARIADB}.so
9620             fi
9621             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
9622             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
9623             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
9624                 AC_MSG_RESULT([found.])
9625                 PathFormat "$LIBMARIADB_PATH"
9626                 LIBMARIADB_PATH="$formatted_path"
9627             else
9628                 AC_MSG_ERROR([not found.])
9629             fi
9630         else
9631             AC_MSG_RESULT([no])
9632             BUNDLE_MARIADB_CONNECTOR_C=
9633         fi
9634     else
9635         AC_MSG_RESULT([internal])
9636         SYSTEM_MARIADB_CONNECTOR_C=
9637         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
9638         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
9639         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
9640     fi
9642     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
9643     AC_SUBST(MARIADB_CFLAGS)
9644     AC_SUBST(MARIADB_LIBS)
9645     AC_SUBST(LIBMARIADB)
9646     AC_SUBST(LIBMARIADB_PATH)
9647     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
9650 dnl ===================================================================
9651 dnl Check for system hsqldb
9652 dnl ===================================================================
9653 if test "$with_java" != "no" -a "$cross_compiling" != "yes"; then
9654     HSQLDB_USE_JDBC_4_1=
9655     AC_MSG_CHECKING([which hsqldb to use])
9656     if test "$with_system_hsqldb" = "yes"; then
9657         AC_MSG_RESULT([external])
9658         SYSTEM_HSQLDB=TRUE
9659         if test -z $HSQLDB_JAR; then
9660             HSQLDB_JAR=/usr/share/java/hsqldb.jar
9661         fi
9662         if ! test -f $HSQLDB_JAR; then
9663                AC_MSG_ERROR(hsqldb.jar not found.)
9664         fi
9665         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
9666         export HSQLDB_JAR
9667         if $PERL -e \
9668            'use Archive::Zip;
9669             my $file = "$ENV{'HSQLDB_JAR'}";
9670             my $zip = Archive::Zip->new( $file );
9671             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
9672             if ( $mf =~ m/Specification-Version: 1.8.*/ )
9673             {
9674                 push @l, split(/\n/, $mf);
9675                 foreach my $line (@l)
9676                 {
9677                     if ($line =~ m/Specification-Version:/)
9678                     {
9679                         ($t, $version) = split (/:/,$line);
9680                         $version =~ s/^\s//;
9681                         ($a, $b, $c, $d) = split (/\./,$version);
9682                         if ($c == "0" && $d > "8")
9683                         {
9684                             exit 0;
9685                         }
9686                         else
9687                         {
9688                             exit 1;
9689                         }
9690                     }
9691                 }
9692             }
9693             else
9694             {
9695                 exit 1;
9696             }'; then
9697             AC_MSG_RESULT([yes])
9698         else
9699             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
9700         fi
9701     else
9702         AC_MSG_RESULT([internal])
9703         SYSTEM_HSQLDB=
9704         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9705         NEED_ANT=TRUE
9706         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
9707         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
9708         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
9709             AC_MSG_RESULT([yes])
9710             HSQLDB_USE_JDBC_4_1=TRUE
9711         else
9712             AC_MSG_RESULT([no])
9713         fi
9714     fi
9715 else
9716     if test "$with_java" != "no" -a -z "$HSQLDB_JAR"; then
9717         BUILD_TYPE="$BUILD_TYPE HSQLDB"
9718     fi
9720 AC_SUBST(SYSTEM_HSQLDB)
9721 AC_SUBST(HSQLDB_JAR)
9722 AC_SUBST([HSQLDB_USE_JDBC_4_1])
9724 dnl ===================================================================
9725 dnl Check for PostgreSQL stuff
9726 dnl ===================================================================
9727 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
9728 if test "x$enable_postgresql_sdbc" != "xno"; then
9729     AC_MSG_RESULT([yes])
9730     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
9732     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
9733         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
9734     fi
9735     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
9736         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
9737     fi
9739     postgres_interface=""
9740     if test "$with_system_postgresql" = "yes"; then
9741         postgres_interface="external PostgreSQL"
9742         SYSTEM_POSTGRESQL=TRUE
9743         if test "$_os" = Darwin; then
9744             supp_path=''
9745             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
9746                 pg_supp_path="$P_SEP$d$pg_supp_path"
9747             done
9748         fi
9749         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
9750         if test -n "$PGCONFIG"; then
9751             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
9752             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
9753         else
9754             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
9755               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
9756               POSTGRESQL_LIB=$POSTGRESQL_LIBS
9757             ],[
9758               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
9759             ])
9760         fi
9761         FilterLibs "${POSTGRESQL_LIB}"
9762         POSTGRESQL_LIB="${filteredlibs}"
9763     else
9764         # if/when anything else than PostgreSQL uses Kerberos,
9765         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
9766         WITH_KRB5=
9767         WITH_GSSAPI=
9768         case "$_os" in
9769         Darwin)
9770             # macOS has system MIT Kerberos 5 since 10.4
9771             if test "$with_krb5" != "no"; then
9772                 WITH_KRB5=TRUE
9773                 save_LIBS=$LIBS
9774                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
9775                 # that the libraries where these functions are located on macOS will change, is it?
9776                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9777                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9778                 KRB5_LIBS=$LIBS
9779                 LIBS=$save_LIBS
9780                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9781                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9782                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9783                 LIBS=$save_LIBS
9784             fi
9785             if test "$with_gssapi" != "no"; then
9786                 WITH_GSSAPI=TRUE
9787                 save_LIBS=$LIBS
9788                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9789                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9790                 GSSAPI_LIBS=$LIBS
9791                 LIBS=$save_LIBS
9792             fi
9793             ;;
9794         WINNT)
9795             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
9796                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
9797             fi
9798             ;;
9799         Linux|GNU|*BSD|DragonFly)
9800             if test "$with_krb5" != "no"; then
9801                 WITH_KRB5=TRUE
9802                 save_LIBS=$LIBS
9803                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9804                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9805                 KRB5_LIBS=$LIBS
9806                 LIBS=$save_LIBS
9807                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9808                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9809                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9810                 LIBS=$save_LIBS
9811             fi
9812             if test "$with_gssapi" != "no"; then
9813                 WITH_GSSAPI=TRUE
9814                 save_LIBS=$LIBS
9815                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9816                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9817                 GSSAPI_LIBS=$LIBS
9818                 LIBS=$save_LIBS
9819             fi
9820             ;;
9821         *)
9822             if test "$with_krb5" = "yes"; then
9823                 WITH_KRB5=TRUE
9824                 save_LIBS=$LIBS
9825                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9826                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9827                 KRB5_LIBS=$LIBS
9828                 LIBS=$save_LIBS
9829                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9830                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9831                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9832                 LIBS=$save_LIBS
9833             fi
9834             if test "$with_gssapi" = "yes"; then
9835                 WITH_GSSAPI=TRUE
9836                 save_LIBS=$LIBS
9837                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9838                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9839                 LIBS=$save_LIBS
9840                 GSSAPI_LIBS=$LIBS
9841             fi
9842         esac
9844         if test -n "$with_libpq_path"; then
9845             SYSTEM_POSTGRESQL=TRUE
9846             postgres_interface="external libpq"
9847             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
9848             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
9849         else
9850             SYSTEM_POSTGRESQL=
9851             postgres_interface="internal"
9852             POSTGRESQL_LIB=""
9853             POSTGRESQL_INC="%OVERRIDE_ME%"
9854             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
9855         fi
9856     fi
9858     AC_MSG_CHECKING([PostgreSQL C interface])
9859     AC_MSG_RESULT([$postgres_interface])
9861     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
9862         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
9863         save_CFLAGS=$CFLAGS
9864         save_CPPFLAGS=$CPPFLAGS
9865         save_LIBS=$LIBS
9866         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
9867         LIBS="${LIBS} ${POSTGRESQL_LIB}"
9868         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
9869         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
9870             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
9871         CFLAGS=$save_CFLAGS
9872         CPPFLAGS=$save_CPPFLAGS
9873         LIBS=$save_LIBS
9874     fi
9875     BUILD_POSTGRESQL_SDBC=TRUE
9876 else
9877     AC_MSG_RESULT([no])
9879 AC_SUBST(WITH_KRB5)
9880 AC_SUBST(WITH_GSSAPI)
9881 AC_SUBST(GSSAPI_LIBS)
9882 AC_SUBST(KRB5_LIBS)
9883 AC_SUBST(BUILD_POSTGRESQL_SDBC)
9884 AC_SUBST(SYSTEM_POSTGRESQL)
9885 AC_SUBST(POSTGRESQL_INC)
9886 AC_SUBST(POSTGRESQL_LIB)
9888 dnl ===================================================================
9889 dnl Check for Firebird stuff
9890 dnl ===================================================================
9891 ENABLE_FIREBIRD_SDBC=
9892 if test "$enable_firebird_sdbc" = "yes" ; then
9893     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
9895     dnl ===================================================================
9896     dnl Check for system Firebird
9897     dnl ===================================================================
9898     AC_MSG_CHECKING([which Firebird to use])
9899     if test "$with_system_firebird" = "yes"; then
9900         AC_MSG_RESULT([external])
9901         SYSTEM_FIREBIRD=TRUE
9902         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
9903         if test -z "$FIREBIRDCONFIG"; then
9904             AC_MSG_NOTICE([No fb_config -- using pkg-config])
9905             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
9906                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
9907             ])
9908             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
9909         else
9910             AC_MSG_NOTICE([fb_config found])
9911             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
9912             AC_MSG_CHECKING([for Firebird Client library])
9913             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
9914             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
9915             FilterLibs "${FIREBIRD_LIBS}"
9916             FIREBIRD_LIBS="${filteredlibs}"
9917         fi
9918         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
9919         AC_MSG_CHECKING([Firebird version])
9920         if test -n "${FIREBIRD_VERSION}"; then
9921             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
9922             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
9923             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
9924                 AC_MSG_RESULT([OK])
9925             else
9926                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
9927             fi
9928         else
9929             save_CFLAGS="${CFLAGS}"
9930             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
9931             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
9932 #if defined(FB_API_VER) && FB_API_VER == 30
9933 int fb_api_is_30(void) { return 0; }
9934 #else
9935 #error "Wrong Firebird API version"
9936 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
9937             CFLAGS="$save_CFLAGS"
9938         fi
9939         ENABLE_FIREBIRD_SDBC=TRUE
9940         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9941     elif test "$enable_database_connectivity" != yes; then
9942         AC_MSG_RESULT([none])
9943     elif test "$cross_compiling" = "yes"; then
9944         AC_MSG_RESULT([none])
9945     else
9946         dnl Embedded Firebird has version 3.0
9947         AC_DEFINE(HAVE_FIREBIRD_30, 1)
9948         dnl We need libatomic_ops for any non X86/X64 system
9949         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
9950             dnl ===================================================================
9951             dnl Check for system libatomic_ops
9952             dnl ===================================================================
9953             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[LIBATOMIC_OPS],[atomic_ops >= 0.7.2])
9954             if test "$with_system_libatomic_ops" = "yes"; then
9955                 SYSTEM_LIBATOMIC_OPS=TRUE
9956                 AC_CHECK_HEADERS(atomic_ops.h, [],
9957                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
9958             else
9959                 SYSTEM_LIBATOMIC_OPS=
9960                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
9961                 LIBATOMIC_OPS_LIBS="-latomic_ops"
9962                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
9963             fi
9964         fi
9966         AC_MSG_RESULT([internal])
9967         SYSTEM_FIREBIRD=
9968         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
9969         FIREBIRD_LIBS="-lfbclient"
9971         if test "$with_system_libtommath" = "yes"; then
9972             SYSTEM_LIBTOMMATH=TRUE
9973             dnl check for tommath presence
9974             save_LIBS=$LIBS
9975             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
9976             AC_CHECK_LIB(tommath, mp_init, LIBTOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
9977             LIBS=$save_LIBS
9978         else
9979             SYSTEM_LIBTOMMATH=
9980             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
9981             LIBTOMMATH_LIBS="-ltommath"
9982             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
9983         fi
9985         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
9986         ENABLE_FIREBIRD_SDBC=TRUE
9987         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9988     fi
9990 AC_SUBST(ENABLE_FIREBIRD_SDBC)
9991 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
9992 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
9993 AC_SUBST(LIBATOMIC_OPS_LIBS)
9994 AC_SUBST(SYSTEM_FIREBIRD)
9995 AC_SUBST(FIREBIRD_CFLAGS)
9996 AC_SUBST(FIREBIRD_LIBS)
9997 AC_SUBST(SYSTEM_LIBTOMMATH)
9998 AC_SUBST(LIBTOMMATH_CFLAGS)
9999 AC_SUBST(LIBTOMMATH_LIBS)
10001 dnl ===================================================================
10002 dnl Check for system curl
10003 dnl ===================================================================
10004 AC_MSG_CHECKING([which libcurl to use])
10005 if test "$with_system_curl" = "auto"; then
10006     with_system_curl="$with_system_libs"
10009 if test "$with_system_curl" = "yes"; then
10010     AC_MSG_RESULT([external])
10011     SYSTEM_CURL=TRUE
10013     # First try PKGCONFIG and then fall back
10014     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
10016     if test -n "$CURL_PKG_ERRORS"; then
10017         AC_PATH_PROG(CURLCONFIG, curl-config)
10018         if test -z "$CURLCONFIG"; then
10019             AC_MSG_ERROR([curl development files not found])
10020         fi
10021         CURL_LIBS=`$CURLCONFIG --libs`
10022         FilterLibs "${CURL_LIBS}"
10023         CURL_LIBS="${filteredlibs}"
10024         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
10025         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
10027         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
10028         case $curl_version in
10029         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
10030         dnl so they need to be doubled to end up in the configure script
10031         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
10032             AC_MSG_RESULT([yes])
10033             ;;
10034         *)
10035             AC_MSG_ERROR([no, you have $curl_version])
10036             ;;
10037         esac
10038     fi
10040     ENABLE_CURL=TRUE
10041 else
10042     AC_MSG_RESULT([internal])
10043     SYSTEM_CURL=
10044     BUILD_TYPE="$BUILD_TYPE CURL"
10045     ENABLE_CURL=TRUE
10047 AC_SUBST(SYSTEM_CURL)
10048 AC_SUBST(CURL_CFLAGS)
10049 AC_SUBST(CURL_LIBS)
10050 AC_SUBST(ENABLE_CURL)
10052 dnl ===================================================================
10053 dnl Check for system boost
10054 dnl ===================================================================
10055 AC_MSG_CHECKING([which boost to use])
10056 if test "$with_system_boost" = "yes"; then
10057     AC_MSG_RESULT([external])
10058     SYSTEM_BOOST=TRUE
10059     AX_BOOST_BASE([1.66],,[AC_MSG_ERROR([no suitable Boost found])])
10060     AX_BOOST_DATE_TIME
10061     AX_BOOST_FILESYSTEM
10062     AX_BOOST_IOSTREAMS
10063     AX_BOOST_LOCALE
10064     AC_LANG_PUSH([C++])
10065     save_CXXFLAGS=$CXXFLAGS
10066     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
10067     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
10068        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
10069     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
10070        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
10071     CXXFLAGS=$save_CXXFLAGS
10072     AC_LANG_POP([C++])
10073     # this is in m4/ax_boost_base.m4
10074     FilterLibs "${BOOST_LDFLAGS}"
10075     BOOST_LDFLAGS="${filteredlibs}"
10076 else
10077     AC_MSG_RESULT([internal])
10078     BUILD_TYPE="$BUILD_TYPE BOOST"
10079     SYSTEM_BOOST=
10080     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
10081         # use warning-suppressing wrapper headers
10082         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
10083     else
10084         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
10085     fi
10087 AC_SUBST(SYSTEM_BOOST)
10089 dnl ===================================================================
10090 dnl Check for system mdds
10091 dnl ===================================================================
10092 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
10094 dnl ===================================================================
10095 dnl Check for system glm
10096 dnl ===================================================================
10097 AC_MSG_CHECKING([which glm to use])
10098 if test "$with_system_glm" = "yes"; then
10099     AC_MSG_RESULT([external])
10100     SYSTEM_GLM=TRUE
10101     AC_LANG_PUSH([C++])
10102     AC_CHECK_HEADER([glm/glm.hpp], [],
10103        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
10104     AC_LANG_POP([C++])
10105 else
10106     AC_MSG_RESULT([internal])
10107     BUILD_TYPE="$BUILD_TYPE GLM"
10108     SYSTEM_GLM=
10109     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
10111 AC_SUBST([GLM_CFLAGS])
10112 AC_SUBST([SYSTEM_GLM])
10114 dnl ===================================================================
10115 dnl Check for system odbc
10116 dnl ===================================================================
10117 AC_MSG_CHECKING([which odbc headers to use])
10118 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
10119     AC_MSG_RESULT([external])
10120     SYSTEM_ODBC_HEADERS=TRUE
10122     if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
10123         save_CPPFLAGS=$CPPFLAGS
10124         find_winsdk
10125         PathFormat "$winsdktest"
10126         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"
10127         AC_CHECK_HEADER(sqlext.h, [],
10128             [AC_MSG_ERROR(odbc not found. install odbc)],
10129             [#include <windows.h>])
10130         CPPFLAGS=$save_CPPFLAGS
10131     else
10132         AC_CHECK_HEADER(sqlext.h, [],
10133             [AC_MSG_ERROR(odbc not found. install odbc)],[])
10134     fi
10135 elif test "$enable_database_connectivity" != yes; then
10136     AC_MSG_RESULT([none])
10137 else
10138     AC_MSG_RESULT([internal])
10139     SYSTEM_ODBC_HEADERS=
10141 AC_SUBST(SYSTEM_ODBC_HEADERS)
10143 dnl ===================================================================
10144 dnl Enable LDAP support
10145 dnl ===================================================================
10147 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
10148 AC_MSG_CHECKING([whether to enable LDAP support])
10149     if test "$enable_ldap" != "yes"; then
10150         AC_MSG_RESULT([no])
10151         ENABLE_LDAP=""
10152         enable_ldap=no
10153     else
10154         AC_MSG_RESULT([yes])
10155         ENABLE_LDAP="TRUE"
10156     fi
10158 AC_SUBST(ENABLE_LDAP)
10160 dnl ===================================================================
10161 dnl Check for system openldap
10162 dnl ===================================================================
10164 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
10165 AC_MSG_CHECKING([which openldap library to use])
10166 if test "$with_system_openldap" = "yes"; then
10167     AC_MSG_RESULT([external])
10168     SYSTEM_OPENLDAP=TRUE
10169     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
10170     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10171     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
10172 else
10173     AC_MSG_RESULT([internal])
10174     SYSTEM_OPENLDAP=
10175     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
10178 AC_SUBST(SYSTEM_OPENLDAP)
10180 dnl ===================================================================
10181 dnl Check for system NSS
10182 dnl ===================================================================
10183 if test "$enable_fuzzers" != "yes"; then
10184     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
10185     AC_DEFINE(HAVE_FEATURE_NSS)
10186     ENABLE_NSS="TRUE"
10187     AC_DEFINE(ENABLE_NSS)
10188 elif test $_os != iOS ; then
10189     with_tls=openssl
10191 AC_SUBST(ENABLE_NSS)
10193 dnl ===================================================================
10194 dnl Check for TLS/SSL and cryptographic implementation to use
10195 dnl ===================================================================
10196 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
10197 if test -n "$with_tls"; then
10198     case $with_tls in
10199     openssl)
10200         AC_DEFINE(USE_TLS_OPENSSL)
10201         TLS=OPENSSL
10202         AC_MSG_RESULT([$TLS])
10204         if test "$enable_openssl" != "yes"; then
10205             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
10206         fi
10208         # warn that OpenSSL has been selected but not all TLS code has this option
10209         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
10210         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
10211         ;;
10212     nss)
10213         AC_DEFINE(USE_TLS_NSS)
10214         TLS=NSS
10215         AC_MSG_RESULT([$TLS])
10216         ;;
10217     no)
10218         AC_MSG_RESULT([none])
10219         AC_MSG_WARN([Skipping TLS/SSL])
10220         ;;
10221     *)
10222         AC_MSG_RESULT([])
10223         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
10224 openssl - OpenSSL
10225 nss - Mozilla's Network Security Services (NSS)
10226     ])
10227         ;;
10228     esac
10229 else
10230     # default to using NSS, it results in smaller oox lib
10231     AC_DEFINE(USE_TLS_NSS)
10232     TLS=NSS
10233     AC_MSG_RESULT([$TLS])
10235 AC_SUBST(TLS)
10237 dnl ===================================================================
10238 dnl Check for system sane
10239 dnl ===================================================================
10240 AC_MSG_CHECKING([which sane header to use])
10241 if test "$with_system_sane" = "yes"; then
10242     AC_MSG_RESULT([external])
10243     AC_CHECK_HEADER(sane/sane.h, [],
10244       [AC_MSG_ERROR(sane not found. install sane)], [])
10245 else
10246     AC_MSG_RESULT([internal])
10247     BUILD_TYPE="$BUILD_TYPE SANE"
10250 dnl ===================================================================
10251 dnl Check for system icu
10252 dnl ===================================================================
10253 SYSTEM_GENBRK=
10254 SYSTEM_GENCCODE=
10255 SYSTEM_GENCMN=
10257 ICU_MAJOR=68
10258 ICU_MINOR=1
10259 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
10260 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
10261 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
10262 AC_MSG_CHECKING([which icu to use])
10263 if test "$with_system_icu" = "yes"; then
10264     AC_MSG_RESULT([external])
10265     SYSTEM_ICU=TRUE
10266     AC_LANG_PUSH([C++])
10267     AC_MSG_CHECKING([for unicode/rbbi.h])
10268     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
10269     AC_LANG_POP([C++])
10271     if test "$cross_compiling" != "yes"; then
10272         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
10273         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
10274         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
10275         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
10276     fi
10278     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
10279         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
10280         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
10281         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
10282         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
10283         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
10284             AC_MSG_RESULT([yes])
10285         else
10286             AC_MSG_RESULT([no])
10287             if test "$with_system_icu_for_build" != "force"; then
10288                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
10289 You can use --with-system-icu-for-build=force to use it anyway.])
10290             fi
10291         fi
10292     fi
10294     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
10295         # using the system icu tools can lead to version confusion, use the
10296         # ones from the build environment when cross-compiling
10297         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
10298         if test -z "$SYSTEM_GENBRK"; then
10299             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
10300         fi
10301         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
10302         if test -z "$SYSTEM_GENCCODE"; then
10303             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
10304         fi
10305         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
10306         if test -z "$SYSTEM_GENCMN"; then
10307             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
10308         fi
10309         if test "$ICU_MAJOR" -ge "49"; then
10310             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
10311             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
10312             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
10313         else
10314             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
10315             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
10316             ICU_RECLASSIFIED_HEBREW_LETTER=
10317         fi
10318     fi
10320     if test "$cross_compiling" = "yes"; then
10321         if test "$ICU_MAJOR" -ge "50"; then
10322             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
10323             ICU_MINOR=""
10324         fi
10325     fi
10326 else
10327     AC_MSG_RESULT([internal])
10328     SYSTEM_ICU=
10329     BUILD_TYPE="$BUILD_TYPE ICU"
10330     # surprisingly set these only for "internal" (to be used by various other
10331     # external libs): the system icu-config is quite unhelpful and spits out
10332     # dozens of weird flags and also default path -I/usr/include
10333     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
10334     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
10336 if test "$ICU_MAJOR" -ge "59"; then
10337     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
10338     # with -std=c++11 but not all external libraries can be built with that,
10339     # for those use a bit-compatible typedef uint16_t UChar; see
10340     # icu/source/common/unicode/umachine.h
10341     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
10342 else
10343     ICU_UCHAR_TYPE=""
10345 AC_SUBST(SYSTEM_ICU)
10346 AC_SUBST(SYSTEM_GENBRK)
10347 AC_SUBST(SYSTEM_GENCCODE)
10348 AC_SUBST(SYSTEM_GENCMN)
10349 AC_SUBST(ICU_MAJOR)
10350 AC_SUBST(ICU_MINOR)
10351 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
10352 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
10353 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
10354 AC_SUBST(ICU_CFLAGS)
10355 AC_SUBST(ICU_LIBS)
10356 AC_SUBST(ICU_UCHAR_TYPE)
10358 dnl ==================================================================
10359 dnl Breakpad
10360 dnl ==================================================================
10361 DEFAULT_CRASHDUMP_VALUE="true"
10362 AC_MSG_CHECKING([whether to enable breakpad])
10363 if test "$enable_breakpad" != yes; then
10364     AC_MSG_RESULT([no])
10365 else
10366     AC_MSG_RESULT([yes])
10367     ENABLE_BREAKPAD="TRUE"
10368     AC_DEFINE(ENABLE_BREAKPAD)
10369     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
10370     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
10372     AC_MSG_CHECKING([for disable crash dump])
10373     if test "$enable_crashdump" = no; then
10374         DEFAULT_CRASHDUMP_VALUE="false"
10375         AC_MSG_RESULT([yes])
10376     else
10377        AC_MSG_RESULT([no])
10378     fi
10380     AC_MSG_CHECKING([for crashreport config])
10381     if test "$with_symbol_config" = "no"; then
10382         BREAKPAD_SYMBOL_CONFIG="invalid"
10383         AC_MSG_RESULT([no])
10384     else
10385         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
10386         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
10387         AC_MSG_RESULT([yes])
10388     fi
10389     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
10391 AC_SUBST(ENABLE_BREAKPAD)
10392 AC_SUBST(DEFAULT_CRASHDUMP_VALUE)
10394 dnl ==================================================================
10395 dnl libfuzzer
10396 dnl ==================================================================
10397 AC_MSG_CHECKING([whether to enable fuzzers])
10398 if test "$enable_fuzzers" != yes; then
10399     AC_MSG_RESULT([no])
10400 else
10401     if test $LIB_FUZZING_ENGINE == ""; then
10402       AC_MSG_ERROR(['LIB_FUZZING_ENGINE' must be set when using --enable-fuzzers. Examples include '-fsanitize=fuzzer'.])
10403     fi
10404     AC_MSG_RESULT([yes])
10405     ENABLE_FUZZERS="TRUE"
10406     AC_DEFINE([ENABLE_FUZZERS],1)
10407     BUILD_TYPE="$BUILD_TYPE FUZZERS"
10409 AC_SUBST(LIB_FUZZING_ENGINE)
10410 AC_SUBST(ENABLE_FUZZERS)
10412 dnl ===================================================================
10413 dnl Orcus
10414 dnl ===================================================================
10415 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.16 >= 0.16.0])
10416 if test "$with_system_orcus" != "yes"; then
10417     if test "$SYSTEM_BOOST" = "TRUE"; then
10418         # ===========================================================
10419         # Determine if we are going to need to link with Boost.System
10420         # ===========================================================
10421         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
10422         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
10423         dnl in documentation has no effect.
10424         AC_MSG_CHECKING([if we need to link with Boost.System])
10425         AC_LANG_PUSH([C++])
10426         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
10427                 @%:@include <boost/version.hpp>
10428             ]],[[
10429                 #if BOOST_VERSION >= 105000
10430                 #   error yes, we need to link with Boost.System
10431                 #endif
10432             ]])],[
10433                 AC_MSG_RESULT([no])
10434             ],[
10435                 AC_MSG_RESULT([yes])
10436                 AX_BOOST_SYSTEM
10437         ])
10438         AC_LANG_POP([C++])
10439     fi
10441 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
10442 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
10443 AC_SUBST([BOOST_SYSTEM_LIB])
10444 AC_SUBST(SYSTEM_LIBORCUS)
10446 dnl ===================================================================
10447 dnl HarfBuzz
10448 dnl ===================================================================
10449 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
10450                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
10451                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
10453 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
10454                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
10455                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
10457 if test "$COM" = "MSC"; then # override the above
10458     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
10459     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
10462 if test "$with_system_harfbuzz" = "yes"; then
10463     if test "$with_system_graphite" = "no"; then
10464         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
10465     fi
10466     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
10467     save_LIBS="$LIBS"
10468     save_CFLAGS="$CFLAGS"
10469     LIBS="$LIBS $HARFBUZZ_LIBS"
10470     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
10471     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
10472     LIBS="$save_LIBS"
10473     CFLAGS="$save_CFLAGS"
10474 else
10475     if test "$with_system_graphite" = "yes"; then
10476         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
10477     fi
10480 AC_MSG_CHECKING([whether to use X11])
10481 dnl ***************************************
10482 dnl testing for X libraries and includes...
10483 dnl ***************************************
10484 if test "$USING_X11" = TRUE; then
10485     AC_DEFINE(HAVE_FEATURE_X11)
10487 AC_MSG_RESULT([$USING_X11])
10489 if test "$USING_X11" = TRUE; then
10490     AC_PATH_X
10491     AC_PATH_XTRA
10492     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
10494     if test -z "$x_includes"; then
10495         x_includes="default_x_includes"
10496     fi
10497     if test -z "$x_libraries"; then
10498         x_libraries="default_x_libraries"
10499     fi
10500     CFLAGS="$CFLAGS $X_CFLAGS"
10501     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
10502     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
10503 else
10504     x_includes="no_x_includes"
10505     x_libraries="no_x_libraries"
10508 if test "$USING_X11" = TRUE; then
10509     dnl ===================================================================
10510     dnl Check for extension headers
10511     dnl ===================================================================
10512     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
10513      [#include <X11/extensions/shape.h>])
10515     # vcl needs ICE and SM
10516     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
10517     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
10518         [AC_MSG_ERROR(ICE library not found)])
10519     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
10520     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
10521         [AC_MSG_ERROR(SM library not found)])
10524 if test "$USING_X11" = TRUE -a "$ENABLE_JAVA" != ""; then
10525     # bean/native/unix/com_sun_star_comp_beans_LocalOfficeWindow.c needs Xt
10526     AC_CHECK_HEADERS(X11/Intrinsic.h,[],[AC_MSG_ERROR([libXt headers not found])])
10529 dnl ===================================================================
10530 dnl Check for system Xrender
10531 dnl ===================================================================
10532 AC_MSG_CHECKING([whether to use Xrender])
10533 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
10534     AC_MSG_RESULT([yes])
10535     PKG_CHECK_MODULES(XRENDER, xrender)
10536     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10537     FilterLibs "${XRENDER_LIBS}"
10538     XRENDER_LIBS="${filteredlibs}"
10539     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
10540       [AC_MSG_ERROR(libXrender not found or functional)], [])
10541     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
10542       [AC_MSG_ERROR(Xrender not found. install X)], [])
10543 else
10544     AC_MSG_RESULT([no])
10546 AC_SUBST(XRENDER_CFLAGS)
10547 AC_SUBST(XRENDER_LIBS)
10549 dnl ===================================================================
10550 dnl Check for XRandr
10551 dnl ===================================================================
10552 AC_MSG_CHECKING([whether to enable RandR support])
10553 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
10554     AC_MSG_RESULT([yes])
10555     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
10556     if test "$ENABLE_RANDR" != "TRUE"; then
10557         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
10558                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
10559         XRANDR_CFLAGS=" "
10560         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
10561           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
10562         XRANDR_LIBS="-lXrandr "
10563         ENABLE_RANDR="TRUE"
10564     fi
10565     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10566     FilterLibs "${XRANDR_LIBS}"
10567     XRANDR_LIBS="${filteredlibs}"
10568 else
10569     ENABLE_RANDR=""
10570     AC_MSG_RESULT([no])
10572 AC_SUBST(XRANDR_CFLAGS)
10573 AC_SUBST(XRANDR_LIBS)
10574 AC_SUBST(ENABLE_RANDR)
10576 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
10577     if test -z "$WITH_WEBDAV"; then
10578         WITH_WEBDAV="serf"
10579     fi
10581 if test $_os = iOS -o $_os = Android; then
10582     WITH_WEBDAV="no"
10584 AC_MSG_CHECKING([for webdav library])
10585 case "$WITH_WEBDAV" in
10586 serf)
10587     AC_MSG_RESULT([serf])
10588     # Check for system apr-util
10589     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
10590                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
10591                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
10592     if test "$COM" = "MSC"; then
10593         APR_LIB_DIR="LibR"
10594         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
10595         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
10596     fi
10598     # Check for system serf
10599     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
10600                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
10601     if test "$COM" = "MSC"; then
10602         SERF_LIB_DIR="Release"
10603         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
10604         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
10605     fi
10606     ;;
10607 neon)
10608     AC_MSG_RESULT([neon])
10609     # Check for system neon
10610     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.31.1])
10611     if test "$with_system_neon" = "yes"; then
10612         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
10613     else
10614         NEON_VERSION=0311
10615     fi
10616     AC_SUBST(NEON_VERSION)
10617     ;;
10619     AC_MSG_RESULT([none, disabled])
10620     WITH_WEBDAV=""
10621     ;;
10622 esac
10623 AC_SUBST(WITH_WEBDAV)
10625 dnl ===================================================================
10626 dnl Check for disabling cve_tests
10627 dnl ===================================================================
10628 AC_MSG_CHECKING([whether to execute CVE tests])
10629 # If not explicitly enabled or disabled, default
10630 if test -z "$enable_cve_tests"; then
10631     case "$OS" in
10632     WNT)
10633         # Default cves off for Windows with its wild and wonderful
10634         # variety of AV software kicking in and panicking
10635         enable_cve_tests=no
10636         ;;
10637     *)
10638         # otherwise yes
10639         enable_cve_tests=yes
10640         ;;
10641     esac
10643 if test "$enable_cve_tests" = "no"; then
10644     AC_MSG_RESULT([no])
10645     DISABLE_CVE_TESTS=TRUE
10646     AC_SUBST(DISABLE_CVE_TESTS)
10647 else
10648     AC_MSG_RESULT([yes])
10651 dnl ===================================================================
10652 dnl Check for enabling chart XShape tests
10653 dnl ===================================================================
10654 AC_MSG_CHECKING([whether to execute chart XShape tests])
10655 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
10656     AC_MSG_RESULT([yes])
10657     ENABLE_CHART_TESTS=TRUE
10658     AC_SUBST(ENABLE_CHART_TESTS)
10659 else
10660     AC_MSG_RESULT([no])
10663 dnl ===================================================================
10664 dnl Check for system openssl
10665 dnl ===================================================================
10666 DISABLE_OPENSSL=
10667 AC_MSG_CHECKING([whether to disable OpenSSL usage])
10668 if test "$enable_openssl" = "yes"; then
10669     AC_MSG_RESULT([no])
10670     if test "$_os" = Darwin ; then
10671         # OpenSSL is deprecated when building for 10.7 or later.
10672         #
10673         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
10674         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
10676         with_system_openssl=no
10677         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10678     elif test "$_os" = "FreeBSD" -o "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
10679             && test "$with_system_openssl" != "no"; then
10680         with_system_openssl=yes
10681         SYSTEM_OPENSSL=TRUE
10682         OPENSSL_CFLAGS=
10683         OPENSSL_LIBS="-lssl -lcrypto"
10684     else
10685         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
10686     fi
10687     if test "$with_system_openssl" = "yes"; then
10688         AC_MSG_CHECKING([whether openssl supports SHA512])
10689         AC_LANG_PUSH([C])
10690         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
10691             SHA512_CTX context;
10692 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
10693         AC_LANG_POP(C)
10694     fi
10695 else
10696     AC_MSG_RESULT([yes])
10697     DISABLE_OPENSSL=TRUE
10699     # warn that although OpenSSL is disabled, system libraries may depend on it
10700     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
10701     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
10704 AC_SUBST([DISABLE_OPENSSL])
10706 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
10707     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
10708         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
10709         enable_cipher_openssl_backend=no
10710     else
10711         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
10712     fi
10714 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
10715 ENABLE_CIPHER_OPENSSL_BACKEND=
10716 if test "$enable_cipher_openssl_backend" = yes; then
10717     AC_MSG_RESULT([yes])
10718     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
10719 else
10720     AC_MSG_RESULT([no])
10722 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
10724 dnl ===================================================================
10725 dnl Check for building gnutls
10726 dnl ===================================================================
10727 AC_MSG_CHECKING([whether to use gnutls])
10728 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
10729     AC_MSG_RESULT([yes])
10730     AM_PATH_LIBGCRYPT()
10731     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
10732         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
10733                       available in the system to use as replacement.]]))
10734     FilterLibs "${LIBGCRYPT_LIBS}"
10735     LIBGCRYPT_LIBS="${filteredlibs}"
10736 else
10737     AC_MSG_RESULT([no])
10740 AC_SUBST([LIBGCRYPT_CFLAGS])
10741 AC_SUBST([LIBGCRYPT_LIBS])
10743 dnl ===================================================================
10744 dnl Check for system redland
10745 dnl ===================================================================
10746 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
10747 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
10748 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
10749 if test "$with_system_redland" = "yes"; then
10750     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
10751             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
10752 else
10753     RAPTOR_MAJOR="0"
10754     RASQAL_MAJOR="3"
10755     REDLAND_MAJOR="0"
10757 AC_SUBST(RAPTOR_MAJOR)
10758 AC_SUBST(RASQAL_MAJOR)
10759 AC_SUBST(REDLAND_MAJOR)
10761 dnl ===================================================================
10762 dnl Check for system hunspell
10763 dnl ===================================================================
10764 AC_MSG_CHECKING([which libhunspell to use])
10765 if test "$with_system_hunspell" = "yes"; then
10766     AC_MSG_RESULT([external])
10767     SYSTEM_HUNSPELL=TRUE
10768     AC_LANG_PUSH([C++])
10769     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
10770     if test "$HUNSPELL_PC" != "TRUE"; then
10771         AC_CHECK_HEADER(hunspell.hxx, [],
10772             [
10773             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
10774             [AC_MSG_ERROR(hunspell headers not found.)], [])
10775             ], [])
10776         AC_CHECK_LIB([hunspell], [main], [:],
10777            [ AC_MSG_ERROR(hunspell library not found.) ], [])
10778         HUNSPELL_LIBS=-lhunspell
10779     fi
10780     AC_LANG_POP([C++])
10781     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10782     FilterLibs "${HUNSPELL_LIBS}"
10783     HUNSPELL_LIBS="${filteredlibs}"
10784 else
10785     AC_MSG_RESULT([internal])
10786     SYSTEM_HUNSPELL=
10787     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
10788     if test "$COM" = "MSC"; then
10789         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
10790     else
10791         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
10792     fi
10793     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
10795 AC_SUBST(SYSTEM_HUNSPELL)
10796 AC_SUBST(HUNSPELL_CFLAGS)
10797 AC_SUBST(HUNSPELL_LIBS)
10799 dnl ===================================================================
10800 dnl Check for system zxing
10801 dnl ===================================================================
10802 AC_MSG_CHECKING([whether to use zxing])
10803 if test "$enable_zxing" = "no"; then
10804     AC_MSG_RESULT([no])
10805     ENABLE_ZXING=
10806     SYSTEM_ZXING=
10807 else
10808     AC_MSG_RESULT([yes])
10809     ENABLE_ZXING=TRUE
10810     AC_MSG_CHECKING([which libzxing to use])
10811     if test "$with_system_zxing" = "yes"; then
10812         AC_MSG_RESULT([external])
10813         SYSTEM_ZXING=TRUE
10814         AC_LANG_PUSH([C++])
10815         AC_CHECK_HEADER(ZXing/MultiFormatWriter.h, [],
10816             [AC_MSG_ERROR(zxing headers not found.)], [#include <stdexcept>])
10817         ZXING_CFLAGS=-I/usr/include/ZXing
10818         AC_CHECK_LIB([ZXing], [main], [ZXING_LIBS=-lZXing],
10819             [ AC_CHECK_LIB([ZXingCore], [main], [ZXING_LIBS=-lZXingCore],
10820             [ AC_MSG_ERROR(zxing C++ library not found.) ])], [])
10821         AC_LANG_POP([C++])
10822         ZXING_CFLAGS=$(printf '%s' "$ZXING_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10823         FilterLibs "${ZXING_LIBS}"
10824         ZXING_LIBS="${filteredlibs}"
10825     else
10826         AC_MSG_RESULT([internal])
10827         SYSTEM_ZXING=
10828         BUILD_TYPE="$BUILD_TYPE ZXING"
10829     fi
10830     if test "$ENABLE_ZXING" = TRUE; then
10831         AC_DEFINE(ENABLE_ZXING)
10832     fi
10834 AC_SUBST(SYSTEM_ZXING)
10835 AC_SUBST(ENABLE_ZXING)
10836 AC_SUBST(ZXING_CFLAGS)
10837 AC_SUBST(ZXING_LIBS)
10839 dnl ===================================================================
10840 dnl Check for system box2d
10841 dnl ===================================================================
10842 AC_MSG_CHECKING([which box2d to use])
10843 if test "$with_system_box2d" = "yes"; then
10844     AC_MSG_RESULT([external])
10845     SYSTEM_BOX2D=TRUE
10846     AC_LANG_PUSH([C++])
10847     AC_CHECK_HEADER(box2d/box2d.h, [BOX2D_H_FOUND='TRUE'],
10848         [BOX2D_H_FOUND='FALSE'])
10849     if test "$BOX2D_H_FOUND" = "TRUE"; then # 2.4.0+
10850         _BOX2D_LIB=box2d
10851         AC_DEFINE(BOX2D_HEADER,<box2d/box2d.h>)
10852     else
10853         # fail this. there's no other alternative to check when we are here.
10854         AC_CHECK_HEADER([Box2D/Box2D.h], [],
10855                 [AC_MSG_ERROR(box2d headers not found.)])
10856         _BOX2D_LIB=Box2D
10857         AC_DEFINE(BOX2D_HEADER,<Box2D/Box2D.h>)
10858     fi
10859     AC_CHECK_LIB([$_BOX2D_LIB], [main], [:],
10860         [ AC_MSG_ERROR(box2d library not found.) ], [])
10861     BOX2D_LIBS=-l$_BOX2D_LIB
10862     AC_LANG_POP([C++])
10863     BOX2D_CFLAGS=$(printf '%s' "$BOX2D_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10864     FilterLibs "${BOX2D_LIBS}"
10865     BOX2D_LIBS="${filteredlibs}"
10866 else
10867     AC_MSG_RESULT([internal])
10868     SYSTEM_BOX2D=
10869     BUILD_TYPE="$BUILD_TYPE BOX2D"
10871 AC_SUBST(SYSTEM_BOX2D)
10872 AC_SUBST(BOX2D_CFLAGS)
10873 AC_SUBST(BOX2D_LIBS)
10875 dnl ===================================================================
10876 dnl Checking for altlinuxhyph
10877 dnl ===================================================================
10878 AC_MSG_CHECKING([which altlinuxhyph to use])
10879 if test "$with_system_altlinuxhyph" = "yes"; then
10880     AC_MSG_RESULT([external])
10881     SYSTEM_HYPH=TRUE
10882     AC_CHECK_HEADER(hyphen.h, [],
10883        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
10884     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
10885        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
10886        [#include <hyphen.h>])
10887     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
10888         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10889     if test -z "$HYPHEN_LIB"; then
10890         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
10891            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10892     fi
10893     if test -z "$HYPHEN_LIB"; then
10894         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
10895            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10896     fi
10897 else
10898     AC_MSG_RESULT([internal])
10899     SYSTEM_HYPH=
10900     BUILD_TYPE="$BUILD_TYPE HYPHEN"
10901     if test "$COM" = "MSC"; then
10902         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
10903     else
10904         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
10905     fi
10907 AC_SUBST(SYSTEM_HYPH)
10908 AC_SUBST(HYPHEN_LIB)
10910 dnl ===================================================================
10911 dnl Checking for mythes
10912 dnl ===================================================================
10913 AC_MSG_CHECKING([which mythes to use])
10914 if test "$with_system_mythes" = "yes"; then
10915     AC_MSG_RESULT([external])
10916     SYSTEM_MYTHES=TRUE
10917     AC_LANG_PUSH([C++])
10918     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
10919     if test "$MYTHES_PKGCONFIG" = "no"; then
10920         AC_CHECK_HEADER(mythes.hxx, [],
10921             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
10922         AC_CHECK_LIB([mythes-1.2], [main], [:],
10923             [ MYTHES_FOUND=no], [])
10924     if test "$MYTHES_FOUND" = "no"; then
10925         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
10926                 [ MYTHES_FOUND=no], [])
10927     fi
10928     if test "$MYTHES_FOUND" = "no"; then
10929         AC_MSG_ERROR([mythes library not found!.])
10930     fi
10931     fi
10932     AC_LANG_POP([C++])
10933     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10934     FilterLibs "${MYTHES_LIBS}"
10935     MYTHES_LIBS="${filteredlibs}"
10936 else
10937     AC_MSG_RESULT([internal])
10938     SYSTEM_MYTHES=
10939     BUILD_TYPE="$BUILD_TYPE MYTHES"
10940     if test "$COM" = "MSC"; then
10941         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
10942     else
10943         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
10944     fi
10946 AC_SUBST(SYSTEM_MYTHES)
10947 AC_SUBST(MYTHES_CFLAGS)
10948 AC_SUBST(MYTHES_LIBS)
10950 dnl ===================================================================
10951 dnl How should we build the linear programming solver ?
10952 dnl ===================================================================
10954 ENABLE_COINMP=
10955 AC_MSG_CHECKING([whether to build with CoinMP])
10956 if test "$enable_coinmp" != "no"; then
10957     ENABLE_COINMP=TRUE
10958     AC_MSG_RESULT([yes])
10959     if test "$with_system_coinmp" = "yes"; then
10960         SYSTEM_COINMP=TRUE
10961         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
10962         FilterLibs "${COINMP_LIBS}"
10963         COINMP_LIBS="${filteredlibs}"
10964     else
10965         BUILD_TYPE="$BUILD_TYPE COINMP"
10966     fi
10967 else
10968     AC_MSG_RESULT([no])
10970 AC_SUBST(ENABLE_COINMP)
10971 AC_SUBST(SYSTEM_COINMP)
10972 AC_SUBST(COINMP_CFLAGS)
10973 AC_SUBST(COINMP_LIBS)
10975 ENABLE_LPSOLVE=
10976 AC_MSG_CHECKING([whether to build with lpsolve])
10977 if test "$enable_lpsolve" != "no"; then
10978     ENABLE_LPSOLVE=TRUE
10979     AC_MSG_RESULT([yes])
10980 else
10981     AC_MSG_RESULT([no])
10983 AC_SUBST(ENABLE_LPSOLVE)
10985 if test "$ENABLE_LPSOLVE" = TRUE; then
10986     AC_MSG_CHECKING([which lpsolve to use])
10987     if test "$with_system_lpsolve" = "yes"; then
10988         AC_MSG_RESULT([external])
10989         SYSTEM_LPSOLVE=TRUE
10990         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
10991            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
10992         save_LIBS=$LIBS
10993         # some systems need this. Like Ubuntu...
10994         AC_CHECK_LIB(m, floor)
10995         AC_CHECK_LIB(dl, dlopen)
10996         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
10997             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
10998         LIBS=$save_LIBS
10999     else
11000         AC_MSG_RESULT([internal])
11001         SYSTEM_LPSOLVE=
11002         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
11003     fi
11005 AC_SUBST(SYSTEM_LPSOLVE)
11007 dnl ===================================================================
11008 dnl Checking for libexttextcat
11009 dnl ===================================================================
11010 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
11011 if test "$with_system_libexttextcat" = "yes"; then
11012     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
11014 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
11016 dnl ===================================================================
11017 dnl Checking for libnumbertext
11018 dnl ===================================================================
11019 libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.6])
11020 if test "$with_system_libnumbertext" = "yes"; then
11021     SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
11022     SYSTEM_LIBNUMBERTEXT=YES
11023 else
11024     SYSTEM_LIBNUMBERTEXT=
11025     AC_LANG_PUSH([C++])
11026     save_CPPFLAGS=$CPPFLAGS
11027     CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
11028     AC_CHECK_HEADERS([codecvt regex])
11029     AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
11030             [ LIBNUMBERTEXT_CFLAGS=''
11031               AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
11032                            Enable libnumbertext fallback (missing number to number name conversion).])
11033             ])
11034     CPPFLAGS=$save_CPPFLAGS
11035     AC_LANG_POP([C++])
11037 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
11038 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
11039 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
11041 dnl ***************************************
11042 dnl testing libc version for Linux...
11043 dnl ***************************************
11044 if test "$_os" = "Linux"; then
11045     AC_MSG_CHECKING([whether libc is >= 2.1.1])
11046     exec 6>/dev/null # no output
11047     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
11048     exec 6>&1 # output on again
11049     if test "$HAVE_LIBC"; then
11050         AC_MSG_RESULT([yes])
11051     else
11052         AC_MSG_ERROR([no, upgrade libc])
11053     fi
11056 dnl =========================================
11057 dnl Check for uuidgen
11058 dnl =========================================
11059 if test "$_os" = "WINNT"; then
11060     # we must use the uuidgen from the Windows SDK, which will be in the LO_PATH, but isn't in
11061     # the PATH for AC_PATH_PROG. It is already tested above in the WINDOWS_SDK_HOME check.
11062     UUIDGEN=uuidgen.exe
11063     AC_SUBST(UUIDGEN)
11064 else
11065     AC_PATH_PROG([UUIDGEN], [uuidgen])
11066     if test -z "$UUIDGEN"; then
11067         AC_MSG_WARN([uuid is needed for building installation sets])
11068     fi
11071 dnl ***************************************
11072 dnl Checking for bison and flex
11073 dnl ***************************************
11074 AC_PATH_PROG(BISON, bison)
11075 if test -z "$BISON"; then
11076     AC_MSG_ERROR([no bison found in \$PATH, install it])
11077 else
11078     AC_MSG_CHECKING([the bison version])
11079     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
11080     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
11081     dnl Accept newer than 2.0; for --enable-compiler-plugins at least 2.3 is known to be bad and
11082     dnl cause
11083     dnl
11084     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]
11085     dnl   typedef union YYSTYPE
11086     dnl           ~~~~~~^~~~~~~
11087     dnl
11088     dnl while at least 3.4.1 is know to be good:
11089     if test "$COMPILER_PLUGINS" = TRUE; then
11090         if test "$_bison_longver" -lt 2004; then
11091             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.4+ for --enable-compiler-plugins)])
11092         fi
11093     else
11094         if test "$_bison_longver" -lt 2000; then
11095             AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
11096         fi
11097     fi
11099 AC_SUBST([BISON])
11101 AC_PATH_PROG(FLEX, flex)
11102 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11103     FLEX=`cygpath -m $FLEX`
11105 if test -z "$FLEX"; then
11106     AC_MSG_ERROR([no flex found in \$PATH, install it])
11107 else
11108     AC_MSG_CHECKING([the flex version])
11109     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
11110     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
11111         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
11112     fi
11114 AC_SUBST([FLEX])
11115 dnl ***************************************
11116 dnl Checking for patch
11117 dnl ***************************************
11118 AC_PATH_PROG(PATCH, patch)
11119 if test -z "$PATCH"; then
11120     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
11123 dnl On Solaris or macOS, check if --with-gnu-patch was used
11124 if test "$_os" = "SunOS" -o "$_os" = "Darwin"; then
11125     if test -z "$with_gnu_patch"; then
11126         GNUPATCH=$PATCH
11127     else
11128         if test -x "$with_gnu_patch"; then
11129             GNUPATCH=$with_gnu_patch
11130         else
11131             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
11132         fi
11133     fi
11135     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
11136     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
11137         AC_MSG_RESULT([yes])
11138     else
11139         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
11140     fi
11141 else
11142     GNUPATCH=$PATCH
11145 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11146     GNUPATCH=`cygpath -m $GNUPATCH`
11149 dnl We also need to check for --with-gnu-cp
11151 if test -z "$with_gnu_cp"; then
11152     # check the place where the good stuff is hidden on Solaris...
11153     if test -x /usr/gnu/bin/cp; then
11154         GNUCP=/usr/gnu/bin/cp
11155     else
11156         AC_PATH_PROGS(GNUCP, gnucp cp)
11157     fi
11158     if test -z $GNUCP; then
11159         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
11160     fi
11161 else
11162     if test -x "$with_gnu_cp"; then
11163         GNUCP=$with_gnu_cp
11164     else
11165         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
11166     fi
11169 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
11170     GNUCP=`cygpath -m $GNUCP`
11173 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
11174 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
11175     AC_MSG_RESULT([yes])
11176 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
11177     AC_MSG_RESULT([yes])
11178 else
11179     case "$build_os" in
11180     darwin*|macos*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
11181         x_GNUCP=[\#]
11182         GNUCP=''
11183         AC_MSG_RESULT([no gnucp found - using the system's cp command])
11184         ;;
11185     *)
11186         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
11187         ;;
11188     esac
11191 AC_SUBST(GNUPATCH)
11192 AC_SUBST(GNUCP)
11193 AC_SUBST(x_GNUCP)
11195 dnl ***************************************
11196 dnl testing assembler path
11197 dnl ***************************************
11198 ML_EXE=""
11199 if test "$_os" = "WINNT"; then
11200     case "$WIN_HOST_ARCH" in
11201     x86) assembler=ml.exe ;;
11202     x64) assembler=ml64.exe ;;
11203     arm64) assembler=armasm64.exe ;;
11204     esac
11206     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
11207     if test -f "$MSVC_HOST_PATH/$assembler"; then
11208         ML_EXE=`win_short_path_for_make "$MSVC_HOST_PATH/$assembler"`
11209         AC_MSG_RESULT([$ML_EXE])
11210     else
11211         AC_MSG_ERROR([not found in $MSVC_HOST_PATH])
11212     fi
11215 AC_SUBST(ML_EXE)
11217 dnl ===================================================================
11218 dnl We need zip and unzip
11219 dnl ===================================================================
11220 AC_PATH_PROG(ZIP, zip)
11221 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
11222 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
11223     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],,)
11226 AC_PATH_PROG(UNZIP, unzip)
11227 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
11229 dnl ===================================================================
11230 dnl Zip must be a specific type for different build types.
11231 dnl ===================================================================
11232 if test $build_os = cygwin; then
11233     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
11234         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
11235     fi
11238 dnl ===================================================================
11239 dnl We need touch with -h option support.
11240 dnl ===================================================================
11241 AC_PATH_PROG(TOUCH, touch)
11242 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
11243 touch warn
11244 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
11245     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],,)
11248 dnl ===================================================================
11249 dnl Check for system epoxy
11250 dnl ===================================================================
11251 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
11253 dnl ===================================================================
11254 dnl Set vcl option: coordinate device in double or sal_Int32
11255 dnl ===================================================================
11257 dnl disabled for now, we don't want subtle differences between OSs
11258 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
11259 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
11260 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
11261 dnl     AC_MSG_RESULT([double])
11262 dnl else
11263 dnl     AC_MSG_RESULT([sal_Int32])
11264 dnl fi
11266 dnl ===================================================================
11267 dnl Test which vclplugs have to be built.
11268 dnl ===================================================================
11269 R=""
11270 if test "$USING_X11" != TRUE; then
11271     enable_gtk3=no
11274 ENABLE_GTK3=""
11275 if test "x$enable_gtk3" = "xyes"; then
11276     ENABLE_GTK3="TRUE"
11277     AC_DEFINE(ENABLE_GTK3)
11278     R="$R gtk3"
11280 AC_SUBST(ENABLE_GTK3)
11282 ENABLE_GTK3_KDE5=""
11283 if test "x$enable_gtk3_kde5" = "xyes"; then
11284     ENABLE_GTK3_KDE5="TRUE"
11285     AC_DEFINE(ENABLE_GTK3_KDE5)
11286     R="$R gtk3_kde5"
11288 AC_SUBST(ENABLE_GTK3_KDE5)
11290 ENABLE_QT5=""
11291 if test "x$enable_qt5" = "xyes"; then
11292     ENABLE_QT5="TRUE"
11293     AC_DEFINE(ENABLE_QT5)
11294     R="$R qt5"
11296 AC_SUBST(ENABLE_QT5)
11298 ENABLE_KF5=""
11299 if test "x$enable_kf5" = "xyes"; then
11300     ENABLE_KF5="TRUE"
11301     AC_DEFINE(ENABLE_KF5)
11302     R="$R kf5"
11304 AC_SUBST(ENABLE_KF5)
11306 GTK3_CFLAGS=""
11307 GTK3_LIBS=""
11308 if test "x$enable_gtk3" = "xyes" -o "x$enable_gtk3_kde5" = "xyes"; then
11309     if test "$with_system_cairo" = no; then
11310         add_warning 'Non-system cairo combined with gtk3 is assumed to cause trouble; proceed at your own risk.'
11311     fi
11312     : ${with_system_cairo:=yes}
11313     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)
11314     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11315     GTK3_CFLAGS="$GTK3_CFLAGS -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
11316     FilterLibs "${GTK3_LIBS}"
11317     GTK3_LIBS="${filteredlibs}"
11319     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
11320     if test "$with_system_epoxy" != "yes"; then
11321         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
11322         AC_CHECK_HEADER(EGL/eglplatform.h, [],
11323                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
11324     fi
11326 AC_SUBST(GTK3_LIBS)
11327 AC_SUBST(GTK3_CFLAGS)
11329 if test "$enable_introspection" = yes; then
11330     if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
11331         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
11332     else
11333         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
11334     fi
11337 if test "$_os" = "WINNT"; then
11338     R="$R win"
11339 elif test "$_os" = "Darwin"; then
11340     R="$R osx"
11341 elif test "$_os" = "iOS"; then
11342     R="ios (builtin)"
11345 build_vcl_plugins="$R"
11346 if test -z "$build_vcl_plugins"; then
11347     build_vcl_plugins="none"
11349 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
11351 dnl ===================================================================
11352 dnl check for dbus support
11353 dnl ===================================================================
11354 ENABLE_DBUS=""
11355 DBUS_CFLAGS=""
11356 DBUS_LIBS=""
11357 DBUS_GLIB_CFLAGS=""
11358 DBUS_GLIB_LIBS=""
11359 DBUS_HAVE_GLIB=""
11361 if test "$enable_dbus" = "no"; then
11362     test_dbus=no
11365 AC_MSG_CHECKING([whether to enable DBUS support])
11366 if test "$test_dbus" = "yes"; then
11367     ENABLE_DBUS="TRUE"
11368     AC_MSG_RESULT([yes])
11369     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
11370     AC_DEFINE(ENABLE_DBUS)
11371     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11372     FilterLibs "${DBUS_LIBS}"
11373     DBUS_LIBS="${filteredlibs}"
11375     # Glib is needed for BluetoothServer
11376     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
11377     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
11378         [
11379             DBUS_HAVE_GLIB="TRUE"
11380             AC_DEFINE(DBUS_HAVE_GLIB,1)
11381         ],
11382         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
11383     )
11384 else
11385     AC_MSG_RESULT([no])
11388 AC_SUBST(ENABLE_DBUS)
11389 AC_SUBST(DBUS_CFLAGS)
11390 AC_SUBST(DBUS_LIBS)
11391 AC_SUBST(DBUS_GLIB_CFLAGS)
11392 AC_SUBST(DBUS_GLIB_LIBS)
11393 AC_SUBST(DBUS_HAVE_GLIB)
11395 AC_MSG_CHECKING([whether to enable Impress remote control])
11396 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
11397     AC_MSG_RESULT([yes])
11398     ENABLE_SDREMOTE=TRUE
11399     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
11401     if test $OS = MACOSX && test "$MACOSX_SDK_VERSION" -ge 101500; then
11402         # The Bluetooth code doesn't compile with macOS SDK 10.15
11403         if test "$enable_sdremote_bluetooth" = yes; then
11404             AC_MSG_ERROR([macOS SDK $with_macosx_sdk does not currently support --enable-sdremote-bluetooth])
11405         fi
11406         enable_sdremote_bluetooth=no
11407     fi
11408     # If not explicitly enabled or disabled, default
11409     if test -z "$enable_sdremote_bluetooth"; then
11410         case "$OS" in
11411         LINUX|MACOSX|WNT)
11412             # Default to yes for these
11413             enable_sdremote_bluetooth=yes
11414             ;;
11415         *)
11416             # otherwise no
11417             enable_sdremote_bluetooth=no
11418             ;;
11419         esac
11420     fi
11421     # $enable_sdremote_bluetooth is guaranteed non-empty now
11423     if test "$enable_sdremote_bluetooth" != "no"; then
11424         if test "$OS" = "LINUX"; then
11425             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
11426                 AC_MSG_RESULT([yes])
11427                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
11428                 dnl ===================================================================
11429                 dnl Check for system bluez
11430                 dnl ===================================================================
11431                 AC_MSG_CHECKING([which Bluetooth header to use])
11432                 if test "$with_system_bluez" = "yes"; then
11433                     AC_MSG_RESULT([external])
11434                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
11435                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
11436                     SYSTEM_BLUEZ=TRUE
11437                 else
11438                     AC_MSG_RESULT([internal])
11439                     SYSTEM_BLUEZ=
11440                 fi
11441             else
11442                 AC_MSG_RESULT([no, dbus disabled])
11443                 ENABLE_SDREMOTE_BLUETOOTH=
11444                 SYSTEM_BLUEZ=
11445             fi
11446         else
11447             AC_MSG_RESULT([yes])
11448             ENABLE_SDREMOTE_BLUETOOTH=TRUE
11449             SYSTEM_BLUEZ=
11450         fi
11451     else
11452         AC_MSG_RESULT([no])
11453         ENABLE_SDREMOTE_BLUETOOTH=
11454         SYSTEM_BLUEZ=
11455     fi
11456 else
11457     ENABLE_SDREMOTE=
11458     SYSTEM_BLUEZ=
11459     AC_MSG_RESULT([no])
11461 AC_SUBST(ENABLE_SDREMOTE)
11462 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
11463 AC_SUBST(SYSTEM_BLUEZ)
11465 dnl ===================================================================
11466 dnl Check whether to enable GIO support
11467 dnl ===================================================================
11468 if test "$ENABLE_GTK3" = "TRUE" -o "$ENABLE_GTK3_KDE5" = "TRUE"; then
11469     AC_MSG_CHECKING([whether to enable GIO support])
11470     if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
11471         dnl Need at least 2.26 for the dbus support.
11472         PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
11473                           [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
11474         if test "$ENABLE_GIO" = "TRUE"; then
11475             AC_DEFINE(ENABLE_GIO)
11476             GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11477             FilterLibs "${GIO_LIBS}"
11478             GIO_LIBS="${filteredlibs}"
11479         fi
11480     else
11481         AC_MSG_RESULT([no])
11482     fi
11484 AC_SUBST(ENABLE_GIO)
11485 AC_SUBST(GIO_CFLAGS)
11486 AC_SUBST(GIO_LIBS)
11489 dnl ===================================================================
11491 SPLIT_APP_MODULES=""
11492 if test "$enable_split_app_modules" = "yes"; then
11493     SPLIT_APP_MODULES="TRUE"
11495 AC_SUBST(SPLIT_APP_MODULES)
11497 SPLIT_OPT_FEATURES=""
11498 if test "$enable_split_opt_features" = "yes"; then
11499     SPLIT_OPT_FEATURES="TRUE"
11501 AC_SUBST(SPLIT_OPT_FEATURES)
11503 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
11504     if test "$enable_cairo_canvas" = yes; then
11505         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
11506     fi
11507     enable_cairo_canvas=no
11508 elif test -z "$enable_cairo_canvas"; then
11509     enable_cairo_canvas=yes
11512 ENABLE_CAIRO_CANVAS=""
11513 if test "$enable_cairo_canvas" = "yes"; then
11514     test_cairo=yes
11515     ENABLE_CAIRO_CANVAS="TRUE"
11516     AC_DEFINE(ENABLE_CAIRO_CANVAS)
11518 AC_SUBST(ENABLE_CAIRO_CANVAS)
11520 dnl ===================================================================
11521 dnl Check whether the GStreamer libraries are available.
11522 dnl ===================================================================
11524 ENABLE_GSTREAMER_1_0=""
11526 if test "$build_gstreamer_1_0" = "yes"; then
11528     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
11529     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
11530         ENABLE_GSTREAMER_1_0="TRUE"
11531         AC_MSG_RESULT([yes])
11532         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
11533         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11534         FilterLibs "${GSTREAMER_1_0_LIBS}"
11535         GSTREAMER_1_0_LIBS="${filteredlibs}"
11536         AC_DEFINE(ENABLE_GSTREAMER_1_0)
11537     else
11538         AC_MSG_RESULT([no])
11539     fi
11541 AC_SUBST(GSTREAMER_1_0_CFLAGS)
11542 AC_SUBST(GSTREAMER_1_0_LIBS)
11543 AC_SUBST(ENABLE_GSTREAMER_1_0)
11545 ENABLE_OPENGL_TRANSITIONS=
11546 ENABLE_OPENGL_CANVAS=
11547 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
11548    : # disable
11549 elif test "$_os" = "Darwin"; then
11550     # We use frameworks on macOS, no need for detail checks
11551     ENABLE_OPENGL_TRANSITIONS=TRUE
11552     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11553     ENABLE_OPENGL_CANVAS=TRUE
11554 elif test $_os = WINNT; then
11555     ENABLE_OPENGL_TRANSITIONS=TRUE
11556     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11557     ENABLE_OPENGL_CANVAS=TRUE
11558 else
11559     if test "$USING_X11" = TRUE; then
11560         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
11561         ENABLE_OPENGL_TRANSITIONS=TRUE
11562         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
11563         ENABLE_OPENGL_CANVAS=TRUE
11564     fi
11567 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
11568 AC_SUBST(ENABLE_OPENGL_CANVAS)
11570 dnl =================================================
11571 dnl Check whether to build with OpenCL support.
11572 dnl =================================================
11574 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE" -a "$enable_opencl" = "yes"; then
11575     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
11576     # platform (optional at run-time, used through clew).
11577     BUILD_TYPE="$BUILD_TYPE OPENCL"
11578     AC_DEFINE(HAVE_FEATURE_OPENCL)
11581 dnl =================================================
11582 dnl Check whether to build with dconf support.
11583 dnl =================================================
11585 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
11586     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
11587         if test "$enable_dconf" = yes; then
11588             AC_MSG_ERROR([dconf not found])
11589         else
11590             enable_dconf=no
11591         fi])
11593 AC_MSG_CHECKING([whether to enable dconf])
11594 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
11595     DCONF_CFLAGS=
11596     DCONF_LIBS=
11597     ENABLE_DCONF=
11598     AC_MSG_RESULT([no])
11599 else
11600     ENABLE_DCONF=TRUE
11601     AC_DEFINE(ENABLE_DCONF)
11602     AC_MSG_RESULT([yes])
11604 AC_SUBST([DCONF_CFLAGS])
11605 AC_SUBST([DCONF_LIBS])
11606 AC_SUBST([ENABLE_DCONF])
11608 # pdf import?
11609 AC_MSG_CHECKING([whether to build the PDF import feature])
11610 ENABLE_PDFIMPORT=
11611 if test -z "$enable_pdfimport" -o "$enable_pdfimport" = yes; then
11612     AC_MSG_RESULT([yes])
11613     ENABLE_PDFIMPORT=TRUE
11614     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
11615 else
11616     AC_MSG_RESULT([no])
11619 # Pdfium?
11620 AC_MSG_CHECKING([whether to build PDFium])
11621 ENABLE_PDFIUM=
11622 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" = "TRUE" \) -o "$enable_pdfium" = yes; then
11623     AC_MSG_RESULT([yes])
11624     ENABLE_PDFIUM=TRUE
11625     AC_DEFINE(HAVE_FEATURE_PDFIUM)
11626     BUILD_TYPE="$BUILD_TYPE PDFIUM"
11627 else
11628     AC_MSG_RESULT([no])
11630 AC_SUBST(ENABLE_PDFIUM)
11632 dnl ===================================================================
11633 dnl Check for poppler
11634 dnl ===================================================================
11635 ENABLE_POPPLER=
11636 AC_MSG_CHECKING([whether to build Poppler])
11637 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" = "TRUE" -a $_os != Android \) -o "$enable_poppler" = yes; then
11638     AC_MSG_RESULT([yes])
11639     ENABLE_POPPLER=TRUE
11640     AC_DEFINE(HAVE_FEATURE_POPPLER)
11641 else
11642     AC_MSG_RESULT([no])
11644 AC_SUBST(ENABLE_POPPLER)
11646 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
11647     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
11650 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" = "TRUE" -o "$ENABLE_PDFIUM" = "TRUE" \); then
11651     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
11654 if test "$ENABLE_PDFIMPORT" = "TRUE" -a "$ENABLE_POPPLER" = "TRUE"; then
11655     dnl ===================================================================
11656     dnl Check for system poppler
11657     dnl ===================================================================
11658     AC_MSG_CHECKING([which PDF import poppler to use])
11659     if test "$with_system_poppler" = "yes"; then
11660         AC_MSG_RESULT([external])
11661         SYSTEM_POPPLER=TRUE
11662         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
11663         AC_LANG_PUSH([C++])
11664         save_CXXFLAGS=$CXXFLAGS
11665         save_CPPFLAGS=$CPPFLAGS
11666         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
11667         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
11668         AC_CHECK_HEADER([cpp/poppler-version.h],
11669             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
11670             [])
11671         CXXFLAGS=$save_CXXFLAGS
11672         CPPFLAGS=$save_CPPFLAGS
11673         AC_LANG_POP([C++])
11674         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11676         FilterLibs "${POPPLER_LIBS}"
11677         POPPLER_LIBS="${filteredlibs}"
11678     else
11679         AC_MSG_RESULT([internal])
11680         SYSTEM_POPPLER=
11681         BUILD_TYPE="$BUILD_TYPE POPPLER"
11682         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
11683     fi
11684     AC_DEFINE([ENABLE_PDFIMPORT],1)
11686 AC_SUBST(ENABLE_PDFIMPORT)
11687 AC_SUBST(SYSTEM_POPPLER)
11688 AC_SUBST(POPPLER_CFLAGS)
11689 AC_SUBST(POPPLER_LIBS)
11691 # Skia?
11692 AC_MSG_CHECKING([whether to build Skia])
11693 ENABLE_SKIA=
11694 if test "$enable_skia" != "no" -a "$build_skia" = "yes"; then
11695     if test "$enable_skia" = "debug"; then
11696         AC_MSG_RESULT([yes (debug)])
11697         ENABLE_SKIA_DEBUG=TRUE
11698     else
11699         AC_MSG_RESULT([yes])
11700         ENABLE_SKIA_DEBUG=
11701     fi
11702     ENABLE_SKIA=TRUE
11703     AC_DEFINE(HAVE_FEATURE_SKIA)
11704     BUILD_TYPE="$BUILD_TYPE SKIA"
11705 else
11706     AC_MSG_RESULT([no])
11708 AC_SUBST(ENABLE_SKIA)
11709 AC_SUBST(ENABLE_SKIA_DEBUG)
11711 LO_CLANG_CXXFLAGS_INTRINSICS_SSE2=
11712 LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3=
11713 LO_CLANG_CXXFLAGS_INTRINSICS_SSE41=
11714 LO_CLANG_CXXFLAGS_INTRINSICS_SSE42=
11715 LO_CLANG_CXXFLAGS_INTRINSICS_AVX=
11716 LO_CLANG_CXXFLAGS_INTRINSICS_AVX2=
11717 LO_CLANG_CXXFLAGS_INTRINSICS_AVX512=
11718 LO_CLANG_CXXFLAGS_INTRINSICS_F16C=
11719 LO_CLANG_CXXFLAGS_INTRINSICS_FMA=
11721 if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE -a ! \( "$_os" = "WINNT" -a "$CPUNAME" = "AARCH64" \); then
11722     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
11723         AC_MSG_CHECKING([for Clang])
11724         AC_MSG_RESULT([$LO_CLANG_CC / $LO_CLANG_CXX])
11725     else
11726         if test "$_os" = "WINNT"; then
11727             AC_MSG_CHECKING([for clang-cl])
11728             if test -x "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"; then
11729                 LO_CLANG_CC=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"`
11730                 dnl explicitly set -m32/-m64
11731                 LO_CLANG_CC="$LO_CLANG_CC -m$WIN_HOST_BITS"
11732                 LO_CLANG_CXX="$LO_CLANG_CC"
11733                 AC_MSG_RESULT([$LO_CLANG_CC])
11734             else
11735                 AC_MSG_RESULT([no])
11736             fi
11737         else
11738             AC_CHECK_PROG(LO_CLANG_CC,clang,clang,[])
11739             AC_CHECK_PROG(LO_CLANG_CXX,clang++,clang++,[])
11740         fi
11741     fi
11742     if test -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
11743         clang2_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $LO_CLANG_CC -E - | tail -1 | sed 's/ //g'`
11744         clang2_ver=`echo "$clang2_version" | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
11745         if test "$clang2_ver" -lt 50002; then
11746             AC_MSG_WARN(["$clang2_version" is too old or unrecognized, must be at least Clang 5.0.2])
11747             LO_CLANG_CC=
11748             LO_CLANG_CXX=
11749         fi
11750     fi
11751     if test -z "$LO_CLANG_CC" -o -z "$LO_CLANG_CXX"; then
11752         # Skia is the default on Windows, so hard-require Clang.
11753         # Elsewhere it's used just by the 'gen' VCL backend which is rarely used.
11754         if test "$_os" = "WINNT"; then
11755             AC_MSG_ERROR([Clang compiler not found. The Skia library needs to be built using Clang.])
11756         else
11757             AC_MSG_WARN([Clang compiler not found.])
11758         fi
11759     else
11761         save_CXX="$CXX"
11762         CXX="$LO_CLANG_CXX"
11763         # copy&paste (and adjust) of intrinsics checks, since MSVC's -arch doesn't work well for Clang-cl
11764         flag_sse2=-msse2
11765         flag_ssse3=-mssse3
11766         flag_sse41=-msse4.1
11767         flag_sse42=-msse4.2
11768         flag_avx=-mavx
11769         flag_avx2=-mavx2
11770         flag_avx512="-mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd"
11771         flag_f16c=-mf16c
11772         flag_fma=-mfma
11774         AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
11775         AC_LANG_PUSH([C++])
11776         save_CXXFLAGS=$CXXFLAGS
11777         CXXFLAGS="$CXXFLAGS $flag_sse2"
11778         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11779             #include <emmintrin.h>
11780             int main () {
11781                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11782                 c = _mm_xor_si128 (a, b);
11783                 return 0;
11784             }
11785             ])],
11786             [can_compile_sse2=yes],
11787             [can_compile_sse2=no])
11788         AC_LANG_POP([C++])
11789         CXXFLAGS=$save_CXXFLAGS
11790         AC_MSG_RESULT([${can_compile_sse2}])
11791         if test "${can_compile_sse2}" = "yes" ; then
11792             LO_CLANG_CXXFLAGS_INTRINSICS_SSE2="$flag_sse2"
11793         fi
11795         AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
11796         AC_LANG_PUSH([C++])
11797         save_CXXFLAGS=$CXXFLAGS
11798         CXXFLAGS="$CXXFLAGS $flag_ssse3"
11799         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11800             #include <tmmintrin.h>
11801             int main () {
11802                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11803                 c = _mm_maddubs_epi16 (a, b);
11804                 return 0;
11805             }
11806             ])],
11807             [can_compile_ssse3=yes],
11808             [can_compile_ssse3=no])
11809         AC_LANG_POP([C++])
11810         CXXFLAGS=$save_CXXFLAGS
11811         AC_MSG_RESULT([${can_compile_ssse3}])
11812         if test "${can_compile_ssse3}" = "yes" ; then
11813             LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3="$flag_ssse3"
11814         fi
11816         AC_MSG_CHECKING([whether $CXX can compile SSE4.1 intrinsics])
11817         AC_LANG_PUSH([C++])
11818         save_CXXFLAGS=$CXXFLAGS
11819         CXXFLAGS="$CXXFLAGS $flag_sse41"
11820         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11821             #include <smmintrin.h>
11822             int main () {
11823                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11824                 c = _mm_cmpeq_epi64 (a, b);
11825                 return 0;
11826             }
11827             ])],
11828             [can_compile_sse41=yes],
11829             [can_compile_sse41=no])
11830         AC_LANG_POP([C++])
11831         CXXFLAGS=$save_CXXFLAGS
11832         AC_MSG_RESULT([${can_compile_sse41}])
11833         if test "${can_compile_sse41}" = "yes" ; then
11834             LO_CLANG_CXXFLAGS_INTRINSICS_SSE41="$flag_sse41"
11835         fi
11837         AC_MSG_CHECKING([whether $CXX can compile SSE4.2 intrinsics])
11838         AC_LANG_PUSH([C++])
11839         save_CXXFLAGS=$CXXFLAGS
11840         CXXFLAGS="$CXXFLAGS $flag_sse42"
11841         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11842             #include <nmmintrin.h>
11843             int main () {
11844                 __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
11845                 c = _mm_cmpgt_epi64 (a, b);
11846                 return 0;
11847             }
11848             ])],
11849             [can_compile_sse42=yes],
11850             [can_compile_sse42=no])
11851         AC_LANG_POP([C++])
11852         CXXFLAGS=$save_CXXFLAGS
11853         AC_MSG_RESULT([${can_compile_sse42}])
11854         if test "${can_compile_sse42}" = "yes" ; then
11855             LO_CLANG_CXXFLAGS_INTRINSICS_SSE42="$flag_sse42"
11856         fi
11858         AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
11859         AC_LANG_PUSH([C++])
11860         save_CXXFLAGS=$CXXFLAGS
11861         CXXFLAGS="$CXXFLAGS $flag_avx"
11862         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11863             #include <immintrin.h>
11864             int main () {
11865                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
11866                 c = _mm256_xor_ps(a, b);
11867                 return 0;
11868             }
11869             ])],
11870             [can_compile_avx=yes],
11871             [can_compile_avx=no])
11872         AC_LANG_POP([C++])
11873         CXXFLAGS=$save_CXXFLAGS
11874         AC_MSG_RESULT([${can_compile_avx}])
11875         if test "${can_compile_avx}" = "yes" ; then
11876             LO_CLANG_CXXFLAGS_INTRINSICS_AVX="$flag_avx"
11877         fi
11879         AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
11880         AC_LANG_PUSH([C++])
11881         save_CXXFLAGS=$CXXFLAGS
11882         CXXFLAGS="$CXXFLAGS $flag_avx2"
11883         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11884             #include <immintrin.h>
11885             int main () {
11886                 __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
11887                 c = _mm256_maddubs_epi16(a, b);
11888                 return 0;
11889             }
11890             ])],
11891             [can_compile_avx2=yes],
11892             [can_compile_avx2=no])
11893         AC_LANG_POP([C++])
11894         CXXFLAGS=$save_CXXFLAGS
11895         AC_MSG_RESULT([${can_compile_avx2}])
11896         if test "${can_compile_avx2}" = "yes" ; then
11897             LO_CLANG_CXXFLAGS_INTRINSICS_AVX2="$flag_avx2"
11898         fi
11900         AC_MSG_CHECKING([whether $CXX can compile AVX512 intrinsics])
11901         AC_LANG_PUSH([C++])
11902         save_CXXFLAGS=$CXXFLAGS
11903         CXXFLAGS="$CXXFLAGS $flag_avx512"
11904         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11905             #include <immintrin.h>
11906             int main () {
11907                 __m512i a = _mm512_loadu_si512(0);
11908                 return 0;
11909             }
11910             ])],
11911             [can_compile_avx512=yes],
11912             [can_compile_avx512=no])
11913         AC_LANG_POP([C++])
11914         CXXFLAGS=$save_CXXFLAGS
11915         AC_MSG_RESULT([${can_compile_avx512}])
11916         if test "${can_compile_avx512}" = "yes" ; then
11917             LO_CLANG_CXXFLAGS_INTRINSICS_AVX512="$flag_avx512"
11918         fi
11920         AC_MSG_CHECKING([whether $CXX can compile F16C intrinsics])
11921         AC_LANG_PUSH([C++])
11922         save_CXXFLAGS=$CXXFLAGS
11923         CXXFLAGS="$CXXFLAGS $flag_f16c"
11924         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11925             #include <immintrin.h>
11926             int main () {
11927                 __m128i a = _mm_set1_epi32 (0);
11928                 __m128 c;
11929                 c = _mm_cvtph_ps(a);
11930                 return 0;
11931             }
11932             ])],
11933             [can_compile_f16c=yes],
11934             [can_compile_f16c=no])
11935         AC_LANG_POP([C++])
11936         CXXFLAGS=$save_CXXFLAGS
11937         AC_MSG_RESULT([${can_compile_f16c}])
11938         if test "${can_compile_f16c}" = "yes" ; then
11939             LO_CLANG_CXXFLAGS_INTRINSICS_F16C="$flag_f16c"
11940         fi
11942         AC_MSG_CHECKING([whether $CXX can compile FMA intrinsics])
11943         AC_LANG_PUSH([C++])
11944         save_CXXFLAGS=$CXXFLAGS
11945         CXXFLAGS="$CXXFLAGS $flag_fma"
11946         AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11947             #include <immintrin.h>
11948             int main () {
11949                 __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c = _mm256_set1_ps (0.0f), d;
11950                 d = _mm256_fmadd_ps(a, b, c);
11951                 return 0;
11952             }
11953             ])],
11954             [can_compile_fma=yes],
11955             [can_compile_fma=no])
11956         AC_LANG_POP([C++])
11957         CXXFLAGS=$save_CXXFLAGS
11958         AC_MSG_RESULT([${can_compile_fma}])
11959         if test "${can_compile_fma}" = "yes" ; then
11960             LO_CLANG_CXXFLAGS_INTRINSICS_FMA="$flag_fma"
11961         fi
11963         CXX="$save_CXX"
11964     fi
11967 # prefix LO_CLANG_CC/LO_CLANG_CXX with ccache if needed
11969 if test "$CCACHE" != "" -a -n "$LO_CLANG_CC" -a -n "$LO_CLANG_CXX"; then
11970     AC_MSG_CHECKING([whether $LO_CLANG_CC is already ccached])
11971     AC_LANG_PUSH([C])
11972     save_CC="$CC"
11973     CC="$LO_CLANG_CC"
11974     save_CFLAGS=$CFLAGS
11975     CFLAGS="$CFLAGS --ccache-skip -O2"
11976     dnl an empty program will do, we're checking the compiler flags
11977     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
11978                       [use_ccache=yes], [use_ccache=no])
11979     CFLAGS=$save_CFLAGS
11980     CC=$save_CC
11981     if test $use_ccache = yes; then
11982         AC_MSG_RESULT([yes])
11983     else
11984         LO_CLANG_CC="$CCACHE $LO_CLANG_CC"
11985         AC_MSG_RESULT([no])
11986     fi
11987     AC_LANG_POP([C])
11989     AC_MSG_CHECKING([whether $LO_CLANG_CXX is already ccached])
11990     AC_LANG_PUSH([C++])
11991     save_CXX="$CXX"
11992     CXX="$LO_CLANG_CXX"
11993     save_CXXFLAGS=$CXXFLAGS
11994     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
11995     dnl an empty program will do, we're checking the compiler flags
11996     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
11997                       [use_ccache=yes], [use_ccache=no])
11998     if test $use_ccache = yes; then
11999         AC_MSG_RESULT([yes])
12000     else
12001         LO_CLANG_CXX="$CCACHE $LO_CLANG_CXX"
12002         AC_MSG_RESULT([no])
12003     fi
12004     CXXFLAGS=$save_CXXFLAGS
12005     CXX=$save_CXX
12006     AC_LANG_POP([C++])
12009 AC_SUBST(LO_CLANG_CC)
12010 AC_SUBST(LO_CLANG_CXX)
12011 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE2)
12012 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSSE3)
12013 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE41)
12014 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_SSE42)
12015 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX)
12016 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX2)
12017 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_AVX512)
12018 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_F16C)
12019 AC_SUBST(LO_CLANG_CXXFLAGS_INTRINSICS_FMA)
12020 AC_SUBST(CLANG_USE_LD)
12022 SYSTEM_GPGMEPP=
12024 if test "$enable_gpgmepp" = no; then
12025     AC_MSG_CHECKING([whether to enable gpgmepp])
12026     AC_MSG_RESULT([no])
12027 elif test "$enable_mpl_subset" = "yes"; then
12028     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
12029     AC_MSG_RESULT([yes])
12030 elif test "$enable_fuzzers" = "yes"; then
12031     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
12032     AC_MSG_RESULT([yes])
12033 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
12034     dnl ===================================================================
12035     dnl Check for system gpgme
12036     dnl ===================================================================
12037     AC_MSG_CHECKING([which gpgmepp to use])
12038     if test "$with_system_gpgmepp" = "yes"; then
12039         AC_MSG_RESULT([external])
12040         SYSTEM_GPGMEPP=TRUE
12042         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
12043         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
12044             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
12045         # progress_callback is the only func with plain C linkage
12046         # checking for it also filters out older, KDE-dependent libgpgmepp versions
12047         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
12048             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
12049         AC_CHECK_HEADER(gpgme.h, [],
12050             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
12051     else
12052         AC_MSG_RESULT([internal])
12053         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
12054         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
12056         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
12057         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
12058         if test "$_os" != "WINNT"; then
12059             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
12060             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
12061         fi
12062     fi
12063     ENABLE_GPGMEPP=TRUE
12064     AC_DEFINE([HAVE_FEATURE_GPGME])
12065     AC_PATH_PROG(GPG, gpg)
12066     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
12067     # so let's exclude that manually for the moment
12068     if test -n "$GPG" -a "$_os" != "WINNT"; then
12069         # make sure we not only have a working gpgme, but a full working
12070         # gpg installation to run OpenPGP signature verification
12071         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
12072     fi
12073     if test "$_os" = "Linux"; then
12074       uid=`id -u`
12075       AC_MSG_CHECKING([for /run/user/$uid])
12076       if test -d /run/user/$uid; then
12077         AC_MSG_RESULT([yes])
12078         AC_PATH_PROG(GPGCONF, gpgconf)
12080         # Older versions of gpgconf are not working as expected, since
12081         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
12082         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
12083         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
12084         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
12085         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
12086         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
12087         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
12088           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
12089           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
12090           if $GPGCONF --dump-options > /dev/null ; then
12091             if $GPGCONF --dump-options | grep -q create-socketdir ; then
12092               AC_MSG_RESULT([yes])
12093               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
12094               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
12095             else
12096               AC_MSG_RESULT([no])
12097             fi
12098           else
12099             AC_MSG_RESULT([no. missing or broken gpgconf?])
12100           fi
12101         else
12102           AC_MSG_RESULT([no, $GPGCONF_VERSION])
12103         fi
12104       else
12105         AC_MSG_RESULT([no])
12106      fi
12107    fi
12109 AC_SUBST(ENABLE_GPGMEPP)
12110 AC_SUBST(SYSTEM_GPGMEPP)
12111 AC_SUBST(GPG_ERROR_CFLAGS)
12112 AC_SUBST(GPG_ERROR_LIBS)
12113 AC_SUBST(LIBASSUAN_CFLAGS)
12114 AC_SUBST(LIBASSUAN_LIBS)
12115 AC_SUBST(GPGMEPP_CFLAGS)
12116 AC_SUBST(GPGMEPP_LIBS)
12118 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
12119 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
12120     AC_MSG_RESULT([yes])
12121     ENABLE_MEDIAWIKI=TRUE
12122     BUILD_TYPE="$BUILD_TYPE XSLTML"
12123     if test  "x$with_java" = "xno"; then
12124         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
12125     fi
12126 else
12127     AC_MSG_RESULT([no])
12128     ENABLE_MEDIAWIKI=
12129     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
12131 AC_SUBST(ENABLE_MEDIAWIKI)
12133 AC_MSG_CHECKING([whether to build the Report Builder])
12134 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12135     AC_MSG_RESULT([yes])
12136     ENABLE_REPORTBUILDER=TRUE
12137     AC_MSG_CHECKING([which jfreereport libs to use])
12138     if test "$with_system_jfreereport" = "yes"; then
12139         SYSTEM_JFREEREPORT=TRUE
12140         AC_MSG_RESULT([external])
12141         if test -z $SAC_JAR; then
12142             SAC_JAR=/usr/share/java/sac.jar
12143         fi
12144         if ! test -f $SAC_JAR; then
12145              AC_MSG_ERROR(sac.jar not found.)
12146         fi
12148         if test -z $LIBXML_JAR; then
12149             if test -f /usr/share/java/libxml-1.0.0.jar; then
12150                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
12151             elif test -f /usr/share/java/libxml.jar; then
12152                 LIBXML_JAR=/usr/share/java/libxml.jar
12153             else
12154                 AC_MSG_ERROR(libxml.jar replacement not found.)
12155             fi
12156         elif ! test -f $LIBXML_JAR; then
12157             AC_MSG_ERROR(libxml.jar not found.)
12158         fi
12160         if test -z $FLUTE_JAR; then
12161             if test -f /usr/share/java/flute-1.3.0.jar; then
12162                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
12163             elif test -f /usr/share/java/flute.jar; then
12164                 FLUTE_JAR=/usr/share/java/flute.jar
12165             else
12166                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
12167             fi
12168         elif ! test -f $FLUTE_JAR; then
12169             AC_MSG_ERROR(flute-1.3.0.jar not found.)
12170         fi
12172         if test -z $JFREEREPORT_JAR; then
12173             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
12174                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
12175             elif test -f /usr/share/java/flow-engine.jar; then
12176                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
12177             else
12178                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
12179             fi
12180         elif ! test -f  $JFREEREPORT_JAR; then
12181                 AC_MSG_ERROR(jfreereport.jar not found.)
12182         fi
12184         if test -z $LIBLAYOUT_JAR; then
12185             if test -f /usr/share/java/liblayout-0.2.9.jar; then
12186                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
12187             elif test -f /usr/share/java/liblayout.jar; then
12188                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
12189             else
12190                 AC_MSG_ERROR(liblayout.jar replacement not found.)
12191             fi
12192         elif ! test -f $LIBLAYOUT_JAR; then
12193                 AC_MSG_ERROR(liblayout.jar not found.)
12194         fi
12196         if test -z $LIBLOADER_JAR; then
12197             if test -f /usr/share/java/libloader-1.0.0.jar; then
12198                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
12199             elif test -f /usr/share/java/libloader.jar; then
12200                 LIBLOADER_JAR=/usr/share/java/libloader.jar
12201             else
12202                 AC_MSG_ERROR(libloader.jar replacement not found.)
12203             fi
12204         elif ! test -f  $LIBLOADER_JAR; then
12205             AC_MSG_ERROR(libloader.jar not found.)
12206         fi
12208         if test -z $LIBFORMULA_JAR; then
12209             if test -f /usr/share/java/libformula-0.2.0.jar; then
12210                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
12211             elif test -f /usr/share/java/libformula.jar; then
12212                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
12213             else
12214                 AC_MSG_ERROR(libformula.jar replacement not found.)
12215             fi
12216         elif ! test -f $LIBFORMULA_JAR; then
12217                 AC_MSG_ERROR(libformula.jar not found.)
12218         fi
12220         if test -z $LIBREPOSITORY_JAR; then
12221             if test -f /usr/share/java/librepository-1.0.0.jar; then
12222                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
12223             elif test -f /usr/share/java/librepository.jar; then
12224                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
12225             else
12226                 AC_MSG_ERROR(librepository.jar replacement not found.)
12227             fi
12228         elif ! test -f $LIBREPOSITORY_JAR; then
12229             AC_MSG_ERROR(librepository.jar not found.)
12230         fi
12232         if test -z $LIBFONTS_JAR; then
12233             if test -f /usr/share/java/libfonts-1.0.0.jar; then
12234                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
12235             elif test -f /usr/share/java/libfonts.jar; then
12236                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
12237             else
12238                 AC_MSG_ERROR(libfonts.jar replacement not found.)
12239             fi
12240         elif ! test -f $LIBFONTS_JAR; then
12241                 AC_MSG_ERROR(libfonts.jar not found.)
12242         fi
12244         if test -z $LIBSERIALIZER_JAR; then
12245             if test -f /usr/share/java/libserializer-1.0.0.jar; then
12246                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
12247             elif test -f /usr/share/java/libserializer.jar; then
12248                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
12249             else
12250                 AC_MSG_ERROR(libserializer.jar replacement not found.)
12251             fi
12252         elif ! test -f $LIBSERIALIZER_JAR; then
12253                 AC_MSG_ERROR(libserializer.jar not found.)
12254         fi
12256         if test -z $LIBBASE_JAR; then
12257             if test -f /usr/share/java/libbase-1.0.0.jar; then
12258                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
12259             elif test -f /usr/share/java/libbase.jar; then
12260                 LIBBASE_JAR=/usr/share/java/libbase.jar
12261             else
12262                 AC_MSG_ERROR(libbase.jar replacement not found.)
12263             fi
12264         elif ! test -f $LIBBASE_JAR; then
12265             AC_MSG_ERROR(libbase.jar not found.)
12266         fi
12268     else
12269         AC_MSG_RESULT([internal])
12270         SYSTEM_JFREEREPORT=
12271         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
12272         NEED_ANT=TRUE
12273     fi
12274 else
12275     AC_MSG_RESULT([no])
12276     ENABLE_REPORTBUILDER=
12277     SYSTEM_JFREEREPORT=
12279 AC_SUBST(ENABLE_REPORTBUILDER)
12280 AC_SUBST(SYSTEM_JFREEREPORT)
12281 AC_SUBST(SAC_JAR)
12282 AC_SUBST(LIBXML_JAR)
12283 AC_SUBST(FLUTE_JAR)
12284 AC_SUBST(JFREEREPORT_JAR)
12285 AC_SUBST(LIBBASE_JAR)
12286 AC_SUBST(LIBLAYOUT_JAR)
12287 AC_SUBST(LIBLOADER_JAR)
12288 AC_SUBST(LIBFORMULA_JAR)
12289 AC_SUBST(LIBREPOSITORY_JAR)
12290 AC_SUBST(LIBFONTS_JAR)
12291 AC_SUBST(LIBSERIALIZER_JAR)
12293 # this has to be here because both the Wiki Publisher and the SRB use
12294 # commons-logging
12295 COMMONS_LOGGING_VERSION=1.2
12296 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12297     AC_MSG_CHECKING([which Apache commons-* libs to use])
12298     if test "$with_system_apache_commons" = "yes"; then
12299         SYSTEM_APACHE_COMMONS=TRUE
12300         AC_MSG_RESULT([external])
12301         if test -z $COMMONS_LOGGING_JAR; then
12302             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
12303                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
12304            elif test -f /usr/share/java/commons-logging.jar; then
12305                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
12306             else
12307                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
12308             fi
12309         elif ! test -f $COMMONS_LOGGING_JAR; then
12310             AC_MSG_ERROR(commons-logging.jar not found.)
12311         fi
12312     else
12313         AC_MSG_RESULT([internal])
12314         SYSTEM_APACHE_COMMONS=
12315         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
12316         NEED_ANT=TRUE
12317     fi
12319 AC_SUBST(SYSTEM_APACHE_COMMONS)
12320 AC_SUBST(COMMONS_LOGGING_JAR)
12321 AC_SUBST(COMMONS_LOGGING_VERSION)
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: