Resolves tdf#127195 - Placement of "Don't show again" box in No help
[LibreOffice.git] / configure.ac
blobe6081bb94e8b73245b5e886fa9c278142807cd1c
1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; fill-column: 102 -*-
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],[6.4.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     filteredlibs=
47     for f in $1; do
48         case "$f" in
49             # let's start with Fedora's paths for now
50             -L/lib|-L/lib/|-L/lib64|-L/lib64/|-L/usr/lib|-L/usr/lib/|-L/usr/lib64|-L/usr/lib64/)
51                 # ignore it: on UNIXoids it is searched by default anyway
52                 # but if it's given explicitly then it may override other paths
53                 # (on macOS it would be an error to use it instead of SDK)
54                 ;;
55             *)
56                 filteredlibs="$filteredlibs $f"
57                 ;;
58         esac
59     done
62 PathFormat()
64     formatted_path="$1"
65     if test "$build_os" = "cygwin"; then
66         pf_conv_to_dos=
67         # spaces,parentheses,brackets,braces are problematic in pathname
68         # so are backslashes
69         case "$formatted_path" in
70             *\ * | *\)* | *\(* | *\{* | *\}* | *\[* | *\]* | *\\* )
71                 pf_conv_to_dos="yes"
72             ;;
73         esac
74         if test "$pf_conv_to_dos" = "yes"; then
75             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
76                 formatted_path=`cygpath -sm "$formatted_path"`
77             else
78                 formatted_path=`cygpath -d "$formatted_path"`
79             fi
80             if test $? -ne 0;  then
81                 AC_MSG_ERROR([path conversion failed for "$1".])
82             fi
83         fi
84         fp_count_colon=`echo "$formatted_path" | $GREP -c "[:]"`
85         fp_count_slash=`echo "$formatted_path" | $GREP -c "[/]"`
86         if test "$fp_count_slash$fp_count_colon" != "00"; then
87             if test "$fp_count_colon" = "0"; then
88                 new_formatted_path=`realpath "$formatted_path"`
89                 if test $? -ne 0;  then
90                     AC_MSG_WARN([realpath failed for "$1", not necessarily a problem.])
91                 else
92                     formatted_path="$new_formatted_path"
93                 fi
94             fi
95             formatted_path=`cygpath -m "$formatted_path"`
96             if test $? -ne 0;  then
97                 AC_MSG_ERROR([path conversion failed for "$1".])
98             fi
99         fi
100         fp_count_space=`echo "$formatted_path" | $GREP -c "[ ]"`
101         if test "$fp_count_space" != "0"; then
102             AC_MSG_ERROR([converted path "$formatted_path" still contains spaces. Short filenames (8.3 filenames) support was disabled on this system?])
103         fi
104     fi
107 AbsolutePath()
109     # There appears to be no simple and portable method to get an absolute and
110     # canonical path, so we try creating the directory if does not exist and
111     # utilizing the shell and pwd.
112     rel="$1"
113     absolute_path=""
114     test ! -e "$rel" && mkdir -p "$rel"
115     if test -d "$rel" ; then
116         cd "$rel" || AC_MSG_ERROR([absolute path resolution failed for "$rel".])
117         absolute_path="$(pwd)"
118         cd - > /dev/null
119     else
120         AC_MSG_ERROR([Failed to resolve absolute path.  "$rel" does not exist or is not a directory.])
121     fi
124 rm -f warn
125 have_WARNINGS="no"
126 add_warning()
128     if test "$have_WARNINGS" = "no"; then
129         echo "*************************************" > warn
130         have_WARNINGS="yes"
131         if which tput >/dev/null && test "`tput colors 2>/dev/null || echo 0`" -ge 8; then
132             dnl <esc> as actual byte (U+1b), [ escaped using quadrigraph @<:@
133             COLORWARN='*\e@<:@1;33;40m WARNING \e@<:@0m:'
134         else
135             COLORWARN="* WARNING :"
136         fi
137     fi
138     echo "$COLORWARN $@" >> warn
141 dnl Some Mac User have the bad habit of letting a lot of crap
142 dnl accumulate in their PATH and even adding stuff in /usr/local/bin
143 dnl that confuse the build.
144 dnl For the ones that use LODE, let's be nice and protect them
145 dnl from themselves
147 mac_sanitize_path()
149     mac_path="$LODE_HOME/opt/bin:/usr/bin:/bin:/usr/sbin:/sbin"
150 dnl a common but nevertheless necessary thing that may be in a fancy
151 dnl path location is git, so make sure we have it
152     mac_git_path=`which git 2>/dev/null`
153     if test -n "$mac_git_path" -a -x "$mac_git_path" -a "$mac_git_path" != "/usr/bin/git" ; then
154         mac_path="$mac_path:`dirname $mac_git_path`"
155     fi
156 dnl a not so common but nevertheless quite helpful thing that may be in a fancy
157 dnl path location is gpg, so make sure we find it
158     mac_gpg_path=`which gpg 2>/dev/null`
159     if test -n "$mac_gpg_path" -a -x "$mac_gpg_path" -a "$mac_gpg_path" != "/usr/bin/gpg" ; then
160         mac_path="$mac_path:`dirname $mac_gpg_path`"
161     fi
162     PATH="$mac_path"
163     unset mac_path
164     unset mac_git_path
165     unset mac_gpg_path
168 echo "********************************************************************"
169 echo "*"
170 echo "*   Running ${PACKAGE_NAME} build configuration."
171 echo "*"
172 echo "********************************************************************"
173 echo ""
175 dnl ===================================================================
176 dnl checks build and host OSes
177 dnl do this before argument processing to allow for platform dependent defaults
178 dnl ===================================================================
179 AC_CANONICAL_HOST
181 AC_MSG_CHECKING([for product name])
182 PRODUCTNAME="AC_PACKAGE_NAME"
183 if test -n "$with_product_name" -a "$with_product_name" != no; then
184     PRODUCTNAME="$with_product_name"
186 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
187     PRODUCTNAME="${PRODUCTNAME}Dev"
189 AC_MSG_RESULT([$PRODUCTNAME])
190 AC_SUBST(PRODUCTNAME)
191 PRODUCTNAME_WITHOUT_SPACES=$(printf %s "$PRODUCTNAME" | sed 's/ //g')
192 AC_SUBST(PRODUCTNAME_WITHOUT_SPACES)
194 dnl ===================================================================
195 dnl Our version is defined by the AC_INIT() at the top of this script.
196 dnl ===================================================================
198 AC_MSG_CHECKING([for package version])
199 if test -n "$with_package_version" -a "$with_package_version" != no; then
200     PACKAGE_VERSION="$with_package_version"
202 AC_MSG_RESULT([$PACKAGE_VERSION])
204 set `echo "$PACKAGE_VERSION" | sed "s/\./ /g"`
206 LIBO_VERSION_MAJOR=$1
207 LIBO_VERSION_MINOR=$2
208 LIBO_VERSION_MICRO=$3
209 LIBO_VERSION_PATCH=$4
211 # The CFBundleShortVersionString in Info.plist consists of three integers, so encode the third
212 # as the micro version times 1000 plus the patch number. Unfortunately the LIBO_VERSION_SUFFIX can be anything so
213 # no way to encode that into an integer in general.
214 MACOSX_BUNDLE_SHORTVERSION=$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR.`expr $LIBO_VERSION_MICRO '*' 1000 + $LIBO_VERSION_PATCH`
216 LIBO_VERSION_SUFFIX=$5
217 # Split out LIBO_VERSION_SUFFIX_SUFFIX... horrible crack. But apparently wanted separately in
218 # openoffice.lst as ABOUTBOXPRODUCTVERSIONSUFFIX. Note that the double brackets are for m4's sake,
219 # they get undoubled before actually passed to sed.
220 LIBO_VERSION_SUFFIX_SUFFIX=`echo "$LIBO_VERSION_SUFFIX" | sed -e 's/.*[[a-zA-Z0-9]]\([[^a-zA-Z0-9]]*\)$/\1/'`
221 test -n "$LIBO_VERSION_SUFFIX_SUFFIX" && LIBO_VERSION_SUFFIX="${LIBO_VERSION_SUFFIX%${LIBO_VERSION_SUFFIX_SUFFIX}}"
222 # LIBO_VERSION_SUFFIX, if non-empty, should include the period separator
223 test -n "$LIBO_VERSION_SUFFIX" && LIBO_VERSION_SUFFIX=".$LIBO_VERSION_SUFFIX"
225 AC_SUBST(LIBO_VERSION_MAJOR)
226 AC_SUBST(LIBO_VERSION_MINOR)
227 AC_SUBST(LIBO_VERSION_MICRO)
228 AC_SUBST(LIBO_VERSION_PATCH)
229 AC_SUBST(MACOSX_BUNDLE_SHORTVERSION)
230 AC_SUBST(LIBO_VERSION_SUFFIX)
231 AC_SUBST(LIBO_VERSION_SUFFIX_SUFFIX)
233 AC_DEFINE_UNQUOTED(LIBO_VERSION_MAJOR,$LIBO_VERSION_MAJOR)
234 AC_DEFINE_UNQUOTED(LIBO_VERSION_MINOR,$LIBO_VERSION_MINOR)
235 AC_DEFINE_UNQUOTED(LIBO_VERSION_MICRO,$LIBO_VERSION_MICRO)
236 AC_DEFINE_UNQUOTED(LIBO_VERSION_PATCH,$LIBO_VERSION_PATCH)
238 LIBO_THIS_YEAR=`date +%Y`
239 AC_DEFINE_UNQUOTED(LIBO_THIS_YEAR,$LIBO_THIS_YEAR)
241 dnl ===================================================================
242 dnl Product version
243 dnl ===================================================================
244 AC_MSG_CHECKING([for product version])
245 PRODUCTVERSION="$LIBO_VERSION_MAJOR.$LIBO_VERSION_MINOR"
246 AC_MSG_RESULT([$PRODUCTVERSION])
247 AC_SUBST(PRODUCTVERSION)
249 AC_PROG_EGREP
250 # AC_PROG_EGREP doesn't set GREP on all systems as well
251 AC_PATH_PROG(GREP, grep)
253 BUILDDIR=`pwd`
254 cd $srcdir
255 SRC_ROOT=`pwd`
256 cd $BUILDDIR
257 x_Cygwin=[\#]
259 dnl ======================================
260 dnl Required GObject introspection version
261 dnl ======================================
262 INTROSPECTION_REQUIRED_VERSION=1.32.0
264 dnl ===================================================================
265 dnl Search all the common names for GNU Make
266 dnl ===================================================================
267 AC_MSG_CHECKING([for GNU Make])
269 # try to use our own make if it is available and GNUMAKE was not already defined
270 if test -z "$GNUMAKE"; then
271     if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/make" ; then
272         GNUMAKE="$LODE_HOME/opt/bin/make"
273     elif test -x "/opt/lo/bin/make"; then
274         GNUMAKE="/opt/lo/bin/make"
275     fi
278 GNUMAKE_WIN_NATIVE=
279 for a in "$MAKE" "$GNUMAKE" make gmake gnumake; do
280     if test -n "$a"; then
281         $a --version 2> /dev/null | grep GNU  2>&1 > /dev/null
282         if test $? -eq 0;  then
283             if test "$build_os" = "cygwin"; then
284                 if test -n "$($a -v | grep 'Built for Windows')" ; then
285                     GNUMAKE="$(cygpath -m "$(which "$(cygpath -u $a)")")"
286                     GNUMAKE_WIN_NATIVE="TRUE"
287                 else
288                     GNUMAKE=`which $a`
289                 fi
290             else
291                 GNUMAKE=`which $a`
292             fi
293             break
294         fi
295     fi
296 done
297 AC_MSG_RESULT($GNUMAKE)
298 if test -z "$GNUMAKE"; then
299     AC_MSG_ERROR([not found. install GNU Make.])
300 else
301     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
302         AC_MSG_NOTICE([Using a native Win32 GNU Make version.])
303     fi
306 win_short_path_for_make()
308     local_short_path="$1"
309     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
310         cygpath -sm "$local_short_path"
311     else
312         cygpath -u "$(cygpath -d "$local_short_path")"
313     fi
317 if test "$build_os" = "cygwin"; then
318     PathFormat "$SRC_ROOT"
319     SRC_ROOT="$formatted_path"
320     PathFormat "$BUILDDIR"
321     BUILDDIR="$formatted_path"
322     x_Cygwin=
323     AC_MSG_CHECKING(for explicit COMSPEC)
324     if test -z "$COMSPEC"; then
325         AC_MSG_ERROR([COMSPEC not set in environment, please set it and rerun])
326     else
327         AC_MSG_RESULT([found: $COMSPEC])
328     fi
331 AC_SUBST(SRC_ROOT)
332 AC_SUBST(BUILDDIR)
333 AC_SUBST(x_Cygwin)
334 AC_DEFINE_UNQUOTED(SRCDIR,"$SRC_ROOT")
335 AC_DEFINE_UNQUOTED(BUILDDIR,"$BUILDDIR")
337 if test "z$EUID" = "z0" -a "`uname -o 2>/dev/null`" = "Cygwin"; then
338     AC_MSG_ERROR([You must build LibreOffice as a normal user - not using an administrative account])
341 # need sed in os checks...
342 AC_PATH_PROGS(SED, sed)
343 if test -z "$SED"; then
344     AC_MSG_ERROR([install sed to run this script])
347 # Set the ENABLE_LTO variable
348 # ===================================================================
349 AC_MSG_CHECKING([whether to use link-time optimization])
350 if test -n "$enable_lto" -a "$enable_lto" != "no"; then
351     ENABLE_LTO="TRUE"
352     AC_MSG_RESULT([yes])
353     AC_DEFINE(STATIC_LINKING)
354 else
355     ENABLE_LTO=""
356     AC_MSG_RESULT([no])
358 AC_SUBST(ENABLE_LTO)
360 AC_ARG_ENABLE(fuzz-options,
361     AS_HELP_STRING([--enable-fuzz-options],
362         [Randomly enable or disable each of those configurable options
363          that are supposed to be freely selectable without interdependencies,
364          or where bad interaction from interdependencies is automatically avoided.])
367 dnl ===================================================================
368 dnl When building for Android, --with-android-ndk,
369 dnl --with-android-ndk-toolchain-version and --with-android-sdk are
370 dnl mandatory
371 dnl ===================================================================
373 AC_ARG_WITH(android-ndk,
374     AS_HELP_STRING([--with-android-ndk],
375         [Specify location of the Android Native Development Kit. Mandatory when building for Android.]),
378 AC_ARG_WITH(android-ndk-toolchain-version,
379     AS_HELP_STRING([--with-android-ndk-toolchain-version],
380         [Specify which toolchain version to use, of those present in the
381         Android NDK you are using. The default (and only supported version currently) is "clang5.0"]),,
382         with_android_ndk_toolchain_version=clang5.0)
384 AC_ARG_WITH(android-sdk,
385     AS_HELP_STRING([--with-android-sdk],
386         [Specify location of the Android SDK. Mandatory when building for Android.]),
389 ANDROID_NDK_HOME=
390 if test -z "$with_android_ndk" -a -e "$SRC_ROOT/external/android-ndk" -a "$build" != "$host"; then
391     with_android_ndk="$SRC_ROOT/external/android-ndk"
393 if test -n "$with_android_ndk"; then
394     ANDROID_NDK_HOME=$with_android_ndk
396     # Set up a lot of pre-canned defaults
398     if test ! -f $ANDROID_NDK_HOME/RELEASE.TXT; then
399         if test ! -f $ANDROID_NDK_HOME/source.properties; then
400             AC_MSG_ERROR([Unrecognized Android NDK. Missing RELEASE.TXT or source.properties file in $ANDROID_NDK_HOME.])
401         fi
402         ANDROID_NDK_VERSION=`sed -n -e 's/Pkg.Revision = //p' $ANDROID_NDK_HOME/source.properties`
403     else
404         ANDROID_NDK_VERSION=`cut -f1 -d' ' <$ANDROID_NDK_HOME/RELEASE.TXT`
405     fi
406     if test -z "$ANDROID_NDK_VERSION";  then
407         AC_MSG_ERROR([Failed to determine Android NDK version. Please check your installation.])
408     fi
409     case $ANDROID_NDK_VERSION in
410     r9*|r10*)
411         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
412         ;;
413     11.1.*|12.1.*|13.1.*|14.1.*)
414         AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
415         ;;
416     16.*|17.*|18.*|19.*|20.*)
417         ;;
418     *)
419         AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk.])
420         add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk."
421         ;;
422     esac
424     ANDROID_API_LEVEL=16
425     android_cpu=$host_cpu
426     if test $host_cpu = arm; then
427         android_platform_prefix=arm-linux-androideabi
428         android_gnu_prefix=$android_platform_prefix
429         LLVM_TRIPLE=armv7a-linux-androideabi
430         ANDROID_APP_ABI=armeabi-v7a
431         ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
432     elif test $host_cpu = aarch64; then
433         android_platform_prefix=aarch64-linux-android
434         android_gnu_prefix=$android_platform_prefix
435         LLVM_TRIPLE=$android_platform_prefix
436         # minimum android version that supports aarch64
437         ANDROID_API_LEVEL=21
438         ANDROID_APP_ABI=arm64-v8a
439     else
440         # host_cpu is something like "i386" or "i686" I guess, NDK uses
441         # "x86" in some contexts
442         android_cpu=x86
443         android_platform_prefix=$android_cpu
444         android_gnu_prefix=i686-linux-android
445         LLVM_TRIPLE=$android_gnu_prefix
446         ANDROID_APP_ABI=x86
447     fi
449     case "$with_android_ndk_toolchain_version" in
450     clang5.0)
451         ANDROID_GCC_TOOLCHAIN_VERSION=4.9
452         ;;
453     *)
454         AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
455     esac
457     # NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
458     # linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
459     # manage to link the (app-specific) single huge .so that is built for the app in
460     # android/source/ if there is debug information in a significant part of the object files.
461     # (A 64-bit ld.gold grows too much over 10 gigabytes of virtual space when linking such a .so if
462     # all objects have been built with debug information.)
463     case $build_os in
464     linux-gnu*)
465         android_HOST_TAG=linux-x86_64
466         ;;
467     darwin*)
468         android_HOST_TAG=darwin-x86_64
469         ;;
470     *)
471         AC_MSG_ERROR([We only support building for Android from Linux or macOS])
472         # ndk would also support windows and windows-x86_64
473         ;;
474     esac
475     android_TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$android_HOST_TAG
476     ANDROID_COMPILER_BIN=$android_TOOLCHAIN/bin
477     dnl TODO: NSS build uses it...
478     ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION/prebuilt/$android_HOST_TAG
479     AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
481     test -z "$AR" && AR=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ar
482     test -z "$NM" && NM=$ANDROID_COMPILER_BIN/$android_gnu_prefix-nm
483     test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-objdump
484     test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ranlib
485     test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-strip
487     ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
488     ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
489     if test "$ENABLE_LTO" = TRUE; then
490         # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
491         # $CC and $CXX when building external libraries
492         ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
493     fi
495     ANDROIDCXXFLAGS="$ANDROIDCFLAGS -stdlib=libc++"
497     if test -z "$CC"; then
498         CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
499         CC_BASE="clang"
500     fi
501     if test -z "$CXX"; then
502         CXX="$ANDROID_COMPILER_BIN/clang++ $ANDROIDCXXFLAGS"
503         CXX_BASE="clang++"
504     fi
506     # remember to download the ownCloud Android library later
507     BUILD_TYPE="$BUILD_TYPE OWNCLOUD_ANDROID_LIB"
509 AC_SUBST(ANDROID_NDK_HOME)
510 AC_SUBST(ANDROID_APP_ABI)
511 AC_SUBST(ANDROID_GCC_TOOLCHAIN_VERSION)
513 dnl ===================================================================
514 dnl --with-android-sdk
515 dnl ===================================================================
516 ANDROID_SDK_HOME=
517 if test -z "$with_android_sdk" -a -e "$SRC_ROOT/external/android-sdk-linux" -a "$build" != "$host"; then
518     with_android_sdk="$SRC_ROOT/external/android-sdk-linux"
520 if test -n "$with_android_sdk"; then
521     ANDROID_SDK_HOME=$with_android_sdk
522     PATH="$ANDROID_SDK_HOME/platform-tools:$ANDROID_SDK_HOME/tools:$PATH"
524 AC_SUBST(ANDROID_SDK_HOME)
526 libo_FUZZ_ARG_ENABLE([android-editing],
527     AS_HELP_STRING([--enable-android-editing],
528         [Enable the experimental editing feature on Android.])
530 ENABLE_ANDROID_EDITING=
531 if test "$enable_android_editing" = yes; then
532     ENABLE_ANDROID_EDITING=TRUE
534 AC_SUBST([ENABLE_ANDROID_EDITING])
536 dnl ===================================================================
537 dnl The following is a list of supported systems.
538 dnl Sequential to keep the logic very simple
539 dnl These values may be checked and reset later.
540 dnl ===================================================================
541 #defaults unless the os test overrides this:
542 test_randr=yes
543 test_xrender=yes
544 test_cups=yes
545 test_dbus=yes
546 test_fontconfig=yes
547 test_cairo=no
548 test_gdb_index=no
549 test_split_debug=no
551 # Default values, as such probably valid just for Linux, set
552 # differently below just for Mac OSX, but at least better than
553 # hardcoding these as we used to do. Much of this is duplicated also
554 # in solenv for old build system and for gbuild, ideally we should
555 # perhaps define stuff like this only here in configure.ac?
557 LINKFLAGSSHL="-shared"
558 PICSWITCH="-fpic"
559 DLLPOST=".so"
561 LINKFLAGSNOUNDEFS="-Wl,-z,defs"
563 INSTROOTBASESUFFIX=
564 INSTROOTCONTENTSUFFIX=
565 SDKDIRNAME=sdk
567 case "$host_os" in
569 solaris*)
570     test_gtk=yes
571     build_gstreamer_1_0=yes
572     test_freetype=yes
573     _os=SunOS
575     dnl ===========================================================
576     dnl Check whether we're using Solaris 10 - SPARC or Intel.
577     dnl ===========================================================
578     AC_MSG_CHECKING([the Solaris operating system release])
579     _os_release=`echo $host_os | $SED -e s/solaris2\.//`
580     if test "$_os_release" -lt "10"; then
581         AC_MSG_ERROR([use Solaris >= 10 to build LibreOffice])
582     else
583         AC_MSG_RESULT([ok ($_os_release)])
584     fi
586     dnl Check whether we're using a SPARC or i386 processor
587     AC_MSG_CHECKING([the processor type])
588     if test "$host_cpu" = "sparc" -o "$host_cpu" = "i386"; then
589         AC_MSG_RESULT([ok ($host_cpu)])
590     else
591         AC_MSG_ERROR([only SPARC and i386 processors are supported])
592     fi
593     ;;
595 linux-gnu*|k*bsd*-gnu*)
596     test_gtk=yes
597     build_gstreamer_1_0=yes
598     test_kf5=yes
599     test_gtk3_kde5=yes
600     test_gdb_index=yes
601     test_split_debug=yes
602     if test "$enable_fuzzers" != yes; then
603         test_freetype=yes
604         test_fontconfig=yes
605     else
606         test_freetype=no
607         test_fontconfig=no
608         BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
609     fi
610     _os=Linux
611     ;;
613 gnu)
614     test_randr=no
615     test_xrender=no
616     _os=GNU
617      ;;
619 cygwin*|interix*)
621     # When building on Windows normally with MSVC under Cygwin,
622     # configure thinks that the host platform (the platform the
623     # built code will run on) is Cygwin, even if it obviously is
624     # Windows, which in Autoconf terminology is called
625     # "mingw32". (Which is misleading as MinGW is the name of the
626     # tool-chain, not an operating system.)
628     # Somewhat confusing, yes. But this configure script doesn't
629     # look at $host etc that much, it mostly uses its own $_os
630     # variable, set here in this case statement.
632     test_cups=no
633     test_dbus=no
634     test_randr=no
635     test_xrender=no
636     test_freetype=no
637     test_fontconfig=no
638     _os=WINNT
640     DLLPOST=".dll"
641     LINKFLAGSNOUNDEFS=
642     ;;
644 darwin*) # macOS or iOS
645     test_gtk=yes
646     test_randr=no
647     test_xrender=no
648     test_freetype=no
649     test_fontconfig=no
650     test_dbus=no
651     if test -n "$LODE_HOME" ; then
652         mac_sanitize_path
653         AC_MSG_NOTICE([sanitized the PATH to $PATH])
654     fi
655     if test "$host_cpu" = "arm64" -o "$enable_ios_simulator" = "yes"; then
656         build_for_ios=YES
657         _os=iOS
658         test_gtk=no
659         test_cups=no
660         enable_mpl_subset=yes
661         enable_lotuswordpro=no
662         enable_coinmp=no
663         enable_lpsolve=no
664         enable_postgresql_sdbc=no
665         enable_extension_integration=no
666         enable_report_builder=no
667         with_ppds=no
668         if test "$enable_ios_simulator" = "yes"; then
669             host=x86_64-apple-darwin
670         fi
671     else
672         _os=Darwin
673         INSTROOTBASESUFFIX=/$PRODUCTNAME_WITHOUT_SPACES.app
674         INSTROOTCONTENTSUFFIX=/Contents
675         SDKDIRNAME=AC_PACKAGE_NAME${PRODUCTVERSION}_SDK
676     fi
677     # See comment above the case "$host_os"
678     LINKFLAGSSHL="-dynamiclib -single_module"
680     # -fPIC is default
681     PICSWITCH=""
683     DLLPOST=".dylib"
685     # -undefined error is the default
686     LINKFLAGSNOUNDEFS=""
689 freebsd*)
690     test_gtk=yes
691     build_gstreamer_1_0=yes
692     test_kf5=yes
693     test_gtk3_kde5=yes
694     test_freetype=yes
695     AC_MSG_CHECKING([the FreeBSD operating system release])
696     if test -n "$with_os_version"; then
697         OSVERSION="$with_os_version"
698     else
699         OSVERSION=`/sbin/sysctl -n kern.osreldate`
700     fi
701     AC_MSG_RESULT([found OSVERSION=$OSVERSION])
702     AC_MSG_CHECKING([which thread library to use])
703     if test "$OSVERSION" -lt "500016"; then
704         PTHREAD_CFLAGS="-D_THREAD_SAFE"
705         PTHREAD_LIBS="-pthread"
706     elif test "$OSVERSION" -lt "502102"; then
707         PTHREAD_CFLAGS="-D_THREAD_SAFE"
708         PTHREAD_LIBS="-lc_r"
709     else
710         PTHREAD_CFLAGS=""
711         PTHREAD_LIBS="-pthread"
712     fi
713     AC_MSG_RESULT([$PTHREAD_LIBS])
714     _os=FreeBSD
715     ;;
717 *netbsd*)
718     test_gtk=yes
719     build_gstreamer_1_0=yes
720     test_kf5=yes
721     test_gtk3_kde5=yes
722     test_freetype=yes
723     PTHREAD_LIBS="-pthread -lpthread"
724     _os=NetBSD
725     ;;
727 aix*)
728     test_randr=no
729     test_freetype=yes
730     PTHREAD_LIBS=-pthread
731     _os=AIX
732     ;;
734 openbsd*)
735     test_gtk=yes
736     test_freetype=yes
737     PTHREAD_CFLAGS="-D_THREAD_SAFE"
738     PTHREAD_LIBS="-pthread"
739     _os=OpenBSD
740     ;;
742 dragonfly*)
743     test_gtk=yes
744     build_gstreamer_1_0=yes
745     test_kf5=yes
746     test_gtk3_kde5=yes
747     test_freetype=yes
748     PTHREAD_LIBS="-pthread"
749     _os=DragonFly
750     ;;
752 linux-android*)
753     build_gstreamer_1_0=no
754     enable_lotuswordpro=no
755     enable_mpl_subset=yes
756     enable_coinmp=yes
757     enable_lpsolve=no
758     enable_report_builder=no
759     enable_odk=no
760     enable_postgresql_sdbc=no
761     enable_python=no
762     test_cups=no
763     test_dbus=no
764     test_fontconfig=no
765     test_freetype=no
766     test_gtk=no
767     test_kf5=no
768     test_qt5=no
769     test_gtk3_kde5=no
770     test_randr=no
771     test_xrender=no
772     _os=Android
774     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
775     BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
776     ;;
778 haiku*)
779     test_cups=no
780     test_dbus=no
781     test_randr=no
782     test_xrender=no
783     test_freetype=yes
784     enable_odk=no
785     enable_gstreamer_1_0=no
786     enable_vlc=no
787     enable_coinmp=no
788     enable_pdfium=no
789     enable_sdremote=no
790     enable_postgresql_sdbc=no
791     enable_firebird_sdbc=no
792     _os=Haiku
793     ;;
796     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
797     ;;
798 esac
800 if test "$_os" = "Android" ; then
801     # Verify that the NDK and SDK options are proper
802     if test -z "$with_android_ndk"; then
803         AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
804     elif test ! -f "$ANDROID_NDK_HOME/meta/abis.json"; then
805         AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
806     fi
808     if test -z "$ANDROID_SDK_HOME"; then
809         AC_MSG_ERROR([the --with-android-sdk option is mandatory, unless it is available at external/android-sdk-linux/.])
810     elif test ! -d "$ANDROID_SDK_HOME/platforms"; then
811         AC_MSG_ERROR([the --with-android-sdk option does not point to an Android SDK])
812     fi
814     BUILD_TOOLS_VERSION=`$SED -n -e 's/.*buildToolsVersion "\(.*\)"/\1/p' $SRC_ROOT/android/source/build.gradle`
815     if test ! -d "$ANDROID_SDK_HOME/build-tools/$BUILD_TOOLS_VERSION"; then
816         AC_MSG_WARN([android build-tools $BUILD_TOOLS_VERSION not found - install with
817                          $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION
818                     or adjust change $SRC_ROOT/android/source/build.gradle accordingly])
819         add_warning "android build-tools $BUILD_TOOLS_VERSION not found - install with"
820         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --all --filter build-tools-$BUILD_TOOLS_VERSION"
821         add_warning "or adjust $SRC_ROOT/android/source/build.gradle accordingly"
822     fi
823     if test ! -f "$ANDROID_SDK_HOME/extras/android/m2repository/source.properties"; then
824         AC_MSG_WARN([android support repository not found - install with
825                          $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository
826                      to allow the build to download the specified version of the android support libraries])
827         add_warning "android support repository not found - install with"
828         add_warning "    $ANDROID_SDK_HOME/tools/android update sdk -u --filter extra-android-m2repository"
829         add_warning "to allow the build to download the specified version of the android support libraries"
830     fi
833 if test "$_os" = "AIX"; then
834     AC_PATH_PROG(GAWK, gawk)
835     if test -z "$GAWK"; then
836         AC_MSG_ERROR([gawk not found in \$PATH])
837     fi
840 AC_SUBST(SDKDIRNAME)
842 AC_SUBST(PTHREAD_CFLAGS)
843 AC_SUBST(PTHREAD_LIBS)
845 # Check for explicit A/C/CXX/OBJC/OBJCXX/LDFLAGS.
846 # By default use the ones specified by our build system,
847 # but explicit override is possible.
848 AC_MSG_CHECKING(for explicit AFLAGS)
849 if test -n "$AFLAGS"; then
850     AC_MSG_RESULT([$AFLAGS])
851     x_AFLAGS=
852 else
853     AC_MSG_RESULT(no)
854     x_AFLAGS=[\#]
856 AC_MSG_CHECKING(for explicit CFLAGS)
857 if test -n "$CFLAGS"; then
858     AC_MSG_RESULT([$CFLAGS])
859     x_CFLAGS=
860 else
861     AC_MSG_RESULT(no)
862     x_CFLAGS=[\#]
864 AC_MSG_CHECKING(for explicit CXXFLAGS)
865 if test -n "$CXXFLAGS"; then
866     AC_MSG_RESULT([$CXXFLAGS])
867     x_CXXFLAGS=
868 else
869     AC_MSG_RESULT(no)
870     x_CXXFLAGS=[\#]
872 AC_MSG_CHECKING(for explicit OBJCFLAGS)
873 if test -n "$OBJCFLAGS"; then
874     AC_MSG_RESULT([$OBJCFLAGS])
875     x_OBJCFLAGS=
876 else
877     AC_MSG_RESULT(no)
878     x_OBJCFLAGS=[\#]
880 AC_MSG_CHECKING(for explicit OBJCXXFLAGS)
881 if test -n "$OBJCXXFLAGS"; then
882     AC_MSG_RESULT([$OBJCXXFLAGS])
883     x_OBJCXXFLAGS=
884 else
885     AC_MSG_RESULT(no)
886     x_OBJCXXFLAGS=[\#]
888 AC_MSG_CHECKING(for explicit LDFLAGS)
889 if test -n "$LDFLAGS"; then
890     AC_MSG_RESULT([$LDFLAGS])
891     x_LDFLAGS=
892 else
893     AC_MSG_RESULT(no)
894     x_LDFLAGS=[\#]
896 AC_SUBST(AFLAGS)
897 AC_SUBST(CFLAGS)
898 AC_SUBST(CXXFLAGS)
899 AC_SUBST(OBJCFLAGS)
900 AC_SUBST(OBJCXXFLAGS)
901 AC_SUBST(LDFLAGS)
902 AC_SUBST(x_AFLAGS)
903 AC_SUBST(x_CFLAGS)
904 AC_SUBST(x_CXXFLAGS)
905 AC_SUBST(x_OBJCFLAGS)
906 AC_SUBST(x_OBJCXXFLAGS)
907 AC_SUBST(x_LDFLAGS)
909 dnl These are potentially set for MSVC, in the code checking for UCRT below:
910 my_original_CFLAGS=$CFLAGS
911 my_original_CXXFLAGS=$CXXFLAGS
912 my_original_CPPFLAGS=$CPPFLAGS
914 dnl The following checks for gcc, cc and then cl (if it weren't guarded for win32)
915 dnl Needs to precede the AC_C_BIGENDIAN and AC_SEARCH_LIBS calls below, which apparently call
916 dnl AC_PROG_CC internally.
917 if test "$_os" != "WINNT"; then
918     # AC_PROG_CC sets CFLAGS to -g -O2 if not set, avoid that
919     save_CFLAGS=$CFLAGS
920     AC_PROG_CC
921     CFLAGS=$save_CFLAGS
922     if test -z "$CC_BASE"; then
923         CC_BASE=`first_arg_basename "$CC"`
924     fi
927 if test "$_os" != "WINNT"; then
928     AC_C_BIGENDIAN([ENDIANNESS=big], [ENDIANNESS=little])
929 else
930     ENDIANNESS=little
932 AC_SUBST(ENDIANNESS)
934 if test $_os != "WINNT"; then
935     save_LIBS="$LIBS"
936     AC_SEARCH_LIBS([dlsym], [dl],
937         [case "$ac_cv_search_dlsym" in -l*) DLOPEN_LIBS="$ac_cv_search_dlsym";; esac],
938         [AC_MSG_ERROR([dlsym not found in either libc nor libdl])])
939     LIBS="$save_LIBS"
941 AC_SUBST(DLOPEN_LIBS)
943 AC_ARG_ENABLE(ios-simulator,
944     AS_HELP_STRING([--enable-ios-simulator],
945         [build i386 or x86_64 for ios simulator])
948 AC_ARG_ENABLE(ios-libreofficelight-app,
949     AS_HELP_STRING([--enable-ios-libreofficelight-app],
950         [When building for iOS, build stuff relevant only for the 'LibreOfficeLight' app
951          (in ios/LibreOfficeLight). Note that this app is not known to work in any useful manner,
952          and also that its actual build (in Xcode) requires some obvious modifications to the project.])
955 ENABLE_IOS_LIBREOFFICELIGHT_APP=
956 if test "$enable_ios_libreofficelight_app" = yes; then
957     ENABLE_IOS_LIBREOFFICELIGHT_APP=TRUE
959 AC_SUBST(ENABLE_IOS_LIBREOFFICELIGHT_APP)
961 ###############################################################################
962 # Extensions switches --enable/--disable
963 ###############################################################################
964 # By default these should be enabled unless having extra dependencies.
965 # If there is extra dependency over configure options then the enable should
966 # be automagic based on whether the requiring feature is enabled or not.
967 # All this options change anything only with --enable-extension-integration.
969 # The name of this option and its help string makes it sound as if
970 # extensions are built anyway, just not integrated in the installer,
971 # if you use --disable-extension-integration. Is that really the
972 # case?
974 libo_FUZZ_ARG_ENABLE(extension-integration,
975     AS_HELP_STRING([--disable-extension-integration],
976         [Disable integration of the built extensions in the installer of the
977          product. Use this switch to disable the integration.])
980 AC_ARG_ENABLE(avmedia,
981     AS_HELP_STRING([--disable-avmedia],
982         [Disable displaying and inserting AV media in documents. Work in progress, use only if you are hacking on it.])
985 AC_ARG_ENABLE(database-connectivity,
986     AS_HELP_STRING([--disable-database-connectivity],
987         [Disable various database connectivity. Work in progress, use only if you are hacking on it.])
990 # This doesn't mean not building (or "integrating") extensions
991 # (although it probably should; i.e. it should imply
992 # --disable-extension-integration I guess), it means not supporting
993 # any extension mechanism at all
994 libo_FUZZ_ARG_ENABLE(extensions,
995     AS_HELP_STRING([--disable-extensions],
996         [Disable all add-on extension functionality. Work in progress, use only if you are hacking on it.])
999 AC_ARG_ENABLE(scripting,
1000     AS_HELP_STRING([--disable-scripting],
1001         [Disable BASIC, Java and Python. Work in progress, use only if you are hacking on it.])
1004 # This is mainly for Android and iOS, but could potentially be used in some
1005 # special case otherwise, too, so factored out as a separate setting
1007 AC_ARG_ENABLE(dynamic-loading,
1008     AS_HELP_STRING([--disable-dynamic-loading],
1009         [Disable any use of dynamic loading of code. Work in progress, use only if you are hacking on it.])
1012 libo_FUZZ_ARG_ENABLE(report-builder,
1013     AS_HELP_STRING([--disable-report-builder],
1014         [Disable the Report Builder.])
1017 libo_FUZZ_ARG_ENABLE(ext-wiki-publisher,
1018     AS_HELP_STRING([--enable-ext-wiki-publisher],
1019         [Enable the Wiki Publisher extension.])
1022 libo_FUZZ_ARG_ENABLE(lpsolve,
1023     AS_HELP_STRING([--disable-lpsolve],
1024         [Disable compilation of the lp solve solver ])
1026 libo_FUZZ_ARG_ENABLE(coinmp,
1027     AS_HELP_STRING([--disable-coinmp],
1028         [Disable compilation of the CoinMP solver ])
1031 libo_FUZZ_ARG_ENABLE(pdfimport,
1032     AS_HELP_STRING([--disable-pdfimport],
1033         [Disable building the PDF import feature.])
1036 libo_FUZZ_ARG_ENABLE(pdfium,
1037     AS_HELP_STRING([--disable-pdfium],
1038         [Disable building PDFium.])
1041 ###############################################################################
1043 dnl ---------- *** ----------
1045 libo_FUZZ_ARG_ENABLE(mergelibs,
1046     AS_HELP_STRING([--enable-mergelibs],
1047         [Merge several of the smaller libraries into one big, "merged", one.])
1050 libo_FUZZ_ARG_ENABLE(breakpad,
1051     AS_HELP_STRING([--enable-breakpad],
1052         [Enables breakpad for crash reporting.])
1055 AC_ARG_ENABLE(fetch-external,
1056     AS_HELP_STRING([--disable-fetch-external],
1057         [Disables fetching external tarballs from web sources.])
1060 AC_ARG_ENABLE(fuzzers,
1061     AS_HELP_STRING([--enable-fuzzers],
1062         [Enables building libfuzzer targets for fuzz testing.])
1065 libo_FUZZ_ARG_ENABLE(pch,
1066     AS_HELP_STRING([--enable-pch=<yes/no/system/base/normal/full>],
1067         [Enables precompiled header support for C++. Forced default on Windows/VC build.
1068          Using 'system' will include only external headers, 'base' will add also headers
1069          from base modules, 'normal' will also add all headers except from the module built,
1070          'full' will use all suitable headers even from a module itself.])
1073 libo_FUZZ_ARG_ENABLE(epm,
1074     AS_HELP_STRING([--enable-epm],
1075         [LibreOffice includes self-packaging code, that requires epm, however epm is
1076          useless for large scale package building.])
1079 libo_FUZZ_ARG_ENABLE(odk,
1080     AS_HELP_STRING([--disable-odk],
1081         [LibreOffice includes an ODK, office development kit which some packagers may
1082          wish to build without.])
1085 AC_ARG_ENABLE(mpl-subset,
1086     AS_HELP_STRING([--enable-mpl-subset],
1087         [Don't compile any pieces which are not MPL or more liberally licensed])
1090 libo_FUZZ_ARG_ENABLE(evolution2,
1091     AS_HELP_STRING([--enable-evolution2],
1092         [Allows the built-in evolution 2 addressbook connectivity build to be
1093          enabled.])
1096 AC_ARG_ENABLE(avahi,
1097     AS_HELP_STRING([--enable-avahi],
1098         [Determines whether to use Avahi to advertise Impress to remote controls.])
1101 libo_FUZZ_ARG_ENABLE(werror,
1102     AS_HELP_STRING([--enable-werror],
1103         [Turn warnings to errors. (Has no effect in modules where the treating
1104          of warnings as errors is disabled explicitly.)]),
1107 libo_FUZZ_ARG_ENABLE(assert-always-abort,
1108     AS_HELP_STRING([--enable-assert-always-abort],
1109         [make assert() failures abort even when building without --enable-debug or --enable-dbgutil.]),
1112 libo_FUZZ_ARG_ENABLE(dbgutil,
1113     AS_HELP_STRING([--enable-dbgutil],
1114         [Provide debugging support from --enable-debug and include additional debugging
1115          utilities such as object counting or more expensive checks.
1116          This is the recommended option for developers.
1117          Note that this makes the build ABI incompatible, it is not possible to mix object
1118          files or libraries from a --enable-dbgutil and a --disable-dbgutil build.]))
1120 libo_FUZZ_ARG_ENABLE(debug,
1121     AS_HELP_STRING([--enable-debug],
1122         [Include debugging information, disable compiler optimization and inlining plus
1123          extra debugging code like assertions. Extra large build! (enables -g compiler flag).]))
1125 libo_FUZZ_ARG_ENABLE(split-debug,
1126     AS_HELP_STRING([--disable-split-debug],
1127         [Disable using split debug information (-gsplit-dwarf compile flag). Split debug information
1128          saves disk space and build time, but requires tools that support it (both build tools and debuggers).]))
1130 libo_FUZZ_ARG_ENABLE(gdb-index,
1131     AS_HELP_STRING([--disable-gdb-index],
1132         [Disables creating debug information in the gdb index format, which makes gdb start faster.
1133          The feature requires the gold or lld linker.]))
1135 libo_FUZZ_ARG_ENABLE(sal-log,
1136     AS_HELP_STRING([--enable-sal-log],
1137         [Make SAL_INFO and SAL_WARN calls do something even in a non-debug build.]))
1139 libo_FUZZ_ARG_ENABLE(symbols,
1140     AS_HELP_STRING([--enable-symbols],
1141         [Generate debug information.
1142          By default, enabled for --enable-debug and --enable-dbgutil, disabled
1143          otherwise. It is possible to explicitly specify gbuild build targets
1144          (where 'all' means everything, '-' prepended means to not enable, '/' appended means
1145          everything in the directory; there is no ordering, more specific overrides
1146          more general, and disabling takes precedence).
1147          Example: --enable-symbols="all -sw/ -Library_sc".]))
1149 libo_FUZZ_ARG_ENABLE(optimized,
1150     AS_HELP_STRING([--disable-optimized],
1151         [Whether to compile with optimization flags.
1152          By default, disabled for --enable-debug and --enable-dbgutil, enabled
1153          otherwise.]))
1155 libo_FUZZ_ARG_ENABLE(runtime-optimizations,
1156     AS_HELP_STRING([--disable-runtime-optimizations],
1157         [Statically disable certain runtime optimizations (like rtl/alloc.h or
1158          JVM JIT) that are known to interact badly with certain dynamic analysis
1159          tools (like -fsanitize=address or Valgrind).  By default, disabled iff
1160          CC contains "-fsanitize=*".  (For Valgrind, those runtime optimizations
1161          are typically disabled dynamically via RUNNING_ON_VALGRIND.)]))
1163 AC_ARG_WITH(valgrind,
1164     AS_HELP_STRING([--with-valgrind],
1165         [Make availability of Valgrind headers a hard requirement.]))
1167 libo_FUZZ_ARG_ENABLE(compiler-plugins,
1168     AS_HELP_STRING([--enable-compiler-plugins],
1169         [Enable compiler plugins that will perform additional checks during
1170          building. Enabled automatically by --enable-dbgutil.
1171          Use --enable-compiler-plugins=debug to also enable debug code in the plugins.]))
1172 COMPILER_PLUGINS_DEBUG=
1173 if test "$enable_compiler_plugins" = debug; then
1174     enable_compiler_plugins=yes
1175     COMPILER_PLUGINS_DEBUG=TRUE
1178 libo_FUZZ_ARG_ENABLE(ooenv,
1179     AS_HELP_STRING([--disable-ooenv],
1180         [Disable ooenv for the instdir installation.]))
1182 libo_FUZZ_ARG_ENABLE(libnumbertext,
1183     AS_HELP_STRING([--disable-libnumbertext],
1184         [Disable use of numbertext external library.]))
1186 AC_ARG_ENABLE(lto,
1187     AS_HELP_STRING([--enable-lto],
1188         [Enable link-time optimization. Suitable for (optimised) product builds. Building might take
1189          longer but libraries and executables are optimized for speed. For GCC, best to use the 'gold'
1190          linker. For MSVC, this option is broken at the moment. This is experimental work
1191          in progress that shouldn't be used unless you are working on it.)]))
1193 AC_ARG_ENABLE(python,
1194     AS_HELP_STRING([--enable-python=<no/auto/system/internal/fully-internal>],
1195         [Enables or disables Python support at run-time.
1196          Also specifies what Python to use. 'auto' is the default.
1197          'fully-internal' even forces the internal version for uses of Python
1198          during the build.]))
1200 libo_FUZZ_ARG_ENABLE(gtk,
1201     AS_HELP_STRING([--disable-gtk],
1202         [Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
1203 ,test "${enable_gtk+set}" = set || enable_gtk=yes)
1205 libo_FUZZ_ARG_ENABLE(gtk3,
1206     AS_HELP_STRING([--disable-gtk3],
1207         [Determines whether to use Gtk+ 3.0 vclplug on platforms where Gtk+ 3.0 is available.]),
1208 ,test "${enable_gtk3+set}" = set || enable_gtk3=yes)
1210 AC_ARG_ENABLE(introspection,
1211     AS_HELP_STRING([--enable-introspection],
1212         [Generate files for GObject introspection.  Requires --enable-gtk3.  (Typically used by
1213          Linux distributions.)]))
1215 AC_ARG_ENABLE(split-app-modules,
1216     AS_HELP_STRING([--enable-split-app-modules],
1217         [Split file lists for app modules, e.g. base, calc.
1218          Has effect only with make distro-pack-install]),
1221 AC_ARG_ENABLE(split-opt-features,
1222     AS_HELP_STRING([--enable-split-opt-features],
1223         [Split file lists for some optional features, e.g. pyuno, testtool.
1224          Has effect only with make distro-pack-install]),
1227 libo_FUZZ_ARG_ENABLE(cairo-canvas,
1228     AS_HELP_STRING([--disable-cairo-canvas],
1229         [Determines whether to build the Cairo canvas on platforms where Cairo is available.]),
1232 libo_FUZZ_ARG_ENABLE(dbus,
1233     AS_HELP_STRING([--disable-dbus],
1234         [Determines whether to enable features that depend on dbus.
1235          e.g. Presentation mode screensaver control, bluetooth presentation control, automatic font install]),
1236 ,test "${enable_dbus+set}" = set || enable_dbus=yes)
1238 libo_FUZZ_ARG_ENABLE(sdremote,
1239     AS_HELP_STRING([--disable-sdremote],
1240         [Determines whether to enable Impress remote control (i.e. the server component).]),
1241 ,test "${enable_sdremote+set}" = set || enable_sdremote=yes)
1243 libo_FUZZ_ARG_ENABLE(sdremote-bluetooth,
1244     AS_HELP_STRING([--disable-sdremote-bluetooth],
1245         [Determines whether to build sdremote with bluetooth support.
1246          Requires dbus on Linux.]))
1248 libo_FUZZ_ARG_ENABLE(gio,
1249     AS_HELP_STRING([--disable-gio],
1250         [Determines whether to use the GIO support.]),
1251 ,test "${enable_gio+set}" = set || enable_gio=yes)
1253 AC_ARG_ENABLE(qt5,
1254     AS_HELP_STRING([--enable-qt5],
1255         [Determines whether to use Qt5 vclplug on platforms where Qt5 is
1256          available.]),
1259 AC_ARG_ENABLE(kf5,
1260     AS_HELP_STRING([--enable-kf5],
1261         [Determines whether to use Qt5/KF5 vclplug on platforms where Qt5 and
1262          KF5 are available.]),
1265 AC_ARG_ENABLE(kde5,
1266     AS_HELP_STRING([--enable-kde5],
1267         [Compatibility switch for the kde5 => kf5 rename. Use --enable-kf5!])
1270 AC_ARG_ENABLE(gtk3_kde5,
1271     AS_HELP_STRING([--enable-gtk3-kde5],
1272         [Determines whether to use Gtk3 vclplug with KF5 file dialogs on
1273          platforms where Gtk3, Qt5 and Plasma is available.]),
1276 AC_ARG_ENABLE(gui,
1277     AS_HELP_STRING([--disable-gui],
1278         [Disable use of X11 or Wayland to reduce dependencies. Not related to the --headless
1279          command-line option. Not related to LibreOffice Online functionality. Don't use
1280          unless you are certain you need to. Nobody will help you if you insist on trying
1281          this and run into problems.]),
1282 ,enable_gui=yes)
1284 libo_FUZZ_ARG_ENABLE(randr,
1285     AS_HELP_STRING([--disable-randr],
1286         [Disable RandR support in the vcl project.]),
1287 ,test "${enable_randr+set}" = set || enable_randr=yes)
1289 libo_FUZZ_ARG_ENABLE(gstreamer-1-0,
1290     AS_HELP_STRING([--disable-gstreamer-1-0],
1291         [Disable building with the gstreamer 1.0 avmedia backend.]),
1292 ,test "${enable_gstreamer_1_0+set}" = set || enable_gstreamer_1_0=yes)
1294 libo_FUZZ_ARG_ENABLE(vlc,
1295     AS_HELP_STRING([--enable-vlc],
1296         [Enable building with the (experimental) VLC avmedia backend.]),
1297 ,test "${enable_vlc+set}" = set || enable_vlc=no)
1299 libo_FUZZ_ARG_ENABLE(neon,
1300     AS_HELP_STRING([--disable-neon],
1301         [Disable neon and the compilation of webdav binding.]),
1304 libo_FUZZ_ARG_ENABLE([eot],
1305     [AS_HELP_STRING([--enable-eot],
1306         [Enable support for Embedded OpenType fonts.])],
1307 ,test "${enable_eot+set}" = set || enable_eot=no)
1309 libo_FUZZ_ARG_ENABLE(cve-tests,
1310     AS_HELP_STRING([--disable-cve-tests],
1311         [Prevent CVE tests to be executed]),
1314 libo_FUZZ_ARG_ENABLE(chart-tests,
1315     AS_HELP_STRING([--enable-chart-tests],
1316         [Executes chart XShape tests. In a perfect world these tests would be
1317          stable and everyone could run them, in reality it is best to run them
1318          only on a few machines that are known to work and maintained by people
1319          who can judge if a test failure is a regression or not.]),
1322 AC_ARG_ENABLE(build-unowinreg,
1323     AS_HELP_STRING([--enable-build-unowinreg],
1324         [Do not use the prebuilt unowinreg.dll. Build it instead. The MinGW C++
1325          compiler is needed on Linux.]),
1328 AC_ARG_ENABLE(build-opensymbol,
1329     AS_HELP_STRING([--enable-build-opensymbol],
1330         [Do not use the prebuilt opens___.ttf. Build it instead. This needs
1331          fontforge installed.]),
1334 AC_ARG_ENABLE(dependency-tracking,
1335     AS_HELP_STRING([--enable-dependency-tracking],
1336         [Do not reject slow dependency extractors.])[
1337   --disable-dependency-tracking
1338                           Disables generation of dependency information.
1339                           Speed up one-time builds.],
1342 AC_ARG_ENABLE(icecream,
1343     AS_HELP_STRING([--enable-icecream],
1344         [Use the 'icecream' distributed compiling tool to speedup the compilation.
1345          It defaults to /opt/icecream for the location of the icecream gcc/g++
1346          wrappers, you can override that using --with-gcc-home=/the/path switch.]),
1349 AC_ARG_ENABLE(ld,
1350     AS_HELP_STRING([--enable-ld=<linker>],
1351         [Use the specified linker. Both 'gold' and 'lld' linkers generally use less memory and link faster.
1352          By default tries to use the best linker possible, use --disable-ld to use the default linker.]),
1355 libo_FUZZ_ARG_ENABLE(cups,
1356     AS_HELP_STRING([--disable-cups],
1357         [Do not build cups support.])
1360 AC_ARG_ENABLE(ccache,
1361     AS_HELP_STRING([--disable-ccache],
1362         [Do not try to use ccache automatically.
1363          By default, unless on Windows, we will try to detect if ccache is available; in that case if
1364          CC/CXX are not yet set, and --enable-icecream is not given, we
1365          attempt to use ccache. --disable-ccache disables ccache completely.
1366          Additionally ccache's depend mode is enabled if possible,
1367          use --enable-ccache=nodepend to enable ccache without depend mode.
1371 AC_ARG_ENABLE(64-bit,
1372     AS_HELP_STRING([--enable-64-bit],
1373         [Build a 64-bit LibreOffice on platforms where the normal build is 32-bit.
1374          At the moment meaningful only for Windows.]), ,)
1376 libo_FUZZ_ARG_ENABLE(online-update,
1377     AS_HELP_STRING([--enable-online-update],
1378         [Enable the online update service that will check for new versions of
1379          LibreOffice. By default, it is enabled on Windows and Mac, disabled on Linux.
1380          If the value is "mar", the experimental Mozilla-like update will be
1381          enabled instead of the traditional update mechanism.]),
1384 AC_ARG_WITH(update-config,
1385     AS_HELP_STRING([--with-update-config=/tmp/update.ini],
1386                    [Path to the update config ini file]))
1388 libo_FUZZ_ARG_ENABLE(extension-update,
1389     AS_HELP_STRING([--disable-extension-update],
1390         [Disable possibility to update installed extensions.]),
1393 libo_FUZZ_ARG_ENABLE(release-build,
1394     AS_HELP_STRING([--enable-release-build],
1395         [Enable release build. Note that the "release build" choice is orthogonal to
1396          whether symbols are present, debug info is generated, or optimization
1397          is done.
1398          See http://wiki.documentfoundation.org/Development/DevBuild]),
1401 AC_ARG_ENABLE(windows-build-signing,
1402     AS_HELP_STRING([--enable-windows-build-signing],
1403         [Enable signing of windows binaries (*.exe, *.dll)]),
1406 AC_ARG_ENABLE(silent-msi,
1407     AS_HELP_STRING([--enable-silent-msi],
1408         [Enable MSI with LIMITUI=1 (silent install).]),
1411 AC_ARG_ENABLE(macosx-code-signing,
1412     AS_HELP_STRING([--enable-macosx-code-signing=<identity>],
1413         [Sign executables, dylibs, frameworks and the app bundle. If you
1414          don't provide an identity the first suitable certificate
1415          in your keychain is used.]),
1418 AC_ARG_ENABLE(macosx-package-signing,
1419     AS_HELP_STRING([--enable-macosx-package-signing=<identity>],
1420         [Create a .pkg suitable for uploading to the Mac App Store and sign
1421          it. If you don't provide an identity the first suitable certificate
1422          in your keychain is used.]),
1425 AC_ARG_ENABLE(macosx-sandbox,
1426     AS_HELP_STRING([--enable-macosx-sandbox],
1427         [Make the app bundle run in a sandbox. Requires code signing.
1428          Is required by apps distributed in the Mac App Store, and implies
1429          adherence to App Store rules.]),
1432 AC_ARG_WITH(macosx-bundle-identifier,
1433     AS_HELP_STRING([--with-macosx-bundle-identifier=tld.mumble.orifice.TheOffice],
1434         [Define the macOS bundle identifier. Default is the somewhat weird
1435          org.libreoffice.script ("script", huh?).]),
1436 ,with_macosx_bundle_identifier=org.libreoffice.script)
1438 AC_ARG_WITH(product-name,
1439     AS_HELP_STRING([--with-product-name='My Own Office Suite'],
1440         [Define the product name. Default is AC_PACKAGE_NAME.]),
1441 ,with_product_name=$PRODUCTNAME)
1443 AC_ARG_WITH(package-version,
1444     AS_HELP_STRING([--with-package-version='3.1.4.5'],
1445         [Define the package version. Default is AC_PACKAGE_VERSION. Use only if you distribute an own build for macOS.]),
1448 libo_FUZZ_ARG_ENABLE(readonly-installset,
1449     AS_HELP_STRING([--enable-readonly-installset],
1450         [Prevents any attempts by LibreOffice to write into its installation. That means
1451          at least that no "system-wide" extensions can be added. Partly experimental work in
1452          progress, probably not fully implemented (but is useful for sandboxed macOS builds).]),
1455 libo_FUZZ_ARG_ENABLE(postgresql-sdbc,
1456     AS_HELP_STRING([--disable-postgresql-sdbc],
1457         [Disable the build of the PostgreSQL-SDBC driver.])
1460 libo_FUZZ_ARG_ENABLE(lotuswordpro,
1461     AS_HELP_STRING([--disable-lotuswordpro],
1462         [Disable the build of the Lotus Word Pro filter.]),
1463 ,test "${enable_lotuswordpro+set}" = set || enable_lotuswordpro=yes)
1465 libo_FUZZ_ARG_ENABLE(firebird-sdbc,
1466     AS_HELP_STRING([--disable-firebird-sdbc],
1467         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
1468 ,test "${enable_firebird_sdbc+set}" = set || enable_firebird_sdbc=yes)
1470 AC_ARG_ENABLE(bogus-pkg-config,
1471     AS_HELP_STRING([--enable-bogus-pkg-config],
1472         [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.]),
1475 AC_ARG_ENABLE(openssl,
1476     AS_HELP_STRING([--disable-openssl],
1477         [Disable using libssl/libcrypto from OpenSSL. If disabled,
1478          components will either use GNUTLS or NSS. Work in progress,
1479          use only if you are hacking on it.]),
1480 ,enable_openssl=yes)
1482 libo_FUZZ_ARG_ENABLE(cipher-openssl-backend,
1483     AS_HELP_STRING([--enable-cipher-openssl-backend],
1484         [Enable using OpenSSL as the actual implementation of the rtl/cipher.h functionality.
1485          Requires --enable-openssl.]))
1487 AC_ARG_ENABLE(library-bin-tar,
1488     AS_HELP_STRING([--enable-library-bin-tar],
1489         [Enable the building and reused of tarball of binary build for some 'external' libraries.
1490         Some libraries can save their build result in a tarball
1491         stored in TARFILE_LOCATION. That binary tarball is
1492         uniquely identified by the source tarball,
1493         the content of the config_host.mk file and the content
1494         of the top-level directory in core for that library
1495         If this option is enabled, then if such a tarfile exist, it will be untarred
1496         instead of the source tarfile, and the build step will be skipped for that
1497         library.
1498         If a proper tarfile does not exist, then the normal source-based
1499         build is done for that library and a proper binary tarfile is created
1500         for the next time.]),
1503 AC_ARG_ENABLE(dconf,
1504     AS_HELP_STRING([--disable-dconf],
1505         [Disable the dconf configuration backend (enabled by default where
1506          available).]))
1508 libo_FUZZ_ARG_ENABLE(formula-logger,
1509     AS_HELP_STRING(
1510         [--enable-formula-logger],
1511         [Enable formula logger for logging formula calculation flow in Calc.]
1512     )
1515 AC_ARG_ENABLE(ldap,
1516     AS_HELP_STRING([--disable-ldap],
1517         [Disable LDAP support.]),
1518 ,enable_ldap=yes)
1520 dnl ===================================================================
1521 dnl Optional Packages (--with/without-)
1522 dnl ===================================================================
1524 AC_ARG_WITH(gcc-home,
1525     AS_HELP_STRING([--with-gcc-home],
1526         [Specify the location of gcc/g++ manually. This can be used in conjunction
1527          with --enable-icecream when icecream gcc/g++ wrappers are installed in a
1528          non-default path.]),
1531 AC_ARG_WITH(gnu-patch,
1532     AS_HELP_STRING([--with-gnu-patch],
1533         [Specify location of GNU patch on Solaris or FreeBSD.]),
1536 AC_ARG_WITH(build-platform-configure-options,
1537     AS_HELP_STRING([--with-build-platform-configure-options],
1538         [Specify options for the configure script run for the *build* platform in a cross-compilation]),
1541 AC_ARG_WITH(gnu-cp,
1542     AS_HELP_STRING([--with-gnu-cp],
1543         [Specify location of GNU cp on Solaris or FreeBSD.]),
1546 AC_ARG_WITH(external-tar,
1547     AS_HELP_STRING([--with-external-tar=<TARFILE_PATH>],
1548         [Specify an absolute path of where to find (and store) tarfiles.]),
1549     TARFILE_LOCATION=$withval ,
1552 AC_ARG_WITH(referenced-git,
1553     AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
1554         [Specify another checkout directory to reference. This makes use of
1555                  git submodule update --reference, and saves a lot of diskspace
1556                  when having multiple trees side-by-side.]),
1557     GIT_REFERENCE_SRC=$withval ,
1560 AC_ARG_WITH(linked-git,
1561     AS_HELP_STRING([--with-linked-git=<submodules repo basedir>],
1562         [Specify a directory where the repositories of submodules are located.
1563          This uses a method similar to git-new-workdir to get submodules.]),
1564     GIT_LINK_SRC=$withval ,
1567 AC_ARG_WITH(galleries,
1568     AS_HELP_STRING([--with-galleries],
1569         [Specify how galleries should be built. It is possible either to
1570          build these internally from source ("build"),
1571          or to disable them ("no")]),
1574 AC_ARG_WITH(theme,
1575     AS_HELP_STRING([--with-theme="theme1 theme2..."],
1576         [Choose which themes to include. By default those themes with an '*' are included.
1577          Possible choices: *breeze, *breeze_dark, *breeze_svg, *colibre, *colibre_svg, *elementary,
1578          *elementary_svg, *karasa_jaga, *karasa_jaga_svg, *sifr, *sif_svg, *sifr_dark, *tango.]),
1581 libo_FUZZ_ARG_WITH(helppack-integration,
1582     AS_HELP_STRING([--without-helppack-integration],
1583         [It will not integrate the helppacks to the installer
1584          of the product. Please use this switch to use the online help
1585          or separate help packages.]),
1588 libo_FUZZ_ARG_WITH(fonts,
1589     AS_HELP_STRING([--without-fonts],
1590         [LibreOffice includes some third-party fonts to provide a reliable basis for
1591          help content, templates, samples, etc. When these fonts are already
1592          known to be available on the system then you should use this option.]),
1595 AC_ARG_WITH(epm,
1596     AS_HELP_STRING([--with-epm],
1597         [Decides which epm to use. Default is to use the one from the system if
1598          one is built. When either this is not there or you say =internal epm
1599          will be built.]),
1602 AC_ARG_WITH(package-format,
1603     AS_HELP_STRING([--with-package-format],
1604         [Specify package format(s) for LibreOffice installation sets. The
1605          implicit --without-package-format leads to no installation sets being
1606          generated. Possible values: aix, archive, bsd, deb, dmg,
1607          installed, msi, pkg, and rpm.
1608          Example: --with-package-format='deb rpm']),
1611 AC_ARG_WITH(tls,
1612     AS_HELP_STRING([--with-tls],
1613         [Decides which TLS/SSL and cryptographic implementations to use for
1614          LibreOffice's code. Notice that this doesn't apply for depending
1615          libraries like "neon", for example. Default is to use OpenSSL
1616          although NSS is also possible. Notice that selecting NSS restricts
1617          the usage of OpenSSL in LO's code but selecting OpenSSL doesn't
1618          restrict by now the usage of NSS in LO's code. Possible values:
1619          openssl, nss. Example: --with-tls="nss"]),
1622 AC_ARG_WITH(system-libs,
1623     AS_HELP_STRING([--with-system-libs],
1624         [Use libraries already on system -- enables all --with-system-* flags.]),
1627 AC_ARG_WITH(system-bzip2,
1628     AS_HELP_STRING([--with-system-bzip2],
1629         [Use bzip2 already on system. Used only when --enable-online-update=mar]),,
1630     [with_system_bzip2="$with_system_libs"])
1632 AC_ARG_WITH(system-headers,
1633     AS_HELP_STRING([--with-system-headers],
1634         [Use headers already on system -- enables all --with-system-* flags for
1635          external packages whose headers are the only entities used i.e.
1636          boost/odbc/sane-header(s).]),,
1637     [with_system_headers="$with_system_libs"])
1639 AC_ARG_WITH(system-jars,
1640     AS_HELP_STRING([--without-system-jars],
1641         [When building with --with-system-libs, also the needed jars are expected
1642          on the system. Use this to disable that]),,
1643     [with_system_jars="$with_system_libs"])
1645 AC_ARG_WITH(system-cairo,
1646     AS_HELP_STRING([--with-system-cairo],
1647         [Use cairo libraries already on system.  Happens automatically for
1648          (implicit) --enable-gtk and for --enable-gtk3.]))
1650 AC_ARG_WITH(system-epoxy,
1651     AS_HELP_STRING([--with-system-epoxy],
1652         [Use epoxy libraries already on system.  Happens automatically for
1653          --enable-gtk3.]),,
1654        [with_system_epoxy="$with_system_libs"])
1656 AC_ARG_WITH(myspell-dicts,
1657     AS_HELP_STRING([--with-myspell-dicts],
1658         [Adds myspell dictionaries to the LibreOffice installation set]),
1661 AC_ARG_WITH(system-dicts,
1662     AS_HELP_STRING([--without-system-dicts],
1663         [Do not use dictionaries from system paths.]),
1666 AC_ARG_WITH(external-dict-dir,
1667     AS_HELP_STRING([--with-external-dict-dir],
1668         [Specify external dictionary dir.]),
1671 AC_ARG_WITH(external-hyph-dir,
1672     AS_HELP_STRING([--with-external-hyph-dir],
1673         [Specify external hyphenation pattern dir.]),
1676 AC_ARG_WITH(external-thes-dir,
1677     AS_HELP_STRING([--with-external-thes-dir],
1678         [Specify external thesaurus dir.]),
1681 AC_ARG_WITH(system-zlib,
1682     AS_HELP_STRING([--with-system-zlib],
1683         [Use zlib already on system.]),,
1684     [with_system_zlib=auto])
1686 AC_ARG_WITH(system-jpeg,
1687     AS_HELP_STRING([--with-system-jpeg],
1688         [Use jpeg already on system.]),,
1689     [with_system_jpeg="$with_system_libs"])
1691 AC_ARG_WITH(system-clucene,
1692     AS_HELP_STRING([--with-system-clucene],
1693         [Use clucene already on system.]),,
1694     [with_system_clucene="$with_system_libs"])
1696 AC_ARG_WITH(system-expat,
1697     AS_HELP_STRING([--with-system-expat],
1698         [Use expat already on system.]),,
1699     [with_system_expat="$with_system_libs"])
1701 AC_ARG_WITH(system-libxml,
1702     AS_HELP_STRING([--with-system-libxml],
1703         [Use libxml/libxslt already on system.]),,
1704     [with_system_libxml=auto])
1706 AC_ARG_WITH(system-icu,
1707     AS_HELP_STRING([--with-system-icu],
1708         [Use icu already on system.]),,
1709     [with_system_icu="$with_system_libs"])
1711 AC_ARG_WITH(system-ucpp,
1712     AS_HELP_STRING([--with-system-ucpp],
1713         [Use ucpp already on system.]),,
1714     [])
1716 AC_ARG_WITH(system-openldap,
1717     AS_HELP_STRING([--with-system-openldap],
1718         [Use the OpenLDAP LDAP SDK already on system.]),,
1719     [with_system_openldap="$with_system_libs"])
1721 libo_FUZZ_ARG_ENABLE(poppler,
1722     AS_HELP_STRING([--disable-poppler],
1723         [Disable building Poppler.])
1726 AC_ARG_WITH(system-poppler,
1727     AS_HELP_STRING([--with-system-poppler],
1728         [Use system poppler (only needed for PDF import).]),,
1729     [with_system_poppler="$with_system_libs"])
1731 AC_ARG_WITH(system-gpgmepp,
1732     AS_HELP_STRING([--with-system-gpgmepp],
1733         [Use gpgmepp already on system]),,
1734     [with_system_gpgmepp="$with_system_libs"])
1736 AC_ARG_WITH(system-apache-commons,
1737     AS_HELP_STRING([--with-system-apache-commons],
1738         [Use Apache commons libraries already on system.]),,
1739     [with_system_apache_commons="$with_system_jars"])
1741 AC_ARG_WITH(system-mariadb,
1742     AS_HELP_STRING([--with-system-mariadb],
1743         [Use MariaDB/MySQL libraries already on system.]),,
1744     [with_system_mariadb="$with_system_libs"])
1746 AC_ARG_ENABLE(bundle-mariadb,
1747     AS_HELP_STRING([--enable-bundle-mariadb],
1748         [When using MariaDB/MySQL libraries already on system, bundle them with the MariaDB Connector/LibreOffice.])
1751 AC_ARG_WITH(system-postgresql,
1752     AS_HELP_STRING([--with-system-postgresql],
1753         [Use PostgreSQL libraries already on system, for building the PostgreSQL-SDBC
1754          driver. If pg_config is not in PATH, use PGCONFIG to point to it.]),,
1755     [with_system_postgresql="$with_system_libs"])
1757 AC_ARG_WITH(libpq-path,
1758     AS_HELP_STRING([--with-libpq-path=<absolute path to your libpq installation>],
1759         [Use this PostgreSQL C interface (libpq) installation for building
1760          the PostgreSQL-SDBC extension.]),
1763 AC_ARG_WITH(system-firebird,
1764     AS_HELP_STRING([--with-system-firebird],
1765         [Use Firebird libraries already on system, for building the Firebird-SDBC
1766          driver. If fb_config is not in PATH, use FBCONFIG to point to it.]),,
1767     [with_system_firebird="$with_system_libs"])
1769 AC_ARG_WITH(system-libtommath,
1770             AS_HELP_STRING([--with-system-libtommath],
1771                            [Use libtommath already on system]),,
1772             [with_system_libtommath="$with_system_libs"])
1774 AC_ARG_WITH(system-hsqldb,
1775     AS_HELP_STRING([--with-system-hsqldb],
1776         [Use hsqldb already on system.]))
1778 AC_ARG_WITH(hsqldb-jar,
1779     AS_HELP_STRING([--with-hsqldb-jar=JARFILE],
1780         [Specify path to jarfile manually.]),
1781     HSQLDB_JAR=$withval)
1783 libo_FUZZ_ARG_ENABLE(scripting-beanshell,
1784     AS_HELP_STRING([--disable-scripting-beanshell],
1785         [Disable support for scripts in BeanShell.]),
1789 AC_ARG_WITH(system-beanshell,
1790     AS_HELP_STRING([--with-system-beanshell],
1791         [Use beanshell already on system.]),,
1792     [with_system_beanshell="$with_system_jars"])
1794 AC_ARG_WITH(beanshell-jar,
1795     AS_HELP_STRING([--with-beanshell-jar=JARFILE],
1796         [Specify path to jarfile manually.]),
1797     BSH_JAR=$withval)
1799 libo_FUZZ_ARG_ENABLE(scripting-javascript,
1800     AS_HELP_STRING([--disable-scripting-javascript],
1801         [Disable support for scripts in JavaScript.]),
1805 AC_ARG_WITH(system-rhino,
1806     AS_HELP_STRING([--with-system-rhino],
1807         [Use rhino already on system.]),,)
1808 #    [with_system_rhino="$with_system_jars"])
1809 # Above is not used as we have different debug interface
1810 # patched into internal rhino. This code needs to be fixed
1811 # before we can enable it by default.
1813 AC_ARG_WITH(rhino-jar,
1814     AS_HELP_STRING([--with-rhino-jar=JARFILE],
1815         [Specify path to jarfile manually.]),
1816     RHINO_JAR=$withval)
1818 AC_ARG_WITH(commons-logging-jar,
1819     AS_HELP_STRING([--with-commons-logging-jar=JARFILE],
1820         [Specify path to jarfile manually.]),
1821     COMMONS_LOGGING_JAR=$withval)
1823 AC_ARG_WITH(system-jfreereport,
1824     AS_HELP_STRING([--with-system-jfreereport],
1825         [Use JFreeReport already on system.]),,
1826     [with_system_jfreereport="$with_system_jars"])
1828 AC_ARG_WITH(sac-jar,
1829     AS_HELP_STRING([--with-sac-jar=JARFILE],
1830         [Specify path to jarfile manually.]),
1831     SAC_JAR=$withval)
1833 AC_ARG_WITH(libxml-jar,
1834     AS_HELP_STRING([--with-libxml-jar=JARFILE],
1835         [Specify path to jarfile manually.]),
1836     LIBXML_JAR=$withval)
1838 AC_ARG_WITH(flute-jar,
1839     AS_HELP_STRING([--with-flute-jar=JARFILE],
1840         [Specify path to jarfile manually.]),
1841     FLUTE_JAR=$withval)
1843 AC_ARG_WITH(jfreereport-jar,
1844     AS_HELP_STRING([--with-jfreereport-jar=JARFILE],
1845         [Specify path to jarfile manually.]),
1846     JFREEREPORT_JAR=$withval)
1848 AC_ARG_WITH(liblayout-jar,
1849     AS_HELP_STRING([--with-liblayout-jar=JARFILE],
1850         [Specify path to jarfile manually.]),
1851     LIBLAYOUT_JAR=$withval)
1853 AC_ARG_WITH(libloader-jar,
1854     AS_HELP_STRING([--with-libloader-jar=JARFILE],
1855         [Specify path to jarfile manually.]),
1856     LIBLOADER_JAR=$withval)
1858 AC_ARG_WITH(libformula-jar,
1859     AS_HELP_STRING([--with-libformula-jar=JARFILE],
1860         [Specify path to jarfile manually.]),
1861     LIBFORMULA_JAR=$withval)
1863 AC_ARG_WITH(librepository-jar,
1864     AS_HELP_STRING([--with-librepository-jar=JARFILE],
1865         [Specify path to jarfile manually.]),
1866     LIBREPOSITORY_JAR=$withval)
1868 AC_ARG_WITH(libfonts-jar,
1869     AS_HELP_STRING([--with-libfonts-jar=JARFILE],
1870         [Specify path to jarfile manually.]),
1871     LIBFONTS_JAR=$withval)
1873 AC_ARG_WITH(libserializer-jar,
1874     AS_HELP_STRING([--with-libserializer-jar=JARFILE],
1875         [Specify path to jarfile manually.]),
1876     LIBSERIALIZER_JAR=$withval)
1878 AC_ARG_WITH(libbase-jar,
1879     AS_HELP_STRING([--with-libbase-jar=JARFILE],
1880         [Specify path to jarfile manually.]),
1881     LIBBASE_JAR=$withval)
1883 AC_ARG_WITH(system-odbc,
1884     AS_HELP_STRING([--with-system-odbc],
1885         [Use the odbc headers already on system.]),,
1886     [with_system_odbc="auto"])
1888 AC_ARG_WITH(system-sane,
1889     AS_HELP_STRING([--with-system-sane],
1890         [Use sane.h already on system.]),,
1891     [with_system_sane="$with_system_headers"])
1893 AC_ARG_WITH(system-bluez,
1894     AS_HELP_STRING([--with-system-bluez],
1895         [Use bluetooth.h already on system.]),,
1896     [with_system_bluez="$with_system_headers"])
1898 AC_ARG_WITH(system-curl,
1899     AS_HELP_STRING([--with-system-curl],
1900         [Use curl already on system.]),,
1901     [with_system_curl=auto])
1903 AC_ARG_WITH(system-boost,
1904     AS_HELP_STRING([--with-system-boost],
1905         [Use boost already on system.]),,
1906     [with_system_boost="$with_system_headers"])
1908 AC_ARG_WITH(system-glm,
1909     AS_HELP_STRING([--with-system-glm],
1910         [Use glm already on system.]),,
1911     [with_system_glm="$with_system_headers"])
1913 AC_ARG_WITH(system-hunspell,
1914     AS_HELP_STRING([--with-system-hunspell],
1915         [Use libhunspell already on system.]),,
1916     [with_system_hunspell="$with_system_libs"])
1918 AC_ARG_WITH(system-qrcodegen,
1919     AS_HELP_STRING([--with-system-qrcodegen],
1920         [Use libqrcodegen already on system.]),,
1921     [with_system_qrcodegen="$with_system_libs"])
1923 AC_ARG_WITH(system-mythes,
1924     AS_HELP_STRING([--with-system-mythes],
1925         [Use mythes already on system.]),,
1926     [with_system_mythes="$with_system_libs"])
1928 AC_ARG_WITH(system-altlinuxhyph,
1929     AS_HELP_STRING([--with-system-altlinuxhyph],
1930         [Use ALTLinuxhyph already on system.]),,
1931     [with_system_altlinuxhyph="$with_system_libs"])
1933 AC_ARG_WITH(system-lpsolve,
1934     AS_HELP_STRING([--with-system-lpsolve],
1935         [Use lpsolve already on system.]),,
1936     [with_system_lpsolve="$with_system_libs"])
1938 AC_ARG_WITH(system-coinmp,
1939     AS_HELP_STRING([--with-system-coinmp],
1940         [Use CoinMP already on system.]),,
1941     [with_system_coinmp="$with_system_libs"])
1943 AC_ARG_WITH(system-liblangtag,
1944     AS_HELP_STRING([--with-system-liblangtag],
1945         [Use liblangtag library already on system.]),,
1946     [with_system_liblangtag="$with_system_libs"])
1948 AC_ARG_WITH(webdav,
1949     AS_HELP_STRING([--with-webdav],
1950         [Specify which library to use for webdav implementation.
1951          Possible values: "neon", "serf", "no". The default value is "neon".
1952          Example: --with-webdav="serf"]),
1953     WITH_WEBDAV=$withval,
1954     WITH_WEBDAV="neon")
1956 AC_ARG_WITH(linker-hash-style,
1957     AS_HELP_STRING([--with-linker-hash-style],
1958         [Use linker with --hash-style=<style> when linking shared objects.
1959          Possible values: "sysv", "gnu", "both". The default value is "gnu"
1960          if supported on the build system, and "sysv" otherwise.]))
1962 AC_ARG_WITH(jdk-home,
1963     AS_HELP_STRING([--with-jdk-home=<absolute path to JDK home>],
1964         [If you have installed JDK 8 or later on your system please supply the
1965          path here. Note that this is not the location of the java command but the
1966          location of the entire distribution.]),
1969 AC_ARG_WITH(help,
1970     AS_HELP_STRING([--with-help],
1971         [Enable the build of help. There is a special parameter "common" that
1972          can be used to bundle only the common part, .e.g help-specific icons.
1973          This is useful when you build the helpcontent separately.])
1974     [
1975                           Usage:     --with-help    build the old local help
1976                                  --without-help     no local help (default)
1977                                  --with-help=html   build the new HTML local help
1978                                  --with-help=online build the new HTML online help
1979     ],
1982 libo_FUZZ_ARG_WITH(java,
1983     AS_HELP_STRING([--with-java=<java command>],
1984         [Specify the name of the Java interpreter command. Typically "java"
1985          which is the default.
1987          To build without support for Java components, applets, accessibility
1988          or the XML filters written in Java, use --without-java or --with-java=no.]),
1989     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ],
1990     [ test -z "$with_java" -o "$with_java" = "yes" && with_java=java ]
1993 AC_ARG_WITH(jvm-path,
1994     AS_HELP_STRING([--with-jvm-path=<absolute path to parent of jvm home>],
1995         [Use a specific JVM search path at runtime.
1996          e.g. use --with-jvm-path=/usr/lib/ to find JRE/JDK in /usr/lib/jvm/]),
1999 AC_ARG_WITH(ant-home,
2000     AS_HELP_STRING([--with-ant-home=<absolute path to Ant home>],
2001         [If you have installed Apache Ant on your system, please supply the path here.
2002          Note that this is not the location of the Ant binary but the location
2003          of the entire distribution.]),
2006 AC_ARG_WITH(symbol-config,
2007     AS_HELP_STRING([--with-symbol-config],
2008         [Configuration for the crashreport symbol upload]),
2009         [],
2010         [with_symbol_config=no])
2012 AC_ARG_WITH(export-validation,
2013     AS_HELP_STRING([--without-export-validation],
2014         [Disable validating OOXML and ODF files as exported from in-tree tests.]),
2015 ,with_export_validation=auto)
2017 AC_ARG_WITH(bffvalidator,
2018     AS_HELP_STRING([--with-bffvalidator=<absolute path to BFFValidator>],
2019         [Enables export validation for Microsoft Binary formats (doc, xls, ppt).
2020          Requires installed Microsoft Office Binary File Format Validator.
2021          Note: export-validation (--with-export-validation) is required to be turned on.
2022          See https://www.microsoft.com/en-us/download/details.aspx?id=26794]),
2023 ,with_bffvalidator=no)
2025 libo_FUZZ_ARG_WITH(junit,
2026     AS_HELP_STRING([--with-junit=<absolute path to JUnit 4 jar>],
2027         [Specifies the JUnit 4 jar file to use for JUnit-based tests.
2028          --without-junit disables those tests. Not relevant in the --without-java case.]),
2029 ,with_junit=yes)
2031 AC_ARG_WITH(hamcrest,
2032     AS_HELP_STRING([--with-hamcrest=<absolute path to hamcrest jar>],
2033         [Specifies the hamcrest jar file to use for JUnit-based tests.
2034          --without-junit disables those tests. Not relevant in the --without-java case.]),
2035 ,with_hamcrest=yes)
2037 AC_ARG_WITH(perl-home,
2038     AS_HELP_STRING([--with-perl-home=<abs. path to Perl 5 home>],
2039         [If you have installed Perl 5 Distribution, on your system, please
2040          supply the path here. Note that this is not the location of the Perl
2041          binary but the location of the entire distribution.]),
2044 libo_FUZZ_ARG_WITH(doxygen,
2045     AS_HELP_STRING(
2046         [--with-doxygen=<absolute path to doxygen executable>],
2047         [Specifies the doxygen executable to use when generating ODK C/C++
2048          documentation. --without-doxygen disables generation of ODK C/C++
2049          documentation. Not relevant in the --disable-odk case.]),
2050 ,with_doxygen=yes)
2052 AC_ARG_WITH(visual-studio,
2053     AS_HELP_STRING([--with-visual-studio=<2017>],
2054         [Specify which Visual Studio version to use in case several are
2055          installed. Currently only 2017 is supported.]),
2058 AC_ARG_WITH(windows-sdk,
2059     AS_HELP_STRING([--with-windows-sdk=<8.0(A)/8.1(A)/10>],
2060         [Specify which Windows SDK, or "Windows Kit", version to use
2061          in case the one that came with the selected Visual Studio
2062          is not what you want for some reason. Note that not all compiler/SDK
2063          combinations are supported. The intent is that this option should not
2064          be needed.]),
2067 AC_ARG_WITH(lang,
2068     AS_HELP_STRING([--with-lang="es sw tu cs sk"],
2069         [Use this option to build LibreOffice with additional UI language support.
2070          English (US) is always included by default.
2071          Separate multiple languages with space.
2072          For all languages, use --with-lang=ALL.]),
2075 AC_ARG_WITH(locales,
2076     AS_HELP_STRING([--with-locales="en es pt fr zh kr ja"],
2077         [Use this option to limit the locale information built in.
2078          Separate multiple locales with space.
2079          Very experimental and might well break stuff.
2080          Just a desperate measure to shrink code and data size.
2081          By default all the locales available is included.
2082          This option is completely unrelated to --with-lang.])
2083     [
2084                           Affects also our character encoding conversion
2085                           tables for encodings mainly targeted for a
2086                           particular locale, like EUC-CN and EUC-TW for
2087                           zh, ISO-2022-JP for ja.
2089                           Affects also our add-on break iterator data for
2090                           some languages.
2092                           For the default, all locales, don't use this switch at all.
2093                           Specifying just the language part of a locale means all matching
2094                           locales will be included.
2095     ],
2098 # Kerberos and GSSAPI used only by PostgreSQL as of LibO 3.5
2099 libo_FUZZ_ARG_WITH(krb5,
2100     AS_HELP_STRING([--with-krb5],
2101         [Enable MIT Kerberos 5 support in modules that support it.
2102          By default automatically enabled on platforms
2103          where a good system Kerberos 5 is available.]),
2106 libo_FUZZ_ARG_WITH(gssapi,
2107     AS_HELP_STRING([--with-gssapi],
2108         [Enable GSSAPI support in modules that support it.
2109          By default automatically enabled on platforms
2110          where a good system GSSAPI is available.]),
2113 AC_ARG_WITH(iwyu,
2114     AS_HELP_STRING([--with-iwyu],
2115         [Use given IWYU binary path to check unneeded includes instead of building.
2116          Use only if you are hacking on it.]),
2119 libo_FUZZ_ARG_WITH(lxml,
2120     AS_HELP_STRING([--without-lxml],
2121         [gla11y will use python lxml when available, potentially building a local copy if necessary.
2122          --without-lxml tells it to not use python lxml at all, which means that gla11y will only
2123          report widget classes and ids.]),
2126 dnl ===================================================================
2127 dnl Branding
2128 dnl ===================================================================
2130 AC_ARG_WITH(branding,
2131     AS_HELP_STRING([--with-branding=/path/to/images],
2132         [Use given path to retrieve branding images set.])
2133     [
2134                           Search for intro.png about.svg and flat_logo.svg.
2135                           If any is missing, default ones will be used instead.
2137                           Search also progress.conf for progress
2138                           settings on intro screen :
2140                           PROGRESSBARCOLOR="255,255,255" Set color of
2141                           progress bar. Comma separated RGB decimal values.
2142                           PROGRESSSIZE="407,6" Set size of progress bar.
2143                           Comma separated decimal values (width, height).
2144                           PROGRESSPOSITION="61,317" Set position of progress
2145                           bar from left,top. Comma separated decimal values.
2146                           PROGRESSFRAMECOLOR="20,136,3" Set color of progress
2147                           bar frame. Comma separated RGB decimal values.
2148                           PROGRESSTEXTCOLOR="0,0,0" Set color of progress
2149                           bar text. Comma separated RGB decimal values.
2150                           PROGRESSTEXTBASELINE="287" Set vertical position of
2151                           progress bar text from top. Decimal value.
2153                           Default values will be used if not found.
2154     ],
2158 AC_ARG_WITH(extra-buildid,
2159     AS_HELP_STRING([--with-extra-buildid="Tinderbox: Win-x86@6, Branch:master, Date:2012-11-26_00.29.34"],
2160         [Show addition build identification in about dialog.]),
2164 AC_ARG_WITH(vendor,
2165     AS_HELP_STRING([--with-vendor="John the Builder"],
2166         [Set vendor of the build.]),
2169 AC_ARG_WITH(android-package-name,
2170     AS_HELP_STRING([--with-android-package-name="org.libreoffice"],
2171         [Set Android package name of the build.]),
2174 AC_ARG_WITH(compat-oowrappers,
2175     AS_HELP_STRING([--with-compat-oowrappers],
2176         [Install oo* wrappers in parallel with
2177          lo* ones to keep backward compatibility.
2178          Has effect only with make distro-pack-install]),
2181 AC_ARG_WITH(os-version,
2182     AS_HELP_STRING([--with-os-version=<OSVERSION>],
2183         [For FreeBSD users, use this option to override the detected OSVERSION.]),
2186 AC_ARG_WITH(mingw-cross-compiler,
2187     AS_HELP_STRING([--with-mingw-cross-compiler=<mingw32-g++ command>],
2188         [Specify the MinGW cross-compiler to use.
2189          When building on the ODK on Unix and building unowinreg.dll,
2190          specify the MinGW C++ cross-compiler.]),
2193 AC_ARG_WITH(idlc-cpp,
2194     AS_HELP_STRING([--with-idlc-cpp=<cpp/ucpp>],
2195         [Specify the C Preprocessor to use for idlc. Default is ucpp.]),
2198 AC_ARG_WITH(build-version,
2199     AS_HELP_STRING([--with-build-version="Built by Jim"],
2200         [Allows the builder to add a custom version tag that will appear in the
2201          Help/About box for QA purposes.]),
2202 with_build_version=$withval,
2205 AC_ARG_WITH(parallelism,
2206     AS_HELP_STRING([--with-parallelism],
2207         [Number of jobs to run simultaneously during build. Parallel builds can
2208         save a lot of time on multi-cpu machines. Defaults to the number of
2209         CPUs on the machine, unless you configure --enable-icecream - then to
2210         40.]),
2213 AC_ARG_WITH(all-tarballs,
2214     AS_HELP_STRING([--with-all-tarballs],
2215         [Download all external tarballs unconditionally]))
2217 AC_ARG_WITH(gdrive-client-id,
2218     AS_HELP_STRING([--with-gdrive-client-id],
2219         [Provides the client id of the application for OAuth2 authentication
2220         on Google Drive. If either this or --with-gdrive-client-secret is
2221         empty, the feature will be disabled]),
2224 AC_ARG_WITH(gdrive-client-secret,
2225     AS_HELP_STRING([--with-gdrive-client-secret],
2226         [Provides the client secret of the application for OAuth2
2227         authentication on Google Drive. If either this or
2228         --with-gdrive-client-id is empty, the feature will be disabled]),
2231 AC_ARG_WITH(alfresco-cloud-client-id,
2232     AS_HELP_STRING([--with-alfresco-cloud-client-id],
2233         [Provides the client id of the application for OAuth2 authentication
2234         on Alfresco Cloud. If either this or --with-alfresco-cloud-client-secret is
2235         empty, the feature will be disabled]),
2238 AC_ARG_WITH(alfresco-cloud-client-secret,
2239     AS_HELP_STRING([--with-alfresco-cloud-client-secret],
2240         [Provides the client secret of the application for OAuth2
2241         authentication on Alfresco Cloud. If either this or
2242         --with-alfresco-cloud-client-id is empty, the feature will be disabled]),
2245 AC_ARG_WITH(onedrive-client-id,
2246     AS_HELP_STRING([--with-onedrive-client-id],
2247         [Provides the client id of the application for OAuth2 authentication
2248         on OneDrive. If either this or --with-onedrive-client-secret is
2249         empty, the feature will be disabled]),
2252 AC_ARG_WITH(onedrive-client-secret,
2253     AS_HELP_STRING([--with-onedrive-client-secret],
2254         [Provides the client secret of the application for OAuth2
2255         authentication on OneDrive. If either this or
2256         --with-onedrive-client-id is empty, the feature will be disabled]),
2258 dnl ===================================================================
2259 dnl Do we want to use pre-build binary tarball for recompile
2260 dnl ===================================================================
2262 if test "$enable_library_bin_tar" = "yes" ; then
2263     USE_LIBRARY_BIN_TAR=TRUE
2264 else
2265     USE_LIBRARY_BIN_TAR=
2267 AC_SUBST(USE_LIBRARY_BIN_TAR)
2269 dnl ===================================================================
2270 dnl Test whether build target is Release Build
2271 dnl ===================================================================
2272 AC_MSG_CHECKING([whether build target is Release Build])
2273 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
2274     AC_MSG_RESULT([no])
2275     ENABLE_RELEASE_BUILD=
2276 else
2277     AC_MSG_RESULT([yes])
2278     ENABLE_RELEASE_BUILD=TRUE
2280 AC_SUBST(ENABLE_RELEASE_BUILD)
2282 dnl ===================================================================
2283 dnl Test whether to sign Windows Build
2284 dnl ===================================================================
2285 AC_MSG_CHECKING([whether to sign windows build])
2286 if test "$enable_windows_build_signing" = "yes" -a "$_os" = "WINNT"; then
2287     AC_MSG_RESULT([yes])
2288     WINDOWS_BUILD_SIGNING="TRUE"
2289 else
2290     AC_MSG_RESULT([no])
2291     WINDOWS_BUILD_SIGNING="FALSE"
2293 AC_SUBST(WINDOWS_BUILD_SIGNING)
2295 dnl ===================================================================
2296 dnl MacOSX build and runtime environment options
2297 dnl ===================================================================
2299 AC_ARG_WITH(macosx-sdk,
2300     AS_HELP_STRING([--with-macosx-sdk=<version>],
2301         [Prefer a specific SDK for building.])
2302     [
2303                           If the requested SDK is not available, a search for the oldest one will be done.
2304                           With current Xcode versions, only the latest SDK is included, so this option is
2305                           not terribly useful. It works fine to build with a new SDK and run the result
2306                           on an older OS.
2308                           e. g.: --with-macosx-sdk=10.10
2310                           there are 3 options to control the MacOSX build:
2311                           --with-macosx-sdk (referred as 'sdk' below)
2312                           --with-macosx-version-min-required (referred as 'min' below)
2313                           --with-macosx-version-max-allowed (referred as 'max' below)
2315                           the connection between these value and the default they take is as follow:
2316                           ( ? means not specified on the command line, s means the SDK version found,
2317                           constraint: 8 <= x <= y <= z)
2319                           ==========================================
2320                            command line      || config result
2321                           ==========================================
2322                           min  | max  | sdk  || min   | max  | sdk  |
2323                           ?    | ?    | ?    || 10.10 | 10.s | 10.s |
2324                           ?    | ?    | 10.x || 10.10 | 10.x | 10.x |
2325                           ?    | 10.x | ?    || 10.10 | 10.s | 10.s |
2326                           ?    | 10.x | 10.y || 10.10 | 10.x | 10.y |
2327                           10.x | ?    | ?    || 10.x  | 10.s | 10.s |
2328                           10.x | ?    | 10.y || 10.x  | 10.y | 10.y |
2329                           10.x | 10.y | ?    || 10.x  | 10.y | 10.y |
2330                           10.x | 10.y | 10.z || 10.x  | 10.y | 10.z |
2333                           see: http://developer.apple.com/library/mac/#technotes/tn2064/_index.html
2334                           for a detailed technical explanation of these variables
2336                           Note: MACOSX_DEPLOYMENT_TARGET will be set to the value of 'min'.
2337     ],
2340 AC_ARG_WITH(macosx-version-min-required,
2341     AS_HELP_STRING([--with-macosx-version-min-required=<version>],
2342         [set the minimum OS version needed to run the built LibreOffice])
2343     [
2344                           e. g.: --with-macos-version-min-required=10.10
2345                           see --with-macosx-sdk for more info
2346     ],
2349 AC_ARG_WITH(macosx-version-max-allowed,
2350     AS_HELP_STRING([--with-macosx-version-max-allowed=<version>],
2351         [set the maximum allowed OS version the LibreOffice compilation can use APIs from])
2352     [
2353                           e. g.: --with-macos-version-max-allowed=10.10
2354                           see --with-macosx-sdk for more info
2355     ],
2359 dnl ===================================================================
2360 dnl options for stuff used during cross-compilation build
2361 dnl Not quite superseded by --with-build-platform-configure-options.
2362 dnl TODO: check, if the "force" option is still needed anywhere.
2363 dnl ===================================================================
2365 AC_ARG_WITH(system-icu-for-build,
2366     AS_HELP_STRING([--with-system-icu-for-build=yes/no/force],
2367         [Use icu already on system for build tools (cross-compilation only).]))
2370 dnl ===================================================================
2371 dnl Check for incompatible options set by fuzzing, and reset those
2372 dnl automatically to working combinations
2373 dnl ===================================================================
2375 if test "$libo_fuzzed_enable_dbus" = yes -a "$libo_fuzzed_enable_avahi" -a \
2376         "$enable_dbus" != "$enable_avahi"; then
2377     AC_MSG_NOTICE([Resetting --enable-avahi=$enable_dbus])
2378     enable_avahi=$enable_dbus
2381 add_lopath_after ()
2383     if ! echo "$LO_PATH" | $EGREP -q "(^|${P_SEP})$1($|${P_SEP})"; then
2384         LO_PATH="${LO_PATH:+$LO_PATH$P_SEP}$1"
2385     fi
2388 add_lopath_before ()
2390     local IFS=${P_SEP}
2391     local path_cleanup
2392     local dir
2393     for dir in $LO_PATH ; do
2394         if test "$dir" != "$1" ; then
2395             path_cleanup=${path_cleanup:+$path_cleanup$P_SEP}$dir
2396         fi
2397     done
2398     LO_PATH="$1${path_cleanup:+$P_SEP$path_cleanup}"
2401 dnl ===================================================================
2402 dnl check for required programs (grep, awk, sed, bash)
2403 dnl ===================================================================
2405 pathmunge ()
2407     if test -n "$1"; then
2408         if test "$build_os" = "cygwin"; then
2409             if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
2410                 PathFormat "$1"
2411                 new_path=`cygpath -sm "$formatted_path"`
2412             else
2413                 PathFormat "$1"
2414                 new_path=`cygpath -u "$formatted_path"`
2415             fi
2416         else
2417             new_path="$1"
2418         fi
2419         if test "$2" = "after"; then
2420             add_lopath_after "$new_path"
2421         else
2422             add_lopath_before "$new_path"
2423         fi
2424         unset new_path
2425     fi
2428 AC_PROG_AWK
2429 AC_PATH_PROG( AWK, $AWK)
2430 if test -z "$AWK"; then
2431     AC_MSG_ERROR([install awk to run this script])
2434 AC_PATH_PROG(BASH, bash)
2435 if test -z "$BASH"; then
2436     AC_MSG_ERROR([bash not found in \$PATH])
2438 AC_SUBST(BASH)
2440 AC_MSG_CHECKING([for GNU or BSD tar])
2441 for a in $GNUTAR gtar gnutar bsdtar tar /usr/sfw/bin/gtar; do
2442     $a --version 2> /dev/null | egrep "GNU|bsdtar"  2>&1 > /dev/null
2443     if test $? -eq 0;  then
2444         GNUTAR=$a
2445         break
2446     fi
2447 done
2448 AC_MSG_RESULT($GNUTAR)
2449 if test -z "$GNUTAR"; then
2450     AC_MSG_ERROR([not found. install GNU or BSD tar.])
2452 AC_SUBST(GNUTAR)
2454 AC_MSG_CHECKING([for tar's option to strip components])
2455 $GNUTAR --help 2> /dev/null | egrep "bsdtar|strip-components" 2>&1 >/dev/null
2456 if test $? -eq 0; then
2457     STRIP_COMPONENTS="--strip-components"
2458 else
2459     $GNUTAR --help 2> /dev/null | egrep "strip-path" 2>&1 >/dev/null
2460     if test $? -eq 0; then
2461         STRIP_COMPONENTS="--strip-path"
2462     else
2463         STRIP_COMPONENTS="unsupported"
2464     fi
2466 AC_MSG_RESULT($STRIP_COMPONENTS)
2467 if test x$STRIP_COMPONENTS = xunsupported; then
2468     AC_MSG_ERROR([you need a tar that is able to strip components.])
2470 AC_SUBST(STRIP_COMPONENTS)
2472 dnl It is useful to have a BUILD_TYPE keyword to distinguish "normal"
2473 dnl desktop OSes from "mobile" ones.
2475 dnl We assume that a non-DESKTOP build type is also a non-NATIVE one.
2476 dnl In other words, that when building for an OS that is not a
2477 dnl "desktop" one but a "mobile" one, we are always cross-compiling.
2479 dnl Note the direction of the implication; there is no assumption that
2480 dnl cross-compiling would imply a non-desktop OS.
2482 if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
2483     BUILD_TYPE="$BUILD_TYPE DESKTOP"
2484     AC_DEFINE(HAVE_FEATURE_DESKTOP)
2485     AC_DEFINE(HAVE_FEATURE_MULTIUSER_ENVIRONMENT)
2488 # Whether to build "avmedia" functionality or not.
2490 if test -z "$enable_avmedia"; then
2491     enable_avmedia=yes
2494 BUILD_TYPE="$BUILD_TYPE AVMEDIA"
2495 if test "$enable_avmedia" = yes; then
2496     AC_DEFINE(HAVE_FEATURE_AVMEDIA)
2497 else
2498     USE_AVMEDIA_DUMMY='TRUE'
2500 AC_SUBST(USE_AVMEDIA_DUMMY)
2502 # Decide whether to build database connectivity stuff (including
2503 # Base) or not. We probably don't want to on non-desktop OSes.
2504 if test -z "$enable_database_connectivity"; then
2505     # --disable-database-connectivity is unfinished work in progress
2506     # and the iOS test app doesn't link if we actually try to use it.
2507     # if test $_os != iOS -a $_os != Android; then
2508     if test $_os != iOS; then
2509         enable_database_connectivity=yes
2510     fi
2513 if test "$enable_database_connectivity" = yes; then
2514     BUILD_TYPE="$BUILD_TYPE DBCONNECTIVITY"
2515     AC_DEFINE(HAVE_FEATURE_DBCONNECTIVITY)
2518 if test -z "$enable_extensions"; then
2519     # For iOS and Android disable extensions unless specifically overridden with --enable-extensions.
2520     if test $_os != iOS -a $_os != Android; then
2521         enable_extensions=yes
2522     fi
2525 if test "$enable_extensions" = yes; then
2526     BUILD_TYPE="$BUILD_TYPE EXTENSIONS"
2527     AC_DEFINE(HAVE_FEATURE_EXTENSIONS)
2530 if test -z "$enable_scripting"; then
2531     # Disable scripting for iOS unless specifically overridden
2532     # with --enable-scripting.
2533     if test $_os != iOS; then
2534         enable_scripting=yes
2535     fi
2538 DISABLE_SCRIPTING=''
2539 if test "$enable_scripting" = yes; then
2540     BUILD_TYPE="$BUILD_TYPE SCRIPTING"
2541     AC_DEFINE(HAVE_FEATURE_SCRIPTING)
2542 else
2543     DISABLE_SCRIPTING='TRUE'
2544     SCPDEFS="$SCPDEFS -DDISABLE_SCRIPTING"
2547 if test $_os = iOS -o $_os = Android; then
2548     # Disable dynamic_loading always for iOS and Android
2549     enable_dynamic_loading=no
2550 elif test -z "$enable_dynamic_loading"; then
2551     # Otherwise enable it unless specifically disabled
2552     enable_dynamic_loading=yes
2555 DISABLE_DYNLOADING=''
2556 if test "$enable_dynamic_loading" = yes; then
2557     BUILD_TYPE="$BUILD_TYPE DYNLOADING"
2558 else
2559     DISABLE_DYNLOADING='TRUE'
2561 AC_SUBST(DISABLE_DYNLOADING)
2563 # remember SYSBASE value
2564 AC_SUBST(SYSBASE)
2566 dnl ===================================================================
2567 dnl  Sort out various gallery compilation options
2568 dnl ===================================================================
2569 AC_MSG_CHECKING([how to build and package galleries])
2570 if test -n "${with_galleries}"; then
2571     if test "$with_galleries" = "build"; then
2572         WITH_GALLERY_BUILD=TRUE
2573         AC_MSG_RESULT([build from source images internally])
2574     elif test "$with_galleries" = "no"; then
2575         WITH_GALLERY_BUILD=
2576         AC_MSG_RESULT([disable non-internal gallery build])
2577     else
2578         AC_MSG_ERROR([unknown value --with-galleries=$with_galleries])
2579     fi
2580 else
2581     if test $_os != iOS -a $_os != Android; then
2582         WITH_GALLERY_BUILD=TRUE
2583         AC_MSG_RESULT([internal src images for desktop])
2584     else
2585         WITH_GALLERY_BUILD=
2586         AC_MSG_RESULT([disable src image build])
2587     fi
2589 AC_SUBST(WITH_GALLERY_BUILD)
2591 dnl ===================================================================
2592 dnl  Checks if ccache is available
2593 dnl ===================================================================
2594 CCACHE_DEPEND_MODE=
2595 if test "$_os" = "WINNT"; then
2596     # on windows/VC build do not use ccache
2597     CCACHE=""
2598 elif test "$enable_ccache" = "no"; then
2599     CCACHE=""
2600 elif test -n "$enable_ccache" -o \( "$enable_ccache" = "" -a "$enable_icecream" != "yes" \); then
2601     case "%$CC%$CXX%" in
2602     # If $CC and/or $CXX already contain "ccache" (possibly suffixed with some version number etc),
2603     # assume that's good then
2604     *%ccache[[-_' ']]*|*/ccache[[-_' ']]*)
2605         AC_MSG_NOTICE([ccache seems to be included in a pre-defined CC and/or CXX])
2606         CCACHE_DEPEND_MODE=1
2607         ;;
2608     *)
2609         AC_PATH_PROG([CCACHE],[ccache],[not found])
2610         if test "$CCACHE" = "not found"; then
2611             CCACHE=""
2612         else
2613             CCACHE_DEPEND_MODE=1
2614             # Need to check for ccache version: otherwise prevents
2615             # caching of the results (like "-x objective-c++" for Mac)
2616             if test $_os = Darwin -o $_os = iOS; then
2617                 # Check ccache version
2618                 AC_MSG_CHECKING([whether version of ccache is suitable])
2619                 CCACHE_VERSION=`"$CCACHE" -V | "$AWK" '/^ccache version/{print $3}'`
2620                 CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
2621                 if test "$CCACHE_VERSION" = "2.4_OOo" -o "$CCACHE_NUMVER" -ge "030100"; then
2622                     AC_MSG_RESULT([yes, $CCACHE_VERSION])
2623                 else
2624                     AC_MSG_RESULT([no, $CCACHE_VERSION])
2625                     CCACHE=""
2626                     CCACHE_DEPEND_MODE=
2627                 fi
2628             fi
2629         fi
2630         ;;
2631     esac
2632 else
2633     CCACHE=""
2635 if test "$enable_ccache" = "nodepend"; then
2636     CCACHE_DEPEND_MODE=""
2638 AC_SUBST(CCACHE_DEPEND_MODE)
2640 if test "$CCACHE" != ""; then
2641     ccache_size_msg=$([ccache -s | tail -n 1 | sed 's/^[^0-9]*//' | sed -e 's/\.[0-9]*//'])
2642     ccache_size=$(echo "$ccache_size_msg" | grep "G" | sed -e 's/G.*$//')
2643     if test "$ccache_size" = ""; then
2644         ccache_size=$(echo "$ccache_size_msg" | grep "M" | sed -e 's/\ M.*$//')
2645         if test "$ccache_size" = ""; then
2646             ccache_size=0
2647         fi
2648         # we could not determine the size or it was less than 1GB -> disable auto-ccache
2649         if test $ccache_size -lt 1024; then
2650             CCACHE=""
2651             AC_MSG_WARN([ccache's cache size is less than 1GB using it is counter-productive: Disabling auto-ccache detection])
2652             add_warning "ccache's cache size is less than 1GB using it is counter-productive: auto-ccache detection disabled"
2653         else
2654             # warn that ccache may be too small for debug build
2655             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2656             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2657         fi
2658     else
2659         if test $ccache_size -lt 5; then
2660             #warn that ccache may be too small for debug build
2661             AC_MSG_WARN([ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build])
2662             add_warning "ccache's cache size is less than 5GB using it may be counter-productive for debug or symbol-enabled build"
2663         fi
2664     fi
2667 dnl ===================================================================
2668 dnl  Checks for C compiler,
2669 dnl  The check for the C++ compiler is later on.
2670 dnl ===================================================================
2671 if test "$_os" != "WINNT"; then
2672     GCC_HOME_SET="true"
2673     AC_MSG_CHECKING([gcc home])
2674     if test -z "$with_gcc_home"; then
2675         if test "$enable_icecream" = "yes"; then
2676             if test -d "/usr/lib/icecc/bin"; then
2677                 GCC_HOME="/usr/lib/icecc/"
2678             elif test -d "/usr/libexec/icecc/bin"; then
2679                 GCC_HOME="/usr/libexec/icecc/"
2680             elif test -d "/opt/icecream/bin"; then
2681                 GCC_HOME="/opt/icecream/"
2682             else
2683                 AC_MSG_ERROR([Could not figure out the location of icecream GCC wrappers, manually use --with-gcc-home])
2685             fi
2686         else
2687             GCC_HOME=`which gcc | $SED -e s,/bin/gcc,,`
2688             GCC_HOME_SET="false"
2689         fi
2690     else
2691         GCC_HOME="$with_gcc_home"
2692     fi
2693     AC_MSG_RESULT($GCC_HOME)
2694     AC_SUBST(GCC_HOME)
2696     if test "$GCC_HOME_SET" = "true"; then
2697         if test -z "$CC"; then
2698             CC="$GCC_HOME/bin/gcc"
2699             CC_BASE="gcc"
2700         fi
2701         if test -z "$CXX"; then
2702             CXX="$GCC_HOME/bin/g++"
2703             CXX_BASE="g++"
2704         fi
2705     fi
2708 COMPATH=`dirname "$CC"`
2709 if test "$COMPATH" = "."; then
2710     AC_PATH_PROGS(COMPATH, $CC)
2711     dnl double square bracket to get single because of M4 quote...
2712     COMPATH=`echo $COMPATH | $SED "s@/[[^/:]]*\\\$@@"`
2714 COMPATH=`echo $COMPATH | $SED "s@/[[Bb]][[Ii]][[Nn]]\\\$@@"`
2716 dnl ===================================================================
2717 dnl Java support
2718 dnl ===================================================================
2719 AC_MSG_CHECKING([whether to build with Java support])
2720 if test "$with_java" != "no"; then
2721     if test "$DISABLE_SCRIPTING" = TRUE; then
2722         AC_MSG_RESULT([no, overridden by --disable-scripting])
2723         ENABLE_JAVA=""
2724         with_java=no
2725     else
2726         AC_MSG_RESULT([yes])
2727         ENABLE_JAVA="TRUE"
2728         AC_DEFINE(HAVE_FEATURE_JAVA)
2729     fi
2730 else
2731     AC_MSG_RESULT([no])
2732     ENABLE_JAVA=""
2735 AC_SUBST(ENABLE_JAVA)
2737 dnl ENABLE_JAVA="TRUE" if we want there to be *run-time* (and build-time) support for Java
2739 dnl ENABLE_JAVA="" indicate no Java support at all
2741 dnl ===================================================================
2742 dnl Check macOS SDK and compiler
2743 dnl ===================================================================
2745 if test $_os = Darwin -o $_os = iOS; then
2747     # If no --with-macosx-sdk option is given, look for one
2749     # The intent is that for "most" Mac-based developers, a suitable
2750     # SDK will be found automatically without any configure options.
2752     # For developers with a current Xcode, the lowest-numbered SDK
2753     # higher than or equal to the minimum required should be found.
2755     AC_MSG_CHECKING([what macOS SDK to use])
2756     for _macosx_sdk in ${with_macosx_sdk-10.15 10.14 10.13 10.12}; do
2757         MACOSX_SDK_PATH=`xcrun --sdk macosx${_macosx_sdk} --show-sdk-path 2> /dev/null`
2758         if test -d "$MACOSX_SDK_PATH"; then
2759             with_macosx_sdk="${_macosx_sdk}"
2760             break
2761         else
2762             MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${_macosx_sdk}.sdk"
2763             if test -d "$MACOSX_SDK_PATH"; then
2764                 with_macosx_sdk="${_macosx_sdk}"
2765                 break
2766             fi
2767         fi
2768     done
2769     if test ! -d "$MACOSX_SDK_PATH"; then
2770         AC_MSG_ERROR([Could not find an appropriate macOS SDK])
2771     fi
2773     if test $_os = iOS; then
2774         if test "$enable_ios_simulator" = "yes"; then
2775             useos=iphonesimulator
2776         else
2777             useos=iphoneos
2778         fi
2779         MACOSX_SDK_PATH=`xcrun --sdk ${useos} --show-sdk-path 2> /dev/null`
2780     fi
2781     AC_MSG_RESULT([SDK $with_macosx_sdk at $MACOSX_SDK_PATH])
2784     case $with_macosx_sdk in
2785     10.12)
2786         MACOSX_SDK_VERSION=101200
2787         ;;
2788     10.13)
2789         MACOSX_SDK_VERSION=101300
2790         ;;
2791     10.14)
2792         MACOSX_SDK_VERSION=101400
2793         ;;
2794     10.15)
2795         MACOSX_SDK_VERSION=101500
2796         ;;
2797     *)
2798         AC_MSG_ERROR([with-macosx-sdk $with_macosx_sdk is not a supported value, supported values are 10.12--15])
2799         ;;
2800     esac
2802     if test "$with_macosx_version_min_required" = "" ; then
2803         with_macosx_version_min_required="10.10";
2804     fi
2806     if test "$with_macosx_version_max_allowed" = "" ; then
2807         with_macosx_version_max_allowed="$with_macosx_sdk"
2808     fi
2810     # export this so that "xcrun" invocations later return matching values
2811     DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}"
2812     DEVELOPER_DIR="${DEVELOPER_DIR%/Platforms*}"
2813     export DEVELOPER_DIR
2814     FRAMEWORKSHOME="$MACOSX_SDK_PATH/System/Library/Frameworks"
2815     MACOSX_DEPLOYMENT_TARGET="$with_macosx_version_min_required"
2817     AC_MSG_CHECKING([whether Xcode is new enough])
2818     my_xcode_ver1=$(xcrun xcodebuild -version | head -n 1)
2819     my_xcode_ver2=${my_xcode_ver1#Xcode }
2820     my_xcode_ver3=$(printf %s "$my_xcode_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
2821     if test "$my_xcode_ver3" -ge 903; then
2822         AC_MSG_RESULT([yes ($my_xcode_ver2)])
2823     else
2824         AC_MSG_ERROR(["$my_xcode_ver1" is too old or unrecognized, must be at least Xcode 9.3])
2825     fi
2827     case "$with_macosx_version_min_required" in
2828     10.10)
2829         MAC_OS_X_VERSION_MIN_REQUIRED="101000"
2830         ;;
2831     10.11)
2832         MAC_OS_X_VERSION_MIN_REQUIRED="101100"
2833         ;;
2834     10.12)
2835         MAC_OS_X_VERSION_MIN_REQUIRED="101200"
2836         ;;
2837     10.13)
2838         MAC_OS_X_VERSION_MIN_REQUIRED="101300"
2839         ;;
2840     10.14)
2841         MAC_OS_X_VERSION_MIN_REQUIRED="101400"
2842         ;;
2843     10.15)
2844         MAC_OS_X_VERSION_MIN_REQUIRED="101500"
2845         ;;
2846     *)
2847         AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.10--15])
2848         ;;
2849     esac
2850     MAC_OS_X_VERSION_MIN_REQUIRED_DOTS=$with_macosx_version_min_required
2852     LIBTOOL=/usr/bin/libtool
2853     INSTALL_NAME_TOOL=install_name_tool
2854     if test -z "$save_CC"; then
2855         stdlib=-stdlib=libc++
2856         if test "$ENABLE_LTO" = TRUE; then
2857             lto=-flto
2858         fi
2860         AC_MSG_CHECKING([what C compiler to use])
2861         CC="`xcrun -find clang`"
2862         CC_BASE=`first_arg_basename "$CC"`
2863         CC+=" -m64 $lto -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2864         AC_MSG_RESULT([$CC])
2866         AC_MSG_CHECKING([what C++ compiler to use])
2867         CXX="`xcrun -find clang++`"
2868         CXX_BASE=`first_arg_basename "$CXX"`
2869         CXX+=" -m64 $lto $stdlib -mmacosx-version-min=$with_macosx_version_min_required -isysroot $MACOSX_SDK_PATH"
2870         AC_MSG_RESULT([$CXX])
2872         INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
2873         AR=`xcrun -find ar`
2874         NM=`xcrun -find nm`
2875         STRIP=`xcrun -find strip`
2876         LIBTOOL=`xcrun -find libtool`
2877         RANLIB=`xcrun -find ranlib`
2878     fi
2880     case "$with_macosx_version_max_allowed" in
2881     10.10)
2882         MAC_OS_X_VERSION_MAX_ALLOWED="101000"
2883         ;;
2884     10.11)
2885         MAC_OS_X_VERSION_MAX_ALLOWED="101100"
2886         ;;
2887     10.12)
2888         MAC_OS_X_VERSION_MAX_ALLOWED="101200"
2889         ;;
2890     10.13)
2891         MAC_OS_X_VERSION_MAX_ALLOWED="101300"
2892         ;;
2893     10.14)
2894         MAC_OS_X_VERSION_MAX_ALLOWED="101400"
2895         ;;
2896     10.15)
2897         MAC_OS_X_VERSION_MAX_ALLOWED="101500"
2898         ;;
2899     *)
2900         AC_MSG_ERROR([with-macosx-version-max-allowed $with_macosx_version_max_allowed is not a supported value, supported values are 10.10--15])
2901         ;;
2902     esac
2904     AC_MSG_CHECKING([that macosx-version-min-required is coherent with macosx-version-max-allowed])
2905     if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MAC_OS_X_VERSION_MAX_ALLOWED; then
2906         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])
2907     else
2908         AC_MSG_RESULT([ok])
2909     fi
2911     AC_MSG_CHECKING([that macosx-version-max-allowed is coherent with macos-with-sdk])
2912     if test $MAC_OS_X_VERSION_MAX_ALLOWED -gt $MACOSX_SDK_VERSION; then
2913         AC_MSG_ERROR([the version maximum allowed cannot be greater than the sdk level])
2914     else
2915         AC_MSG_RESULT([ok])
2916     fi
2917     AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED])
2918     AC_MSG_NOTICE([MAC_OS_X_VERSION_MAX_ALLOWED=$MAC_OS_X_VERSION_MAX_ALLOWED])
2920     AC_MSG_CHECKING([whether to do code signing])
2922     if test "$enable_macosx_code_signing" = yes; then
2923         # By default use the first suitable certificate (?).
2925         # http://stackoverflow.com/questions/13196291/difference-between-mac-developer-and-3rd-party-mac-developer-application
2926         # says that the "Mac Developer" certificate is useful just for self-testing. For distribution
2927         # outside the Mac App Store, use the "Developer ID Application" one, and for distribution in
2928         # the App Store, the "3rd Party Mac Developer" one. I think it works best to the
2929         # "Developer ID Application" one.
2931         identity=`security find-identity -p codesigning -v 2>/dev/null | grep 'Developer ID Application:' | $AWK '{print $2}' |head -1`
2932         if test -n "$identity"; then
2933             MACOSX_CODESIGNING_IDENTITY=$identity
2934             pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2935             AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2936         else
2937             AC_MSG_ERROR([cannot determine identity to use])
2938         fi
2939     elif test -n "$enable_macosx_code_signing" -a "$enable_macosx_code_signing" != no ; then
2940         MACOSX_CODESIGNING_IDENTITY=$enable_macosx_code_signing
2941         pretty_name=`security find-identity -p codesigning -v | grep "$MACOSX_CODESIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2942         AC_MSG_RESULT([yes, using the identity $MACOSX_CODESIGNING_IDENTITY for $pretty_name])
2943     else
2944         AC_MSG_RESULT([no])
2945     fi
2947     AC_MSG_CHECKING([whether to create a Mac App Store package])
2949     if test -n "$enable_macosx_package_signing" -a -z "$MACOSX_CODESIGNING_IDENTITY"; then
2950         AC_MSG_ERROR([You forgot --enable-macosx-code-signing])
2951     elif test "$enable_macosx_package_signing" = yes; then
2952         # By default use the first suitable certificate.
2953         # It should be a "3rd Party Mac Developer Installer" one
2955         identity=`security find-identity -v 2>/dev/null | grep '3rd Party Mac Developer Installer:' | awk '{print $2}' |head -1`
2956         if test -n "$identity"; then
2957             MACOSX_PACKAGE_SIGNING_IDENTITY=$identity
2958             pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2959             AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2960         else
2961             AC_MSG_ERROR([Could not find any suitable '3rd Party Mac Developer Installer' certificate])
2962         fi
2963     elif test -n "$enable_macosx_package_signing"; then
2964         MACOSX_PACKAGE_SIGNING_IDENTITY=$enable_macosx_package_signing
2965         pretty_name=`security find-identity -v | grep "$MACOSX_PACKAGE_SIGNING_IDENTITY" | sed -e 's/^[[^"]]*"//' -e 's/"//'`
2966         AC_MSG_RESULT([yes, using the identity $MACOSX_PACKAGE_SIGNING_IDENTITY for $pretty_name])
2967     else
2968         AC_MSG_RESULT([no])
2969     fi
2971     if test -n "$MACOSX_CODESIGNING_IDENTITY" -a -n "$MACOSX_PACKAGE_SIGNING_IDENTITY" -a "$MACOSX_CODESIGNING_IDENTITY" = "$MACOSX_PACKAGE_SIGNING_IDENTITY"; then
2972         AC_MSG_ERROR([You should not use the same identity for code and package signing])
2973     fi
2975     AC_MSG_CHECKING([whether to sandbox the application])
2977     if test -z "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2978         AC_MSG_ERROR([macOS sandboxing requires code signing])
2979     elif test -n "$ENABLE_JAVA" -a "$enable_macosx_sandbox" = yes; then
2980         AC_MSG_ERROR([macOS sandboxing (actually App Store rules) disallows use of Java])
2981     elif test -n "$MACOSX_CODESIGNING_IDENTITY" -a "$enable_macosx_sandbox" = yes; then
2982         ENABLE_MACOSX_SANDBOX=TRUE
2983         AC_DEFINE(HAVE_FEATURE_MACOSX_SANDBOX)
2984         AC_MSG_RESULT([yes])
2985     else
2986         AC_MSG_RESULT([no])
2987     fi
2989     AC_MSG_CHECKING([what macOS app bundle identifier to use])
2990     MACOSX_BUNDLE_IDENTIFIER=$with_macosx_bundle_identifier
2991     AC_MSG_RESULT([$MACOSX_BUNDLE_IDENTIFIER])
2993 AC_SUBST(MACOSX_SDK_PATH)
2994 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
2995 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED)
2996 AC_SUBST(MAC_OS_X_VERSION_MIN_REQUIRED_DOTS)
2997 AC_SUBST(MAC_OS_X_VERSION_MAX_ALLOWED)
2998 AC_SUBST(INSTALL_NAME_TOOL)
2999 AC_SUBST(LIBTOOL) # Note that the macOS libtool command is unrelated to GNU libtool
3000 AC_SUBST(MACOSX_CODESIGNING_IDENTITY)
3001 AC_SUBST(MACOSX_PACKAGE_SIGNING_IDENTITY)
3002 AC_SUBST(ENABLE_MACOSX_SANDBOX)
3003 AC_SUBST(MACOSX_BUNDLE_IDENTIFIER)
3005 dnl ===================================================================
3006 dnl Check iOS SDK and compiler
3007 dnl ===================================================================
3009 if test $_os = iOS; then
3010     AC_MSG_CHECKING([what iOS SDK to use])
3011     current_sdk_ver=12.4
3012     older_sdk_vers="13.0 12.2 12.1 12.0 11.4"
3013     if test "$enable_ios_simulator" = "yes"; then
3014         platform=iPhoneSimulator
3015         versionmin=-mios-simulator-version-min=11.0
3016     else
3017         platform=iPhoneOS
3018         versionmin=-miphoneos-version-min=11.0
3019     fi
3020     xcode_developer=`xcode-select -print-path`
3022     for sdkver in $current_sdk_ver $older_sdk_vers; do
3023         t=$xcode_developer/Platforms/$platform.platform/Developer/SDKs/$platform$sdkver.sdk
3024         if test -d $t; then
3025             sysroot=$t
3026             break
3027         fi
3028     done
3030     if test -z "$sysroot"; then
3031         AC_MSG_ERROR([Could not find iOS SDK, expected something like $xcode_developer/Platforms/$platform.platform/Developer/SDKs/${platform}${current_sdk_ver}.sdk])
3032     fi
3034     AC_MSG_RESULT($sysroot)
3036     # LTO is not really recommended for iOS builds,
3037     # the link time will be astronomical
3038     if test "$ENABLE_LTO" = TRUE; then
3039         lto=-flto
3040     fi
3042     stdlib="-stdlib=libc++"
3044     AC_MSG_CHECKING([what C compiler to use])
3045     CC="`xcrun -find clang`"
3046     CC_BASE=`first_arg_basename "$CC"`
3047     CC+=" -arch $host_cpu -isysroot $sysroot $lto $versionmin"
3048     AC_MSG_RESULT([$CC])
3050     AC_MSG_CHECKING([what C++ compiler to use])
3051     CXX="`xcrun -find clang++`"
3052     CXX_BASE=`first_arg_basename "$CXX"`
3053     CXX+=" -arch $host_cpu $stdlib -isysroot $sysroot $lto $versionmin"
3054     AC_MSG_RESULT([$CXX])
3056     INSTALL_NAME_TOOL=`xcrun -find install_name_tool`
3057     AR=`xcrun -find ar`
3058     NM=`xcrun -find nm`
3059     STRIP=`xcrun -find strip`
3060     LIBTOOL=`xcrun -find libtool`
3061     RANLIB=`xcrun -find ranlib`
3064 AC_MSG_CHECKING([whether to treat the installation as read-only])
3066 if test \( -z "$enable_readonly_installset" -a "$ENABLE_MACOSX_SANDBOX" = TRUE \) -o \
3067         "$enable_extensions" != yes; then
3068     enable_readonly_installset=yes
3070 if test "$enable_readonly_installset" = yes; then
3071     AC_MSG_RESULT([yes])
3072     AC_DEFINE(HAVE_FEATURE_READONLY_INSTALLSET)
3073 else
3074     AC_MSG_RESULT([no])
3077 dnl ===================================================================
3078 dnl Structure of install set
3079 dnl ===================================================================
3081 if test $_os = Darwin; then
3082     LIBO_BIN_FOLDER=MacOS
3083     LIBO_ETC_FOLDER=Resources
3084     LIBO_LIBEXEC_FOLDER=MacOS
3085     LIBO_LIB_FOLDER=Frameworks
3086     LIBO_LIB_PYUNO_FOLDER=Resources
3087     LIBO_SHARE_FOLDER=Resources
3088     LIBO_SHARE_HELP_FOLDER=Resources/help
3089     LIBO_SHARE_JAVA_FOLDER=Resources/java
3090     LIBO_SHARE_PRESETS_FOLDER=Resources/presets
3091     LIBO_SHARE_READMES_FOLDER=Resources/readmes
3092     LIBO_SHARE_RESOURCE_FOLDER=Resources/resource
3093     LIBO_SHARE_SHELL_FOLDER=Resources/shell
3094     LIBO_URE_BIN_FOLDER=MacOS
3095     LIBO_URE_ETC_FOLDER=Resources/ure/etc
3096     LIBO_URE_LIB_FOLDER=Frameworks
3097     LIBO_URE_MISC_FOLDER=Resources/ure/share/misc
3098     LIBO_URE_SHARE_JAVA_FOLDER=Resources/java
3099 elif test $_os = WINNT; then
3100     LIBO_BIN_FOLDER=program
3101     LIBO_ETC_FOLDER=program
3102     LIBO_LIBEXEC_FOLDER=program
3103     LIBO_LIB_FOLDER=program
3104     LIBO_LIB_PYUNO_FOLDER=program
3105     LIBO_SHARE_FOLDER=share
3106     LIBO_SHARE_HELP_FOLDER=help
3107     LIBO_SHARE_JAVA_FOLDER=program/classes
3108     LIBO_SHARE_PRESETS_FOLDER=presets
3109     LIBO_SHARE_READMES_FOLDER=readmes
3110     LIBO_SHARE_RESOURCE_FOLDER=program/resource
3111     LIBO_SHARE_SHELL_FOLDER=program/shell
3112     LIBO_URE_BIN_FOLDER=program
3113     LIBO_URE_ETC_FOLDER=program
3114     LIBO_URE_LIB_FOLDER=program
3115     LIBO_URE_MISC_FOLDER=program
3116     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3117 else
3118     LIBO_BIN_FOLDER=program
3119     LIBO_ETC_FOLDER=program
3120     LIBO_LIBEXEC_FOLDER=program
3121     LIBO_LIB_FOLDER=program
3122     LIBO_LIB_PYUNO_FOLDER=program
3123     LIBO_SHARE_FOLDER=share
3124     LIBO_SHARE_HELP_FOLDER=help
3125     LIBO_SHARE_JAVA_FOLDER=program/classes
3126     LIBO_SHARE_PRESETS_FOLDER=presets
3127     LIBO_SHARE_READMES_FOLDER=readmes
3128     if test "$enable_fuzzers" != yes; then
3129         LIBO_SHARE_RESOURCE_FOLDER=program/resource
3130     else
3131         LIBO_SHARE_RESOURCE_FOLDER=resource
3132     fi
3133     LIBO_SHARE_SHELL_FOLDER=program/shell
3134     LIBO_URE_BIN_FOLDER=program
3135     LIBO_URE_ETC_FOLDER=program
3136     LIBO_URE_LIB_FOLDER=program
3137     LIBO_URE_MISC_FOLDER=program
3138     LIBO_URE_SHARE_JAVA_FOLDER=program/classes
3140 AC_DEFINE_UNQUOTED(LIBO_BIN_FOLDER,"$LIBO_BIN_FOLDER")
3141 AC_DEFINE_UNQUOTED(LIBO_ETC_FOLDER,"$LIBO_ETC_FOLDER")
3142 AC_DEFINE_UNQUOTED(LIBO_LIBEXEC_FOLDER,"$LIBO_LIBEXEC_FOLDER")
3143 AC_DEFINE_UNQUOTED(LIBO_LIB_FOLDER,"$LIBO_LIB_FOLDER")
3144 AC_DEFINE_UNQUOTED(LIBO_LIB_PYUNO_FOLDER,"$LIBO_LIB_PYUNO_FOLDER")
3145 AC_DEFINE_UNQUOTED(LIBO_SHARE_FOLDER,"$LIBO_SHARE_FOLDER")
3146 AC_DEFINE_UNQUOTED(LIBO_SHARE_HELP_FOLDER,"$LIBO_SHARE_HELP_FOLDER")
3147 AC_DEFINE_UNQUOTED(LIBO_SHARE_JAVA_FOLDER,"$LIBO_SHARE_JAVA_FOLDER")
3148 AC_DEFINE_UNQUOTED(LIBO_SHARE_PRESETS_FOLDER,"$LIBO_SHARE_PRESETS_FOLDER")
3149 AC_DEFINE_UNQUOTED(LIBO_SHARE_RESOURCE_FOLDER,"$LIBO_SHARE_RESOURCE_FOLDER")
3150 AC_DEFINE_UNQUOTED(LIBO_SHARE_SHELL_FOLDER,"$LIBO_SHARE_SHELL_FOLDER")
3151 AC_DEFINE_UNQUOTED(LIBO_URE_BIN_FOLDER,"$LIBO_URE_BIN_FOLDER")
3152 AC_DEFINE_UNQUOTED(LIBO_URE_ETC_FOLDER,"$LIBO_URE_ETC_FOLDER")
3153 AC_DEFINE_UNQUOTED(LIBO_URE_LIB_FOLDER,"$LIBO_URE_LIB_FOLDER")
3154 AC_DEFINE_UNQUOTED(LIBO_URE_MISC_FOLDER,"$LIBO_URE_MISC_FOLDER")
3155 AC_DEFINE_UNQUOTED(LIBO_URE_SHARE_JAVA_FOLDER,"$LIBO_URE_SHARE_JAVA_FOLDER")
3157 # Not all of them needed in config_host.mk, add more if need arises
3158 AC_SUBST(LIBO_BIN_FOLDER)
3159 AC_SUBST(LIBO_ETC_FOLDER)
3160 AC_SUBST(LIBO_LIB_FOLDER)
3161 AC_SUBST(LIBO_LIB_PYUNO_FOLDER)
3162 AC_SUBST(LIBO_SHARE_FOLDER)
3163 AC_SUBST(LIBO_SHARE_HELP_FOLDER)
3164 AC_SUBST(LIBO_SHARE_JAVA_FOLDER)
3165 AC_SUBST(LIBO_SHARE_PRESETS_FOLDER)
3166 AC_SUBST(LIBO_SHARE_READMES_FOLDER)
3167 AC_SUBST(LIBO_SHARE_RESOURCE_FOLDER)
3168 AC_SUBST(LIBO_URE_BIN_FOLDER)
3169 AC_SUBST(LIBO_URE_ETC_FOLDER)
3170 AC_SUBST(LIBO_URE_LIB_FOLDER)
3171 AC_SUBST(LIBO_URE_MISC_FOLDER)
3172 AC_SUBST(LIBO_URE_SHARE_JAVA_FOLDER)
3174 dnl ===================================================================
3175 dnl Windows specific tests and stuff
3176 dnl ===================================================================
3178 reg_get_value()
3180     # Return value: $regvalue
3181     unset regvalue
3183     local _regentry="/proc/registry${1}/${2}"
3184     if test -f "$_regentry"; then
3185         # Stop bash complaining about \0 bytes in input, as it can't handle them.
3186         # Registry keys read via /proc/registry* are always \0 terminated!
3187         local _regvalue=$(tr -d '\0' < "$_regentry")
3188         if test $? -eq 0; then
3189             regvalue=$_regvalue
3190         fi
3191     fi
3194 # Get a value from the 32-bit side of the Registry
3195 reg_get_value_32()
3197     reg_get_value "32" "$1"
3200 # Get a value from the 64-bit side of the Registry
3201 reg_get_value_64()
3203     reg_get_value "64" "$1"
3206 if test "$_os" = "WINNT"; then
3207     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
3208     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
3209         AC_MSG_RESULT([no])
3210         WINDOWS_SDK_ARCH="x86"
3211     else
3212         AC_MSG_RESULT([yes])
3213         WINDOWS_SDK_ARCH="x64"
3214         BITNESS_OVERRIDE=64
3215     fi
3217 if test "$_os" = "iOS"; then
3218     cross_compiling="yes"
3221 if test "$cross_compiling" = "yes"; then
3222     export CROSS_COMPILING=TRUE
3223 else
3224     CROSS_COMPILING=
3225     BUILD_TYPE="$BUILD_TYPE NATIVE"
3227 AC_SUBST(CROSS_COMPILING)
3229 # Use -isystem (gcc) if possible, to avoid warnings in 3rd party headers.
3230 # NOTE: must _not_ be used for bundled external libraries!
3231 ISYSTEM=
3232 if test "$GCC" = "yes"; then
3233     AC_MSG_CHECKING( for -isystem )
3234     save_CFLAGS=$CFLAGS
3235     CFLAGS="$CFLAGS -Werror"
3236     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM="-isystem " ],[])
3237     CFLAGS=$save_CFLAGS
3238     if test -n "$ISYSTEM"; then
3239         AC_MSG_RESULT(yes)
3240     else
3241         AC_MSG_RESULT(no)
3242     fi
3244 if test -z "$ISYSTEM"; then
3245     # fall back to using -I
3246     ISYSTEM=-I
3248 AC_SUBST(ISYSTEM)
3250 dnl ===================================================================
3251 dnl  Check which Visual Studio compiler is used
3252 dnl ===================================================================
3254 map_vs_year_to_version()
3256     # Return value: $vsversion
3258     unset vsversion
3260     case $1 in
3261     2017)
3262         vsversion=15;;
3263     2019)
3264         vsversion=16;;
3265     *)
3266         AC_MSG_ERROR([Assertion failure - invalid argument "$1" to map_vs_year_to_version()]);;
3267     esac
3270 vs_versions_to_check()
3272     # Args: $1 (optional) : versions to check, in the order of preference
3273     # Return value: $vsversions
3275     unset vsversions
3277     if test -n "$1"; then
3278         map_vs_year_to_version "$1"
3279         vsversions=$vsversion
3280     else
3281         # We accept only 2017
3282         vsversions="15"
3283     fi
3286 win_get_env_from_vsvars32bat()
3288     WRAPPERBATCHFILEPATH="`mktemp -t wrpXXXXXX.bat`"
3289     # Also seems to be located in another directory under the same name: vsvars32.bat
3290     # https://github.com/bazelbuild/bazel/blob/master/src/main/native/build_windows_jni.sh#L56-L57
3291     printf '@call "%s/../Common7/Tools/VsDevCmd.bat" /no_logo\r\n' "$(cygpath -w $VC_PRODUCT_DIR)" > $WRAPPERBATCHFILEPATH
3292     printf '@setlocal\r\n@echo %%%s%%\r\n@endlocal\r\n' "$1" >> $WRAPPERBATCHFILEPATH
3293     chmod +x $WRAPPERBATCHFILEPATH
3294     _win_get_env_from_vsvars32bat=$("$WRAPPERBATCHFILEPATH" | tr -d '\r')
3295     rm -f $WRAPPERBATCHFILEPATH
3296     printf '%s' "$_win_get_env_from_vsvars32bat"
3299 find_ucrt()
3301     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/InstallationFolder"
3302     if test -n "$regvalue"; then
3303         PathFormat "$regvalue"
3304         UCRTSDKDIR=$formatted_path
3305         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v10.0/ProductVersion"
3306         UCRTVERSION=$regvalue
3307         # Rest if not exist
3308         if ! test -d "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"; then
3309           UCRTSDKDIR=
3310         fi
3311     fi
3312     if test -z "$UCRTSDKDIR"; then
3313         ide_env_dir="$VC_PRODUCT_DIR/../Common7/Tools/"
3314         ide_env_file="${ide_env_dir}VsDevCmd.bat"
3315         if test -f "$ide_env_file"; then
3316             PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
3317             UCRTSDKDIR=$formatted_path
3318             UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
3319             dnl Hack needed at least by tml:
3320             if test "$UCRTVERSION" = 10.0.15063.0 \
3321                 -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
3322                 -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
3323             then
3324                 UCRTVERSION=10.0.14393.0
3325             fi
3326         else
3327           AC_MSG_ERROR([No UCRT found])
3328         fi
3329     fi
3332 find_msvc()
3334     # Find Visual C++ 2017/2019
3335     # Args: $1 (optional) : The VS version year
3336     # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber
3338     unset vctest vcnum vcnumwithdot vcbuildnumber
3340     vs_versions_to_check "$1"
3341     vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
3342     vswhere+="\\Microsoft Visual Studio\\Installer\\vswhere.exe"
3343     PathFormat "$vswhere"
3344     vswhere=$formatted_path
3345     for ver in $vsversions; do
3346         vswhereoutput=`$vswhere -version "@<:@ $ver , $(expr $ver + 1) @:}@" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath | head -1`
3347         if test -n "$vswhereoutput"; then
3348             PathFormat "$vswhereoutput"
3349             vctest=$formatted_path
3350             break
3351         fi
3352     done
3354     # This fallback is needed on *some* (but not all) VS 2017 installations, where vswhere turns up
3355     # with the empty list for unclear reason. The below hack does not work for VS 2019 anyway, so
3356     # should be removed when upgrading baseline.
3357     if ! test -n "$vctest"; then
3358         for ver in $vsversions; do
3359             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver.0/Setup/VC/ProductDir
3360             if test -n "$regvalue"; then
3361                 vctest=$regvalue
3362                 break
3363             fi
3364             reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver.0
3365             if test -n "$regvalue"; then
3366                 AC_MSG_RESULT([found: $regvalue])
3367                 PathFormat "$regvalue"
3368                 vctest=$formatted_path
3369                 break
3370             fi
3371         done
3372     fi
3374     if test -n "$vctest"; then
3375         vcnumwithdot="$ver.0"
3376         case "$vcnumwithdot" in
3377         15.0)
3378             vcyear=2017
3379             vcnum=150
3380             ;;
3381         16.0)
3382             vcyear=2019
3383             vcnum=160
3384             ;;
3385         esac
3386         vcbuildnumber=`ls $vctest/VC/Tools/MSVC -A1r | head -1`
3388     fi
3391 SOLARINC=
3392 MSBUILD_PATH=
3393 DEVENV=
3394 if test "$_os" = "WINNT"; then
3395     AC_MSG_CHECKING([Visual C++])
3396     find_msvc "$with_visual_studio"
3397     if test -z "$vctest"; then
3398         if test -n "$with_visual_studio"; then
3399             AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
3400         else
3401             AC_MSG_ERROR([no Visual Studio 2017 installation found])
3402         fi
3403     fi
3405     if test "$BITNESS_OVERRIDE" = ""; then
3406         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86/cl.exe"; then
3407             VC_PRODUCT_DIR=$vctest/VC
3408         else
3409             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX86/x86])
3410         fi
3411     else
3412         if test -f "$vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe"; then
3413             VC_PRODUCT_DIR=$vctest/VC
3414         else
3415             AC_MSG_ERROR([no compiler (cl.exe) in $vctest/VC/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64])
3416         fi
3417     fi
3418     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3420     AC_MSG_CHECKING([for short pathname of VC product directory])
3421     VC_PRODUCT_DIR=`win_short_path_for_make "$VC_PRODUCT_DIR"`
3422     AC_MSG_RESULT([$VC_PRODUCT_DIR])
3424     UCRTSDKDIR=
3425     UCRTVERSION=
3427     AC_MSG_CHECKING([for UCRT location])
3428     find_ucrt
3429     # find_ucrt errors out if it doesn't find it
3430     AC_MSG_RESULT([found])
3431     PathFormat "${UCRTSDKDIR}Include/$UCRTVERSION/ucrt"
3432     ucrtincpath_formatted=$formatted_path
3433     # SOLARINC is used for external modules and must be set too.
3434     # And no, it's not sufficient to set SOLARINC only, as configure
3435     # itself doesn't honour it.
3436     SOLARINC="$SOLARINC -I$ucrtincpath_formatted"
3437     CFLAGS="$CFLAGS -I$ucrtincpath_formatted"
3438     CXXFLAGS="$CXXFLAGS -I$ucrtincpath_formatted"
3439     CPPFLAGS="$CPPFLAGS -I$ucrtincpath_formatted"
3441     AC_SUBST(UCRTSDKDIR)
3442     AC_SUBST(UCRTVERSION)
3444     AC_MSG_CHECKING([for MSBuild.exe location for: $vcnumwithdot])
3445     # Find the proper version of MSBuild.exe to use based on the VS version
3446     reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MSBuild/$vcnumwithdot/MSBuildOverrideTasksPath
3447     if test -n "$regvalue" ; then
3448         AC_MSG_RESULT([found: $regvalue])
3449         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3450     else
3451         if test "$vcnumwithdot" = "16.0"; then
3452             if test "$BITNESS_OVERRIDE" = ""; then
3453                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin"
3454             else
3455                 regvalue="$VC_PRODUCT_DIR/../MSBuild/Current/Bin/amd64"
3456             fi
3457         else
3458             if test "$BITNESS_OVERRIDE" = ""; then
3459                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin"
3460             else
3461                 regvalue="$VC_PRODUCT_DIR/../MSBuild/$vcnumwithdot/Bin/amd64"
3462             fi
3463         fi
3464         MSBUILD_PATH=`win_short_path_for_make "$regvalue"`
3465         AC_MSG_RESULT([$regvalue])
3466     fi
3468     # Find the version of devenv.exe
3469     # MSVC 2017 devenv does not start properly from a DOS 8.3 path
3470     DEVENV=$(cygpath -lm "$VC_PRODUCT_DIR/../Common7/IDE/devenv.exe")
3471     if test ! -e "$DEVENV"; then
3472         AC_MSG_ERROR([No devenv.exe found, Visual Studio installation broken?])
3473     fi
3475     dnl ===========================================================
3476     dnl  Check for the corresponding mspdb*.dll
3477     dnl ===========================================================
3479     VC_HOST_DIR=
3480     MSPDB_PATH=
3481     CL_PATH=
3483     if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/HostX64/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3484         VC_HOST_DIR="HostX64"
3485         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3486     else
3487         VC_HOST_DIR="HostX86"
3488         MSPDB_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3489     fi
3491     if test "$BITNESS_OVERRIDE" = ""; then
3492         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86"
3493     else
3494         CL_PATH="$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64"
3495     fi
3497     # MSVC 15.0 has libraries from 14.0?
3498     mspdbnum="140"
3500     if test ! -e "$MSPDB_PATH/mspdb${mspdbnum}.dll"; then
3501         AC_MSG_ERROR([No mspdb${mspdbnum}.dll in $MSPDB_PATH, Visual Studio installation broken?])
3502     fi
3504     dnl The path needs to be added before cl is called
3505     TEMP_PATH=`cygpath -d "$MSPDB_PATH"`
3506     PATH="`cygpath -u "$TEMP_PATH"`:$PATH"
3508     AC_MSG_CHECKING([cl.exe])
3510     # Is there really ever a need to pass CC explicitly? Surely we can hope to get all the
3511     # automagical niceness to work OK? If somebody has some unsupported compiler in some weird
3512     # location, isn't it likely that lots of other things needs changes, too, and just setting CC
3513     # is not enough?
3515     dnl Save the true MSVC cl.exe for use when CC/CXX is actually clang-cl,
3516     dnl needed when building CLR code:
3517     if test -z "$MSVC_CXX"; then
3518         if test -f "$CL_PATH/cl.exe"; then
3519             MSVC_CXX="$CL_PATH/cl.exe"
3520         fi
3522         # This gives us a posix path with 8.3 filename restrictions
3523         MSVC_CXX=`win_short_path_for_make "$MSVC_CXX"`
3524         CXX_BASE=`first_arg_basename "$MSVC_CXX"`
3525     fi
3527     if test -z "$CC"; then
3528         CC=$MSVC_CXX
3529         CC_BASE=`first_arg_basename "$CC"`
3530     fi
3531     if test "$BITNESS_OVERRIDE" = ""; then
3532         dnl since MSVC 2012, default for x86 is -arch:SSE2:
3533         MSVC_CXX="$MSVC_CXX -arch:SSE"
3534     fi
3536     if test -n "$CC"; then
3537         # Remove /cl.exe from CC case insensitive
3538         AC_MSG_RESULT([found Visual C++ $vcyear ($CC)])
3539         if test "$BITNESS_OVERRIDE" = ""; then
3540            COMPATH="$VC_PRODUCT_DIR"
3541         else
3542             if test -n "$VC_PRODUCT_DIR"; then
3543                 COMPATH=$VC_PRODUCT_DIR
3544             fi
3545         fi
3546         if test "$BITNESS_OVERRIDE" = ""; then
3547             dnl since MSVC 2012, default for x86 is -arch:SSE2:
3548             CC="$CC -arch:SSE"
3549         fi
3551         COMPATH="$COMPATH/Tools/MSVC/$vcbuildnumber"
3553         export INCLUDE=`cygpath -d "$COMPATH\Include"`
3555         PathFormat "$COMPATH"
3556         COMPATH=`win_short_path_for_make "$formatted_path"`
3558         VCVER=$vcnum
3559         MSVSVER=$vcyear
3561         # The WINDOWS_SDK_ACCEPTABLE_VERSIONS is mostly an educated guess...  Assuming newer ones
3562         # are always "better", we list them in reverse chronological order.
3564         case "$vcnum" in
3565         150|160)
3566             WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
3567             ;;
3568         esac
3570         # The expectation is that --with-windows-sdk should not need to be used
3571         if test -n "$with_windows_sdk"; then
3572             case " $WINDOWS_SDK_ACCEPTABLE_VERSIONS " in
3573             *" "$with_windows_sdk" "*)
3574                 WINDOWS_SDK_ACCEPTABLE_VERSIONS=$with_windows_sdk
3575                 ;;
3576             *)
3577                 AC_MSG_ERROR([Windows SDK $with_windows_sdk is not known to work with VS $MSVSVER])
3578                 ;;
3579             esac
3580         fi
3582         # Make AC_COMPILE_IFELSE etc. work (set by AC_PROG_C, which we don't use for MSVC)
3583         ac_objext=obj
3584         ac_exeext=exe
3586     else
3587         AC_MSG_ERROR([Visual C++ not found after all, huh])
3588     fi
3590     AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2017 version 15.7])
3591     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3592         // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
3593         // between Visual Studio versions and _MSC_VER:
3594         #if _MSC_VER < 1914
3595         #error
3596         #endif
3597     ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
3599     # Check for 64-bit (cross-)compiler to use to build the 64-bit
3600     # version of the Explorer extension (and maybe other small
3601     # bits, too) needed when installing a 32-bit LibreOffice on a
3602     # 64-bit OS. The 64-bit Explorer extension is a feature that
3603     # has been present since long in OOo. Don't confuse it with
3604     # building LibreOffice itself as 64-bit code.
3606     BUILD_X64=
3607     CXX_X64_BINARY=
3609     if test "$BITNESS_OVERRIDE" = ""; then
3610         AC_MSG_CHECKING([for a x64 compiler and libraries for 64-bit Explorer extensions])
3611         if test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/x64/atls.lib" || \
3612              test -f "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/atlmfc/lib/spectre/x64/atls.lib"; then
3613             if "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe" -? </dev/null >/dev/null 2>&1; then
3614                 BUILD_X64=TRUE
3615                 CXX_X64_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x64/cl.exe"`
3616             fi
3617         fi
3618         if test "$BUILD_X64" = TRUE; then
3619             AC_MSG_RESULT([found])
3620         else
3621             AC_MSG_RESULT([not found])
3622             AC_MSG_WARN([Installation set will not contain 64-bit Explorer extensions])
3623         fi
3624     else
3625         CXX_X64_BINARY=$MSVC_CXX
3626     fi
3627     AC_SUBST(BUILD_X64)
3629     # These are passed to the environment and then used in gbuild/platform/com_MSC_class.mk
3630     AC_SUBST(CXX_X64_BINARY)
3632     # Check for 32-bit compiler to use to build the 32-bit TWAIN shim
3633     # needed to support TWAIN scan on both 32- and 64-bit systems
3635     BUILD_X86=
3637     if test "$BITNESS_OVERRIDE" = "64"; then
3638         AC_MSG_CHECKING([for a x86 compiler and libraries for 32-bit binaries required for TWAIN support])
3639         if test -n "$CXX_X86_BINARY"; then
3640             BUILD_X86=TRUE
3641             AC_MSG_RESULT([preset])
3642         elif "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe" -? </dev/null >/dev/null 2>&1; then
3643             BUILD_X86=TRUE
3644             CXX_X86_BINARY=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/MSVC/$vcbuildnumber/bin/$VC_HOST_DIR/x86/cl.exe"`
3645             CXX_X86_BINARY+=" /arch:SSE"
3646             AC_MSG_RESULT([found])
3647         else
3648             CXX_X86_BINARY=
3649             AC_MSG_RESULT([not found])
3650             AC_MSG_WARN([Installation set will not contain 32-bit binaries required for TWAIN support])
3651         fi
3652     else
3653         BUILD_X86=TRUE
3654         CXX_X86_BINARY=$MSVC_CXX
3655     fi
3656     AC_SUBST(BUILD_X86)
3657     AC_SUBST(CXX_X86_BINARY)
3659 AC_SUBST(VCVER)
3660 AC_SUBST(DEVENV)
3661 AC_SUBST(MSVC_CXX)
3664 # unowinreg.dll
3666 UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
3667 AC_SUBST(UNOWINREG_DLL)
3669 COM_IS_CLANG=
3670 AC_MSG_CHECKING([whether the compiler is actually Clang])
3671 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3672     #ifndef __clang__
3673     you lose
3674     #endif
3675     int foo=42;
3676     ]])],
3677     [AC_MSG_RESULT([yes])
3678      COM_IS_CLANG=TRUE],
3679     [AC_MSG_RESULT([no])])
3680 AC_SUBST(COM_IS_CLANG)
3682 CC_PLAIN=$CC
3683 CLANGVER=
3684 if test "$COM_IS_CLANG" = TRUE; then
3685     AC_MSG_CHECKING([whether Clang is new enough])
3686     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3687         #if !defined __apple_build_version__
3688         #error
3689         #endif
3690         ]])],
3691         [my_apple_clang=yes],[my_apple_clang=])
3692     if test "$my_apple_clang" = yes; then
3693         AC_MSG_RESULT([assumed yes (Apple Clang)])
3694     else
3695         if test "$_os" = WINNT; then
3696             dnl In which case, assume clang-cl:
3697             my_args="/EP /TC"
3698             dnl Filter out -FIIntrin.h, which needs to be explicitly stated for
3699             dnl clang-cl:
3700             CC_PLAIN=
3701             for i in $CC; do
3702                 case $i in
3703                 -FIIntrin.h)
3704                     ;;
3705                 *)
3706                     CC_PLAIN="$CC_PLAIN $i"
3707                     ;;
3708                 esac
3709             done
3710         else
3711             my_args="-E -P"
3712         fi
3713         clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC_PLAIN $my_args - | sed 's/ //g'`
3714         CLANG_FULL_VERSION=`echo __clang_version__ | $CC_PLAIN $my_args -`
3715         CLANGVER=`echo $clang_version \
3716             | $AWK -F. '{ print \$1*10000+(\$2<100?\$2:99)*100+(\$3<100?\$3:99) }'`
3717         if test "$CLANGVER" -ge 50002; then
3718             AC_MSG_RESULT([yes ($clang_version)])
3719         else
3720             AC_MSG_ERROR(["$CLANG_FULL_VERSION" is too old or unrecognized, must be at least Clang 5.0.2])
3721         fi
3722         AC_DEFINE_UNQUOTED(CLANG_VERSION,$CLANGVER)
3723         AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
3724     fi
3727 SHOWINCLUDES_PREFIX=
3728 if test "$_os" = WINNT; then
3729     dnl We need to guess the prefix of the -showIncludes output, it can be
3730     dnl localized
3731     AC_MSG_CHECKING([the dependency generation prefix (cl.exe -showIncludes)])
3732     echo "#include <stdlib.h>" > conftest.c
3733     SHOWINCLUDES_PREFIX=`$CC_PLAIN $CFLAGS -c -showIncludes conftest.c 2>/dev/null | \
3734         grep 'stdlib\.h' | head -n1 | sed 's/ [[[:alpha:]]]:.*//'`
3735     rm -f conftest.c conftest.obj
3736     if test -z "$SHOWINCLUDES_PREFIX"; then
3737         AC_MSG_ERROR([cannot determine the -showIncludes prefix])
3738     else
3739         AC_MSG_RESULT(["$SHOWINCLUDES_PREFIX"])
3740     fi
3742 AC_SUBST(SHOWINCLUDES_PREFIX)
3745 # prefix C with ccache if needed
3747 if test "$CCACHE" != ""; then
3748     AC_MSG_CHECKING([whether $CC_BASE is already ccached])
3750     AC_LANG_PUSH([C])
3751     save_CFLAGS=$CFLAGS
3752     CFLAGS="$CFLAGS --ccache-skip -O2"
3753     dnl an empty program will do, we're checking the compiler flags
3754     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
3755                       [use_ccache=yes], [use_ccache=no])
3756     if test $use_ccache = yes; then
3757         AC_MSG_RESULT([yes])
3758     else
3759         CC="$CCACHE $CC"
3760         CC_BASE="ccache $CC_BASE"
3761         AC_MSG_RESULT([no])
3762     fi
3763     CFLAGS=$save_CFLAGS
3764     AC_LANG_POP([C])
3767 # ===================================================================
3768 # check various GCC options that Clang does not support now but maybe
3769 # will somewhen in the future, check them even for GCC, so that the
3770 # flags are set
3771 # ===================================================================
3773 HAVE_GCC_GGDB2=
3774 if test "$GCC" = "yes"; then
3775     AC_MSG_CHECKING([whether $CC_BASE supports -ggdb2])
3776     save_CFLAGS=$CFLAGS
3777     CFLAGS="$CFLAGS -Werror -ggdb2"
3778     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_GGDB2=TRUE ],[])
3779     CFLAGS=$save_CFLAGS
3780     if test "$HAVE_GCC_GGDB2" = "TRUE"; then
3781         AC_MSG_RESULT([yes])
3782     else
3783         AC_MSG_RESULT([no])
3784     fi
3786     if test "$host_cpu" = "m68k"; then
3787         AC_MSG_CHECKING([whether $CC_BASE supports -mlong-jump-table-offsets])
3788         save_CFLAGS=$CFLAGS
3789         CFLAGS="$CFLAGS -Werror -mlong-jump-table-offsets"
3790         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_LONG_JUMP_TABLE_OFFSETS=TRUE ],[])
3791         CFLAGS=$save_CFLAGS
3792         if test "$HAVE_GCC_LONG_JUMP_TABLE_OFFSETS" = "TRUE"; then
3793             AC_MSG_RESULT([yes])
3794         else
3795             AC_MSG_ERROR([no])
3796         fi
3797     fi
3799 AC_SUBST(HAVE_GCC_GGDB2)
3801 dnl ===================================================================
3802 dnl  Test the gcc version
3803 dnl ===================================================================
3804 if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
3805     AC_MSG_CHECKING([the GCC version])
3806     _gcc_version=`$CC -dumpversion`
3807     gcc_full_version=$(printf '%s' "$_gcc_version" | \
3808         $AWK -F. '{ print $1*10000+$2*100+(NF<3?1:$3) }')
3809     GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
3811     AC_MSG_RESULT([gcc $_gcc_version ($gcc_full_version)])
3813     if test "$gcc_full_version" -lt 70000; then
3814         AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 7.0.0])
3815     fi
3816 else
3817     # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
3818     # GCC version should generally be checked only when handling GCC-specific bugs, for testing
3819     # things like features configure checks should be used, otherwise they may e.g. fail with Clang
3820     # (which reports itself as GCC 4.2.1).
3821     GCC_VERSION=
3823 AC_SUBST(GCC_VERSION)
3825 dnl Set the ENABLE_DBGUTIL variable
3826 dnl ===================================================================
3827 AC_MSG_CHECKING([whether to build with additional debug utilities])
3828 if test -n "$enable_dbgutil" -a "$enable_dbgutil" != "no"; then
3829     ENABLE_DBGUTIL="TRUE"
3830     # this is an extra var so it can have different default on different MSVC
3831     # versions (in case there are version specific problems with it)
3832     MSVC_USE_DEBUG_RUNTIME="TRUE"
3834     AC_MSG_RESULT([yes])
3835     # cppunit and graphite expose STL in public headers
3836     if test "$with_system_cppunit" = "yes"; then
3837         AC_MSG_ERROR([--with-system-cppunit conflicts with --enable-dbgutil])
3838     else
3839         with_system_cppunit=no
3840     fi
3841     if test "$with_system_graphite" = "yes"; then
3842         AC_MSG_ERROR([--with-system-graphite conflicts with --enable-dbgutil])
3843     else
3844         with_system_graphite=no
3845     fi
3846     if test "$with_system_orcus" = "yes"; then
3847         AC_MSG_ERROR([--with-system-orcus conflicts with --enable-dbgutil])
3848     else
3849         with_system_orcus=no
3850     fi
3851     if test "$with_system_libcmis" = "yes"; then
3852         AC_MSG_ERROR([--with-system-libcmis conflicts with --enable-dbgutil])
3853     else
3854         with_system_libcmis=no
3855     fi
3856     if test "$with_system_hunspell" = "yes"; then
3857         AC_MSG_ERROR([--with-system-hunspell conflicts with --enable-dbgutil])
3858     else
3859         with_system_hunspell=no
3860     fi
3861     if test "$with_system_gpgmepp" = "yes"; then
3862         AC_MSG_ERROR([--with-system-gpgmepp conflicts with --enable-dbgutil])
3863     else
3864         with_system_gpgmepp=no
3865     fi
3866     # As mixing system libwps and non-system libnumbertext or vice versa likely causes trouble (see
3867     # 603074c5f2b84de8a24593faf807da784b040625 "Pass _GLIBCXX_DEBUG into external/libwps" and the
3868     # mail thread starting at <https://gcc.gnu.org/ml/gcc/2018-05/msg00057.html> "libstdc++: ODR
3869     # violation when using std::regex with and without -D_GLIBCXX_DEBUG"), simply make sure neither
3870     # of those two is using the system variant:
3871     if test "$with_system_libnumbertext" = "yes"; then
3872         AC_MSG_ERROR([--with-system-libnumbertext conflicts with --enable-dbgutil])
3873     else
3874         with_system_libnumbertext=no
3875     fi
3876     if test "$with_system_libwps" = "yes"; then
3877         AC_MSG_ERROR([--with-system-libwps conflicts with --enable-dbgutil])
3878     else
3879         with_system_libwps=no
3880     fi
3881 else
3882     ENABLE_DBGUTIL=""
3883     MSVC_USE_DEBUG_RUNTIME=""
3884     AC_MSG_RESULT([no])
3886 AC_SUBST(ENABLE_DBGUTIL)
3887 AC_SUBST(MSVC_USE_DEBUG_RUNTIME)
3889 dnl Set the ENABLE_DEBUG variable.
3890 dnl ===================================================================
3891 if test -n "$enable_debug" && test "$enable_debug" != "yes" && test "$enable_debug" != "no"; then
3892     AC_MSG_ERROR([--enable-debug now accepts only yes or no, use --enable-symbols])
3894 if test -n "$ENABLE_DBGUTIL" -a "$enable_debug" = "no"; then
3895     if test -z "$libo_fuzzed_enable_debug"; then
3896         AC_MSG_ERROR([--disable-debug cannot be used with --enable-dbgutil])
3897     else
3898         AC_MSG_NOTICE([Resetting --enable-debug=yes])
3899         enable_debug=yes
3900     fi
3903 AC_MSG_CHECKING([whether to do a debug build])
3904 if test -n "$ENABLE_DBGUTIL" -o \( -n "$enable_debug" -a "$enable_debug" != "no" \) ; then
3905     ENABLE_DEBUG="TRUE"
3906     if test -n "$ENABLE_DBGUTIL" ; then
3907         AC_MSG_RESULT([yes (dbgutil)])
3908     else
3909         AC_MSG_RESULT([yes])
3910     fi
3911 else
3912     ENABLE_DEBUG=""
3913     AC_MSG_RESULT([no])
3915 AC_SUBST(ENABLE_DEBUG)
3917 AC_MSG_CHECKING([whether special RTTI visibility flags are needed for Clang Linux UBSan])
3918 NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY=
3919 dnl Clang 9 is known fixed since
3920 dnl <https://github.com/llvm/llvm-project/commit/5745eccef54ddd3caca278d1d292a88b2281528b> "Adapt
3921 dnl -fsanitize=function to SANITIZER_NON_UNIQUE_TYPEINFO":
3922 if test "$COM_IS_CLANG" = TRUE -a "$_os" = Linux; then
3923     if test "$CLANGVER" -lt 90000; then
3924         for i in $CC; do
3925             case $i in
3926             -fsanitize=*)
3927                 NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY=TRUE
3928                 break
3929                 ;;
3930             esac
3931         done
3932     fi
3934 if test "$NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY" = TRUE; then
3935     AC_MSG_RESULT([yes])
3936 else
3937     AC_MSG_RESULT([no])
3939 AC_SUBST([NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY])
3941 dnl ===================================================================
3942 dnl Select the linker to use (gold/lld/ld.bfd).
3943 dnl This is done only after compiler checks (need to know if Clang is
3944 dnl used, for different defaults) and after checking if a debug build
3945 dnl is wanted (non-debug builds get the default linker if not explicitly
3946 dnl specified otherwise).
3947 dnl All checks for linker features/options should come after this.
3948 dnl ===================================================================
3949 check_use_ld()
3951     use_ld=$1
3952     use_ld_fail_if_error=$2
3953     use_ld_ok=
3954     AC_MSG_CHECKING([for -fuse-ld=$use_ld linker support])
3955     use_ld_ldflags_save="$LDFLAGS"
3956     LDFLAGS="$LDFLAGS -fuse-ld=$use_ld"
3957     AC_LINK_IFELSE([AC_LANG_PROGRAM([
3958 #include <stdio.h>
3959         ],[
3960 printf ("hello world\n");
3961         ])], USE_LD=$use_ld, [])
3962     if test -n "$USE_LD"; then
3963         AC_MSG_RESULT( yes )
3964         use_ld_ok=yes
3965         dnl For obscure reasons, unxgcc.mk uses the --dynamic-list-cpp-typeinfo linker option
3966         dnl if NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY, and lld doesn't support this option.
3967         if test -n "$NEED_CLANG_LINUX_UBSAN_RTTI_VISIBILITY"; then
3968             AC_MSG_CHECKING([for --dynamic-list-cpp-typeinfo linker support (-fuse-ld=$use_ld)])
3969             use_ld_ldflags_save_2="$LDFLAGS"
3970             LDFLAGS="$LDFLAGS -Wl,--dynamic-list-cpp-typeinfo"
3971             use_ld_has_cpp_typeinfo=
3972             AC_LINK_IFELSE([AC_LANG_PROGRAM([
3973 #include <stdio.h>
3974                 ],[
3975 printf ("hello world\n");
3976                 ])], use_ld_has_cpp_typeinfo=yes, [])
3977             LDFLAGS="$use_ld_ldflags_save_2"
3978             if test -n "$use_ld_has_cpp_typeinfo"; then
3979                 AC_MSG_RESULT( yes )
3980             else
3981                 if test -n "$use_ld_fail_if_error"; then
3982                     AC_MSG_ERROR( no )
3983                 else
3984                     AC_MSG_RESULT( no )
3985                 fi
3986                 use_ld_ok=
3987             fi
3988         fi
3989     else
3990         if test -n "$use_ld_fail_if_error"; then
3991             AC_MSG_ERROR( no )
3992         else
3993             AC_MSG_RESULT( no )
3994         fi
3995     fi
3996     if test -n "$use_ld_ok"; then
3997         dnl keep the value of LDFLAGS
3998         return 0
3999     fi
4000     LDFLAGS="$use_ld_ldflags_save"
4001     return 1
4003 USE_LD=
4004 if test "$enable_ld" != "no"; then
4005     if test "$GCC" = "yes"; then
4006         if test -n "$enable_ld"; then
4007             check_use_ld "$enable_ld" fail_if_error
4008         elif test -z "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4009             dnl non-debug builds default to the default linker
4010             true
4011         elif test -n "$COM_IS_CLANG"; then
4012             check_use_ld lld
4013             if test $? -ne 0; then
4014                 check_use_ld gold
4015             fi
4016         else
4017             # For gcc first try gold, new versions also support lld.
4018             check_use_ld gold
4019             if test $? -ne 0; then
4020                 check_use_ld lld
4021             fi
4022         fi
4023         ld_output=$(echo 'int main() { return 0; }' | $CC -Wl,-v -x c -o conftest.out - $CFLAGS $LDFLAGS 2>/dev/null)
4024         rm conftest.out
4025         ld_used=$(echo "$ld_output" | grep -E '(^GNU gold|^GNU ld|^LLD)')
4026         if test -z "$ld_used"; then
4027             ld_used="unknown"
4028         fi
4029         AC_MSG_CHECKING([for linker that is used])
4030         AC_MSG_RESULT([$ld_used])
4031         if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4032             if echo "$ld_used" | grep -q "^GNU ld"; then
4033                 AC_MSG_WARN([The default GNU linker is slow, consider using the LLD or the GNU gold linker.])
4034                 add_warning "The default GNU linker is slow, consider using the LLD or the GNU gold linker."
4035             fi
4036         fi
4037     else
4038         if test "$enable_ld" = "yes"; then
4039             AC_MSG_ERROR([--enable-ld not supported])
4040         fi
4041     fi
4043 AC_SUBST(USE_LD)
4045 HAVE_LD_BSYMBOLIC_FUNCTIONS=
4046 if test "$GCC" = "yes"; then
4047     AC_MSG_CHECKING([for -Bsymbolic-functions linker support])
4048     bsymbolic_functions_ldflags_save=$LDFLAGS
4049     LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
4050     AC_LINK_IFELSE([AC_LANG_PROGRAM([
4051 #include <stdio.h>
4052         ],[
4053 printf ("hello world\n");
4054         ])], HAVE_LD_BSYMBOLIC_FUNCTIONS=TRUE, [])
4055     if test "$HAVE_LD_BSYMBOLIC_FUNCTIONS" = "TRUE"; then
4056         AC_MSG_RESULT( found )
4057     else
4058         AC_MSG_RESULT( not found )
4059     fi
4060     LDFLAGS=$bsymbolic_functions_ldflags_save
4062 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
4065 HAVE_GSPLIT_DWARF=
4066 if test "$enable_split_debug" != no; then
4067     dnl Currently by default enabled only on Linux, feel free to set test_split_debug above also for other platforms.
4068     if test "$enable_split_debug" = yes -o \( "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4069         AC_MSG_CHECKING([whether $CC_BASE supports -gsplit-dwarf])
4070         save_CFLAGS=$CFLAGS
4071         CFLAGS="$CFLAGS -Werror -gsplit-dwarf"
4072         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_SPLIT_DWARF=TRUE ],[])
4073         CFLAGS=$save_CFLAGS
4074         if test "$HAVE_GCC_SPLIT_DWARF" = "TRUE"; then
4075             AC_MSG_RESULT([yes])
4076         else
4077             if test "$enable_split_debug" = yes; then
4078                 AC_MSG_ERROR([no])
4079             else
4080                 AC_MSG_RESULT([no])
4081             fi
4082         fi
4083     fi
4084     if test -z "$HAVE_GCC_SPLIT_DWARF" -a "$test_split_debug" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4085         AC_MSG_WARN([Compiler is not capable of creating split debug info, linking will require more time and disk space.])
4086         add_warning "Compiler is not capable of creating split debug info, linking will require more time and disk space."
4087     fi
4089 AC_SUBST(HAVE_GCC_SPLIT_DWARF)
4091 ENABLE_GDB_INDEX=
4092 if test "$enable_gdb_index" != "no"; then
4093     dnl Currently by default enabled only on Linux, feel free to set test_gdb_index above also for other platforms.
4094     if test "$enable_gdb_index" = yes -o \( "$test_gdb_index" = "yes" -o -n "$ENABLE_DEBUG$ENABLE_DBGUTIL" \); then
4095         AC_MSG_CHECKING([whether $CC_BASE supports -ggnu-pubnames])
4096         save_CFLAGS=$CFLAGS
4097         CFLAGS="$CFLAGS -Werror -ggnu-pubnames"
4098         have_ggnu_pubnames=
4099         AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[have_ggnu_pubnames=TRUE],[have_ggnu_pubnames=])
4100         if test "$have_ggnu_pubnames" != "TRUE"; then
4101             if test "$enable_gdb_index" = "yes"; then
4102                 AC_MSG_ERROR( no, --enable-gdb-index not supported )
4103             else
4104                 AC_MSG_RESULT( no )
4105             fi
4106         else
4107             AC_MSG_RESULT( yes )
4108             AC_MSG_CHECKING([whether $CC_BASE supports -Wl,--gdb-index])
4109             ldflags_save=$LDFLAGS
4110             LDFLAGS="$LDFLAGS -Wl,--gdb-index"
4111             AC_LINK_IFELSE([AC_LANG_PROGRAM([
4112 #include <stdio.h>
4113                 ],[
4114 printf ("hello world\n");
4115                 ])], ENABLE_GDB_INDEX=TRUE, [])
4116             if test "$ENABLE_GDB_INDEX" = "TRUE"; then
4117                 AC_MSG_RESULT( yes )
4118             else
4119                 if test "$enable_gdb_index" = "yes"; then
4120                     AC_MSG_ERROR( no )
4121                 else
4122                     AC_MSG_RESULT( no )
4123                 fi
4124             fi
4125             LDFLAGS=$ldflags_save
4126         fi
4127         CFLAGS=$save_CFLAGS
4128         fi
4129     if test -z "$ENABLE_GDB_INDEX" -a "$test_gdb_index" = "yes" -a -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4130         AC_MSG_WARN([Linker is not capable of creating gdb index, debugger startup will be slow.])
4131         add_warning "Linker is not capable of creating gdb index, debugger startup will be slow."
4132     fi
4134 AC_SUBST(ENABLE_GDB_INDEX)
4136 if test "$enable_sal_log" = yes; then
4137     ENABLE_SAL_LOG=TRUE
4139 AC_SUBST(ENABLE_SAL_LOG)
4141 dnl Check for enable symbols option
4142 dnl ===================================================================
4143 AC_MSG_CHECKING([whether to generate debug information])
4144 if test -z "$enable_symbols"; then
4145     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4146         enable_symbols=yes
4147     else
4148         enable_symbols=no
4149     fi
4151 if test "$enable_symbols" = yes; then
4152     ENABLE_SYMBOLS_FOR=all
4153     AC_MSG_RESULT([yes])
4154 elif test "$enable_symbols" = no; then
4155     ENABLE_SYMBOLS_FOR=
4156     AC_MSG_RESULT([no])
4157 else
4158     # Selective debuginfo.
4159     ENABLE_SYMBOLS_FOR="$enable_symbols"
4160     AC_MSG_RESULT([for "$enable_symbols"])
4162 AC_SUBST(ENABLE_SYMBOLS_FOR)
4164 if test -n "$with_android_ndk" -a \( -n "$ENABLE_SYMBOLS" -o -n "$ENABLE_DEBUG" -o -n "$ENABLE_DBGUTIL" \) -a "$ENABLE_DEBUGINFO_FOR" = "all"; then
4165     # Building on Android with full symbols: without enough memory the linker never finishes currently.
4166     AC_MSG_CHECKING([whether enough memory is available for linking])
4167     mem_size=$(grep -o 'MemTotal: *.\+ kB' /proc/meminfo | sed 's/MemTotal: *\(.\+\) kB/\1/')
4168     # Check for 15GB, as Linux reports a bit less than the physical memory size.
4169     if test -n "$mem_size" -a $mem_size -lt 15728640; then
4170         AC_MSG_ERROR([building with full symbols and less than 16GB of memory is not supported])
4171     else
4172         AC_MSG_RESULT([yes])
4173     fi
4176 AC_MSG_CHECKING([whether to compile with optimization flags])
4177 if test -z "$enable_optimized"; then
4178     if test -n "$ENABLE_DEBUG$ENABLE_DBGUTIL"; then
4179         enable_optimized=no
4180     else
4181         enable_optimized=yes
4182     fi
4184 if test "$enable_optimized" != no; then
4185     ENABLE_OPTIMIZED=TRUE
4186     AC_MSG_RESULT([yes])
4187 else
4188     ENABLE_OPTIMIZED=
4189     AC_MSG_RESULT([no])
4191 AC_SUBST(ENABLE_OPTIMIZED)
4194 # determine CPUNAME, OS, ...
4195 # The USING_X11 flag tells whether the host os uses X by default. Can be overridden with the --without-x option.
4197 case "$host_os" in
4199 aix*)
4200     COM=GCC
4201     CPUNAME=POWERPC
4202     USING_X11=TRUE
4203     OS=AIX
4204     RTL_OS=AIX
4205     RTL_ARCH=PowerPC
4206     PLATFORMID=aix_powerpc
4207     P_SEP=:
4208     ;;
4210 cygwin*)
4211     COM=MSC
4212     USING_X11=
4213     OS=WNT
4214     RTL_OS=Windows
4215     if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4216         P_SEP=";"
4217     else
4218         P_SEP=:
4219     fi
4220     case "$host_cpu" in
4221     i*86|x86_64)
4222         if test "$BITNESS_OVERRIDE" = 64; then
4223             CPUNAME=X86_64
4224             RTL_ARCH=X86_64
4225             PLATFORMID=windows_x86_64
4226             WINDOWS_X64=1
4227             SCPDEFS="$SCPDEFS -DWINDOWS_X64"
4228         else
4229             CPUNAME=INTEL
4230             RTL_ARCH=x86
4231             PLATFORMID=windows_x86
4232         fi
4233         ;;
4234     *)
4235         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4236         ;;
4237     esac
4238     SCPDEFS="$SCPDEFS -D_MSC_VER"
4239     ;;
4241 darwin*)
4242     COM=GCC
4243     USING_X11=
4244     OS=MACOSX
4245     RTL_OS=MacOSX
4246     P_SEP=:
4248     case "$host_cpu" in
4249     arm)
4250         AC_MSG_ERROR([Can't build 32-bit code for iOS])
4251         ;;
4252     arm64)
4253         OS=iOS
4254         if test "$enable_ios_simulator" = "yes"; then
4255             AC_MSG_ERROR([iOS simulator is only available in OSX not iOS])
4256         else
4257             CPUNAME=ARM64
4258             RTL_ARCH=ARM_EABI
4259             PLATFORMID=ios_arm64
4260         fi
4261         ;;
4262     i*86)
4263         AC_MSG_ERROR([Can't build 64-bit code in 32-bit OS])
4264         ;;
4265     x86_64)
4266         if test "$enable_ios_simulator" = "yes"; then
4267             OS=iOS
4268         fi
4269         CPUNAME=X86_64
4270         RTL_ARCH=X86_64
4271         PLATFORMID=macosx_x86_64
4272         ;;
4273     *)
4274         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4275         ;;
4276     esac
4277     ;;
4279 dragonfly*)
4280     COM=GCC
4281     USING_X11=TRUE
4282     OS=DRAGONFLY
4283     RTL_OS=DragonFly
4284     P_SEP=:
4286     case "$host_cpu" in
4287     i*86)
4288         CPUNAME=INTEL
4289         RTL_ARCH=x86
4290         PLATFORMID=dragonfly_x86
4291         ;;
4292     x86_64)
4293         CPUNAME=X86_64
4294         RTL_ARCH=X86_64
4295         PLATFORMID=dragonfly_x86_64
4296         ;;
4297     *)
4298         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4299         ;;
4300     esac
4301     ;;
4303 freebsd*)
4304     COM=GCC
4305     USING_X11=TRUE
4306     RTL_OS=FreeBSD
4307     OS=FREEBSD
4308     P_SEP=:
4310     case "$host_cpu" in
4311     i*86)
4312         CPUNAME=INTEL
4313         RTL_ARCH=x86
4314         PLATFORMID=freebsd_x86
4315         ;;
4316     x86_64|amd64)
4317         CPUNAME=X86_64
4318         RTL_ARCH=X86_64
4319         PLATFORMID=freebsd_x86_64
4320         ;;
4321     *)
4322         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4323         ;;
4324     esac
4325     ;;
4327 haiku*)
4328     COM=GCC
4329     USING_X11=
4330     GUIBASE=haiku
4331     RTL_OS=Haiku
4332     OS=HAIKU
4333     P_SEP=:
4335     case "$host_cpu" in
4336     i*86)
4337         CPUNAME=INTEL
4338         RTL_ARCH=x86
4339         PLATFORMID=haiku_x86
4340         ;;
4341     x86_64|amd64)
4342         CPUNAME=X86_64
4343         RTL_ARCH=X86_64
4344         PLATFORMID=haiku_x86_64
4345         ;;
4346     *)
4347         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4348         ;;
4349     esac
4350     ;;
4352 kfreebsd*)
4353     COM=GCC
4354     USING_X11=TRUE
4355     OS=LINUX
4356     RTL_OS=kFreeBSD
4357     P_SEP=:
4359     case "$host_cpu" in
4361     i*86)
4362         CPUNAME=INTEL
4363         RTL_ARCH=x86
4364         PLATFORMID=kfreebsd_x86
4365         ;;
4366     x86_64)
4367         CPUNAME=X86_64
4368         RTL_ARCH=X86_64
4369         PLATFORMID=kfreebsd_x86_64
4370         ;;
4371     *)
4372         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4373         ;;
4374     esac
4375     ;;
4377 linux-gnu*)
4378     COM=GCC
4379     USING_X11=TRUE
4380     OS=LINUX
4381     RTL_OS=Linux
4382     P_SEP=:
4384     case "$host_cpu" in
4386     aarch64)
4387         CPUNAME=AARCH64
4388         PLATFORMID=linux_aarch64
4389         RTL_ARCH=AARCH64
4390         ;;
4391     alpha)
4392         CPUNAME=AXP
4393         RTL_ARCH=ALPHA
4394         PLATFORMID=linux_alpha
4395         ;;
4396     arm*)
4397         CPUNAME=ARM
4398         EPM_FLAGS="-a arm"
4399         RTL_ARCH=ARM_EABI
4400         PLATFORMID=linux_arm_eabi
4401         case "$host_cpu" in
4402         arm*-linux)
4403             RTL_ARCH=ARM_OABI
4404             PLATFORMID=linux_arm_oabi
4405             ;;
4406         esac
4407         ;;
4408     hppa)
4409         CPUNAME=HPPA
4410         RTL_ARCH=HPPA
4411         EPM_FLAGS="-a hppa"
4412         PLATFORMID=linux_hppa
4413         ;;
4414     i*86)
4415         CPUNAME=INTEL
4416         RTL_ARCH=x86
4417         PLATFORMID=linux_x86
4418         ;;
4419     ia64)
4420         CPUNAME=IA64
4421         RTL_ARCH=IA64
4422         PLATFORMID=linux_ia64
4423         ;;
4424     mips)
4425         CPUNAME=GODSON
4426         RTL_ARCH=MIPS_EB
4427         EPM_FLAGS="-a mips"
4428         PLATFORMID=linux_mips_eb
4429         ;;
4430     mips64)
4431         CPUNAME=GODSON64
4432         RTL_ARCH=MIPS64_EB
4433         EPM_FLAGS="-a mips64"
4434         PLATFORMID=linux_mips64_eb
4435         ;;
4436     mips64el)
4437         CPUNAME=GODSON64
4438         RTL_ARCH=MIPS64_EL
4439         EPM_FLAGS="-a mips64el"
4440         PLATFORMID=linux_mips64_el
4441         ;;
4442     mipsel)
4443         CPUNAME=GODSON
4444         RTL_ARCH=MIPS_EL
4445         EPM_FLAGS="-a mipsel"
4446         PLATFORMID=linux_mips_el
4447         ;;
4448     m68k)
4449         CPUNAME=M68K
4450         RTL_ARCH=M68K
4451         PLATFORMID=linux_m68k
4452         ;;
4453     powerpc)
4454         CPUNAME=POWERPC
4455         RTL_ARCH=PowerPC
4456         PLATFORMID=linux_powerpc
4457         ;;
4458     powerpc64)
4459         CPUNAME=POWERPC64
4460         RTL_ARCH=PowerPC_64
4461         PLATFORMID=linux_powerpc64
4462         ;;
4463     powerpc64le)
4464         CPUNAME=POWERPC64
4465         RTL_ARCH=PowerPC_64_LE
4466         PLATFORMID=linux_powerpc64_le
4467         ;;
4468     sparc)
4469         CPUNAME=SPARC
4470         RTL_ARCH=SPARC
4471         PLATFORMID=linux_sparc
4472         ;;
4473     sparc64)
4474         CPUNAME=SPARC64
4475         RTL_ARCH=SPARC64
4476         PLATFORMID=linux_sparc64
4477         ;;
4478     s390)
4479         CPUNAME=S390
4480         RTL_ARCH=S390
4481         PLATFORMID=linux_s390
4482         ;;
4483     s390x)
4484         CPUNAME=S390X
4485         RTL_ARCH=S390x
4486         PLATFORMID=linux_s390x
4487         ;;
4488     x86_64)
4489         CPUNAME=X86_64
4490         RTL_ARCH=X86_64
4491         PLATFORMID=linux_x86_64
4492         ;;
4493     *)
4494         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4495         ;;
4496     esac
4497     ;;
4499 linux-android*)
4500     COM=GCC
4501     USING_X11=
4502     OS=ANDROID
4503     RTL_OS=Android
4504     P_SEP=:
4506     case "$host_cpu" in
4508     arm|armel)
4509         CPUNAME=ARM
4510         RTL_ARCH=ARM_EABI
4511         PLATFORMID=android_arm_eabi
4512         ;;
4513     aarch64)
4514         CPUNAME=AARCH64
4515         RTL_ARCH=AARCH64
4516         PLATFORMID=android_aarch64
4517         ;;
4518     i*86)
4519         CPUNAME=INTEL
4520         RTL_ARCH=x86
4521         PLATFORMID=android_x86
4522         ;;
4523     *)
4524         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4525         ;;
4526     esac
4527     ;;
4529 *netbsd*)
4530     COM=GCC
4531     USING_X11=TRUE
4532     OS=NETBSD
4533     RTL_OS=NetBSD
4534     P_SEP=:
4536     case "$host_cpu" in
4537     i*86)
4538         CPUNAME=INTEL
4539         RTL_ARCH=x86
4540         PLATFORMID=netbsd_x86
4541         ;;
4542     powerpc)
4543         CPUNAME=POWERPC
4544         RTL_ARCH=PowerPC
4545         PLATFORMID=netbsd_powerpc
4546         ;;
4547     sparc)
4548         CPUNAME=SPARC
4549         RTL_ARCH=SPARC
4550         PLATFORMID=netbsd_sparc
4551         ;;
4552     x86_64)
4553         CPUNAME=X86_64
4554         RTL_ARCH=X86_64
4555         PLATFORMID=netbsd_x86_64
4556         ;;
4557     *)
4558         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4559         ;;
4560     esac
4561     ;;
4563 openbsd*)
4564     COM=GCC
4565     USING_X11=TRUE
4566     OS=OPENBSD
4567     RTL_OS=OpenBSD
4568     P_SEP=:
4570     case "$host_cpu" in
4571     i*86)
4572         CPUNAME=INTEL
4573         RTL_ARCH=x86
4574         PLATFORMID=openbsd_x86
4575         ;;
4576     x86_64)
4577         CPUNAME=X86_64
4578         RTL_ARCH=X86_64
4579         PLATFORMID=openbsd_x86_64
4580         ;;
4581     *)
4582         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4583         ;;
4584     esac
4585     SOLARINC="$SOLARINC -I/usr/local/include"
4586     ;;
4588 solaris*)
4589     COM=GCC
4590     USING_X11=TRUE
4591     OS=SOLARIS
4592     RTL_OS=Solaris
4593     P_SEP=:
4595     case "$host_cpu" in
4596     i*86)
4597         CPUNAME=INTEL
4598         RTL_ARCH=x86
4599         PLATFORMID=solaris_x86
4600         ;;
4601     sparc)
4602         CPUNAME=SPARC
4603         RTL_ARCH=SPARC
4604         PLATFORMID=solaris_sparc
4605         ;;
4606     sparc64)
4607         CPUNAME=SPARC64
4608         RTL_ARCH=SPARC64
4609         PLATFORMID=solaris_sparc64
4610         ;;
4611     *)
4612         AC_MSG_ERROR([Unsupported host_cpu $host_cpu for host_os $host_os])
4613         ;;
4614     esac
4615     SOLARINC="$SOLARINC -I/usr/local/include"
4616     ;;
4619     AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice for!])
4620     ;;
4621 esac
4623 if test "$with_x" = "no"; then
4624     AC_MSG_ERROR([Use --disable-gui instead. How can we get rid of this option? No idea where it comes from.])
4627 DISABLE_GUI=""
4628 if test "$enable_gui" = "no"; then
4629     if test "$USING_X11" != TRUE; then
4630         AC_MSG_ERROR([$host_os operating system is not suitable to build LibreOffice with --disable-gui.])
4631     fi
4632     USING_X11=
4633     DISABLE_GUI=TRUE
4634     AC_DEFINE(HAVE_FEATURE_UI,0)
4635     test_cairo=yes
4637 AC_SUBST(DISABLE_GUI)
4639 WORKDIR="${BUILDDIR}/workdir"
4640 INSTDIR="${BUILDDIR}/instdir"
4641 INSTROOTBASE=${INSTDIR}${INSTROOTBASESUFFIX}
4642 INSTROOT=${INSTROOTBASE}${INSTROOTCONTENTSUFFIX}
4643 SOLARINC="-I$SRC_ROOT/include $SOLARINC"
4644 AC_SUBST(COM)
4645 AC_SUBST(CPUNAME)
4646 AC_SUBST(RTL_OS)
4647 AC_SUBST(RTL_ARCH)
4648 AC_SUBST(EPM_FLAGS)
4649 AC_SUBST(USING_X11)
4650 AC_SUBST([INSTDIR])
4651 AC_SUBST([INSTROOT])
4652 AC_SUBST([INSTROOTBASE])
4653 AC_SUBST(OS)
4654 AC_SUBST(P_SEP)
4655 AC_SUBST(WORKDIR)
4656 AC_SUBST(PLATFORMID)
4657 AC_SUBST(WINDOWS_X64)
4658 AC_DEFINE_UNQUOTED(WORKDIR,"$WORKDIR")
4660 dnl ===================================================================
4661 dnl Test which package format to use
4662 dnl ===================================================================
4663 AC_MSG_CHECKING([which package format to use])
4664 if test -n "$with_package_format" -a "$with_package_format" != no; then
4665     for i in $with_package_format; do
4666         case "$i" in
4667         aix | bsd | deb | pkg | rpm | archive | dmg | installed | msi)
4668             ;;
4669         *)
4670             AC_MSG_ERROR([unsupported format $i. Supported by EPM are:
4671 aix - AIX software distribution
4672 bsd - FreeBSD, NetBSD, or OpenBSD software distribution
4673 deb - Debian software distribution
4674 pkg - Solaris software distribution
4675 rpm - RedHat software distribution
4677 LibreOffice additionally supports:
4678 archive - .tar.gz or .zip
4679 dmg - macOS .dmg
4680 installed - installation tree
4681 msi - Windows .msi
4682         ])
4683             ;;
4684         esac
4685     done
4686     # fakeroot is needed to ensure correct file ownerships/permissions
4687     # inside deb packages and tar archives created on Linux and Solaris.
4688     if test "$OS" = "LINUX" || test "$OS" = "SOLARIS"; then
4689         AC_PATH_PROG(FAKEROOT, fakeroot, no)
4690         if test "$FAKEROOT" = "no"; then
4691             AC_MSG_ERROR(
4692                 [--with-package-format='$with_package_format' requires fakeroot. Install fakeroot.])
4693         fi
4694     fi
4695     PKGFORMAT="$with_package_format"
4696     AC_MSG_RESULT([$PKGFORMAT])
4697 else
4698     PKGFORMAT=
4699     AC_MSG_RESULT([none])
4701 AC_SUBST(PKGFORMAT)
4703 dnl ===================================================================
4704 dnl Set up a different compiler to produce tools to run on the build
4705 dnl machine when doing cross-compilation
4706 dnl ===================================================================
4708 m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
4709 m4_pattern_allow([PKG_CONFIG_LIBDIR])
4710 if test "$cross_compiling" = "yes"; then
4711     AC_MSG_CHECKING([for BUILD platform configuration])
4712     echo
4713     rm -rf CONF-FOR-BUILD config_build.mk
4714     mkdir CONF-FOR-BUILD
4715     # Here must be listed all files needed when running the configure script. In particular, also
4716     # those expanded by the AC_CONFIG_FILES() call near the end of this configure.ac. For clarity,
4717     # keep them in the same order as there.
4718     (cd $SRC_ROOT && tar cf - \
4719         config.guess \
4720         bin/get_config_variables \
4721         solenv/bin/getcompver.awk \
4722         solenv/inc/langlist.mk \
4723         download.lst \
4724         config_host.mk.in \
4725         config_host_lang.mk.in \
4726         Makefile.in \
4727         bin/bffvalidator.sh.in \
4728         bin/odfvalidator.sh.in \
4729         bin/officeotron.sh.in \
4730         instsetoo_native/util/openoffice.lst.in \
4731         config_host/*.in \
4732         sysui/desktop/macosx/Info.plist.in) \
4733     | (cd CONF-FOR-BUILD && tar xf -)
4734     cp configure CONF-FOR-BUILD
4735     test -d config_build && cp -p config_build/*.h CONF-FOR-BUILD/config_host 2>/dev/null
4736     (
4737     unset COM USING_X11 OS CPUNAME
4738     unset CC CXX SYSBASE CFLAGS
4739     unset AR NM OBJDUMP PKG_CONFIG RANLIB READELF STRIP
4740     unset CPPUNIT_CFLAGS CPPUNIT_LIBS
4741     unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC PKG_CONFIG_LIBDIR
4742     if test -n "$CC_FOR_BUILD"; then
4743         export CC="$CC_FOR_BUILD"
4744         CC_BASE=`first_arg_basename "$CC"`
4745     fi
4746     if test -n "$CXX_FOR_BUILD"; then
4747         export CXX="$CXX_FOR_BUILD"
4748         CXX_BASE=`first_arg_basename "$CXX"`
4749     fi
4750     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
4751     cd CONF-FOR-BUILD
4752     sub_conf_opts=""
4753     test -n "$enable_ccache" && sub_conf_opts="$sub_conf_opts --enable-ccache=$enable_ccache"
4754     test -n "$with_ant_home" && sub_conf_opts="$sub_conf_opts --with-ant-home=$with_ant_home"
4755     test $with_junit = no && sub_conf_opts="$sub_conf_opts --without-junit"
4756     test -n "$TARFILE_LOCATION" && sub_conf_opts="$sub_conf_opts --with-external-tar=$TARFILE_LOCATION"
4757     test "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" && sub_conf_opts="$sub_conf_opts --with-system-icu"
4758     test "$build_for_ios" = "YES" && sub_conf_opts="$sub_conf_opts build_for_ios=YES"
4759     sub_conf_opts="$sub_conf_opts $with_build_platform_configure_options"
4760     # Don't bother having configure look for stuff not needed for the build platform anyway
4761     ./configure \
4762         --disable-cups \
4763         --disable-gstreamer-1-0 \
4764         --disable-gtk \
4765         --disable-gtk3 \
4766         --disable-pdfimport \
4767         --disable-postgresql-sdbc \
4768         --with-parallelism="$with_parallelism" \
4769         --without-doxygen \
4770         --without-java \
4771         $sub_conf_opts \
4772         --srcdir=$srcdir \
4773         2>&1 | sed -e 's/^/    /'
4774     test -f ./config_host.mk 2>/dev/null || exit
4775     cp config_host.mk ../config_build.mk
4776     cp config_host_lang.mk ../config_build_lang.mk
4777     mv config.log ../config.Build.log
4778     mkdir -p ../config_build
4779     mv config_host/*.h ../config_build
4780     . ./bin/get_config_variables CC CXX INSTDIR INSTROOT LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER LIBO_URE_MISC_FOLDER OS PATH SDKDIRNAME SYSTEM_LIBXML SYSTEM_LIBXSLT WORKDIR
4782     for V in CC CXX LIBO_BIN_FOLDER LIBO_LIB_FOLDER LIBO_URE_LIB_FOLDER LIBO_URE_MISC_FOLDER OS SDKDIRNAME SYSTEM_LIBXML SYSTEM_LIBXSLT; do
4783         VV='$'$V
4784         VV=`eval "echo $VV"`
4785         if test -n "$VV"; then
4786             line=${V}_FOR_BUILD='${'${V}_FOR_BUILD:-$VV'}'
4787             echo "$line" >>build-config
4788         fi
4789     done
4791     for V in INSTDIR INSTROOT WORKDIR; do
4792         VV='$'$V
4793         VV=`eval "echo $VV"`
4794         VV=`echo $VV | sed -e "s,/CONF-FOR-BUILD/\([[a-z]]*\),/\1_for_build,g"`
4795         if test -n "$VV"; then
4796             line="${V}_FOR_BUILD='$VV'"
4797             echo "$line" >>build-config
4798         fi
4799     done
4801     line=`echo "LO_PATH_FOR_BUILD=$PATH" | sed -e 's,/CONF-FOR-BUILD,,g'`
4802     echo "$line" >>build-config
4804     )
4805     test -f CONF-FOR-BUILD/build-config || AC_MSG_ERROR([Running configure script for BUILD system failed, see CONF-FOR-BUILD/config.log])
4806     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])
4807     perl -pi -e 's,/(workdir|instdir)(/|$),/\1_for_build\2,g;' \
4808              -e 's,/CONF-FOR-BUILD,,g;' config_build.mk
4810     eval `cat CONF-FOR-BUILD/build-config`
4812     AC_MSG_RESULT([checking for BUILD platform configuration... done])
4814     rm -rf CONF-FOR-BUILD
4815 else
4816     OS_FOR_BUILD="$OS"
4817     CC_FOR_BUILD="$CC"
4818     CXX_FOR_BUILD="$CXX"
4819     INSTDIR_FOR_BUILD="$INSTDIR"
4820     INSTROOT_FOR_BUILD="$INSTROOT"
4821     LIBO_BIN_FOLDER_FOR_BUILD="$LIBO_BIN_FOLDER"
4822     LIBO_LIB_FOLDER_FOR_BUILD="$LIBO_LIB_FOLDER"
4823     LIBO_URE_LIB_FOLDER_FOR_BUILD="$LIBO_URE_LIB_FOLDER"
4824     LIBO_URE_MISC_FOLDER_FOR_BUILD="$LIBO_URE_MISC_FOLDER"
4825     SDKDIRNAME_FOR_BUILD="$SDKDIRNAME"
4826     WORKDIR_FOR_BUILD="$WORKDIR"
4828 AC_SUBST(OS_FOR_BUILD)
4829 AC_SUBST(INSTDIR_FOR_BUILD)
4830 AC_SUBST(INSTROOT_FOR_BUILD)
4831 AC_SUBST(LIBO_BIN_FOLDER_FOR_BUILD)
4832 AC_SUBST(LIBO_LIB_FOLDER_FOR_BUILD)
4833 AC_SUBST(LIBO_URE_LIB_FOLDER_FOR_BUILD)
4834 AC_SUBST(LIBO_URE_MISC_FOLDER_FOR_BUILD)
4835 AC_SUBST(SDKDIRNAME_FOR_BUILD)
4836 AC_SUBST(WORKDIR_FOR_BUILD)
4838 dnl ===================================================================
4839 dnl Check for syslog header
4840 dnl ===================================================================
4841 AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG_H))
4843 dnl Set the ENABLE_WERROR variable. (Activate --enable-werror)
4844 dnl ===================================================================
4845 AC_MSG_CHECKING([whether to turn warnings to errors])
4846 if test -n "$enable_werror" -a "$enable_werror" != "no"; then
4847     ENABLE_WERROR="TRUE"
4848     AC_MSG_RESULT([yes])
4849 else
4850     if test -n "$LODE_HOME" -a -z "$enable_werror"; then
4851         ENABLE_WERROR="TRUE"
4852         AC_MSG_RESULT([yes])
4853     else
4854         AC_MSG_RESULT([no])
4855     fi
4857 AC_SUBST(ENABLE_WERROR)
4859 dnl Check for --enable-assert-always-abort, set ASSERT_ALWAYS_ABORT
4860 dnl ===================================================================
4861 AC_MSG_CHECKING([whether to have assert() failures abort even without --enable-debug])
4862 if test -z "$enable_assert_always_abort"; then
4863    if test "$ENABLE_DEBUG" = TRUE; then
4864        enable_assert_always_abort=yes
4865    else
4866        enable_assert_always_abort=no
4867    fi
4869 if test "$enable_assert_always_abort" = "yes"; then
4870     ASSERT_ALWAYS_ABORT="TRUE"
4871     AC_MSG_RESULT([yes])
4872 else
4873     ASSERT_ALWAYS_ABORT="FALSE"
4874     AC_MSG_RESULT([no])
4876 AC_SUBST(ASSERT_ALWAYS_ABORT)
4878 # Determine whether to use ooenv for the instdir installation
4879 # ===================================================================
4880 if test $_os != "WINNT" -a $_os != "Darwin"; then
4881     AC_MSG_CHECKING([whether to use ooenv for the instdir installation])
4882     if test "$enable_ooenv" = "no"; then
4883         AC_MSG_RESULT([no])
4884     else
4885         ENABLE_OOENV="TRUE"
4886         AC_MSG_RESULT([yes])
4887     fi
4889 AC_SUBST(ENABLE_OOENV)
4891 if test "$USING_X11" != TRUE; then
4892     # be sure to do not mess with unneeded stuff
4893     test_randr=no
4894     test_xrender=no
4895     test_cups=no
4896     test_dbus=no
4897     test_gtk=no
4898     build_gstreamer_1_0=no
4899     test_kf5=no
4900     test_qt5=no
4901     test_gtk3_kde5=no
4902     enable_cairo_canvas=no
4905 if test "$OS" = "HAIKU"; then
4906     enable_cairo_canvas=yes
4907     test_kf5=yes
4910 if test "$test_kf5" = "yes" -a "$enable_kde5" = "yes"; then
4911     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!])
4912     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!"
4913     enable_kf5=yes
4916 if test "$test_kf5" = "yes"; then
4917     test_qt5=yes
4920 if test "$test_kf5" = "yes" -a "$enable_kf5" = "yes"; then
4921     if test "$enable_qt5" = "no"; then
4922         AC_MSG_ERROR([KF5 support depends on QT5, so it conflicts with --disable-qt5])
4923     else
4924         enable_qt5=yes
4925     fi
4928 dnl ===================================================================
4929 dnl check for cups support
4930 dnl ===================================================================
4931 ENABLE_CUPS=""
4933 if test "$enable_cups" = "no"; then
4934     test_cups=no
4937 AC_MSG_CHECKING([whether to enable CUPS support])
4938 if test "$test_cups" = "yes"; then
4939     ENABLE_CUPS="TRUE"
4940     AC_MSG_RESULT([yes])
4942     AC_MSG_CHECKING([whether cups support is present])
4943     AC_CHECK_LIB([cups], [cupsPrintFiles], [:])
4944     AC_CHECK_HEADER(cups/cups.h, AC_DEFINE(HAVE_CUPS_H))
4945     if test "$ac_cv_lib_cups_cupsPrintFiles" != "yes" -o "$ac_cv_header_cups_cups_h" != "yes"; then
4946         AC_MSG_ERROR([Could not find CUPS. Install libcups2-dev or cups-devel.])
4947     fi
4949 else
4950     AC_MSG_RESULT([no])
4953 AC_SUBST(ENABLE_CUPS)
4955 # fontconfig checks
4956 if test "$test_fontconfig" = "yes"; then
4957     PKG_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.4.1])
4958     SYSTEM_FONTCONFIG=TRUE
4959     FilterLibs "${FONTCONFIG_LIBS}"
4960     FONTCONFIG_LIBS="${filteredlibs}"
4962 AC_SUBST(FONTCONFIG_CFLAGS)
4963 AC_SUBST(FONTCONFIG_LIBS)
4964 AC_SUBST([SYSTEM_FONTCONFIG])
4966 dnl whether to find & fetch external tarballs?
4967 dnl ===================================================================
4968 if test -z "$TARFILE_LOCATION" -a -n "$LODE_HOME" ; then
4969    if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
4970        TARFILE_LOCATION="`cygpath -m $LODE_HOME/ext_tar`"
4971    else
4972        TARFILE_LOCATION="$LODE_HOME/ext_tar"
4973    fi
4975 if test -z "$TARFILE_LOCATION"; then
4976     if test -d "$SRC_ROOT/src" ; then
4977         mv "$SRC_ROOT/src" "$SRC_ROOT/external/tarballs"
4978         ln -s "$SRC_ROOT/external/tarballs" "$SRC_ROOT/src"
4979     fi
4980     TARFILE_LOCATION="$SRC_ROOT/external/tarballs"
4981 else
4982     AbsolutePath "$TARFILE_LOCATION"
4983     PathFormat "${absolute_path}"
4984     TARFILE_LOCATION="${formatted_path}"
4986 AC_SUBST(TARFILE_LOCATION)
4988 AC_MSG_CHECKING([whether we want to fetch tarballs])
4989 if test "$enable_fetch_external" != "no"; then
4990     if test "$with_all_tarballs" = "yes"; then
4991         AC_MSG_RESULT([yes, all of them])
4992         DO_FETCH_TARBALLS="ALL"
4993     else
4994         AC_MSG_RESULT([yes, if we use them])
4995         DO_FETCH_TARBALLS="TRUE"
4996     fi
4997 else
4998     AC_MSG_RESULT([no])
4999     DO_FETCH_TARBALLS=
5001 AC_SUBST(DO_FETCH_TARBALLS)
5003 AC_MSG_CHECKING([whether to build help])
5004 if test -n "$with_help" -a "$with_help" != "no" -a $_os != iOS -a $_os != Android; then
5005     BUILD_TYPE="$BUILD_TYPE HELP"
5006     GIT_NEEDED_SUBMODULES="helpcontent2 $GIT_NEEDED_SUBMODULES"
5007     case "$with_help" in
5008     "html")
5009         ENABLE_HTMLHELP=TRUE
5010         SCPDEFS="$SCPDEFS -DWITH_HELP"
5011         AC_MSG_RESULT([HTML])
5012         ;;
5013     "online")
5014         ENABLE_HTMLHELP=TRUE
5015         HELP_ONLINE=TRUE
5016         AC_MSG_RESULT([HTML])
5017         ;;
5018     yes)
5019         SCPDEFS="$SCPDEFS -DWITH_HELP"
5020         AC_MSG_RESULT([yes])
5021         ;;
5022     *)
5023         AC_MSG_ERROR([Unknown --with-help=$with_help])
5024         ;;
5025     esac
5026 else
5027     AC_MSG_RESULT([no])
5029 AC_SUBST([ENABLE_HTMLHELP])
5030 AC_SUBST([HELP_ONLINE])
5032 dnl Test whether to include MySpell dictionaries
5033 dnl ===================================================================
5034 AC_MSG_CHECKING([whether to include MySpell dictionaries])
5035 if test "$with_myspell_dicts" = "yes"; then
5036     AC_MSG_RESULT([yes])
5037     WITH_MYSPELL_DICTS=TRUE
5038     BUILD_TYPE="$BUILD_TYPE DICTIONARIES"
5039     GIT_NEEDED_SUBMODULES="dictionaries $GIT_NEEDED_SUBMODULES"
5040 else
5041     AC_MSG_RESULT([no])
5042     WITH_MYSPELL_DICTS=
5044 AC_SUBST(WITH_MYSPELL_DICTS)
5046 # There are no "system" myspell, hyphen or mythes dictionaries on macOS, Windows, Android or iOS.
5047 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS -o $_os = Android; then
5048     if test "$with_system_dicts" = yes; then
5049         AC_MSG_ERROR([There are no system dicts on this OS in the formats the 3rd-party libs we use expect]);
5050     fi
5051     with_system_dicts=no
5054 AC_MSG_CHECKING([whether to use dicts from external paths])
5055 if test -z "$with_system_dicts" -o "$with_system_dicts" != "no"; then
5056     AC_MSG_RESULT([yes])
5057     SYSTEM_DICTS=TRUE
5058     AC_MSG_CHECKING([for spelling dictionary directory])
5059     if test -n "$with_external_dict_dir"; then
5060         DICT_SYSTEM_DIR=file://$with_external_dict_dir
5061     else
5062         DICT_SYSTEM_DIR=file:///usr/share/hunspell
5063         if test ! -d /usr/share/hunspell -a -d /usr/share/myspell; then
5064             DICT_SYSTEM_DIR=file:///usr/share/myspell
5065         fi
5066     fi
5067     AC_MSG_RESULT([$DICT_SYSTEM_DIR])
5068     AC_MSG_CHECKING([for hyphenation patterns directory])
5069     if test -n "$with_external_hyph_dir"; then
5070         HYPH_SYSTEM_DIR=file://$with_external_hyph_dir
5071     else
5072         HYPH_SYSTEM_DIR=file:///usr/share/hyphen
5073     fi
5074     AC_MSG_RESULT([$HYPH_SYSTEM_DIR])
5075     AC_MSG_CHECKING([for thesaurus directory])
5076     if test -n "$with_external_thes_dir"; then
5077         THES_SYSTEM_DIR=file://$with_external_thes_dir
5078     else
5079         THES_SYSTEM_DIR=file:///usr/share/mythes
5080     fi
5081     AC_MSG_RESULT([$THES_SYSTEM_DIR])
5082 else
5083     AC_MSG_RESULT([no])
5084     SYSTEM_DICTS=
5086 AC_SUBST(SYSTEM_DICTS)
5087 AC_SUBST(DICT_SYSTEM_DIR)
5088 AC_SUBST(HYPH_SYSTEM_DIR)
5089 AC_SUBST(THES_SYSTEM_DIR)
5091 dnl ===================================================================
5092 dnl Precompiled headers.
5093 ENABLE_PCH=""
5094 AC_MSG_CHECKING([whether to enable pch feature])
5095 if test -z "$enable_pch"; then
5096     if test "$_os" = "WINNT"; then
5097         # Enabled by default on Windows.
5098         enable_pch=yes
5099     else
5100         enable_pch=no
5101     fi
5103 if test "$enable_pch" != "no" -a "$_os" != "WINNT" -a "$GCC" != "yes" ; then
5104     AC_MSG_ERROR([Precompiled header not yet supported for your platform/compiler])
5106 if test "$enable_pch" = "system"; then
5107     ENABLE_PCH="1"
5108     AC_MSG_RESULT([yes (system headers)])
5109 elif test "$enable_pch" = "base"; then
5110     ENABLE_PCH="2"
5111     AC_MSG_RESULT([yes (system and base headers)])
5112 elif test "$enable_pch" = "normal"; then
5113     ENABLE_PCH="3"
5114     AC_MSG_RESULT([yes (normal)])
5115 elif test "$enable_pch" = "full"; then
5116     ENABLE_PCH="4"
5117     AC_MSG_RESULT([yes (full)])
5118 elif test "$enable_pch" = "yes"; then
5119     # Pick a suitable default.
5120     if test "$GCC" = "yes"; then
5121         # With Clang and GCC higher levels do not seem to make a noticeable improvement,
5122         # while making the PCHs larger and rebuilds more likely.
5123         ENABLE_PCH="2"
5124         AC_MSG_RESULT([yes (system and base headers)])
5125     else
5126         # With MSVC the highest level makes a significant difference,
5127         # and it was the default when there used to be no PCH levels.
5128         ENABLE_PCH="4"
5129         AC_MSG_RESULT([yes (full)])
5130     fi
5131 elif test "$enable_pch" = "no"; then
5132     AC_MSG_RESULT([no])
5133 else
5134     AC_MSG_ERROR([Unknown value for --enable-pch])
5136 AC_SUBST(ENABLE_PCH)
5137 # ccache 3.7.1 and older do not properly detect/handle -include .gch in CCACHE_DEPEND mode
5138 if test -n "$ENABLE_PCH" -a -n "$CCACHE_DEPEND_MODE" -a "$GCC" = "yes" -a "$COM_IS_CLANG" != "TRUE"; then
5139     AC_PATH_PROG([CCACHE_BIN],[ccache],[not found])
5140     if test "$CCACHE_BIN" != "not found"; then
5141         AC_MSG_CHECKING([ccache version])
5142         CCACHE_VERSION=`"$CCACHE_BIN" -V | "$AWK" '/^ccache version/{print $3}'`
5143         CCACHE_NUMVER=`echo $CCACHE_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5144         AC_MSG_RESULT([$CCACHE_VERSION])
5145         AC_MSG_CHECKING([whether ccache depend mode works properly with GCC PCH])
5146         if test "$CCACHE_NUMVER" -gt "030701"; then
5147             AC_MSG_RESULT([yes])
5148         else
5149             AC_MSG_RESULT([no (not newer than 3.7.1)])
5150             CCACHE_DEPEND_MODE=
5151         fi
5152     fi
5155 TAB=`printf '\t'`
5157 AC_MSG_CHECKING([the GNU Make version])
5158 _make_version=`$GNUMAKE --version | grep GNU | $GREP -v GPL | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
5159 _make_longver=`echo $_make_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
5160 if test "$_make_longver" -ge "038200"; then
5161     AC_MSG_RESULT([$GNUMAKE $_make_version])
5163 elif test "$_make_longver" -ge "038100"; then
5164     if test "$build_os" = "cygwin"; then
5165         AC_MSG_ERROR([failed ($GNUMAKE version >= 3.82 needed])
5166     fi
5167     AC_MSG_RESULT([$GNUMAKE $_make_version])
5169     dnl ===================================================================
5170     dnl Search all the common names for sha1sum
5171     dnl ===================================================================
5172     AC_CHECK_PROGS(SHA1SUM, sha1sum sha1 shasum openssl)
5173     if test -z "$SHA1SUM"; then
5174         AC_MSG_ERROR([install the appropriate SHA-1 checksumming program for this OS])
5175     elif test "$SHA1SUM" = "openssl"; then
5176         SHA1SUM="openssl sha1"
5177     fi
5178     AC_MSG_CHECKING([for GNU Make bug 20033])
5179     TESTGMAKEBUG20033=`mktemp -d tmp.XXXXXX`
5180     $SED -e "s/<TAB>/$TAB/g" > $TESTGMAKEBUG20033/Makefile << EOF
5181 A := \$(wildcard *.a)
5183 .PHONY: all
5184 all: \$(A:.a=.b)
5185 <TAB>@echo survived bug20033.
5187 .PHONY: setup
5188 setup:
5189 <TAB>@touch 1.a 2.a 3.a 4.a 5.a 6.a
5191 define d1
5192 @echo lala \$(1)
5193 @sleep 1
5194 endef
5196 define d2
5197 @echo tyty \$(1)
5198 @sleep 1
5199 endef
5201 %.b : %.a
5202 <TAB>\$(eval CHECKSUM := \$(word 1,\$(shell cat \$^ | $SHA1SUM))) \$(if \$(wildcard \$(CACHEDIR)/\$(CHECKSUM)),\
5203 <TAB>\$(call d1,\$(CHECKSUM)),\
5204 <TAB>\$(call d2,\$(CHECKSUM)))
5206     if test -z "`(cd $TESTGMAKEBUG20033 && $GNUMAKE setup && $GNUMAKE -j)|grep survived`"; then
5207         no_parallelism_make="YES"
5208         AC_MSG_RESULT([yes, disable parallelism])
5209     else
5210         AC_MSG_RESULT([no, keep parallelism enabled])
5211     fi
5212     rm -rf $TESTGMAKEBUG20033
5213 else
5214     AC_MSG_ERROR([failed ($GNUMAKE version >= 3.81 needed])
5217 # find if gnumake support file function
5218 AC_MSG_CHECKING([whether GNU Make supports the 'file' function])
5219 TESTGMAKEFILEFUNC="`mktemp -d -t tst.XXXXXX`"
5220 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
5221     TESTGMAKEFILEFUNC=`cygpath -m $TESTGMAKEFILEFUNC`
5223 $SED -e "s/<TAB>/$TAB/" > $TESTGMAKEFILEFUNC/Makefile << EOF
5224 \$(file >test.txt,Success )
5226 .PHONY: all
5227 all:
5228 <TAB>@cat test.txt
5231 $GNUMAKE -C $TESTGMAKEFILEFUNC 2>/dev/null 1>&2
5232 if test -f $TESTGMAKEFILEFUNC/test.txt; then
5233     HAVE_GNUMAKE_FILE_FUNC=TRUE
5234     AC_MSG_RESULT([yes])
5235 else
5236     AC_MSG_RESULT([no])
5238 rm -rf $TESTGMAKEFILEFUNC
5239 AC_SUBST(HAVE_GNUMAKE_FILE_FUNC)
5240 AC_SUBST(GNUMAKE_WIN_NATIVE)
5242 _make_ver_check=`$GNUMAKE --version | grep "Built for Windows"`
5243 STALE_MAKE=
5244 if test "$_make_ver_check" = ""; then
5245    STALE_MAKE=TRUE
5248 HAVE_LD_HASH_STYLE=FALSE
5249 WITH_LINKER_HASH_STYLE=
5250 AC_MSG_CHECKING([for --hash-style gcc linker support])
5251 if test "$GCC" = "yes"; then
5252     if test -z "$with_linker_hash_style" -o "$with_linker_hash_style" = "yes"; then
5253         hash_styles="gnu sysv"
5254     elif test "$with_linker_hash_style" = "no"; then
5255         hash_styles=
5256     else
5257         hash_styles="$with_linker_hash_style"
5258     fi
5260     for hash_style in $hash_styles; do
5261         test "$HAVE_LD_HASH_STYLE" = "TRUE" && continue
5262         hash_style_ldflags_save=$LDFLAGS
5263         LDFLAGS="$LDFLAGS -Wl,--hash-style=$hash_style"
5265         AC_RUN_IFELSE([AC_LANG_PROGRAM(
5266             [
5267 #include <stdio.h>
5268             ],[
5269 printf ("");
5270             ])],
5271             [
5272                   HAVE_LD_HASH_STYLE=TRUE
5273                   WITH_LINKER_HASH_STYLE=$hash_style
5274             ],
5275             [HAVE_LD_HASH_STYLE=FALSE],
5276             [HAVE_LD_HASH_STYLE=FALSE])
5277         LDFLAGS=$hash_style_ldflags_save
5278     done
5280     if test "$HAVE_LD_HASH_STYLE" = "TRUE"; then
5281         AC_MSG_RESULT( $WITH_LINKER_HASH_STYLE )
5282     else
5283         AC_MSG_RESULT( no )
5284     fi
5285     LDFLAGS=$hash_style_ldflags_save
5286 else
5287     AC_MSG_RESULT( no )
5289 AC_SUBST(HAVE_LD_HASH_STYLE)
5290 AC_SUBST(WITH_LINKER_HASH_STYLE)
5292 dnl ===================================================================
5293 dnl Check whether there's a Perl version available.
5294 dnl ===================================================================
5295 if test -z "$with_perl_home"; then
5296     AC_PATH_PROG(PERL, perl)
5297 else
5298     test "$build_os" = "cygwin" && with_perl_home=`cygpath -u "$with_perl_home"`
5299     _perl_path="$with_perl_home/bin/perl"
5300     if test -x "$_perl_path"; then
5301         PERL=$_perl_path
5302     else
5303         AC_MSG_ERROR([$_perl_path not found])
5304     fi
5307 dnl ===================================================================
5308 dnl Testing for Perl version 5 or greater.
5309 dnl $] is the Perl version variable, it is returned as an integer
5310 dnl ===================================================================
5311 if test "$PERL"; then
5312     AC_MSG_CHECKING([the Perl version])
5313     ${PERL} -e "exit($]);"
5314     _perl_version=$?
5315     if test "$_perl_version" -lt 5; then
5316         AC_MSG_ERROR([found Perl $_perl_version, use Perl 5])
5317     fi
5318     AC_MSG_RESULT([Perl $_perl_version])
5319 else
5320     AC_MSG_ERROR([Perl not found, install Perl 5])
5323 dnl ===================================================================
5324 dnl Testing for required Perl modules
5325 dnl ===================================================================
5327 AC_MSG_CHECKING([for required Perl modules])
5328 perl_use_string="use Cwd ; use Digest::MD5"
5329 if test "$_os" = "WINNT"; then
5330     if test -n "$PKGFORMAT"; then
5331         for i in $PKGFORMAT; do
5332             case "$i" in
5333             msi)
5334                 # for getting fonts versions to use in MSI
5335                 perl_use_string="$perl_use_string ; use Font::TTF::Font"
5336                 ;;
5337             esac
5338         done
5339     fi
5341 if test "$with_system_hsqldb" = "yes"; then
5342     perl_use_string="$perl_use_string ; use Archive::Zip"
5344 if $PERL -e "$perl_use_string">/dev/null 2>&1; then
5345     AC_MSG_RESULT([all modules found])
5346 else
5347     AC_MSG_RESULT([failed to find some modules])
5348     # Find out which modules are missing.
5349     for i in $perl_use_string; do
5350         if test "$i" != "use" -a "$i" != ";"; then
5351             if ! $PERL -e "use $i;">/dev/null 2>&1; then
5352                 missing_perl_modules="$missing_perl_modules $i"
5353             fi
5354         fi
5355     done
5356     AC_MSG_ERROR([
5357     The missing Perl modules are: $missing_perl_modules
5358     Install them as superuser/administrator with "cpan -i $missing_perl_modules"])
5361 dnl ===================================================================
5362 dnl Check for pkg-config
5363 dnl ===================================================================
5364 if test "$_os" != "WINNT"; then
5365     PKG_PROG_PKG_CONFIG
5368 if test "$_os" != "WINNT"; then
5370     # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
5371     # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
5372     # explicitly. Or put /path/to/compiler in PATH yourself.
5374     # Use wrappers for LTO
5375     if test "$ENABLE_LTO" = "TRUE" -a "$COM_IS_CLANG" != "TRUE"; then
5376         AC_CHECK_TOOL(AR,gcc-ar)
5377         AC_CHECK_TOOL(NM,gcc-nm)
5378         AC_CHECK_TOOL(RANLIB,gcc-ranlib)
5379     else
5380         AC_CHECK_TOOL(AR,ar)
5381         AC_CHECK_TOOL(NM,nm)
5382         AC_CHECK_TOOL(RANLIB,ranlib)
5383     fi
5384     AC_CHECK_TOOL(OBJDUMP,objdump)
5385     AC_CHECK_TOOL(READELF,readelf)
5386     AC_CHECK_TOOL(STRIP,strip)
5387     if test "$_os" = "WINNT"; then
5388         AC_CHECK_TOOL(DLLTOOL,dlltool)
5389         AC_CHECK_TOOL(WINDRES,windres)
5390     fi
5392 AC_SUBST(AR)
5393 AC_SUBST(DLLTOOL)
5394 AC_SUBST(NM)
5395 AC_SUBST(OBJDUMP)
5396 AC_SUBST(PKG_CONFIG)
5397 AC_SUBST(RANLIB)
5398 AC_SUBST(READELF)
5399 AC_SUBST(STRIP)
5400 AC_SUBST(WINDRES)
5402 dnl ===================================================================
5403 dnl pkg-config checks on macOS
5404 dnl ===================================================================
5406 if test $_os = Darwin; then
5407     AC_MSG_CHECKING([for bogus pkg-config])
5408     if test -n "$PKG_CONFIG"; then
5409         if test "$PKG_CONFIG" = /usr/bin/pkg-config && ls -l /usr/bin/pkg-config | $GREP -q Mono.framework; then
5410             AC_MSG_ERROR([yes, from Mono. This *will* break the build. Please remove or hide $PKG_CONFIG])
5411         else
5412             if test "$enable_bogus_pkg_config" = "yes"; then
5413                 AC_MSG_RESULT([yes, user-approved from unknown origin.])
5414             else
5415                 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.])
5416             fi
5417         fi
5418     else
5419         AC_MSG_RESULT([no, good])
5420     fi
5423 find_csc()
5425     # Return value: $csctest
5427     unset csctest
5429     reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
5430     if test -n "$regvalue"; then
5431         csctest=$regvalue
5432         return
5433     fi
5436 find_al()
5438     # Return value: $altest
5440     unset altest
5442     # We need this check to detect 4.6.1 or above.
5443     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
5444         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
5445         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5446             altest=$regvalue
5447             return
5448         fi
5449     done
5451     for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
5452         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
5453         if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
5454             altest=$regvalue
5455             return
5456         fi
5457     done
5462 find_dotnetsdk46()
5464     unset frametest
5466     for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1 4.6; do
5467         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/KitsInstallationFolder"
5468         if test -n "$regvalue"; then
5469             frametest=$regvalue
5470             return
5471         fi
5472     done
5475 find_winsdk_version()
5477     # Args: $1 : SDK version as in "8.0", "8.1A" etc
5478     # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir
5480     unset winsdktest winsdkbinsubdir winsdklibsubdir
5482     case "$1" in
5483     8.0|8.0A)
5484         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
5485         if test -n "$regvalue"; then
5486             winsdktest=$regvalue
5487             winsdklibsubdir=win8
5488             return
5489         fi
5490         ;;
5491     8.1|8.1A)
5492         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot81"
5493         if test -n "$regvalue"; then
5494             winsdktest=$regvalue
5495             winsdklibsubdir=winv6.3
5496             return
5497         fi
5498         ;;
5499     10.0)
5500         reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/InstallationFolder"
5501         if test -n "$regvalue"; then
5502             winsdktest=$regvalue
5503             reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
5504             if test -n "$regvalue"; then
5505                 winsdkbinsubdir="$regvalue".0
5506                 winsdklibsubdir=$winsdkbinsubdir
5507                 tmppath="$winsdktest\\Include\\$winsdklibsubdir"
5508                 # test exist the SDK path
5509                 if test -d "$tmppath"; then
5510                    # when path is convertible to a short path then path is okay
5511                    cygpath -d "$tmppath" >/dev/null 2>&1
5512                    if test $? -ne 0; then
5513                       AC_MSG_ERROR([Windows SDK doesn't have a 8.3 name, see NtfsDisable8dot3NameCreation])
5514                    fi
5515                 else
5516                    AC_MSG_ERROR([The Windows SDK not found, check the installation])
5517                 fi
5518             fi
5519             return
5520         fi
5521         ;;
5522     esac
5525 find_winsdk()
5527     # Return value: From find_winsdk_version
5529     unset winsdktest
5531     for ver in $WINDOWS_SDK_ACCEPTABLE_VERSIONS; do
5532         find_winsdk_version $ver
5533         if test -n "$winsdktest"; then
5534             return
5535         fi
5536     done
5539 find_msms()
5541     AC_MSG_CHECKING([for MSVC merge modules directory])
5542     my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
5543     case "$VCVER" in
5544         150|160)
5545         my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
5546         ;;
5547     esac
5548     for f in $my_msm_files; do
5549         echo "$as_me:$LINENO: searching for $f" >&5
5550     done
5552     msmdir=
5553     for ver in 14.0 15.0; do
5554         reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
5555         if test -n "$regvalue"; then
5556             for f in ${my_msm_files}; do
5557                 if test -e "$regvalue/${f}"; then
5558                     msmdir=$regvalue
5559                     break
5560                 fi
5561             done
5562         fi
5563     done
5564     dnl Is the following fallback really necessary, or was it added in response
5565     dnl to never having started Visual Studio on a given machine, so the
5566     dnl registry keys checked above had presumably not yet been created?
5567     dnl Anyway, if it really is necessary, it might be worthwhile to extend it
5568     dnl to also check %CommonProgramFiles(X86)% (typically expanding to
5569     dnl "C:\Program Files (X86)\Common Files" compared to %CommonProgramFiles%
5570     dnl expanding to "C:\Program Files\Common Files"), which would need
5571     dnl something like $(perl -e 'print $ENV{"CommonProgramFiles(x86)"}') to
5572     dnl obtain its value from cygwin:
5573     if test -z "$msmdir"; then
5574         my_msm_dir="${COMMONPROGRAMFILES}/Merge Modules/"
5575         for f in ${my_msm_files}; do
5576             if test -e "$my_msm_dir/${f}"; then
5577                 msmdir=$my_msm_dir
5578             fi
5579         done
5580     fi
5582     dnl Starting from MSVC 15.0, merge modules are located in different directory
5583     case "$VCVER" in
5584     150|160)
5585         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5586             echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
5587             my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
5588             for f in ${my_msm_files}; do
5589                 if test -e "$my_msm_dir/${f}"; then
5590                     msmdir=$my_msm_dir
5591                     break
5592                 fi
5593             done
5594         done
5595         ;;
5596     esac
5598     if test -n "$msmdir"; then
5599         msmdir=`cygpath -m "$msmdir"`
5600         AC_MSG_RESULT([$msmdir])
5601     else
5602         if test "$ENABLE_RELEASE_BUILD" = "TRUE" ; then
5603             AC_MSG_FAILURE([not found])
5604         else
5605             AC_MSG_WARN([not found (check config.log)])
5606             add_warning "MSM none of ${my_msm_files} found"
5607         fi
5608     fi
5611 find_msvc_x64_dlls()
5613     AC_MSG_CHECKING([for MSVC x64 DLL path])
5614     msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
5615     case "$VCVER" in
5616     150|160)
5617         for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
5618             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
5619             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
5620                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"
5621                 break
5622             fi
5623             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT" >&5
5624             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"; then
5625                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC142.CRT"
5626                 break
5627             fi
5628             echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC150.CRT" >&5
5629             if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"; then
5630                 msvcdllpath="$VC_PRODUCT_DIR/redist/MSVC/$l/onecore/x64/Microsoft.VC150.CRT"
5631                 break
5632             fi
5633         done
5634         ;;
5635     esac
5636     AC_MSG_RESULT([$msvcdllpath])
5637     AC_MSG_CHECKING([for MSVC x64 DLLs])
5638     msvcdlls="msvcp140.dll vcruntime140.dll"
5639     for dll in $msvcdlls; do
5640         if ! test -f "$msvcdllpath/$dll"; then
5641             AC_MSG_FAILURE([missing $dll])
5642         fi
5643     done
5644     AC_MSG_RESULT([found all ($msvcdlls)])
5647 dnl =========================================
5648 dnl Check for the Windows  SDK.
5649 dnl =========================================
5650 if test "$_os" = "WINNT"; then
5651     AC_MSG_CHECKING([for Windows SDK])
5652     if test "$build_os" = "cygwin"; then
5653         find_winsdk
5654         WINDOWS_SDK_HOME=$winsdktest
5656         # normalize if found
5657         if test -n "$WINDOWS_SDK_HOME"; then
5658             WINDOWS_SDK_HOME=`cygpath -d "$WINDOWS_SDK_HOME"`
5659             WINDOWS_SDK_HOME=`cygpath -u "$WINDOWS_SDK_HOME"`
5660         fi
5662         WINDOWS_SDK_LIB_SUBDIR=$winsdklibsubdir
5663     fi
5665     if test -n "$WINDOWS_SDK_HOME"; then
5666         # Remove a possible trailing backslash
5667         WINDOWS_SDK_HOME=`echo $WINDOWS_SDK_HOME | $SED 's/\/$//'`
5669         if test -f "$WINDOWS_SDK_HOME/Include/adoint.h" \
5670              -a -f "$WINDOWS_SDK_HOME/Include/SqlUcode.h" \
5671              -a -f "$WINDOWS_SDK_HOME/Include/usp10.h"; then
5672             have_windows_sdk_headers=yes
5673         elif test -f "$WINDOWS_SDK_HOME/Include/um/adoint.h" \
5674              -a -f "$WINDOWS_SDK_HOME/Include/um/SqlUcode.h" \
5675              -a -f "$WINDOWS_SDK_HOME/Include/um/usp10.h"; then
5676             have_windows_sdk_headers=yes
5677         elif test -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/adoint.h" \
5678              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/SqlUcode.h" \
5679              -a -f "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um/usp10.h"; then
5680             have_windows_sdk_headers=yes
5681         else
5682             have_windows_sdk_headers=no
5683         fi
5685         if test -f "$WINDOWS_SDK_HOME/lib/user32.lib"; then
5686             have_windows_sdk_libs=yes
5687         elif test -f "$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/user32.lib"; then
5688             have_windows_sdk_libs=yes
5689         else
5690             have_windows_sdk_libs=no
5691         fi
5693         if test $have_windows_sdk_headers = no -o $have_windows_sdk_libs = no; then
5694             AC_MSG_ERROR([Some (all?) Windows SDK files not found, please check if all needed parts of
5695 the  Windows SDK are installed.])
5696         fi
5697     fi
5699     if test -z "$WINDOWS_SDK_HOME"; then
5700         AC_MSG_RESULT([no, hoping the necessary headers and libraries will be found anyway!?])
5701     elif echo $WINDOWS_SDK_HOME | grep "8.0" >/dev/null 2>/dev/null; then
5702         WINDOWS_SDK_VERSION=80
5703         AC_MSG_RESULT([found Windows SDK 8.0 ($WINDOWS_SDK_HOME)])
5704     elif echo $WINDOWS_SDK_HOME | grep "8.1" >/dev/null 2>/dev/null; then
5705         WINDOWS_SDK_VERSION=81
5706         AC_MSG_RESULT([found Windows SDK 8.1 ($WINDOWS_SDK_HOME)])
5707     elif echo $WINDOWS_SDK_HOME | grep "/10" >/dev/null 2>/dev/null; then
5708         WINDOWS_SDK_VERSION=10
5709         AC_MSG_RESULT([found Windows SDK 10.0 ($WINDOWS_SDK_HOME)])
5710     else
5711         AC_MSG_ERROR([Found legacy Windows Platform SDK ($WINDOWS_SDK_HOME)])
5712     fi
5713     PathFormat "$WINDOWS_SDK_HOME"
5714     WINDOWS_SDK_HOME="$formatted_path"
5715     if test "$build_os" = "cygwin"; then
5716         SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include -I$COMPATH/Include"
5717         if test -d "$WINDOWS_SDK_HOME/include/um"; then
5718             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/include/um -I$WINDOWS_SDK_HOME/include/shared"
5719         elif test -d "$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um"; then
5720             SOLARINC="$SOLARINC -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/um -I$WINDOWS_SDK_HOME/Include/$winsdklibsubdir/shared"
5721         fi
5722     fi
5724     dnl TODO: solenv/bin/modules/installer/windows/msiglobal.pm wants to use a
5725     dnl WiLangId.vbs that is included only in some SDKs (e.g., included in v7.1
5726     dnl but not in v8.0), so allow this to be overridden with a
5727     dnl WINDOWS_SDK_WILANGID for now; a full-blown --with-windows-sdk-wilangid
5728     dnl and configuration error if no WiLangId.vbs is found would arguably be
5729     dnl better, but I do not know under which conditions exactly it is needed by
5730     dnl msiglobal.pm:
5731     if test -z "$WINDOWS_SDK_WILANGID" -a -n "$WINDOWS_SDK_HOME"; then
5732         WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/Samples/sysmgmt/msi/scripts/WiLangId.vbs
5733         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5734             WINDOWS_SDK_WILANGID="${WINDOWS_SDK_HOME}/bin/${WINDOWS_SDK_LIB_SUBDIR}/${WINDOWS_SDK_ARCH}/WiLangId.vbs"
5735         fi
5736         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5737             WINDOWS_SDK_WILANGID=$WINDOWS_SDK_HOME/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs
5738         fi
5739         if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5740             WINDOWS_SDK_WILANGID=$(cygpath -sm "C:/Program Files (x86)/Windows Kits/8.1/bin/$WINDOWS_SDK_ARCH/WiLangId.vbs")
5741         fi
5742     fi
5743     if test -n "$with_lang" -a "$with_lang" != "en-US"; then
5744         if test -n "$with_package_format" -a "$with_package_format" != no; then
5745             for i in "$with_package_format"; do
5746                 if test "$i" = "msi"; then
5747                     if ! test -e "$WINDOWS_SDK_WILANGID" ; then
5748                         AC_MSG_ERROR([WiLangId.vbs not found - building translated packages will fail])
5749                     fi
5750                 fi
5751             done
5752         fi
5753     fi
5755 AC_SUBST(WINDOWS_SDK_HOME)
5756 AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
5757 AC_SUBST(WINDOWS_SDK_VERSION)
5758 AC_SUBST(WINDOWS_SDK_WILANGID)
5760 if test "$build_os" = "cygwin"; then
5761     dnl Check midl.exe; this being the first check for a tool in the SDK bin
5762     dnl dir, it also determines that dir's path w/o an arch segment if any,
5763     dnl WINDOWS_SDK_BINDIR_NO_ARCH:
5764     AC_MSG_CHECKING([for midl.exe])
5766     find_winsdk
5767     if test -n "$winsdkbinsubdir" \
5768         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
5769     then
5770         MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH
5771         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
5772     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
5773         MIDL_PATH=$winsdktest/Bin/$WINDOWS_SDK_ARCH
5774         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5775     elif test -f "$winsdktest/Bin/midl.exe"; then
5776         MIDL_PATH=$winsdktest/Bin
5777         WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin
5778     fi
5779     if test ! -f "$MIDL_PATH/midl.exe"; then
5780         AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
5781     else
5782         AC_MSG_RESULT([$MIDL_PATH/midl.exe])
5783     fi
5785     # Convert to posix path with 8.3 filename restrictions ( No spaces )
5786     MIDL_PATH=`win_short_path_for_make "$MIDL_PATH"`
5788     if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
5789          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
5790          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
5791          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
5792     elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
5793          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
5794          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5795          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
5796     elif test -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
5797          -a -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
5798          -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
5799          -a -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
5800     else
5801         AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
5802     fi
5804     dnl Check csc.exe
5805     AC_MSG_CHECKING([for csc.exe])
5806     find_csc
5807     if test -f "$csctest/csc.exe"; then
5808         CSC_PATH="$csctest"
5809     fi
5810     if test ! -f "$CSC_PATH/csc.exe"; then
5811         AC_MSG_ERROR([csc.exe not found as $CSC_PATH/csc.exe])
5812     else
5813         AC_MSG_RESULT([$CSC_PATH/csc.exe])
5814     fi
5816     CSC_PATH=`win_short_path_for_make "$CSC_PATH"`
5818     dnl Check al.exe
5819     AC_MSG_CHECKING([for al.exe])
5820     find_winsdk
5821     if test -n "$winsdkbinsubdir" \
5822         -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
5823     then
5824         AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
5825     elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
5826         AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
5827     elif test -f "$winsdktest/Bin/al.exe"; then
5828         AL_PATH="$winsdktest/Bin"
5829     fi
5831     if test -z "$AL_PATH"; then
5832         find_al
5833         if test -f "$altest/bin/al.exe"; then
5834             AL_PATH="$altest/bin"
5835         elif test -f "$altest/al.exe"; then
5836             AL_PATH="$altest"
5837         fi
5838     fi
5839     if test ! -f "$AL_PATH/al.exe"; then
5840         AC_MSG_ERROR([al.exe not found as $AL_PATH/al.exe])
5841     else
5842         AC_MSG_RESULT([$AL_PATH/al.exe])
5843     fi
5845     AL_PATH=`win_short_path_for_make "$AL_PATH"`
5847     dnl Check mscoree.lib / .NET Framework dir
5848     AC_MSG_CHECKING(.NET Framework)
5849     find_dotnetsdk46
5850     PathFormat "$frametest"
5851     frametest="$formatted_path"
5852     if test -f "$frametest/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5853         DOTNET_FRAMEWORK_HOME="$frametest"
5854     else
5855         find_winsdk
5856         if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5857             DOTNET_FRAMEWORK_HOME="$winsdktest"
5858         fi
5859     fi
5860     if test ! -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib" -a ! -f "$DOTNET_FRAMEWORK_HOME/lib/$winsdklibsubdir/um/$WINDOWS_SDK_ARCH/mscoree.lib" -a ! -f "$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH/mscoree.lib"; then
5861         AC_MSG_ERROR([mscoree.lib not found])
5862     fi
5863     AC_MSG_RESULT([found: $DOTNET_FRAMEWORK_HOME])
5865     PathFormat "$MIDL_PATH"
5866     MIDL_PATH="$formatted_path"
5868     PathFormat "$AL_PATH"
5869     AL_PATH="$formatted_path"
5871     PathFormat "$DOTNET_FRAMEWORK_HOME"
5872     DOTNET_FRAMEWORK_HOME="$formatted_path"
5874     PathFormat "$CSC_PATH"
5875     CSC_PATH="$formatted_path"
5878 dnl ===================================================================
5879 dnl Check if stdc headers are available excluding MSVC.
5880 dnl ===================================================================
5881 if test "$_os" != "WINNT"; then
5882     AC_HEADER_STDC
5885 dnl ===================================================================
5886 dnl Testing for C++ compiler and version...
5887 dnl ===================================================================
5889 if test "$_os" != "WINNT"; then
5890     # AC_PROG_CXX sets CXXFLAGS to -g -O2 if not set, avoid that
5891     save_CXXFLAGS=$CXXFLAGS
5892     AC_PROG_CXX
5893     CXXFLAGS=$save_CXXFLAGS
5894     if test -z "$CXX_BASE"; then
5895         CXX_BASE=`first_arg_basename "$CXX"`
5896     fi
5897 else
5898     if test -n "$CC" -a -z "$CXX"; then
5899         CXX="$CC"
5900         CXX_BASE="$CC_BASE"
5901     fi
5904 dnl check for GNU C++ compiler version
5905 if test "$GXX" = "yes" -a -z "$COM_IS_CLANG"; then
5906     AC_MSG_CHECKING([the GNU C++ compiler version])
5908     _gpp_version=`$CXX -dumpversion`
5909     _gpp_majmin=`echo $_gpp_version | $AWK -F. '{ print \$1*100+\$2 }'`
5911     if test "$_gpp_majmin" -lt "700"; then
5912         AC_MSG_ERROR([You need to use GNU C++ compiler version >= 7.0 to build LibreOffice, you have $_gpp_version.])
5913     else
5914         AC_MSG_RESULT([ok (g++ $_gpp_version)])
5915     fi
5917     dnl see https://code.google.com/p/android/issues/detail?id=41770
5918         glibcxx_threads=no
5919         AC_LANG_PUSH([C++])
5920         AC_REQUIRE_CPP
5921         AC_MSG_CHECKING([whether $CXX_BASE is broken with boost.thread])
5922         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
5923             #include <bits/c++config.h>]],[[
5924             #if !defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
5925             && !defined(_GLIBCXX__PTHREADS) \
5926             && !defined(_GLIBCXX_HAS_GTHREADS)
5927             choke me
5928             #endif
5929         ]])],[AC_MSG_RESULT([yes])
5930         glibcxx_threads=yes],[AC_MSG_RESULT([no])])
5931         AC_LANG_POP([C++])
5932         if test $glibcxx_threads = yes; then
5933             BOOST_CXXFLAGS="-D_GLIBCXX_HAS_GTHREADS"
5934         fi
5936 AC_SUBST(BOOST_CXXFLAGS)
5939 # prefx CXX with ccache if needed
5941 if test "$CCACHE" != ""; then
5942     AC_MSG_CHECKING([whether $CXX_BASE is already ccached])
5943     AC_LANG_PUSH([C++])
5944     save_CXXFLAGS=$CXXFLAGS
5945     CXXFLAGS="$CXXFLAGS --ccache-skip -O2"
5946     dnl an empty program will do, we're checking the compiler flags
5947     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
5948                       [use_ccache=yes], [use_ccache=no])
5949     if test $use_ccache = yes; then
5950         AC_MSG_RESULT([yes])
5951     else
5952         CXX="$CCACHE $CXX"
5953         CXX_BASE="ccache $CXX_BASE"
5954         AC_MSG_RESULT([no])
5955     fi
5956     CXXFLAGS=$save_CXXFLAGS
5957     AC_LANG_POP([C++])
5960 dnl ===================================================================
5961 dnl Find pre-processors.(should do that _after_ messing with CC/CXX)
5962 dnl ===================================================================
5964 if test "$_os" != "WINNT"; then
5965     AC_PROG_CXXCPP
5967     dnl Check whether there's a C pre-processor.
5968     AC_PROG_CPP
5972 dnl ===================================================================
5973 dnl Find integral type sizes and alignments
5974 dnl ===================================================================
5976 if test "$_os" != "WINNT"; then
5978 if test "$_os" == "iOS"; then
5979     AC_MSG_CHECKING([iOS setting sizes long, short, int, long long, double, voidp])
5980     ac_cv_sizeof_long=8
5981     ac_cv_sizeof_short=2
5982     ac_cv_sizeof_int=4
5983     ac_cv_sizeof_long_long=8
5984     ac_cv_sizeof_double=8
5985     ac_cv_sizeof_voidp=8
5986 else
5987     AC_CHECK_SIZEOF(long)
5988     AC_CHECK_SIZEOF(short)
5989     AC_CHECK_SIZEOF(int)
5990     AC_CHECK_SIZEOF(long long)
5991     AC_CHECK_SIZEOF(double)
5992     AC_CHECK_SIZEOF(void*)
5995     SAL_TYPES_SIZEOFSHORT=$ac_cv_sizeof_short
5996     SAL_TYPES_SIZEOFINT=$ac_cv_sizeof_int
5997     SAL_TYPES_SIZEOFLONG=$ac_cv_sizeof_long
5998     SAL_TYPES_SIZEOFLONGLONG=$ac_cv_sizeof_long_long
5999     SAL_TYPES_SIZEOFPOINTER=$ac_cv_sizeof_voidp
6001     dnl Allow build without AC_CHECK_ALIGNOF, grrr
6002     m4_pattern_allow([AC_CHECK_ALIGNOF])
6003     m4_ifdef([AC_CHECK_ALIGNOF],
6004         [
6005             AC_CHECK_ALIGNOF(short,[#include <stddef.h>])
6006             AC_CHECK_ALIGNOF(int,[#include <stddef.h>])
6007             AC_CHECK_ALIGNOF(long,[#include <stddef.h>])
6008             AC_CHECK_ALIGNOF(double,[#include <stddef.h>])
6009         ],
6010         [
6011             case "$_os-$host_cpu" in
6012             Linux-i686)
6013                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6014                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6015                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=4
6016                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=4
6017                 ;;
6018             Linux-x86_64)
6019                 test -z "$ac_cv_alignof_short" && ac_cv_alignof_short=2
6020                 test -z "$ac_cv_alignof_int" && ac_cv_alignof_int=4
6021                 test -z "$ac_cv_alignof_long" && ac_cv_alignof_long=8
6022                 test -z "$ac_cv_alignof_double" && ac_cv_alignof_double=8
6023                 ;;
6024             *)
6025                 if test -z "$ac_cv_alignof_short" -o \
6026                         -z "$ac_cv_alignof_int" -o \
6027                         -z "$ac_cv_alignof_long" -o \
6028                         -z "$ac_cv_alignof_double"; then
6029                    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.])
6030                 fi
6031                 ;;
6032             esac
6033         ])
6035     SAL_TYPES_ALIGNMENT2=$ac_cv_alignof_short
6036     SAL_TYPES_ALIGNMENT4=$ac_cv_alignof_int
6037     if test $ac_cv_sizeof_long -eq 8; then
6038         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_long
6039     elif test $ac_cv_sizeof_double -eq 8; then
6040         SAL_TYPES_ALIGNMENT8=$ac_cv_alignof_double
6041     else
6042         AC_MSG_ERROR([Cannot find alignment of 8 byte types.])
6043     fi
6045     dnl Check for large file support
6046     AC_SYS_LARGEFILE
6047     if test -n "$ac_cv_sys_file_offset_bits" -a "$ac_cv_sys_file_offset_bits" != "no"; then
6048         LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
6049     fi
6050     if test -n "$ac_cv_sys_large_files" -a "$ac_cv_sys_large_files" != "no"; then
6051         LFS_CFLAGS="$LFS_CFLAGS -D_LARGE_FILES"
6052     fi
6053 else
6054     # Hardcode for MSVC
6055     SAL_TYPES_SIZEOFSHORT=2
6056     SAL_TYPES_SIZEOFINT=4
6057     SAL_TYPES_SIZEOFLONG=4
6058     SAL_TYPES_SIZEOFLONGLONG=8
6059     if test "$BITNESS_OVERRIDE" = ""; then
6060         SAL_TYPES_SIZEOFPOINTER=4
6061     else
6062         SAL_TYPES_SIZEOFPOINTER=8
6063     fi
6064     SAL_TYPES_ALIGNMENT2=2
6065     SAL_TYPES_ALIGNMENT4=4
6066     SAL_TYPES_ALIGNMENT8=8
6067     LFS_CFLAGS=''
6069 AC_SUBST(LFS_CFLAGS)
6071 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFSHORT,$SAL_TYPES_SIZEOFSHORT)
6072 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFINT,$SAL_TYPES_SIZEOFINT)
6073 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONG,$SAL_TYPES_SIZEOFLONG)
6074 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFLONGLONG,$SAL_TYPES_SIZEOFLONGLONG)
6075 AC_DEFINE_UNQUOTED(SAL_TYPES_SIZEOFPOINTER,$SAL_TYPES_SIZEOFPOINTER)
6076 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT2,$SAL_TYPES_ALIGNMENT2)
6077 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT4,$SAL_TYPES_ALIGNMENT4)
6078 AC_DEFINE_UNQUOTED(SAL_TYPES_ALIGNMENT8,$SAL_TYPES_ALIGNMENT8)
6080 dnl ===================================================================
6081 dnl Check whether to enable runtime optimizations
6082 dnl ===================================================================
6083 ENABLE_RUNTIME_OPTIMIZATIONS=
6084 AC_MSG_CHECKING([whether to enable runtime optimizations])
6085 if test -z "$enable_runtime_optimizations"; then
6086     for i in $CC; do
6087         case $i in
6088         -fsanitize=*)
6089             enable_runtime_optimizations=no
6090             break
6091             ;;
6092         esac
6093     done
6095 if test "$enable_runtime_optimizations" != no; then
6096     ENABLE_RUNTIME_OPTIMIZATIONS=TRUE
6097     AC_DEFINE(ENABLE_RUNTIME_OPTIMIZATIONS)
6098     AC_MSG_RESULT([yes])
6099 else
6100     AC_MSG_RESULT([no])
6102 AC_SUBST([ENABLE_RUNTIME_OPTIMIZATIONS])
6104 dnl ===================================================================
6105 dnl Check if valgrind headers are available
6106 dnl ===================================================================
6107 ENABLE_VALGRIND=
6108 if test "$cross_compiling" != yes -a "$with_valgrind" != no; then
6109     prev_cppflags=$CPPFLAGS
6110     # Is VALGRIND_CFLAGS something one is supposed to have in the environment,
6111     # or where does it come from?
6112     CPPFLAGS="$CPPFLAGS $VALGRIND_CFLAGS"
6113     AC_CHECK_HEADER([valgrind/valgrind.h],
6114         [ENABLE_VALGRIND=TRUE])
6115     CPPFLAGS=$prev_cppflags
6117 AC_SUBST([ENABLE_VALGRIND])
6118 if test -z "$ENABLE_VALGRIND"; then
6119     if test "$with_valgrind" = yes; then
6120         AC_MSG_ERROR([--with-valgrind specified but no Valgrind headers found])
6121     fi
6122     VALGRIND_CFLAGS=
6124 AC_SUBST([VALGRIND_CFLAGS])
6127 dnl ===================================================================
6128 dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
6129 dnl ===================================================================
6131 # We need at least the sys/sdt.h include header.
6132 AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
6133 if test "$SDT_H_FOUND" = "TRUE"; then
6134     # Found sys/sdt.h header, now make sure the c++ compiler works.
6135     # Old g++ versions had problems with probes in constructors/destructors.
6136     AC_MSG_CHECKING([working sys/sdt.h and c++ support])
6137     AC_LANG_PUSH([C++])
6138     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
6139     #include <sys/sdt.h>
6140     class ProbeClass
6141     {
6142     private:
6143       int& ref;
6144       const char *name;
6146     public:
6147       ProbeClass(int& v, const char *n) : ref(v), name(n)
6148       {
6149         DTRACE_PROBE2(_test_, cons, name, ref);
6150       }
6152       void method(int min)
6153       {
6154         DTRACE_PROBE3(_test_, meth, name, ref, min);
6155         ref -= min;
6156       }
6158       ~ProbeClass()
6159       {
6160         DTRACE_PROBE2(_test_, dest, name, ref);
6161       }
6162     };
6163     ]],[[
6164     int i = 64;
6165     DTRACE_PROBE1(_test_, call, i);
6166     ProbeClass inst = ProbeClass(i, "call");
6167     inst.method(24);
6168     ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
6169           [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
6170     AC_LANG_POP([C++])
6172 AC_CONFIG_HEADERS([config_host/config_probes.h])
6174 dnl ===================================================================
6175 dnl GCC features
6176 dnl ===================================================================
6177 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6178     AC_MSG_CHECKING([whether $CC_BASE supports -mno-avx])
6179     save_CFLAGS=$CFLAGS
6180     CFLAGS="$CFLAGS -Werror -mno-avx"
6181     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_AVX=TRUE ],[])
6182     CFLAGS=$save_CFLAGS
6183     if test "$HAVE_GCC_AVX" = "TRUE"; then
6184         AC_MSG_RESULT([yes])
6185     else
6186         AC_MSG_RESULT([no])
6187     fi
6189     AC_MSG_CHECKING([whether $CC_BASE supports -fstack-protector-strong])
6190     save_CFLAGS=$CFLAGS
6191     CFLAGS="$CFLAGS -O0 -Werror -fstack-protector-strong"
6192     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ char a[8]; a[7] = 0; ]])],[ HAVE_GCC_STACK_PROTECTOR_STRONG=TRUE ],[])
6193     CFLAGS=$save_CFLAGS
6194     if test "$HAVE_GCC_STACK_PROTECTOR_STRONG" = "TRUE"; then
6195         AC_MSG_RESULT([yes])
6196     else
6197         AC_MSG_RESULT([no])
6198     fi
6200     AC_MSG_CHECKING([whether $CC_BASE supports atomic functions])
6201     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
6202     int v = 0;
6203     if (__sync_add_and_fetch(&v, 1) != 1 ||
6204         __sync_sub_and_fetch(&v, 1) != 0)
6205         return 1;
6206     __sync_synchronize();
6207     if (__sync_val_compare_and_swap(&v, 0, 1) != 0 ||
6208         v != 1)
6209         return 1;
6210     return 0;
6211 ]])],[HAVE_GCC_BUILTIN_ATOMIC=TRUE],[])
6212     if test "$HAVE_GCC_BUILTIN_ATOMIC" = "TRUE"; then
6213         AC_MSG_RESULT([yes])
6214         AC_DEFINE(HAVE_GCC_BUILTIN_ATOMIC)
6215     else
6216         AC_MSG_RESULT([no])
6217     fi
6219     AC_MSG_CHECKING([whether $CC_BASE supports __builtin_ffs])
6220     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_ffs(1); ]])],[HAVE_GCC_BUILTIN_FFS=TRUE],[])
6221     if test "$HAVE_GCC_BUILTIN_FFS" = "TRUE"; then
6222         AC_MSG_RESULT([yes])
6223         AC_DEFINE(HAVE_GCC_BUILTIN_FFS)
6224     else
6225         AC_MSG_RESULT([no])
6226     fi
6228     AC_MSG_CHECKING([whether $CC_BASE supports __attribute__((deprecated(message)))])
6229     save_CFLAGS=$CFLAGS
6230     CFLAGS="$CFLAGS -Werror"
6231     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6232             __attribute__((deprecated("test"))) void f();
6233         ])], [
6234             AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
6235             AC_MSG_RESULT([yes])
6236         ], [AC_MSG_RESULT([no])])
6237     CFLAGS=$save_CFLAGS
6239     AC_MSG_CHECKING([whether $CXX_BASE defines __base_class_type_info in cxxabi.h])
6240     AC_LANG_PUSH([C++])
6241     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6242             #include <cstddef>
6243             #include <cxxabi.h>
6244             std::size_t f() { return sizeof(__cxxabiv1::__base_class_type_info); }
6245         ])], [
6246             AC_DEFINE([HAVE_CXXABI_H_BASE_CLASS_TYPE_INFO],[1])
6247             AC_MSG_RESULT([yes])
6248         ], [AC_MSG_RESULT([no])])
6249     AC_LANG_POP([C++])
6251     AC_MSG_CHECKING([whether $CXX_BASE defines __class_type_info in cxxabi.h])
6252     AC_LANG_PUSH([C++])
6253     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6254             #include <cstddef>
6255             #include <cxxabi.h>
6256             std::size_t f() { return sizeof(__cxxabiv1::__class_type_info); }
6257         ])], [
6258             AC_DEFINE([HAVE_CXXABI_H_CLASS_TYPE_INFO],[1])
6259             AC_MSG_RESULT([yes])
6260         ], [AC_MSG_RESULT([no])])
6261     AC_LANG_POP([C++])
6263     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_allocate_exception in cxxabi.h])
6264     AC_LANG_PUSH([C++])
6265     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6266             #include <cxxabi.h>
6267             void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
6268         ])], [
6269             AC_DEFINE([HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
6270             AC_MSG_RESULT([yes])
6271         ], [AC_MSG_RESULT([no])])
6272     AC_LANG_POP([C++])
6274     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_eh_globals in cxxabi.h])
6275     AC_LANG_PUSH([C++])
6276     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6277             #include <cstddef>
6278             #include <cxxabi.h>
6279             std::size_t f() { return sizeof(__cxxabiv1::__cxa_eh_globals); }
6280         ])], [
6281             AC_DEFINE([HAVE_CXXABI_H_CXA_EH_GLOBALS],[1])
6282             AC_MSG_RESULT([yes])
6283         ], [AC_MSG_RESULT([no])])
6284     AC_LANG_POP([C++])
6286     AC_MSG_CHECKING([whether $CXX_BASE defines __cxa_exceptions in cxxabi.h])
6287     AC_LANG_PUSH([C++])
6288     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6289             #include <cstddef>
6290             #include <cxxabi.h>
6291             std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
6292         ])], [
6293             AC_DEFINE([HAVE_CXXABI_H_CXA_EXCEPTIONS],[1])
6294             AC_MSG_RESULT([yes])
6295         ], [AC_MSG_RESULT([no])])
6296     AC_LANG_POP([C++])
6298     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_get_globals in cxxabi.h])
6299     AC_LANG_PUSH([C++])
6300     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6301             #include <cxxabi.h>
6302             void * f() { return __cxxabiv1::__cxa_get_globals(); }
6303         ])], [
6304             AC_DEFINE([HAVE_CXXABI_H_CXA_GET_GLOBALS],[1])
6305             AC_MSG_RESULT([yes])
6306         ], [AC_MSG_RESULT([no])])
6307     AC_LANG_POP([C++])
6309     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_current_exception_type in cxxabi.h])
6310     AC_LANG_PUSH([C++])
6311     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6312             #include <cxxabi.h>
6313             void * f() { return __cxxabiv1::__cxa_current_exception_type(); }
6314         ])], [
6315             AC_DEFINE([HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE],[1])
6316             AC_MSG_RESULT([yes])
6317         ], [AC_MSG_RESULT([no])])
6318     AC_LANG_POP([C++])
6320     AC_MSG_CHECKING([whether $CXX_BASE declares __cxa_throw in cxxabi.h])
6321     AC_LANG_PUSH([C++])
6322     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6323             #include <cxxabi.h>
6324             void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
6325         ])], [
6326             AC_DEFINE([HAVE_CXXABI_H_CXA_THROW],[1])
6327             AC_MSG_RESULT([yes])
6328         ], [AC_MSG_RESULT([no])])
6329     AC_LANG_POP([C++])
6331     AC_MSG_CHECKING([whether $CXX_BASE defines __si_class_type_info in cxxabi.h])
6332     AC_LANG_PUSH([C++])
6333     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6334             #include <cstddef>
6335             #include <cxxabi.h>
6336             std::size_t f() { return sizeof(__cxxabiv1::__si_class_type_info); }
6337         ])], [
6338             AC_DEFINE([HAVE_CXXABI_H_SI_CLASS_TYPE_INFO],[1])
6339             AC_MSG_RESULT([yes])
6340         ], [AC_MSG_RESULT([no])])
6341     AC_LANG_POP([C++])
6343     AC_MSG_CHECKING([whether $CXX_BASE defines __vmi_class_type_info in cxxabi.h])
6344     AC_LANG_PUSH([C++])
6345     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6346             #include <cstddef>
6347             #include <cxxabi.h>
6348             std::size_t f() { return sizeof(__cxxabiv1::__vmi_class_type_info); }
6349         ])], [
6350             AC_DEFINE([HAVE_CXXABI_H_VMI_CLASS_TYPE_INFO],[1])
6351             AC_MSG_RESULT([yes])
6352         ], [AC_MSG_RESULT([no])])
6353     AC_LANG_POP([C++])
6355     dnl Available in GCC 4.9 and at least since Clang 3.4:
6356     AC_MSG_CHECKING([whether $CXX_BASE supports __attribute__((warn_unused))])
6357     AC_LANG_PUSH([C++])
6358     save_CXXFLAGS=$CXXFLAGS
6359     CXXFLAGS="$CXXFLAGS -Werror"
6360     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6361             struct __attribute__((warn_unused)) dummy {};
6362         ])], [
6363             AC_DEFINE([HAVE_GCC_ATTRIBUTE_WARN_UNUSED],[1])
6364             AC_MSG_RESULT([yes])
6365         ], [AC_MSG_RESULT([no])])
6366     CXXFLAGS=$save_CXXFLAGS
6367 AC_LANG_POP([C++])
6370 AC_SUBST(HAVE_GCC_AVX)
6371 AC_SUBST(HAVE_GCC_STACK_PROTECTOR_STRONG)
6372 AC_SUBST(HAVE_GCC_BUILTIN_ATOMIC)
6373 AC_SUBST(HAVE_GCC_BUILTIN_FFS)
6375 dnl ===================================================================
6376 dnl Identify the C++ library
6377 dnl ===================================================================
6379 AC_MSG_CHECKING([what the C++ library is])
6380 AC_LANG_PUSH([C++])
6381 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6382 #include <utility>
6383 #ifndef __GLIBCXX__
6384 foo bar
6385 #endif
6386 ]])],
6387     [CPP_LIBRARY=GLIBCXX
6388      cpp_library_name="GNU libstdc++"
6389     ],
6390     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6391 #include <utility>
6392 #ifndef _LIBCPP_VERSION
6393 foo bar
6394 #endif
6395 ]])],
6396     [CPP_LIBRARY=LIBCPP
6397      cpp_library_name="LLVM libc++"
6398      AC_DEFINE([HAVE_LIBCXX])
6399     ],
6400     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6401 #include <utility>
6402 #ifndef _MSC_VER
6403 foo bar
6404 #endif
6405 ]])],
6406     [CPP_LIBRARY=MSVCRT
6407      cpp_library_name="Microsoft"
6408     ],
6409     AC_MSG_ERROR([Could not figure out what C++ library this is]))))
6410 AC_MSG_RESULT([$cpp_library_name])
6411 AC_LANG_POP([C++])
6413 dnl ===================================================================
6414 dnl Check for gperf
6415 dnl ===================================================================
6416 AC_PATH_PROG(GPERF, gperf)
6417 if test -z "$GPERF"; then
6418     AC_MSG_ERROR([gperf not found but needed. Install it.])
6420 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
6421     GPERF=`cygpath -m $GPERF`
6423 AC_MSG_CHECKING([whether gperf is new enough])
6424 my_gperf_ver1=$($GPERF --version | head -n 1)
6425 my_gperf_ver2=${my_gperf_ver1#GNU gperf }
6426 my_gperf_ver3=$(printf %s "$my_gperf_ver2" | $AWK -F. '{ print $1*100+($2<100?$2:99) }')
6427 if test "$my_gperf_ver3" -ge 301; then
6428     AC_MSG_RESULT([yes ($my_gperf_ver2)])
6429 else
6430     AC_MSG_ERROR(["$my_gperf_ver1" is too old or unrecognized, must be at least gperf 3.1])
6432 AC_SUBST(GPERF)
6434 dnl ===================================================================
6435 dnl Check for system libcmis
6436 dnl ===================================================================
6437 # libcmis requires curl and we can't build curl for iOS
6438 if test $_os != iOS; then
6439     libo_CHECK_SYSTEM_MODULE([libcmis],[LIBCMIS],[libcmis-0.5 >= 0.5.2])
6440     ENABLE_LIBCMIS=TRUE
6441 else
6442     ENABLE_LIBCMIS=
6444 AC_SUBST(ENABLE_LIBCMIS)
6446 dnl ===================================================================
6447 dnl C++11
6448 dnl ===================================================================
6450 AC_MSG_CHECKING([whether $CXX_BASE supports C++17])
6451 CXXFLAGS_CXX11=
6452 if test "$COM" = MSC -a "$COM_IS_CLANG" != TRUE; then
6453     CXXFLAGS_CXX11='-std:c++17 -Zc:__cplusplus'
6454 elif test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6455     my_flags='-std=gnu++2a -std=c++2a -std=gnu++17 -std=gnu++1z -std=c++17 -std=c++1z'
6456     for flag in $my_flags; do
6457         if test "$COM" = MSC; then
6458             flag="-Xclang $flag"
6459         fi
6460         save_CXXFLAGS=$CXXFLAGS
6461         CXXFLAGS="$CXXFLAGS $flag -Werror"
6462         if test "$SYSTEM_LIBCMIS" = TRUE; then
6463             CXXFLAGS="$CXXFLAGS -DSYSTEM_LIBCMIS $LIBCMIS_CFLAGS"
6464         fi
6465         AC_LANG_PUSH([C++])
6466         dnl Clang 3.9 supports __float128 since
6467         dnl <http://llvm.org/viewvc/llvm-project?view=revision&revision=268898> "Enable support for
6468         dnl __float128 in Clang and enable it on pertinent platforms", but Clang 3.8 may need a
6469         dnl hacky workaround to be able to include <vector> (as is done in the main check whether
6470         dnl $flag is supported below, so check this first):
6471         my_float128hack=
6472         my_float128hack_impl=-D__float128=void
6473         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6474             #include <vector>
6475             // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6476             // (__float128)
6477             ]])
6478         ],,[
6479             dnl The only reason why libstdc++ headers fail with Clang in C++11 mode is because they
6480             dnl use the __float128 type that Clang doesn't know (libstdc++ checks whether __float128
6481             dnl is available during its build, but it's usually built using GCC, and so c++config.h
6482             dnl hardcodes __float128 being supported). At least for some older libstdc++, the only
6483             dnl place where __float128 is used is in a template specialization, -D__float128=void
6484             dnl will avoid the problem there while still causing a problem if somebody actually uses
6485             dnl the type. (But some later libstdc++ are known to use __float128 also in algorithm ->
6486             dnl bits/stl_alog.h -> cstdlib -> bits/std_abs.h, in a way that unfortunately cannot be
6487             dnl "fixed" with this hack):
6488             CXXFLAGS="$CXXFLAGS $my_float128hack_impl"
6489             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6490                 #include <vector>
6491                 // some Clang fail when compiling against libstdc++ headers with -std=gnu++0x
6492                 // (__float128)
6493                 ]])
6494             ],[my_float128hack=$my_float128hack_impl])
6495         ])
6496         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6497             #include <algorithm>
6498             #include <cmath>
6499             #include <functional>
6500             #include <vector>
6502             #if defined SYSTEM_LIBCMIS
6503             // See ucb/source/ucp/cmis/auth_provider.hxx:
6504             #if !defined __clang__
6505             #pragma GCC diagnostic push
6506             #pragma GCC diagnostic ignored "-Wdeprecated"
6507             #pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
6508             #endif
6509             #include <libcmis/libcmis.hxx>
6510             #if !defined __clang__
6511             #pragma GCC diagnostic pop
6512             #endif
6513             #endif
6515             void f(std::vector<int> & v, std::function<bool(int, int)> fn) {
6516                 std::sort(v.begin(), v.end(), fn);
6517             }
6519             // At least with glibc-headers-2.28-26.fc29.x86_64, when building for Linux x86 32-bit
6520             // (via -m32) and passed-in CXXFLAGS setting -O1 (or higher; overriding -Os as set in
6521             // solenv/gbuild/platform/LINUX_INTEL_GCC.mk), std=gnu* would cause math_errhandling to
6522             // get undef'ed in /usr/include/bits/mathinline.h, while std=c* keeps it defined (as
6523             // needed by sc/source/core/tool/math.cxx):
6524             int g() { return math_errhandling; }
6525             ]])],[CXXFLAGS_CXX11=$flag $my_float128hack])
6526         AC_LANG_POP([C++])
6527         CXXFLAGS=$save_CXXFLAGS
6528         if test -n "$CXXFLAGS_CXX11"; then
6529             break
6530         fi
6531     done
6533 if test -n "$CXXFLAGS_CXX11"; then
6534     AC_MSG_RESULT([yes ($CXXFLAGS_CXX11)])
6535 else
6536     AC_MSG_ERROR(no)
6538 AC_SUBST(CXXFLAGS_CXX11)
6540 if test "$GCC" = "yes"; then
6541     save_CXXFLAGS=$CXXFLAGS
6542     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6543     CHECK_L_ATOMIC
6544     CXXFLAGS=$save_CXXFLAGS
6545     AC_SUBST(ATOMIC_LIB)
6548 dnl Test for temporarily incompatible libstdc++ 4.7.{0,1}, where
6549 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=179528> introduced
6550 dnl an additional member _M_size into C++11 std::list towards 4.7.0 and
6551 dnl <https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=189186> removed it
6552 dnl again towards 4.7.2:
6553 if test $CPP_LIBRARY = GLIBCXX; then
6554     AC_MSG_CHECKING([whether using C++11 causes libstdc++ 4.7.0/4.7.1 ABI breakage])
6555     AC_LANG_PUSH([C++])
6556     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6557 #include <list>
6558 #if !defined __GLIBCXX__ || (__GLIBCXX__ != 20120322 && __GLIBCXX__ != 20120614)
6559     // according to <https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html>:
6560     //   GCC 4.7.0: 20120322
6561     //   GCC 4.7.1: 20120614
6562     // and using a range check is not possible as the mapping between
6563     // __GLIBCXX__ values and GCC versions is not monotonic
6564 /* ok */
6565 #else
6566 abi broken
6567 #endif
6568         ]])], [AC_MSG_RESULT(no, ok)],
6569         [AC_MSG_ERROR(yes)])
6570     AC_LANG_POP([C++])
6573 AC_MSG_CHECKING([whether $CXX_BASE supports C++11 without Language Defect 757])
6574 save_CXXFLAGS=$CXXFLAGS
6575 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6576 AC_LANG_PUSH([C++])
6578 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
6579 #include <stddef.h>
6581 template <typename T, size_t S> char (&sal_n_array_size( T(&)[S] ))[S];
6583 namespace
6585         struct b
6586         {
6587                 int i;
6588                 int j;
6589         };
6591 ]], [[
6592 struct a
6594         int i;
6595         int j;
6597 a thinga[]={{0,0}, {1,1}};
6598 b thingb[]={{0,0}, {1,1}};
6599 size_t i = sizeof(sal_n_array_size(thinga));
6600 size_t j = sizeof(sal_n_array_size(thingb));
6601 return !(i != 0 && j != 0);
6603     ], [ AC_MSG_RESULT(yes) ],
6604     [ AC_MSG_ERROR(no)])
6605 AC_LANG_POP([C++])
6606 CXXFLAGS=$save_CXXFLAGS
6608 dnl _Pragma support (may require C++11)
6609 if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
6610     AC_MSG_CHECKING([whether $CXX_BASE supports _Pragma operator])
6611     AC_LANG_PUSH([C++])
6612     save_CXXFLAGS=$CXXFLAGS
6613     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
6614     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6615             _Pragma("GCC diagnostic ignored \"-Wformat\"")
6616         ])], [
6617             AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
6618             AC_MSG_RESULT([yes])
6619         ], [AC_MSG_RESULT([no])])
6620     AC_LANG_POP([C++])
6621     CXXFLAGS=$save_CXXFLAGS
6624 HAVE_GCC_FNO_SIZED_DEALLOCATION=
6625 if test "$GCC" = yes; then
6626     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-sized-deallocation])
6627     AC_LANG_PUSH([C++])
6628     save_CXXFLAGS=$CXXFLAGS
6629     CXXFLAGS="$CXXFLAGS -fno-sized-deallocation"
6630     AC_LINK_IFELSE([AC_LANG_PROGRAM()],[HAVE_GCC_FNO_SIZED_DEALLOCATION=TRUE])
6631     CXXFLAGS=$save_CXXFLAGS
6632     AC_LANG_POP([C++])
6633     if test "$HAVE_GCC_FNO_SIZED_DEALLOCATION" = TRUE; then
6634         AC_MSG_RESULT([yes])
6635     else
6636         AC_MSG_RESULT([no])
6637     fi
6639 AC_SUBST([HAVE_GCC_FNO_SIZED_DEALLOCATION])
6641 AC_MSG_CHECKING([whether $CXX_BASE supports guaranteed copy elision])
6642 AC_LANG_PUSH([C++])
6643 save_CXXFLAGS=$CXXFLAGS
6644 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6645 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6646         // At least VS 2017 15.8.1 defines __cpp_guaranteed_copy_elision as 201606L without actually
6647         // supporting it:
6648         #if !defined __cpp_guaranteed_copy_elision || (defined _MSC_VER && !defined __clang__)
6649         struct S {
6650         private:
6651             S(S const &);
6652         public:
6653             S();
6654             ~S();
6655         };
6656         S copy();
6657         void f() { S c(copy()); }
6658         #endif
6659     ])], [
6660         AC_DEFINE([HAVE_CPP_GUARANTEED_COPY_ELISION],[1])
6661         AC_MSG_RESULT([yes])
6662     ], [AC_MSG_RESULT([no])])
6663 CXXFLAGS=$save_CXXFLAGS
6664 AC_LANG_POP([C++])
6666 AC_MSG_CHECKING([whether $CXX_BASE has GCC bug 87150])
6667 AC_LANG_PUSH([C++])
6668 save_CXXFLAGS=$CXXFLAGS
6669 CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
6670 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6671         struct S1 { S1(S1 &&); };
6672         struct S2: S1 {};
6673         S1 f(S2 s) { return s; }
6674     ])], [
6675         AC_DEFINE([HAVE_GCC_BUG_87150],[1])
6676         AC_MSG_RESULT([yes])
6677     ], [AC_MSG_RESULT([no])])
6678 CXXFLAGS=$save_CXXFLAGS
6679 AC_LANG_POP([C++])
6681 dnl At least GCC 8.2 with -O2 (i.e., --enable-optimized) causes a false-positive -Wmaybe-
6682 dnl uninitialized warning for code like
6684 dnl   OString f();
6685 dnl   boost::optional<OString> * g(bool b) {
6686 dnl       boost::optional<OString> o;
6687 dnl       if (b) o = f();
6688 dnl       return new boost::optional<OString>(o);
6689 dnl   }
6691 dnl (as is e.g. present, in a slightly more elaborate form, in
6692 dnl librdf_TypeConverter::extractNode_NoLock in unoxml/source/rdf/librdf_repository.cxx); the below
6693 dnl code is meant to be a faithfully stripped-down and self-contained version of the above code:
6694 HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=
6695 if test "$GCC" = yes && test "$COM_IS_CLANG" != TRUE; then
6696     AC_MSG_CHECKING([whether $CXX_BASE might report false -Werror=maybe-uninitialized])
6697     AC_LANG_PUSH([C++])
6698     save_CXXFLAGS=$CXXFLAGS
6699     CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror -Wmaybe-uninitialized"
6700     if test "$ENABLE_OPTIMIZED" = TRUE; then
6701         CXXFLAGS="$CXXFLAGS -O2"
6702     else
6703         CXXFLAGS="$CXXFLAGS -O0"
6704     fi
6705     AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
6706             #include <new>
6707             void f1(int);
6708             struct S1 {
6709                 ~S1() { f1(n); }
6710                 int n = 0;
6711             };
6712             struct S2 {
6713                 S2() {}
6714                 S2(S2 const & s) { if (s.init) set(*reinterpret_cast<S1 const *>(s.stg)); }
6715                 ~S2() { if (init) reinterpret_cast<S1 *>(stg)->S1::~S1(); }
6716                 void set(S1 s) {
6717                     new (stg) S1(s);
6718                     init = true;
6719                 }
6720                 bool init = false;
6721                 char stg[sizeof (S1)];
6722             } ;
6723             S1 f2();
6724             S2 * f3(bool b) {
6725                 S2 o;
6726                 if (b) o.set(f2());
6727                 return new S2(o);
6728             }
6729         ]])], [AC_MSG_RESULT([no])], [
6730             HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED=TRUE
6731             AC_MSG_RESULT([yes])
6732         ])
6733     CXXFLAGS=$save_CXXFLAGS
6734     AC_LANG_POP([C++])
6736 AC_SUBST([HAVE_BROKEN_GCC_WMAYBE_UNINITIALIZED])
6738 dnl ===================================================================
6739 dnl CPU Intrinsics support - SSE, AVX
6740 dnl ===================================================================
6742 INTRINSICS_CXXFLAGS=""
6744 if test "$GCC" = "yes"; then
6745     AC_MSG_CHECKING([whether $CXX can compile SSE2 intrinsics])
6746     AC_LANG_PUSH([C++])
6747     save_CXXFLAGS=$CXXFLAGS
6748     CXXFLAGS="$CXXFLAGS -msse2"
6749     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6750         #include <emmintrin.h>
6751         int main () {
6752             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6753             c = _mm_xor_si128 (a, b);
6754             return 0;
6755         }
6756         ])],
6757         [can_compile_sse2=yes],
6758         [can_compile_sse2=no])
6759     AC_LANG_POP([C++])
6760     CXXFLAGS=$save_CXXFLAGS
6761     AC_MSG_RESULT([${can_compile_sse2}])
6762     if test "${can_compile_sse2}" = "yes" ; then
6763         INTRINSICS_CXXFLAGS="-msse2"
6764     else
6765         AC_MSG_WARN([cannot compile SSE2 intrinsics])
6766     fi
6768     AC_MSG_CHECKING([whether $CXX can compile SSSE3 intrinsics])
6769     AC_LANG_PUSH([C++])
6770     save_CXXFLAGS=$CXXFLAGS
6771     CXXFLAGS="$CXXFLAGS -mssse3"
6772     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6773         #include <tmmintrin.h>
6774         int main () {
6775             volatile __m128i a = _mm_set1_epi32 (0), b = _mm_set1_epi32 (0), c;
6776             c = _mm_maddubs_epi16 (a, b);
6777             return 0;
6778         }
6779         ])],
6780         [can_compile_ssse3=yes],
6781         [can_compile_ssse3=no])
6782     AC_LANG_POP([C++])
6783     CXXFLAGS=$save_CXXFLAGS
6784     AC_MSG_RESULT([${can_compile_ssse3}])
6785     if test "${can_compile_ssse3}" = "yes" ; then
6786         INTRINSICS_CXXFLAGS="-mssse3"
6787     else
6788         AC_MSG_WARN([cannot compile SSSE3 intrinsics])
6789     fi
6791     AC_MSG_CHECKING([whether $CXX can compile AVX intrinsics])
6792     AC_LANG_PUSH([C++])
6793     save_CXXFLAGS=$CXXFLAGS
6794     CXXFLAGS="$CXXFLAGS -mavx"
6795     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6796         #include <immintrin.h>
6797         int main () {
6798             volatile __m256 a = _mm256_set1_ps (0.0f), b = _mm256_set1_ps (0.0f), c;
6799             c = _mm256_xor_ps(a, b);
6800             return 0;
6801         }
6802         ])],
6803         [can_compile_avx=yes],
6804         [can_compile_avx=no])
6805     AC_LANG_POP([C++])
6806     CXXFLAGS=$save_CXXFLAGS
6807     AC_MSG_RESULT([${can_compile_avx}])
6808     if test "${can_compile_avx}" = "yes" ; then
6809         INTRINSICS_CXXFLAGS="-mavx"
6810     else
6811         AC_MSG_WARN([cannot compile AVX intrinsics])
6812     fi
6814     AC_MSG_CHECKING([whether $CXX can compile AVX2 intrinsics])
6815     AC_LANG_PUSH([C++])
6816     save_CXXFLAGS=$CXXFLAGS
6817     CXXFLAGS="$CXXFLAGS -mavx2"
6818     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
6819         #include <immintrin.h>
6820         int main () {
6821             volatile __m256i a = _mm256_set1_epi32 (0), b = _mm256_set1_epi32 (0), c;
6822             c = _mm256_maddubs_epi16(a, b);
6823             return 0;
6824         }
6825         ])],
6826         [can_compile_avx2=yes],
6827         [can_compile_avx2=no])
6828     AC_LANG_POP([C++])
6829     CXXFLAGS=$save_CXXFLAGS
6830     AC_MSG_RESULT([${can_compile_avx2}])
6831     if test "${can_compile_avx2}" = "yes" ; then
6832         INTRINSICS_CXXFLAGS="-mavx2"
6833     else
6834         AC_MSG_WARN([cannot compile AVX2 intrinsics])
6835     fi
6838 AC_SUBST([INTRINSICS_CXXFLAGS])
6840 dnl ===================================================================
6841 dnl system stl sanity tests
6842 dnl ===================================================================
6843 if test "$_os" != "WINNT"; then
6845     AC_LANG_PUSH([C++])
6847     save_CPPFLAGS="$CPPFLAGS"
6848     if test -n "$MACOSX_SDK_PATH"; then
6849         CPPFLAGS="-isysroot $MACOSX_SDK_PATH $CPPFLAGS"
6850     fi
6852     # Assume visibility is not broken with libc++. The below test is very much designed for libstdc++
6853     # only.
6854     if test "$CPP_LIBRARY" = GLIBCXX; then
6855         dnl gcc#19664, gcc#22482, rhbz#162935
6856         AC_MSG_CHECKING([if STL headers are visibility safe (GCC bug 22482)])
6857         AC_EGREP_HEADER(visibility push, string, stlvisok=yes, stlvisok=no)
6858         AC_MSG_RESULT([$stlvisok])
6859         if test "$stlvisok" = "no"; then
6860             AC_MSG_ERROR([Your libstdc++ headers are not visibility safe. This is no longer supported.])
6861         fi
6862     fi
6864     # As the below test checks things when linking self-compiled dynamic libraries, it presumably is irrelevant
6865     # when we don't make any dynamic libraries?
6866     if test "$DISABLE_DYNLOADING" = ""; then
6867         AC_MSG_CHECKING([if $CXX_BASE is -fvisibility-inlines-hidden safe (Clang bug 11250)])
6868         cat > conftestlib1.cc <<_ACEOF
6869 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6870 struct S2: S1<int> { virtual ~S2(); };
6871 S2::~S2() {}
6872 _ACEOF
6873         cat > conftestlib2.cc <<_ACEOF
6874 template<typename T> struct S1 { virtual ~S1() {} virtual void f() {} };
6875 struct S2: S1<int> { virtual ~S2(); };
6876 struct S3: S2 { virtual ~S3(); }; S3::~S3() {}
6877 _ACEOF
6878         gccvisinlineshiddenok=yes
6879         if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib1.cc -o libconftest1$DLLPOST >/dev/null 2>&5; then
6880             gccvisinlineshiddenok=no
6881         else
6882             dnl At least Clang -fsanitize=address and -fsanitize=undefined are
6883             dnl known to not work with -z defs (unsetting which makes the test
6884             dnl moot, though):
6885             my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
6886             if test "$COM_IS_CLANG" = TRUE; then
6887                 for i in $CXX $CXXFLAGS; do
6888                     case $i in
6889                     -fsanitize=*)
6890                         my_linkflagsnoundefs=
6891                         break
6892                         ;;
6893                     esac
6894                 done
6895             fi
6896             if ! $CXX $CXXFLAGS $CPPFLAGS $LINKFLAGSSHL -fPIC -fvisibility-inlines-hidden conftestlib2.cc -L. -lconftest1 $my_linkflagsnoundefs -o libconftest2$DLLPOST >/dev/null 2>&5; then
6897                 gccvisinlineshiddenok=no
6898             fi
6899         fi
6901         rm -fr libconftest*
6902         AC_MSG_RESULT([$gccvisinlineshiddenok])
6903         if test "$gccvisinlineshiddenok" = "no"; then
6904             AC_MSG_ERROR([Your gcc/clang is not -fvisibility-inlines-hidden safe. This is no longer supported.])
6905         fi
6906     fi
6908    AC_MSG_CHECKING([if $CXX_BASE has a visibility bug with class-level attributes (GCC bug 26905)])
6909     cat >visibility.cxx <<_ACEOF
6910 #pragma GCC visibility push(hidden)
6911 struct __attribute__ ((visibility ("default"))) TestStruct {
6912   static void Init();
6914 __attribute__ ((visibility ("default"))) void TestFunc() {
6915   TestStruct::Init();
6917 _ACEOF
6918     if ! $CXX $CXXFLAGS $CPPFLAGS -fpic -S visibility.cxx; then
6919         gccvisbroken=yes
6920     else
6921         case "$host_cpu" in
6922         i?86|x86_64)
6923             if test "$_os" = "Darwin" -o "$_os" = "iOS"; then
6924                 gccvisbroken=no
6925             else
6926                 if $EGREP -q '@PLT|@GOT' visibility.s || test "$ENABLE_LTO" = "TRUE"; then
6927                     gccvisbroken=no
6928                 else
6929                     gccvisbroken=yes
6930                 fi
6931             fi
6932             ;;
6933         *)
6934             gccvisbroken=no
6935             ;;
6936         esac
6937     fi
6938     rm -f visibility.s visibility.cxx
6940     AC_MSG_RESULT([$gccvisbroken])
6941     if test "$gccvisbroken" = "yes"; then
6942         AC_MSG_ERROR([Your gcc is not -fvisibility=hidden safe. This is no longer supported.])
6943     fi
6945     CPPFLAGS="$save_CPPFLAGS"
6947     AC_LANG_POP([C++])
6950 dnl ===================================================================
6951 dnl  Clang++ tests
6952 dnl ===================================================================
6954 HAVE_GCC_FNO_ENFORCE_EH_SPECS=
6955 if test "$GCC" = "yes"; then
6956     AC_MSG_CHECKING([whether $CXX_BASE supports -fno-enforce-eh-specs])
6957     AC_LANG_PUSH([C++])
6958     save_CXXFLAGS=$CXXFLAGS
6959     CXXFLAGS="$CFLAGS -Werror -fno-enforce-eh-specs"
6960     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_FNO_ENFORCE_EH_SPECS=TRUE ],[])
6961     CXXFLAGS=$save_CXXFLAGS
6962     AC_LANG_POP([C++])
6963     if test "$HAVE_GCC_FNO_ENFORCE_EH_SPECS" = "TRUE"; then
6964         AC_MSG_RESULT([yes])
6965     else
6966         AC_MSG_RESULT([no])
6967     fi
6969 AC_SUBST(HAVE_GCC_FNO_ENFORCE_EH_SPECS)
6971 dnl ===================================================================
6972 dnl Compiler plugins
6973 dnl ===================================================================
6975 COMPILER_PLUGINS=
6976 # currently only Clang
6978 if test "$COM_IS_CLANG" != "TRUE"; then
6979     if test "$libo_fuzzed_enable_compiler_plugins" = yes -a "$enable_compiler_plugins" = yes; then
6980         AC_MSG_NOTICE([Resetting --enable-compiler-plugins=no])
6981         enable_compiler_plugins=no
6982     fi
6985 if test "$COM_IS_CLANG" = "TRUE"; then
6986     if test -n "$enable_compiler_plugins"; then
6987         compiler_plugins="$enable_compiler_plugins"
6988     elif test -n "$ENABLE_DBGUTIL"; then
6989         compiler_plugins=test
6990     else
6991         compiler_plugins=no
6992     fi
6993     if test "$compiler_plugins" != no -a "$my_apple_clang" != yes; then
6994         if test "$CLANGVER" -lt 50002; then
6995             if test "$compiler_plugins" = yes; then
6996                 AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 5.0.2.])
6997             else
6998                 compiler_plugins=no
6999             fi
7000         fi
7001     fi
7002     if test "$compiler_plugins" != "no"; then
7003         dnl The prefix where Clang resides, override to where Clang resides if
7004         dnl using a source build:
7005         if test -z "$CLANGDIR"; then
7006             CLANGDIR=$(dirname $(dirname $($CXX -print-prog-name=$(basename $CXX))))
7007         fi
7008         AC_LANG_PUSH([C++])
7009         save_CPPFLAGS=$CPPFLAGS
7010         save_CXX=$CXX
7011         save_CXXCPP=$CXXCPP
7012         # compiler plugins must be built with "native" compiler that was used to build Clang itself:
7013         : "${COMPILER_PLUGINS_CXX=g++ -std=c++11}"
7014         CXX=$COMPILER_PLUGINS_CXX
7015         CXXCPP="$COMPILER_PLUGINS_CXX -E"
7016         CPPFLAGS="$CPPFLAGS -I$CLANGDIR/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
7017         AC_CHECK_HEADER(clang/AST/RecursiveASTVisitor.h,
7018             [COMPILER_PLUGINS=TRUE],
7019             [
7020             if test "$compiler_plugins" = "yes"; then
7021                 AC_MSG_ERROR([Cannot find Clang headers to build compiler plugins.])
7022             else
7023                 AC_MSG_WARN([Cannot find Clang headers to build compiler plugins, plugins disabled])
7024                 add_warning "Cannot find Clang headers to build compiler plugins, plugins disabled."
7025             fi
7026             ])
7027         CXX=$save_CXX
7028         CXXCPP=$save_CXXCPP
7029         CPPFLAGS=$save_CPPFLAGS
7030         AC_LANG_POP([C++])
7031     fi
7032 else
7033     if test "$enable_compiler_plugins" = "yes"; then
7034         AC_MSG_ERROR([Compiler plugins are currently supported only with the Clang compiler.])
7035     fi
7037 AC_SUBST(COMPILER_PLUGINS)
7038 AC_SUBST(COMPILER_PLUGINS_CXX)
7039 AC_SUBST(COMPILER_PLUGINS_CXX_LINKFLAGS)
7040 AC_SUBST(COMPILER_PLUGINS_DEBUG)
7041 AC_SUBST(COMPILER_PLUGINS_TOOLING_ARGS)
7042 AC_SUBST(CLANGDIR)
7043 AC_SUBST(CLANGLIBDIR)
7045 # Plugin to help linker.
7046 # Add something like LD_PLUGIN=/usr/lib64/LLVMgold.so to your autogen.input.
7047 # This makes --enable-lto build with clang work.
7048 AC_SUBST(LD_PLUGIN)
7050 AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, [HAVE_POSIX_FALLOCATE=NO])
7051 AC_SUBST(HAVE_POSIX_FALLOCATE)
7053 dnl ===================================================================
7054 dnl Custom build version
7055 dnl ===================================================================
7057 AC_MSG_CHECKING([whether to add custom build version])
7058 if test "$with_build_version" != ""; then
7059     BUILD_VER_STRING=$with_build_version
7060     AC_MSG_RESULT([yes, $BUILD_VER_STRING])
7061 else
7062     BUILD_VER_STRING=
7063     AC_MSG_RESULT([no])
7065 AC_SUBST(BUILD_VER_STRING)
7067 JITC_PROCESSOR_TYPE=""
7068 if test "$_os" = "Linux" -a "$host_cpu" = "powerpc"; then
7069     # IBMs JDK needs this...
7070     JITC_PROCESSOR_TYPE=6
7071     export JITC_PROCESSOR_TYPE
7073 AC_SUBST([JITC_PROCESSOR_TYPE])
7075 # Misc Windows Stuff
7076 AC_ARG_WITH(ucrt-dir,
7077     AS_HELP_STRING([--with-ucrt-dir],
7078         [path to the directory with the arch-specific MSU packages of the Windows Universal CRT redistributables
7079         (MS KB 2999226) for packaging into the installsets (without those the target system needs to install
7080         the UCRT or Visual C++ Runtimes manually). The directory must contain the following 6 files:
7081             Windows6.1-KB2999226-x64.msu
7082             Windows6.1-KB2999226-x86.msu
7083             Windows8.1-KB2999226-x64.msu
7084             Windows8.1-KB2999226-x86.msu
7085             Windows8-RT-KB2999226-x64.msu
7086             Windows8-RT-KB2999226-x86.msu
7087         A zip archive including those files is available from Microsoft site:
7088         https://www.microsoft.com/en-us/download/details.aspx?id=48234]),
7090 UCRT_REDISTDIR="$with_ucrt_dir"
7091 if test $_os = "WINNT"; then
7092     find_msvc_x64_dlls
7093     find_msms
7094     MSVC_DLL_PATH=`win_short_path_for_make "$msvcdllpath"`
7095     MSVC_DLLS="$msvcdlls"
7096     MSM_PATH=`win_short_path_for_make "$msmdir"`
7097     # MSVC 15.3 changed it to VC141
7098     if echo "$msvcdllpath" | grep -q "VC141.CRT$"; then
7099         SCPDEFS="$SCPDEFS -DWITH_VC141_REDIST"
7100     else
7101         SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
7102     fi
7104     if test "$UCRT_REDISTDIR" = "no"; then
7105         dnl explicitly disabled
7106         UCRT_REDISTDIR=""
7107     else
7108         if ! test -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x64.msu" -a \
7109                   -f "$UCRT_REDISTDIR/Windows6.1-KB2999226-x86.msu" -a \
7110                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x64.msu" -a \
7111                   -f "$UCRT_REDISTDIR/Windows8.1-KB2999226-x86.msu" -a \
7112                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x64.msu" -a \
7113                   -f "$UCRT_REDISTDIR/Windows8-RT-KB2999226-x86.msu"; then
7114             UCRT_REDISTDIR=""
7115             if test -n "$PKGFORMAT"; then
7116                for i in $PKGFORMAT; do
7117                    case "$i" in
7118                    msi)
7119                        AC_MSG_WARN([--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency])
7120                        add_warning "--without-ucrt-dir not specified or MSUs not found - installer will have runtime dependency"
7121                        ;;
7122                    esac
7123                done
7124             fi
7125         fi
7126     fi
7129 AC_SUBST(UCRT_REDISTDIR)
7130 AC_SUBST(MSVC_DLL_PATH)
7131 AC_SUBST(MSVC_DLLS)
7132 AC_SUBST(MSM_PATH)
7134 dnl ===================================================================
7135 dnl Checks for Java
7136 dnl ===================================================================
7137 if test "$ENABLE_JAVA" != ""; then
7139     # Windows-specific tests
7140     if test "$build_os" = "cygwin"; then
7141         if test "$BITNESS_OVERRIDE" = 64; then
7142             bitness=64
7143         else
7144             bitness=32
7145         fi
7147         if test -z "$with_jdk_home"; then
7148             dnl See <https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-EEED398E-AE37-4D12-
7149             dnl AB10-49F82F720027> section "Windows Registry Key Changes":
7150             reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion"
7151             if test -n "$regvalue"; then
7152                 ver=$regvalue
7153                 reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/$ver/JavaHome"
7154                 _jdk_home=$regvalue
7155             fi
7156             if test -z "$with_jdk_home"; then
7157                 for ver in 1.8; do
7158                     reg_get_value "$bitness" "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
7159                     if test -n "$regvalue"; then
7160                         _jdk_home=$regvalue
7161                         break
7162                     fi
7163                 done
7164             fi
7165             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
7166                 with_jdk_home="$_jdk_home"
7167                 howfound="found automatically"
7168             else
7169                 AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness-bit JDK])
7170             fi
7171         else
7172             test "$build_os" = "cygwin" && with_jdk_home=`win_short_path_for_make "$with_jdk_home"`
7173             howfound="you passed"
7174         fi
7175     fi
7177     # 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.
7178     # /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java, but /usr does not contain the JDK libraries
7179     if test -z "$with_jdk_home" -a "$_os" = "Darwin" -a -x /usr/libexec/java_home; then
7180         with_jdk_home=`/usr/libexec/java_home`
7181     fi
7183     JAVA_HOME=; export JAVA_HOME
7184     if test -z "$with_jdk_home"; then
7185         AC_PATH_PROG(JAVAINTERPRETER, $with_java)
7186     else
7187         _java_path="$with_jdk_home/bin/$with_java"
7188         dnl Check if there is a Java interpreter at all.
7189         if test -x "$_java_path"; then
7190             JAVAINTERPRETER=$_java_path
7191         else
7192             AC_MSG_ERROR([$_java_path not found, pass --with-jdk-home])
7193         fi
7194     fi
7196     dnl Check that the JDK found is correct architecture (at least 2 reasons to
7197     dnl check: officebean needs to link -ljawt, and libjpipe.so needs to be
7198     dnl loaded by java to run JunitTests:
7199     if test "$build_os" = "cygwin"; then
7200         shortjdkhome=`cygpath -d "$with_jdk_home"`
7201         if test "$BITNESS_OVERRIDE" = 64 -a -f "$with_jdk_home/bin/java.exe" -a "`$shortjdkhome/bin/java.exe -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7202             AC_MSG_WARN([You are building 64-bit binaries but the JDK $howfound is 32-bit])
7203             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7204         elif test "$BITNESS_OVERRIDE" = "" -a -f "$_jdk_home/bin/java.exe" -a "`$shortjdkhome/bin/java.exe -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7205             AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7206             AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7207         fi
7209         if test x`echo "$JAVAINTERPRETER" | $GREP -i '\.exe$'` = x; then
7210             JAVAINTERPRETER="${JAVAINTERPRETER}.exe"
7211         fi
7212         JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
7213     elif test "$cross_compiling" != "yes"; then
7214         case $CPUNAME in
7215             AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
7216                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
7217                     AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
7218                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
7219                 fi
7220                 ;;
7221             *) # assumption: everything else 32-bit
7222                 if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" != ""  >/dev/null; then
7223                     AC_MSG_WARN([You are building 32-bit binaries but the JDK $howfound is 64-bit])
7224                     AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a (32-bit) JDK])
7225                 fi
7226                 ;;
7227         esac
7228     fi
7231 dnl ===================================================================
7232 dnl Checks for JDK.
7233 dnl ===================================================================
7235 # Note that JAVA_HOME as for now always means the *build* platform's
7236 # JAVA_HOME. Whether all the complexity here actually is needed any
7237 # more or not, no idea.
7239 if test "$ENABLE_JAVA" != ""; then
7240     _gij_longver=0
7241     AC_MSG_CHECKING([the installed JDK])
7242     if test -n "$JAVAINTERPRETER"; then
7243         dnl java -version sends output to stderr!
7244         if test `$JAVAINTERPRETER -version 2>&1 | $GREP -c "Kaffe"` -gt 0; then
7245             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7246         elif test `$JAVAINTERPRETER --version 2>&1 | $GREP -c "GNU libgcj"` -gt 0; then
7247             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7248         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "BEA"` -gt 0; then
7249             AC_MSG_ERROR([No valid check available. Please check the block for your desired java in configure.ac])
7250         elif test `$JAVAINTERPRETER -version 2>&1 | $AWK '{ print }' | $GREP -c "IBM"` -gt 0; then
7251             JDK=ibm
7253             dnl IBM JDK specific tests
7254             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED s/[[-A-Za-z]]*//`
7255             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7257             if test "$_jdk_ver" -lt 10800; then
7258                 AC_MSG_ERROR([IBM JDK is too old, you need at least 8])
7259             fi
7261             AC_MSG_RESULT([found (IBM JDK $_jdk)])
7263             if test "$with_jdk_home" = ""; then
7264                 AC_MSG_ERROR([In order to successfully build LibreOffice using the IBM JDK,
7265 you must use the "--with-jdk-home" configure option explicitly])
7266             fi
7268             JAVA_HOME=$with_jdk_home
7269         else
7270             JDK=sun
7272             dnl Sun JDK specific tests
7273             _jdk=`$JAVAINTERPRETER -version 2>&1 | $AWK -F'"' '{ print \$2 }' | $SED '/^$/d' | $SED s/[[-A-Za-z]]*//`
7274             _jdk_ver=`echo "$_jdk" | $AWK -F. '{ print (($1 * 100) + $2) * 100 + $3;}'`
7276             if test "$_jdk_ver" -lt 10800; then
7277                 AC_MSG_ERROR([JDK is too old, you need at least 8])
7278             fi
7279             if test "$_jdk_ver" -gt 10800; then
7280                 JAVA_CLASSPATH_NOT_SET=TRUE
7281             fi
7283             AC_MSG_RESULT([found (JDK $_jdk)])
7284             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*java,,p"`
7285             if test "$_os" = "WINNT"; then
7286                 JAVA_HOME=`echo $JAVA_HOME | $SED "s,\.[[eE]][[xX]][[eE]]$,,"`
7287             fi
7289             # set to limit VM usage for JunitTests
7290             JAVAIFLAGS=-Xmx64M
7291             # set to limit VM usage for javac
7292             JAVAFLAGS=-J-Xmx128M
7293         fi
7294     else
7295         AC_MSG_ERROR([Java not found. You need at least JDK 8])
7296     fi
7297 else
7298     dnl Java disabled
7299     JAVA_HOME=
7300     export JAVA_HOME
7303 dnl ===================================================================
7304 dnl Checks for javac
7305 dnl ===================================================================
7306 if test "$ENABLE_JAVA" != ""; then
7307     javacompiler="javac"
7308     : ${JAVA_SOURCE_VER=8}
7309     : ${JAVA_TARGET_VER=8}
7310     if test -z "$with_jdk_home"; then
7311         AC_PATH_PROG(JAVACOMPILER, $javacompiler)
7312     else
7313         _javac_path="$with_jdk_home/bin/$javacompiler"
7314         dnl Check if there is a Java compiler at all.
7315         if test -x "$_javac_path"; then
7316             JAVACOMPILER=$_javac_path
7317         fi
7318     fi
7319     if test -z "$JAVACOMPILER"; then
7320         AC_MSG_ERROR([$javacompiler not found set with_jdk_home])
7321     fi
7322     if test "$build_os" = "cygwin"; then
7323         if test x`echo "$JAVACOMPILER" | $GREP -i '\.exe$'` = x; then
7324             JAVACOMPILER="${JAVACOMPILER}.exe"
7325         fi
7326         JAVACOMPILER=`win_short_path_for_make "$JAVACOMPILER"`
7327     fi
7330 dnl ===================================================================
7331 dnl Checks for javadoc
7332 dnl ===================================================================
7333 if test "$ENABLE_JAVA" != ""; then
7334     if test -z "$with_jdk_home"; then
7335         AC_PATH_PROG(JAVADOC, javadoc)
7336     else
7337         _javadoc_path="$with_jdk_home/bin/javadoc"
7338         dnl Check if there is a javadoc at all.
7339         if test -x "$_javadoc_path"; then
7340             JAVADOC=$_javadoc_path
7341         else
7342             AC_PATH_PROG(JAVADOC, javadoc)
7343         fi
7344     fi
7345     if test -z "$JAVADOC"; then
7346         AC_MSG_ERROR([$_javadoc_path not found set with_jdk_home])
7347     fi
7348     if test "$build_os" = "cygwin"; then
7349         if test x`echo "$JAVADOC" | $GREP -i '\.exe$'` = x; then
7350             JAVADOC="${JAVADOC}.exe"
7351         fi
7352         JAVADOC=`win_short_path_for_make "$JAVADOC"`
7353     fi
7355     if test `$JAVADOC --version 2>&1 | $GREP -c "gjdoc"` -gt 0; then
7356     JAVADOCISGJDOC="yes"
7357     fi
7359 AC_SUBST(JAVADOCISGJDOC)
7361 if test "$ENABLE_JAVA" != ""; then
7362     # check if JAVA_HOME was (maybe incorrectly?) set automatically to /usr
7363     if test "$JAVA_HOME" = "/usr" -a "x$with_jdk_home" = "x"; then
7364         if basename $(readlink $(readlink $JAVACOMPILER)) >/dev/null 2>/dev/null; then
7365            # try to recover first by looking whether we have an alternative
7366            # system as in Debian or newer SuSEs where following /usr/bin/javac
7367            # over /etc/alternatives/javac leads to the right bindir where we
7368            # just need to strip a bit away to get a valid JAVA_HOME
7369            JAVA_HOME=$(readlink $(readlink $JAVACOMPILER))
7370         elif readlink $JAVACOMPILER >/dev/null 2>/dev/null; then
7371             # maybe only one level of symlink (e.g. on Mac)
7372             JAVA_HOME=$(readlink $JAVACOMPILER)
7373             if test "$(dirname $JAVA_HOME)" = "."; then
7374                 # we've got no path to trim back
7375                 JAVA_HOME=""
7376             fi
7377         else
7378             # else warn
7379             AC_MSG_WARN([JAVA_HOME is set to /usr - this is very likely to be incorrect])
7380             AC_MSG_WARN([if this is the case, please inform the correct JAVA_HOME with --with-jdk-home])
7381             add_warning "JAVA_HOME is set to /usr - this is very likely to be incorrect"
7382             add_warning "if this is the case, please inform the correct JAVA_HOME with --with-jdk-home"
7383         fi
7384         dnl now that we probably have the path to the real javac, make a JAVA_HOME out of it...
7385         if test "$JAVA_HOME" != "/usr"; then
7386             if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7387                 dnl Leopard returns a non-suitable path with readlink - points to "Current" only
7388                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/Current/Commands/javac$,/CurrentJDK/Home,)
7389                 dnl Tiger already returns a JDK path...
7390                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/CurrentJDK/Commands/javac$,/CurrentJDK/Home,)
7391             else
7392                 JAVA_HOME=$(echo $JAVA_HOME | $SED -e s,/bin/javac$,,)
7393                 dnl check that we have a directory as certain distros eg gentoo substitute javac for a script
7394                 dnl that checks which version to run
7395                 if test -f "$JAVA_HOME"; then
7396                     JAVA_HOME=""; # set JAVA_HOME to null if it's a file
7397                 fi
7398             fi
7399         fi
7400     fi
7401     # as we drop out of this, JAVA_HOME may have been set to the empty string by readlink
7403     dnl now if JAVA_HOME has been set to empty, then call findhome to find it
7404     if test -z "$JAVA_HOME"; then
7405         if test "x$with_jdk_home" = "x"; then
7406             cat > findhome.java <<_ACEOF
7407 [import java.io.File;
7409 class findhome
7411     public static void main(String args[])
7412     {
7413         String jrelocation = System.getProperty("java.home");
7414         File jre = new File(jrelocation);
7415         System.out.println(jre.getParent());
7416     }
7418 _ACEOF
7419             AC_MSG_CHECKING([if javac works])
7420             javac_cmd="$JAVACOMPILER findhome.java 1>&2"
7421             AC_TRY_EVAL(javac_cmd)
7422             if test $? = 0 -a -f ./findhome.class; then
7423                 AC_MSG_RESULT([javac works])
7424             else
7425                 echo "configure: javac test failed" >&5
7426                 cat findhome.java >&5
7427                 AC_MSG_ERROR([javac does not work - java projects will not build!])
7428             fi
7429             AC_MSG_CHECKING([if gij knows its java.home])
7430             JAVA_HOME=`$JAVAINTERPRETER findhome`
7431             if test $? = 0 -a "$JAVA_HOME" != ""; then
7432                 AC_MSG_RESULT([$JAVA_HOME])
7433             else
7434                 echo "configure: java test failed" >&5
7435                 cat findhome.java >&5
7436                 AC_MSG_ERROR([gij does not know its java.home - use --with-jdk-home])
7437             fi
7438             # clean-up after ourselves
7439             rm -f ./findhome.java ./findhome.class
7440         else
7441             JAVA_HOME=`echo $JAVAINTERPRETER | $SED -n "s,//*bin//*$with_java,,p"`
7442         fi
7443     fi
7445     # now check if $JAVA_HOME is really valid
7446     if test "$_os" = "Darwin" -o "$OS_FOR_BUILD" = MACOSX; then
7447         case "${JAVA_HOME}" in
7448             /Library/Java/JavaVirtualMachines/*)
7449                 ;;
7450             *)
7451                 AC_MSG_ERROR([JDK in $JAVA_HOME cannot be used in CppUnit tests - install Oracle JDK])
7452                 ;;
7453         esac
7454         if test ! -f "$JAVA_HOME/lib/jvm.cfg" -a "x$with_jdk_home" = "x"; then
7455             JAVA_HOME_OK="NO"
7456         fi
7457     elif test ! -d "$JAVA_HOME/jre" -a "x$with_jdk_home" = "x"; then
7458         JAVA_HOME_OK="NO"
7459     fi
7460     if test "$JAVA_HOME_OK" = "NO"; then
7461         AC_MSG_WARN([JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script])
7462         AC_MSG_WARN([attempted to find JAVA_HOME automatically, but apparently it failed])
7463         AC_MSG_WARN([in case JAVA_HOME is incorrectly set, some projects will not be built correctly])
7464         add_warning "JAVA_HOME was not explicitly informed with --with-jdk-home. the configure script"
7465         add_warning "attempted to find JAVA_HOME automatically, but apparently it failed"
7466         add_warning "in case JAVA_HOME is incorrectly set, some projects will not be built correctly"
7467     fi
7468     PathFormat "$JAVA_HOME"
7469     JAVA_HOME="$formatted_path"
7472 if test -z "$JAWTLIB" -a -n "$ENABLE_JAVA" -a "$_os" != Android -a \
7473     "$_os" != Darwin
7474 then
7475     AC_MSG_CHECKING([for JAWT lib])
7476     if test "$_os" = WINNT; then
7477         # The path to $JAVA_HOME/lib/$JAWTLIB is part of $ILIB:
7478         JAWTLIB=jawt.lib
7479     else
7480         case "$host_cpu" in
7481         arm*)
7482             AS_IF([test -e "$JAVA_HOME/jre/lib/aarch32/libjawt.so"], [my_java_arch=aarch32], [my_java_arch=arm])
7483             JAVA_ARCH=$my_java_arch
7484             ;;
7485         i*86)
7486             my_java_arch=i386
7487             ;;
7488         m68k)
7489             my_java_arch=m68k
7490             ;;
7491         powerpc)
7492             my_java_arch=ppc
7493             ;;
7494         powerpc64)
7495             my_java_arch=ppc64
7496             ;;
7497         powerpc64le)
7498             AS_IF([test -e "$JAVA_HOME/jre/lib/ppc64le/libjawt.so"], [my_java_arch=ppc64le], [my_java_arch=ppc64])
7499             JAVA_ARCH=$my_java_arch
7500             ;;
7501         sparc64)
7502             my_java_arch=sparcv9
7503             ;;
7504         x86_64)
7505             my_java_arch=amd64
7506             ;;
7507         *)
7508             my_java_arch=$host_cpu
7509             ;;
7510         esac
7511         # This is where JDK9 puts the library
7512         if test -e "$JAVA_HOME/lib/libjawt.so"; then
7513             JAWTLIB="-L$JAVA_HOME/lib/ -ljawt"
7514         else
7515             JAWTLIB="-L$JAVA_HOME/jre/lib/$my_java_arch -ljawt"
7516         fi
7517         AS_IF([test "$JAVA_ARCH" != ""], [AC_DEFINE_UNQUOTED([JAVA_ARCH], ["$JAVA_ARCH"])])
7518     fi
7519     AC_MSG_RESULT([$JAWTLIB])
7521 AC_SUBST(JAWTLIB)
7523 if test -n "$ENABLE_JAVA" -a -z "$JAVAINC"; then
7524     case "$host_os" in
7526     aix*)
7527         JAVAINC="-I$JAVA_HOME/include"
7528         JAVAINC="$JAVAINC -I$JAVA_HOME/include/aix"
7529         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7530         ;;
7532     cygwin*)
7533         JAVAINC="-I$JAVA_HOME/include/win32"
7534         JAVAINC="$JAVAINC -I$JAVA_HOME/include"
7535         ;;
7537     darwin*)
7538         if test -d "$JAVA_HOME/include/darwin"; then
7539             JAVAINC="-I$JAVA_HOME/include  -I$JAVA_HOME/include/darwin"
7540         else
7541             JAVAINC=${ISYSTEM}$FRAMEWORKSHOME/JavaVM.framework/Versions/Current/Headers
7542         fi
7543         ;;
7545     dragonfly*)
7546         JAVAINC="-I$JAVA_HOME/include"
7547         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7548         ;;
7550     freebsd*)
7551         JAVAINC="-I$JAVA_HOME/include"
7552         JAVAINC="$JAVAINC -I$JAVA_HOME/include/freebsd"
7553         JAVAINC="$JAVAINC -I$JAVA_HOME/include/bsd"
7554         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7555         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7556         ;;
7558     k*bsd*-gnu*)
7559         JAVAINC="-I$JAVA_HOME/include"
7560         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7561         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7562         ;;
7564     linux-gnu*)
7565         JAVAINC="-I$JAVA_HOME/include"
7566         JAVAINC="$JAVAINC -I$JAVA_HOME/include/linux"
7567         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7568         ;;
7570     *netbsd*)
7571         JAVAINC="-I$JAVA_HOME/include"
7572         JAVAINC="$JAVAINC -I$JAVA_HOME/include/netbsd"
7573         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7574        ;;
7576     openbsd*)
7577         JAVAINC="-I$JAVA_HOME/include"
7578         JAVAINC="$JAVAINC -I$JAVA_HOME/include/openbsd"
7579         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7580         ;;
7582     solaris*)
7583         JAVAINC="-I$JAVA_HOME/include"
7584         JAVAINC="$JAVAINC -I$JAVA_HOME/include/solaris"
7585         test -d "$JAVA_HOME/include/native_thread" && JAVAINC="$JAVAINC -I$JAVA_HOME/include/native_thread"
7586         ;;
7587     esac
7589 SOLARINC="$SOLARINC $JAVAINC"
7591 if test "$ENABLE_JAVA" != "" -a "x" != "x$JAVACOMPILER" && test "$_jdk_ver" -ge 10900; then
7592     url_check_unknown=0
7593     java_base="testurlcheck"
7594     java_src="${java_base}.java"
7595     java_cls="${java_base}.class"
7596     cat > "${java_src}" <<_ACEOF
7597 [import jdk.internal.loader.URLClassPath;
7598 import java.lang.reflect.Field;
7599 import java.net.URL;
7601 class ${java_base}
7603     public static void main(String args[])
7604     {
7605         try {
7606             URLClassPath cp = new URLClassPath(new URL[0], null);
7607             Field field = cp.getClass().getDeclaredField("DISABLE_CP_URL_CHECK");
7608             field.setAccessible(true);
7609             System.out.println(field.get(cp).toString());
7610         } catch(Exception e) {
7611             System.out.println("unknown");
7612         }
7613     }
7615 _ACEOF
7616     AC_MSG_CHECKING([if jdk.net.URLClassPath.ClassPathURLCheck is disabled])
7617     java_cmd="$JAVACOMPILER --add-exports java.base/jdk.internal.loader=ALL-UNNAMED ${java_src} 1>&2"
7618     AC_TRY_EVAL(java_cmd)
7619     if test $? = 0 -a -f "./${java_cls}"; then
7620         java_res=`$JAVAINTERPRETER --add-opens java.base/jdk.internal.loader=ALL-UNNAMED ${java_base} 2>/dev/null`
7621         if test $? = 0; then
7622             case "${java_res}" in
7623             true) AC_MSG_RESULT([yes]) ;;
7624             false)
7625                 rm -f "./${java_src}" "./${java_cls}"
7626                 AC_MSG_ERROR([no - Java unit tests will break!])
7627                 ;;
7628             *) url_check_unknown=1 ;;
7629             esac
7630         else
7631             url_check_unknown=1
7632         fi
7633     else
7634         url_check_unknown=1
7635     fi
7636     if test $url_check_unknown -eq 1; then
7637         AC_MSG_RESULT([unknown - assuming yes])
7638         add_warning "Unable to find the default value for jdk.net.URLClassPath.ClassPathURLCheck - java tests might fail!"
7639     fi
7640     rm -f "./${java_src}" "./${java_cls}"
7643 AC_SUBST(JAVACOMPILER)
7644 AC_SUBST(JAVADOC)
7645 AC_SUBST(JAVAINTERPRETER)
7646 AC_SUBST(JAVAIFLAGS)
7647 AC_SUBST(JAVAFLAGS)
7648 AC_SUBST(JAVA_CLASSPATH_NOT_SET)
7649 AC_SUBST(JAVA_HOME)
7650 AC_SUBST(JAVA_SOURCE_VER)
7651 AC_SUBST(JAVA_TARGET_VER)
7652 AC_SUBST(JDK)
7655 dnl ===================================================================
7656 dnl Export file validation
7657 dnl ===================================================================
7658 AC_MSG_CHECKING([whether to enable export file validation])
7659 if test "$with_export_validation" != "no"; then
7660     if test -z "$ENABLE_JAVA"; then
7661         if test "$with_export_validation" = "yes"; then
7662             AC_MSG_ERROR([requested, but Java is disabled])
7663         else
7664             AC_MSG_RESULT([no, as Java is disabled])
7665         fi
7666     elif ! test -d "${SRC_ROOT}/schema"; then
7667         if test "$with_export_validation" = "yes"; then
7668             AC_MSG_ERROR([requested, but schema directory is missing (it is excluded from tarballs)])
7669         else
7670             AC_MSG_RESULT([no, schema directory is missing (it is excluded from tarballs)])
7671         fi
7672     else
7673         AC_MSG_RESULT([yes])
7674         AC_DEFINE(HAVE_EXPORT_VALIDATION)
7676         AC_PATH_PROGS(ODFVALIDATOR, odfvalidator)
7677         if test -z "$ODFVALIDATOR"; then
7678             # remember to download the ODF toolkit with validator later
7679             AC_MSG_NOTICE([no odfvalidator found, will download it])
7680             BUILD_TYPE="$BUILD_TYPE ODFVALIDATOR"
7681             ODFVALIDATOR="$BUILDDIR/bin/odfvalidator.sh"
7683             # and fetch name of odfvalidator jar name from download.lst
7684             ODFVALIDATOR_JAR=`$SED -n -e "s/export *ODFVALIDATOR_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7685             AC_SUBST(ODFVALIDATOR_JAR)
7687             if test -z "$ODFVALIDATOR_JAR"; then
7688                 AC_MSG_ERROR([cannot determine odfvalidator jar location (--with-export-validation)])
7689             fi
7690         fi
7691         if test "$build_os" = "cygwin"; then
7692             # In case of Cygwin it will be executed from Windows,
7693             # so we need to run bash and absolute path to validator
7694             # so instead of "odfvalidator" it will be
7695             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7696             ODFVALIDATOR="bash.exe `cygpath -m "$ODFVALIDATOR"`"
7697         else
7698             ODFVALIDATOR="sh $ODFVALIDATOR"
7699         fi
7700         AC_SUBST(ODFVALIDATOR)
7703         AC_PATH_PROGS(OFFICEOTRON, officeotron)
7704         if test -z "$OFFICEOTRON"; then
7705             # remember to download the officeotron with validator later
7706             AC_MSG_NOTICE([no officeotron found, will download it])
7707             BUILD_TYPE="$BUILD_TYPE OFFICEOTRON"
7708             OFFICEOTRON="$BUILDDIR/bin/officeotron.sh"
7710             # and fetch name of officeotron jar name from download.lst
7711             OFFICEOTRON_JAR=`$SED -n -e "s/export *OFFICEOTRON_JAR *:= *\(.*\) */\1/p" $SRC_ROOT/download.lst`
7712             AC_SUBST(OFFICEOTRON_JAR)
7714             if test -z "$OFFICEOTRON_JAR"; then
7715                 AC_MSG_ERROR([cannot determine officeotron jar location (--with-export-validation)])
7716             fi
7717         else
7718             # check version of existing officeotron
7719             OFFICEOTRON_VER=`$OFFICEOTRON --version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
7720             if test 0"$OFFICEOTRON_VER" -lt 704; then
7721                 AC_MSG_ERROR([officeotron too old])
7722             fi
7723         fi
7724         if test "$build_os" = "cygwin"; then
7725             # In case of Cygwin it will be executed from Windows,
7726             # so we need to run bash and absolute path to validator
7727             # so instead of "odfvalidator" it will be
7728             # something like "bash.exe C:\cygwin\opt\lo\bin\odfvalidator"
7729             OFFICEOTRON="bash.exe `cygpath -m "$OFFICEOTRON"`"
7730         else
7731             OFFICEOTRON="sh $OFFICEOTRON"
7732         fi
7733     fi
7734     AC_SUBST(OFFICEOTRON)
7735 else
7736     AC_MSG_RESULT([no])
7739 AC_MSG_CHECKING([for Microsoft Binary File Format Validator])
7740 if test "$with_bffvalidator" != "no"; then
7741     AC_DEFINE(HAVE_BFFVALIDATOR)
7743     if test "$with_export_validation" = "no"; then
7744         AC_MSG_ERROR([Please enable export validation (-with-export-validation)!])
7745     fi
7747     if test "$with_bffvalidator" = "yes"; then
7748         BFFVALIDATOR=`win_short_path_for_make "$PROGRAMFILES/Microsoft Office/BFFValidator/BFFValidator.exe"`
7749     else
7750         BFFVALIDATOR="$with_bffvalidator"
7751     fi
7753     if test "$build_os" = "cygwin"; then
7754         if test -n "$BFFVALIDATOR" -a -e "`cygpath $BFFVALIDATOR`"; then
7755             AC_MSG_RESULT($BFFVALIDATOR)
7756         else
7757             AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7758         fi
7759     elif test -n "$BFFVALIDATOR"; then
7760         # We are not in Cygwin but need to run Windows binary with wine
7761         AC_PATH_PROGS(WINE, wine)
7763         # so swap in a shell wrapper that converts paths transparently
7764         BFFVALIDATOR_EXE="$BFFVALIDATOR"
7765         BFFVALIDATOR="sh $BUILDDIR/bin/bffvalidator.sh"
7766         AC_SUBST(BFFVALIDATOR_EXE)
7767         AC_MSG_RESULT($BFFVALIDATOR)
7768     else
7769         AC_MSG_ERROR([bffvalidator not found, but required by --with-bffvalidator])
7770     fi
7771     AC_SUBST(BFFVALIDATOR)
7772 else
7773     AC_MSG_RESULT([no])
7776 dnl ===================================================================
7777 dnl Check for C preprocessor to use
7778 dnl ===================================================================
7779 AC_MSG_CHECKING([which C preprocessor to use in idlc])
7780 if test -n "$with_idlc_cpp"; then
7781     AC_MSG_RESULT([$with_idlc_cpp])
7782     AC_PATH_PROG(SYSTEM_UCPP, $with_idlc_cpp)
7783 else
7784     AC_MSG_RESULT([ucpp])
7785     AC_MSG_CHECKING([which ucpp tp use])
7786     if test -n "$with_system_ucpp" -a "$with_system_ucpp" != "no"; then
7787         AC_MSG_RESULT([external])
7788         AC_PATH_PROG(SYSTEM_UCPP, ucpp)
7789     else
7790         AC_MSG_RESULT([internal])
7791         BUILD_TYPE="$BUILD_TYPE UCPP"
7792     fi
7794 AC_SUBST(SYSTEM_UCPP)
7796 dnl ===================================================================
7797 dnl Check for epm (not needed for Windows)
7798 dnl ===================================================================
7799 AC_MSG_CHECKING([whether to enable EPM for packing])
7800 if test "$enable_epm" = "yes"; then
7801     AC_MSG_RESULT([yes])
7802     if test "$_os" != "WINNT"; then
7803         if test $_os = Darwin; then
7804             EPM=internal
7805         elif test -n "$with_epm"; then
7806             EPM=$with_epm
7807         else
7808             AC_PATH_PROG(EPM, epm, no)
7809         fi
7810         if test "$EPM" = "no" -o "$EPM" = "internal"; then
7811             AC_MSG_NOTICE([EPM will be built.])
7812             BUILD_TYPE="$BUILD_TYPE EPM"
7813             EPM=${WORKDIR}/UnpackedTarball/epm/epm
7814         else
7815             # Gentoo has some epm which is something different...
7816             AC_MSG_CHECKING([whether the found epm is the right epm])
7817             if $EPM | grep "ESP Package Manager" >/dev/null 2>/dev/null; then
7818                 AC_MSG_RESULT([yes])
7819             else
7820                 AC_MSG_ERROR([no. Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7821             fi
7822             AC_MSG_CHECKING([epm version])
7823             EPM_VERSION=`$EPM | grep 'ESP Package Manager' | cut -d' ' -f4 | $SED -e s/v//`
7824             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -gt "3" || \
7825                test "`echo $EPM_VERSION | cut -d'.' -f1`" -eq "3" -a "`echo $EPM_VERSION | cut -d'.' -f2`" -ge "7"; then
7826                 AC_MSG_RESULT([OK, >= 3.7])
7827             else
7828                 AC_MSG_RESULT([too old. epm >= 3.7 is required.])
7829                 AC_MSG_ERROR([Install ESP Package Manager (http://www.msweet.org/projects.php?Z2) and/or specify the path to the right epm])
7830             fi
7831         fi
7832     fi
7834     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null; then
7835         AC_MSG_CHECKING([for rpm])
7836         for a in "$RPM" rpmbuild rpm; do
7837             $a --usage >/dev/null 2> /dev/null
7838             if test $? -eq 0; then
7839                 RPM=$a
7840                 break
7841             else
7842                 $a --version >/dev/null 2> /dev/null
7843                 if test $? -eq 0; then
7844                     RPM=$a
7845                     break
7846                 fi
7847             fi
7848         done
7849         if test -z "$RPM"; then
7850             AC_MSG_ERROR([not found])
7851         elif "$RPM" --help 2>&1 | $EGREP buildroot >/dev/null; then
7852             RPM_PATH=`which $RPM`
7853             AC_MSG_RESULT([$RPM_PATH])
7854             SCPDEFS="$SCPDEFS -DWITH_RPM"
7855         else
7856             AC_MSG_ERROR([cannot build packages. Try installing rpmbuild.])
7857         fi
7858     fi
7859     if echo "$PKGFORMAT" | $EGREP deb 2>&1 >/dev/null; then
7860         AC_PATH_PROG(DPKG, dpkg, no)
7861         if test "$DPKG" = "no"; then
7862             AC_MSG_ERROR([dpkg needed for deb creation. Install dpkg.])
7863         fi
7864     fi
7865     if echo "$PKGFORMAT" | $EGREP rpm 2>&1 >/dev/null || \
7866        echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7867         if test "$with_epm" = "no" -a "$_os" != "Darwin"; then
7868             if test "`echo $EPM_VERSION | cut -d'.' -f1`" -lt "4"; then
7869                 AC_MSG_CHECKING([whether epm is patched for LibreOffice's needs])
7870                 if grep "Patched for .*Office" $EPM >/dev/null 2>/dev/null; then
7871                     AC_MSG_RESULT([yes])
7872                 else
7873                     AC_MSG_RESULT([no])
7874                     if echo "$PKGFORMAT" | $GREP -q rpm; then
7875                         _pt="rpm"
7876                         AC_MSG_WARN([the rpms will need to be installed with --nodeps])
7877                         add_warning "the rpms will need to be installed with --nodeps"
7878                     else
7879                         _pt="pkg"
7880                     fi
7881                     AC_MSG_WARN([the ${_pt}s will not be relocatable])
7882                     add_warning "the ${_pt}s will not be relocatable"
7883                     AC_MSG_WARN([if you want to make sure installation without --nodeps and
7884                                  relocation will work, you need to patch your epm with the
7885                                  patch in epm/epm-3.7.patch or build with
7886                                  --with-epm=internal which will build a suitable epm])
7887                 fi
7888             fi
7889         fi
7890     fi
7891     if echo "$PKGFORMAT" | $EGREP pkg 2>&1 >/dev/null; then
7892         AC_PATH_PROG(PKGMK, pkgmk, no)
7893         if test "$PKGMK" = "no"; then
7894             AC_MSG_ERROR([pkgmk needed for Solaris pkg creation. Install it.])
7895         fi
7896     fi
7897     AC_SUBST(RPM)
7898     AC_SUBST(DPKG)
7899     AC_SUBST(PKGMK)
7900 else
7901     for i in $PKGFORMAT; do
7902         case "$i" in
7903         aix | bsd | deb | pkg | rpm | native | portable)
7904             AC_MSG_ERROR(
7905                 [--with-package-format='$PKGFORMAT' requires --enable-epm])
7906             ;;
7907         esac
7908     done
7909     AC_MSG_RESULT([no])
7910     EPM=NO
7912 AC_SUBST(EPM)
7914 ENABLE_LWP=
7915 if test "$enable_lotuswordpro" = "yes"; then
7916     ENABLE_LWP="TRUE"
7918 AC_SUBST(ENABLE_LWP)
7920 dnl ===================================================================
7921 dnl Check for building ODK
7922 dnl ===================================================================
7923 if test "$enable_odk" = no; then
7924     unset DOXYGEN
7925 else
7926     if test "$with_doxygen" = no; then
7927         AC_MSG_CHECKING([for doxygen])
7928         unset DOXYGEN
7929         AC_MSG_RESULT([no])
7930     else
7931         if test "$with_doxygen" = yes; then
7932             AC_PATH_PROG([DOXYGEN], [doxygen])
7933             if test -z "$DOXYGEN"; then
7934                 AC_MSG_ERROR([doxygen not found in \$PATH; specify its pathname via --with-doxygen=..., or disable its use via --without-doxygen])
7935             fi
7936             if $DOXYGEN -g - | grep -q "HAVE_DOT *= *YES"; then
7937                 if ! dot -V 2>/dev/null; then
7938                     AC_MSG_ERROR([dot not found in \$PATH but doxygen defaults to HAVE_DOT=YES; install graphviz or disable its use via --without-doxygen])
7939                 fi
7940             fi
7941         else
7942             AC_MSG_CHECKING([for doxygen])
7943             DOXYGEN=$with_doxygen
7944             AC_MSG_RESULT([$DOXYGEN])
7945         fi
7946         if test -n "$DOXYGEN"; then
7947             DOXYGEN_VERSION=`$DOXYGEN --version 2>/dev/null`
7948             DOXYGEN_NUMVERSION=`echo $DOXYGEN_VERSION | $AWK -F. '{ print \$1*10000 + \$2*100 + \$3 }'`
7949             if ! test "$DOXYGEN_NUMVERSION" -ge "10804" ; then
7950                 AC_MSG_ERROR([found doxygen is too old; need at least version 1.8.4 or specify --without-doxygen])
7951             fi
7952         fi
7953     fi
7955 AC_SUBST([DOXYGEN])
7957 AC_MSG_CHECKING([whether to build the ODK])
7958 if test "$enable_odk" = "" -o "$enable_odk" != "no"; then
7959     AC_MSG_RESULT([yes])
7961     if test "$with_java" != "no"; then
7962         AC_MSG_CHECKING([whether to build unowinreg.dll])
7963         if test "$_os" = "WINNT" -a "$enable_build_unowinreg" = ""; then
7964             # build on Win by default
7965             enable_build_unowinreg=yes
7966         fi
7967         if test "$enable_build_unowinreg" = "" -o "$enable_build_unowinreg" = "no"; then
7968             AC_MSG_RESULT([no])
7969             BUILD_UNOWINREG=
7970         else
7971             AC_MSG_RESULT([yes])
7972             BUILD_UNOWINREG=TRUE
7973         fi
7974         if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "TRUE"; then
7975             if test -z "$with_mingw_cross_compiler"; then
7976                 dnl Guess...
7977                 AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
7978             elif test -x "$with_mingw_cross_compiler"; then
7979                  MINGWCXX="$with_mingw_cross_compiler"
7980             else
7981                 AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
7982             fi
7984             if test "$MINGWCXX" = "false"; then
7985                 AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
7986             fi
7988             mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
7989             if test -x "$mingwstrip_test"; then
7990                 MINGWSTRIP="$mingwstrip_test"
7991             else
7992                 AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
7993             fi
7995             if test "$MINGWSTRIP" = "false"; then
7996                 AC_MSG_ERROR(MinGW32 binutils not found.)
7997             fi
7998         fi
7999     fi
8000     BUILD_TYPE="$BUILD_TYPE ODK"
8001 else
8002     AC_MSG_RESULT([no])
8003     BUILD_UNOWINREG=
8005 AC_SUBST(BUILD_UNOWINREG)
8006 AC_SUBST(MINGWCXX)
8007 AC_SUBST(MINGWSTRIP)
8009 dnl ===================================================================
8010 dnl Check for system zlib
8011 dnl ===================================================================
8012 if test "$with_system_zlib" = "auto"; then
8013     case "$_os" in
8014     WINNT)
8015         with_system_zlib="$with_system_libs"
8016         ;;
8017     *)
8018         if test "$enable_fuzzers" != "yes"; then
8019             with_system_zlib=yes
8020         else
8021             with_system_zlib=no
8022         fi
8023         ;;
8024     esac
8027 dnl we want to use libo_CHECK_SYSTEM_MODULE here too, but macOS is too stupid
8028 dnl and has no pkg-config for it at least on some tinderboxes,
8029 dnl so leaving that out for now
8030 dnl libo_CHECK_SYSTEM_MODULE([zlib],[ZLIB],[zlib])
8031 AC_MSG_CHECKING([which zlib to use])
8032 if test "$with_system_zlib" = "yes"; then
8033     AC_MSG_RESULT([external])
8034     SYSTEM_ZLIB=TRUE
8035     AC_CHECK_HEADER(zlib.h, [],
8036         [AC_MSG_ERROR(zlib.h not found. install zlib)], [])
8037     AC_CHECK_LIB(z, deflate, [ ZLIB_LIBS=-lz ],
8038         [AC_MSG_ERROR(zlib not found or functional)], [])
8039 else
8040     AC_MSG_RESULT([internal])
8041     SYSTEM_ZLIB=
8042     BUILD_TYPE="$BUILD_TYPE ZLIB"
8043     ZLIB_CFLAGS="-I${WORKDIR}/UnpackedTarball/zlib"
8044     ZLIB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lzlib"
8046 AC_SUBST(ZLIB_CFLAGS)
8047 AC_SUBST(ZLIB_LIBS)
8048 AC_SUBST(SYSTEM_ZLIB)
8050 dnl ===================================================================
8051 dnl Check for system jpeg
8052 dnl ===================================================================
8053 AC_MSG_CHECKING([which libjpeg to use])
8054 if test "$with_system_jpeg" = "yes"; then
8055     AC_MSG_RESULT([external])
8056     SYSTEM_LIBJPEG=TRUE
8057     AC_CHECK_HEADER(jpeglib.h, [ LIBJPEG_CFLAGS= ],
8058         [AC_MSG_ERROR(jpeg.h not found. install libjpeg)], [])
8059     AC_CHECK_LIB(jpeg, jpeg_resync_to_restart, [ LIBJPEG_LIBS="-ljpeg" ],
8060         [AC_MSG_ERROR(jpeg library not found or functional)], [])
8061 else
8062     SYSTEM_LIBJPEG=
8063     AC_MSG_RESULT([internal, libjpeg-turbo])
8064     BUILD_TYPE="$BUILD_TYPE LIBJPEG_TURBO"
8065     LIBJPEG_CFLAGS="-I${WORKDIR}/UnpackedTarball/libjpeg-turbo"
8066     if test "$COM" = "MSC"; then
8067         LIBJPEG_LIBS="${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs/libjpeg.lib"
8068     else
8069         LIBJPEG_LIBS="-L${WORKDIR}/UnpackedTarball/libjpeg-turbo/.libs -ljpeg"
8070     fi
8072     case "$host_cpu" in
8073     x86_64 | amd64 | i*86 | x86 | ia32)
8074         AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
8075         if test -z "$NASM" -a "$build_os" = "cygwin"; then
8076             if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/nasm"; then
8077                 NASM="$LODE_HOME/opt/bin/nasm"
8078             elif test -x "/opt/lo/bin/nasm"; then
8079                 NASM="/opt/lo/bin/nasm"
8080             fi
8081         fi
8083         if test -n "$NASM"; then
8084             AC_MSG_CHECKING([for object file format of host system])
8085             case "$host_os" in
8086               cygwin* | mingw* | pw32* | interix*)
8087                 case "$host_cpu" in
8088                   x86_64)
8089                     objfmt='Win64-COFF'
8090                     ;;
8091                   *)
8092                     objfmt='Win32-COFF'
8093                     ;;
8094                 esac
8095               ;;
8096               msdosdjgpp* | go32*)
8097                 objfmt='COFF'
8098               ;;
8099               os2-emx*) # not tested
8100                 objfmt='MSOMF' # obj
8101               ;;
8102               linux*coff* | linux*oldld*)
8103                 objfmt='COFF' # ???
8104               ;;
8105               linux*aout*)
8106                 objfmt='a.out'
8107               ;;
8108               linux*)
8109                 case "$host_cpu" in
8110                   x86_64)
8111                     objfmt='ELF64'
8112                     ;;
8113                   *)
8114                     objfmt='ELF'
8115                     ;;
8116                 esac
8117               ;;
8118               kfreebsd* | freebsd* | netbsd* | openbsd*)
8119                 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
8120                   objfmt='BSD-a.out'
8121                 else
8122                   case "$host_cpu" in
8123                     x86_64 | amd64)
8124                       objfmt='ELF64'
8125                       ;;
8126                     *)
8127                       objfmt='ELF'
8128                       ;;
8129                   esac
8130                 fi
8131               ;;
8132               solaris* | sunos* | sysv* | sco*)
8133                 case "$host_cpu" in
8134                   x86_64)
8135                     objfmt='ELF64'
8136                     ;;
8137                   *)
8138                     objfmt='ELF'
8139                     ;;
8140                 esac
8141               ;;
8142               darwin* | rhapsody* | nextstep* | openstep* | macos*)
8143                 case "$host_cpu" in
8144                   x86_64)
8145                     objfmt='Mach-O64'
8146                     ;;
8147                   *)
8148                     objfmt='Mach-O'
8149                     ;;
8150                 esac
8151               ;;
8152               *)
8153                 objfmt='ELF ?'
8154               ;;
8155             esac
8157             AC_MSG_RESULT([$objfmt])
8158             if test "$objfmt" = 'ELF ?'; then
8159               objfmt='ELF'
8160               AC_MSG_WARN([unexpected host system. assumed that the format is $objfmt.])
8161             fi
8163             AC_MSG_CHECKING([for object file format specifier (NAFLAGS) ])
8164             case "$objfmt" in
8165               MSOMF)      NAFLAGS='-fobj -DOBJ32';;
8166               Win32-COFF) NAFLAGS='-fwin32 -DWIN32';;
8167               Win64-COFF) NAFLAGS='-fwin64 -DWIN64 -D__x86_64__';;
8168               COFF)       NAFLAGS='-fcoff -DCOFF';;
8169               a.out)      NAFLAGS='-faout -DAOUT';;
8170               BSD-a.out)  NAFLAGS='-faoutb -DAOUT';;
8171               ELF)        NAFLAGS='-felf -DELF';;
8172               ELF64)      NAFLAGS='-felf64 -DELF -D__x86_64__';;
8173               RDF)        NAFLAGS='-frdf -DRDF';;
8174               Mach-O)     NAFLAGS='-fmacho -DMACHO';;
8175               Mach-O64)   NAFLAGS='-fmacho64 -DMACHO -D__x86_64__';;
8176             esac
8177             AC_MSG_RESULT([$NAFLAGS])
8179             AC_MSG_CHECKING([whether the assembler ($NASM $NAFLAGS) works])
8180             cat > conftest.asm << EOF
8181             [%line __oline__ "configure"
8182                     section .text
8183                     global  _main,main
8184             _main:
8185             main:   xor     eax,eax
8186                     ret
8187             ]
8189             try_nasm='$NASM $NAFLAGS -o conftest.o conftest.asm'
8190             if AC_TRY_EVAL(try_nasm) && test -s conftest.o; then
8191               AC_MSG_RESULT(yes)
8192             else
8193               echo "configure: failed program was:" >&AC_FD_CC
8194               cat conftest.asm >&AC_FD_CC
8195               rm -rf conftest*
8196               AC_MSG_RESULT(no)
8197               AC_MSG_WARN([installation or configuration problem: assembler cannot create object files.])
8198               NASM=""
8199             fi
8201         fi
8203         if test -z "$NASM"; then
8204 cat << _EOS
8205 ****************************************************************************
8206 You need yasm or nasm (Netwide Assembler) to build the internal jpeg library optimally.
8207 To get one please:
8209 _EOS
8210             if test "$build_os" = "cygwin"; then
8211 cat << _EOS
8212 install a pre-compiled binary for Win32
8214 mkdir -p /opt/lo/bin
8215 cd /opt/lo/bin
8216 wget https://dev-www.libreoffice.org/bin/cygwin/nasm.exe
8217 chmod +x nasm
8219 or get and install one from http://www.nasm.us/
8221 Then re-run autogen.sh
8223 Note: autogen.sh will try to use /opt/lo/bin/nasm if the environment variable NASM is not already defined.
8224 Alternatively, you can install the 'new' nasm where ever you want and make sure that \`which nasm\` finds it.
8226 _EOS
8227             else
8228 cat << _EOS
8229 consult https://github.com/libjpeg-turbo/libjpeg-turbo/blob/master/BUILDING.md
8231 _EOS
8232             fi
8233             AC_MSG_WARN([no suitable nasm (Netwide Assembler) found])
8234             add_warning "no suitable nasm (Netwide Assembler) found for internal libjpeg-turbo"
8235         fi
8236       ;;
8237     esac
8240 AC_SUBST(NASM)
8241 AC_SUBST(LIBJPEG_CFLAGS)
8242 AC_SUBST(LIBJPEG_LIBS)
8243 AC_SUBST(SYSTEM_LIBJPEG)
8245 dnl ===================================================================
8246 dnl Check for system clucene
8247 dnl ===================================================================
8248 dnl we should rather be using
8249 dnl libo_CHECK_SYSTEM_MODULE([clucence],[CLUCENE],[liblucence-core]) here
8250 dnl but the contribs-lib check seems tricky
8251 AC_MSG_CHECKING([which clucene to use])
8252 if test "$with_system_clucene" = "yes"; then
8253     AC_MSG_RESULT([external])
8254     SYSTEM_CLUCENE=TRUE
8255     PKG_CHECK_MODULES(CLUCENE, libclucene-core)
8256     CLUCENE_CFLAGS=[$(printf '%s' "$CLUCENE_CFLAGS" | sed -e 's@-I[^ ]*/CLucene/ext@@' -e "s/-I/${ISYSTEM?}/g")]
8257     FilterLibs "${CLUCENE_LIBS}"
8258     CLUCENE_LIBS="${filteredlibs}"
8259     AC_LANG_PUSH([C++])
8260     save_CXXFLAGS=$CXXFLAGS
8261     save_CPPFLAGS=$CPPFLAGS
8262     CXXFLAGS="$CXXFLAGS $CLUCENE_CFLAGS"
8263     CPPFLAGS="$CPPFLAGS $CLUCENE_CFLAGS"
8264     dnl http://sourceforge.net/tracker/index.php?func=detail&aid=3392466&group_id=80013&atid=558446
8265     dnl https://bugzilla.redhat.com/show_bug.cgi?id=794795
8266     AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
8267                  [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [#include <CLucene.h>])
8268     CXXFLAGS=$save_CXXFLAGS
8269     CPPFLAGS=$save_CPPFLAGS
8270     AC_LANG_POP([C++])
8272     CLUCENE_LIBS="$CLUCENE_LIBS -lclucene-contribs-lib"
8273 else
8274     AC_MSG_RESULT([internal])
8275     SYSTEM_CLUCENE=
8276     BUILD_TYPE="$BUILD_TYPE CLUCENE"
8278 AC_SUBST(SYSTEM_CLUCENE)
8279 AC_SUBST(CLUCENE_CFLAGS)
8280 AC_SUBST(CLUCENE_LIBS)
8282 dnl ===================================================================
8283 dnl Check for system expat
8284 dnl ===================================================================
8285 libo_CHECK_SYSTEM_MODULE([expat], [EXPAT], [expat])
8287 dnl ===================================================================
8288 dnl Check for system xmlsec
8289 dnl ===================================================================
8290 libo_CHECK_SYSTEM_MODULE([xmlsec], [XMLSEC], [xmlsec1-nss >= 1.2.28])
8292 AC_MSG_CHECKING([whether to enable Embedded OpenType support])
8293 if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_eot" = "yes"; then
8294     ENABLE_EOT="TRUE"
8295     AC_DEFINE([ENABLE_EOT])
8296     AC_MSG_RESULT([yes])
8298     libo_CHECK_SYSTEM_MODULE([libeot],[LIBEOT],[libeot >= 0.01])
8299 else
8300     ENABLE_EOT=
8301     AC_MSG_RESULT([no])
8303 AC_SUBST([ENABLE_EOT])
8305 dnl ===================================================================
8306 dnl Check for DLP libs
8307 dnl ===================================================================
8308 AS_IF([test "$COM" = "MSC"],
8309       [librevenge_libdir="${WORKDIR}/LinkTarget/Library"],
8310       [librevenge_libdir="${WORKDIR}/UnpackedTarball/librevenge/src/lib/.libs"]
8312 libo_CHECK_SYSTEM_MODULE([librevenge],[REVENGE],[librevenge-0.0 >= 0.0.1],["-I${WORKDIR}/UnpackedTarball/librevenge/inc"],["-L${librevenge_libdir} -lrevenge-0.0"])
8314 libo_CHECK_SYSTEM_MODULE([libodfgen],[ODFGEN],[libodfgen-0.1])
8316 libo_CHECK_SYSTEM_MODULE([libepubgen],[EPUBGEN],[libepubgen-0.1])
8318 AS_IF([test "$COM" = "MSC"],
8319       [libwpd_libdir="${WORKDIR}/LinkTarget/Library"],
8320       [libwpd_libdir="${WORKDIR}/UnpackedTarball/libwpd/src/lib/.libs"]
8322 libo_CHECK_SYSTEM_MODULE([libwpd],[WPD],[libwpd-0.10],["-I${WORKDIR}/UnpackedTarball/libwpd/inc"],["-L${libwpd_libdir} -lwpd-0.10"])
8324 libo_CHECK_SYSTEM_MODULE([libwpg],[WPG],[libwpg-0.3])
8326 libo_CHECK_SYSTEM_MODULE([libwps],[WPS],[libwps-0.4])
8327 libo_PKG_VERSION([WPS], [libwps-0.4], [0.4.10])
8329 libo_CHECK_SYSTEM_MODULE([libvisio],[VISIO],[libvisio-0.1])
8331 libo_CHECK_SYSTEM_MODULE([libcdr],[CDR],[libcdr-0.1])
8333 libo_CHECK_SYSTEM_MODULE([libmspub],[MSPUB],[libmspub-0.1])
8335 libo_CHECK_SYSTEM_MODULE([libmwaw],[MWAW],[libmwaw-0.3 >= 0.3.1])
8336 libo_PKG_VERSION([MWAW], [libmwaw-0.3], [0.3.15])
8338 libo_CHECK_SYSTEM_MODULE([libetonyek],[ETONYEK],[libetonyek-0.1])
8339 libo_PKG_VERSION([ETONYEK], [libetonyek-0.1], [0.1.8])
8341 libo_CHECK_SYSTEM_MODULE([libfreehand],[FREEHAND],[libfreehand-0.1])
8343 libo_CHECK_SYSTEM_MODULE([libebook],[EBOOK],[libe-book-0.1])
8344 libo_PKG_VERSION([EBOOK], [libe-book-0.1], [0.1.2])
8346 libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
8348 libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
8350 libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
8352 libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
8354 libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
8355 libo_PKG_VERSION([STAROFFICE], [libstaroffice-0.0], [0.0.6])
8357 dnl ===================================================================
8358 dnl Check for system lcms2
8359 dnl ===================================================================
8360 if test "$with_system_lcms2" != "yes"; then
8361     SYSTEM_LCMS2=
8363 libo_CHECK_SYSTEM_MODULE([lcms2],[LCMS2],[lcms2],["-I${WORKDIR}/UnpackedTarball/lcms2/include"],["-L${WORKDIR}/UnpackedTarball/lcms2/src/.libs -llcms2"])
8364 if test "$GCC" = "yes"; then
8365     LCMS2_CFLAGS="${LCMS2_CFLAGS} -Wno-long-long"
8367 if test "$COM" = "MSC"; then # override the above
8368     LCMS2_LIBS=${WORKDIR}/UnpackedTarball/lcms2/bin/lcms2.lib
8371 dnl ===================================================================
8372 dnl Check for system cppunit
8373 dnl ===================================================================
8374 if test "$_os" != "Android" ; then
8375     libo_CHECK_SYSTEM_MODULE([cppunit],[CPPUNIT],[cppunit >= 1.14.0])
8378 dnl ===================================================================
8379 dnl Check whether freetype is available
8380 dnl ===================================================================
8381 if test  "$test_freetype" = "yes"; then
8382     AC_MSG_CHECKING([whether freetype is available])
8383     # FreeType has 3 different kinds of versions
8384     # * release, like 2.4.10
8385     # * libtool, like 13.0.7 (this what pkg-config returns)
8386     # * soname
8387     # FreeType's docs/VERSION.DLL provides a table mapping between the three
8388     #
8389     # 9.9.3 is 2.2.0
8390     PKG_CHECK_MODULES(FREETYPE, freetype2 >= 9.9.3)
8391     FREETYPE_CFLAGS=$(printf '%s' "$FREETYPE_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8392     FilterLibs "${FREETYPE_LIBS}"
8393     FREETYPE_LIBS="${filteredlibs}"
8394     SYSTEM_FREETYPE=TRUE
8395 else
8396     FREETYPE_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/freetype/include"
8397     FREETYPE_LIBS="-L${WORKDIR}/UnpackedTarball/freetype/instdir/lib -lfreetype"
8399 AC_SUBST(FREETYPE_CFLAGS)
8400 AC_SUBST(FREETYPE_LIBS)
8401 AC_SUBST([SYSTEM_FREETYPE])
8403 # ===================================================================
8404 # Check for system libxslt
8405 # to prevent incompatibilities between internal libxml2 and external libxslt,
8406 # or vice versa, use with_system_libxml here
8407 # ===================================================================
8408 if test "$with_system_libxml" = "auto"; then
8409     case "$_os" in
8410     WINNT|iOS|Android)
8411         with_system_libxml="$with_system_libs"
8412         ;;
8413     *)
8414         if test "$enable_fuzzers" != "yes"; then
8415             with_system_libxml=yes
8416         else
8417             with_system_libxml=no
8418         fi
8419         ;;
8420     esac
8423 AC_MSG_CHECKING([which libxslt to use])
8424 if test "$with_system_libxml" = "yes"; then
8425     AC_MSG_RESULT([external])
8426     SYSTEM_LIBXSLT=TRUE
8427     if test "$_os" = "Darwin"; then
8428         dnl make sure to use SDK path
8429         LIBXSLT_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8430         LIBEXSLT_CFLAGS="$LIBXSLT_CFLAGS"
8431         dnl omit -L/usr/lib
8432         LIBXSLT_LIBS="-lxslt -lxml2 -lz -lpthread -liconv -lm"
8433         LIBEXSLT_LIBS="-lexslt $LIBXSLT_LIBS"
8434     else
8435         PKG_CHECK_MODULES(LIBXSLT, libxslt)
8436         LIBXSLT_CFLAGS=$(printf '%s' "$LIBXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8437         FilterLibs "${LIBXSLT_LIBS}"
8438         LIBXSLT_LIBS="${filteredlibs}"
8439         PKG_CHECK_MODULES(LIBEXSLT, libexslt)
8440         LIBEXSLT_CFLAGS=$(printf '%s' "$LIBEXSLT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8441         FilterLibs "${LIBEXSLT_LIBS}"
8442         LIBEXSLT_LIBS=$(printf '%s' "${filteredlibs}" | sed -e "s/-lgpg-error//"  -e "s/-lgcrypt//")
8443     fi
8445     dnl Check for xsltproc
8446     AC_PATH_PROG(XSLTPROC, xsltproc, no)
8447     if test "$XSLTPROC" = "no"; then
8448         AC_MSG_ERROR([xsltproc is required])
8449     fi
8450 else
8451     AC_MSG_RESULT([internal])
8452     SYSTEM_LIBXSLT=
8453     BUILD_TYPE="$BUILD_TYPE LIBXSLT"
8455     if test "$cross_compiling" = "yes"; then
8456         AC_PATH_PROG(XSLTPROC, xsltproc, no)
8457         if test "$XSLTPROC" = "no"; then
8458             AC_MSG_ERROR([xsltproc is required])
8459         fi
8460     fi
8462 AC_SUBST(SYSTEM_LIBXSLT)
8463 if test -z "$SYSTEM_LIBXSLT_FOR_BUILD"; then
8464     SYSTEM_LIBXSLT_FOR_BUILD="$SYSTEM_LIBXSLT"
8466 AC_SUBST(SYSTEM_LIBXSLT_FOR_BUILD)
8468 AC_SUBST(LIBEXSLT_CFLAGS)
8469 AC_SUBST(LIBEXSLT_LIBS)
8470 AC_SUBST(LIBXSLT_CFLAGS)
8471 AC_SUBST(LIBXSLT_LIBS)
8472 AC_SUBST(XSLTPROC)
8474 # ===================================================================
8475 # Check for system libxml
8476 # ===================================================================
8477 AC_MSG_CHECKING([which libxml to use])
8478 if test "$with_system_libxml" = "yes"; then
8479     AC_MSG_RESULT([external])
8480     SYSTEM_LIBXML=TRUE
8481     if test "$_os" = "Darwin"; then
8482         dnl make sure to use SDK path
8483         LIBXML_CFLAGS="-I$MACOSX_SDK_PATH/usr/include/libxml2"
8484         dnl omit -L/usr/lib
8485         LIBXML_LIBS="-lxml2 -lz -lpthread -liconv -lm"
8486     elif test $_os = iOS; then
8487         dnl make sure to use SDK path
8488         usr=`echo '#include <stdlib.h>' | $CC -E -MD - | grep usr/include/stdlib.h | head -1 | sed -e 's,# 1 ",,' -e 's,/usr/include/.*,/usr,'`
8489         LIBXML_CFLAGS="-I$usr/include/libxml2"
8490         LIBXML_LIBS="-L$usr/lib -lxml2 -liconv"
8491     else
8492         PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.0)
8493         LIBXML_CFLAGS=$(printf '%s' "$LIBXML_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
8494         FilterLibs "${LIBXML_LIBS}"
8495         LIBXML_LIBS="${filteredlibs}"
8496     fi
8498     dnl Check for xmllint
8499     AC_PATH_PROG(XMLLINT, xmllint, no)
8500     if test "$XMLLINT" = "no"; then
8501         AC_MSG_ERROR([xmllint is required])
8502     fi
8503 else
8504     AC_MSG_RESULT([internal])
8505     SYSTEM_LIBXML=
8506     LIBXML_CFLAGS="-I${WORKDIR}/UnpackedTarball/libxml2/include"
8507     if test "$COM" = "MSC"; then
8508         LIBXML_CFLAGS="${LIBXML_CFLAGS} -I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
8509     fi
8510     if test "$COM" = "MSC"; then
8511         LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
8512     else
8513         LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
8514     fi
8515     BUILD_TYPE="$BUILD_TYPE LIBXML2"
8517 AC_SUBST(SYSTEM_LIBXML)
8518 if test -z "$SYSTEM_LIBXML_FOR_BUILD"; then
8519     SYSTEM_LIBXML_FOR_BUILD="$SYSTEM_LIBXML"
8521 AC_SUBST(SYSTEM_LIBXML_FOR_BUILD)
8522 AC_SUBST(LIBXML_CFLAGS)
8523 AC_SUBST(LIBXML_LIBS)
8524 AC_SUBST(XMLLINT)
8526 # =====================================================================
8527 # Checking for a Python interpreter with version >= 2.7.
8528 # Build and runtime requires Python 3 compatible version (>= 2.7).
8529 # Optionally user can pass an option to configure, i. e.
8530 # ./configure PYTHON=/usr/bin/python
8531 # =====================================================================
8532 if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
8533     if test -n "$PYTHON"; then
8534         PYTHON_FOR_BUILD=$PYTHON
8535     else
8536         # This allows a lack of system python with no error, we use internal one in that case.
8537         AM_PATH_PYTHON([2.7],, [:])
8538         # Clean PYTHON_VERSION checked below if cross-compiling
8539         PYTHON_VERSION=""
8540         if test "$PYTHON" != ":"; then
8541             PYTHON_FOR_BUILD=$PYTHON
8542         fi
8543     fi
8545 AC_SUBST(PYTHON_FOR_BUILD)
8547 # Checks for Python to use for Pyuno
8548 AC_MSG_CHECKING([which Python to use for Pyuno])
8549 case "$enable_python" in
8550 no|disable)
8551     if test -z $PYTHON_FOR_BUILD; then
8552         # Python is required to build LibreOffice. In theory we could separate the build-time Python
8553         # requirement from the choice whether to include Python stuff in the installer, but why
8554         # bother?
8555         AC_MSG_ERROR([Python is required at build time.])
8556     fi
8557     enable_python=no
8558     AC_MSG_RESULT([none])
8559     ;;
8560 ""|yes|auto)
8561     if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
8562         AC_MSG_RESULT([no, overridden by --disable-scripting])
8563         enable_python=no
8564     elif test $build_os = cygwin; then
8565         dnl When building on Windows we don't attempt to use any installed
8566         dnl "system"  Python.
8567         AC_MSG_RESULT([fully internal])
8568         enable_python=internal
8569     elif test "$cross_compiling" = yes; then
8570         AC_MSG_RESULT([system])
8571         enable_python=system
8572     else
8573         # Unset variables set by the above AM_PATH_PYTHON so that
8574         # we actually do check anew.
8575         AC_MSG_RESULT([])
8576         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
8577         AM_PATH_PYTHON([3.3],, [:])
8578         AC_MSG_CHECKING([which Python to use for Pyuno])
8579         if test "$PYTHON" = ":"; then
8580             if test -z "$PYTHON_FOR_BUILD"; then
8581                 AC_MSG_RESULT([fully internal])
8582             else
8583                 AC_MSG_RESULT([internal])
8584             fi
8585             enable_python=internal
8586         else
8587             AC_MSG_RESULT([system])
8588             enable_python=system
8589         fi
8590     fi
8591     ;;
8592 internal)
8593     AC_MSG_RESULT([internal])
8594     ;;
8595 fully-internal)
8596     AC_MSG_RESULT([fully internal])
8597     enable_python=internal
8598     ;;
8599 system)
8600     AC_MSG_RESULT([system])
8601     if test "$_os" = Darwin; then
8602         AC_MSG_ERROR([--enable-python=system doesn't work on macOS: /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/unicodeobject.h is known to contain uses of "register", which is removed from C++17])
8603     fi
8604     ;;
8606     AC_MSG_ERROR([Incorrect --enable-python option])
8607     ;;
8608 esac
8610 if test $enable_python != no; then
8611     BUILD_TYPE="$BUILD_TYPE PYUNO"
8614 if test $enable_python = system; then
8615     if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
8616         # Fallback: Accept these in the environment, or as set above
8617         # for MacOSX.
8618         :
8619     elif test "$cross_compiling" != yes; then
8620         # Unset variables set by the above AM_PATH_PYTHON so that
8621         # we actually do check anew.
8622         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
8623         # This causes an error if no python command is found
8624         AM_PATH_PYTHON([3.3])
8625         python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
8626         python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
8627         python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
8628         python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
8629         if test -z "$PKG_CONFIG"; then
8630             PYTHON_CFLAGS="-I$python_include"
8631             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8632         elif $PKG_CONFIG --exists python-$python_version-embed; then
8633             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version-embed`"
8634             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version-embed` $python_libs"
8635         elif $PKG_CONFIG --exists python-$python_version; then
8636             PYTHON_CFLAGS="`$PKG_CONFIG --cflags python-$python_version`"
8637             PYTHON_LIBS="`$PKG_CONFIG --libs python-$python_version` $python_libs"
8638         else
8639             PYTHON_CFLAGS="-I$python_include"
8640             PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
8641         fi
8642         FilterLibs "${PYTHON_LIBS}"
8643         PYTHON_LIBS="${filteredlibs}"
8644     else
8645         dnl How to find out the cross-compilation Python installation path?
8646         AC_MSG_CHECKING([for python version])
8647         AS_IF([test -n "$PYTHON_VERSION"],
8648               [AC_MSG_RESULT([$PYTHON_VERSION])],
8649               [AC_MSG_RESULT([not found])
8650                AC_MSG_ERROR([no usable python found])])
8651         test -n "$PYTHON_CFLAGS" && break
8652     fi
8654     dnl Check if the headers really work
8655     save_CPPFLAGS="$CPPFLAGS"
8656     CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
8657     AC_CHECK_HEADER(Python.h)
8658     CPPFLAGS="$save_CPPFLAGS"
8660     # let the PYTHON_FOR_BUILD match the same python installation that
8661     # provides PYTHON_CFLAGS/PYTHON_LDFLAGS for pyuno, which should be
8662     # better for PythonTests.
8663     PYTHON_FOR_BUILD=$PYTHON
8666 if test "$with_lxml" != no; then
8667     if test -z "$PYTHON_FOR_BUILD"; then
8668         case $build_os in
8669             cygwin)
8670                 AC_MSG_WARN([No system-provided python lxml, gla11y will only report widget classes and ids])
8671                 ;;
8672             *)
8673                 if test "$cross_compiling" != yes ; then
8674                     BUILD_TYPE="$BUILD_TYPE LXML"
8675                 fi
8676                 ;;
8677         esac
8678     else
8679         AC_MSG_CHECKING([for python lxml])
8680         if $PYTHON_FOR_BUILD -c "import lxml.etree as ET" 2> /dev/null ; then
8681             AC_MSG_RESULT([yes])
8682         else
8683             case $build_os in
8684                 cygwin)
8685                     AC_MSG_RESULT([no, gla11y will only report widget classes and ids])
8686                     ;;
8687                 *)
8688                     if test "$cross_compiling" != yes -a "x$ac_cv_header_Python_h" = "xyes"; then
8689                         BUILD_TYPE="$BUILD_TYPE LXML"
8690                         AC_MSG_RESULT([no, using internal lxml])
8691                     else
8692                         AC_MSG_RESULT([no, and system does not provide python development headers, gla11y will only report widget classes and ids])
8693                     fi
8694                     ;;
8695             esac
8696         fi
8697     fi
8700 dnl By now enable_python should be "system", "internal" or "no"
8701 case $enable_python in
8702 system)
8703     SYSTEM_PYTHON=TRUE
8705     if test "x$ac_cv_header_Python_h" != "xyes"; then
8706        AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])
8707     fi
8709     AC_LANG_PUSH(C)
8710     CFLAGS="$CFLAGS $PYTHON_CFLAGS"
8711     AC_MSG_CHECKING([for correct python library version])
8712        AC_RUN_IFELSE([AC_LANG_SOURCE([[
8713 #include <Python.h>
8715 int main(int argc, char **argv) {
8716    if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 7) ||
8717        (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
8718    else return 1;
8720        ]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3, or Python >= 2.7 when building with Python 2])],[AC_MSG_RESULT([skipped; cross-compiling])])
8721     CFLAGS=$save_CFLAGS
8722     AC_LANG_POP(C)
8724     dnl FIXME Check if the Python library can be linked with, too?
8725     ;;
8727 internal)
8728     SYSTEM_PYTHON=
8729     PYTHON_VERSION_MAJOR=3
8730     PYTHON_VERSION_MINOR=5
8731     PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.7
8732     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
8733         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
8734     fi
8735     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
8736     BUILD_TYPE="$BUILD_TYPE PYTHON"
8737     # Embedded Python dies without Home set
8738     if test "$HOME" = ""; then
8739         export HOME=""
8740     fi
8741     ;;
8743     DISABLE_PYTHON=TRUE
8744     SYSTEM_PYTHON=
8745     ;;
8747     AC_MSG_ERROR([Internal configure script error, invalid enable_python value "$enable_python"])
8748     ;;
8749 esac
8751 AC_SUBST(DISABLE_PYTHON)
8752 AC_SUBST(SYSTEM_PYTHON)
8753 AC_SUBST(PYTHON_CFLAGS)
8754 AC_SUBST(PYTHON_LIBS)
8755 AC_SUBST(PYTHON_VERSION)
8756 AC_SUBST(PYTHON_VERSION_MAJOR)
8757 AC_SUBST(PYTHON_VERSION_MINOR)
8759 ENABLE_MARIADBC=TRUE
8760 if test "$_os" = "Android" -o "$_os" = "iOS" -o "$enable_mpl_subset" = "yes"; then
8761     ENABLE_MARIADBC=
8763 MARIADBC_MAJOR=1
8764 MARIADBC_MINOR=0
8765 MARIADBC_MICRO=2
8766 if test "$ENABLE_MARIADBC" = "TRUE"; then
8767     BUILD_TYPE="$BUILD_TYPE MARIADBC"
8770 AC_SUBST(ENABLE_MARIADBC)
8771 AC_SUBST(MARIADBC_MAJOR)
8772 AC_SUBST(MARIADBC_MINOR)
8773 AC_SUBST(MARIADBC_MICRO)
8775 if test "$ENABLE_MARIADBC" = "TRUE"; then
8776     dnl ===================================================================
8777     dnl Check for system MariaDB
8778     dnl ===================================================================
8779     AC_MSG_CHECKING([which MariaDB to use])
8780     if test "$with_system_mariadb" = "yes"; then
8781         AC_MSG_RESULT([external])
8782         SYSTEM_MARIADB_CONNECTOR_C=TRUE
8783         #AC_PATH_PROG(MARIADBCONFIG, [mariadb_config])
8784         if test -z "$MARIADBCONFIG"; then
8785             AC_PATH_PROG(MARIADBCONFIG, [mysql_config])
8786             if test -z "$MARIADBCONFIG"; then
8787                 AC_MSG_ERROR([mysql_config is missing. Install MySQL client library development package.])
8788                 #AC_MSG_ERROR([mariadb_config and mysql_config are missing. Install MariaDB or MySQL client library development package.])
8789             fi
8790         fi
8791         AC_MSG_CHECKING([MariaDB version])
8792         MARIADB_VERSION=`$MARIADBCONFIG --version`
8793         MARIADB_MAJOR=`$MARIADBCONFIG --version | cut -d"." -f1`
8794         if test "$MARIADB_MAJOR" -ge "5"; then
8795             AC_MSG_RESULT([OK])
8796         else
8797             AC_MSG_ERROR([too old, use 5.0.x or later])
8798         fi
8799         AC_MSG_CHECKING([for MariaDB Client library])
8800         MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
8801         if test "$COM_IS_CLANG" = TRUE; then
8802             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
8803         fi
8804         MARIADB_LIBS=`$MARIADBCONFIG --libs_r`
8805         dnl At least mariadb-5.5.34-3.fc20.x86_64 plus
8806         dnl mariadb-5.5.34-3.fc20.i686 reports 64-bit specific output even under
8807         dnl linux32:
8808         if test "$OS" = LINUX -a "$CPUNAME" = INTEL; then
8809             MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-m64//)
8810             MARIADB_LIBS=$(printf '%s' "$MARIADB_LIBS" \
8811                 | sed -e 's|/lib64/|/lib/|')
8812         fi
8813         FilterLibs "${MARIADB_LIBS}"
8814         MARIADB_LIBS="${filteredlibs}"
8815         AC_MSG_RESULT([includes '$MARIADB_CFLAGS', libraries '$MARIADB_LIBS'])
8816         AC_MSG_CHECKING([whether to bundle the MySQL/MariaDB client library])
8817         if test "$enable_bundle_mariadb" = "yes"; then
8818             AC_MSG_RESULT([yes])
8819             BUNDLE_MARIADB_CONNECTOR_C=TRUE
8820             LIBMARIADB=lib$(echo "${MARIADB_LIBS}" | sed -e 's/[[[:space:]]]\{1,\}-l\([[^[:space:]]]\{1,\}\)/\
8822 /g' -e 's/^-l\([[^[:space:]]]\{1,\}\)[[[:space:]]]*/\
8824 /g' | grep -E '(mysqlclient|mariadb)')
8825             if test "$_os" = "Darwin"; then
8826                 LIBMARIADB=${LIBMARIADB}.dylib
8827             elif test "$_os" = "WINNT"; then
8828                 LIBMARIADB=${LIBMARIADB}.dll
8829             else
8830                 LIBMARIADB=${LIBMARIADB}.so
8831             fi
8832             LIBMARIADB_PATH=$($MARIADBCONFIG --variable=pkglibdir)
8833             AC_MSG_CHECKING([for $LIBMARIADB in $LIBMARIADB_PATH])
8834             if test -e "$LIBMARIADB_PATH/$LIBMARIADB"; then
8835                 AC_MSG_RESULT([found.])
8836                 PathFormat "$LIBMARIADB_PATH"
8837                 LIBMARIADB_PATH="$formatted_path"
8838             else
8839                 AC_MSG_ERROR([not found.])
8840             fi
8841         else
8842             AC_MSG_RESULT([no])
8843             BUNDLE_MARIADB_CONNECTOR_C=
8844         fi
8845     else
8846         AC_MSG_RESULT([internal])
8847         SYSTEM_MARIADB_CONNECTOR_C=
8848         MARIADB_CFLAGS="-I${WORKDIR}/UnpackedTarball/mariadb-connector-c/include"
8849         MARIADB_LIBS="-L${WORKDIR}/LinkTarget/StaticLibrary -lmariadb-connector-c"
8850         BUILD_TYPE="$BUILD_TYPE MARIADB_CONNECTOR_C"
8851     fi
8853     AC_SUBST(SYSTEM_MARIADB_CONNECTOR_C)
8854     AC_SUBST(MARIADB_CFLAGS)
8855     AC_SUBST(MARIADB_LIBS)
8856     AC_SUBST(LIBMARIADB)
8857     AC_SUBST(LIBMARIADB_PATH)
8858     AC_SUBST(BUNDLE_MARIADB_CONNECTOR_C)
8861 dnl ===================================================================
8862 dnl Check for system hsqldb
8863 dnl ===================================================================
8864 if test "$with_java" != "no"; then
8865     HSQLDB_USE_JDBC_4_1=
8866     AC_MSG_CHECKING([which hsqldb to use])
8867     if test "$with_system_hsqldb" = "yes"; then
8868         AC_MSG_RESULT([external])
8869         SYSTEM_HSQLDB=TRUE
8870         if test -z $HSQLDB_JAR; then
8871             HSQLDB_JAR=/usr/share/java/hsqldb.jar
8872         fi
8873         if ! test -f $HSQLDB_JAR; then
8874                AC_MSG_ERROR(hsqldb.jar not found.)
8875         fi
8876         AC_MSG_CHECKING([whether hsqldb is 1.8.0.x])
8877         export HSQLDB_JAR
8878         if $PERL -e \
8879            'use Archive::Zip;
8880             my $file = "$ENV{'HSQLDB_JAR'}";
8881             my $zip = Archive::Zip->new( $file );
8882             my $mf = $zip->contents ( "META-INF/MANIFEST.MF" );
8883             if ( $mf =~ m/Specification-Version: 1.8.*/ )
8884             {
8885                 push @l, split(/\n/, $mf);
8886                 foreach my $line (@l)
8887                 {
8888                     if ($line =~ m/Specification-Version:/)
8889                     {
8890                         ($t, $version) = split (/:/,$line);
8891                         $version =~ s/^\s//;
8892                         ($a, $b, $c, $d) = split (/\./,$version);
8893                         if ($c == "0" && $d > "8")
8894                         {
8895                             exit 0;
8896                         }
8897                         else
8898                         {
8899                             exit 1;
8900                         }
8901                     }
8902                 }
8903             }
8904             else
8905             {
8906                 exit 1;
8907             }'; then
8908             AC_MSG_RESULT([yes])
8909         else
8910             AC_MSG_ERROR([no, you need hsqldb >= 1.8.0.9 but < 1.8.1])
8911         fi
8912     else
8913         AC_MSG_RESULT([internal])
8914         SYSTEM_HSQLDB=
8915         BUILD_TYPE="$BUILD_TYPE HSQLDB"
8916         NEED_ANT=TRUE
8917         AC_MSG_CHECKING([whether hsqldb should be built with JDBC 4.1])
8918         javanumver=`$JAVAINTERPRETER -version 2>&1 | $AWK -v num=true -f $SRC_ROOT/solenv/bin/getcompver.awk`
8919         if expr "$javanumver" '>=' 000100060000 > /dev/null; then
8920             AC_MSG_RESULT([yes])
8921             HSQLDB_USE_JDBC_4_1=TRUE
8922         else
8923             AC_MSG_RESULT([no])
8924         fi
8925     fi
8926     AC_SUBST(SYSTEM_HSQLDB)
8927     AC_SUBST(HSQLDB_JAR)
8928     AC_SUBST([HSQLDB_USE_JDBC_4_1])
8931 dnl ===================================================================
8932 dnl Check for PostgreSQL stuff
8933 dnl ===================================================================
8934 AC_MSG_CHECKING([whether to build the PostgreSQL SDBC driver])
8935 if test "x$enable_postgresql_sdbc" != "xno"; then
8936     AC_MSG_RESULT([yes])
8937     SCPDEFS="$SCPDEFS -DWITH_POSTGRESQL_SDBC"
8939     if test "$with_krb5" = "yes" -a "$enable_openssl" = "no"; then
8940         AC_MSG_ERROR([krb5 needs OpenSSL, but --disable-openssl was given.])
8941     fi
8942     if test "$with_gssapi" = "yes" -a "$enable_openssl" = "no"; then
8943         AC_MSG_ERROR([GSSAPI needs OpenSSL, but --disable-openssl was given.])
8944     fi
8946     postgres_interface=""
8947     if test "$with_system_postgresql" = "yes"; then
8948         postgres_interface="external PostgreSQL"
8949         SYSTEM_POSTGRESQL=TRUE
8950         if test "$_os" = Darwin; then
8951             supp_path=''
8952             for d in /Library/PostgreSQL/9.*/bin /sw/opt/postgresql/9.*/bin /opt/local/lib/postgresql9*/bin; do
8953                 pg_supp_path="$P_SEP$d$pg_supp_path"
8954             done
8955         fi
8956         AC_PATH_PROG(PGCONFIG, pg_config, ,$PATH$pg_supp_path)
8957         if test -n "$PGCONFIG"; then
8958             POSTGRESQL_INC=-I$(${PGCONFIG} --includedir)
8959             POSTGRESQL_LIB="-L$(${PGCONFIG} --libdir)"
8960         else
8961             PKG_CHECK_MODULES(POSTGRESQL, libpq, [
8962               POSTGRESQL_INC=$POSTGRESQL_CFLAGS
8963               POSTGRESQL_LIB=$POSTGRESQL_LIBS
8964             ],[
8965               AC_MSG_ERROR([pg_config or 'pkg-config libpq' needed; set PGCONFIG if not in PATH])
8966             ])
8967         fi
8968         FilterLibs "${POSTGRESQL_LIB}"
8969         POSTGRESQL_LIB="${filteredlibs}"
8970     else
8971         # if/when anything else than PostgreSQL uses Kerberos,
8972         # move this out of `test "x$enable_postgresql_sdbc" != "xno"'
8973         WITH_KRB5=
8974         WITH_GSSAPI=
8975         case "$_os" in
8976         Darwin)
8977             # macOS has system MIT Kerberos 5 since 10.4
8978             if test "$with_krb5" != "no"; then
8979                 WITH_KRB5=TRUE
8980                 save_LIBS=$LIBS
8981                 # Not sure whether it makes any sense here to search multiple potential libraries; it is not likely
8982                 # that the libraries where these functions are located on macOS will change, is it?
8983                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8984                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
8985                 KRB5_LIBS=$LIBS
8986                 LIBS=$save_LIBS
8987                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
8988                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
8989                 KRB5_LIBS="$KRB5_LIBS $LIBS"
8990                 LIBS=$save_LIBS
8991             fi
8992             if test "$with_gssapi" != "no"; then
8993                 WITH_GSSAPI=TRUE
8994                 save_LIBS=$LIBS
8995                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
8996                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
8997                 GSSAPI_LIBS=$LIBS
8998                 LIBS=$save_LIBS
8999             fi
9000             ;;
9001         WINNT)
9002             if test "$with_krb5" = "yes" -o "$with_gssapi" = "yes"; then
9003                 AC_MSG_ERROR([Refusing to enable MIT Kerberos 5 or GSSAPI on Windows.])
9004             fi
9005             ;;
9006         Linux|GNU|*BSD|DragonFly)
9007             if test "$with_krb5" != "no"; then
9008                 WITH_KRB5=TRUE
9009                 save_LIBS=$LIBS
9010                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9011                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9012                 KRB5_LIBS=$LIBS
9013                 LIBS=$save_LIBS
9014                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9015                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9016                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9017                 LIBS=$save_LIBS
9018             fi
9019             if test "$with_gssapi" != "no"; then
9020                 WITH_GSSAPI=TRUE
9021                 save_LIBS=$LIBS
9022                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9023                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9024                 GSSAPI_LIBS=$LIBS
9025                 LIBS=$save_LIBS
9026             fi
9027             ;;
9028         *)
9029             if test "$with_krb5" = "yes"; then
9030                 WITH_KRB5=TRUE
9031                 save_LIBS=$LIBS
9032                 AC_SEARCH_LIBS(com_err, [com_err 'com_err -lssl -lcrypto' krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9033                     [AC_MSG_ERROR([could not find function 'com_err' required for Kerberos 5])])
9034                 KRB5_LIBS=$LIBS
9035                 LIBS=$save_LIBS
9036                 AC_SEARCH_LIBS(krb5_sendauth, [krb5 'krb5 -lcrypto -ldes -lasn1 -lroken'], [],
9037                     [AC_MSG_ERROR([could not find function 'krb5_sendauth' required for Kerberos 5])])
9038                 KRB5_LIBS="$KRB5_LIBS $LIBS"
9039                 LIBS=$save_LIBS
9040             fi
9041             if test "$with_gssapi" = "yes"; then
9042                 WITH_GSSAPI=TRUE
9043                 save_LIBS=$LIBS
9044                 AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
9045                     [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
9046                 LIBS=$save_LIBS
9047                 GSSAPI_LIBS=$LIBS
9048             fi
9049         esac
9051         if test -n "$with_libpq_path"; then
9052             SYSTEM_POSTGRESQL=TRUE
9053             postgres_interface="external libpq"
9054             POSTGRESQL_LIB="-L${with_libpq_path}/lib/"
9055             POSTGRESQL_INC=-I"${with_libpq_path}/include/"
9056         else
9057             SYSTEM_POSTGRESQL=
9058             postgres_interface="internal"
9059             POSTGRESQL_LIB=""
9060             POSTGRESQL_INC="%OVERRIDE_ME%"
9061             BUILD_TYPE="$BUILD_TYPE POSTGRESQL"
9062         fi
9063     fi
9065     AC_MSG_CHECKING([PostgreSQL C interface])
9066     AC_MSG_RESULT([$postgres_interface])
9068     if test "${SYSTEM_POSTGRESQL}" = "TRUE"; then
9069         AC_MSG_NOTICE([checking system PostgreSQL prerequisites])
9070         save_CFLAGS=$CFLAGS
9071         save_CPPFLAGS=$CPPFLAGS
9072         save_LIBS=$LIBS
9073         CPPFLAGS="${CPPFLAGS} ${POSTGRESQL_INC}"
9074         LIBS="${LIBS} ${POSTGRESQL_LIB}"
9075         AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR([libpq-fe.h is needed])], [])
9076         AC_CHECK_LIB([pq], [PQconnectdbParams], [:],
9077             [AC_MSG_ERROR(libpq not found or too old. Need >= 9.0)], [])
9078         CFLAGS=$save_CFLAGS
9079         CPPFLAGS=$save_CPPFLAGS
9080         LIBS=$save_LIBS
9081     fi
9082     BUILD_POSTGRESQL_SDBC=TRUE
9083 else
9084     AC_MSG_RESULT([no])
9086 AC_SUBST(WITH_KRB5)
9087 AC_SUBST(WITH_GSSAPI)
9088 AC_SUBST(GSSAPI_LIBS)
9089 AC_SUBST(KRB5_LIBS)
9090 AC_SUBST(BUILD_POSTGRESQL_SDBC)
9091 AC_SUBST(SYSTEM_POSTGRESQL)
9092 AC_SUBST(POSTGRESQL_INC)
9093 AC_SUBST(POSTGRESQL_LIB)
9095 dnl ===================================================================
9096 dnl Check for Firebird stuff
9097 dnl ===================================================================
9098 ENABLE_FIREBIRD_SDBC=
9099 if test "$enable_firebird_sdbc" = "yes" ; then
9100     SCPDEFS="$SCPDEFS -DWITH_FIREBIRD_SDBC"
9102     dnl ===================================================================
9103     dnl Check for system Firebird
9104     dnl ===================================================================
9105     AC_MSG_CHECKING([which Firebird to use])
9106     if test "$with_system_firebird" = "yes"; then
9107         AC_MSG_RESULT([external])
9108         SYSTEM_FIREBIRD=TRUE
9109         AC_PATH_PROG(FIREBIRDCONFIG, [fb_config])
9110         if test -z "$FIREBIRDCONFIG"; then
9111             AC_MSG_NOTICE([No fb_config -- using pkg-config])
9112             PKG_CHECK_MODULES([FIREBIRD], [fbclient >= 3], [FIREBIRD_PKGNAME=fbclient], [
9113                 PKG_CHECK_MODULES([FIREBIRD], [fbembed], [FIREBIRD_PKGNAME=fbembed])
9114             ])
9115             FIREBIRD_VERSION=`pkg-config --modversion "$FIREBIRD_PKGNAME"`
9116         else
9117             AC_MSG_NOTICE([fb_config found])
9118             FIREBIRD_VERSION=`$FIREBIRDCONFIG --version`
9119             AC_MSG_CHECKING([for Firebird Client library])
9120             FIREBIRD_CFLAGS=`$FIREBIRDCONFIG --cflags`
9121             FIREBIRD_LIBS=`$FIREBIRDCONFIG --embedlibs`
9122             FilterLibs "${FIREBIRD_LIBS}"
9123             FIREBIRD_LIBS="${filteredlibs}"
9124         fi
9125         AC_MSG_RESULT([includes `$FIREBIRD_CFLAGS', libraries `$FIREBIRD_LIBS'])
9126         AC_MSG_CHECKING([Firebird version])
9127         if test -n "${FIREBIRD_VERSION}"; then
9128             FIREBIRD_MAJOR=`echo $FIREBIRD_VERSION | cut -d"." -f1`
9129             FIREBIRD_MINOR=`echo $FIREBIRD_VERSION | cut -d"." -f2`
9130             if test "$FIREBIRD_MAJOR" -eq "3" -a "$FIREBIRD_MINOR" -eq "0"; then
9131                 AC_MSG_RESULT([OK])
9132             else
9133                 AC_MSG_ERROR([Ensure firebird 3.0.x is installed])
9134             fi
9135         else
9136             __save_CFLAGS="${CFLAGS}"
9137             CFLAGS="${CFLAGS} ${FIREBIRD_CFLAGS}"
9138             AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <ibase.h>
9139 #if defined(FB_API_VER) && FB_API_VER == 30
9140 int fb_api_is_30(void) { return 0; }
9141 #else
9142 #error "Wrong Firebird API version"
9143 #endif]])],AC_MSG_RESULT([OK]),AC_MSG_ERROR([Ensure firebird 3.0.x is installed]))
9144             CFLAGS="${__save_CFLAGS}"
9145         fi
9146         ENABLE_FIREBIRD_SDBC=TRUE
9147         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9148     elif test "$enable_database_connectivity" != yes; then
9149         AC_MSG_RESULT([none])
9150     elif test "$cross_compiling" = "yes"; then
9151         AC_MSG_RESULT([none])
9152     else
9153         dnl Embedded Firebird has version 3.0
9154         AC_DEFINE(HAVE_FIREBIRD_30, 1)
9155         dnl We need libatomic_ops for any non X86/X64 system
9156         if test "${CPUNAME}" != INTEL -a "${CPUNAME}" != X86_64; then
9157             dnl ===================================================================
9158             dnl Check for system libatomic_ops
9159             dnl ===================================================================
9160             libo_CHECK_SYSTEM_MODULE([libatomic_ops],[ATOMIC_OPS],[atomic_ops >= 0.7.2])
9161             if test "$with_system_libatomic_ops" = "yes"; then
9162                 SYSTEM_LIBATOMIC_OPS=TRUE
9163                 AC_CHECK_HEADERS(atomic_ops.h, [],
9164                 [AC_MSG_ERROR(atomic_ops.h not found. install libatomic_ops)], [])
9165             else
9166                 SYSTEM_LIBATOMIC_OPS=
9167                 LIBATOMIC_OPS_CFLAGS="-I${WORKDIR}/UnpackedTarball/libatomic_ops/include"
9168                 LIBATOMIC_OPS_LIBS="-latomic_ops"
9169                 BUILD_TYPE="$BUILD_TYPE LIBATOMIC_OPS"
9170             fi
9171         fi
9173         AC_MSG_RESULT([internal])
9174         SYSTEM_FIREBIRD=
9175         FIREBIRD_CFLAGS="-I${WORKDIR}/UnpackedTarball/firebird/gen/Release/firebird/include"
9176         FIREBIRD_LIBS="-lfbclient"
9178         if test "$with_system_libtommath" = "yes"; then
9179             SYSTEM_LIBTOMMATH=TRUE
9180             dnl check for tommath presence
9181             save_LIBS=$LIBS
9182             AC_CHECK_HEADER(tommath.h,,AC_MSG_ERROR(Include file for tommath not found - please install development tommath package))
9183             AC_CHECK_LIB(tommath, mp_init, TOMMATH_LIBS=-ltommath, AC_MSG_ERROR(Library tommath not found - please install development tommath package))
9184             LIBS=$save_LIBS
9185         else
9186             SYSTEM_LIBTOMMATH=
9187             LIBTOMMATH_CFLAGS="-I${WORKDIR}/UnpackedTarball/libtommath"
9188             LIBTOMMATH_LIBS="-ltommath"
9189             BUILD_TYPE="$BUILD_TYPE LIBTOMMATH"
9190         fi
9192         BUILD_TYPE="$BUILD_TYPE FIREBIRD"
9193         ENABLE_FIREBIRD_SDBC=TRUE
9194         AC_DEFINE([ENABLE_FIREBIRD_SDBC],1)
9195     fi
9197 AC_SUBST(ENABLE_FIREBIRD_SDBC)
9198 AC_SUBST(SYSTEM_LIBATOMIC_OPS)
9199 AC_SUBST(LIBATOMIC_OPS_CFLAGS)
9200 AC_SUBST(LIBATOMIC_OPS_LIBS)
9201 AC_SUBST(SYSTEM_FIREBIRD)
9202 AC_SUBST(FIREBIRD_CFLAGS)
9203 AC_SUBST(FIREBIRD_LIBS)
9204 AC_SUBST([TOMMATH_CFLAGS])
9205 AC_SUBST([TOMMATH_LIBS])
9207 dnl ===================================================================
9208 dnl Check for system curl
9209 dnl ===================================================================
9210 AC_MSG_CHECKING([which libcurl to use])
9211 if test "$with_system_curl" = "auto"; then
9212     with_system_curl="$with_system_libs"
9215 if test "$with_system_curl" = "yes"; then
9216     AC_MSG_RESULT([external])
9217     SYSTEM_CURL=TRUE
9219     # First try PKGCONFIG and then fall back
9220     PKG_CHECK_MODULES(CURL, libcurl >= 7.19.4,, [:])
9222     if test -n "$CURL_PKG_ERRORS"; then
9223         AC_PATH_PROG(CURLCONFIG, curl-config)
9224         if test -z "$CURLCONFIG"; then
9225             AC_MSG_ERROR([curl development files not found])
9226         fi
9227         CURL_LIBS=`$CURLCONFIG --libs`
9228         FilterLibs "${CURL_LIBS}"
9229         CURL_LIBS="${filteredlibs}"
9230         CURL_CFLAGS=$("$CURLCONFIG" --cflags | sed -e "s/-I/${ISYSTEM?}/g")
9231         curl_version=`$CURLCONFIG --version | $SED -e 's/^libcurl //'`
9233         AC_MSG_CHECKING([whether libcurl is >= 7.19.4])
9234         case $curl_version in
9235         dnl brackets doubled below because Autoconf uses them as m4 quote characters,
9236         dnl so they need to be doubled to end up in the configure script
9237         7.19.4|7.19.[[5-9]]|7.[[2-9]]?.*|7.???.*|[[8-9]].*|[[1-9]][[0-9]].*)
9238             AC_MSG_RESULT([yes])
9239             ;;
9240         *)
9241             AC_MSG_ERROR([no, you have $curl_version])
9242             ;;
9243         esac
9244     fi
9246     ENABLE_CURL=TRUE
9247 elif test $_os = iOS; then
9248     # Let's see if we need curl, I think not?
9249     AC_MSG_RESULT([none])
9250     ENABLE_CURL=
9251 else
9252     AC_MSG_RESULT([internal])
9253     SYSTEM_CURL=
9254     BUILD_TYPE="$BUILD_TYPE CURL"
9255     ENABLE_CURL=TRUE
9257 AC_SUBST(SYSTEM_CURL)
9258 AC_SUBST(CURL_CFLAGS)
9259 AC_SUBST(CURL_LIBS)
9260 AC_SUBST(ENABLE_CURL)
9262 dnl ===================================================================
9263 dnl Check for system boost
9264 dnl ===================================================================
9265 AC_MSG_CHECKING([which boost to use])
9266 if test "$with_system_boost" = "yes"; then
9267     AC_MSG_RESULT([external])
9268     SYSTEM_BOOST=TRUE
9269     AX_BOOST_BASE(1.47)
9270     AX_BOOST_DATE_TIME
9271     AX_BOOST_FILESYSTEM
9272     AX_BOOST_IOSTREAMS
9273     AX_BOOST_LOCALE
9274     AC_LANG_PUSH([C++])
9275     save_CXXFLAGS=$CXXFLAGS
9276     CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS $CXXFLAGS_CXX11"
9277     AC_CHECK_HEADER(boost/shared_ptr.hpp, [],
9278        [AC_MSG_ERROR(boost/shared_ptr.hpp not found. install boost)], [])
9279     AC_CHECK_HEADER(boost/spirit/include/classic_core.hpp, [],
9280        [AC_MSG_ERROR(boost/spirit/include/classic_core.hpp not found. install boost >= 1.36)], [])
9281     CXXFLAGS=$save_CXXFLAGS
9282     AC_LANG_POP([C++])
9283     # this is in m4/ax_boost_base.m4
9284     FilterLibs "${BOOST_LDFLAGS}"
9285     BOOST_LDFLAGS="${filteredlibs}"
9286 else
9287     AC_MSG_RESULT([internal])
9288     BUILD_TYPE="$BUILD_TYPE BOOST"
9289     SYSTEM_BOOST=
9290     if test "${COM}" = "GCC" -o "${COM_IS_CLANG}" = "TRUE"; then
9291         # use warning-suppressing wrapper headers
9292         BOOST_CPPFLAGS="-I${SRC_ROOT}/external/boost/include -I${WORKDIR}/UnpackedTarball/boost"
9293     else
9294         BOOST_CPPFLAGS="-I${WORKDIR}/UnpackedTarball/boost"
9295     fi
9297 AC_SUBST(SYSTEM_BOOST)
9299 dnl ===================================================================
9300 dnl Check for system mdds
9301 dnl ===================================================================
9302 libo_CHECK_SYSTEM_MODULE([mdds], [MDDS], [mdds-1.5 >= 1.5.0], ["-I${WORKDIR}/UnpackedTarball/mdds/include"])
9304 dnl ===================================================================
9305 dnl Check for system glm
9306 dnl ===================================================================
9307 AC_MSG_CHECKING([which glm to use])
9308 if test "$with_system_glm" = "yes"; then
9309     AC_MSG_RESULT([external])
9310     SYSTEM_GLM=TRUE
9311     AC_LANG_PUSH([C++])
9312     AC_CHECK_HEADER([glm/glm.hpp], [],
9313        [AC_MSG_ERROR([glm/glm.hpp not found. install glm])], [])
9314     AC_LANG_POP([C++])
9315 else
9316     AC_MSG_RESULT([internal])
9317     BUILD_TYPE="$BUILD_TYPE GLM"
9318     SYSTEM_GLM=
9319     GLM_CFLAGS="${ISYSTEM}${WORKDIR}/UnpackedTarball/glm"
9321 AC_SUBST([GLM_CFLAGS])
9322 AC_SUBST([SYSTEM_GLM])
9324 dnl ===================================================================
9325 dnl Check for system odbc
9326 dnl ===================================================================
9327 AC_MSG_CHECKING([which odbc headers to use])
9328 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
9329     AC_MSG_RESULT([external])
9330     SYSTEM_ODBC_HEADERS=TRUE
9332     if test "$build_os" = "cygwin"; then
9333         save_CPPFLAGS=$CPPFLAGS
9334         find_winsdk
9335         PathFormat "$winsdktest"
9336         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"
9337         AC_CHECK_HEADER(sqlext.h, [],
9338             [AC_MSG_ERROR(odbc not found. install odbc)],
9339             [#include <windows.h>])
9340         CPPFLAGS=$save_CPPFLAGS
9341     else
9342         AC_CHECK_HEADER(sqlext.h, [],
9343             [AC_MSG_ERROR(odbc not found. install odbc)],[])
9344     fi
9345 elif test "$enable_database_connectivity" != yes; then
9346     AC_MSG_RESULT([none])
9347 else
9348     AC_MSG_RESULT([internal])
9349     SYSTEM_ODBC_HEADERS=
9351 AC_SUBST(SYSTEM_ODBC_HEADERS)
9353 dnl ===================================================================
9354 dnl Enable LDAP support
9355 dnl ===================================================================
9357 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android"; then
9358 AC_MSG_CHECKING([whether to enable LDAP support])
9359     if test "$enable_ldap" != "yes"; then
9360         AC_MSG_RESULT([no])
9361         ENABLE_LDAP=""
9362         enable_ldap=no
9363     else
9364         AC_MSG_RESULT([yes])
9365         ENABLE_LDAP="TRUE"
9366         AC_DEFINE(HAVE_FEATURE_LDAP)
9367     fi
9369 AC_SUBST(ENABLE_LDAP)
9371 dnl ===================================================================
9372 dnl Check for system openldap
9373 dnl ===================================================================
9375 if test "$_os" != "WINNT" -a "$_os" != "iOS" -a "$_os" != "Android" -a "$ENABLE_LDAP" != ""; then
9376 AC_MSG_CHECKING([which openldap library to use])
9377 if test "$with_system_openldap" = "yes"; then
9378     AC_MSG_RESULT([external])
9379     SYSTEM_OPENLDAP=TRUE
9380     AC_CHECK_HEADERS(ldap.h, [], [AC_MSG_ERROR(ldap.h not found. install openldap libs)], [])
9381     AC_CHECK_LIB([ldap], [ldap_simple_bind_s], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9382     AC_CHECK_LIB([ldap], [ldap_set_option], [:], [AC_MSG_ERROR(openldap lib not found or functional)], [])
9383 else
9384     AC_MSG_RESULT([internal])
9385     SYSTEM_OPENLDAP=
9386     BUILD_TYPE="$BUILD_TYPE OPENLDAP"
9389 AC_SUBST(SYSTEM_OPENLDAP)
9391 dnl ===================================================================
9392 dnl Check for system NSS
9393 dnl ===================================================================
9394 if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
9395     libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
9396     AC_DEFINE(HAVE_FEATURE_NSS)
9397     ENABLE_NSS="TRUE"
9398     AC_DEFINE(ENABLE_NSS)
9399 elif test $_os != iOS ; then
9400     with_tls=openssl
9402 AC_SUBST(ENABLE_NSS)
9404 dnl ===================================================================
9405 dnl Check for TLS/SSL and cryptographic implementation to use
9406 dnl ===================================================================
9407 AC_MSG_CHECKING([which TLS/SSL and cryptographic implementation to use])
9408 if test -n "$with_tls"; then
9409     case $with_tls in
9410     openssl)
9411         AC_DEFINE(USE_TLS_OPENSSL)
9412         TLS=OPENSSL
9414         if test "$enable_openssl" != "yes"; then
9415             AC_MSG_ERROR(["Disabling OpenSSL was requested, but the requested TLS to use is actually OpenSSL."])
9416         fi
9418         # warn that OpenSSL has been selected but not all TLS code has this option
9419         AC_MSG_WARN([TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS])
9420         add_warning "TLS/SSL implementation to use is OpenSSL but some code may still depend on NSS or GNUTLS"
9421         ;;
9422     nss)
9423         AC_DEFINE(USE_TLS_NSS)
9424         TLS=NSS
9425         ;;
9426     no)
9427         AC_MSG_WARN([Skipping TLS/SSL])
9428         ;;
9429     *)
9430         AC_MSG_ERROR([unsupported implementation $with_tls. Supported are:
9431 openssl - OpenSSL
9432 nss - Mozilla's Network Security Services (NSS)
9433     ])
9434         ;;
9435     esac
9436 else
9437     # default to using NSS, it results in smaller oox lib
9438     AC_DEFINE(USE_TLS_NSS)
9439     TLS=NSS
9441 AC_MSG_RESULT([$TLS])
9442 AC_SUBST(TLS)
9444 dnl ===================================================================
9445 dnl Check for system sane
9446 dnl ===================================================================
9447 AC_MSG_CHECKING([which sane header to use])
9448 if test "$with_system_sane" = "yes"; then
9449     AC_MSG_RESULT([external])
9450     AC_CHECK_HEADER(sane/sane.h, [],
9451       [AC_MSG_ERROR(sane not found. install sane)], [])
9452 else
9453     AC_MSG_RESULT([internal])
9454     BUILD_TYPE="$BUILD_TYPE SANE"
9457 dnl ===================================================================
9458 dnl Check for system icu
9459 dnl ===================================================================
9460 SYSTEM_GENBRK=
9461 SYSTEM_GENCCODE=
9462 SYSTEM_GENCMN=
9464 ICU_MAJOR=63
9465 ICU_MINOR=1
9466 ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9467 ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9468 ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9469 AC_MSG_CHECKING([which icu to use])
9470 if test "$with_system_icu" = "yes"; then
9471     AC_MSG_RESULT([external])
9472     SYSTEM_ICU=TRUE
9473     AC_LANG_PUSH([C++])
9474     AC_MSG_CHECKING([for unicode/rbbi.h])
9475     AC_PREPROC_IFELSE([AC_LANG_SOURCE([[unicode/rbbi.h]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([icu headers not found])])
9476     AC_LANG_POP([C++])
9478     if test "$cross_compiling" != "yes"; then
9479         PKG_CHECK_MODULES(ICU, icu-i18n >= 4.6)
9480         ICU_VERSION=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9481         ICU_MAJOR=`echo $ICU_VERSION | cut -d"." -f1`
9482         ICU_MINOR=`echo $ICU_VERSION | cut -d"." -f2`
9483     fi
9485     if test "$cross_compiling" = "yes" -a \( "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force" \); then
9486         ICU_VERSION_FOR_BUILD=`$PKG_CONFIG --modversion icu-i18n 2>/dev/null`
9487         ICU_MAJOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f1`
9488         ICU_MINOR_FOR_BUILD=`echo $ICU_VERSION_FOR_BUILD | cut -d"." -f2`
9489         AC_MSG_CHECKING([if MinGW and system versions of ICU are compatible])
9490         if test "$ICU_MAJOR" -eq "$ICU_MAJOR_FOR_BUILD" -a "$ICU_MINOR" -eq "$ICU_MINOR_FOR_BUILD"; then
9491             AC_MSG_RESULT([yes])
9492         else
9493             AC_MSG_RESULT([no])
9494             if test "$with_system_icu_for_build" != "force"; then
9495                 AC_MSG_ERROR([System ICU is not version-compatible with MinGW ICU.
9496 You can use --with-system-icu-for-build=force to use it anyway.])
9497             fi
9498         fi
9499     fi
9501     if test "$cross_compiling" != "yes" -o "$with_system_icu_for_build" = "yes" -o "$with_system_icu_for_build" = "force"; then
9502         # using the system icu tools can lead to version confusion, use the
9503         # ones from the build environment when cross-compiling
9504         AC_PATH_PROG(SYSTEM_GENBRK, genbrk, [], [$PATH:/usr/sbin:/sbin])
9505         if test -z "$SYSTEM_GENBRK"; then
9506             AC_MSG_ERROR([\'genbrk\' not found in \$PATH, install the icu development tool \'genbrk\'])
9507         fi
9508         AC_PATH_PROG(SYSTEM_GENCCODE, genccode, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9509         if test -z "$SYSTEM_GENCCODE"; then
9510             AC_MSG_ERROR([\'genccode\' not found in \$PATH, install the icu development tool \'genccode\'])
9511         fi
9512         AC_PATH_PROG(SYSTEM_GENCMN, gencmn, [], [$PATH:/usr/sbin:/sbin:/usr/local/sbin])
9513         if test -z "$SYSTEM_GENCMN"; then
9514             AC_MSG_ERROR([\'gencmn\' not found in \$PATH, install the icu development tool \'gencmn\'])
9515         fi
9516         if test "$ICU_MAJOR" -ge "49"; then
9517             ICU_RECLASSIFIED_PREPEND_SET_EMPTY="TRUE"
9518             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER="TRUE"
9519             ICU_RECLASSIFIED_HEBREW_LETTER="TRUE"
9520         else
9521             ICU_RECLASSIFIED_PREPEND_SET_EMPTY=
9522             ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER=
9523             ICU_RECLASSIFIED_HEBREW_LETTER=
9524         fi
9525     fi
9527     if test "$cross_compiling" = "yes"; then
9528         if test "$ICU_MAJOR" -ge "50"; then
9529             AC_MSG_RESULT([Ignore ICU_MINOR as obviously the libraries don't include the minor version in their names any more])
9530             ICU_MINOR=""
9531         fi
9532     fi
9533 else
9534     AC_MSG_RESULT([internal])
9535     SYSTEM_ICU=
9536     BUILD_TYPE="$BUILD_TYPE ICU"
9537     # surprisingly set these only for "internal" (to be used by various other
9538     # external libs): the system icu-config is quite unhelpful and spits out
9539     # dozens of weird flags and also default path -I/usr/include
9540     ICU_CFLAGS="-I${WORKDIR}/UnpackedTarball/icu/source/i18n -I${WORKDIR}/UnpackedTarball/icu/source/common"
9541     ICU_LIBS="-L${WORKDIR}/UnpackedTarball/icu/source/lib"
9543 if test "$ICU_MAJOR" -ge "59"; then
9544     # As of ICU 59 it defaults to typedef char16_t UChar; which is available
9545     # with -std=c++11 but not all external libraries can be built with that,
9546     # for those use a bit-compatible typedef uint16_t UChar; see
9547     # icu/source/common/unicode/umachine.h
9548     ICU_UCHAR_TYPE="-DUCHAR_TYPE=uint16_t"
9549 else
9550     ICU_UCHAR_TYPE=""
9552 AC_SUBST(SYSTEM_ICU)
9553 AC_SUBST(SYSTEM_GENBRK)
9554 AC_SUBST(SYSTEM_GENCCODE)
9555 AC_SUBST(SYSTEM_GENCMN)
9556 AC_SUBST(ICU_MAJOR)
9557 AC_SUBST(ICU_MINOR)
9558 AC_SUBST(ICU_RECLASSIFIED_PREPEND_SET_EMPTY)
9559 AC_SUBST(ICU_RECLASSIFIED_CONDITIONAL_JAPANESE_STARTER)
9560 AC_SUBST(ICU_RECLASSIFIED_HEBREW_LETTER)
9561 AC_SUBST(ICU_CFLAGS)
9562 AC_SUBST(ICU_LIBS)
9563 AC_SUBST(ICU_UCHAR_TYPE)
9565 dnl ==================================================================
9566 dnl Breakpad
9567 dnl ==================================================================
9568 AC_MSG_CHECKING([whether to enable breakpad])
9569 if test "$enable_breakpad" != yes; then
9570     AC_MSG_RESULT([no])
9571 else
9572     AC_MSG_RESULT([yes])
9573     ENABLE_BREAKPAD="TRUE"
9574     AC_DEFINE(ENABLE_BREAKPAD)
9575     AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1)
9576     BUILD_TYPE="$BUILD_TYPE BREAKPAD"
9578     AC_MSG_CHECKING([for crashreport config])
9579     if test "$with_symbol_config" = "no"; then
9580         BREAKPAD_SYMBOL_CONFIG="invalid"
9581         AC_MSG_RESULT([no])
9582     else
9583         BREAKPAD_SYMBOL_CONFIG="$with_symbol_config"
9584         AC_DEFINE(BREAKPAD_SYMBOL_CONFIG)
9585         AC_MSG_RESULT([yes])
9586     fi
9587     AC_SUBST(BREAKPAD_SYMBOL_CONFIG)
9589 AC_SUBST(ENABLE_BREAKPAD)
9591 dnl ==================================================================
9592 dnl libfuzzer
9593 dnl ==================================================================
9594 AC_MSG_CHECKING([whether to enable fuzzers])
9595 if test "$enable_fuzzers" != yes; then
9596     AC_MSG_RESULT([no])
9597 else
9598     AC_MSG_RESULT([yes])
9599     ENABLE_FUZZERS="TRUE"
9600     AC_DEFINE([ENABLE_FUZZERS],1)
9601     BUILD_TYPE="$BUILD_TYPE FUZZERS"
9603 AC_SUBST(ENABLE_FUZZERS)
9605 dnl ===================================================================
9606 dnl Orcus
9607 dnl ===================================================================
9608 libo_CHECK_SYSTEM_MODULE([orcus],[ORCUS],[liborcus-0.15 >= 0.15.0])
9609 if test "$with_system_orcus" != "yes"; then
9610     if test "$SYSTEM_BOOST" = "TRUE"; then
9611         # ===========================================================
9612         # Determine if we are going to need to link with Boost.System
9613         # ===========================================================
9614         dnl This seems to be necessary since boost 1.50 (1.48 does not need it,
9615         dnl 1.49 is untested). The macro BOOST_THREAD_DONT_USE_SYSTEM mentioned
9616         dnl in documentation has no effect.
9617         AC_MSG_CHECKING([if we need to link with Boost.System])
9618         AC_LANG_PUSH([C++])
9619         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9620                 @%:@include <boost/version.hpp>
9621             ]],[[
9622                 #if BOOST_VERSION >= 105000
9623                 #   error yes, we need to link with Boost.System
9624                 #endif
9625             ]])],[
9626                 AC_MSG_RESULT([no])
9627             ],[
9628                 AC_MSG_RESULT([yes])
9629                 AX_BOOST_SYSTEM
9630         ])
9631         AC_LANG_POP([C++])
9632     fi
9634 dnl FIXME by renaming SYSTEM_LIBORCUS to SYSTEM_ORCUS in the build system world
9635 SYSTEM_LIBORCUS=$SYSTEM_ORCUS
9636 AC_SUBST([BOOST_SYSTEM_LIB])
9637 AC_SUBST(SYSTEM_LIBORCUS)
9639 dnl ===================================================================
9640 dnl HarfBuzz
9641 dnl ===================================================================
9642 libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3],
9643                          ["-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"],
9644                          ["-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"])
9646 libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 0.9.42],
9647                          ["-I${WORKDIR}/UnpackedTarball/harfbuzz/src"],
9648                          ["-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbuzz"])
9650 if test "$COM" = "MSC"; then # override the above
9651     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
9652     HARFBUZZ_LIBS="${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs/libharfbuzz.lib"
9655 if test "$with_system_harfbuzz" = "yes"; then
9656     if test "$with_system_graphite" = "no"; then
9657         AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
9658     fi
9659     AC_MSG_CHECKING([whether system Harfbuzz is built with Graphite support])
9660     _save_libs="$LIBS"
9661     _save_cflags="$CFLAGS"
9662     LIBS="$LIBS $HARFBUZZ_LIBS"
9663     CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS"
9664     AC_CHECK_FUNC(hb_graphite2_face_get_gr_face,,[AC_MSG_ERROR([Harfbuzz needs to be built with Graphite support.])])
9665     LIBS="$_save_libs"
9666     CFLAGS="$_save_cflags"
9667 else
9668     if test "$with_system_graphite" = "yes"; then
9669         AC_MSG_ERROR([--without-system-graphite must be used when --without-system-harfbuzz is used])
9670     fi
9673 AC_MSG_CHECKING([whether to use X11])
9674 dnl ***************************************
9675 dnl testing for X libraries and includes...
9676 dnl ***************************************
9677 if test "$USING_X11" = TRUE; then
9678     AC_DEFINE(HAVE_FEATURE_X11)
9680 AC_MSG_RESULT([$USING_X11])
9682 if test "$USING_X11" = TRUE; then
9683     AC_PATH_X
9684     AC_PATH_XTRA
9685     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
9687     if test -z "$x_includes"; then
9688         x_includes="default_x_includes"
9689     fi
9690     if test -z "$x_libraries"; then
9691         x_libraries="default_x_libraries"
9692     fi
9693     CFLAGS="$CFLAGS $X_CFLAGS"
9694     LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
9695     AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", [AC_MSG_ERROR([X Development libraries not found])])
9696 else
9697     x_includes="no_x_includes"
9698     x_libraries="no_x_libraries"
9701 if test "$USING_X11" = TRUE; then
9702     dnl ===================================================================
9703     dnl Check for extension headers
9704     dnl ===================================================================
9705     AC_CHECK_HEADERS(X11/extensions/shape.h,[],[AC_MSG_ERROR([libXext headers not found])],
9706      [#include <X11/extensions/shape.h>])
9708     # vcl needs ICE and SM
9709     AC_CHECK_HEADERS(X11/ICE/ICElib.h,[],[AC_MSG_ERROR([libICE headers not found])])
9710     AC_CHECK_LIB([ICE], [IceConnectionNumber], [:],
9711         [AC_MSG_ERROR(ICE library not found)])
9712     AC_CHECK_HEADERS(X11/SM/SMlib.h,[],[AC_MSG_ERROR([libSM headers not found])])
9713     AC_CHECK_LIB([SM], [SmcOpenConnection], [:],
9714         [AC_MSG_ERROR(SM library not found)])
9717 dnl ===================================================================
9718 dnl Check for system Xrender
9719 dnl ===================================================================
9720 AC_MSG_CHECKING([whether to use Xrender])
9721 if test "$USING_X11" = TRUE -a  "$test_xrender" = "yes"; then
9722     AC_MSG_RESULT([yes])
9723     PKG_CHECK_MODULES(XRENDER, xrender)
9724     XRENDER_CFLAGS=$(printf '%s' "$XRENDER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9725     FilterLibs "${XRENDER_LIBS}"
9726     XRENDER_LIBS="${filteredlibs}"
9727     AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [:],
9728       [AC_MSG_ERROR(libXrender not found or functional)], [])
9729     AC_CHECK_HEADER(X11/extensions/Xrender.h, [],
9730       [AC_MSG_ERROR(Xrender not found. install X)], [])
9731 else
9732     AC_MSG_RESULT([no])
9734 AC_SUBST(XRENDER_CFLAGS)
9735 AC_SUBST(XRENDER_LIBS)
9737 dnl ===================================================================
9738 dnl Check for XRandr
9739 dnl ===================================================================
9740 AC_MSG_CHECKING([whether to enable RandR support])
9741 if test "$USING_X11" = TRUE -a "$test_randr" = "yes" -a \( "$enable_randr" = "yes" -o "$enable_randr" = "TRUE" \); then
9742     AC_MSG_RESULT([yes])
9743     PKG_CHECK_MODULES(XRANDR, xrandr >= 1.2, ENABLE_RANDR="TRUE", ENABLE_RANDR="")
9744     if test "$ENABLE_RANDR" != "TRUE"; then
9745         AC_CHECK_HEADER(X11/extensions/Xrandr.h, [],
9746                     [AC_MSG_ERROR([X11/extensions/Xrandr.h could not be found. X11 dev missing?])], [])
9747         XRANDR_CFLAGS=" "
9748         AC_CHECK_LIB([Xrandr], [XRRQueryExtension], [:],
9749           [ AC_MSG_ERROR(libXrandr not found or functional) ], [])
9750         XRANDR_LIBS="-lXrandr "
9751         ENABLE_RANDR="TRUE"
9752     fi
9753     XRANDR_CFLAGS=$(printf '%s' "$XRANDR_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9754     FilterLibs "${XRANDR_LIBS}"
9755     XRANDR_LIBS="${filteredlibs}"
9756 else
9757     ENABLE_RANDR=""
9758     AC_MSG_RESULT([no])
9760 AC_SUBST(XRANDR_CFLAGS)
9761 AC_SUBST(XRANDR_LIBS)
9762 AC_SUBST(ENABLE_RANDR)
9764 if test "$enable_neon" = "no" -o "$enable_mpl_subset" = "yes"; then
9765     WITH_WEBDAV="serf"
9767 if test $_os = iOS -o $_os = Android; then
9768     WITH_WEBDAV="no"
9770 AC_MSG_CHECKING([for webdav library])
9771 case "$WITH_WEBDAV" in
9772 serf)
9773     AC_MSG_RESULT([serf])
9774     # Check for system apr-util
9775     libo_CHECK_SYSTEM_MODULE([apr],[APR],[apr-util-1],
9776                              ["-I${WORKDIR}/UnpackedTarball/apr/include -I${WORKDIR}/UnpackedTarball/apr_util/include"],
9777                              ["-L${WORKDIR}/UnpackedTarball/apr/.libs -lapr-1 -L${WORKDIR}/UnpackedTarball/apr_util/.libs -laprutil-1"])
9778     if test "$COM" = "MSC"; then
9779         APR_LIB_DIR="LibR"
9780         test -n "${MSVC_USE_DEBUG_RUNTIME}" && APR_LIB_DIR="LibD"
9781         APR_LIBS="${WORKDIR}/UnpackedTarball/apr/${APR_LIB_DIR}/apr-1.lib ${WORKDIR}/UnpackedTarball/apr_util/${APR_LIB_DIR}/aprutil-1.lib"
9782     fi
9784     # Check for system serf
9785     libo_CHECK_SYSTEM_MODULE([serf],[SERF],[serf-1 >= 1.1.0],["-I${WORKDIR}/UnpackedTarball/serf"],
9786                              ["-L${WORKDIR}/UnpackedTarball/serf/.libs -lserf-1"])
9787     if test "$COM" = "MSC"; then
9788         SERF_LIB_DIR="Release"
9789         test -n "${MSVC_USE_DEBUG_RUNTIME}" && SERF_LIB_DIR="Debug"
9790         SERF_LIBS="${WORKDIR}/UnpackedTarball/serf/${SERF_LIB_DIR}/serf-1.lib"
9791     fi
9792     ;;
9793 neon)
9794     AC_MSG_RESULT([neon])
9795     # Check for system neon
9796     libo_CHECK_SYSTEM_MODULE([neon],[NEON],[neon >= 0.26.0])
9797     if test "$with_system_neon" = "yes"; then
9798         NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`"
9799     else
9800         NEON_VERSION=0295
9801     fi
9802     AC_SUBST(NEON_VERSION)
9803     ;;
9805     AC_MSG_RESULT([none, disabled])
9806     WITH_WEBDAV=""
9807     ;;
9808 esac
9809 AC_SUBST(WITH_WEBDAV)
9811 dnl ===================================================================
9812 dnl Check for disabling cve_tests
9813 dnl ===================================================================
9814 AC_MSG_CHECKING([whether to execute CVE tests])
9815 # If not explicitly enabled or disabled, default
9816 if test -z "$enable_cve_tests"; then
9817     case "$OS" in
9818     WNT)
9819         # Default cves off for Windows with its wild and wonderful
9820         # variety of AV software kicking in and panicking
9821         enable_cve_tests=no
9822         ;;
9823     *)
9824         # otherwise yes
9825         enable_cve_tests=yes
9826         ;;
9827     esac
9829 if test "$enable_cve_tests" = "no"; then
9830     AC_MSG_RESULT([no])
9831     DISABLE_CVE_TESTS=TRUE
9832     AC_SUBST(DISABLE_CVE_TESTS)
9833 else
9834     AC_MSG_RESULT([yes])
9837 dnl ===================================================================
9838 dnl Check for enabling chart XShape tests
9839 dnl ===================================================================
9840 AC_MSG_CHECKING([whether to execute chart XShape tests])
9841 if test "$enable_chart_tests" = "yes" -o '(' "$_os" = "WINNT" -a "$enable_chart_tests" != "no" ')'; then
9842     AC_MSG_RESULT([yes])
9843     ENABLE_CHART_TESTS=TRUE
9844     AC_SUBST(ENABLE_CHART_TESTS)
9845 else
9846     AC_MSG_RESULT([no])
9849 dnl ===================================================================
9850 dnl Check for system openssl
9851 dnl ===================================================================
9852 DISABLE_OPENSSL=
9853 AC_MSG_CHECKING([whether to disable OpenSSL usage])
9854 if test "$enable_openssl" = "yes"; then
9855     AC_MSG_RESULT([no])
9856     if test "$_os" = Darwin ; then
9857         # OpenSSL is deprecated when building for 10.7 or later.
9858         #
9859         # http://stackoverflow.com/questions/7406946/why-is-apple-deprecating-openssl-in-macos-10-7-lion
9860         # http://stackoverflow.com/questions/7475914/libcrypto-deprecated-on-mac-os-x-10-7-lion
9862         with_system_openssl=no
9863         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9864     elif test "$_os" = "NetBSD" -o "$_os" = "OpenBSD" -o "$_os" = "DragonFly" \
9865             && test "$with_system_openssl" != "no"; then
9866         with_system_openssl=yes
9867         SYSTEM_OPENSSL=TRUE
9868         OPENSSL_CFLAGS=
9869         OPENSSL_LIBS="-lssl -lcrypto"
9870     else
9871         libo_CHECK_SYSTEM_MODULE([openssl],[OPENSSL],[openssl])
9872     fi
9873     if test "$with_system_openssl" = "yes"; then
9874         AC_MSG_CHECKING([whether openssl supports SHA512])
9875         AC_LANG_PUSH([C])
9876         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/sha.h>]],[[
9877             SHA512_CTX context;
9878 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, openssl too old. Need >= 0.9.8.])])
9879         AC_LANG_POP(C)
9880     fi
9881 else
9882     AC_MSG_RESULT([yes])
9883     DISABLE_OPENSSL=TRUE
9885     # warn that although OpenSSL is disabled, system libraries may depend on it
9886     AC_MSG_WARN([OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies])
9887     add_warning "OpenSSL has been disabled. No code compiled here will make use of it but system libraries may create indirect dependencies"
9890 AC_SUBST([DISABLE_OPENSSL])
9892 if test "$enable_cipher_openssl_backend" = yes && test "$DISABLE_OPENSSL" = TRUE; then
9893     if test "$libo_fuzzed_enable_cipher_openssl_backend" = yes; then
9894         AC_MSG_NOTICE([Resetting --enable-cipher-openssl-backend=no])
9895         enable_cipher_openssl_backend=no
9896     else
9897         AC_MSG_ERROR([--enable-cipher-openssl-backend needs OpenSSL, but --disable-openssl was given.])
9898     fi
9900 AC_MSG_CHECKING([whether to enable the OpenSSL backend for rtl/cipher.h])
9901 ENABLE_CIPHER_OPENSSL_BACKEND=
9902 if test "$enable_cipher_openssl_backend" = yes; then
9903     AC_MSG_RESULT([yes])
9904     ENABLE_CIPHER_OPENSSL_BACKEND=TRUE
9905 else
9906     AC_MSG_RESULT([no])
9908 AC_SUBST([ENABLE_CIPHER_OPENSSL_BACKEND])
9910 dnl ===================================================================
9911 dnl Check for building gnutls
9912 dnl ===================================================================
9913 AC_MSG_CHECKING([whether to use gnutls])
9914 if test "$WITH_WEBDAV" = "neon" -a "$with_system_neon" = no -a "$enable_openssl" = "no"; then
9915     AC_MSG_RESULT([yes])
9916     AM_PATH_LIBGCRYPT()
9917     PKG_CHECK_MODULES(GNUTLS, [gnutls],,
9918         AC_MSG_ERROR([[Disabling OpenSSL was requested, but GNUTLS is not
9919                       available in the system to use as replacement.]]))
9920     FilterLibs "${LIBGCRYPT_LIBS}"
9921     LIBGCRYPT_LIBS="${filteredlibs}"
9922 else
9923     AC_MSG_RESULT([no])
9926 AC_SUBST([LIBGCRYPT_CFLAGS])
9927 AC_SUBST([LIBGCRYPT_LIBS])
9929 dnl ===================================================================
9930 dnl Check for system redland
9931 dnl ===================================================================
9932 dnl redland: versions before 1.0.8 write RDF/XML that is useless for ODF (@xml:base)
9933 dnl raptor2: need at least 2.0.7 for CVE-2012-0037
9934 libo_CHECK_SYSTEM_MODULE([redland],[REDLAND],[redland >= 1.0.8 raptor2 >= 2.0.7])
9935 if test "$with_system_redland" = "yes"; then
9936     AC_CHECK_LIB([rdf], [librdf_world_set_raptor_init_handler], [:],
9937             [AC_MSG_ERROR(librdf too old. Need >= 1.0.16)], [])
9938 else
9939     RAPTOR_MAJOR="0"
9940     RASQAL_MAJOR="3"
9941     REDLAND_MAJOR="0"
9943 AC_SUBST(RAPTOR_MAJOR)
9944 AC_SUBST(RASQAL_MAJOR)
9945 AC_SUBST(REDLAND_MAJOR)
9947 dnl ===================================================================
9948 dnl Check for system hunspell
9949 dnl ===================================================================
9950 AC_MSG_CHECKING([which libhunspell to use])
9951 if test "$with_system_hunspell" = "yes"; then
9952     AC_MSG_RESULT([external])
9953     SYSTEM_HUNSPELL=TRUE
9954     AC_LANG_PUSH([C++])
9955     PKG_CHECK_MODULES(HUNSPELL, hunspell, HUNSPELL_PC="TRUE", HUNSPELL_PC="" )
9956     if test "$HUNSPELL_PC" != "TRUE"; then
9957         AC_CHECK_HEADER(hunspell.hxx, [],
9958             [
9959             AC_CHECK_HEADER(hunspell/hunspell.hxx, [ HUNSPELL_CFLAGS=-I/usr/include/hunspell ],
9960             [AC_MSG_ERROR(hunspell headers not found.)], [])
9961             ], [])
9962         AC_CHECK_LIB([hunspell], [main], [:],
9963            [ AC_MSG_ERROR(hunspell library not found.) ], [])
9964         HUNSPELL_LIBS=-lhunspell
9965     fi
9966     AC_LANG_POP([C++])
9967     HUNSPELL_CFLAGS=$(printf '%s' "$HUNSPELL_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
9968     FilterLibs "${HUNSPELL_LIBS}"
9969     HUNSPELL_LIBS="${filteredlibs}"
9970 else
9971     AC_MSG_RESULT([internal])
9972     SYSTEM_HUNSPELL=
9973     HUNSPELL_CFLAGS="-I${WORKDIR}/UnpackedTarball/hunspell/src/hunspell"
9974     if test "$COM" = "MSC"; then
9975         HUNSPELL_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/hunspell.lib"
9976     else
9977         HUNSPELL_LIBS="-L${WORKDIR}/UnpackedTarball/hunspell/src/hunspell/.libs -lhunspell-1.7"
9978     fi
9979     BUILD_TYPE="$BUILD_TYPE HUNSPELL"
9981 AC_SUBST(SYSTEM_HUNSPELL)
9982 AC_SUBST(HUNSPELL_CFLAGS)
9983 AC_SUBST(HUNSPELL_LIBS)
9985 dnl ===================================================================
9986 dnl Check for system qrcodegen
9987 dnl ===================================================================
9988 AC_MSG_CHECKING([which libqrcodegen to use])
9989 if test "$with_system_qrcodegen" = "yes"; then
9990     AC_MSG_RESULT([external])
9991     SYSTEM_QRCODEGEN=TRUE
9992     AC_LANG_PUSH([C++])
9993     AC_CHECK_HEADER(qrcodegen/QrCode.hpp, [],
9994         [AC_MSG_ERROR(qrcodegen headers not found.)], [#include <stdexcept>])
9995     AC_CHECK_LIB([qrcodegencpp], [main], [:],
9996         [ AC_MSG_ERROR(qrcodegen C++ library not found.) ], [])
9997     QRCODEGEN_LIBS=-lqrcodegencpp
9998     AC_LANG_POP([C++])
9999     QRCODEGEN_CFLAGS=$(printf '%s' "$QRCODEGEN_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10000     FilterLibs "${QRCODEGEN_LIBS}"
10001     QRCODEGEN_LIBS="${filteredlibs}"
10002 else
10003     AC_MSG_RESULT([internal])
10004     SYSTEM_QRCODEGEN=
10005     BUILD_TYPE="$BUILD_TYPE QRCODEGEN"
10007 AC_SUBST(SYSTEM_QRCODEGEN)
10008 AC_SUBST(QRCODEGEN_CFLAGS)
10009 AC_SUBST(QRCODEGEN_LIBS)
10011 dnl ===================================================================
10012 dnl Checking for altlinuxhyph
10013 dnl ===================================================================
10014 AC_MSG_CHECKING([which altlinuxhyph to use])
10015 if test "$with_system_altlinuxhyph" = "yes"; then
10016     AC_MSG_RESULT([external])
10017     SYSTEM_HYPH=TRUE
10018     AC_CHECK_HEADER(hyphen.h, [],
10019        [ AC_MSG_ERROR(altlinuxhyph headers not found.)], [])
10020     AC_CHECK_MEMBER(struct _HyphenDict.cset, [],
10021        [ AC_MSG_ERROR(no. You are sure you have altlinuyhyph headers?)],
10022        [#include <hyphen.h>])
10023     AC_CHECK_LIB(hyphen, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyphen],
10024         [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10025     if test -z "$HYPHEN_LIB"; then
10026         AC_CHECK_LIB(hyph, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhyph],
10027            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10028     fi
10029     if test -z "$HYPHEN_LIB"; then
10030         AC_CHECK_LIB(hnj, hnj_hyphen_hyphenate2, [HYPHEN_LIB=-lhnj],
10031            [ AC_MSG_ERROR(altlinuxhyph library not found or too old.)], [])
10032     fi
10033 else
10034     AC_MSG_RESULT([internal])
10035     SYSTEM_HYPH=
10036     BUILD_TYPE="$BUILD_TYPE HYPHEN"
10037     if test "$COM" = "MSC"; then
10038         HYPHEN_LIB="${WORKDIR}/LinkTarget/StaticLibrary/hyphen.lib"
10039     else
10040         HYPHEN_LIB="-L${WORKDIR}/UnpackedTarball/hyphen/.libs -lhyphen"
10041     fi
10043 AC_SUBST(SYSTEM_HYPH)
10044 AC_SUBST(HYPHEN_LIB)
10046 dnl ===================================================================
10047 dnl Checking for mythes
10048 dnl ===================================================================
10049 AC_MSG_CHECKING([which mythes to use])
10050 if test "$with_system_mythes" = "yes"; then
10051     AC_MSG_RESULT([external])
10052     SYSTEM_MYTHES=TRUE
10053     AC_LANG_PUSH([C++])
10054     PKG_CHECK_MODULES(MYTHES, mythes, MYTHES_PKGCONFIG=yes, MYTHES_PKGCONFIG=no)
10055     if test "$MYTHES_PKGCONFIG" = "no"; then
10056         AC_CHECK_HEADER(mythes.hxx, [],
10057             [ AC_MSG_ERROR(mythes.hxx headers not found.)], [])
10058         AC_CHECK_LIB([mythes-1.2], [main], [:],
10059             [ MYTHES_FOUND=no], [])
10060     if test "$MYTHES_FOUND" = "no"; then
10061         AC_CHECK_LIB(mythes, main, [MYTHES_FOUND=yes],
10062                 [ MYTHES_FOUND=no], [])
10063     fi
10064     if test "$MYTHES_FOUND" = "no"; then
10065         AC_MSG_ERROR([mythes library not found!.])
10066     fi
10067     fi
10068     AC_LANG_POP([C++])
10069     MYTHES_CFLAGS=$(printf '%s' "$MYTHES_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10070     FilterLibs "${MYTHES_LIBS}"
10071     MYTHES_LIBS="${filteredlibs}"
10072 else
10073     AC_MSG_RESULT([internal])
10074     SYSTEM_MYTHES=
10075     BUILD_TYPE="$BUILD_TYPE MYTHES"
10076     if test "$COM" = "MSC"; then
10077         MYTHES_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/mythes.lib"
10078     else
10079         MYTHES_LIBS="-L${WORKDIR}/UnpackedTarball/mythes/.libs -lmythes-1.2"
10080     fi
10082 AC_SUBST(SYSTEM_MYTHES)
10083 AC_SUBST(MYTHES_CFLAGS)
10084 AC_SUBST(MYTHES_LIBS)
10086 dnl ===================================================================
10087 dnl How should we build the linear programming solver ?
10088 dnl ===================================================================
10090 ENABLE_COINMP=
10091 AC_MSG_CHECKING([whether to build with CoinMP])
10092 if test "$enable_coinmp" != "no"; then
10093     ENABLE_COINMP=TRUE
10094     AC_MSG_RESULT([yes])
10095     if test "$with_system_coinmp" = "yes"; then
10096         SYSTEM_COINMP=TRUE
10097         PKG_CHECK_MODULES(COINMP, coinmp coinutils)
10098         FilterLibs "${COINMP_LIBS}"
10099         COINMP_LIBS="${filteredlibs}"
10100     else
10101         BUILD_TYPE="$BUILD_TYPE COINMP"
10102     fi
10103 else
10104     AC_MSG_RESULT([no])
10106 AC_SUBST(ENABLE_COINMP)
10107 AC_SUBST(SYSTEM_COINMP)
10108 AC_SUBST(COINMP_CFLAGS)
10109 AC_SUBST(COINMP_LIBS)
10111 ENABLE_LPSOLVE=
10112 AC_MSG_CHECKING([whether to build with lpsolve])
10113 if test "$enable_lpsolve" != "no"; then
10114     ENABLE_LPSOLVE=TRUE
10115     AC_MSG_RESULT([yes])
10116 else
10117     AC_MSG_RESULT([no])
10119 AC_SUBST(ENABLE_LPSOLVE)
10121 if test "$ENABLE_LPSOLVE" = TRUE; then
10122     AC_MSG_CHECKING([which lpsolve to use])
10123     if test "$with_system_lpsolve" = "yes"; then
10124         AC_MSG_RESULT([external])
10125         SYSTEM_LPSOLVE=TRUE
10126         AC_CHECK_HEADER(lpsolve/lp_lib.h, [],
10127            [ AC_MSG_ERROR(lpsolve headers not found.)], [])
10128         save_LIBS=$LIBS
10129         # some systems need this. Like Ubuntu...
10130         AC_CHECK_LIB(m, floor)
10131         AC_CHECK_LIB(dl, dlopen)
10132         AC_CHECK_LIB([lpsolve55], [make_lp], [:],
10133             [ AC_MSG_ERROR(lpsolve library not found or too old.)], [])
10134         LIBS=$save_LIBS
10135     else
10136         AC_MSG_RESULT([internal])
10137         SYSTEM_LPSOLVE=
10138         BUILD_TYPE="$BUILD_TYPE LPSOLVE"
10139     fi
10141 AC_SUBST(SYSTEM_LPSOLVE)
10143 dnl ===================================================================
10144 dnl Checking for libexttextcat
10145 dnl ===================================================================
10146 libo_CHECK_SYSTEM_MODULE([libexttextcat],[LIBEXTTEXTCAT],[libexttextcat >= 3.4.1])
10147 if test "$with_system_libexttextcat" = "yes"; then
10148     SYSTEM_LIBEXTTEXTCAT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libexttextcat`
10150 AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA)
10152 dnl ===================================================================
10153 dnl Checking for libnumbertext
10154 dnl ===================================================================
10155 AC_MSG_CHECKING([whether to use libnumbertext])
10156 if test "$enable_libnumbertext" = "no"; then
10157     AC_MSG_RESULT([no])
10158     ENABLE_LIBNUMBERTEXT=
10159     SYSTEM_LIBNUMBERTEXT=
10160 else
10161     AC_MSG_RESULT([yes])
10162     ENABLE_LIBNUMBERTEXT=TRUE
10163     libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0])
10164     if test "$with_system_libnumbertext" = "yes"; then
10165         SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext`
10166         SYSTEM_LIBNUMBERTEXT=YES
10167     else
10168         SYSTEM_LIBNUMBERTEXT=
10169         AC_LANG_PUSH([C++])
10170         save_CPPFLAGS=$CPPFLAGS
10171         CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11"
10172         AC_CHECK_HEADERS([codecvt regex])
10173         AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes],
10174                 [ ENABLE_LIBNUMBERTEXT=''
10175                   LIBNUMBERTEXT_CFLAGS=''
10176                   AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9).
10177                                Enable libnumbertext fallback (missing number to number name conversion).])
10178                 ])
10179         CPPFLAGS=$save_CPPFLAGS
10180         AC_LANG_POP([C++])
10181     fi
10182     if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then
10183         AC_DEFINE(ENABLE_LIBNUMBERTEXT)
10184     fi
10186 AC_SUBST(SYSTEM_LIBNUMBERTEXT)
10187 AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA)
10188 AC_SUBST(ENABLE_LIBNUMBERTEXT)
10189 AC_SUBST(LIBNUMBERTEXT_CFLAGS)
10191 dnl ***************************************
10192 dnl testing libc version for Linux...
10193 dnl ***************************************
10194 if test "$_os" = "Linux"; then
10195     AC_MSG_CHECKING([whether libc is >= 2.1.1])
10196     exec 6>/dev/null # no output
10197     AC_CHECK_LIB(c, gnu_get_libc_version, HAVE_LIBC=yes; export HAVE_LIBC)
10198     exec 6>&1 # output on again
10199     if test "$HAVE_LIBC"; then
10200         AC_MSG_RESULT([yes])
10201     else
10202         AC_MSG_ERROR([no, upgrade libc])
10203     fi
10206 dnl =========================================
10207 dnl Check for uuidgen
10208 dnl =========================================
10209 if test "$_os" = "WINNT" -a "$cross_compiling" != "yes"; then
10210     # presence is already tested above in the WINDOWS_SDK_HOME check
10211     UUIDGEN=uuidgen.exe
10212     AC_SUBST(UUIDGEN)
10213 else
10214     AC_PATH_PROG([UUIDGEN], [uuidgen])
10215     if test -z "$UUIDGEN"; then
10216         AC_MSG_WARN([uuid is needed for building installation sets])
10217     fi
10220 dnl ***************************************
10221 dnl Checking for bison and flex
10222 dnl ***************************************
10223 AC_PATH_PROG(BISON, bison)
10224 if test -z "$BISON"; then
10225     AC_MSG_ERROR([no bison found in \$PATH, install it])
10226 else
10227     AC_MSG_CHECKING([the bison version])
10228     _bison_version=`$BISON --version | grep GNU | $SED -e 's@^[[^0-9]]*@@' -e 's@ .*@@' -e 's@,.*@@'`
10229     _bison_longver=`echo $_bison_version | $AWK -F. '{ print \$1*1000+\$2}'`
10230     # Accept newer than 2.0
10231     if test "$_bison_longver" -lt 2000; then
10232         AC_MSG_ERROR([failed ($BISON $_bison_version need 2.0+)])
10233     fi
10236 AC_PATH_PROG(FLEX, flex)
10237 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10238     FLEX=`cygpath -m $FLEX`
10240 if test -z "$FLEX"; then
10241     AC_MSG_ERROR([no flex found in \$PATH, install it])
10242 else
10243     AC_MSG_CHECKING([the flex version])
10244     _flex_version=$($FLEX --version | $SED -e 's/^.*\([[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\.[[[:digit:]]]\{1,\}\).*$/\1/')
10245     if test $(echo $_flex_version | $AWK -F. '{printf("%d%03d%03d", $1, $2, $3)}') -lt 2006000; then
10246         AC_MSG_ERROR([failed ($FLEX $_flex_version found, but need at least 2.6.0)])
10247     fi
10249 AC_SUBST([FLEX])
10250 dnl ***************************************
10251 dnl Checking for patch
10252 dnl ***************************************
10253 AC_PATH_PROG(PATCH, patch)
10254 if test -z "$PATCH"; then
10255     AC_MSG_ERROR(["patch" not found in \$PATH, install it])
10258 dnl On Solaris, FreeBSD or macOS, check if --with-gnu-patch was used
10259 if test "$_os" = "SunOS" -o "$_os" = "FreeBSD" -o "$_os" = "Darwin"; then
10260     if test -z "$with_gnu_patch"; then
10261         GNUPATCH=$PATCH
10262     else
10263         if test -x "$with_gnu_patch"; then
10264             GNUPATCH=$with_gnu_patch
10265         else
10266             AC_MSG_ERROR([--with-gnu-patch did not point to an executable])
10267         fi
10268     fi
10270     AC_MSG_CHECKING([whether $GNUPATCH is GNU patch])
10271     if $GNUPATCH --version | grep "Free Software Foundation" >/dev/null 2>/dev/null; then
10272         AC_MSG_RESULT([yes])
10273     else
10274         AC_MSG_ERROR([no, GNU patch needed. install or specify with --with-gnu-patch=/path/to/it])
10275     fi
10276 else
10277     GNUPATCH=$PATCH
10280 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10281     GNUPATCH=`cygpath -m $GNUPATCH`
10284 dnl We also need to check for --with-gnu-cp
10286 if test -z "$with_gnu_cp"; then
10287     # check the place where the good stuff is hidden on Solaris...
10288     if test -x /usr/gnu/bin/cp; then
10289         GNUCP=/usr/gnu/bin/cp
10290     else
10291         AC_PATH_PROGS(GNUCP, gnucp cp)
10292     fi
10293     if test -z $GNUCP; then
10294         AC_MSG_ERROR([Neither gnucp nor cp found. Install GNU cp and/or specify --with-gnu-cp=/path/to/it])
10295     fi
10296 else
10297     if test -x "$with_gnu_cp"; then
10298         GNUCP=$with_gnu_cp
10299     else
10300         AC_MSG_ERROR([--with-gnu-cp did not point to an executable])
10301     fi
10304 if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
10305     GNUCP=`cygpath -m $GNUCP`
10308 AC_MSG_CHECKING([whether $GNUCP is GNU cp from coreutils with preserve= support])
10309 if $GNUCP --version 2>/dev/null | grep "coreutils" >/dev/null 2>/dev/null; then
10310     AC_MSG_RESULT([yes])
10311 elif $GNUCP --version 2>/dev/null | grep "GNU fileutils" >/dev/null 2>/dev/null; then
10312     AC_MSG_RESULT([yes])
10313 else
10314     case "$build_os" in
10315     darwin*|netbsd*|openbsd*|freebsd*|dragonfly*|aix*)
10316         x_GNUCP=[\#]
10317         GNUCP=''
10318         AC_MSG_RESULT([no gnucp found - using the system's cp command])
10319         ;;
10320     *)
10321         AC_MSG_ERROR([no, GNU cp needed. install or specify with --with-gnu-cp=/path/to/it])
10322         ;;
10323     esac
10326 AC_SUBST(GNUPATCH)
10327 AC_SUBST(GNUCP)
10328 AC_SUBST(x_GNUCP)
10330 dnl ***************************************
10331 dnl testing assembler path
10332 dnl ***************************************
10333 ML_EXE=""
10334 if test "$_os" = "WINNT"; then
10335     if test "$BITNESS_OVERRIDE" = ""; then
10336         assembler=ml.exe
10337     else
10338         assembler=ml64.exe
10339     fi
10341     AC_MSG_CHECKING([for the MSVC assembler ($assembler)])
10342     if test -f "$CL_PATH/$assembler"; then
10343         ML_EXE=`win_short_path_for_make "$CL_PATH/$assembler"`
10344         AC_MSG_RESULT([$ML_EXE])
10345     else
10346         AC_MSG_ERROR([not found])
10347     fi
10350 AC_SUBST(ML_EXE)
10352 dnl ===================================================================
10353 dnl We need zip and unzip
10354 dnl ===================================================================
10355 AC_PATH_PROG(ZIP, zip)
10356 test -z "$ZIP" && AC_MSG_ERROR([zip is required])
10357 if ! "$ZIP" --filesync < /dev/null 2>/dev/null > /dev/null; then
10358     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],,)
10361 AC_PATH_PROG(UNZIP, unzip)
10362 test -z "$UNZIP" && AC_MSG_ERROR([unzip is required])
10364 dnl ===================================================================
10365 dnl Zip must be a specific type for different build types.
10366 dnl ===================================================================
10367 if test $build_os = cygwin; then
10368     if test -n "`$ZIP -h | $GREP -i WinNT`"; then
10369         AC_MSG_ERROR([$ZIP is not the required Cygwin version of Info-ZIP's zip.exe.])
10370     fi
10373 dnl ===================================================================
10374 dnl We need touch with -h option support.
10375 dnl ===================================================================
10376 AC_PATH_PROG(TOUCH, touch)
10377 test -z "$TOUCH" && AC_MSG_ERROR([touch is required])
10378 touch warn
10379 if ! "$TOUCH" -h warn 2>/dev/null > /dev/null; then
10380     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],,)
10383 dnl ===================================================================
10384 dnl Check for system epoxy
10385 dnl ===================================================================
10386 libo_CHECK_SYSTEM_MODULE([epoxy], [EPOXY], [epoxy >= 1.2], ["-I${WORKDIR}/UnpackedTarball/epoxy/include"])
10388 dnl ===================================================================
10389 dnl Set vcl option: coordinate device in double or sal_Int32
10390 dnl ===================================================================
10392 dnl disabled for now, we don't want subtle differences between OSs
10393 dnl AC_MSG_CHECKING([Type to use for Device Pixel coordinates])
10394 dnl if test "$_os" = "Darwin" -o  $_os = iOS ; then
10395 dnl     AC_DEFINE(VCL_FLOAT_DEVICE_PIXEL)
10396 dnl     AC_MSG_RESULT([double])
10397 dnl else
10398 dnl     AC_MSG_RESULT([sal_Int32])
10399 dnl fi
10401 dnl ===================================================================
10402 dnl Test which vclplugs have to be built.
10403 dnl ===================================================================
10404 R=""
10405 if test "$USING_X11" != TRUE; then
10406     enable_gtk=no
10407     enable_gtk3=no
10409 GTK3_CFLAGS=""
10410 GTK3_LIBS=""
10411 ENABLE_GTK3=""
10412 if test "x$enable_gtk3" = "xyes"; then
10413     if test "$with_system_cairo" = no; then
10414         AC_MSG_ERROR([System cairo required for gtk3 support, do not combine --enable-gtk3 with --without-system-cairo])
10415     fi
10416     : ${with_system_cairo:=yes}
10417     PKG_CHECK_MODULES(GTK3, gtk+-3.0 >= 3.18 gtk+-unix-print-3.0 gmodule-no-export-2.0 glib-2.0 >= 2.38 cairo, ENABLE_GTK3="TRUE", ENABLE_GTK3="")
10418     if test "x$ENABLE_GTK3" = "xTRUE"; then
10419         AC_DEFINE(ENABLE_GTK3)
10420         R="gtk3"
10421     else
10422         AC_MSG_ERROR([gtk3 or dependent libraries of the correct versions, not found])
10423     fi
10424     GTK3_CFLAGS=$(printf '%s' "$GTK3_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10425     FilterLibs "${GTK3_LIBS}"
10426     GTK3_LIBS="${filteredlibs}"
10428     dnl We require egl only for the gtk3 plugin. Otherwise we use glx.
10429     if test "$with_system_epoxy" != "yes"; then
10430         AC_CHECK_LIB(EGL, eglMakeCurrent, [:], AC_MSG_ERROR([libEGL required.]))
10431         AC_CHECK_HEADER(EGL/eglplatform.h, [],
10432                         [AC_MSG_ERROR(EGL headers not found. install mesa-libEGL-devel)], [])
10433     fi
10435 AC_SUBST(GTK3_LIBS)
10436 AC_SUBST(GTK3_CFLAGS)
10437 AC_SUBST(ENABLE_GTK3)
10439 if test "$enable_introspection" = yes; then
10440     if test "$ENABLE_GTK3" = TRUE; then
10441         GOBJECT_INTROSPECTION_REQUIRE(INTROSPECTION_REQUIRED_VERSION)
10442     else
10443         AC_MSG_ERROR([--enable-introspection requires --enable-gtk3])
10444     fi
10447 ENABLE_GTK=""
10448 if test "x$enable_gtk" = "xyes"; then
10449     if test "$with_system_cairo" = no; then
10450         AC_MSG_ERROR([System cairo required for gtk support, do not use --without-system-cairo or use --disable-gtk])
10451     fi
10452     : ${with_system_cairo:=yes}
10453     ENABLE_GTK="TRUE"
10454     AC_DEFINE(ENABLE_GTK)
10455     R="gtk $R"
10457 AC_SUBST(ENABLE_GTK)
10459 ENABLE_QT5=""
10460 if test "x$enable_qt5" = "xyes"; then
10461     ENABLE_QT5="TRUE"
10462     AC_DEFINE(ENABLE_QT5)
10463     R="$R qt5"
10465 AC_SUBST(ENABLE_QT5)
10467 ENABLE_KF5=""
10468 if test "x$enable_kf5" = "xyes"; then
10469     ENABLE_KF5="TRUE"
10470     AC_DEFINE(ENABLE_KF5)
10471     R="$R kf5"
10473 AC_SUBST(ENABLE_KF5)
10475 ENABLE_GTK3_KDE5=""
10476 if test "x$enable_gtk3_kde5" = "xyes"; then
10477     ENABLE_GTK3_KDE5="TRUE"
10478     AC_DEFINE(ENABLE_GTK3_KDE5)
10479     R="$R gtk3_kde5"
10481 AC_SUBST(ENABLE_GTK3_KDE5)
10483 if test "$_os" = "WINNT"; then
10484     R="$R win"
10485 elif test "$_os" = "Darwin"; then
10486     R="$R osx"
10487 elif test "$_os" = "iOS"; then
10488     R="ios (builtin)"
10491 build_vcl_plugins="$R"
10492 if test -z "$build_vcl_plugins"; then
10493     build_vcl_plugins="none"
10495 AC_MSG_NOTICE([VCLplugs to be built: $build_vcl_plugins])
10497 dnl ===================================================================
10498 dnl check for dbus support
10499 dnl ===================================================================
10500 ENABLE_DBUS=""
10501 DBUS_CFLAGS=""
10502 DBUS_LIBS=""
10503 DBUS_GLIB_CFLAGS=""
10504 DBUS_GLIB_LIBS=""
10505 DBUS_HAVE_GLIB=""
10507 if test "$enable_dbus" = "no"; then
10508     test_dbus=no
10511 AC_MSG_CHECKING([whether to enable DBUS support])
10512 if test "$test_dbus" = "yes"; then
10513     ENABLE_DBUS="TRUE"
10514     AC_MSG_RESULT([yes])
10515     PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.60)
10516     AC_DEFINE(ENABLE_DBUS)
10517     DBUS_CFLAGS=$(printf '%s' "$DBUS_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10518     FilterLibs "${DBUS_LIBS}"
10519     DBUS_LIBS="${filteredlibs}"
10521     # Glib is needed for BluetoothServer
10522     # Sets also DBUS_GLIB_CFLAGS/DBUS_GLIB_LIBS if successful.
10523     PKG_CHECK_MODULES(DBUS_GLIB,[glib-2.0 >= 2.4],
10524         [
10525             DBUS_HAVE_GLIB="TRUE"
10526             AC_DEFINE(DBUS_HAVE_GLIB,1)
10527         ],
10528         AC_MSG_WARN([[No Glib found, Bluetooth support will be disabled]])
10529     )
10530 else
10531     AC_MSG_RESULT([no])
10534 AC_SUBST(ENABLE_DBUS)
10535 AC_SUBST(DBUS_CFLAGS)
10536 AC_SUBST(DBUS_LIBS)
10537 AC_SUBST(DBUS_GLIB_CFLAGS)
10538 AC_SUBST(DBUS_GLIB_LIBS)
10539 AC_SUBST(DBUS_HAVE_GLIB)
10541 AC_MSG_CHECKING([whether to enable Impress remote control])
10542 if test -n "$enable_sdremote" -a "$enable_sdremote" != "no"; then
10543     AC_MSG_RESULT([yes])
10544     ENABLE_SDREMOTE=TRUE
10545     AC_MSG_CHECKING([whether to enable Bluetooth support in Impress remote control])
10547     if test $OS = MACOSX && test "$MAC_OS_X_VERSION_MAX_ALLOWED" -ge 101500; then
10548         # The Bluetooth code doesn't compile with macOS SDK 10.15
10549         enable_sdremote_bluetooth=no
10550     fi
10551     # If not explicitly enabled or disabled, default
10552     if test -z "$enable_sdremote_bluetooth"; then
10553         case "$OS" in
10554         LINUX|MACOSX|WNT)
10555             # Default to yes for these
10556             enable_sdremote_bluetooth=yes
10557             ;;
10558         *)
10559             # otherwise no
10560             enable_sdremote_bluetooth=no
10561             ;;
10562         esac
10563     fi
10564     # $enable_sdremote_bluetooth is guaranteed non-empty now
10566     if test "$enable_sdremote_bluetooth" != "no"; then
10567         if test "$OS" = "LINUX"; then
10568             if test "$ENABLE_DBUS" = "TRUE" -a "$DBUS_HAVE_GLIB" = "TRUE"; then
10569                 AC_MSG_RESULT([yes])
10570                 ENABLE_SDREMOTE_BLUETOOTH=TRUE
10571                 dnl ===================================================================
10572                 dnl Check for system bluez
10573                 dnl ===================================================================
10574                 AC_MSG_CHECKING([which Bluetooth header to use])
10575                 if test "$with_system_bluez" = "yes"; then
10576                     AC_MSG_RESULT([external])
10577                     AC_CHECK_HEADER(bluetooth/bluetooth.h, [],
10578                         [AC_MSG_ERROR(bluetooth.h not found. install bluez)], [])
10579                     SYSTEM_BLUEZ=TRUE
10580                 else
10581                     AC_MSG_RESULT([internal])
10582                     SYSTEM_BLUEZ=
10583                 fi
10584             else
10585                 AC_MSG_RESULT([no, dbus disabled])
10586                 ENABLE_SDREMOTE_BLUETOOTH=
10587                 SYSTEM_BLUEZ=
10588             fi
10589         else
10590             AC_MSG_RESULT([yes])
10591             ENABLE_SDREMOTE_BLUETOOTH=TRUE
10592             SYSTEM_BLUEZ=
10593         fi
10594     else
10595         AC_MSG_RESULT([no])
10596         ENABLE_SDREMOTE_BLUETOOTH=
10597         SYSTEM_BLUEZ=
10598     fi
10599 else
10600     ENABLE_SDREMOTE=
10601     SYSTEM_BLUEZ=
10602     AC_MSG_RESULT([no])
10604 AC_SUBST(ENABLE_SDREMOTE)
10605 AC_SUBST(ENABLE_SDREMOTE_BLUETOOTH)
10606 AC_SUBST(SYSTEM_BLUEZ)
10608 dnl ===================================================================
10609 dnl Check whether the gtk 2.0 libraries are available.
10610 dnl ===================================================================
10612 GTK_CFLAGS=""
10613 GTK_LIBS=""
10614 if test  "$test_gtk" = "yes"; then
10616     if test "$ENABLE_GTK" = "TRUE"; then
10617         PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.18.0 ,,AC_MSG_ERROR([requirements to build the gtk-plugin not met (gtk+-2.0 >= 2.18.0). Use --disable-gtk or install the missing packages]))
10618         PKG_CHECK_MODULES(GTK, gdk-pixbuf-2.0 >= 2.2 ,,AC_MSG_ERROR([requirements to build the gtk-plugin not met (gdk-pixbuf-2.0 >= 2.2). Use --disable-gtk or install the missing packages]))
10619         GTK_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10620         FilterLibs "${GTK_LIBS}"
10621         GTK_LIBS="${filteredlibs}"
10622         PKG_CHECK_MODULES(GTHREAD, gthread-2.0,,AC_MSG_ERROR([requirements to build the gtk-plugin not met (gthread-2.0). Use --disable-gtk or install the missing packages]))
10623         BUILD_TYPE="$BUILD_TYPE GTK"
10624         GTHREAD_CFLAGS=$(printf '%s' "$GTK_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10625         FilterLibs "${GTHREAD_LIBS}"
10626         GTHREAD_LIBS="${filteredlibs}"
10628         AC_MSG_CHECKING([whether to enable Gtk print dialog support])
10629         PKG_CHECK_MODULES([GTK_PRINT], [gtk+-unix-print-2.0 >= 2.10.0],
10630                           [ENABLE_GTK_PRINT="TRUE"],
10631                           [ENABLE_GTK_PRINT=""])
10632         GTK_PRINT_CFLAGS=$(printf '%s' "$GTK_PRINT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10633         FilterLibs "${GTK_PRINT_LIBS}"
10634         GTK_PRINT_LIBS="${filteredlibs}"
10635     fi
10637     if test "$ENABLE_GTK" = "TRUE" || test "$ENABLE_GTK3" = "TRUE"; then
10638         AC_MSG_CHECKING([whether to enable GIO support])
10639         if test "$_os" != "WINNT" -a "$_os" != "Darwin" -a "$enable_gio" = "yes"; then
10640             dnl Need at least 2.26 for the dbus support.
10641             PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.26],
10642                               [ENABLE_GIO="TRUE"], [ENABLE_GIO=""])
10643             if test "$ENABLE_GIO" = "TRUE"; then
10644                 AC_DEFINE(ENABLE_GIO)
10645                 GIO_CFLAGS=$(printf '%s' "$GIO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10646                 FilterLibs "${GIO_LIBS}"
10647                 GIO_LIBS="${filteredlibs}"
10648             fi
10649         else
10650             AC_MSG_RESULT([no])
10651         fi
10652     fi
10654 AC_SUBST(ENABLE_GIO)
10655 AC_SUBST(GIO_CFLAGS)
10656 AC_SUBST(GIO_LIBS)
10657 AC_SUBST(GTK_CFLAGS)
10658 AC_SUBST(GTK_LIBS)
10659 AC_SUBST(GTHREAD_CFLAGS)
10660 AC_SUBST(GTHREAD_LIBS)
10661 AC_SUBST([ENABLE_GTK_PRINT])
10662 AC_SUBST([GTK_PRINT_CFLAGS])
10663 AC_SUBST([GTK_PRINT_LIBS])
10666 dnl ===================================================================
10668 SPLIT_APP_MODULES=""
10669 if test "$enable_split_app_modules" = "yes"; then
10670     SPLIT_APP_MODULES="TRUE"
10672 AC_SUBST(SPLIT_APP_MODULES)
10674 SPLIT_OPT_FEATURES=""
10675 if test "$enable_split_opt_features" = "yes"; then
10676     SPLIT_OPT_FEATURES="TRUE"
10678 AC_SUBST(SPLIT_OPT_FEATURES)
10680 if test $_os = Darwin -o $_os = WINNT -o $_os = iOS; then
10681     if test "$enable_cairo_canvas" = yes; then
10682         AC_MSG_ERROR([The cairo canvas should not be used for this platform])
10683     fi
10684     enable_cairo_canvas=no
10685 elif test -z "$enable_cairo_canvas"; then
10686     enable_cairo_canvas=yes
10689 ENABLE_CAIRO_CANVAS=""
10690 if test "$enable_cairo_canvas" = "yes"; then
10691     test_cairo=yes
10692     ENABLE_CAIRO_CANVAS="TRUE"
10693     AC_DEFINE(ENABLE_CAIRO_CANVAS)
10695 AC_SUBST(ENABLE_CAIRO_CANVAS)
10697 dnl ===================================================================
10698 dnl Check whether the GStreamer libraries are available.
10699 dnl ===================================================================
10701 ENABLE_GSTREAMER_1_0=""
10703 if test "$build_gstreamer_1_0" = "yes"; then
10705     AC_MSG_CHECKING([whether to enable the GStreamer 1.0 avmedia backend])
10706     if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then
10707         ENABLE_GSTREAMER_1_0="TRUE"
10708         AC_MSG_RESULT([yes])
10709         PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] )
10710         GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10711         FilterLibs "${GSTREAMER_1_0_LIBS}"
10712         GSTREAMER_1_0_LIBS="${filteredlibs}"
10713         AC_DEFINE(ENABLE_GSTREAMER_1_0)
10714     else
10715         AC_MSG_RESULT([no])
10716     fi
10718 AC_SUBST(GSTREAMER_1_0_CFLAGS)
10719 AC_SUBST(GSTREAMER_1_0_LIBS)
10720 AC_SUBST(ENABLE_GSTREAMER_1_0)
10722 dnl ===================================================================
10723 dnl Check whether to build the VLC avmedia backend
10724 dnl ===================================================================
10726 ENABLE_VLC=""
10728 AC_MSG_CHECKING([whether to enable the VLC avmedia backend])
10729 if test "$enable_avmedia" = yes -a $_os != iOS -a $_os != Android -a "$enable_vlc" = yes; then
10730     ENABLE_VLC="TRUE"
10731     AC_MSG_RESULT([yes])
10732 else
10733     AC_MSG_RESULT([no])
10735 AC_SUBST(ENABLE_VLC)
10737 ENABLE_OPENGL_TRANSITIONS=
10738 ENABLE_OPENGL_CANVAS=
10739 if test $_os = iOS -o $_os = Android -o "$ENABLE_FUZZERS" = "TRUE"; then
10740    : # disable
10741 elif test "$_os" = "Darwin"; then
10742     # We use frameworks on macOS, no need for detail checks
10743     ENABLE_OPENGL_TRANSITIONS=TRUE
10744     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10745     ENABLE_OPENGL_CANVAS=TRUE
10746 elif test $_os = WINNT; then
10747     ENABLE_OPENGL_TRANSITIONS=TRUE
10748     AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10749     ENABLE_OPENGL_CANVAS=TRUE
10750 else
10751     if test "$USING_X11" = TRUE; then
10752         AC_CHECK_LIB(GL, glBegin, [:], AC_MSG_ERROR([libGL required.]))
10753         ENABLE_OPENGL_TRANSITIONS=TRUE
10754         AC_DEFINE(HAVE_FEATURE_OPENGL,1)
10755         ENABLE_OPENGL_CANVAS=TRUE
10756     fi
10759 AC_SUBST(ENABLE_OPENGL_TRANSITIONS)
10760 AC_SUBST(ENABLE_OPENGL_CANVAS)
10762 dnl =================================================
10763 dnl Check whether to build with OpenCL support.
10764 dnl =================================================
10766 if test $_os != iOS -a $_os != Android -a "$ENABLE_FUZZERS" != "TRUE"; then
10767     # OPENCL in BUILD_TYPE and HAVE_FEATURE_OPENCL tell that OpenCL is potentially available on the
10768     # platform (optional at run-time, used through clew).
10769     BUILD_TYPE="$BUILD_TYPE OPENCL"
10770     AC_DEFINE(HAVE_FEATURE_OPENCL)
10773 dnl =================================================
10774 dnl Check whether to build with dconf support.
10775 dnl =================================================
10777 if test $_os != Android -a $_os != iOS -a "$enable_dconf" != no; then
10778     PKG_CHECK_MODULES([DCONF], [dconf >= 0.15.2], [], [
10779         if test "$enable_dconf" = yes; then
10780             AC_MSG_ERROR([dconf not found])
10781         else
10782             enable_dconf=no
10783         fi])
10785 AC_MSG_CHECKING([whether to enable dconf])
10786 if test $_os = Android -o $_os = iOS -o "$enable_dconf" = no; then
10787     DCONF_CFLAGS=
10788     DCONF_LIBS=
10789     ENABLE_DCONF=
10790     AC_MSG_RESULT([no])
10791 else
10792     ENABLE_DCONF=TRUE
10793     AC_DEFINE(ENABLE_DCONF)
10794     AC_MSG_RESULT([yes])
10796 AC_SUBST([DCONF_CFLAGS])
10797 AC_SUBST([DCONF_LIBS])
10798 AC_SUBST([ENABLE_DCONF])
10800 # pdf import?
10801 AC_MSG_CHECKING([whether to build the PDF import feature])
10802 ENABLE_PDFIMPORT=
10803 if test $_os != Android -a $_os != iOS -a \( -z "$enable_pdfimport" -o "$enable_pdfimport" = yes \); then
10804     AC_MSG_RESULT([yes])
10805     ENABLE_PDFIMPORT=TRUE
10806     AC_DEFINE(HAVE_FEATURE_PDFIMPORT)
10807 else
10808     AC_MSG_RESULT([no])
10811 # Pdfium?
10812 AC_MSG_CHECKING([whether to build PDFium])
10813 ENABLE_PDFIUM=
10814 if test \( -z "$enable_pdfium" -a "$ENABLE_PDFIMPORT" == "TRUE" \) -o "$enable_pdfium" = yes; then
10815     AC_MSG_RESULT([yes])
10816     ENABLE_PDFIUM=TRUE
10817     AC_DEFINE(HAVE_FEATURE_PDFIUM)
10818     BUILD_TYPE="$BUILD_TYPE PDFIUM"
10819 else
10820     AC_MSG_RESULT([no])
10822 AC_SUBST(ENABLE_PDFIUM)
10824 dnl ===================================================================
10825 dnl Check for poppler
10826 dnl ===================================================================
10827 ENABLE_POPPLER=
10828 AC_MSG_CHECKING([whether to build Poppler])
10829 if test \( -z "$enable_poppler" -a "$ENABLE_PDFIMPORT" == "TRUE" \) -o "$enable_poppler" = yes; then
10830     AC_MSG_RESULT([yes])
10831     ENABLE_POPPLER=TRUE
10832     AC_DEFINE(HAVE_FEATURE_POPPLER)
10833 else
10834     AC_MSG_RESULT([no])
10836 AC_SUBST(ENABLE_POPPLER)
10838 if test "$ENABLE_PDFIMPORT" == "TRUE" -a "$ENABLE_POPPLER" != "TRUE" -a "$ENABLE_PDFIUM" != "TRUE"; then
10839     AC_MSG_ERROR([Cannot import PDF without either Pdfium or Poppler; please enable either of them.])
10842 if test "$ENABLE_PDFIMPORT" != "TRUE" -a \( "$ENABLE_POPPLER" == "TRUE" -o "$ENABLE_PDFIUM" == "TRUE" \); then
10843     AC_MSG_ERROR([Cannot enable Pdfium or Poppler when PDF importing is disabled; please enable PDF import first.])
10846 if test "$ENABLE_PDFIMPORT" == "TRUE" -a "$ENABLE_POPPLER" == "TRUE"; then
10847     dnl ===================================================================
10848     dnl Check for system poppler
10849     dnl ===================================================================
10850     AC_MSG_CHECKING([which PDF import poppler to use])
10851     if test "$with_system_poppler" = "yes"; then
10852         AC_MSG_RESULT([external])
10853         SYSTEM_POPPLER=TRUE
10854         PKG_CHECK_MODULES( POPPLER, poppler >= 0.12.0 )
10855         AC_LANG_PUSH([C++])
10856         save_CXXFLAGS=$CXXFLAGS
10857         save_CPPFLAGS=$CPPFLAGS
10858         CXXFLAGS="$CXXFLAGS $POPPLER_CFLAGS"
10859         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
10860         AC_CHECK_HEADER([cpp/poppler-version.h],
10861             [AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)],
10862             [])
10863         CXXFLAGS=$save_CXXFLAGS
10864         CPPFLAGS=$save_CPPFLAGS
10865         AC_LANG_POP([C++])
10866         POPPLER_CFLAGS=$(printf '%s' "$POPPLER_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
10868         FilterLibs "${POPPLER_LIBS}"
10869         POPPLER_LIBS="${filteredlibs}"
10870     else
10871         AC_MSG_RESULT([internal])
10872         SYSTEM_POPPLER=
10873         BUILD_TYPE="$BUILD_TYPE POPPLER"
10874         AC_DEFINE([HAVE_POPPLER_VERSION_H], 1)
10875     fi
10876     AC_DEFINE([ENABLE_PDFIMPORT],1)
10878 AC_SUBST(ENABLE_PDFIMPORT)
10879 AC_SUBST(SYSTEM_POPPLER)
10880 AC_SUBST(POPPLER_CFLAGS)
10881 AC_SUBST(POPPLER_LIBS)
10883 SYSTEM_GPGMEPP=
10885 if test "$build_for_ios" = "YES"; then
10886     AC_MSG_CHECKING([whether gpgmepp should be disabled due to iOS])
10887     AC_MSG_RESULT([yes])
10888 elif test "$enable_mpl_subset" = "yes"; then
10889     AC_MSG_CHECKING([whether gpgmepp should be disabled due to building just MPL])
10890     AC_MSG_RESULT([yes])
10891 elif test "$enable_fuzzers" = "yes"; then
10892     AC_MSG_CHECKING([whether gpgmepp should be disabled due to oss-fuzz])
10893     AC_MSG_RESULT([yes])
10894 elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
10895     dnl ===================================================================
10896     dnl Check for system gpgme
10897     dnl ===================================================================
10898     AC_MSG_CHECKING([which gpgmepp to use])
10899     if test "$with_system_gpgmepp" = "yes"; then
10900         AC_MSG_RESULT([external])
10901         SYSTEM_GPGMEPP=TRUE
10903         # C++ library doesn't come with fancy gpgmepp-config, check for headers the old-fashioned way
10904         AC_CHECK_HEADER(gpgme++/gpgmepp_version.h, [ GPGMEPP_CFLAGS=-I/usr/include/gpgme++ ],
10905             [AC_MSG_ERROR([gpgmepp headers not found, install gpgmepp development package])], [])
10906         # progress_callback is the only func with plain C linkage
10907         # checking for it also filters out older, KDE-dependent libgpgmepp versions
10908         AC_CHECK_LIB(gpgmepp, progress_callback, [ GPGMEPP_LIBS=-lgpgmepp ],
10909             [AC_MSG_ERROR(gpgmepp not found or not functional)], [])
10910         AC_CHECK_HEADER(gpgme.h, [],
10911             [AC_MSG_ERROR([gpgme headers not found, install gpgme development package])], [])
10912     else
10913         AC_MSG_RESULT([internal])
10914         BUILD_TYPE="$BUILD_TYPE LIBGPGERROR LIBASSUAN GPGMEPP"
10915         AC_DEFINE([GPGME_CAN_EXPORT_MINIMAL_KEY])
10917         GPG_ERROR_CFLAGS="-I${WORKDIR}/UnpackedTarball/libgpg-error/src"
10918         LIBASSUAN_CFLAGS="-I${WORKDIR}/UnpackedTarball/libassuan/src"
10919         if test "$_os" != "WINNT"; then
10920             GPG_ERROR_LIBS="-L${WORKDIR}/UnpackedTarball/libgpg-error/src/.libs -lgpg-error"
10921             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
10922         elif test "$host_cpu" = "i686" -a "$WINDOWS_SDK_ARCH" = "x64"; then
10923             AC_MSG_ERROR(gpgme cannot be built on cygwin32 for Win64.)
10924         fi
10925     fi
10926     ENABLE_GPGMEPP=TRUE
10927     AC_DEFINE([HAVE_FEATURE_GPGME])
10928     AC_PATH_PROG(GPG, gpg)
10929     # TODO: Windows's cygwin gpg does not seem to work with our gpgme,
10930     # so let's exclude that manually for the moment
10931     if test -n "$GPG" -a "$_os" != "WINNT"; then
10932         # make sure we not only have a working gpgme, but a full working
10933         # gpg installation to run OpenPGP signature verification
10934         AC_DEFINE([HAVE_FEATURE_GPGVERIFY])
10935     fi
10936     if test "$_os" = "Linux"; then
10937       uid=`id -u`
10938       AC_MSG_CHECKING([for /run/user/$uid])
10939       if test -d /run/user/$uid; then
10940         AC_MSG_RESULT([yes])
10941         AC_PATH_PROG(GPGCONF, gpgconf)
10943         # Older versions of gpgconf are not working as expected, since
10944         # `gpgconf --remove-socketdir` fails to exit any gpg-agent daemon operating
10945         # on that socket dir that has (indirectly) been started by the tests in xmlsecurity/qa/unit/signing/signing.cxx
10946         # (see commit message of f0305ec0a7d199e605511844d9d6af98b66d4bfd%5E )
10947         AC_MSG_CHECKING([whether version of gpgconf is suitable ... ])
10948         GPGCONF_VERSION=`"$GPGCONF" --version | "$AWK" '/^gpgconf \(GnuPG\)/{print $3}'`
10949         GPGCONF_NUMVER=`echo $GPGCONF_VERSION | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
10950         if test "$GPGCONF_VERSION" = "2.2_OOo" -o "$GPGCONF_NUMVER" -ge "020200"; then
10951           AC_MSG_RESULT([yes, $GPGCONF_VERSION])
10952           AC_MSG_CHECKING([for gpgconf --create-socketdir... ])
10953           if $GPGCONF --dump-options > /dev/null ; then
10954             if $GPGCONF --dump-options | grep -q create-socketdir ; then
10955               AC_MSG_RESULT([yes])
10956               AC_DEFINE([HAVE_GPGCONF_SOCKETDIR])
10957               AC_DEFINE_UNQUOTED([GPGME_GPGCONF], ["$GPGCONF"])
10958             else
10959               AC_MSG_RESULT([no])
10960             fi
10961           else
10962             AC_MSG_RESULT([no. missing or broken gpgconf?])
10963           fi
10964         else
10965           AC_MSG_RESULT([no, $GPGCONF_VERSION])
10966         fi
10967       else
10968         AC_MSG_RESULT([no])
10969      fi
10970    fi
10972 AC_SUBST(ENABLE_GPGMEPP)
10973 AC_SUBST(SYSTEM_GPGMEPP)
10974 AC_SUBST(GPG_ERROR_CFLAGS)
10975 AC_SUBST(GPG_ERROR_LIBS)
10976 AC_SUBST(LIBASSUAN_CFLAGS)
10977 AC_SUBST(LIBASSUAN_LIBS)
10978 AC_SUBST(GPGMEPP_CFLAGS)
10979 AC_SUBST(GPGMEPP_LIBS)
10981 AC_MSG_CHECKING([whether to build the Wiki Publisher extension])
10982 if test "x$enable_ext_wiki_publisher" = "xyes" -a "x$enable_extension_integration" != "xno" -a "$with_java" != "no"; then
10983     AC_MSG_RESULT([yes])
10984     ENABLE_MEDIAWIKI=TRUE
10985     BUILD_TYPE="$BUILD_TYPE XSLTML"
10986     if test  "x$with_java" = "xno"; then
10987         AC_MSG_ERROR([Wiki Publisher requires Java! Enable Java if you want to build it.])
10988     fi
10989 else
10990     AC_MSG_RESULT([no])
10991     ENABLE_MEDIAWIKI=
10992     SCPDEFS="$SCPDEFS -DWITHOUT_EXTENSION_MEDIAWIKI"
10994 AC_SUBST(ENABLE_MEDIAWIKI)
10996 AC_MSG_CHECKING([whether to build the Report Builder])
10997 if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
10998     AC_MSG_RESULT([yes])
10999     ENABLE_REPORTBUILDER=TRUE
11000     AC_MSG_CHECKING([which jfreereport libs to use])
11001     if test "$with_system_jfreereport" = "yes"; then
11002         SYSTEM_JFREEREPORT=TRUE
11003         AC_MSG_RESULT([external])
11004         if test -z $SAC_JAR; then
11005             SAC_JAR=/usr/share/java/sac.jar
11006         fi
11007         if ! test -f $SAC_JAR; then
11008              AC_MSG_ERROR(sac.jar not found.)
11009         fi
11011         if test -z $LIBXML_JAR; then
11012             if test -f /usr/share/java/libxml-1.0.0.jar; then
11013                 LIBXML_JAR=/usr/share/java/libxml-1.0.0.jar
11014             elif test -f /usr/share/java/libxml.jar; then
11015                 LIBXML_JAR=/usr/share/java/libxml.jar
11016             else
11017                 AC_MSG_ERROR(libxml.jar replacement not found.)
11018             fi
11019         elif ! test -f $LIBXML_JAR; then
11020             AC_MSG_ERROR(libxml.jar not found.)
11021         fi
11023         if test -z $FLUTE_JAR; then
11024             if test -f/usr/share/java/flute-1.3.0.jar; then
11025                 FLUTE_JAR=/usr/share/java/flute-1.3.0.jar
11026             elif test -f /usr/share/java/flute.jar; then
11027                 FLUTE_JAR=/usr/share/java/flute.jar
11028             else
11029                 AC_MSG_ERROR(flute-1.3.0.jar replacement not found.)
11030             fi
11031         elif ! test -f $FLUTE_JAR; then
11032             AC_MSG_ERROR(flute-1.3.0.jar not found.)
11033         fi
11035         if test -z $JFREEREPORT_JAR; then
11036             if test -f /usr/share/java/flow-engine-0.9.2.jar; then
11037                 JFREEREPORT_JAR=/usr/share/java/flow-engine-0.9.2.jar
11038             elif test -f /usr/share/java/flow-engine.jar; then
11039                 JFREEREPORT_JAR=/usr/share/java/flow-engine.jar
11040             else
11041                 AC_MSG_ERROR(jfreereport.jar replacement not found.)
11042             fi
11043         elif ! test -f  $JFREEREPORT_JAR; then
11044                 AC_MSG_ERROR(jfreereport.jar not found.)
11045         fi
11047         if test -z $LIBLAYOUT_JAR; then
11048             if test -f /usr/share/java/liblayout-0.2.9.jar; then
11049                 LIBLAYOUT_JAR=/usr/share/java/liblayout-0.2.9.jar
11050             elif test -f /usr/share/java/liblayout.jar; then
11051                 LIBLAYOUT_JAR=/usr/share/java/liblayout.jar
11052             else
11053                 AC_MSG_ERROR(liblayout.jar replacement not found.)
11054             fi
11055         elif ! test -f $LIBLAYOUT_JAR; then
11056                 AC_MSG_ERROR(liblayout.jar not found.)
11057         fi
11059         if test -z $LIBLOADER_JAR; then
11060             if test -f /usr/share/java/libloader-1.0.0.jar; then
11061                 LIBLOADER_JAR=/usr/share/java/libloader-1.0.0.jar
11062             elif test -f /usr/share/java/libloader.jar; then
11063                 LIBLOADER_JAR=/usr/share/java/libloader.jar
11064             else
11065                 AC_MSG_ERROR(libloader.jar replacement not found.)
11066             fi
11067         elif ! test -f  $LIBLOADER_JAR; then
11068             AC_MSG_ERROR(libloader.jar not found.)
11069         fi
11071         if test -z $LIBFORMULA_JAR; then
11072             if test -f /usr/share/java/libformula-0.2.0.jar; then
11073                 LIBFORMULA_JAR=/usr/share/java/libformula-0.2.0.jar
11074             elif test -f /usr/share/java/libformula.jar; then
11075                 LIBFORMULA_JAR=/usr/share/java/libformula.jar
11076             else
11077                 AC_MSG_ERROR(libformula.jar replacement not found.)
11078             fi
11079         elif ! test -f $LIBFORMULA_JAR; then
11080                 AC_MSG_ERROR(libformula.jar not found.)
11081         fi
11083         if test -z $LIBREPOSITORY_JAR; then
11084             if test -f /usr/share/java/librepository-1.0.0.jar; then
11085                 LIBREPOSITORY_JAR=/usr/share/java/librepository-1.0.0.jar
11086             elif test -f /usr/share/java/librepository.jar; then
11087                 LIBREPOSITORY_JAR=/usr/share/java/librepository.jar
11088             else
11089                 AC_MSG_ERROR(librepository.jar replacement not found.)
11090             fi
11091         elif ! test -f $LIBREPOSITORY_JAR; then
11092             AC_MSG_ERROR(librepository.jar not found.)
11093         fi
11095         if test -z $LIBFONTS_JAR; then
11096             if test -f /usr/share/java/libfonts-1.0.0.jar; then
11097                 LIBFONTS_JAR=/usr/share/java/libfonts-1.0.0.jar
11098             elif test -f /usr/share/java/libfonts.jar; then
11099                 LIBFONTS_JAR=/usr/share/java/libfonts.jar
11100             else
11101                 AC_MSG_ERROR(libfonts.jar replacement not found.)
11102             fi
11103         elif ! test -f $LIBFONTS_JAR; then
11104                 AC_MSG_ERROR(libfonts.jar not found.)
11105         fi
11107         if test -z $LIBSERIALIZER_JAR; then
11108             if test -f /usr/share/java/libserializer-1.0.0.jar; then
11109                 LIBSERIALIZER_JAR=/usr/share/java/libserializer-1.0.0.jar
11110             elif test -f /usr/share/java/libserializer.jar; then
11111                 LIBSERIALIZER_JAR=/usr/share/java/libserializer.jar
11112             else
11113                 AC_MSG_ERROR(libserializer.jar replacement not found.)
11114             fi
11115         elif ! test -f $LIBSERIALIZER_JAR; then
11116                 AC_MSG_ERROR(libserializer.jar not found.)
11117         fi
11119         if test -z $LIBBASE_JAR; then
11120             if test -f /usr/share/java/libbase-1.0.0.jar; then
11121                 LIBBASE_JAR=/usr/share/java/libbase-1.0.0.jar
11122             elif test -f /usr/share/java/libbase.jar; then
11123                 LIBBASE_JAR=/usr/share/java/libbase.jar
11124             else
11125                 AC_MSG_ERROR(libbase.jar replacement not found.)
11126             fi
11127         elif ! test -f $LIBBASE_JAR; then
11128             AC_MSG_ERROR(libbase.jar not found.)
11129         fi
11131     else
11132         AC_MSG_RESULT([internal])
11133         SYSTEM_JFREEREPORT=
11134         BUILD_TYPE="$BUILD_TYPE JFREEREPORT"
11135         NEED_ANT=TRUE
11136     fi
11137 else
11138     AC_MSG_RESULT([no])
11139     ENABLE_REPORTBUILDER=
11140     SYSTEM_JFREEREPORT=
11142 AC_SUBST(ENABLE_REPORTBUILDER)
11143 AC_SUBST(SYSTEM_JFREEREPORT)
11144 AC_SUBST(SAC_JAR)
11145 AC_SUBST(LIBXML_JAR)
11146 AC_SUBST(FLUTE_JAR)
11147 AC_SUBST(JFREEREPORT_JAR)
11148 AC_SUBST(LIBBASE_JAR)
11149 AC_SUBST(LIBLAYOUT_JAR)
11150 AC_SUBST(LIBLOADER_JAR)
11151 AC_SUBST(LIBFORMULA_JAR)
11152 AC_SUBST(LIBREPOSITORY_JAR)
11153 AC_SUBST(LIBFONTS_JAR)
11154 AC_SUBST(LIBSERIALIZER_JAR)
11156 # this has to be here because both the Wiki Publisher and the SRB use
11157 # commons-logging
11158 COMMONS_LOGGING_VERSION=1.2
11159 if test "$ENABLE_REPORTBUILDER" = "TRUE"; then
11160     AC_MSG_CHECKING([which Apache commons-* libs to use])
11161     if test "$with_system_apache_commons" = "yes"; then
11162         SYSTEM_APACHE_COMMONS=TRUE
11163         AC_MSG_RESULT([external])
11164         if test -z $COMMONS_LOGGING_JAR; then
11165             if test -f /usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar; then
11166                COMMONS_LOGGING_JAR=/usr/share/java/commons-logging-${COMMONS_LOGGING_VERSION}.jar
11167            elif test -f /usr/share/java/commons-logging.jar; then
11168                 COMMONS_LOGGING_JAR=/usr/share/java/commons-logging.jar
11169             else
11170                 AC_MSG_ERROR(commons-logging.jar replacement not found.)
11171             fi
11172         elif ! test -f $COMMONS_LOGGING_JAR; then
11173             AC_MSG_ERROR(commons-logging.jar not found.)
11174         fi
11175     else
11176         AC_MSG_RESULT([internal])
11177         SYSTEM_APACHE_COMMONS=
11178         BUILD_TYPE="$BUILD_TYPE APACHE_COMMONS"
11179         NEED_ANT=TRUE
11180     fi
11182 AC_SUBST(SYSTEM_APACHE_COMMONS)
11183 AC_SUBST(COMMONS_LOGGING_JAR)
11184 AC_SUBST(COMMONS_LOGGING_VERSION)
11186 # scripting provider for BeanShell?
11187 AC_MSG_CHECKING([whether to build support for scripts in BeanShell])
11188 if test "${enable_scripting_beanshell}" != "no" -a "x$with_java" != "xno"; then
11189     AC_MSG_RESULT([yes])
11190     ENABLE_SCRIPTING_BEANSHELL=TRUE
11192     dnl ===================================================================
11193     dnl Check for system beanshell
11194     dnl ===================================================================
11195     AC_MSG_CHECKING([which beanshell to use])
11196     if test "$with_system_beanshell" = "yes"; then
11197         AC_MSG_RESULT([external])
11198         SYSTEM_BSH=TRUE
11199         if test -z $BSH_JAR; then
11200             BSH_JAR=/usr/share/java/bsh.jar
11201         fi
11202         if ! test -f $BSH_JAR; then
11203             AC_MSG_ERROR(bsh.jar not found.)
11204         fi
11205     else
11206         AC_MSG_RESULT([internal])
11207         SYSTEM_BSH=
11208         BUILD_TYPE="$BUILD_TYPE BSH"
11209     fi
11210 else
11211     AC_MSG_RESULT([no])
11212     ENABLE_SCRIPTING_BEANSHELL=
11213     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_BEANSHELL"
11215 AC_SUBST(ENABLE_SCRIPTING_BEANSHELL)
11216 AC_SUBST(SYSTEM_BSH)
11217 AC_SUBST(BSH_JAR)
11219 # scripting provider for JavaScript?
11220 AC_MSG_CHECKING([whether to build support for scripts in JavaScript])
11221 if test "${enable_scripting_javascript}" != "no" -a "x$with_java" != "xno"; then
11222     AC_MSG_RESULT([yes])
11223     ENABLE_SCRIPTING_JAVASCRIPT=TRUE
11225     dnl ===================================================================
11226     dnl Check for system rhino
11227     dnl ===================================================================
11228     AC_MSG_CHECKING([which rhino to use])
11229     if test "$with_system_rhino" = "yes"; then
11230         AC_MSG_RESULT([external])
11231         SYSTEM_RHINO=TRUE
11232         if test -z $RHINO_JAR; then
11233             RHINO_JAR=/usr/share/java/js.jar
11234         fi
11235         if ! test -f $RHINO_JAR; then
11236             AC_MSG_ERROR(js.jar not found.)
11237         fi
11238     else
11239         AC_MSG_RESULT([internal])
11240         SYSTEM_RHINO=
11241         BUILD_TYPE="$BUILD_TYPE RHINO"
11242         NEED_ANT=TRUE
11243     fi
11244 else
11245     AC_MSG_RESULT([no])
11246     ENABLE_SCRIPTING_JAVASCRIPT=
11247     SCPDEFS="$SCPDEFS -DWITHOUT_SCRIPTING_JAVASCRIPT"
11249 AC_SUBST(ENABLE_SCRIPTING_JAVASCRIPT)
11250 AC_SUBST(SYSTEM_RHINO)
11251 AC_SUBST(RHINO_JAR)
11253 # This is only used in Qt5/KF5 checks to determine if /usr/lib64
11254 # paths should be added to library search path. So lets put all 64-bit
11255 # platforms there.
11256 supports_multilib=
11257 case "$host_cpu" in
11258 x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el)
11259     if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
11260         supports_multilib="yes"
11261     fi
11262     ;;
11264     ;;
11265 esac
11267 dnl ===================================================================
11268 dnl QT5 Integration
11269 dnl ===================================================================
11271 QT5_CFLAGS=""
11272 QT5_LIBS=""
11273 QMAKE5="qmake"
11274 MOC5="moc"
11275 QT5_GOBJECT_CFLAGS=""
11276 QT5_GOBJECT_LIBS=""
11277 QT5_HAVE_GOBJECT=""
11278 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11279         \( "$test_qt5" = "yes" -a "$ENABLE_QT5" = "TRUE" \) -o \
11280         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11281 then
11282     qt5_incdirs="$QT5INC /usr/include/qt5 /usr/include $x_includes"
11283     qt5_libdirs="$QT5LIB /usr/lib/qt5 /usr/lib $x_libraries"
11285     if test -n "$supports_multilib"; then
11286         qt5_libdirs="$qt5_libdirs /usr/lib64/qt5 /usr/lib64/qt /usr/lib64"
11287     fi
11289     qt5_test_include="QtWidgets/qapplication.h"
11290     qt5_test_library="libQt5Widgets.so"
11292     dnl Check for qmake5
11293     AC_PATH_PROGS( QMAKE5, [qmake-qt5 qmake], no, [$QT5DIR/bin:$PATH] )
11294     if test "$QMAKE5" = "no"; then
11295         AC_MSG_ERROR([Qmake not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11296     else
11297         qmake5_test_ver="`$QMAKE5 -v 2>&1 | $SED -n -e 's/^Using Qt version \(5\.[[0-9.]]\+\).*$/\1/p'`"
11298         if test -z "$qmake5_test_ver"; then
11299             AC_MSG_ERROR([Wrong qmake for Qt5 found. Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11300         fi
11301         qmake5_minor_version="`echo $qmake5_test_ver | cut -d. -f2`"
11302         qt5_minimal_minor="6"
11303         if test "$qmake5_minor_version" -lt "$qt5_minimal_minor"; then
11304             AC_MSG_ERROR([The minimal supported Qt5 version is 5.${qt5_minimal_minor}, but your 'qmake -v' reports Qt5 version $qmake5_test_ver.])
11305         else
11306             AC_MSG_NOTICE([Detected Qt5 version: $qmake5_test_ver])
11307         fi
11308     fi
11310     qt5_incdirs="`$QMAKE5 -query QT_INSTALL_HEADERS` $qt5_incdirs"
11311     qt5_libdirs="`$QMAKE5 -query QT_INSTALL_LIBS` $qt5_libdirs"
11313     AC_MSG_CHECKING([for Qt5 headers])
11314     qt5_incdir="no"
11315     for inc_dir in $qt5_incdirs; do
11316         if test -r "$inc_dir/$qt5_test_include"; then
11317             qt5_incdir="$inc_dir"
11318             break
11319         fi
11320     done
11321     AC_MSG_RESULT([$qt5_incdir])
11322     if test "x$qt5_incdir" = "xno"; then
11323         AC_MSG_ERROR([Qt5 headers not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11324     fi
11326     AC_MSG_CHECKING([for Qt5 libraries])
11327     qt5_libdir="no"
11328     for lib_dir in $qt5_libdirs; do
11329         if test -r "$lib_dir/$qt5_test_library"; then
11330             qt5_libdir="$lib_dir"
11331             break
11332         fi
11333     done
11334     AC_MSG_RESULT([$qt5_libdir])
11335     if test "x$qt5_libdir" = "xno"; then
11336         AC_MSG_ERROR([Qt5 libraries not found.  Please specify the root of your Qt5 installation by exporting QT5DIR before running "configure".])
11337     fi
11339     QT5_CFLAGS="-I$qt5_incdir -DQT_CLEAN_NAMESPACE -DQT_THREAD_SUPPORT -DQT_NO_VERSION_TAGGING"
11340     QT5_CFLAGS=$(printf '%s' "$QT5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11341     QT5_LIBS="-L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11343     if test "$USING_X11" = TRUE; then
11344         PKG_CHECK_MODULES(QT5_XCB,[xcb],,[AC_MSG_ERROR([XCB not found, which is needed for correct app grouping in X11.])])
11345         QT5_CFLAGS="$QT5_CFLAGS $QT5_XCB_CFLAGS"
11346         QT5_LIBS="$QT5_LIBS $QT5_XCB_LIBS -lQt5X11Extras"
11347         QT5_USING_X11=1
11348         AC_DEFINE(QT5_USING_X11)
11349     fi
11351     dnl Check for Meta Object Compiler
11353     AC_PATH_PROGS( MOC5, [moc-qt5 moc], no, [`dirname $qt5_libdir`/bin:$QT5DIR/bin:$PATH] )
11354     if test "$MOC5" = "no"; then
11355         AC_MSG_ERROR([Qt Meta Object Compiler not found.  Please specify
11356 the root of your Qt installation by exporting QT5DIR before running "configure".])
11357     fi
11359     if test "$build_gstreamer_1_0" = "yes"; then
11360         PKG_CHECK_MODULES(QT5_GOBJECT,[gobject-2.0], [
11361                 QT5_HAVE_GOBJECT=1
11362                 AC_DEFINE(QT5_HAVE_GOBJECT)
11363             ],
11364             AC_MSG_WARN([[No GObject found, can't use QWidget GStreamer sink on wayland!]])
11365         )
11366     fi
11368 AC_SUBST(QT5_CFLAGS)
11369 AC_SUBST(QT5_LIBS)
11370 AC_SUBST(MOC5)
11371 AC_SUBST(QT5_GOBJECT_CFLAGS)
11372 AC_SUBST(QT5_GOBJECT_LIBS)
11373 AC_SUBST(QT5_HAVE_GOBJECT)
11375 dnl ===================================================================
11376 dnl KF5 Integration
11377 dnl ===================================================================
11379 KF5_CFLAGS=""
11380 KF5_LIBS=""
11381 KF5_CONFIG="kf5-config"
11382 if test \( "$test_kf5" = "yes" -a "$ENABLE_KF5" = "TRUE" \) -o \
11383         \( "$test_gtk3_kde5" = "yes" -a "$ENABLE_GTK3_KDE5" = "TRUE" \)
11384 then
11385     if test "$OS" = "HAIKU"; then
11386         haiku_arch="`echo $RTL_ARCH | tr X x`"
11387         kf5_haiku_incdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_HEADERS_DIRECTORY`"
11388         kf5_haiku_libdirs="`findpaths -c ' ' -a $haiku_arch B_FIND_PATH_DEVELOP_LIB_DIRECTORY`"
11389     fi
11391     kf5_incdirs="$KF5INC /usr/include $kf5_haiku_incdirs $x_includes"
11392     kf5_libdirs="$KF5LIB /usr/lib /usr/lib/kf5 /usr/lib/kf5/devel $kf5_haiku_libdirs $x_libraries"
11393     if test -n "$supports_multilib"; then
11394         kf5_libdirs="$kf5_libdirs /usr/lib64 /usr/lib64/kf5 /usr/lib64/kf5/devel"
11395     fi
11397     kf5_test_include="KF5/kcoreaddons_version.h"
11398     kf5_test_library="libKF5CoreAddons.so"
11399     kf5_libdirs="$qt5_libdir $kf5_libdirs"
11401     dnl kf5 KDE4 support compatibility installed
11402     AC_PATH_PROG( KF5_CONFIG, $KF5_CONFIG, no, )
11403     if test "$KF5_CONFIG" != "no"; then
11404         kf5_incdirs="`$KF5_CONFIG --path include` $kf5_incdirs"
11405         kf5_libdirs="`$KF5_CONFIG --path lib` $kf5_libdirs"
11406     fi
11408     dnl Check for KF5 headers
11409     AC_MSG_CHECKING([for KF5 headers])
11410     kf5_incdir="no"
11411     for kf5_check in $kf5_incdirs; do
11412         if test -r "$kf5_check/$kf5_test_include"; then
11413             kf5_incdir="$kf5_check/KF5"
11414             break
11415         fi
11416     done
11417     AC_MSG_RESULT([$kf5_incdir])
11418     if test "x$kf5_incdir" = "xno"; then
11419         AC_MSG_ERROR([KF5 headers not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11420     fi
11422     dnl Check for KF5 libraries
11423     AC_MSG_CHECKING([for KF5 libraries])
11424     kf5_libdir="no"
11425     for kf5_check in $kf5_libdirs; do
11426         if test -r "$kf5_check/$kf5_test_library"; then
11427             kf5_libdir="$kf5_check"
11428             break
11429         fi
11430     done
11432     AC_MSG_RESULT([$kf5_libdir])
11433     if test "x$kf5_libdir" = "xno"; then
11434         AC_MSG_ERROR([KF5 libraries not found.  Please specify the root of your KF5 installation by exporting KF5DIR before running "configure".])
11435     fi
11437     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"
11438     KF5_LIBS="-L$kf5_libdir -lKF5CoreAddons -lKF5I18n -lKF5ConfigCore -lKF5WindowSystem -lKF5KIOCore -lKF5KIOWidgets -lKF5KIOFileWidgets -L$qt5_libdir -lQt5Core -lQt5Gui -lQt5Widgets -lQt5Network"
11439     KF5_CFLAGS=$(printf '%s' "$KF5_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11441     if test "$USING_X11" = TRUE; then
11442         KF5_LIBS="$KF5_LIBS -lQt5X11Extras"
11443     fi
11445     AC_LANG_PUSH([C++])
11446     save_CXXFLAGS=$CXXFLAGS
11447     CXXFLAGS="$CXXFLAGS $KF5_CFLAGS"
11448     AC_MSG_CHECKING([whether KDE is >= 5.0])
11449        AC_RUN_IFELSE([AC_LANG_SOURCE([[
11450 #include <kcoreaddons_version.h>
11452 int main(int argc, char **argv) {
11453        if (KCOREADDONS_VERSION_MAJOR == 5 && KCOREADDONS_VERSION_MINOR >= 0) return 0;
11454        else return 1;
11456        ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([KDE version too old])],[])
11457     CXXFLAGS=$save_CXXFLAGS
11458     AC_LANG_POP([C++])
11460 AC_SUBST(KF5_CFLAGS)
11461 AC_SUBST(KF5_LIBS)
11463 dnl ===================================================================
11464 dnl Test whether to include Evolution 2 support
11465 dnl ===================================================================
11466 AC_MSG_CHECKING([whether to enable evolution 2 support])
11467 if test "$enable_evolution2" = "yes" -o "$enable_evolution2" = "TRUE"; then
11468     AC_MSG_RESULT([yes])
11469     PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
11470     GOBJECT_CFLAGS=$(printf '%s' "$GOBJECT_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11471     FilterLibs "${GOBJECT_LIBS}"
11472     GOBJECT_LIBS="${filteredlibs}"
11473     ENABLE_EVOAB2="TRUE"
11474 else
11475     ENABLE_EVOAB2=""
11476     AC_MSG_RESULT([no])
11478 AC_SUBST(ENABLE_EVOAB2)
11479 AC_SUBST(GOBJECT_CFLAGS)
11480 AC_SUBST(GOBJECT_LIBS)
11482 dnl ===================================================================
11483 dnl Test which themes to include
11484 dnl ===================================================================
11485 AC_MSG_CHECKING([which themes to include])
11486 # if none given use default subset of available themes
11487 if test "x$with_theme" = "x" -o "x$with_theme" = "xyes"; then
11488     with_theme="breeze breeze_dark breeze_svg colibre colibre_svg elementary elementary_svg karasa_jaga karasa_jaga_svg sifr sifr_svg sifr_dark tango"
11491 WITH_THEMES=""
11492 if test "x$with_theme" != "xno"; then
11493     for theme in $with_theme; do
11494         case $theme in
11495         breeze|breeze_dark|breeze_svg|colibre|colibre_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg|sifr|sifr_svg|sifr_dark|tango) real_theme="$theme" ;;
11496         default) real_theme=colibre ;;
11497         *) AC_MSG_ERROR([Unknown value for --with-theme: $theme]) ;;
11498         esac
11499         WITH_THEMES=`echo "$WITH_THEMES $real_theme"|tr '\ ' '\n'|sort|uniq|tr '\n' '\ '`
11500     done
11502 AC_MSG_RESULT([$WITH_THEMES])
11503 AC_SUBST([WITH_THEMES])
11504 # FIXME: remove this, and the convenience default->colibre remapping after a grace period
11505 for theme in $with_theme; do
11506     case $theme in
11507     default) AC_MSG_WARN([--with-theme=default is deprecated and will be removed, use --with-theme=colibre]) ;;
11508     *) ;;
11509     esac
11510 done
11512 dnl ===================================================================
11513 dnl Test whether to integrate helppacks into the product's installer
11514 dnl ===================================================================
11515 AC_MSG_CHECKING([for helppack integration])
11516 if test "$with_helppack_integration" = "no"; then
11517     AC_MSG_RESULT([no integration])
11518 else
11519     SCPDEFS="$SCPDEFS -DWITH_HELPPACK_INTEGRATION"
11520     AC_MSG_RESULT([integration])
11523 ###############################################################################
11524 # Extensions checking
11525 ###############################################################################
11526 AC_MSG_CHECKING([for extensions integration])
11527 if test "x$enable_extension_integration" != "xno"; then
11528     WITH_EXTENSION_INTEGRATION=TRUE
11529     SCPDEFS="$SCPDEFS -DWITH_EXTENSION_INTEGRATION"
11530     AC_MSG_RESULT([yes, use integration])
11531 else
11532     WITH_EXTENSION_INTEGRATION=
11533     AC_MSG_RESULT([no, do not integrate])
11535 AC_SUBST(WITH_EXTENSION_INTEGRATION)
11537 dnl Should any extra extensions be included?
11538 dnl There are standalone tests for each of these below.
11539 WITH_EXTRA_EXTENSIONS=
11540 AC_SUBST([WITH_EXTRA_EXTENSIONS])
11542 libo_CHECK_EXTENSION([ConvertTextToNumber],[CT2N],[ct2n],[ct2n],[])
11543 libo_CHECK_EXTENSION([Numbertext],[NUMBERTEXT],[numbertext],[numbertext],[b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt])
11544 if test "x$with_java" != "xno"; then
11545     libo_CHECK_EXTENSION([NLPSolver],[NLPSOLVER],[nlpsolver],[nlpsolver],[])
11546     libo_CHECK_EXTENSION([LanguageTool],[LANGUAGETOOL],[languagetool],[languagetool],[])
11549 AC_MSG_CHECKING([whether to build opens___.ttf])
11550 if test "$enable_build_opensymbol" = "yes"; then
11551     AC_MSG_RESULT([yes])
11552     AC_PATH_PROG(FONTFORGE, fontforge)
11553     if test -z "$FONTFORGE"; then
11554         AC_MSG_ERROR([fontforge not installed])
11555     fi
11556 else
11557     AC_MSG_RESULT([no])
11558     OPENSYMBOL_TTF=884ed41809687c3e168fc7c19b16585149ff058eca79acbf3ee784f6630704cc-opens___.ttf
11559     BUILD_TYPE="$BUILD_TYPE OPENSYMBOL"
11561 AC_SUBST(OPENSYMBOL_TTF)
11562 AC_SUBST(FONTFORGE)
11564 dnl ===================================================================
11565 dnl Test whether to include fonts
11566 dnl ===================================================================
11567 AC_MSG_CHECKING([whether to include third-party fonts])
11568 if test "$with_fonts" != "no"; then
11569     AC_MSG_RESULT([yes])
11570     WITH_FONTS=TRUE
11571     BUILD_TYPE="$BUILD_TYPE MORE_FONTS"
11572     AC_DEFINE(HAVE_MORE_FONTS)
11573 else
11574     AC_MSG_RESULT([no])
11575     WITH_FONTS=
11576     SCPDEFS="$SCPDEFS -DWITHOUT_FONTS"
11578 AC_SUBST(WITH_FONTS)
11581 dnl ===================================================================
11582 dnl Test whether to enable online update service
11583 dnl ===================================================================
11584 AC_MSG_CHECKING([whether to enable online update])
11585 ENABLE_ONLINE_UPDATE=
11586 ENABLE_ONLINE_UPDATE_MAR=
11587 UPDATE_CONFIG=
11588 if test "$enable_online_update" = ""; then
11589     if test "$_os" = "WINNT" -o "$_os" = "Darwin"; then
11590         AC_MSG_RESULT([yes])
11591         ENABLE_ONLINE_UPDATE="TRUE"
11592     else
11593         AC_MSG_RESULT([no])
11594     fi
11595 else
11596     if test "$enable_online_update" = "mar"; then
11597         AC_MSG_RESULT([yes - MAR-based online update])
11598         ENABLE_ONLINE_UPDATE_MAR="TRUE"
11599         if test "$with_update_config" = ""; then
11600             AC_MSG_ERROR([mar based online updater needs an update config specified with "with-update-config])
11601         fi
11602         UPDATE_CONFIG="$with_update_config"
11603         AC_DEFINE(HAVE_FEATURE_UPDATE_MAR)
11604     elif test "$enable_online_update" = "yes"; then
11605         AC_MSG_RESULT([yes])
11606         ENABLE_ONLINE_UPDATE="TRUE"
11607     else
11608         AC_MSG_RESULT([no])
11609     fi
11611 AC_SUBST(ENABLE_ONLINE_UPDATE)
11612 AC_SUBST(ENABLE_ONLINE_UPDATE_MAR)
11613 AC_SUBST(UPDATE_CONFIG)
11615 dnl ===================================================================
11616 dnl Test whether we need bzip2
11617 dnl ===================================================================
11618 SYSTEM_BZIP2=
11619 if test "$ENABLE_ONLINE_UPDATE_MAR" = "TRUE"; then
11620     AC_MSG_CHECKING([whether to use system bzip2])
11621     if test "$with_system_bzip2" = yes; then
11622         SYSTEM_BZIP2=TRUE
11623         AC_MSG_RESULT([yes])
11624         PKG_CHECK_MODULES(BZIP2, bzip2)
11625         FilterLibs "${BZIP2_LIBS}"
11626         BZIP2_LIBS="${filteredlibs}"
11627     else
11628         AC_MSG_RESULT([no])
11629         BUILD_TYPE="$BUILD_TYPE BZIP2"
11630     fi
11632 AC_SUBST(SYSTEM_BZIP2)
11633 AC_SUBST(BZIP2_CFLAGS)
11634 AC_SUBST(BZIP2_LIBS)
11636 dnl ===================================================================
11637 dnl Test whether to enable extension update
11638 dnl ===================================================================
11639 AC_MSG_CHECKING([whether to enable extension update])
11640 ENABLE_EXTENSION_UPDATE=
11641 if test "x$enable_extension_update" = "xno"; then
11642     AC_MSG_RESULT([no])
11643 else
11644     AC_MSG_RESULT([yes])
11645     ENABLE_EXTENSION_UPDATE="TRUE"
11646     AC_DEFINE(ENABLE_EXTENSION_UPDATE)
11647     SCPDEFS="$SCPDEFS -DENABLE_EXTENSION_UPDATE"
11649 AC_SUBST(ENABLE_EXTENSION_UPDATE)
11652 dnl ===================================================================
11653 dnl Test whether to create MSI with LIMITUI=1 (silent install)
11654 dnl ===================================================================
11655 AC_MSG_CHECKING([whether to create MSI with LIMITUI=1 (silent install)])
11656 if test "$enable_silent_msi" = "" -o "$enable_silent_msi" = "no"; then
11657     AC_MSG_RESULT([no])
11658     ENABLE_SILENT_MSI=
11659 else
11660     AC_MSG_RESULT([yes])
11661     ENABLE_SILENT_MSI=TRUE
11662     SCPDEFS="$SCPDEFS -DENABLE_SILENT_MSI"
11664 AC_SUBST(ENABLE_SILENT_MSI)
11666 AC_MSG_CHECKING([whether and how to use Xinerama])
11667 if test "$_os" = "Linux" -o "$_os" = "FreeBSD"; then
11668     if test "$x_libraries" = "default_x_libraries"; then
11669         XINERAMALIB=`$PKG_CONFIG --variable=libdir xinerama`
11670         if test "x$XINERAMALIB" = x; then
11671            XINERAMALIB="/usr/lib"
11672         fi
11673     else
11674         XINERAMALIB="$x_libraries"
11675     fi
11676     if test -e "$XINERAMALIB/libXinerama.so" -a -e "$XINERAMALIB/libXinerama.a"; then
11677         # we have both versions, let the user decide but use the dynamic one
11678         # per default
11679         USE_XINERAMA=TRUE
11680         if test -z "$with_static_xinerama" -o -n "$with_system_libs"; then
11681             XINERAMA_LINK=dynamic
11682         else
11683             XINERAMA_LINK=static
11684         fi
11685     elif test -e "$XINERAMALIB/libXinerama.so" -a ! -e "$XINERAMALIB/libXinerama.a"; then
11686         # we have only the dynamic version
11687         USE_XINERAMA=TRUE
11688         XINERAMA_LINK=dynamic
11689     elif test -e "$XINERAMALIB/libXinerama.a"; then
11690         # static version
11691         if echo $host_cpu | $GREP -E 'i[[3456]]86' 2>/dev/null >/dev/null; then
11692             USE_XINERAMA=TRUE
11693             XINERAMA_LINK=static
11694         else
11695             USE_XINERAMA=
11696             XINERAMA_LINK=none
11697         fi
11698     else
11699         # no Xinerama
11700         USE_XINERAMA=
11701         XINERAMA_LINK=none
11702     fi
11703     if test "$USE_XINERAMA" = "TRUE"; then
11704         AC_MSG_RESULT([yes, with $XINERAMA_LINK linking])
11705         AC_CHECK_HEADER(X11/extensions/Xinerama.h, [],
11706             [AC_MSG_ERROR(Xinerama header not found.)], [])
11707         XEXTLIBS=`$PKG_CONFIG --variable=libs xext`
11708         if test "x$XEXTLIB" = x; then
11709            XEXTLIBS="-L$XLIB -L$XINERAMALIB -lXext"
11710         fi
11711         XINERAMA_EXTRA_LIBS="$XEXTLIBS"
11712         if test "$_os" = "FreeBSD"; then
11713             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -lXt"
11714         fi
11715         if test "$_os" = "Linux"; then
11716             XINERAMA_EXTRA_LIBS="$XINERAMA_EXTRA_LIBS -ldl"
11717         fi
11718         AC_CHECK_LIB([Xinerama], [XineramaIsActive], [:],
11719             [AC_MSG_ERROR(Xinerama not functional?)], [$XINERAMA_EXTRA_LIBS])
11720     else
11721         AC_MSG_RESULT([no, libXinerama not found or wrong architecture.])
11722     fi
11723 else
11724     USE_XINERAMA=
11725     XINERAMA_LINK=none
11726     AC_MSG_RESULT([no])
11728 AC_SUBST(USE_XINERAMA)
11729 AC_SUBST(XINERAMA_LINK)
11731 dnl ===================================================================
11732 dnl Test whether to build cairo or rely on the system version
11733 dnl ===================================================================
11735 if test "$USING_X11" = TRUE; then
11736     # Used in vcl/Library_vclplug_gen.mk
11737     test_cairo=yes
11740 if test "$test_cairo" = "yes"; then
11741     AC_MSG_CHECKING([whether to use the system cairo])
11743     : ${with_system_cairo:=$with_system_libs}
11744     if test "$with_system_cairo" = "yes"; then
11745         SYSTEM_CAIRO=TRUE
11746         AC_MSG_RESULT([yes])
11748         PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
11749         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11750         FilterLibs "${CAIRO_LIBS}"
11751         CAIRO_LIBS="${filteredlibs}"
11753         if test "$test_xrender" = "yes"; then
11754             AC_MSG_CHECKING([whether Xrender.h defines PictStandardA8])
11755             AC_LANG_PUSH([C])
11756             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/Xrender.h>]],[[
11757 #ifdef PictStandardA8
11758 #else
11759       return fail;
11760 #endif
11761 ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no, X headers too old.])])
11763             AC_LANG_POP([C])
11764         fi
11765     else
11766         SYSTEM_CAIRO=
11767         AC_MSG_RESULT([no])
11769         BUILD_TYPE="$BUILD_TYPE CAIRO"
11770     fi
11773 AC_SUBST(SYSTEM_CAIRO)
11774 AC_SUBST(CAIRO_CFLAGS)
11775 AC_SUBST(CAIRO_LIBS)
11777 dnl ===================================================================
11778 dnl Test whether to use avahi
11779 dnl ===================================================================
11780 if test "$_os" = "WINNT"; then
11781     # Windows uses bundled mDNSResponder
11782     BUILD_TYPE="$BUILD_TYPE MDNSRESPONDER"
11783 elif test "$_os" != "Darwin" -a "$enable_avahi" = "yes"; then
11784     PKG_CHECK_MODULES([AVAHI], [avahi-client >= 0.6.10],
11785                       [ENABLE_AVAHI="TRUE"])
11786     AC_DEFINE(HAVE_FEATURE_AVAHI)
11787     AVAHI_CFLAGS=$(printf '%s' "$AVAHI_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11788     FilterLibs "${AVAHI_LIBS}"
11789     AVAHI_LIBS="${filteredlibs}"
11792 AC_SUBST(ENABLE_AVAHI)
11793 AC_SUBST(AVAHI_CFLAGS)
11794 AC_SUBST(AVAHI_LIBS)
11796 dnl ===================================================================
11797 dnl Test whether to use liblangtag
11798 dnl ===================================================================
11799 SYSTEM_LIBLANGTAG=
11800 AC_MSG_CHECKING([whether to use system liblangtag])
11801 if test "$with_system_liblangtag" = yes; then
11802     SYSTEM_LIBLANGTAG=TRUE
11803     AC_MSG_RESULT([yes])
11804     PKG_CHECK_MODULES( LIBLANGTAG, liblangtag >= 0.4.0)
11805     dnl cf. <https://bitbucket.org/tagoh/liblangtag/commits/9324836a0d1c> "Fix a build issue with inline keyword"
11806     PKG_CHECK_EXISTS([liblangtag >= 0.5.5], [], [AC_DEFINE([LIBLANGTAG_INLINE_FIX])])
11807     LIBLANGTAG_CFLAGS=$(printf '%s' "$LIBLANGTAG_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
11808     FilterLibs "${LIBLANGTAG_LIBS}"
11809     LIBLANGTAG_LIBS="${filteredlibs}"
11810 else
11811     SYSTEM_LIBLANGTAG=
11812     AC_MSG_RESULT([no])
11813     BUILD_TYPE="$BUILD_TYPE LIBLANGTAG"
11814     LIBLANGTAG_CFLAGS="-I${WORKDIR}/UnpackedTarball/liblangtag"
11815     if test "$COM" = "MSC"; then
11816         LIBLANGTAG_LIBS="${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs/liblangtag.lib"
11817     else
11818         LIBLANGTAG_LIBS="-L${WORKDIR}/UnpackedTarball/liblangtag/liblangtag/.libs -llangtag"
11819     fi
11821 AC_SUBST(SYSTEM_LIBLANGTAG)
11822 AC_SUBST(LIBLANGTAG_CFLAGS)
11823 AC_SUBST(LIBLANGTAG_LIBS)
11825 dnl ===================================================================
11826 dnl Test whether to build libpng or rely on the system version
11827 dnl ===================================================================
11829 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"])
11831 dnl ===================================================================
11832 dnl Check for runtime JVM search path
11833 dnl ===================================================================
11834 if test "$ENABLE_JAVA" != ""; then
11835     AC_MSG_CHECKING([whether to use specific JVM search path at runtime])
11836     if test -n "$with_jvm_path" -a "$with_jvm_path" != "no"; then
11837         AC_MSG_RESULT([yes])
11838         if ! test -d "$with_jvm_path"; then
11839             AC_MSG_ERROR(["$with_jvm_path" not a directory])
11840         fi
11841         if ! test -d "$with_jvm_path"jvm; then
11842             AC_MSG_ERROR(["$with_jvm_path"jvm not found, point with_jvm_path to \[/path/to/\]jvm])
11843         fi
11844         JVM_ONE_PATH_CHECK="$with_jvm_path"
11845         AC_SUBST(JVM_ONE_PATH_CHECK)
11846     else
11847         AC_MSG_RESULT([no])
11848     fi
11851 dnl ===================================================================
11852 dnl Test for the presence of Ant and that it works
11853 dnl ===================================================================
11855 if test "$ENABLE_JAVA" != "" -a "$NEED_ANT" = "TRUE"; then
11856     ANT_HOME=; export ANT_HOME
11857     WITH_ANT_HOME=; export WITH_ANT_HOME
11858     if test -z "$with_ant_home" -a -n "$LODE_HOME" ; then
11859         if test -x "$LODE_HOME/opt/ant/bin/ant" ; then
11860             if test "$_os" = "WINNT"; then
11861                 with_ant_home="`cygpath -m $LODE_HOME/opt/ant`"
11862             else
11863                 with_ant_home="$LODE_HOME/opt/ant"
11864             fi
11865         elif test -x  "$LODE_HOME/opt/bin/ant" ; then
11866             with_ant_home="$LODE_HOME/opt/ant"
11867         fi
11868     fi
11869     if test -z "$with_ant_home"; then
11870         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd])
11871     else
11872         if test "$_os" = "WINNT"; then
11873             # AC_PATH_PROGS needs unix path
11874             with_ant_home=`cygpath -u "$with_ant_home"`
11875         fi
11876         AbsolutePath "$with_ant_home"
11877         with_ant_home=$absolute_path
11878         AC_PATH_PROGS(ANT, [ant ant.sh ant.bat ant.cmd],,$with_ant_home/bin:$PATH)
11879         WITH_ANT_HOME=$with_ant_home
11880         ANT_HOME=$with_ant_home
11881     fi
11883     if test -z "$ANT"; then
11884         AC_MSG_ERROR([Ant not found - Make sure it's in the path or use --with-ant-home])
11885     else
11886         # resolve relative or absolute symlink
11887         while test -h "$ANT"; do
11888             a_cwd=`pwd`
11889             a_basename=`basename "$ANT"`
11890             a_script=`ls -l "$ANT" | $SED "s/.*${a_basename} -> //g"`
11891             cd "`dirname "$ANT"`"
11892             cd "`dirname "$a_script"`"
11893             ANT="`pwd`"/"`basename "$a_script"`"
11894             cd "$a_cwd"
11895         done
11897         AC_MSG_CHECKING([if $ANT works])
11898         mkdir -p conftest.dir
11899         a_cwd=$(pwd)
11900         cd conftest.dir
11901         cat > conftest.java << EOF
11902         public class conftest {
11903             int testmethod(int a, int b) {
11904                     return a + b;
11905             }
11906         }
11909         cat > conftest.xml << EOF
11910         <project name="conftest" default="conftest">
11911         <target name="conftest">
11912             <javac srcdir="." includes="conftest.java">
11913             </javac>
11914         </target>
11915         </project>
11918         AC_TRY_COMMAND("$ANT" -buildfile conftest.xml 1>&2)
11919         if test $? = 0 -a -f ./conftest.class; then
11920             AC_MSG_RESULT([Ant works])
11921             if test -z "$WITH_ANT_HOME"; then
11922                 ANT_HOME=`"$ANT" -diagnostics | $EGREP "ant.home :" | $SED -e "s#ant.home : ##g"`
11923                 if test -z "$ANT_HOME"; then
11924                     ANT_HOME=`echo "$ANT" | $SED -n "s/\/bin\/ant.*\$//p"`
11925                 fi
11926             else
11927                 ANT_HOME="$WITH_ANT_HOME"
11928             fi
11929         else
11930             echo "configure: Ant test failed" >&5
11931             cat conftest.java >&5
11932             cat conftest.xml >&5
11933             AC_MSG_ERROR([Ant does not work - Some Java projects will not build!])
11934         fi
11935         cd "$a_cwd"
11936         rm -fr conftest.dir
11937     fi
11938     if test -z "$ANT_HOME"; then
11939         ANT_HOME="NO_ANT_HOME"
11940     else
11941         PathFormat "$ANT_HOME"
11942         ANT_HOME="$formatted_path"
11943         PathFormat "$ANT"
11944         ANT="$formatted_path"
11945     fi
11946     AC_SUBST(ANT_HOME)
11947     AC_SUBST(ANT)
11949     dnl Checking for ant.jar
11950     if test "$ANT_HOME" != "NO_ANT_HOME"; then
11951         AC_MSG_CHECKING([Ant lib directory])
11952         if test -f $ANT_HOME/lib/ant.jar; then
11953             ANT_LIB="$ANT_HOME/lib"
11954         else
11955             if test -f $ANT_HOME/ant.jar; then
11956                 ANT_LIB="$ANT_HOME"
11957             else
11958                 if test -f /usr/share/java/ant.jar; then
11959                     ANT_LIB=/usr/share/java
11960                 else
11961                     if test -f /usr/share/ant-core/lib/ant.jar; then
11962                         ANT_LIB=/usr/share/ant-core/lib
11963                     else
11964                         if test -f $ANT_HOME/lib/ant/ant.jar; then
11965                             ANT_LIB="$ANT_HOME/lib/ant"
11966                         else
11967                             if test -f /usr/share/lib/ant/ant.jar; then
11968                                 ANT_LIB=/usr/share/lib/ant
11969                             else
11970                                 AC_MSG_ERROR([Ant libraries not found!])
11971                             fi
11972                         fi
11973                     fi
11974                 fi
11975             fi
11976         fi
11977         PathFormat "$ANT_LIB"
11978         ANT_LIB="$formatted_path"
11979         AC_MSG_RESULT([Ant lib directory found.])
11980     fi
11981     AC_SUBST(ANT_LIB)
11983     ant_minver=1.6.0
11984     ant_minminor1=`echo $ant_minver | cut -d"." -f2`
11986     AC_MSG_CHECKING([whether Ant is >= $ant_minver])
11987     ant_version=`"$ANT" -version | $AWK '{ print $4; }'`
11988     ant_version_major=`echo $ant_version | cut -d. -f1`
11989     ant_version_minor=`echo $ant_version | cut -d. -f2`
11990     echo "configure: ant_version $ant_version " >&5
11991     echo "configure: ant_version_major $ant_version_major " >&5
11992     echo "configure: ant_version_minor $ant_version_minor " >&5
11993     if test "$ant_version_major" -ge "2"; then
11994         AC_MSG_RESULT([yes, $ant_version])
11995     elif test "$ant_version_major" = "1" -a "$ant_version_minor" -ge "$ant_minminor1"; then
11996         AC_MSG_RESULT([yes, $ant_version])
11997     else
11998         AC_MSG_ERROR([no, you need at least Ant >= $ant_minver])
11999     fi
12001     rm -f conftest* core core.* *.core
12004 OOO_JUNIT_JAR=
12005 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12006     AC_MSG_CHECKING([for JUnit 4])
12007     if test "$with_junit" = "yes"; then
12008         if test -n "$LODE_HOME" -a -e "$LODE_HOME/opt/share/java/junit.jar" ; then
12009             OOO_JUNIT_JAR="$LODE_HOME/opt/share/java/junit.jar"
12010         elif test -e /usr/share/java/junit4.jar; then
12011             OOO_JUNIT_JAR=/usr/share/java/junit4.jar
12012         else
12013            if test -e /usr/share/lib/java/junit.jar; then
12014               OOO_JUNIT_JAR=/usr/share/lib/java/junit.jar
12015            else
12016               OOO_JUNIT_JAR=/usr/share/java/junit.jar
12017            fi
12018         fi
12019     else
12020         OOO_JUNIT_JAR=$with_junit
12021     fi
12022     if test "$_os" = "WINNT"; then
12023         OOO_JUNIT_JAR=`cygpath -m "$OOO_JUNIT_JAR"`
12024     fi
12025     printf 'import org.junit.Before;' > conftest.java
12026     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12027         AC_MSG_RESULT([$OOO_JUNIT_JAR])
12028     else
12029         AC_MSG_ERROR(
12030 [cannot find JUnit 4 jar; please install one in the default location (/usr/share/java),
12031  specify its pathname via --with-junit=..., or disable it via --without-junit])
12032     fi
12033     rm -f conftest.class conftest.java
12034     if test $OOO_JUNIT_JAR != ""; then
12035     BUILD_TYPE="$BUILD_TYPE QADEVOOO"
12036     fi
12038 AC_SUBST(OOO_JUNIT_JAR)
12040 HAMCREST_JAR=
12041 if test "$ENABLE_JAVA" != "" -a "$with_junit" != "no"; then
12042     AC_MSG_CHECKING([for included Hamcrest])
12043     printf 'import org.hamcrest.BaseDescription;' > conftest.java
12044     if "$JAVACOMPILER" -classpath "$OOO_JUNIT_JAR" conftest.java >&5 2>&5; then
12045         AC_MSG_RESULT([Included in $OOO_JUNIT_JAR])
12046     else
12047         AC_MSG_RESULT([Not included])
12048         AC_MSG_CHECKING([for standalone hamcrest jar.])
12049         if test "$with_hamcrest" = "yes"; then
12050             if test -e /usr/share/lib/java/hamcrest.jar; then
12051                 HAMCREST_JAR=/usr/share/lib/java/hamcrest.jar
12052             elif test -e /usr/share/java/hamcrest/core.jar; then
12053                 HAMCREST_JAR=/usr/share/java/hamcrest/core.jar
12054             else
12055                 HAMCREST_JAR=/usr/share/java/hamcrest.jar
12056             fi
12057         else
12058             HAMCREST_JAR=$with_hamcrest
12059         fi
12060         if test "$_os" = "WINNT"; then
12061             HAMCREST_JAR=`cygpath -m "$HAMCREST_JAR"`
12062         fi
12063         if "$JAVACOMPILER" -classpath "$HAMCREST_JAR" conftest.java >&5 2>&5; then
12064             AC_MSG_RESULT([$HAMCREST_JAR])
12065         else
12066             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),
12067                           specify its path with --with-hamcrest=..., or disable junit with --without-junit])
12068         fi
12069     fi
12070     rm -f conftest.class conftest.java
12072 AC_SUBST(HAMCREST_JAR)
12075 AC_SUBST(SCPDEFS)
12078 # check for wget and curl
12080 WGET=
12081 CURL=
12083 if test "$enable_fetch_external" != "no"; then
12085 CURL=`which curl 2>/dev/null`
12087 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget /opt/local/bin/wget; do
12088     # wget new enough?
12089     $i --help 2> /dev/null | $GREP no-use-server-timestamps 2>&1 > /dev/null
12090     if test $? -eq 0; then
12091         WGET=$i
12092         break
12093     fi
12094 done
12096 if test -z "$WGET" -a -z "$CURL"; then
12097     AC_MSG_ERROR([neither wget nor curl found!])
12102 AC_SUBST(WGET)
12103 AC_SUBST(CURL)
12106 # check for sha256sum
12108 SHA256SUM=
12110 for i in shasum /usr/local/bin/shasum /usr/sfw/bin/shasum /opt/sfw/bin/shasum /opt/local/bin/shasum; do
12111     eval "$i -a 256 --version" > /dev/null 2>&1
12112     ret=$?
12113     if test $ret -eq 0; then
12114         SHA256SUM="$i -a 256"
12115         break
12116     fi
12117 done
12119 if test -z "$SHA256SUM"; then
12120     for i in sha256sum /usr/local/bin/sha256sum /usr/sfw/bin/sha256sum /opt/sfw/bin/sha256sum /opt/local/bin/sha256sum; do
12121         eval "$i --version" > /dev/null 2>&1
12122         ret=$?
12123         if test $ret -eq 0; then
12124             SHA256SUM=$i
12125             break
12126         fi
12127     done
12130 if test -z "$SHA256SUM"; then
12131     AC_MSG_ERROR([no sha256sum found!])
12134 AC_SUBST(SHA256SUM)
12136 dnl ===================================================================
12137 dnl Dealing with l10n options
12138 dnl ===================================================================
12139 AC_MSG_CHECKING([which languages to be built])
12140 # get list of all languages
12141 # generate shell variable from completelangiso= from solenv/inc/langlist.mk
12142 # the sed command does the following:
12143 #   + if a line ends with a backslash, append the next line to it
12144 #   + adds " on the beginning of the value (after =)
12145 #   + adds " at the end of the value
12146 #   + removes en-US; we want to put it on the beginning
12147 #   + prints just the section starting with 'completelangiso=' and ending with the " at the end of line
12148 [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)]
12149 ALL_LANGS="en-US $completelangiso"
12150 # check the configured localizations
12151 WITH_LANG="$with_lang"
12153 # Check for --without-lang which turns up as $with_lang being "no". Luckily there is no language with code "no".
12154 # (Norwegian is "nb" and "nn".)
12155 if test "$WITH_LANG" = "no"; then
12156     WITH_LANG=
12159 if test -z "$WITH_LANG" -o "$WITH_LANG" = "en-US"; then
12160     AC_MSG_RESULT([en-US])
12161 else
12162     AC_MSG_RESULT([$WITH_LANG])
12163     GIT_NEEDED_SUBMODULES="translations $GIT_NEEDED_SUBMODULES"
12164     if test -z "$MSGFMT"; then
12165         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msgfmt" ; then
12166             MSGFMT="$LODE_HOME/opt/bin/msgfmt"
12167         elif test -x "/opt/lo/bin/msgfmt"; then
12168             MSGFMT="/opt/lo/bin/msgfmt"
12169         else
12170             AC_CHECK_PROGS(MSGFMT, [msgfmt])
12171             if test -z "$MSGFMT"; then
12172                 AC_MSG_ERROR([msgfmt not found. Install GNU gettext, or re-run without languages.])
12173             fi
12174         fi
12175     fi
12176     if test -z "$MSGUNIQ"; then
12177         if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/msguniq" ; then
12178             MSGUNIQ="$LODE_HOME/opt/bin/msguniq"
12179         elif test -x "/opt/lo/bin/msguniq"; then
12180             MSGUNIQ="/opt/lo/bin/msguniq"
12181         else
12182             AC_CHECK_PROGS(MSGUNIQ, [msguniq])
12183             if test -z "$MSGUNIQ"; then
12184                 AC_MSG_ERROR([msguniq not found. Install GNU gettext, or re-run without languages.])
12185             fi
12186         fi
12187     fi
12189 AC_SUBST(MSGFMT)
12190 AC_SUBST(MSGUNIQ)
12191 # check that the list is valid
12192 for lang in $WITH_LANG; do
12193     test "$lang" = "ALL" && continue
12194     # need to check for the exact string, so add space before and after the list of all languages
12195     for vl in $ALL_LANGS; do
12196         if test "$vl" = "$lang"; then
12197            break
12198         fi
12199     done
12200     if test "$vl" != "$lang"; then
12201         # if you're reading this - you prolly quoted your languages remove the quotes ...
12202         AC_MSG_ERROR([invalid language: '$lang' (vs '$v1'); supported languages are: $ALL_LANGS])
12203     fi
12204 done
12205 if test -n "$WITH_LANG" -a "$WITH_LANG" != "ALL"; then
12206     echo $WITH_LANG | grep -q en-US
12207     test $? -ne 1 || WITH_LANG=`echo $WITH_LANG en-US`
12209 # list with substituted ALL
12210 WITH_LANG_LIST=`echo $WITH_LANG | sed "s/ALL/$ALL_LANGS/"`
12211 test -z "$WITH_LANG_LIST" && WITH_LANG_LIST="en-US"
12212 test "$WITH_LANG" = "en-US" && WITH_LANG=
12213 if test "$enable_release_build" = "" -o "$enable_release_build" = "no"; then
12214     test "$WITH_LANG_LIST" = "en-US" || WITH_LANG_LIST=`echo $WITH_LANG_LIST qtz`
12215     ALL_LANGS=`echo $ALL_LANGS qtz`
12217 AC_SUBST(ALL_LANGS)
12218 AC_DEFINE_UNQUOTED(WITH_LANG,"$WITH_LANG")
12219 AC_SUBST(WITH_LANG)
12220 AC_SUBST(WITH_LANG_LIST)
12221 AC_SUBST(GIT_NEEDED_SUBMODULES)
12223 WITH_POOR_HELP_LOCALIZATIONS=
12224 if test -d "$SRC_ROOT/translations/source"; then
12225     for l in `ls -1 $SRC_ROOT/translations/source`; do
12226         if test ! -d "$SRC_ROOT/translations/source/$l/helpcontent2"; then
12227             WITH_POOR_HELP_LOCALIZATIONS="$WITH_POOR_HELP_LOCALIZATIONS $l"
12228         fi
12229     done
12231 AC_SUBST(WITH_POOR_HELP_LOCALIZATIONS)
12233 if test -n "$with_locales"; then
12234     WITH_LOCALES="$with_locales"
12236     just_langs="`echo $WITH_LOCALES | sed -e 's/_[A-Z]*//g'`"
12237     # Only languages and scripts for which we actually have ifdefs need to be handled. Also see
12238     # config_host/config_locales.h.in
12239     for locale in $WITH_LOCALES; do
12240         lang=${locale%_*}
12242         AC_DEFINE_UNQUOTED(WITH_LOCALE_$lang, 1)
12244         case $lang in
12245         hi|mr*ne)
12246             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Deva)
12247             ;;
12248         bg|ru)
12249             AC_DEFINE(WITH_LOCALE_FOR_SCRIPT_Cyrl)
12250             ;;
12251         esac
12252     done
12253 else
12254     AC_DEFINE(WITH_LOCALE_ALL)
12256 AC_SUBST(WITH_LOCALES)
12258 dnl git submodule update --reference
12259 dnl ===================================================================
12260 if test -n "${GIT_REFERENCE_SRC}"; then
12261     for repo in ${GIT_NEEDED_SUBMODULES}; do
12262         if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
12263             AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
12264         fi
12265     done
12267 AC_SUBST(GIT_REFERENCE_SRC)
12269 dnl git submodules linked dirs
12270 dnl ===================================================================
12271 if test -n "${GIT_LINK_SRC}"; then
12272     for repo in ${GIT_NEEDED_SUBMODULES}; do
12273         if ! test -d "${GIT_LINK_SRC}"/${repo}; then
12274             AC_MSG_ERROR([linked git: required repository does not exist: ${GIT_LINK_SRC}/${repo}])
12275         fi
12276     done
12278 AC_SUBST(GIT_LINK_SRC)
12280 dnl branding
12281 dnl ===================================================================
12282 AC_MSG_CHECKING([for alternative branding images directory])
12283 # initialize mapped arrays
12284 BRAND_INTRO_IMAGES="flat_logo.svg intro.png intro-highres.png"
12285 brand_files="$BRAND_INTRO_IMAGES about.svg"
12287 if test -z "$with_branding" -o "$with_branding" = "no"; then
12288     AC_MSG_RESULT([none])
12289     DEFAULT_BRAND_IMAGES="$brand_files"
12290 else
12291     if ! test -d $with_branding ; then
12292         AC_MSG_ERROR([No directory $with_branding, falling back to default branding])
12293     else
12294         AC_MSG_RESULT([$with_branding])
12295         CUSTOM_BRAND_DIR="$with_branding"
12296         for lfile in $brand_files
12297         do
12298             if ! test -f $with_branding/$lfile ; then
12299                 AC_MSG_WARN([Branded file $lfile does not exist, using the default one])
12300                 DEFAULT_BRAND_IMAGES="$DEFAULT_BRAND_IMAGES $lfile"
12301             else
12302                 CUSTOM_BRAND_IMAGES="$CUSTOM_BRAND_IMAGES $lfile"
12303             fi
12304         done
12305         check_for_progress="yes"
12306     fi
12308 AC_SUBST([BRAND_INTRO_IMAGES])
12309 AC_SUBST([CUSTOM_BRAND_DIR])
12310 AC_SUBST([CUSTOM_BRAND_IMAGES])
12311 AC_SUBST([DEFAULT_BRAND_IMAGES])
12314 AC_MSG_CHECKING([for 'intro' progress settings])
12315 PROGRESSBARCOLOR=
12316 PROGRESSSIZE=
12317 PROGRESSPOSITION=
12318 PROGRESSFRAMECOLOR=
12319 PROGRESSTEXTCOLOR=
12320 PROGRESSTEXTBASELINE=
12322 if test "$check_for_progress" = "yes" -a -f "$with_branding/progress.conf" ; then
12323     source "$with_branding/progress.conf"
12324     AC_MSG_RESULT([settings found in $with_branding/progress.conf])
12325 else
12326     AC_MSG_RESULT([none])
12329 AC_SUBST(PROGRESSBARCOLOR)
12330 AC_SUBST(PROGRESSSIZE)
12331 AC_SUBST(PROGRESSPOSITION)
12332 AC_SUBST(PROGRESSFRAMECOLOR)
12333 AC_SUBST(PROGRESSTEXTCOLOR)
12334 AC_SUBST(PROGRESSTEXTBASELINE)
12337 AC_MSG_CHECKING([for extra build ID])
12338 if test -n "$with_extra_buildid" -a "$with_extra_buildid" != "yes" ; then
12339     EXTRA_BUILDID="$with_extra_buildid"
12341 # in tinderboxes, it is easier to set EXTRA_BUILDID via the environment variable instead of configure switch
12342 if test -n "$EXTRA_BUILDID" ; then
12343     AC_MSG_RESULT([$EXTRA_BUILDID])
12344 else
12345     AC_MSG_RESULT([not set])
12347 AC_DEFINE_UNQUOTED([EXTRA_BUILDID], ["$EXTRA_BUILDID"])
12349 OOO_VENDOR=
12350 AC_MSG_CHECKING([for vendor])
12351 if test -z "$with_vendor" -o "$with_vendor" = "no"; then
12352     OOO_VENDOR="$USERNAME"
12354     if test -z "$OOO_VENDOR"; then
12355         OOO_VENDOR="$USER"
12356     fi
12358     if test -z "$OOO_VENDOR"; then
12359         OOO_VENDOR="`id -u -n`"
12360     fi
12362     AC_MSG_RESULT([not set, using $OOO_VENDOR])
12363 else
12364     OOO_VENDOR="$with_vendor"
12365     AC_MSG_RESULT([$OOO_VENDOR])
12367 AC_DEFINE_UNQUOTED(OOO_VENDOR,"$OOO_VENDOR")
12368 AC_SUBST(OOO_VENDOR)
12370 if test "$_os" = "Android" ; then
12371     ANDROID_PACKAGE_NAME=
12372     AC_MSG_CHECKING([for Android package name])
12373     if test -z "$with_android_package_name" -o "$with_android_package_name" = "no"; then
12374         if test -n "$ENABLE_DEBUG"; then
12375             # Default to the package name that makes ndk-gdb happy.
12376             ANDROID_PACKAGE_NAME="org.libreoffice"
12377         else
12378             ANDROID_PACKAGE_NAME="org.example.libreoffice"
12379         fi
12381         AC_MSG_RESULT([not set, using $ANDROID_PACKAGE_NAME])
12382     else
12383         ANDROID_PACKAGE_NAME="$with_android_package_name"
12384         AC_MSG_RESULT([$ANDROID_PACKAGE_NAME])
12385     fi
12386     AC_SUBST(ANDROID_PACKAGE_NAME)
12389 AC_MSG_CHECKING([whether to install the compat oo* wrappers])
12390 if test "$with_compat_oowrappers" = "yes"; then
12391     WITH_COMPAT_OOWRAPPERS=TRUE
12392     AC_MSG_RESULT(yes)
12393 else
12394     WITH_COMPAT_OOWRAPPERS=
12395     AC_MSG_RESULT(no)
12397 AC_SUBST(WITH_COMPAT_OOWRAPPERS)
12399 INSTALLDIRNAME=`echo AC_PACKAGE_NAME | $AWK '{print tolower($0)}'`
12400 AC_MSG_CHECKING([for install dirname])
12401 if test -n "$with_install_dirname" -a "$with_install_dirname" != "no" -a "$with_install_dirname" != "yes"; then
12402     INSTALLDIRNAME="$with_install_dirname"
12404 AC_MSG_RESULT([$INSTALLDIRNAME])
12405 AC_SUBST(INSTALLDIRNAME)
12407 AC_MSG_CHECKING([for prefix])
12408 test "x$prefix" = xNONE && prefix=$ac_default_prefix
12409 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
12410 PREFIXDIR="$prefix"
12411 AC_MSG_RESULT([$PREFIXDIR])
12412 AC_SUBST(PREFIXDIR)
12414 LIBDIR=[$(eval echo $(eval echo $libdir))]
12415 AC_SUBST(LIBDIR)
12417 DATADIR=[$(eval echo $(eval echo $datadir))]
12418 AC_SUBST(DATADIR)
12420 MANDIR=[$(eval echo $(eval echo $mandir))]
12421 AC_SUBST(MANDIR)
12423 DOCDIR=[$(eval echo $(eval echo $docdir))]
12424 AC_SUBST(DOCDIR)
12426 BINDIR=[$(eval echo $(eval echo $bindir))]
12427 AC_SUBST(BINDIR)
12429 INSTALLDIR="$LIBDIR/$INSTALLDIRNAME"
12430 AC_SUBST(INSTALLDIR)
12432 TESTINSTALLDIR="${BUILDDIR}/test-install"
12433 AC_SUBST(TESTINSTALLDIR)
12436 # ===================================================================
12437 # OAuth2 id and secrets
12438 # ===================================================================
12440 AC_MSG_CHECKING([for Google Drive client id and secret])
12441 if test "$with_gdrive_client_id" = "no" -o -z "$with_gdrive_client_id"; then
12442     AC_MSG_RESULT([not set])
12443     GDRIVE_CLIENT_ID="\"\""
12444     GDRIVE_CLIENT_SECRET="\"\""
12445 else
12446     AC_MSG_RESULT([set])
12447     GDRIVE_CLIENT_ID="\"$with_gdrive_client_id\""
12448     GDRIVE_CLIENT_SECRET="\"$with_gdrive_client_secret\""
12450 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_ID, $GDRIVE_CLIENT_ID)
12451 AC_DEFINE_UNQUOTED(GDRIVE_CLIENT_SECRET, $GDRIVE_CLIENT_SECRET)
12453 AC_MSG_CHECKING([for Alfresco Cloud client id and secret])
12454 if test "$with_alfresco_cloud_client_id" = "no" -o -z "$with_alfresco_cloud_client_id"; then
12455     AC_MSG_RESULT([not set])
12456     ALFRESCO_CLOUD_CLIENT_ID="\"\""
12457     ALFRESCO_CLOUD_CLIENT_SECRET="\"\""
12458 else
12459     AC_MSG_RESULT([set])
12460     ALFRESCO_CLOUD_CLIENT_ID="\"$with_alfresco_cloud_client_id\""
12461     ALFRESCO_CLOUD_CLIENT_SECRET="\"$with_alfresco_cloud_client_secret\""
12463 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_ID, $ALFRESCO_CLOUD_CLIENT_ID)
12464 AC_DEFINE_UNQUOTED(ALFRESCO_CLOUD_CLIENT_SECRET, $ALFRESCO_CLOUD_CLIENT_SECRET)
12466 AC_MSG_CHECKING([for OneDrive client id and secret])
12467 if test "$with_onedrive_client_id" = "no" -o -z "$with_onedrive_client_id"; then
12468     AC_MSG_RESULT([not set])
12469     ONEDRIVE_CLIENT_ID="\"\""
12470     ONEDRIVE_CLIENT_SECRET="\"\""
12471 else
12472     AC_MSG_RESULT([set])
12473     ONEDRIVE_CLIENT_ID="\"$with_onedrive_client_id\""
12474     ONEDRIVE_CLIENT_SECRET="\"$with_onedrive_client_secret\""
12476 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_ID, $ONEDRIVE_CLIENT_ID)
12477 AC_DEFINE_UNQUOTED(ONEDRIVE_CLIENT_SECRET, $ONEDRIVE_CLIENT_SECRET)
12480 dnl ===================================================================
12481 dnl Hook up LibreOffice's nodep environmental variable to automake's equivalent
12482 dnl --enable-dependency-tracking configure option
12483 dnl ===================================================================
12484 AC_MSG_CHECKING([whether to enable dependency tracking])
12485 if test "$enable_dependency_tracking" = "no"; then
12486     nodep=TRUE
12487     AC_MSG_RESULT([no])
12488 else
12489     AC_MSG_RESULT([yes])
12491 AC_SUBST(nodep)
12493 dnl ===================================================================
12494 dnl Number of CPUs to use during the build
12495 dnl ===================================================================
12496 AC_MSG_CHECKING([for number of processors to use])
12497 # plain --with-parallelism is just the default
12498 if test -n "$with_parallelism" -a "$with_parallelism" != "yes"; then
12499     if test "$with_parallelism" = "no"; then
12500         PARALLELISM=0
12501     else
12502         PARALLELISM=$with_parallelism
12503     fi
12504 else
12505     if test "$enable_icecream" = "yes"; then
12506         PARALLELISM="40"
12507     else
12508         case `uname -s` in
12510         Darwin|FreeBSD|NetBSD|OpenBSD)
12511             PARALLELISM=`sysctl -n hw.ncpu`
12512             ;;
12514         Linux)
12515             PARALLELISM=`getconf _NPROCESSORS_ONLN`
12516         ;;
12517         # what else than above does profit here *and* has /proc?
12518         *)
12519             PARALLELISM=`grep $'^processor\t*:' /proc/cpuinfo | wc -l`
12520             ;;
12521         esac
12523         # If we hit the catch-all case, but /proc/cpuinfo doesn't exist or has an
12524         # unexpected format, 'wc -l' will have returned 0 (and we won't use -j at all).
12525     fi
12528 if test "$no_parallelism_make" = "YES" && test $PARALLELISM -gt 1; then
12529     if test -z "$with_parallelism"; then
12530             AC_MSG_WARN([gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this.])
12531             add_warning "gmake 3.81 crashes with parallelism > 1, reducing it to 1. upgrade to 3.82 to avoid this."
12532             PARALLELISM="1"
12533     else
12534         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."
12535     fi
12538 if test $PARALLELISM -eq 0; then
12539     AC_MSG_RESULT([explicit make -j option needed])
12540 else
12541     AC_MSG_RESULT([$PARALLELISM])
12543 AC_SUBST(PARALLELISM)
12545 IWYU_PATH="$with_iwyu"
12546 AC_SUBST(IWYU_PATH)
12547 if test ! -z "$IWYU_PATH"; then
12548     if test ! -f "$IWYU_PATH"; then
12549         AC_MSG_ERROR([cannot find include-what-you-use binary specified by --with-iwyu])
12550     fi
12554 # Set up ILIB for MSVC build
12556 ILIB1=
12557 if test "$build_os" = "cygwin"; then
12558     ILIB="."
12559     if test -n "$JAVA_HOME"; then
12560         ILIB="$ILIB;$JAVA_HOME/lib"
12561     fi
12562     ILIB1=-link
12563     if test "$BITNESS_OVERRIDE" = 64; then
12564         ILIB="$ILIB;$COMPATH/lib/x64"
12565         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x64"
12566         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/x64"
12567         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/x64"
12568         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12569             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12570             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x64"
12571         fi
12572         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x64"
12573         ucrtlibpath_formatted=$formatted_path
12574         ILIB="$ILIB;$ucrtlibpath_formatted"
12575         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12576     else
12577         ILIB="$ILIB;$COMPATH/lib/x86"
12578         ILIB1="$ILIB1 -LIBPATH:$COMPATH/lib/x86"
12579         ILIB="$ILIB;$WINDOWS_SDK_HOME/lib"
12580         ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib"
12581         if test $WINDOWS_SDK_VERSION = 80 -o $WINDOWS_SDK_VERSION = 81 -o $WINDOWS_SDK_VERSION = 10; then
12582             ILIB="$ILIB;$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12583             ILIB1="$ILIB1 -LIBPATH:$WINDOWS_SDK_HOME/lib/$winsdklibsubdir/um/x86"
12584         fi
12585         PathFormat "${UCRTSDKDIR}lib/$UCRTVERSION/ucrt/x86"
12586         ucrtlibpath_formatted=$formatted_path
12587         ILIB="$ILIB;$ucrtlibpath_formatted"
12588         ILIB1="$ILIB1 -LIBPATH:$ucrtlibpath_formatted"
12589     fi
12590     if test -f "$DOTNET_FRAMEWORK_HOME/lib/mscoree.lib"; then
12591         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/lib"
12592     else
12593         ILIB="$ILIB;$DOTNET_FRAMEWORK_HOME/Lib/um/$WINDOWS_SDK_ARCH"
12594     fi
12596     AC_SUBST(ILIB)
12599 # ===================================================================
12600 # Creating bigger shared library to link against
12601 # ===================================================================
12602 AC_MSG_CHECKING([whether to create huge library])
12603 MERGELIBS=
12605 if test $_os = iOS -o $_os = Android; then
12606     # Never any point in mergelibs for these as we build just static
12607     # libraries anyway...
12608     enable_mergelibs=no
12611 if test -n "$enable_mergelibs" -a "$enable_mergelibs" != "no"; then
12612     if test $_os != Linux -a $_os != WINNT; then
12613         add_warning "--enable-mergelibs is not tested for this platform"
12614     fi
12615     MERGELIBS="TRUE"
12616     AC_MSG_RESULT([yes])
12617 else
12618     AC_MSG_RESULT([no])
12620 AC_SUBST([MERGELIBS])
12622 dnl ===================================================================
12623 dnl icerun is a wrapper that stops us spawning tens of processes
12624 dnl locally - for tools that can't be executed on the compile cluster
12625 dnl this avoids a dozen javac's ganging up on your laptop to kill it.
12626 dnl ===================================================================
12627 AC_MSG_CHECKING([whether to use icerun wrapper])
12628 ICECREAM_RUN=
12629 if test "$enable_icecream" = "yes" && which icerun >/dev/null 2>&1 ; then
12630     ICECREAM_RUN=icerun
12631     AC_MSG_RESULT([yes])
12632 else
12633     AC_MSG_RESULT([no])
12635 AC_SUBST(ICECREAM_RUN)
12637 dnl ===================================================================
12638 dnl Setup the ICECC_VERSION for the build the same way it was set for
12639 dnl configure, so that CC/CXX and ICECC_VERSION are in sync
12640 dnl ===================================================================
12641 x_ICECC_VERSION=[\#]
12642 if test -n "$ICECC_VERSION" ; then
12643     x_ICECC_VERSION=
12645 AC_SUBST(x_ICECC_VERSION)
12646 AC_SUBST(ICECC_VERSION)
12648 dnl ===================================================================
12650 AC_MSG_CHECKING([MPL subset])
12651 MPL_SUBSET=
12653 if test "$enable_mpl_subset" = "yes"; then
12654     warn_report=false
12655     if test "$enable_report_builder" != "no" -a "$with_java" != "no"; then
12656         warn_report=true
12657     elif test "$ENABLE_REPORTBUILDER" = "TRUE"; then
12658         warn_report=true
12659     fi
12660     if test "$warn_report" = "true"; then
12661         AC_MSG_ERROR([need to --disable-report-builder - extended database report builder.])
12662     fi
12663     if test "x$enable_postgresql_sdbc" != "xno"; then
12664         AC_MSG_ERROR([need to --disable-postgresql-sdbc - the PostgreSQL database backend.])
12665     fi
12666     if test "$enable_lotuswordpro" = "yes"; then
12667         AC_MSG_ERROR([need to --disable-lotuswordpro - a Lotus Word Pro file format import filter.])
12668     fi
12669     if test "$WITH_WEBDAV" = "neon"; then
12670         AC_MSG_ERROR([need --with-webdav=serf or --without-webdav - webdav support.])
12671     fi
12672     if test -n "$ENABLE_POPPLER"; then
12673         if test "x$SYSTEM_POPPLER" = "x"; then
12674             AC_MSG_ERROR([need to disable PDF import via poppler or use system library])
12675         fi
12676     fi
12677     # cf. m4/libo_check_extension.m4
12678     if test "x$WITH_EXTRA_EXTENSIONS" != "x"; then
12679         AC_MSG_ERROR([need to disable extra extensions '$WITH_EXTRA_EXTENSIONS'])
12680     fi
12681     for theme in $WITH_THEMES; do
12682         case $theme in
12683         breeze|breeze_dark|breeze_svg|elementary|elementary_svg|karasa_jaga|karasa_jaga_svg) #blacklist of icon themes under GPL or LGPL
12684             AC_MSG_ERROR([need to disable icon themes from '$WITH_THEMES': $theme present, use --with-theme=tango]) ;;
12685         *) : ;;
12686         esac
12687     done
12689     ENABLE_OPENGL_TRANSITIONS=
12691     if test "$enable_lpsolve" != "no" -o "x$ENABLE_LPSOLVE" = "xTRUE"; then
12692         AC_MSG_ERROR([need to --disable-lpsolve - calc linear programming solver.])
12693     fi
12695     MPL_SUBSET="TRUE"
12696     AC_DEFINE(MPL_HAVE_SUBSET)
12697     AC_MSG_RESULT([only])
12698 else
12699     AC_MSG_RESULT([no restrictions])
12701 AC_SUBST(MPL_SUBSET)
12703 dnl ===================================================================
12705 AC_MSG_CHECKING([formula logger])
12706 ENABLE_FORMULA_LOGGER=
12708 if test "x$enable_formula_logger" = "xyes"; then
12709     AC_MSG_RESULT([yes])
12710     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12711     ENABLE_FORMULA_LOGGER=TRUE
12712 elif test -n "$ENABLE_DBGUTIL" ; then
12713     AC_MSG_RESULT([yes])
12714     AC_DEFINE(ENABLE_FORMULA_LOGGER)
12715     ENABLE_FORMULA_LOGGER=TRUE
12716 else
12717     AC_MSG_RESULT([no])
12720 AC_SUBST(ENABLE_FORMULA_LOGGER)
12722 dnl ===================================================================
12723 dnl Setting up the environment.
12724 dnl ===================================================================
12725 AC_MSG_NOTICE([setting up the build environment variables...])
12727 AC_SUBST(COMPATH)
12729 if test "$build_os" = "cygwin"; then
12730     if test -d "$COMPATH/atlmfc/lib/spectre"; then
12731         ATL_LIB="$COMPATH/atlmfc/lib/spectre"
12732         ATL_INCLUDE="$COMPATH/atlmfc/include"
12733     elif test -d "$COMPATH/atlmfc/lib"; then
12734         ATL_LIB="$COMPATH/atlmfc/lib"
12735         ATL_INCLUDE="$COMPATH/atlmfc/include"
12736     else
12737         ATL_LIB="$WINDOWS_SDK_HOME/lib" # Doesn't exist for VSE
12738         ATL_INCLUDE="$WINDOWS_SDK_HOME/include/atl"
12739     fi
12740     if test "$BITNESS_OVERRIDE" = 64; then
12741         ATL_LIB="$ATL_LIB/x64"
12742     else
12743         ATL_LIB="$ATL_LIB/x86"
12744     fi
12745     ATL_LIB=`win_short_path_for_make "$ATL_LIB"`
12746     ATL_INCLUDE=`win_short_path_for_make "$ATL_INCLUDE"`
12748     # sort.exe and find.exe also exist in C:/Windows/system32 so need /usr/bin/
12749     PathFormat "/usr/bin/find.exe"
12750     FIND="$formatted_path"
12751     PathFormat "/usr/bin/sort.exe"
12752     SORT="$formatted_path"
12753     PathFormat "/usr/bin/grep.exe"
12754     WIN_GREP="$formatted_path"
12755     PathFormat "/usr/bin/ls.exe"
12756     WIN_LS="$formatted_path"
12757     PathFormat "/usr/bin/touch.exe"
12758     WIN_TOUCH="$formatted_path"
12759 else
12760     FIND=find
12761     SORT=sort
12764 AC_SUBST(ATL_INCLUDE)
12765 AC_SUBST(ATL_LIB)
12766 AC_SUBST(FIND)
12767 AC_SUBST(SORT)
12768 AC_SUBST(WIN_GREP)
12769 AC_SUBST(WIN_LS)
12770 AC_SUBST(WIN_TOUCH)
12772 AC_SUBST(BUILD_TYPE)
12774 AC_SUBST(SOLARINC)
12776 PathFormat "$PERL"
12777 PERL="$formatted_path"
12778 AC_SUBST(PERL)
12780 if test -n "$TMPDIR"; then
12781     TEMP_DIRECTORY="$TMPDIR"
12782 else
12783     TEMP_DIRECTORY="/tmp"
12785 if test "$build_os" = "cygwin"; then
12786     TEMP_DIRECTORY=`cygpath -m "$TEMP_DIRECTORY"`
12788 AC_SUBST(TEMP_DIRECTORY)
12790 # setup the PATH for the environment
12791 if test -n "$LO_PATH_FOR_BUILD"; then
12792     LO_PATH="$LO_PATH_FOR_BUILD"
12793 else
12794     LO_PATH="$PATH"
12796     case "$host_os" in
12798     aix*|dragonfly*|freebsd*|linux-gnu*|*netbsd*|openbsd*)
12799         if test "$ENABLE_JAVA" != ""; then
12800             pathmunge "$JAVA_HOME/bin" "after"
12801         fi
12802         ;;
12804     cygwin*)
12805         # Win32 make needs native paths
12806         if test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
12807             LO_PATH=`cygpath -p -m "$PATH"`
12808         fi
12809         if test "$BITNESS_OVERRIDE" = 64; then
12810             # needed for msi packaging
12811             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12812         fi
12813         # .NET 4.6 and higher don't have bin directory
12814         if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
12815             pathmunge "$DOTNET_FRAMEWORK_HOME/bin" "before"
12816         fi
12817         pathmunge "$WINDOWS_SDK_HOME/bin" "before"
12818         pathmunge "$CSC_PATH" "before"
12819         pathmunge "$MIDL_PATH" "before"
12820         pathmunge "$AL_PATH" "before"
12821         pathmunge "$MSPDB_PATH" "before"
12822         if test "$MSPDB_PATH" != "$CL_PATH" ; then
12823             pathmunge "$CL_PATH" "before"
12824         fi
12825         if test -n "$MSBUILD_PATH" ; then
12826             pathmunge "$MSBUILD_PATH" "before"
12827         fi
12828         if test "$BITNESS_OVERRIDE" = 64; then
12829             pathmunge "$COMPATH/bin/amd64" "before"
12830             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
12831         else
12832             pathmunge "$COMPATH/bin" "before"
12833             pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
12834         fi
12835         if test "$ENABLE_JAVA" != ""; then
12836             if test -d "$JAVA_HOME/jre/bin/client"; then
12837                 pathmunge "$JAVA_HOME/jre/bin/client" "before"
12838             fi
12839             if test -d "$JAVA_HOME/jre/bin/hotspot"; then
12840                 pathmunge "$JAVA_HOME/jre/bin/hotspot" "before"
12841             fi
12842             pathmunge "$JAVA_HOME/bin" "before"
12843         fi
12844         ;;
12846     solaris*)
12847         pathmunge "/usr/css/bin" "before"
12848         if test "$ENABLE_JAVA" != ""; then
12849             pathmunge "$JAVA_HOME/bin" "after"
12850         fi
12851         ;;
12852     esac
12855 AC_SUBST(LO_PATH)
12857 libo_FUZZ_SUMMARY
12859 # Generate a configuration sha256 we can use for deps
12860 if test -f config_host.mk; then
12861     config_sha256=`$SHA256SUM config_host.mk | sed "s/ .*//"`
12863 if test -f config_host_lang.mk; then
12864     config_lang_sha256=`$SHA256SUM config_host_lang.mk | sed "s/ .*//"`
12867 CFLAGS=$my_original_CFLAGS
12868 CXXFLAGS=$my_original_CXXFLAGS
12869 CPPFLAGS=$my_original_CPPFLAGS
12871 AC_CONFIG_FILES([config_host.mk
12872                  config_host_lang.mk
12873                  Makefile
12874                  bin/bffvalidator.sh
12875                  bin/odfvalidator.sh
12876                  bin/officeotron.sh
12877                  instsetoo_native/util/openoffice.lst
12878                  sysui/desktop/macosx/Info.plist])
12879 AC_CONFIG_HEADERS([config_host/config_buildid.h])
12880 AC_CONFIG_HEADERS([config_host/config_clang.h])
12881 AC_CONFIG_HEADERS([config_host/config_dconf.h])
12882 AC_CONFIG_HEADERS([config_host/config_eot.h])
12883 AC_CONFIG_HEADERS([config_host/config_extensions.h])
12884 AC_CONFIG_HEADERS([config_host/config_cairo_canvas.h])
12885 AC_CONFIG_HEADERS([config_host/config_cxxabi.h])
12886 AC_CONFIG_HEADERS([config_host/config_dbus.h])
12887 AC_CONFIG_HEADERS([config_host/config_features.h])
12888 AC_CONFIG_HEADERS([config_host/config_firebird.h])
12889 AC_CONFIG_HEADERS([config_host/config_folders.h])
12890 AC_CONFIG_HEADERS([config_host/config_fuzzers.h])
12891 AC_CONFIG_HEADERS([config_host/config_gio.h])
12892 AC_CONFIG_HEADERS([config_host/config_global.h])
12893 AC_CONFIG_HEADERS([config_host/config_gpgme.h])
12894 AC_CONFIG_HEADERS([config_host/config_java.h])
12895 AC_CONFIG_HEADERS([config_host/config_langs.h])
12896 AC_CONFIG_HEADERS([config_host/config_lgpl.h])
12897 AC_CONFIG_HEADERS([config_host/config_libcxx.h])
12898 AC_CONFIG_HEADERS([config_host/config_liblangtag.h])
12899 AC_CONFIG_HEADERS([config_host/config_libnumbertext.h])
12900 AC_CONFIG_HEADERS([config_host/config_locales.h])
12901 AC_CONFIG_HEADERS([config_host/config_mpl.h])
12902 AC_CONFIG_HEADERS([config_host/config_oox.h])
12903 AC_CONFIG_HEADERS([config_host/config_options.h])
12904 AC_CONFIG_HEADERS([config_host/config_options_calc.h])
12905 AC_CONFIG_HEADERS([config_host/config_typesizes.h])
12906 AC_CONFIG_HEADERS([config_host/config_vendor.h])
12907 AC_CONFIG_HEADERS([config_host/config_vcl.h])
12908 AC_CONFIG_HEADERS([config_host/config_vclplug.h])
12909 AC_CONFIG_HEADERS([config_host/config_version.h])
12910 AC_CONFIG_HEADERS([config_host/config_oauth2.h])
12911 AC_CONFIG_HEADERS([config_host/config_poppler.h])
12912 AC_CONFIG_HEADERS([config_host/config_python.h])
12913 AC_CONFIG_HEADERS([config_host/config_writerperfect.h])
12914 AC_OUTPUT
12916 if test "$CROSS_COMPILING" = TRUE; then
12917     (echo; echo export BUILD_TYPE_FOR_HOST=$BUILD_TYPE) >>config_build.mk
12920 # touch the config timestamp file
12921 if test ! -f config_host.mk.stamp; then
12922     echo > config_host.mk.stamp
12923 elif test "$config_sha256" = `$SHA256SUM config_host.mk | sed "s/ .*//"`; then
12924     echo "Host Configuration unchanged - avoiding scp2 stamp update"
12925 else
12926     echo > config_host.mk.stamp
12929 # touch the config lang timestamp file
12930 if test ! -f config_host_lang.mk.stamp; then
12931     echo > config_host_lang.mk.stamp
12932 elif test "$config_lang_sha256" = `$SHA256SUM config_host_lang.mk | sed "s/ .*//"`; then
12933     echo "Language Configuration unchanged - avoiding scp2 stamp update"
12934 else
12935     echo > config_host_lang.mk.stamp
12939 if test \( "$STALE_MAKE" = "TRUE" -o "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE" \) \
12940         -a "$build_os" = "cygwin"; then
12942 cat << _EOS
12943 ****************************************************************************
12944 WARNING:
12945 Your make version is known to be horribly slow, and hard to debug
12946 problems with. To get a reasonably functional make please do:
12948 to install a pre-compiled binary make for Win32
12950  mkdir -p /opt/lo/bin
12951  cd /opt/lo/bin
12952  wget https://dev-www.libreoffice.org/bin/cygwin/make-4.2.1-msvc.exe
12953  cp make-4.2.1-msvc.exe make
12954  chmod +x make
12956 to install from source:
12957 place yourself in a working directory of you choice.
12959  git clone git://git.savannah.gnu.org/make.git
12961  [go to Start menu, open "Visual Studio 2017", click "VS2017 x86 Native Tools Command Prompt" or "VS2017 x64 Native Tools Command Prompt"]
12962  set PATH=%PATH%;C:\Cygwin\bin
12963  [or Cygwin64, if that is what you have]
12964  cd path-to-make-repo-you-cloned-above
12965  build_w32.bat --without-guile
12967 should result in a WinRel/gnumake.exe.
12968 Copy it to the Cygwin /opt/lo/bin directory as make.exe
12970 Then re-run autogen.sh
12972 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
12973 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
12975 _EOS
12976 if test "$HAVE_GNUMAKE_FILE_FUNC" != "TRUE"; then
12977     AC_MSG_ERROR([no file function found; the build will fail without it; use GNU make 4.0 or later])
12982 cat << _EOF
12983 ****************************************************************************
12985 To build, run:
12986 $GNUMAKE
12988 To view some help, run:
12989 $GNUMAKE help
12991 _EOF
12993 if test $_os != WINNT -a "$CROSS_COMPILING" != TRUE; then
12994     cat << _EOF
12995 After the build of LibreOffice has finished successfully, you can immediately run LibreOffice using the command:
12996 _EOF
12998     if test $_os = Darwin; then
12999         echo open instdir/$PRODUCTNAME.app
13000     else
13001         echo instdir/program/soffice
13002     fi
13003     cat << _EOF
13005 If you want to run the smoketest, run:
13006 $GNUMAKE check
13008 _EOF
13011 if test -f warn; then
13012     cat warn
13013     rm warn
13016 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: